org.xith3d.scenegraph
Class MultiShape3D

java.lang.Object
  extended by org.xith3d.scenegraph.SceneGraphObject
      extended by org.xith3d.scenegraph.Node
          extended by org.xith3d.scenegraph.Leaf
              extended by org.xith3d.scenegraph.Shape3D
                  extended by org.xith3d.scenegraph.MultiShape3D
All Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.spatial.SpatialNode
Direct Known Subclasses:
MultiCharacter2D

public class MultiShape3D
extends Shape3D

This is a Shape3D extension, that allows you to use multiple Geometries and Appearances for, of which only one set is active at a time.
This is comparable to a Switch node, but is more efficient for this task.


Field Summary
 
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
MultiShape3D()
          Constructs a new Shape3D object with a null geometry component and a null appearance component.
MultiShape3D(Geometry geometry)
          Constructs a new Shape3D object with specified geometry component and a null appearance component.
MultiShape3D(Geometry geometry, Appearance appearance)
          Constructs a new Shape3D object with specified geometry and appearance components.
 
Method Summary
 void addUnit(Geometry geometry, Appearance appearance)
          Adds an unnamed Shape-unit to the MultiShape3D.
 void addUnit(java.lang.String name, Geometry geometry, Appearance appearance)
          Adds a named Shape-unit to the MultiShape3D.
 int getActiveUnit()
           
 java.lang.String getActiveUnitName()
           
 int getNumberOfUnits()
           
 java.util.List<java.lang.String> getUnits()
           
 void setActiveUnit(int index)
          Sets the active unit.
 void setActiveUnit(java.lang.String name)
          Sets the active unit.
 void setModListener(ScenegraphModificationsListener modListener)
          
 
Methods inherited from class org.xith3d.scenegraph.Shape3D
absorbDetails, copy, freeOpenGLResources, getAppearance, getAppearance, getCustomComparable, getGeometry, isBumpMappingEnabled, isShadowReceiver, isVisible, newAppearance, newInstance, setAppearance, setBounds, setBumpMappingEnabled, setBumpMappingEnabled, setCustomComparable, setGeometry, setIsShadowReceiver, setVisible, sharedCopy, sharedCopy, traverse, updateBounds, updateBoundsCheap, updateWorldTransform, verifyAppChange
 
Methods inherited from class org.xith3d.scenegraph.Leaf
dump, getPickHost, setPickHost
 
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, mergeInheritedClipper, mergeInheritedNodes, mergeInheritedScissorRect, popGlobalIgnoreBounds, printBounds, pushGlobalIgnoreBounds, setBoundsAutoCompute, setBoundsDirty, setBoundsDirtyUpward, setBoundsTypeHint, setDefaultPickable, setGlobalIgnoreBounds, setIgnoreBounds, setIsOccluder, setOrderedChild, setParent, setPickable, setPickableRecursive, setPickableRecursive, setRenderable, setShadowAttachment, setShowBounds, setTransformGroup, setTreeCell, traverse, unmergeInheritedFog, unmergeInheritedLight, unmergeInheritedNodes, updateOrderedChild, updateTransformGroup
 
Methods inherited from class org.xith3d.scenegraph.SceneGraphObject
getName, getUserData, getUserData, getUserDataMap, isLive, setLive, 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

MultiShape3D

public MultiShape3D(Geometry geometry,
                    Appearance appearance)
Constructs a new Shape3D object with specified geometry and appearance components.


MultiShape3D

public MultiShape3D(Geometry geometry)
Constructs a new Shape3D object with specified geometry component and a null appearance component.


MultiShape3D

public MultiShape3D()
Constructs a new Shape3D object with a null geometry component and a null appearance component.

Method Detail

getUnits

public final java.util.List<java.lang.String> getUnits()
Returns:
an unmodifiable List of all available units in this MultiShape3D.

getNumberOfUnits

public final int getNumberOfUnits()
Returns:
the number of units in this MultiShape3D.

getActiveUnit

public final int getActiveUnit()
Returns:
the active unit's index

getActiveUnitName

public final java.lang.String getActiveUnitName()
Returns:
the active unit's name

setActiveUnit

public void setActiveUnit(int index)
Sets the active unit.

Parameters:
index -

setActiveUnit

public void setActiveUnit(java.lang.String name)
Sets the active unit.

Parameters:
name -

addUnit

public void addUnit(java.lang.String name,
                    Geometry geometry,
                    Appearance appearance)
Adds a named Shape-unit to the MultiShape3D.

Parameters:
name -
geometry -
appearance -

addUnit

public void addUnit(Geometry geometry,
                    Appearance appearance)
Adds an unnamed Shape-unit to the MultiShape3D.

Parameters:
geometry -
appearance -

setModListener

public void setModListener(ScenegraphModificationsListener modListener)

Overrides:
setModListener in class Shape3D