|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.scene.Spatial
com.jme.scene.Node
public class Node
Node
defines an internal node of a scene graph. The internal
node maintains a collection of children and handles merging said children
into a single bound to allow for very fast culling of multiple nodes. Node
allows for any number of children to be attached.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.jme.scene.Spatial |
---|
Spatial.CullHint, Spatial.LightCombineMode, Spatial.NormalsMode, Spatial.TextureCombineMode |
Field Summary | |
---|---|
protected java.util.List<Spatial> |
children
This node's children. |
Fields inherited from class com.jme.scene.Spatial |
---|
cullHint, frustrumIntersects, geometricalControllers, isCollidable, lightCombineMode, localRotation, localScale, localTranslation, LOCKED_BOUNDS, LOCKED_BRANCH, LOCKED_MESH_DATA, LOCKED_NONE, LOCKED_SHADOWS, LOCKED_TRANSFORMS, lockedMode, name, normalsMode, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder |
Constructor Summary | |
---|---|
Node()
Default constructor. |
|
Node(java.lang.String name)
Constructor instantiates a new Node with a default empty
list for containing children. |
Method Summary | |
---|---|
protected void |
applyRenderState(java.util.Stack<? extends RenderState>[] states)
Applies the stack of render states to each child by calling updateRenderState(states) on each child. |
int |
attachChild(Spatial child)
attachChild attaches a child to this node. |
int |
attachChildAt(Spatial child,
int index)
attachChildAt attaches a child to this node at an index. |
void |
childChange(Geometry geometry,
int index1,
int index2)
|
void |
detachAllChildren()
detachAllChildren removes all children attached to this
node. |
int |
detachChild(Spatial child)
detachChild removes a given child from the node's list. |
Spatial |
detachChildAt(int index)
detachChildAt removes a child at a given index. |
int |
detachChildNamed(java.lang.String childName)
detachChild removes a given child from the node's list. |
void |
draw(Renderer r)
draw calls the onDraw method for each child maintained by
this node. |
void |
findCollisions(Spatial scene,
CollisionResults results)
checks this spatial against a second spatial, any collisions are stored in the results object. |
void |
findPick(Ray toTest,
PickResults results)
Tests a ray against this spatial, and stores the results in the result object. |
Spatial |
getChild(int i)
getChild returns a child at a given index. |
Spatial |
getChild(java.lang.String name)
getChild returns the first child found with exactly the
given name (case sensitive.) |
int |
getChildIndex(Spatial sp)
|
java.util.List<Spatial> |
getChildren()
Returns all children to this node. |
int |
getQuantity()
getQuantity returns the number of children this node
maintains. |
int |
getTriangleCount()
getTriangleCount returns the number of triangles contained
in all sub-branches of this node that contain geometry. |
int |
getVertexCount()
getVertexCount returns the number of vertices contained
in all sub-branches of this node that contain geometry. |
boolean |
hasChild(Spatial spat)
determines if the provided Spatial is contained in the children list of this node. |
boolean |
hasCollision(Spatial scene,
boolean checkTriangles)
Checks this spatial against a second spatial for collisions. |
void |
lockBounds()
Calling this method tells the scenegraph that it is not necessary to update bounds from this point in the scenegraph on down to the leaves. |
void |
lockMeshes(Renderer r)
Flags this spatial and those below it that any meshes in the specified scenegraph location or lower will not have changes in vertex, texcoord, normal or color data. |
void |
lockShadows()
Calling this method tells the scenegraph that it is not necessary to update Shadow volumes that may be associated with this Spatial. |
void |
lockTransforms()
Flags this spatial and those below it in the scenegraph to not recalculate world transforms such as translation, rotation and scale on every update. |
void |
read(JMEImporter e)
|
void |
setModelBound(BoundingVolume modelBound)
setModelBound sets the bounding object for this Spatial. |
void |
sortLights()
|
void |
swapChildren(int index1,
int index2)
|
void |
unlockBounds()
Flags this spatial and those below it to allow for bounds updating (the default). |
void |
unlockMeshes(Renderer r)
Flags this spatial and those below it to allow for mesh updating (the default). |
void |
unlockShadows()
Flags this spatial and those below it to allow for shadow volume updates (the default). |
void |
unlockTransforms()
Flags this spatial and those below it to allow for transform updating (the default). |
void |
updateModelBound()
updateBound recalculates the bounding object for this
Spatial. |
void |
updateWorldBound()
updateWorldBound merges the bounds of all the children
maintained by this node. |
void |
updateWorldData(float time)
updateWorldData updates all the children maintained by
this node. |
void |
updateWorldVectors(boolean recurse)
If not locked, updates worldscale, worldrotation and worldtranslation |
void |
write(JMEExporter e)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.jme.util.export.Savable |
---|
getClassTag |
Field Detail |
---|
protected java.util.List<Spatial> children
Constructor Detail |
---|
public Node()
public Node(java.lang.String name)
Node
with a default empty
list for containing children.
name
- the name of the scene element. This is required for
identification and comparision purposes.Method Detail |
---|
public int getQuantity()
getQuantity
returns the number of children this node
maintains.
public int getTriangleCount()
getTriangleCount
returns the number of triangles contained
in all sub-branches of this node that contain geometry.
getTriangleCount
in class Spatial
public int getVertexCount()
getVertexCount
returns the number of vertices contained
in all sub-branches of this node that contain geometry.
getVertexCount
in class Spatial
public int attachChild(Spatial child)
attachChild
attaches a child to this node. This node
becomes the child's parent. The current number of children maintained is
returned.
child
- the child to attach to this node.
public int attachChildAt(Spatial child, int index)
attachChildAt
attaches a child to this node at an index. This node
becomes the child's parent. The current number of children maintained is
returned.
child
- the child to attach to this node.
public int detachChild(Spatial child)
detachChild
removes a given child from the node's list.
This child will no longe be maintained.
child
- the child to remove.
public int detachChildNamed(java.lang.String childName)
detachChild
removes a given child from the node's list.
This child will no longe be maintained. Only the first child with a
matching name is removed.
childName
- the child to remove.
public Spatial detachChildAt(int index)
detachChildAt
removes a child at a given index. That child
is returned for saving purposes.
index
- the index of the child to be removed.
public void detachAllChildren()
detachAllChildren
removes all children attached to this
node.
public int getChildIndex(Spatial sp)
public void swapChildren(int index1, int index2)
public Spatial getChild(int i)
getChild
returns a child at a given index.
i
- the index to retrieve the child from.
public Spatial getChild(java.lang.String name)
getChild
returns the first child found with exactly the
given name (case sensitive.)
name
- the name of the child to retrieve. If null, we'll return null.
public boolean hasChild(Spatial spat)
spat
- the child object to look for.
public void updateWorldData(float time)
updateWorldData
updates all the children maintained by
this node.
updateWorldData
in class Spatial
time
- the frame time.public void updateWorldVectors(boolean recurse)
Spatial
updateWorldVectors
in class Spatial
recurse
- usually false when updating the tree. Set to true when you
just want to update the world transforms for a branch without
updating geometric state.public void lockBounds()
Spatial
lockBounds
in class Spatial
Spatial.unlockBounds()
public void lockShadows()
Spatial
lockShadows
in class Spatial
Spatial.unlockShadows()
public void lockTransforms()
Spatial
lockTransforms
in class Spatial
Spatial.unlockTransforms()
public void lockMeshes(Renderer r)
Spatial
lockMeshes
in class Spatial
r
- A renderer to lock against.Spatial.unlockMeshes(Renderer)
public void unlockBounds()
Spatial
unlockBounds
in class Spatial
Spatial.lockBounds()
public void unlockShadows()
Spatial
unlockShadows
in class Spatial
Spatial.lockShadows()
public void unlockTransforms()
Spatial
unlockTransforms
in class Spatial
Spatial.lockTransforms()
public void unlockMeshes(Renderer r)
Spatial
unlockMeshes
in class Spatial
r
- The renderer used to lock against.Spatial.lockMeshes(Renderer)
public void draw(Renderer r)
draw
calls the onDraw method for each child maintained by
this node.
draw
in class Spatial
r
- the renderer to draw to.Spatial.draw(com.jme.renderer.Renderer)
protected void applyRenderState(java.util.Stack<? extends RenderState>[] states)
applyRenderState
in class Spatial
states
- The Stack[] of render states to apply to each child.public void sortLights()
sortLights
in class Spatial
public void updateWorldBound()
updateWorldBound
merges the bounds of all the children
maintained by this node. This will allow for faster culling operations.
updateWorldBound
in class Spatial
Spatial.updateWorldBound()
public void findCollisions(Spatial scene, CollisionResults results)
Spatial
findCollisions
in class Spatial
scene
- the scene to test against.results
- the results of the collisions.public boolean hasCollision(Spatial scene, boolean checkTriangles)
Spatial
hasCollision
in class Spatial
scene
- the scene to test against.checkTriangles
- check for collisions on triangle accuracy level
public void findPick(Ray toTest, PickResults results)
Spatial
findPick
in class Spatial
toTest
- ray to test picking againstresults
- the results of the pickingpublic java.util.List<Spatial> getChildren()
public void childChange(Geometry geometry, int index1, int index2)
public void write(JMEExporter e) throws java.io.IOException
write
in interface Savable
write
in class Spatial
java.io.IOException
public void read(JMEImporter e) throws java.io.IOException
read
in interface Savable
read
in class Spatial
java.io.IOException
public void setModelBound(BoundingVolume modelBound)
Spatial
setModelBound
sets the bounding object for this Spatial.
setModelBound
in class Spatial
modelBound
- the bounding object for this spatial.public void updateModelBound()
Spatial
updateBound
recalculates the bounding object for this
Spatial.
updateModelBound
in class Spatial
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |