Package com.jme3.scene
Class Spatial
java.lang.Object
com.jme3.scene.Spatial
- All Implemented Interfaces:
HasLocalTransform
,CloneableSmartAsset
,Collidable
,Savable
,JmeCloneable
,Cloneable
public abstract class Spatial
extends Object
implements Savable, Cloneable, Collidable, CloneableSmartAsset, JmeCloneable, HasLocalTransform
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Specifies if this spatial should be batchedstatic enum
Specifies how frustum culling should be handled by this spatial.static enum
Specifies the mode of the depth first search. -
Field Summary
Modifier and TypeFieldDescriptionprotected Spatial.BatchHint
protected SafeArrayList<Control>
protected Spatial.CullHint
protected Camera.FrustumIntersect
protected AssetKey
Used for smart asset cachingprotected LightList
LightListprotected SafeArrayList<MatParamOverride>
protected Transform
protected String
This spatial's name.protected Node
Spatial's parent, or null if it has none.protected RenderQueue.Bucket
float
protected int
Refresh flags.protected static final int
Refresh flag typesprotected static final int
Refresh flag typesprotected static final int
Refresh flag typesprotected static final int
Refresh flag typesprotected static final int
Refresh flag typesprotected RenderQueue.ShadowMode
protected BoundingVolume
Spatial's bounding volume relative to the world.protected LightList
protected SafeArrayList<MatParamOverride>
protected Transform
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addControl
(Control control) Add a control to the list of controls.void
addControlAt
(int index, Control control) Adds the specified control to the list, at the specified index.void
addLight
adds the given light to the Spatial; causing all child Spatials to be affected by it.void
addMatParamOverride
(MatParamOverride override) Adds a local material parameter override.void
breadthFirstTraversal
(SceneGraphVisitor visitor) Visit each scene graph element ordered by BFSprotected abstract void
breadthFirstTraversal
(SceneGraphVisitor visitor, Queue<Spatial> queue) 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.void
Remove all local material parameter overrides.clone()
Creates a clone of the asset.clone
(boolean cloneMaterial) void
cloneFields
(Cloner cloner, Object original) Called internally by com.jme3.util.clone.Cloner.void
depthFirstTraversal
(SceneGraphVisitor visitor) Visit each scene graph element ordered by DFS with the default post order mode.abstract void
depthFirstTraversal
(SceneGraphVisitor visitor, Spatial.DFSMode mode) Visit each scene graph element ordered by DFS.void
forceRefresh
(boolean transforms, boolean bounds, boolean lights) (Internal use only) Forces a refresh of the given types of data.getControl
(int index) Returns the control at the given index in the list.<T extends Control>
TgetControl
(Class<T> controlType) Returns the first control that is an instance of the given class, or null if no such control exists.getKey()
Returns the asset key that is used to track this asset for garbage collection.Returns this spatial's last frustum intersection result.Returns the localLightList
, which are the lights that were directly attached to thisSpatial
through theaddLight(com.jme3.light.Light)
andremoveLight(com.jme3.light.Light)
methods.Get the local material parameter overrides.getLocalRotation
retrieves the local rotation of this node.getLocalScale
retrieves the local scale of this node.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.getLocalTransform
retrieves the local transform of this spatial.getLocalTranslation
retrieves the local translation of this node.getName()
Returns the name of this spatial.int
getParent
retrieves this node's parent.Returns this spatial's render-queue bucket.abstract int
<T> T
getUserData
(String key) abstract int
getWorldBound
retrieves the world bound at this node level.Returns the worldLightList
, containing the lights combined from all thisSpatial's
parents up to and including thisSpatial
's lights.Get the world material parameter overrides.getWorldRotation
retrieves the absolute rotation of the Spatial.getWorldScale
retrieves the absolute scale factor of the spatial.getWorldTransform
retrieves the world transformation of the spatial.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.jmeClone()
Called internally by com.jme3.util.clone.Cloner.localToWorld
(Vector3f in, Vector3f store) Convert a vector (in) from this spatial's local coordinate space to world coordinate space.void
lookAt
is a convenience method for auto-setting the local rotation based on a position in world space and an up vector.boolean
Note that we are matching the pattern, therefore the pattern must match the entire pattern (i.e.move
(float x, float y, float z) Translates the spatial by the given translation vector.Translates the spatial by the given translation vector.oldClone
(boolean cloneMaterial) Deprecated.void
read
(JmeImporter im) boolean
removeControl
(Control control) Removes the given control from this spatial's controls.void
removeControl
(Class<? extends Control> controlType) Removes the first control that is an instance of the given class.boolean
removeFromParent
removes this Spatial from its parent.void
removeLight
(Light light) removeLight
removes the given light from the Spatial.void
removeMatParamOverride
(MatParamOverride override) Remove a local material parameter override if it exists.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.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.scale
(float s) Scales the spatial by the given valuescale
(float x, float y, float z) Scales the spatial by the given scale vector.void
setBatchHint
alters how batching will treat this spatial.protected void
Indicate that the bounding of this spatial has changed and that a refresh is required.void
setCullHint
(Spatial.CullHint hint) setCullHint
alters how view frustum culling will treat this spatial.void
Set by theAssetManager
to track this asset.void
setLastFrustumIntersection
(Camera.FrustumIntersect intersects) Overrides the last intersection result.protected void
void
setLocalRotation
(Matrix3f rotation) setLocalRotation
sets the local rotation of this node by using aMatrix3f
.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
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.protected void
abstract void
setModelBound
(BoundingVolume modelBound) setModelBound
sets the bounding object for this Spatial.void
Sets the name of this spatial.protected void
Called byNode.attachChild(Spatial)
andNode.detachChild(Spatial)
- don't call directly.void
setQueueBucket
(RenderQueue.Bucket queueBucket) setQueueBucket
determines at what phase of the rendering process this Spatial will rendered.protected void
setRequiresUpdates
(boolean f) Subclasses can call this with true to denote that they require updateLogicalState() to be called even if they contain no controls.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
Indicate that the transform of this spatial has changed and that a refresh is required.void
setUserData
(String key, Object data) toString()
Returns the Spatial's name followed by the class of the spatial
Example: "MyNode (com.jme3.scene.Spatial)"void
updateGeometricState
updates the light list, computes the world transforms, and computes the world bounds for this Spatial.void
updateLogicalState
(float tpf) updateLogicalState
calls theupdate()
method for all controls attached to this Spatial.protected void
abstract void
updateModelBound
recalculates the bounding object for this Spatial.protected void
Should be overridden by Node and Geometry.protected void
protected void
Should only be called from updateGeometricState().worldToLocal
(Vector3f in, Vector3f store) Convert a vector (in) from world coordinate space to this spatial's 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 Details
-
RF_TRANSFORM
protected static final int RF_TRANSFORMRefresh flag types- See Also:
-
RF_BOUND
protected static final int RF_BOUNDRefresh flag types- See Also:
-
RF_LIGHTLIST
protected static final int RF_LIGHTLISTRefresh flag types- See Also:
-
RF_CHILD_LIGHTLIST
protected static final int RF_CHILD_LIGHTLISTRefresh flag types- See Also:
-
RF_MATPARAM_OVERRIDE
protected static final int RF_MATPARAM_OVERRIDERefresh flag types- See Also:
-
cullHint
-
batchHint
-
worldBound
Spatial's bounding volume relative to the world. -
localLights
LightList -
worldLights
-
localOverrides
-
worldOverrides
-
name
This spatial's name. -
frustrumIntersects
-
queueBucket
-
shadowMode
-
queueDistance
public transient float queueDistance -
localTransform
-
worldTransform
-
controls
-
userData
-
key
Used for smart asset caching- See Also:
-
parent
Spatial's parent, or null if it has none. -
refreshFlags
protected transient int refreshFlagsRefresh flags. Indicate what data of the spatial need to be updated to reflect the correct state.
-
-
Constructor Details
-
Spatial
protected Spatial()Serialization only. Do not use. Not really. This class is never instantiated directly but the subclasses like to use the no-arg constructor for their own no-arg constructor... which is technically weaker than forward supplying defaults. -
Spatial
Constructor instantiates a newSpatial
object, setting the rotation, translation, and scale values to their defaults.- Parameters:
name
- the name of the scene element. This is required for identification and comparison purposes.
-
-
Method Details
-
setKey
Description copied from interface:CloneableSmartAsset
Set by theAssetManager
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 interfaceCloneableSmartAsset
- Parameters:
key
- The AssetKey to set
-
getKey
Description copied from interface:CloneableSmartAsset
Returns the asset key that is used to track this asset for garbage collection.- Specified by:
getKey
in interfaceCloneableSmartAsset
- Returns:
- the asset key that is used to track this asset for garbage collection.
-
setRequiresUpdates
protected void setRequiresUpdates(boolean f) Subclasses can call this with true to denote that they require updateLogicalState() to be called even if they contain no controls. Setting this to false reverts to the default behavior of only updating if the spatial has controls. This is not meant to indicate dynamic state in any way and must be called while unattached or an IllegalStateException is thrown. It is designed to be called during object construction and then never changed, ie: it's meant to be subclass specific state and not runtime state. Subclasses of Node or Geometry that do not set this will get the old default behavior as if this was set to true. Subclasses should call setRequiresUpdate(false) in their constructors to receive optimal behavior if they don't require updateLogicalState() to be called even if there are no controls.- Parameters:
f
- true→require updates, false→don't require updates
-
setTransformRefresh
protected void setTransformRefresh()Indicate that the transform of this spatial has changed and that a refresh is required. -
setLightListRefresh
protected void setLightListRefresh() -
setMatParamOverrideRefresh
protected void setMatParamOverrideRefresh() -
setBoundRefresh
protected void setBoundRefresh()Indicate that the bounding of this spatial has changed and that a refresh is required. -
forceRefresh
public void forceRefresh(boolean transforms, boolean bounds, boolean lights) (Internal use only) Forces a refresh of the given types of data.- Parameters:
transforms
- Refresh world transform based on parents'bounds
- Refresh bounding volume data based on child nodeslights
- Refresh light list based on parents'
-
checkCulling
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
Sets the name of this spatial.- Parameters:
name
- The spatial's new name.
-
getName
Returns the name of this spatial.- Returns:
- This spatial's name.
-
getLocalLightList
Returns the localLightList
, which are the lights that were directly attached to thisSpatial
through theaddLight(com.jme3.light.Light)
andremoveLight(com.jme3.light.Light)
methods.- Returns:
- The local light list
-
getWorldLightList
Returns the worldLightList
, containing the lights combined from all thisSpatial's
parents up to and including thisSpatial
's lights.- Returns:
- The combined world light list
-
getLocalMatParamOverrides
Get the local material parameter overrides.- Returns:
- The list of local material parameter overrides.
-
getWorldMatParamOverrides
Get the world material parameter overrides. Note that this list is only updated on a call toupdateGeometricState()
. After update, the world overrides list will contain theparent's
world overrides combined with this spatial'slocal overrides
.- Returns:
- The list of world material parameter overrides.
-
getWorldRotation
getWorldRotation
retrieves the absolute rotation of the Spatial.- Returns:
- the Spatial's world rotation quaternion.
-
getWorldTranslation
getWorldTranslation
retrieves the absolute translation of the spatial.- Returns:
- the Spatial's world translation vector.
-
getWorldScale
getWorldScale
retrieves the absolute scale factor of the spatial.- Returns:
- the Spatial's world scale factor.
-
getWorldTransform
getWorldTransform
retrieves the world transformation of the spatial.- Returns:
- the world transform.
-
rotateUpTo
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
lookAt
is a convenience method for auto-setting the local rotation based on a position in world space and an up vector. It computes the rotation to transform the z-axis to point onto 'position' and the y-axis to 'up'. UnlikeQuaternion.lookAt(com.jme3.math.Vector3f, com.jme3.math.Vector3f)
this method takes a world position to look at and not a relative direction. Note : 28/01/2013 this method has been fixed as it was not taking into account the parent rotation. This was resulting in improper rotation when the spatial had rotated parent nodes. This method is intended to work in world space, so no matter what parent graph the spatial has, it will look at the given position in world space.- Parameters:
position
- where to look at in terms of world coordinatesupVector
- 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() -
updateMatParamOverrides
protected void updateMatParamOverrides() -
addMatParamOverride
Adds a local material parameter override.- Parameters:
override
- The override to add.- See Also:
-
removeMatParamOverride
Remove a local material parameter override if it exists.- Parameters:
override
- The override to remove.- See Also:
-
clearMatParamOverrides
public void clearMatParamOverrides()Remove all local material parameter overrides. -
updateWorldTransforms
protected void updateWorldTransforms()Should only be called from updateGeometricState(). In most cases should not be subclassed. -
runControlRender
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
Add a control to the list of controls.- Parameters:
control
- The control to add.- See Also:
-
addControlAt
Adds the specified control to the list, at the specified index. Any controls with indices greater than or equal to the specified index will have their indices increased by one.- Parameters:
index
- the index at which to add the control (0→first, ≥0)control
- the control to add (not null)- Throws:
IllegalStateException
- if the control is already added here
-
removeControl
Removes the first control that is an instance of the given class.- Parameters:
controlType
- the type of Control to remove- See Also:
-
removeControl
Removes the given control from this spatial's controls.- Parameters:
control
- The control to remove- Returns:
- True if the control was successfully removed. False if the control is not assigned to this spatial.
- See Also:
-
getControl
Returns the first control that is an instance of the given class, or null if no such control exists.- Type Parameters:
T
- the type of control to look for- 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:
-
getControl
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:
IndexOutOfBoundsException
- If the index is outside the range [0, getNumControls()-1]- See Also:
-
getNumControls
public int getNumControls()- Returns:
- The number of controls attached to this Spatial.
- See Also:
-
updateLogicalState
public void updateLogicalState(float tpf) updateLogicalState
calls theupdate()
method for all controls attached to this Spatial.- Parameters:
tpf
- Time per frame.- See Also:
-
updateGeometricState
public void updateGeometricState()updateGeometricState
updates the light list, 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. -
localToWorld
Convert a vector (in) from this spatial's local coordinate space to world coordinate space.- Parameters:
in
- vector to read fromstore
- where to write the result (null to create a new vector, may be same as in)- Returns:
- the result (store)
-
worldToLocal
Convert a vector (in) from world coordinate space to this spatial's local coordinate space.- Parameters:
in
- vector to read fromstore
- where to write the result- Returns:
- the result (store)
-
getParent
getParent
retrieves this node's parent. If the parent is null this is the root node.- Returns:
- the parent of this node.
-
setParent
Called byNode.attachChild(Spatial)
andNode.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 its parent.- Returns:
- true if it has a parent and performed the remove.
-
hasAncestor
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
getLocalRotation
retrieves the local rotation of this node.- Returns:
- the local rotation of this node.
-
setLocalRotation
setLocalRotation
sets the local rotation of this node by using aMatrix3f
.- Parameters:
rotation
- the new local rotation.
-
setLocalRotation
setLocalRotation
sets the local rotation of this node.- Parameters:
quaternion
- the new local rotation.
-
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.- Parameters:
x
- the desired scale factor for the X axisy
- the desired scale factor for the Y axisz
- the desired scale factor for the Z axis
-
setLocalScale
setLocalScale
sets the local scale of this node.- Parameters:
localScale
- the new local scale.
-
getLocalTranslation
getLocalTranslation
retrieves the local translation of this node.- Returns:
- the local translation of this node.
-
setLocalTranslation
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.- Parameters:
x
- the desired offset in the +X directiony
- the desired offset in the +Y directionz
- the desired offset in the +Z direction
-
setLocalTransform
setLocalTransform
sets the local transform of this spatial.- Specified by:
setLocalTransform
in interfaceHasLocalTransform
-
getLocalTransform
getLocalTransform
retrieves the local transform of this spatial.- Specified by:
getLocalTransform
in interfaceHasLocalTransform
- Returns:
- the local transform of this spatial.
-
setMaterial
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
addLight
adds the given light to the Spatial; causing all child Spatials to be affected by it.- Parameters:
light
- The light to add.
-
removeLight
removeLight
removes the given light from the Spatial.- Parameters:
light
- The light to remove.- See Also:
-
move
Translates the spatial by the given translation vector.- Parameters:
x
- the offset to apply in the +X directiony
- the offset to apply in the +Y directionz
- the offset to apply in the +Z direction- Returns:
- The spatial on which this method is called, e.g
this
.
-
move
Translates the spatial by the given translation vector.- Parameters:
offset
- the desired offset (not null, unaffected)- Returns:
- The spatial on which this method is called, e.g
this
.
-
scale
Scales the spatial by the given value- Parameters:
s
- the scaling factor to apply to all axes- Returns:
- The spatial on which this method is called, e.g
this
.
-
scale
Scales the spatial by the given scale vector.- Parameters:
x
- the scaling factor to apply to the X axisy
- the scaling factor to apply to the Y axisz
- the scaling factor to apply to the Z axis- Returns:
- The spatial on which this method is called, e.g
this
.
-
rotate
Rotates the spatial by the given rotation.- Parameters:
rot
- the intrinsic rotation to apply (not null, unaffected)- Returns:
- The spatial on which this method is called, e.g
this
.
-
rotate
Rotates the spatial by the xAngle, yAngle and zAngle angles (in radians), (aka pitch, yaw, roll) in the local coordinate space.- Parameters:
xAngle
- the angle of rotation around the +X axis (in radians)yAngle
- the angle of rotation around the +Y axis (in radians)zAngle
- the angle of rotation around the +Z axis (in radians)- Returns:
- The spatial on which this method is called, e.g
this
.
-
center
Centers the spatial in the origin of the world bound.- Returns:
- The spatial on which this method is called, e.g
this
.
-
getCullHint
- Returns:
- the cull mode of this spatial, or if set to CullHint.Inherit, the cull mode of its parent.
- See Also:
-
getBatchHint
-
getQueueBucket
Returns this spatial's render-queue bucket. If the mode is set to inherit, then the spatial gets its render-queue bucket from its parent.- Returns:
- The spatial's current render-queue bucket.
-
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:
-
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
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 vertices under this Spatial.
-
getTriangleCount
public abstract int getTriangleCount()- Returns:
- The sum of all triangles under this Spatial.
-
clone
- Parameters:
cloneMaterial
- true to clone materials, false to share them- 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.
- See Also:
-
oldClone
Deprecated.The old clone() method that did not use the new Cloner utility.- Parameters:
cloneMaterial
- ignored- Returns:
- never
-
clone
Description copied from interface:CloneableSmartAsset
Creates a clone of the asset. Please seeObject.clone()
for more info on how this method should be implemented.- Specified by:
clone
in interfaceCloneableSmartAsset
- Overrides:
clone
in classObject
- 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.
- See Also:
-
deepClone
- Returns:
- Similar to Spatial.clone() except will create a deep clone of all geometries' meshes. Normally this method shouldn't be used. Instead, use Spatial.clone()
- See Also:
-
jmeClone
Called internally by com.jme3.util.clone.Cloner. Do not call directly.- Specified by:
jmeClone
in interfaceJmeCloneable
- Returns:
- a new instance
-
cloneFields
Called internally by com.jme3.util.clone.Cloner. Do not call directly.- Specified by:
cloneFields
in interfaceJmeCloneable
- Parameters:
cloner
- The cloner that is performing the cloning operation. The cloneFields method can call back into the cloner to make clones of its subordinate fields.original
- The original object from which this object was cloned. This is provided for the very rare case that this object needs to refer to its original for some reason. In general, all of the relevant values should have been transferred during the shallow clone, and this object need only clone what it wants.
-
setUserData
-
getUserData
-
getUserDataKeys
-
matches
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:
-
write
- Specified by:
write
in interfaceSavable
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Throws:
IOException
-
getWorldBound
getWorldBound
retrieves the world bound at this node level.- Returns:
- the world bound at this level.
-
setCullHint
setCullHint
alters how view frustum culling will treat this spatial.- Parameters:
hint
- one of:CullHint.Dynamic
,CullHint.Always
,CullHint.Inherit
, orCullHint.Never
The effect of the default value (CullHint.Inherit) may change if the spatial gets re-parented.
-
setBatchHint
setBatchHint
alters how batching will treat this spatial.- Parameters:
hint
- one of:BatchHint.Never
,BatchHint.Always
, orBatchHint.Inherit
The effect of the default value (BatchHint.Inherit) may change if the spatial gets re-parented.
-
getLocalCullHint
- Returns:
- the cull mode of this Spatial
-
getLocalBatchHint
- Returns:
- the batch hint for this Spatial
-
setQueueBucket
setQueueBucket
determines at what phase of the rendering process this Spatial will rendered. See theRenderQueue.Bucket
enum for an explanation of the various render queue buckets.- Parameters:
queueBucket
- The bucket to use for this Spatial.
-
setShadowMode
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 classRenderQueue.ShadowMode
for more information.- Parameters:
shadowMode
- The local shadow mode to set.- See Also:
-
getLocalQueueBucket
- Returns:
- The locally set queue bucket mode
- See Also:
-
getLocalShadowMode
- Returns:
- The locally set shadow mode
- See Also:
-
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
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
Returns the Spatial's name followed by the class of the spatial
Example: "MyNode (com.jme3.scene.Spatial)" -
getLocalToWorldMatrix
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:
-
depthFirstTraversal
Visit each scene graph element ordered by DFS with the default post order mode.- Parameters:
visitor
- the action to take for each visited Spatial- See Also:
-
depthFirstTraversal
Visit each scene graph element ordered by DFS. There are two modes: pre order and post order.- Parameters:
visitor
- the action to take for each visited Spatialmode
- the traversal mode: pre order or post order
-
breadthFirstTraversal
Visit each scene graph element ordered by BFS- Parameters:
visitor
- the action to take for each visited Spatial
-
breadthFirstTraversal
-