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
Nested ClassesModifier and TypeClassDescriptionstatic enumSpecifies if this spatial should be batchedstatic enumSpecifies how frustum culling should be handled by this spatial.static enumSpecifies the mode of the depth first search. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Spatial.BatchHintprotected SafeArrayList<Control>protected Spatial.CullHintprotected Camera.FrustumIntersectprotected AssetKeyUsed for smart asset cachingprotected LightListLightListprotected SafeArrayList<MatParamOverride>protected Transformprotected StringThis spatial's name.protected NodeSpatial's parent, or null if it has none.protected RenderQueue.Bucketfloatprotected intRefresh flags.protected static final intRefresh flag typesprotected static final intRefresh flag typesprotected static final intRefresh flag typesprotected static final intRefresh flag typesprotected static final intRefresh flag typesprotected RenderQueue.ShadowModeprotected BoundingVolumeSpatial's bounding volume relative to the world.protected LightListprotected SafeArrayList<MatParamOverride>protected Transform -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddControl(Control control) Add a control to the list of controls.voidaddControlAt(int index, Control control) Adds the specified control to the list, at the specified index.voidaddLightadds the given light to the Spatial; causing all child Spatials to be affected by it.voidaddMatParamOverride(MatParamOverride override) Adds a local material parameter override.voidbreadthFirstTraversal(SceneGraphVisitor visitor) Visit each scene graph element ordered by BFSprotected abstract voidbreadthFirstTraversal(SceneGraphVisitor visitor, Queue<Spatial> queue) center()Centers the spatial in the origin of the world bound.booleancheckCulling(Camera cam) checkCullingchecks the spatial with the camera to see if it should be culled.voidRemove all local material parameter overrides.clone()Creates a clone of the asset.clone(boolean cloneMaterial) voidcloneFields(Cloner cloner, Object original) Called internally by com.jme3.util.clone.Cloner.voiddepthFirstTraversal(SceneGraphVisitor visitor) Visit each scene graph element ordered by DFS with the default post order mode.abstract voiddepthFirstTraversal(SceneGraphVisitor visitor, Spatial.DFSMode mode) Visit each scene graph element ordered by DFS.voidforceRefresh(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 thisSpatialthrough theaddLight(com.jme3.light.Light)andremoveLight(com.jme3.light.Light)methods.Get the local material parameter overrides.getLocalRotationretrieves the local rotation of this node.getLocalScaleretrieves 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.getLocalTransformretrieves the local transform of this spatial.getLocalTranslationretrieves the local translation of this node.getName()Returns the name of this spatial.intgetParentretrieves this node's parent.Returns this spatial's render-queue bucket.abstract int<T> TgetUserData(String key) abstract intgetWorldBoundretrieves the world bound at this node level.Returns the worldLightList, containing the lights combined from all thisSpatial'sparents up to and including thisSpatial's lights.Get the world material parameter overrides.getWorldRotationretrieves the absolute rotation of the Spatial.getWorldScaleretrieves the absolute scale factor of the spatial.getWorldTransformretrieves the world transformation of the spatial.getWorldTranslationretrieves the absolute translation of the spatial.booleanhasAncestor(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.voidlookAtis a convenience method for auto-setting the local rotation based on a position in world space and an up vector.booleanNote 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.voidread(JmeImporter im) booleanremoveControl(Control control) Removes the given control from this spatial's controls.voidremoveControl(Class<? extends Control> controlType) Removes the first control that is an instance of the given class.booleanremoveFromParentremoves this Spatial from its parent.voidremoveLight(Light light) removeLightremoves the given light from the Spatial.voidremoveMatParamOverride(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.voidrotateUpTo(Vector3f newUp) rotateUpTois a utility function that alters the local rotation to point the Y axis in the direction given by newUp.voidrunControlRender(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.voidsetBatchHintalters how batching will treat this spatial.protected voidIndicate that the bounding of this spatial has changed and that a refresh is required.voidsetCullHint(Spatial.CullHint hint) setCullHintalters how view frustum culling will treat this spatial.voidSet by theAssetManagerto track this asset.voidsetLastFrustumIntersection(Camera.FrustumIntersect intersects) Overrides the last intersection result.protected voidvoidsetLocalRotation(Matrix3f rotation) setLocalRotationsets the local rotation of this node by using aMatrix3f.voidsetLocalRotation(Quaternion quaternion) setLocalRotationsets the local rotation of this node.voidsetLocalScale(float localScale) setLocalScalesets the local scale of this node.voidsetLocalScale(float x, float y, float z) setLocalScalesets the local scale of this node.voidsetLocalScale(Vector3f localScale) setLocalScalesets the local scale of this node.voidsetLocalTransformsets the local transform of this spatial.voidsetLocalTranslation(float x, float y, float z) setLocalTranslationsets the local translation of this spatial.voidsetLocalTranslation(Vector3f localTranslation) setLocalTranslationsets the local translation of this spatial.voidsetLodLevel(int lod) Sets the level of detail to use when rendering this Spatial, this call propagates to all geometries under this Spatial.voidsetMaterial(Material material) Applies the given material to the Spatial, this will propagate the material down to the geometries in the scene graph.protected voidabstract voidsetModelBound(BoundingVolume modelBound) setModelBoundsets the bounding object for this Spatial.voidSets the name of this spatial.protected voidCalled byNode.attachChild(Spatial)andNode.detachChild(Spatial)- don't call directly.voidsetQueueBucket(RenderQueue.Bucket queueBucket) setQueueBucketdetermines at what phase of the rendering process this Spatial will rendered.protected voidsetRequiresUpdates(boolean f) Subclasses can call this with true to denote that they require updateLogicalState() to be called even if they contain no controls.voidsetShadowMode(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 voidIndicate that the transform of this spatial has changed and that a refresh is required.voidsetUserData(String key, Object data) toString()Returns the Spatial's name followed by the class of the spatial
Example: "MyNode (com.jme3.scene.Spatial)"voidupdateGeometricStateupdates the light list, computes the world transforms, and computes the world bounds for this Spatial.voidupdateLogicalState(float tpf) updateLogicalStatecalls theupdate()method for all controls attached to this Spatial.protected voidabstract voidupdateModelBoundrecalculates the bounding object for this Spatial.protected voidShould be overridden by Node and Geometry.protected voidprotected voidShould 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.voidwrite(JmeExporter ex) Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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 newSpatialobject, 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:CloneableSmartAssetSet by theAssetManagerto 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:
setKeyin interfaceCloneableSmartAsset- Parameters:
key- The AssetKey to set
-
getKey
Description copied from interface:CloneableSmartAssetReturns the asset key that is used to track this asset for garbage collection.- Specified by:
getKeyin 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
checkCullingchecks 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 thisSpatialthrough 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'sparents 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'sworld overrides combined with this spatial'slocal overrides.- Returns:
- The list of world material parameter overrides.
-
getWorldRotation
getWorldRotationretrieves the absolute rotation of the Spatial.- Returns:
- the Spatial's world rotation quaternion.
-
getWorldTranslation
getWorldTranslationretrieves the absolute translation of the spatial.- Returns:
- the Spatial's world translation vector.
-
getWorldScale
getWorldScaleretrieves the absolute scale factor of the spatial.- Returns:
- the Spatial's world scale factor.
-
getWorldTransform
getWorldTransformretrieves the world transformation of the spatial.- Returns:
- the world transform.
-
rotateUpTo
rotateUpTois 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
lookAtis 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) updateLogicalStatecalls theupdate()method for all controls attached to this Spatial.- Parameters:
tpf- Time per frame.- See Also:
-
updateGeometricState
public void updateGeometricState()updateGeometricStateupdates 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
getParentretrieves 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.setParentsets the parent of this node.- Parameters:
parent- the parent of this node.
-
removeFromParent
public boolean removeFromParent()removeFromParentremoves 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
getLocalRotationretrieves the local rotation of this node.- Returns:
- the local rotation of this node.
-
setLocalRotation
setLocalRotationsets the local rotation of this node by using aMatrix3f.- Parameters:
rotation- the new local rotation.
-
setLocalRotation
setLocalRotationsets the local rotation of this node.- Parameters:
quaternion- the new local rotation.
-
getLocalScale
getLocalScaleretrieves the local scale of this node.- Returns:
- the local scale of this node.
-
setLocalScale
public void setLocalScale(float localScale) setLocalScalesets 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) setLocalScalesets 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
setLocalScalesets the local scale of this node.- Parameters:
localScale- the new local scale.
-
getLocalTranslation
getLocalTranslationretrieves the local translation of this node.- Returns:
- the local translation of this node.
-
setLocalTranslation
setLocalTranslationsets the local translation of this spatial.- Parameters:
localTranslation- the local translation of this spatial.
-
setLocalTranslation
public void setLocalTranslation(float x, float y, float z) setLocalTranslationsets 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
setLocalTransformsets the local transform of this spatial.- Specified by:
setLocalTransformin interfaceHasLocalTransform
-
getLocalTransform
getLocalTransformretrieves the local transform of this spatial.- Specified by:
getLocalTransformin 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
addLightadds the given light to the Spatial; causing all child Spatials to be affected by it.- Parameters:
light- The light to add.
-
removeLight
removeLightremoves 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()updateModelBoundrecalculates the bounding object for this Spatial. -
setModelBound
setModelBoundsets 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:CloneableSmartAssetCreates a clone of the asset. Please seeObject.clone()for more info on how this method should be implemented.- Specified by:
clonein interfaceCloneableSmartAsset- Overrides:
clonein 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:
jmeClonein interfaceJmeCloneable- Returns:
- a new instance
-
cloneFields
Called internally by com.jme3.util.clone.Cloner. Do not call directly.- Specified by:
cloneFieldsin 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:
writein interfaceSavable- Throws:
IOException
-
read
- Specified by:
readin interfaceSavable- Throws:
IOException
-
getWorldBound
getWorldBoundretrieves the world bound at this node level.- Returns:
- the world bound at this level.
-
setCullHint
setCullHintalters how view frustum culling will treat this spatial.- Parameters:
hint- one of:CullHint.Dynamic,CullHint.Always,CullHint.Inherit, orCullHint.NeverThe effect of the default value (CullHint.Inherit) may change if the spatial gets re-parented.
-
setBatchHint
setBatchHintalters how batching will treat this spatial.- Parameters:
hint- one of:BatchHint.Never,BatchHint.Always, orBatchHint.InheritThe 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
setQueueBucketdetermines at what phase of the rendering process this Spatial will rendered. See theRenderQueue.Bucketenum 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.ShadowModefor 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
-