public class OctreeNode extends BoundedSceneObject
Modifier and Type | Field and Description |
---|---|
static int |
CHILDREN_PER_NODE |
Constructor and Description |
---|
OctreeNode(int minimumObjectsPerNode,
int maximumObjectsPerNode,
Vector3 center,
float dimension)
Create a new octree
|
Modifier and Type | Method and Description |
---|---|
void |
addObject(BoundedSceneObject sceneObject)
Insert an object into the octree
Note that the inserted object must provide a none-null aabb!
|
void |
attachTo(SceneNode node)
Attaches this object to a SceneNode
|
SceneNode |
detach()
Detaches this node from its parent
|
AABB |
getBoundingBox() |
OctreeNode |
getParentOctree() |
void |
merge() |
void |
query(ISceneQuery query) |
boolean |
removeObject(BoundedSceneObject sceneObject)
Remove a sceneObject
|
void |
setBoundingBoxVisible(boolean visible) |
void |
setDirty() |
void |
update()
Update the tree (check the partitions, merging, splitting, etc)
|
isDity, onTransformed, setClean
getAbsolutePos, getModelMatrix, getParent, getRelativePos
public static final int CHILDREN_PER_NODE
public OctreeNode(int minimumObjectsPerNode, int maximumObjectsPerNode, Vector3 center, float dimension)
minimumObjectsPerNode
- The minimum number of objects held before merging nodesmaximumObjectsPerNode
- The maximum number of objects in a node before splitting
May be exceeded due to objects not insertable into child nodescenter
- Center of this octreedimension
- Size of the octree in each directionpublic void addObject(BoundedSceneObject sceneObject)
sceneObject
- The sceneobject to be insertedpublic boolean removeObject(BoundedSceneObject sceneObject)
sceneObject
- The sceneobject to be removedpublic void update()
public AABB getBoundingBox()
getBoundingBox
in class BoundedSceneObject
public void setBoundingBoxVisible(boolean visible)
setBoundingBoxVisible
in class BoundedSceneObject
public void merge()
public void attachTo(SceneNode node)
SceneObject
attachTo
in class BoundedSceneObject
node
- The node onto which this SceneObject will be attachedpublic SceneNode detach()
SceneObject
detach
in class BoundedSceneObject
public void query(ISceneQuery query)
public OctreeNode getParentOctree()
public void setDirty()