|
||||||||||
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
com.jme.scene.SwitchNode
public class SwitchNode
SwitchNode
defines a node that maintains a single active child
at a time. This allows the instantanious switching of children depending on
any number of factors. For example, multiple levels of detail models can be
loaded into the switch node and the active model can be set depending on the
distance from the camera.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.jme.scene.Spatial |
---|
Spatial.CullHint, Spatial.LightCombineMode, Spatial.NormalsMode, Spatial.TextureCombineMode |
Field Summary | |
---|---|
static int |
SN_INVALID_CHILD
defines an inactive or invalid child. |
Fields inherited from class com.jme.scene.Node |
---|
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 | |
---|---|
SwitchNode()
|
|
SwitchNode(java.lang.String name)
Constructor instantiates a new SwitchNode object. |
Method Summary | |
---|---|
int |
attachChild(Spatial child)
Attaches a child to this SwitchNode. |
int |
attachChildAt(Spatial child,
int index)
Attaches a child to this SwitchNode at a specified index. |
void |
disableAllChildren()
Marks the node to render nothing on a draw. |
void |
draw(Renderer r)
If a valid active child is set, that child is rendered and none others. |
void |
findCollisions(Spatial scene,
CollisionResults results)
collisions are checked for the currently active child. |
void |
findPick(Ray toTest,
PickResults results)
Tests a ray against this spatial, and stores the results in the result object. |
int |
getActiveChild()
Returns the index of the currently rendered child for this Node. |
boolean |
hasCollision(Spatial scene,
boolean checkTriangles)
collisions are checked for the currently active child. |
void |
read(JMEImporter e)
|
void |
setActiveChild(int child)
Sets the index of the child of this Node that will be rendered. |
void |
write(JMEExporter e)
|
Methods inherited from class com.jme.scene.Node |
---|
applyRenderState, childChange, detachAllChildren, detachChild, detachChildAt, detachChildNamed, getChild, getChild, getChildIndex, getChildren, getQuantity, getTriangleCount, getVertexCount, hasChild, lockBounds, lockMeshes, lockShadows, lockTransforms, setModelBound, sortLights, swapChildren, unlockBounds, unlockMeshes, unlockShadows, unlockTransforms, updateModelBound, updateWorldBound, updateWorldData, updateWorldVectors |
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 |
---|
public static final int SN_INVALID_CHILD
Constructor Detail |
---|
public SwitchNode()
public SwitchNode(java.lang.String name)
SwitchNode
object. The name
of the node is provided during construction.
name
- the name of the node.Method Detail |
---|
public int getActiveChild()
public void setActiveChild(int child)
child
- The child index of this node it should render.public void disableAllChildren()
public int attachChild(Spatial child)
attachChild
in class Node
child
- the child to attach to this node.
public int attachChildAt(Spatial child, int index)
attachChildAt
in class Node
child
- the child to attach to this node.
public void draw(Renderer r)
draw
in class Node
r
- The render system to draw the child.Spatial.draw(com.jme.renderer.Renderer)
public void findCollisions(Spatial scene, CollisionResults results)
findCollisions
in class Node
scene
- the scene to test against.results
- the results of the collisions.public boolean hasCollision(Spatial scene, boolean checkTriangles)
hasCollision
in class Node
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 Node
toTest
- ray to test picking againstresults
- the results of the pickingpublic void write(JMEExporter e) throws java.io.IOException
write
in interface Savable
write
in class Node
java.io.IOException
public void read(JMEImporter e) throws java.io.IOException
read
in interface Savable
read
in class Node
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |