org.xith3d.scenegraph
Class Shape3D

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
All Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.spatial.SpatialNode
Direct Known Subclasses:
AbstractLODShape3D, Box, BSPTextureAnimatedShape, Cal3dSubmesh, Capsule, Character2D, Cone, Cylinder, Disk, Ellipsoid, FixedSizedBillboard, GeneratorShape3D, GeoEllipsoid, GeoSphere, Grid, Hemisphere, Line, Morph, MultiShape3D, NormalsVisualizer, Points, Quad, Sphere, Torus

public class Shape3D
extends Leaf

Shape3D is a class for all scene graph nodes that have no children. Leaf nodes specify lights, geometry, sounds, etc.


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
Shape3D()
          Constructs a new Shape3D object with a null geometry component and a null appearance component.
Shape3D(Geometry geometry)
          Constructs a new Shape3D object with specified geometry component and a null appearance component.
Shape3D(Geometry geometry, Appearance appearance)
          Constructs a new Shape3D object with specified geometry and appearance components.
 
Method Summary
 void absorbDetails(Node node)
          Turns the receiver into a shared copy of the node parameter.
protected  void copy(Shape3D dest)
           
 void freeOpenGLResources(CanvasPeer canvasPeer)
          This method frees OpenGL resources (names) for all Nodes in the traversal of this Node(-Group).
 Appearance getAppearance()
           
 Appearance getAppearance(boolean forceExistance)
          Returns this shape's Appearance, if it exists.
 java.lang.Comparable getCustomComparable()
          Returns the custom comparable object.
 Geometry getGeometry()
           
 boolean isBumpMappingEnabled()
           
 boolean isShadowReceiver()
           
 boolean isVisible()
          Checks, whether this Shape3D is visible.
 Appearance newAppearance()
          Creates a new appearance for this Shape3D and returns it.
protected  Shape3D newInstance()
           
 void setAppearance(Appearance appearance)
          Sets the appearance for this object.
 void setBounds(org.openmali.spatial.bounds.Bounds bounds)
          Sets the bounds for this object.
 void setBumpMappingEnabled(boolean enabled, java.lang.String normalMapTex)
           
 void setBumpMappingEnabled(boolean enabled, Texture normalMapTex)
           
 void setCustomComparable(java.lang.Comparable customComparable)
          Sets the custom comparable object.
 void setGeometry(Geometry geometry)
          Sets the geometry for this object.
 void setIsShadowReceiver(boolean isSR)
           
 void setModListener(ScenegraphModificationsListener modListener)
          
 void setVisible(boolean visible)
          Sets this Shape3D is visible or invisible.
 Shape3D sharedCopy()
          Creates a shared copy of this Node.
 Shape3D sharedCopy(CopyListener listener)
          Creates a shared copy of this Node.
 boolean traverse(DetailedTraversalCallback callback)
          Traverses the scenegraph from this node on.
 void updateBounds(boolean onlyDirty)
          Update bounds sets the bounds and virutal world bounds of all nodes recursively.
protected  void updateBoundsCheap(boolean onlyDirty, boolean childrenToo, boolean parentToo, boolean onlyWorld)
          Update bounds sets the bounds and virutal world bounds of all nodes recursively.
 void updateWorldTransform()
          If this is a TransformGroupm then it will multiply the transform against the parent transform and store it into the world-transform matrix.
 boolean verifyAppChange(OpenGLCapabilities glCaps)
           
 
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

Shape3D

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


Shape3D

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


Shape3D

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

Method Detail

setModListener

public void setModListener(ScenegraphModificationsListener modListener)

Overrides:
setModListener in class Node

setVisible

public void setVisible(boolean visible)
Sets this Shape3D is visible or invisible.


isVisible

public final boolean isVisible()
Checks, whether this Shape3D is visible.

If the Appearance or the Appearance's RenderingAttributes is null or the RenderingAttributes are set to invisible false is returned.


setBounds

public final void setBounds(org.openmali.spatial.bounds.Bounds bounds)
Sets the bounds for this object.

Overrides:
setBounds in class Node

updateBoundsCheap

protected void updateBoundsCheap(boolean onlyDirty,
                                 boolean childrenToo,
                                 boolean parentToo,
                                 boolean onlyWorld)
Update bounds sets the bounds and virutal world bounds of all nodes recursively.

Overrides:
updateBoundsCheap in class Node
Parameters:
onlyDirty - Only update those nodes which have been marked as dirty.
childrenToo - if false, the children bounds are not updated
parentToo - if false, the parent Node will not be updated
onlyWorld - if true, only the vworld bounds are updated

updateBounds

public void updateBounds(boolean onlyDirty)
Update bounds sets the bounds and virutal world bounds of all nodes recursively.

Overrides:
updateBounds in class Node
Parameters:
onlyDirty - Only update those nodes which have been marked as dirty.

updateWorldTransform

public final void updateWorldTransform()
If this is a TransformGroupm then it will multiply the transform against the parent transform and store it into the world-transform matrix. Never use this method on your own! It's just for internal use.

Overrides:
updateWorldTransform in class Node

setGeometry

public void setGeometry(Geometry geometry)
Sets the geometry for this object.

Parameters:
geometry - The new geometry

getGeometry

public Geometry getGeometry()
Returns:
the Geometry for this object.

setAppearance

public final void setAppearance(Appearance appearance)
Sets the appearance for this object.


getAppearance

public final Appearance getAppearance()
Returns:
the appearance for this object.

getAppearance

public Appearance getAppearance(boolean forceExistance)
Returns this shape's Appearance, if it exists. If it doesn't exist, it is created depending on the forceExistance parameter.

Parameters:
forceExistance - if true, a new Appearance is created and attached, if it doesn't already exist.
Returns:
the appearance for this object

newAppearance

public Appearance newAppearance()
Creates a new appearance for this Shape3D and returns it.

Returns:
A new appearance for this Shape3D

verifyAppChange

public final boolean verifyAppChange(OpenGLCapabilities glCaps)

setCustomComparable

public void setCustomComparable(java.lang.Comparable customComparable)
Sets the custom comparable object.
This object can be used for shape sorting, but isn't by default.

Parameters:
customComparable -

getCustomComparable

public final java.lang.Comparable getCustomComparable()
Returns the custom comparable object.
This object can be used for shape sorting, but isn't by default.

Returns:
the custom comparable object.

setBumpMappingEnabled

public final void setBumpMappingEnabled(boolean enabled,
                                        Texture normalMapTex)

setBumpMappingEnabled

public final void setBumpMappingEnabled(boolean enabled,
                                        java.lang.String normalMapTex)

isBumpMappingEnabled

public final boolean isBumpMappingEnabled()

setIsShadowReceiver

public final void setIsShadowReceiver(boolean isSR)

isShadowReceiver

public final boolean isShadowReceiver()

copy

protected void copy(Shape3D dest)

newInstance

protected Shape3D newInstance()
Returns:
a new instance of this class. This is invoked by the sharedCopy() method.
See Also:
sharedCopy(CopyListener)

sharedCopy

public Shape3D 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 Node
Returns:
a shared copy of this Node
See Also:
Node.absorbDetails(Node)

sharedCopy

public Shape3D 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 Node
Returns:
a shared copy of this Node
See Also:
Node.absorbDetails(Node)

absorbDetails

public void absorbDetails(Node node)
Turns the receiver into a shared copy of the node parameter. This is precisely the inverse operation of sharedCopy; i.e., shared copy creates a new node, but absorbDetails turns the current node into a copy exactly equivalent to what would be returned, if you created a new copy via the sharedCopy() method.

Overrides:
absorbDetails in class Node
Parameters:
node - the node to copy.
See Also:
Node.sharedCopy()

freeOpenGLResources

public void freeOpenGLResources(CanvasPeer canvasPeer)
This method frees OpenGL resources (names) for all Nodes in the traversal of this Node(-Group).

Specified by:
freeOpenGLResources in class Node

traverse

public boolean traverse(DetailedTraversalCallback callback)
Traverses the scenegraph from this node on. If this Node is a Group it will recusively run through each child.

Overrides:
traverse in class Leaf
Parameters:
callback - the listener is notified of any traversed Node on the way
Returns:
if false, the whole traversal will stop