org.xith3d.scenegraph
Class LODSwitch

java.lang.Object
  extended by org.xith3d.scenegraph.SceneGraphObject
      extended by org.xith3d.scenegraph.Node
          extended by org.xith3d.scenegraph.GroupNode
              extended by org.xith3d.scenegraph.Group
                  extended by org.xith3d.scenegraph.Switch
                      extended by org.xith3d.scenegraph.LODSwitch
All Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.spatial.SpatialNode

public class LODSwitch
extends Switch

The LODSwitch is a Switch Node extension, that handles its children as discrete LOD items. Discrete LOD (level of detail) is a technique, that selects an item depending on its distance to the camera. Don't use the regular addChild() methods of the NodeGroup interface, that are inherited, but the addLODItem() methods.

See Also:
AbstractLODShape3D

Field Summary
 
Fields inherited from class org.xith3d.scenegraph.Switch
CHILD_ALL, CHILD_MASK, CHILD_NONE
 
Fields inherited from class org.xith3d.scenegraph.GroupNode
children, hostGroup, numChildren, totalNumChildren, totalNumShapes
 
Fields inherited from class org.xith3d.scenegraph.Node
bounds, boundsAutoCompute, boundsDirty, globalIgnoreBounds, instanceBoundsTypeHint, transformGroup, untransformedBounds
 
Fields inherited from class org.xith3d.scenegraph.SceneGraphObject
XITH3D_USERDATAKEY_OLDUSERDATA
 
Constructor Summary
LODSwitch()
           
 
Method Summary
 int addLODItem(Node item, float minDist, float maxDist)
           
 float getMaxDist(int index)
           
 float getMaxDist(Node item)
           
 float getMinDist(int index)
           
 float getMinDist(Node item)
           
protected  LODSwitch newInstance()
          
 void removeLODItem(int index)
           
 void removeLODItem(Node node)
           
protected  void setLODChild(int index)
           
 void setLODItem(int index, float minDist, float maxDist)
           
protected  void setLODItem(int index, Node item, boolean itemChanged, float minDist, float maxDist)
           
 void setLODItem(int index, Node item, float minDist, float maxDist)
           
 void setWhichChild(int whichChild)
          Deprecated. just because it is unsupported.
 LODSwitch sharedCopy()
          Creates a shared copy of this Node.
 LODSwitch sharedCopy(CopyListener listener)
          Creates a shared copy of this Node.
 void updateWhichChild(org.openmali.vecmath2.Point3f viewPosition)
          Called by the Renderer to make the LODSwitch select the right item for the given view position.
 
Methods inherited from class org.xith3d.scenegraph.Switch
getChildMask, getCurrentChild, getIgnoreMaskForTraversal, getWhichChild, isVisible, removeChild, setChildMask, setIgnoreMaskForTraversal, traverse, traverse
 
Methods inherited from class org.xith3d.scenegraph.Group
moveTo
 
Methods inherited from class org.xith3d.scenegraph.GroupNode
absorbDetails, addChild, addChild, checkChild, dump, dump, ensureCapacity, expandBounds, findAll, findAll, findFirst, findFirst, freeOpenGLResources, getChild, getChildren, getChildren, getClipper, getPickHost, getScissorRect, getTotalNumChildren, getTotalNumShapes, indexOf, isPickHost, mergeInheritedClipper, mergeInheritedNodes, mergeInheritedScissorRect, numChildren, removeAllChildren, removeChild, setBoundsDirty, setBoundsDirtyUpward, setChild, setClipper, setLive, setPickHost, setPickHost, setScissorRect, setShowBounds, unmergeInheritedFog, unmergeInheritedLight, unmergeInheritedNodes, updateBounds, updateBoundsCheap
 
Methods inherited from class org.xith3d.scenegraph.Node
cloneNode, detach, duplicateNode, freeOpenGLResources, getBounds, getBoundsAutoCompute, getBoundsType, getBoundsTypeHint, getDefaultPickable, getIndentString, getInheritedNodeAttributes, getModListener, getOrderedChild, getOrderedState, getParent, getRoot, getShadowAttachment, getShowBounds, getTransformGroup, getTreeCell, getWorldBounds, getWorldTransform, getWorldTransform, isBillboard, isIgnoreBounds, isOccluder, isPickable, isRenderable, isUpdatableNode, popGlobalIgnoreBounds, printBounds, pushGlobalIgnoreBounds, setBounds, setBoundsAutoCompute, setBoundsTypeHint, setDefaultPickable, setGlobalIgnoreBounds, setIgnoreBounds, setIsOccluder, setModListener, setOrderedChild, setParent, setPickable, setPickableRecursive, setPickableRecursive, setRenderable, setShadowAttachment, setShowBounds, setTransformGroup, setTreeCell, updateOrderedChild, updateTransformGroup, updateWorldTransform
 
Methods inherited from class org.xith3d.scenegraph.SceneGraphObject
getName, getUserData, getUserData, getUserDataMap, isLive, setName, setUserData, setUserData, setUserDataRecursive, setUserDataRecursive, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LODSwitch

public LODSwitch()
Method Detail

getMinDist

public final float getMinDist(int index)
Parameters:
index - the index of the LOD item of interest
Returns:
the minimal distance of the LOD item

getMinDist

public final float getMinDist(Node item)
Parameters:
item - the LOD item of interest
Returns:
the minimal distance of the LOD item

getMaxDist

public final float getMaxDist(int index)
Parameters:
index - the index of the LOD item of interest
Returns:
the maximal distance of the LOD item

getMaxDist

public final float getMaxDist(Node item)
Parameters:
item - the LOD item of interest
Returns:
the maximal distance of the LOD item

setLODChild

protected void setLODChild(int index)
Parameters:
index -

setWhichChild

@Deprecated
public void setWhichChild(int whichChild)
Deprecated. just because it is unsupported.

Unsupported for LODSwitch

Overrides:
setWhichChild in class Switch

updateWhichChild

public void updateWhichChild(org.openmali.vecmath2.Point3f viewPosition)
Called by the Renderer to make the LODSwitch select the right item for the given view position.


addLODItem

public int addLODItem(Node item,
                      float minDist,
                      float maxDist)

setLODItem

protected void setLODItem(int index,
                          Node item,
                          boolean itemChanged,
                          float minDist,
                          float maxDist)

setLODItem

public final void setLODItem(int index,
                             Node item,
                             float minDist,
                             float maxDist)

setLODItem

public final void setLODItem(int index,
                             float minDist,
                             float maxDist)

removeLODItem

public void removeLODItem(int index)

removeLODItem

public void removeLODItem(Node node)

newInstance

protected LODSwitch newInstance()

Overrides:
newInstance in class Switch
Returns:
a new instance of this class. This is invoked by the sharedCopy() method.
See Also:
GroupNode.sharedCopy(CopyListener)

sharedCopy

public LODSwitch sharedCopy(CopyListener listener)
Creates a shared copy of this Node. A shared copy is one where the geometry and appearance is shared, but everything else is copied. This is a replacement for shared groups because of performance considerations. If you are loading the same model many times then this can save on memory and load times. The only allowable within the subtree are groups and shapes. This also copies a shapes bounds and turns autocomute off so that it is fast to insert the model into the scene.

Overrides:
sharedCopy in class GroupNode
Returns:
a shared copy of this Node
See Also:
Node.absorbDetails(Node)

sharedCopy

public LODSwitch sharedCopy()
Creates a shared copy of this Node. A shared copy is one where the geometry and appearance is shared, but everything else is copied. This is a replacement for shared groups because of performance considerations. If you are loading the same model many times then this can save on memory and load times. The only allowable within the subtree are groups and shapes. This also copies a shapes bounds and turns autocomute off so that it is fast to insert the model into the scene.

Overrides:
sharedCopy in class GroupNode
Returns:
a shared copy of this Node
See Also:
Node.absorbDetails(Node)