|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jme.scene.Spatial
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 nodes, such as Node and
Geometry are subclasses of Spatial.
| Field Summary | |
protected static RenderState[] |
currentStates
RenderStates a Spatial contains during rendering. |
static RenderState[] |
defaultStateList
List of default states all spatials take if none is set. |
protected boolean |
forceCull
If true, spatial and all children are culled from the scene graph. |
protected boolean |
forceView
If true, spatial and all children are always rendered in the scene graph. |
protected int |
frustrumIntersects
|
protected java.util.ArrayList |
geometricalControllers
ArrayList of controllers for this spatial. |
protected int |
lightCombineMode
Flag signaling how lights are combined for this node. |
protected Quaternion |
localRotation
Spatial's rotation relative to its parent. |
protected Vector3f |
localScale
Spatial's scale relative to its parent. |
protected Vector3f |
localTranslation
Spatial's translation relative to its parent. |
protected java.lang.String |
name
This spatial's name. |
protected Node |
parent
Spatial's parent, or null if it has none. |
float |
queueDistance
|
protected int |
renderQueueMode
|
protected RenderState[] |
renderStateList
The render states of this spatial. |
protected int |
textureCombineMode
Flag signaling how textures are combined for this node. |
protected BoundingVolume |
worldBound
Spatial's bounding volume relative to the world. |
protected Quaternion |
worldRotation
Spatial's world absolute rotation. |
protected Vector3f |
worldScale
Spatial's world absolute scale. |
protected Vector3f |
worldTranslation
Spatial's world absolute translation. |
protected int |
zOrder
|
| Constructor Summary | |
Spatial()
Empty Constructor to be used internally only. |
|
Spatial(java.lang.String name)
Constructor instantiates a new Spatial object setting the
rotation, translation and scale value to defaults. |
|
| Method Summary | |
void |
addController(Controller controller)
Adds a Controller to this Spatial's list of controllers. |
static void |
applyDefaultStates()
All non null default states are applied to the renderer. |
protected void |
applyRenderState(java.util.Stack[] states)
Called during updateRenderState(Stack[]), this function determines how the render states are actually applied to the spatial and any children it may have. |
void |
calculateCollisions(Spatial scene,
CollisionResults results)
calculateCollisions calls findCollisions to populate the
CollisionResults object then processes the collision results. |
void |
calculatePick(Ray ray,
PickResults results)
|
static void |
clearCurrentState(int state)
clears the specified state. |
static void |
clearCurrentStates()
sets all current states to null, and therefore forces the use of the default states. |
void |
clearRenderState(int renderStateType)
Clears a given render state index by setting it to 0. |
abstract void |
draw(Renderer r)
draw abstract method that handles drawing data to the
renderer if it is geometry and passing the call to it's children if it is
a node. |
abstract void |
drawBounds(Renderer r)
drawBounds abstract method that handles drawing bounds
data to the renderer if it is geometry and passing the call to it's
children if it is a node. |
abstract void |
findCollisions(Spatial scene,
CollisionResults results)
checks this spatial against a second spatial, any collisions are stored in the results object. |
abstract void |
findPick(Ray toTest,
PickResults results)
|
Controller |
getController(int i)
Returns the controller in this list of controllers at index i. |
java.util.ArrayList |
getControllers()
Returns the ArrayList that contains this spatial's Controllers. |
static RenderState |
getCurrentState(int state)
|
int |
getLastFrustumIntersection()
Returns this spatial's last frustum intersection result. |
int |
getLightCombineMode()
Returns this spatial's light combine mode. |
Quaternion |
getLocalRotation()
getLocalRotation retrieves the local rotation of this
node. |
Vector3f |
getLocalScale()
getLocalScale retrieves the local scale of this node. |
Vector3f |
getLocalTranslation()
getLocalTranslation retrieves the local translation of
this node. |
java.lang.String |
getName()
Returns the name of this spatial. |
Node |
getParent()
getParent retrieve's this node's parent. |
int |
getRenderQueueMode()
|
RenderState[] |
getRenderStateList()
Returns the array of RenerState that this Spatial currently has. |
int |
getTextureCombineMode()
Returns this spatial's texture combine mode. |
BoundingVolume |
getWorldBound()
getWorldBound retrieves the world bound at this node
level. |
Quaternion |
getWorldRotation()
getWorldRotation retrieves the absolute rotation of the
Spatial. |
Vector3f |
getWorldScale()
getWorldScale retrieves the absolute scale factor of the
spatial. |
Vector3f |
getWorldTranslation()
getWorldTranslation retrieves the absolute translation of
the spatial. |
int |
getZOrder()
|
abstract boolean |
hasCollision(Spatial scene,
boolean checkTriangles)
|
boolean |
isForceCulled()
isForceCulled reports if this node should always be culled
or not. |
boolean |
isForceView()
isForceView returns true if the node will be rendered
whether it's in the camera frustum or not. |
void |
onDraw(Renderer r)
onDraw checks the node with the camera to see if it should
be culled, if not, the node's draw method is called. |
void |
onDrawBounds(Renderer r)
onDrawBounds checks the node with the camera to see if it
should be culled, if not, the node's draw method is called. |
void |
propagateBoundToRoot()
propagateBoundToRoot passes the new world bound up the
tree to the root. |
protected void |
propagateStatesFromRoot(java.util.Stack[] states)
Called during updateRenderState(Stack[]), this function goes up the scene graph tree until the parent is null and pushes RenderStates onto the states Stack array. |
Spatial |
putClone(Spatial store,
CloneCreator properties)
|
boolean |
removeController(Controller controller)
Removes a Controller to this Spatial's list of controllers, if it exist. |
boolean |
removeFromParent()
removeFromParent removes this Spatial from it's parent. |
void |
setForceCull(boolean forceCull)
setForceCull sets if this node should always be culled or
not. |
abstract void |
setForceView(boolean value)
setForceView will force the node to be rendered whether
it's in the camera frustum or not. |
void |
setLightCombineMode(int lightCombineMode)
Sets how lights from parents should be combined for this spatial. |
void |
setLocalRotation(Matrix3f rotation)
setLocalRotation sets the local rotation of this node. |
void |
setLocalRotation(Quaternion quaternion)
setLocalRotation sets the local rotation of this node,
using a quaterion to build the matrix. |
void |
setLocalScale(float localScale)
setLocalScale sets the local scale of this node. |
void |
setLocalScale(Vector3f localScale)
setLocalScale sets the local scale of this node. |
void |
setLocalTranslation(Vector3f localTranslation)
setLocalTranslation sets the local translation of this
node. |
void |
setName(java.lang.String name)
Sets the name of this spatial. |
void |
setParent(Node parent)
setParent sets the parent of this node. |
void |
setRenderQueueMode(int renderQueueMode)
|
RenderState |
setRenderState(RenderState rs)
setRenderState sets a render state for this node. |
void |
setTextureCombineMode(int textureCombineMode)
Sets how textures from parents should be combined for this Spatial. |
void |
setWorldBound(BoundingVolume worldBound)
setWorldBound sets the world bound for this node level. |
void |
setZOrder(int zOrder)
|
java.lang.String |
toString()
Returns the Spatial's name followed by the class of the spatial Example: "MyNode (com.jme.scene.Spatial) |
void |
updateCollisionTree()
This method updates the exact bounding tree of any this Spatial. |
void |
updateGeometricState(float time,
boolean initiator)
updateGeometricState updates all the geometry information
for the node. |
void |
updateRenderState()
Updates the render state values of this Spatial and and children it has. |
protected void |
updateRenderState(java.util.Stack[] parentStates)
Called internally. |
abstract void |
updateWorldBound()
updateWorldBound updates the bounding volume of the world. |
protected void |
updateWorldData(float time)
updateWorldData updates the world transforms from the
parent down to the leaf. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected Quaternion localRotation
protected Quaternion worldRotation
protected Vector3f localTranslation
protected Vector3f worldTranslation
protected Vector3f localScale
protected Vector3f worldScale
protected boolean forceCull
protected boolean forceView
protected BoundingVolume worldBound
protected transient Node parent
public static RenderState[] defaultStateList
protected static RenderState[] currentStates
protected RenderState[] renderStateList
protected int renderQueueMode
protected int zOrder
public transient float queueDistance
protected int lightCombineMode
protected int textureCombineMode
protected java.util.ArrayList geometricalControllers
protected java.lang.String name
protected int frustrumIntersects
| Constructor Detail |
public Spatial()
public Spatial(java.lang.String name)
Spatial object setting the
rotation, translation and scale value to defaults.
name - the name of the scene element. This is required for
identification and comparision purposes.| Method Detail |
public void setName(java.lang.String name)
name - The spatial's new name.public java.lang.String getName()
public void addController(Controller controller)
controller - The Controller to addControllerpublic boolean removeController(Controller controller)
controller - The Controller to remove
Controllerpublic Controller getController(int i)
i - The index to get a controller from.
Controllerpublic java.util.ArrayList getControllers()
public BoundingVolume getWorldBound()
getWorldBound retrieves the world bound at this node
level.
public void setWorldBound(BoundingVolume worldBound)
setWorldBound sets the world bound for this node level.
This function should only be used in rare situations. In most cases,
users will let jME's engine set the world bound and will instead call
setModelBound on the leaf nodes.
worldBound - the world bound at this level.Geometry.setModelBound(com.jme.bounding.BoundingVolume)public void onDraw(Renderer r)
onDraw checks the node with the camera to see if it should
be culled, if not, the node's draw method is called.
r - the renderer used for display.public void onDrawBounds(Renderer r)
onDrawBounds checks the node with the camera to see if it
should be culled, if not, the node's draw method is called.
r - the renderer used for display.public abstract void draw(Renderer r)
draw abstract method that handles drawing data to the
renderer if it is geometry and passing the call to it's children if it is
a node.
r - the renderer used for display.public abstract void drawBounds(Renderer r)
drawBounds abstract method that handles drawing bounds
data to the renderer if it is geometry and passing the call to it's
children if it is a node.
r - the renderer used for display.public Quaternion getWorldRotation()
getWorldRotation retrieves the absolute rotation of the
Spatial.
public Vector3f getWorldTranslation()
getWorldTranslation retrieves the absolute translation of
the spatial.
public Vector3f getWorldScale()
getWorldScale retrieves the absolute scale factor of the
spatial.
public boolean isForceCulled()
isForceCulled reports if this node should always be culled
or not. If true, this node will not be displayed.
public boolean isForceView()
isForceView returns true if the node will be rendered
whether it's in the camera frustum or not.
public void setForceCull(boolean forceCull)
setForceCull sets if this node should always be culled or
not. True will always cull the node, false will allow proper culling to
take place.
NOTE: You must set this AFTER attaching to a parent or it will be reset
with the parent's forceCull value.
forceCull - the value for forcing a culling.public abstract void setForceView(boolean value)
setForceView will force the node to be rendered whether
it's in the camera frustum or not.
value - true to force viewing, false otherwise.
public void updateGeometricState(float time,
boolean initiator)
updateGeometricState updates all the geometry information
for the node.
time - the frame time.initiator - true if this node started the update process.protected void updateWorldData(float time)
updateWorldData updates the world transforms from the
parent down to the leaf.
time - the frame time.public abstract void updateWorldBound()
updateWorldBound updates the bounding volume of the world.
Abstract, geometry transforms the bound while node merges the children's
bound. In most cases, users will want to call updateModelBound() and let
this function be called automatically during updateGeometricState().
public void updateRenderState()
protected void updateRenderState(java.util.Stack[] parentStates)
parentStates - The list of parent renderstates.protected void applyRenderState(java.util.Stack[] states)
states - An array of stacks for each state.protected void propagateStatesFromRoot(java.util.Stack[] states)
states - The Stack[] to push states onto.public void propagateBoundToRoot()
propagateBoundToRoot passes the new world bound up the
tree to the root.
public Node getParent()
getParent retrieve's this node's parent. If the parent is
null this is the root node.
public void setParent(Node parent)
setParent sets the parent of this node.
parent - the parent of this node.public boolean removeFromParent()
removeFromParent removes this Spatial from it's parent.
public Quaternion getLocalRotation()
getLocalRotation retrieves the local rotation of this
node.
public void setLocalRotation(Matrix3f rotation)
setLocalRotation sets the local rotation of this node.
rotation - the new local rotation.public void setLocalRotation(Quaternion quaternion)
setLocalRotation sets the local rotation of this node,
using a quaterion to build the matrix.
quaternion - the quaternion that defines the matrix.public Vector3f getLocalScale()
getLocalScale retrieves the local scale of this node.
public void setLocalScale(float localScale)
setLocalScale sets the local scale of this node.
localScale - the new local scale, applied to x, y and zpublic void setLocalScale(Vector3f localScale)
setLocalScale sets the local scale of this node.
localScale - the new local scale.public Vector3f getLocalTranslation()
getLocalTranslation retrieves the local translation of
this node.
public void setLocalTranslation(Vector3f localTranslation)
setLocalTranslation sets the local translation of this
node.
localTranslation - the local translation of this node.public RenderState setRenderState(RenderState rs)
setRenderState sets a render state for this node. Note,
there can only be one render state per type per node. That is, there can
only be a single AlphaState a single TextureState, etc. If there is
already a render state for a type set the old render state will be
returned. Otherwise, null is returned.
rs - the render state to add.
public RenderState[] getRenderStateList()
public void clearRenderState(int renderStateType)
renderStateType - The index of a RenderState to clearRenderState.getType()public void setRenderQueueMode(int renderQueueMode)
public int getRenderQueueMode()
public void setZOrder(int zOrder)
public int getZOrder()
public void setLightCombineMode(int lightCombineMode)
lightCombineMode - The light combine mode for this spatialLightState.COMBINE_CLOSEST,
LightState.COMBINE_FIRST,
LightState.COMBINE_RECENT_ENABLED,
LightState.INHERIT,
LightState.OFF,
LightState.REPLACEpublic int getLightCombineMode()
public void setTextureCombineMode(int textureCombineMode)
textureCombineMode - The new texture combine mode for this spatial.TextureState.COMBINE_CLOSEST,
TextureState.COMBINE_FIRST,
TextureState.COMBINE_RECENT_ENABLED,
TextureState.INHERIT,
TextureState.OFF,
TextureState.REPLACEpublic int getTextureCombineMode()
public int getLastFrustumIntersection()
public static void clearCurrentStates()
public static void clearCurrentState(int state)
state - the state to clear.public static RenderState getCurrentState(int state)
public static void applyDefaultStates()
public void calculateCollisions(Spatial scene,
CollisionResults results)
calculateCollisions calls findCollisions to populate the
CollisionResults object then processes the collision results.
scene - the scene to test against.results - the results object.
public abstract void findCollisions(Spatial scene,
CollisionResults results)
scene - the scene to test against.results - the results of the collisions.
public abstract boolean hasCollision(Spatial scene,
boolean checkTriangles)
public void calculatePick(Ray ray,
PickResults results)
public abstract void findPick(Ray toTest,
PickResults results)
public void updateCollisionTree()
public java.lang.String toString()
public Spatial putClone(Spatial store,
CloneCreator properties)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||