Java Code Examples for com.jme3.bounding.BoundingBox#setXExtent()
The following examples show how to use
com.jme3.bounding.BoundingBox#setXExtent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FastOctnode.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private static void findChildBound(BoundingBox bbox, int side){ float extent = bbox.getXExtent() * 0.5f; bbox.getCenter().set(bbox.getCenter().x + extent * Octnode.extentMult[side].x, bbox.getCenter().y + extent * Octnode.extentMult[side].y, bbox.getCenter().z + extent * Octnode.extentMult[side].z); bbox.setXExtent(extent); bbox.setYExtent(extent); bbox.setZExtent(extent); }
Example 2
Source File: Octree.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public Octree(Spatial scene, int minTrisPerNode){ scene.updateGeometricState(); List<Geometry> geomsList = getGeometries(scene); geoms = new Geometry[geomsList.size()]; geomsList.toArray(geoms); // generate bound box for all geom bbox = new BoundingBox(); for (Geometry geom : geoms){ BoundingVolume bv = geom.getWorldBound(); bbox.mergeLocal(bv); } // set largest extent float extent = Math.max(bbox.getXExtent(), Math.max(bbox.getYExtent(), bbox.getZExtent())); bbox.setXExtent(extent); bbox.setYExtent(extent); bbox.setZExtent(extent); this.minTrisPerNode = minTrisPerNode; Triangle t = new Triangle(); for (int g = 0; g < geoms.length; g++){ Mesh m = geoms[g].getMesh(); for (int i = 0; i < m.getTriangleCount(); i++){ m.getTriangle(i, t); OCTTriangle ot = new OCTTriangle(t.get1(), t.get2(), t.get3(), i, g); allTris.add(ot); // convert triangle to world space // geom.getWorldTransform().transformVector(t.get1(), t.get1()); // geom.getWorldTransform().transformVector(t.get2(), t.get2()); // geom.getWorldTransform().transformVector(t.get3(), t.get3()); } } }