com.jme3.scene
Class Spatial

java.lang.Object
  extended by com.jme3.scene.Spatial
All Implemented Interfaces:
CloneableSmartAsset, Collidable, Savable, java.lang.Cloneable
Direct Known Subclasses:
BlenderKey.LoadingResults, Geometry, Node

public abstract class Spatial
extends java.lang.Object
implements Savable, java.lang.Cloneable, Collidable, CloneableSmartAsset

Spatial defines the base class for scene graph nodes. It maintains a link to a parent, it's local transforms and the world's transforms. All other scene graph elements, such as Node and Geometry are subclasses of Spatial.


Nested Class Summary
static class Spatial.BatchHint
          Specifies if this spatial should be batched
static class Spatial.CullHint
          Specifies how frustum culling should be handled by this spatial.
 
Field Summary
protected  Spatial.BatchHint batchHint
           
protected  SafeArrayList<Control> controls
           
protected  Spatial.CullHint cullHint
           
protected  Camera.FrustumIntersect frustrumIntersects
           
protected  AssetKey key
          Used for smart asset caching
protected  LightList localLights
          LightList
protected  Transform localTransform
           
protected  java.lang.String name
          This spatial's name.
protected  Node parent
          Spatial's parent, or null if it has none.
protected  RenderQueue.Bucket queueBucket
           
 float queueDistance
           
protected  int refreshFlags
          Refresh flags.
protected static int RF_BOUND
          Refresh flag types
protected static int RF_LIGHTLIST
          Refresh flag types
protected static int RF_TRANSFORM
          Refresh flag types
protected  RenderQueue.ShadowMode shadowMode
           
protected  java.util.HashMap<java.lang.String,Savable> userData
           
protected  BoundingVolume worldBound
          Spatial's bounding volume relative to the world.
protected  LightList worldLights
           
protected  Transform worldTransform
           
 
Constructor Summary
Spatial()
          Serialization only.
Spatial(java.lang.String name)
          Constructor instantiates a new Spatial object setting the rotation, translation and scale value to defaults.
 
Method Summary
 void addControl(Control control)
          Add a control to the list of controls.
 void addLight(Light light)
          addLight adds the given light to the Spatial; causing all child Spatials to be effected by it.
 void breadthFirstTraversal(SceneGraphVisitor visitor)
          Visit each scene graph element ordered by BFS
protected abstract  void breadthFirstTraversal(SceneGraphVisitor visitor, java.util.Queue<Spatial> queue)
           
 Spatial center()
          Centers the spatial in the origin of the world bound.
 boolean checkCulling(Camera cam)
          checkCulling checks the spatial with the camera to see if it should be culled.
 Spatial clone()
          Creates a clone of the asset.
 Spatial clone(boolean cloneMaterial)
           
abstract  Spatial deepClone()
           
abstract  void depthFirstTraversal(SceneGraphVisitor visitor)
          Visit each scene graph element ordered by DFS
 Spatial.BatchHint getBatchHint()
           
<T extends Control>
T
getControl(java.lang.Class<T> controlType)
          Returns the first control that is an instance of the given class, or null if no such control exists.
 Control getControl(int index)
          Returns the control at the given index in the list.
 Spatial.CullHint getCullHint()
           
 AssetKey getKey()
          Returns the asset key that is used to track this asset for garbage collection.
 Camera.FrustumIntersect getLastFrustumIntersection()
          Returns this spatial's last frustum intersection result.
 Spatial.BatchHint getLocalBatchHint()
           
 Spatial.CullHint getLocalCullHint()
           
 LightList getLocalLightList()
          Returns the local LightList, which are the lights that were directly attached to this Spatial through the addLight(com.jme3.light.Light) and removeLight(com.jme3.light.Light) methods.
 RenderQueue.Bucket getLocalQueueBucket()
           
 Quaternion getLocalRotation()
          getLocalRotation retrieves the local rotation of this node.
 Vector3f getLocalScale()
          getLocalScale retrieves the local scale of this node.
 RenderQueue.ShadowMode getLocalShadowMode()
           
 Matrix4f getLocalToWorldMatrix(Matrix4f store)
          Creates a transform matrix that will convert from this spatials' local coordinate space to the world coordinate space based on the world transform.
 Transform getLocalTransform()
          getLocalTransform retrieves the local transform of this spatial.
 Vector3f getLocalTranslation()
          getLocalTranslation retrieves the local translation of this node.
 java.lang.String getName()
          Returns the name of this spatial.
 int getNumControls()
           
 Node getParent()
          getParent retrieves this node's parent.
 RenderQueue.Bucket getQueueBucket()
          Returns this spatial's renderqueue bucket.
 RenderQueue.ShadowMode getShadowMode()
           
abstract  int getTriangleCount()
           
<T> T
getUserData(java.lang.String key)
           
 java.util.Collection<java.lang.String> getUserDataKeys()
           
abstract  int getVertexCount()
           
 BoundingVolume getWorldBound()
          getWorldBound retrieves the world bound at this node level.
 LightList getWorldLightList()
          Returns the world LightList, containing the lights combined from all this Spatial's parents up to and including this Spatial's lights.
 Quaternion getWorldRotation()
          getWorldRotation retrieves the absolute rotation of the Spatial.
 Vector3f getWorldScale()
          getWorldScale retrieves the absolute scale factor of the spatial.
 Transform getWorldTransform()
          getWorldTransform retrieves the world transformation of the spatial.
 Vector3f getWorldTranslation()
          getWorldTranslation retrieves the absolute translation of the spatial.
 boolean hasAncestor(Node ancestor)
          determines if the provided Node is the parent, or parent's parent, etc.
 Vector3f localToWorld(Vector3f in, Vector3f store)
          Convert a vector (in) from this spatials' local coordinate space to world coordinate space.
 void lookAt(Vector3f position, Vector3f upVector)
          lookAt is a convenience method for auto-setting the local rotation based on a position and an up vector.
 boolean matches(java.lang.Class<? extends Spatial> spatialSubclass, java.lang.String nameRegex)
          Note that we are matching the pattern, therefore the pattern must match the entire pattern (i.e.
 Spatial move(float x, float y, float z)
          Translates the spatial by the given translation vector.
 Spatial move(Vector3f offset)
          Translates the spatial by the given translation vector.
 void read(JmeImporter im)
           
 void removeControl(java.lang.Class<? extends Control> controlType)
          Removes the first control that is an instance of the given class.
 boolean removeControl(Control control)
          Removes the given control from this spatial's controls.
 boolean removeFromParent()
          removeFromParent removes this Spatial from it's parent.
 void removeLight(Light light)
          removeLight removes the given light from the Spatial.
 Spatial rotate(float xAngle, float yAngle, float zAngle)
          Rotates the spatial by the xAngle, yAngle and zAngle angles (in radians), (aka pitch, yaw, roll) in the local coordinate space.
 Spatial rotate(Quaternion rot)
          Rotates the spatial by the given rotation.
 void rotateUpTo(Vector3f newUp)
          rotateUpTo is a utility function that alters the local rotation to point the Y axis in the direction given by newUp.
 void runControlRender(RenderManager rm, ViewPort vp)
          Called when the Spatial is about to be rendered, to notify controls attached to this Spatial using the Control.render() method.
 Spatial scale(float s)
          Scales the spatial by the given value
 Spatial scale(float x, float y, float z)
          Scales the spatial by the given scale vector.
 void setBatchHint(Spatial.BatchHint hint)
          setBatchHint sets how batching should work on this spatial.
protected  void setBoundRefresh()
          Indicate that the bounding of this spatial has changed and that a refresh is required.
 void setCullHint(Spatial.CullHint hint)
          setCullHint sets how scene culling should work on this spatial during drawing.
 void setKey(AssetKey key)
          Set by the AssetManager to track this asset.
 void setLastFrustumIntersection(Camera.FrustumIntersect intersects)
          Overrides the last intersection result.
protected  void setLightListRefresh()
           
 void setLocalRotation(Matrix3f rotation)
          setLocalRotation sets the local rotation of this node by using a Matrix3f.
 void setLocalRotation(Quaternion quaternion)
          setLocalRotation sets the local rotation of this node.
 void setLocalScale(float localScale)
          setLocalScale sets the local scale of this node.
 void setLocalScale(float x, float y, float z)
          setLocalScale sets the local scale of this node.
 void setLocalScale(Vector3f localScale)
          setLocalScale sets the local scale of this node.
 void setLocalTransform(Transform t)
          setLocalTransform sets the local transform of this spatial.
 void setLocalTranslation(float x, float y, float z)
          setLocalTranslation sets the local translation of this spatial.
 void setLocalTranslation(Vector3f localTranslation)
          setLocalTranslation sets the local translation of this spatial.
 void setLodLevel(int lod)
          Sets the level of detail to use when rendering this Spatial, this call propagates to all geometries under this Spatial.
 void setMaterial(Material material)
          Applies the given material to the Spatial, this will propagate the material down to the geometries in the scene graph.
abstract  void setModelBound(BoundingVolume modelBound)
          setModelBound sets the bounding object for this Spatial.
 void setName(java.lang.String name)
          Sets the name of this spatial.
protected  void setParent(Node parent)
          Called by Node.attachChild(Spatial) and Node.detachChild(Spatial) - don't call directly.
 void setQueueBucket(RenderQueue.Bucket queueBucket)
          setQueueBucket determines at what phase of the rendering process this Spatial will rendered.
 void setShadowMode(RenderQueue.ShadowMode shadowMode)
          Sets the shadow mode of the spatial The shadow mode determines how the spatial should be shadowed, when a shadowing technique is used.
protected  void setTransformRefresh()
          Indicate that the transform of this spatial has changed and that a refresh is required.
 void setUserData(java.lang.String key, java.lang.Object data)
           
 java.lang.String toString()
          Returns the Spatial's name followed by the class of the spatial
Example: "MyNode (com.jme3.scene.Spatial)
 void updateGeometricState()
          updateGeometricState updates the lightlist, computes the world transforms, and computes the world bounds for this Spatial.
 void updateLogicalState(float tpf)
          updateLogicalState calls the update() method for all controls attached to this Spatial.
abstract  void updateModelBound()
          updateModelBound recalculates the bounding object for this Spatial.
protected  void updateWorldBound()
          Should be overridden by Node and Geometry.
protected  void updateWorldLightList()
           
protected  void updateWorldTransforms()
          Should only be called from updateGeometricState().
 Vector3f worldToLocal(Vector3f in, Vector3f store)
          Convert a vector (in) from world coordinate space to this spatials' local coordinate space.
 void write(JmeExporter ex)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jme3.collision.Collidable
collideWith
 

Field Detail

RF_TRANSFORM

protected static final int RF_TRANSFORM
Refresh flag types

See Also:
Constant Field Values

RF_BOUND

protected static final int RF_BOUND
Refresh flag types

See Also:
Constant Field Values

RF_LIGHTLIST

protected static final int RF_LIGHTLIST
Refresh flag types

See Also:
Constant Field Values

cullHint

protected Spatial.CullHint cullHint

batchHint

protected Spatial.BatchHint batchHint

worldBound

protected BoundingVolume worldBound
Spatial's bounding volume relative to the world.


localLights

protected LightList localLights
LightList


worldLights

protected transient LightList worldLights

name

protected java.lang.String name
This spatial's name.


frustrumIntersects

protected transient Camera.FrustumIntersect frustrumIntersects

queueBucket

protected RenderQueue.Bucket queueBucket

shadowMode

protected RenderQueue.ShadowMode shadowMode

queueDistance

public transient float queueDistance

localTransform

protected Transform localTransform

worldTransform

protected Transform worldTransform

controls

protected SafeArrayList<Control> controls

userData

protected java.util.HashMap<java.lang.String,Savable> userData

key

protected AssetKey key
Used for smart asset caching

See Also:
AssetKey#useSmartCache()

parent

protected transient Node parent
Spatial's parent, or null if it has none.


refreshFlags

protected transient int refreshFlags
Refresh flags. Indicate what data of the spatial need to be updated to reflect the correct state.

Constructor Detail

Spatial

public Spatial()
Serialization only. Do not use.


Spatial

public Spatial(java.lang.String name)
Constructor instantiates a new Spatial object setting the rotation, translation and scale value to defaults.

Parameters:
name - the name of the scene element. This is required for identification and comparison purposes.
Method Detail

setKey

public void setKey(AssetKey key)
Description copied from interface: CloneableSmartAsset
Set by the AssetManager to track this asset. Only clones of the asset has this set, the original copy that was loaded has this key set to null so that only the clones are tracked for garbage collection.

Specified by:
setKey in interface CloneableSmartAsset
Parameters:
key - The AssetKey to set

getKey

public AssetKey getKey()
Description copied from interface: CloneableSmartAsset
Returns the asset key that is used to track this asset for garbage collection.

Specified by:
getKey in interface CloneableSmartAsset
Returns:
the asset key that is used to track this asset for garbage collection.

setTransformRefresh

protected void setTransformRefresh()
Indicate that the transform of this spatial has changed and that a refresh is required.


setLightListRefresh

protected void setLightListRefresh()

setBoundRefresh

protected void setBoundRefresh()
Indicate that the bounding of this spatial has changed and that a refresh is required.


checkCulling

public boolean checkCulling(Camera cam)
checkCulling checks the spatial with the camera to see if it should be culled.

This method is called by the renderer. Usually it should not be called directly.

Parameters:
cam - The camera to check against.
Returns:
true if inside or intersecting camera frustum (should be rendered), false if outside.

setName

public void setName(java.lang.String name)
Sets the name of this spatial.

Parameters:
name - The spatial's new name.

getName

public java.lang.String getName()
Returns the name of this spatial.

Returns:
This spatial's name.

getLocalLightList

public LightList getLocalLightList()
Returns the local LightList, which are the lights that were directly attached to this Spatial through the addLight(com.jme3.light.Light) and removeLight(com.jme3.light.Light) methods.

Returns:
The local light list

getWorldLightList

public LightList getWorldLightList()
Returns the world LightList, containing the lights combined from all this Spatial's parents up to and including this Spatial's lights.

Returns:
The combined world light list

getWorldRotation

public Quaternion getWorldRotation()
getWorldRotation retrieves the absolute rotation of the Spatial.

Returns:
the Spatial's world rotation quaternion.

getWorldTranslation

public Vector3f getWorldTranslation()
getWorldTranslation retrieves the absolute translation of the spatial.

Returns:
the Spatial's world tranlsation vector.

getWorldScale

public Vector3f getWorldScale()
getWorldScale retrieves the absolute scale factor of the spatial.

Returns:
the Spatial's world scale factor.

getWorldTransform

public Transform getWorldTransform()
getWorldTransform retrieves the world transformation of the spatial.

Returns:
the world transform.

rotateUpTo

public void rotateUpTo(Vector3f newUp)
rotateUpTo is a utility function that alters the local rotation to point the Y axis in the direction given by newUp.

Parameters:
newUp - the up vector to use - assumed to be a unit vector.

lookAt

public void lookAt(Vector3f position,
                   Vector3f upVector)
lookAt is a convenience method for auto-setting the local rotation based on a position and an up vector. It computes the rotation to transform the z-axis to point onto 'position' and the y-axis to 'up'. Unlike Quaternion.lookAt(com.jme3.math.Vector3f, com.jme3.math.Vector3f) this method takes a world position to look at and not a relative direction.

Parameters:
position - where to look at in terms of world coordinates
upVector - a vector indicating the (local) up direction. (typically {0, 1, 0} in jME.)

updateWorldBound

protected void updateWorldBound()
Should be overridden by Node and Geometry.


updateWorldLightList

protected void updateWorldLightList()

updateWorldTransforms

protected void updateWorldTransforms()
Should only be called from updateGeometricState(). In most cases should not be subclassed.


runControlRender

public void runControlRender(RenderManager rm,
                             ViewPort vp)
Called when the Spatial is about to be rendered, to notify controls attached to this Spatial using the Control.render() method.

Parameters:
rm - The RenderManager rendering the Spatial.
vp - The ViewPort to which the Spatial is being rendered to.
See Also:
addControl(com.jme3.scene.control.Control), getControl(java.lang.Class)

addControl

public void addControl(Control control)
Add a control to the list of controls.

Parameters:
control - The control to add.
See Also:
removeControl(java.lang.Class)

removeControl

public void removeControl(java.lang.Class<? extends Control> controlType)
Removes the first control that is an instance of the given class.

See Also:
addControl(com.jme3.scene.control.Control)

removeControl

public boolean removeControl(Control control)
Removes the given control from this spatial's controls.

Parameters:
control - The control to remove
Returns:
True if the control was successfuly removed. False if the control is not assigned to this spatial.
See Also:
addControl(com.jme3.scene.control.Control)

getControl

public <T extends Control> T getControl(java.lang.Class<T> controlType)
Returns the first control that is an instance of the given class, or null if no such control exists.

Parameters:
controlType - The superclass of the control to look for.
Returns:
The first instance in the list of the controlType class, or null.
See Also:
addControl(com.jme3.scene.control.Control)

getControl

public Control getControl(int index)
Returns the control at the given index in the list.

Parameters:
index - The index of the control in the list to find.
Returns:
The control at the given index.
Throws:
java.lang.IndexOutOfBoundsException - If the index is outside the range [0, getNumControls()-1]
See Also:
addControl(com.jme3.scene.control.Control)

getNumControls

public int getNumControls()
Returns:
The number of controls attached to this Spatial.
See Also:
addControl(com.jme3.scene.control.Control), removeControl(java.lang.Class)

updateLogicalState

public void updateLogicalState(float tpf)
updateLogicalState calls the update() method for all controls attached to this Spatial.

Parameters:
tpf - Time per frame.
See Also:
addControl(com.jme3.scene.control.Control)

updateGeometricState

public void updateGeometricState()
updateGeometricState updates the lightlist, computes the world transforms, and computes the world bounds for this Spatial. Calling this when the Spatial is attached to a node will cause undefined results. User code should only call this method on Spatials having no parent.

See Also:
getWorldLightList(), getWorldTransform(), getWorldBound()

localToWorld

public Vector3f localToWorld(Vector3f in,
                             Vector3f store)
Convert a vector (in) from this spatials' local coordinate space to world coordinate space.

Parameters:
in - vector to read from
store - where to write the result (null to create a new vector, may be same as in)
Returns:
the result (store)

worldToLocal

public Vector3f worldToLocal(Vector3f in,
                             Vector3f store)
Convert a vector (in) from world coordinate space to this spatials' local coordinate space.

Parameters:
in - vector to read from
store - where to write the result
Returns:
the result (store)

getParent

public Node getParent()
getParent retrieves this node's parent. If the parent is null this is the root node.

Returns:
the parent of this node.

setParent

protected void setParent(Node parent)
Called by Node.attachChild(Spatial) and Node.detachChild(Spatial) - don't call directly. setParent sets the parent of this node.

Parameters:
parent - the parent of this node.

removeFromParent

public boolean removeFromParent()
removeFromParent removes this Spatial from it's parent.

Returns:
true if it has a parent and performed the remove.

hasAncestor

public boolean hasAncestor(Node ancestor)
determines if the provided Node is the parent, or parent's parent, etc. of this Spatial.

Parameters:
ancestor - the ancestor object to look for.
Returns:
true if the ancestor is found, false otherwise.

getLocalRotation

public Quaternion getLocalRotation()
getLocalRotation retrieves the local rotation of this node.

Returns:
the local rotation of this node.

setLocalRotation

public void setLocalRotation(Matrix3f rotation)
setLocalRotation sets the local rotation of this node by using a Matrix3f.

Parameters:
rotation - the new local rotation.

setLocalRotation

public void setLocalRotation(Quaternion quaternion)
setLocalRotation sets the local rotation of this node.

Parameters:
quaternion - the new local rotation.

getLocalScale

public Vector3f getLocalScale()
getLocalScale retrieves the local scale of this node.

Returns:
the local scale of this node.

setLocalScale

public void setLocalScale(float localScale)
setLocalScale sets the local scale of this node.

Parameters:
localScale - the new local scale, applied to x, y and z

setLocalScale

public void setLocalScale(float x,
                          float y,
                          float z)
setLocalScale sets the local scale of this node.


setLocalScale

public void setLocalScale(Vector3f localScale)
setLocalScale sets the local scale of this node.

Parameters:
localScale - the new local scale.

getLocalTranslation

public Vector3f getLocalTranslation()
getLocalTranslation retrieves the local translation of this node.

Returns:
the local translation of this node.

setLocalTranslation

public void setLocalTranslation(Vector3f localTranslation)
setLocalTranslation sets the local translation of this spatial.

Parameters:
localTranslation - the local translation of this spatial.

setLocalTranslation

public void setLocalTranslation(float x,
                                float y,
                                float z)
setLocalTranslation sets the local translation of this spatial.


setLocalTransform

public void setLocalTransform(Transform t)
setLocalTransform sets the local transform of this spatial.


getLocalTransform

public Transform getLocalTransform()
getLocalTransform retrieves the local transform of this spatial.

Returns:
the local transform of this spatial.

setMaterial

public void setMaterial(Material material)
Applies the given material to the Spatial, this will propagate the material down to the geometries in the scene graph.

Parameters:
material - The material to set.

addLight

public void addLight(Light light)
addLight adds the given light to the Spatial; causing all child Spatials to be effected by it.

Parameters:
light - The light to add.

removeLight

public void removeLight(Light light)
removeLight removes the given light from the Spatial.

Parameters:
light - The light to remove.
See Also:
addLight(com.jme3.light.Light)

move

public Spatial move(float x,
                    float y,
                    float z)
Translates the spatial by the given translation vector.

Returns:
The spatial on which this method is called, e.g this.

move

public Spatial move(Vector3f offset)
Translates the spatial by the given translation vector.

Returns:
The spatial on which this method is called, e.g this.

scale

public Spatial scale(float s)
Scales the spatial by the given value

Returns:
The spatial on which this method is called, e.g this.

scale

public Spatial scale(float x,
                     float y,
                     float z)
Scales the spatial by the given scale vector.

Returns:
The spatial on which this method is called, e.g this.

rotate

public Spatial rotate(Quaternion rot)
Rotates the spatial by the given rotation.

Returns:
The spatial on which this method is called, e.g this.

rotate

public Spatial rotate(float xAngle,
                      float yAngle,
                      float zAngle)
Rotates the spatial by the xAngle, yAngle and zAngle angles (in radians), (aka pitch, yaw, roll) in the local coordinate space.

Returns:
The spatial on which this method is called, e.g this.

center

public Spatial center()
Centers the spatial in the origin of the world bound.

Returns:
The spatial on which this method is called, e.g this.

getCullHint

public Spatial.CullHint getCullHint()
Returns:
the cull mode of this spatial, or if set to CullHint.Inherit, the cullmode of it's parent.
See Also:
setCullHint(CullHint)

getBatchHint

public Spatial.BatchHint getBatchHint()

getQueueBucket

public RenderQueue.Bucket getQueueBucket()
Returns this spatial's renderqueue bucket. If the mode is set to inherit, then the spatial gets its renderqueue bucket from its parent.

Returns:
The spatial's current renderqueue mode.

getShadowMode

public RenderQueue.ShadowMode getShadowMode()
Returns:
The shadow mode of this spatial, if the local shadow mode is set to inherit, then the parent's shadow mode is returned.
See Also:
setShadowMode(com.jme3.renderer.queue.RenderQueue.ShadowMode), RenderQueue.ShadowMode

setLodLevel

public void setLodLevel(int lod)
Sets the level of detail to use when rendering this Spatial, this call propagates to all geometries under this Spatial.

Parameters:
lod - The lod level to set.

updateModelBound

public abstract void updateModelBound()
updateModelBound recalculates the bounding object for this Spatial.


setModelBound

public abstract void setModelBound(BoundingVolume modelBound)
setModelBound sets the bounding object for this Spatial.

Parameters:
modelBound - the bounding object for this spatial.

getVertexCount

public abstract int getVertexCount()
Returns:
The sum of all verticies under this Spatial.

getTriangleCount

public abstract int getTriangleCount()
Returns:
The sum of all triangles under this Spatial.

clone

public Spatial clone(boolean cloneMaterial)
Returns:
A clone of this Spatial, the scene graph in its entirety is cloned and can be altered independently of the original scene graph. Note that meshes of geometries are not cloned explicitly, they are shared if static, or specially cloned if animated. All controls will be cloned using the Control.cloneForSpatial method on the clone.
See Also:
Mesh.cloneForAnim()

clone

public Spatial clone()
Description copied from interface: CloneableSmartAsset
Creates a clone of the asset. Please see Object.clone() for more info on how this method should be implemented.

Specified by:
clone in interface CloneableSmartAsset
Overrides:
clone in class java.lang.Object
Returns:
A clone of this Spatial, the scene graph in its entirety is cloned and can be altered independently of the original scene graph. Note that meshes of geometries are not cloned explicitly, they are shared if static, or specially cloned if animated. All controls will be cloned using the Control.cloneForSpatial method on the clone.
See Also:
Mesh.cloneForAnim()

deepClone

public abstract Spatial deepClone()
Returns:
Similar to Spatial.clone() except will create a deep clone of all geometry's meshes, normally this method shouldn't be used instead use Spatial.clone()
See Also:
clone()

setUserData

public void setUserData(java.lang.String key,
                        java.lang.Object data)

getUserData

public <T> T getUserData(java.lang.String key)

getUserDataKeys

public java.util.Collection<java.lang.String> getUserDataKeys()

matches

public boolean matches(java.lang.Class<? extends Spatial> spatialSubclass,
                       java.lang.String nameRegex)
Note that we are matching the pattern, therefore the pattern must match the entire pattern (i.e. it behaves as if it is sandwiched between "^" and "$"). You can set regex modes, like case insensitivity, by using the (?X) or (?X:Y) constructs.

Parameters:
spatialSubclass - Subclass which this must implement. Null causes all Spatials to qualify.
nameRegex - Regular expression to match this name against. Null causes all Names to qualify.
Returns:
true if this implements the specified class and this's name matches the specified pattern.
See Also:
Pattern

write

public void write(JmeExporter ex)
           throws java.io.IOException
Specified by:
write in interface Savable
Throws:
java.io.IOException

read

public void read(JmeImporter im)
          throws java.io.IOException
Specified by:
read in interface Savable
Throws:
java.io.IOException

getWorldBound

public BoundingVolume getWorldBound()
getWorldBound retrieves the world bound at this node level.

Returns:
the world bound at this level.

setCullHint

public void setCullHint(Spatial.CullHint hint)
setCullHint sets how scene culling should work on this spatial during drawing. NOTE: You must set this AFTER attaching to a parent or it will be reset with the parent's cullMode value.

Parameters:
hint - one of CullHint.Dynamic, CullHint.Always, CullHint.Inherit or CullHint.Never

setBatchHint

public void setBatchHint(Spatial.BatchHint hint)
setBatchHint sets how batching should work on this spatial. NOTE: You must set this AFTER attaching to a parent or it will be reset with the parent's cullMode value.

Parameters:
hint - one of BatchHint.Never, BatchHint.Always, BatchHint.Inherit

getLocalCullHint

public Spatial.CullHint getLocalCullHint()
Returns:
the cullmode set on this Spatial

getLocalBatchHint

public Spatial.BatchHint getLocalBatchHint()
Returns:
the batchHint set on this Spatial

setQueueBucket

public void setQueueBucket(RenderQueue.Bucket queueBucket)
setQueueBucket determines at what phase of the rendering process this Spatial will rendered. See the RenderQueue.Bucket enum for an explanation of the various render queue buckets.

Parameters:
queueBucket - The bucket to use for this Spatial.

setShadowMode

public void setShadowMode(RenderQueue.ShadowMode shadowMode)
Sets the shadow mode of the spatial The shadow mode determines how the spatial should be shadowed, when a shadowing technique is used. See the documentation for the class RenderQueue.ShadowMode for more information.

Parameters:
shadowMode - The local shadow mode to set.
See Also:
RenderQueue.ShadowMode

getLocalQueueBucket

public RenderQueue.Bucket getLocalQueueBucket()
Returns:
The locally set queue bucket mode
See Also:
setQueueBucket(com.jme3.renderer.queue.RenderQueue.Bucket)

getLocalShadowMode

public RenderQueue.ShadowMode getLocalShadowMode()
Returns:
The locally set shadow mode
See Also:
setShadowMode(com.jme3.renderer.queue.RenderQueue.ShadowMode)

getLastFrustumIntersection

public Camera.FrustumIntersect getLastFrustumIntersection()
Returns this spatial's last frustum intersection result. This int is set when a check is made to determine if the bounds of the object fall inside a camera's frustum. If a parent is found to fall outside the frustum, the value for this spatial will not be updated.

Returns:
The spatial's last frustum intersection result.

setLastFrustumIntersection

public void setLastFrustumIntersection(Camera.FrustumIntersect intersects)
Overrides the last intersection result. This is useful for operations that want to start rendering at the middle of a scene tree and don't want the parent of that node to influence culling.

Parameters:
intersects - the new value

toString

public java.lang.String toString()
Returns the Spatial's name followed by the class of the spatial
Example: "MyNode (com.jme3.scene.Spatial)

Overrides:
toString in class java.lang.Object
Returns:
Spatial's name followed by the class of the Spatial

getLocalToWorldMatrix

public Matrix4f getLocalToWorldMatrix(Matrix4f store)
Creates a transform matrix that will convert from this spatials' local coordinate space to the world coordinate space based on the world transform.

Parameters:
store - Matrix where to store the result, if null, a new one will be created and returned.
Returns:
store if not null, otherwise, a new matrix containing the result.
See Also:
getWorldTransform()

depthFirstTraversal

public abstract void depthFirstTraversal(SceneGraphVisitor visitor)
Visit each scene graph element ordered by DFS

Parameters:
visitor -

breadthFirstTraversal

public void breadthFirstTraversal(SceneGraphVisitor visitor)
Visit each scene graph element ordered by BFS

Parameters:
visitor -

breadthFirstTraversal

protected abstract void breadthFirstTraversal(SceneGraphVisitor visitor,
                                              java.util.Queue<Spatial> queue)