public class OctTree extends BaseNode implements CustomCullable, TransformHierarchy
The core implementation is a fairly simplistic distance-based algorithm to determine when the level sets should be changed over. The class uses a single Node object for the low-detail model, and allows the provision of a set of nodes for the next detail level, allowing for nesting of the tree objects if required.
For describing the high-detail geometry, there is no specific geometric representation implied by this node. There are just up to 8 children that can be supplied, and that the user should make sure to place them in the correct octant location using transformations as required.
For bounds calculation, the bounds of the low-res model are used.
Internationalisation Resource Names
bounds, implicitBounds, INVALID_BOUNDS, parentalive, LISTENER_SET_TIMING_ERR_PROP, updateHandler| Constructor and Description |
|---|
OctTree()
Create a new empty instance of the oct tree.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkForCyclicChild(SceneGraphObject parent)
Check to see if this node is the same reference as the passed node that
is a parent of this node.
|
void |
cullChildren(CullInstructions output,
org.j3d.maths.vector.Matrix4d vworldTx,
org.j3d.maths.vector.Matrix4d viewTransform,
org.j3d.maths.vector.Vector4d[] frustumPlanes,
float angularRes)
Check this node for children to traverse.
|
void |
getHighDetail(Node[] geom)
Get the currently set low-detail geometry structure.
|
Node |
getLowDetail()
Get the currently set low-detail geometry structure.
|
float |
getRange()
Get the currently set range at which the high detail model will be
shown.
|
int |
numHighDetailGeom()
Get the number of valid high-detail children in use by this node.
|
protected void |
recomputeBounds()
Internal method to recalculate the implicit bounds of this Node.
|
void |
requestBoundsUpdate()
Request a recomputation of the bounds of this object.
|
void |
setHighDetail(Node[] geom,
int numValid)
Set the low-detail geometry instance to use.
|
protected void |
setLive(boolean state)
Notification that this object is live now.
|
void |
setLowDetail(Node geom)
Set the low-detail geometry instance to use.
|
void |
setRange(float distance)
Set the range at which this geometry should change from low-detail to
high-detail models.
|
protected void |
setUpdateHandler(NodeUpdateHandler handler)
Set the scenegraph update handler for this node.
|
checkForCyclicChild, checkForCyclicParent, clearUpdateHandler, removeParent, setLive, setParent, setUpdateHandlerboundsChanged, checkForCyclicParent, getBounds, getParent, markBoundsDirty, removeParent, setBounds, setParent, updateBounds, updateParentBoundsdataChanged, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, getUserData, isLive, setUserDatapublic OctTree()
public void cullChildren(CullInstructions output, org.j3d.maths.vector.Matrix4d vworldTx, org.j3d.maths.vector.Matrix4d viewTransform, org.j3d.maths.vector.Vector4d[] frustumPlanes, float angularRes)
cullChildren in interface CustomCullableoutput - Fill in the child information herevworldTx - The transformation from the root of the scene to
this node according to the current traversal pathviewTransform - The transformation from the root of the scene
graph to the active viewpointfrustumPlanes - Listing of frustum planes in the order: right,
left, bottom, top, far, nearangularRes - Angular resolution of the screen, or 0 if not
calculable from the available data.protected void recomputeBounds()
recomputeBounds in class Nodepublic void requestBoundsUpdate()
This will recurse down the children asking all of them to recompute the bounds. If a child is found to be during this process, that branch will not update, and thus the value used will be the last updated (ie from the previous frame it was processed).
requestBoundsUpdate in class Nodeprotected void checkForCyclicChild(SceneGraphObject parent) throws CyclicSceneGraphStructureException
checkForCyclicChild in class SceneGraphObjectparent - The reference to check against this classCyclicSceneGraphStructureException - Equal parent and childprotected void setUpdateHandler(NodeUpdateHandler handler)
setUpdateHandler in class SceneGraphObjecthandler - The instance to use as a handlerprotected void setLive(boolean state)
setLive in class SceneGraphObjectpublic void setRange(float distance)
throws IllegalArgumentException,
InvalidWriteTimingException
distance - The range at which the geometry should swapIllegalArgumentException - The range value was negativeInvalidWriteTimingException - An attempt was made to write outside
of the NodeUpdateListener bounds changed callback methodpublic float getRange()
public void setLowDetail(Node geom) throws InvalidWriteTimingException
geom - The sub scene graph to use for the low-detail geometryInvalidWriteTimingException - An attempt was made to write outside
of the NodeUpdateListener bounds changed callback methodpublic Node getLowDetail()
public void setHighDetail(Node[] geom, int numValid) throws InvalidWriteTimingException
geom - The sub scene graph list to use for the high-detail geometrynumValid - The number of valid bits of geometry to use from the arrayIllegalArgumentException - numValid was outside [0, 8]InvalidWriteTimingException - An attempt was made to write outside
of the NodeUpdateListener bounds changed callback methodpublic int numHighDetailGeom()
public void getHighDetail(Node[] geom)
geom - An array to copy the values into
Copyright © 2001 - 2015 j3d.org