com.model.md5
Class MD5Node

java.lang.Object
  extended by com.jme.scene.Spatial
      extended by com.jme.scene.Node
          extended by com.model.md5.MD5Node
All Implemented Interfaces:
com.jme.util.export.Savable, IMD5Node, java.io.Serializable

public class MD5Node
extends com.jme.scene.Node
implements IMD5Node

MD5Node is the final product of MD5 loading process.

ModelNode maintains the loaded IJoint and IMesh instances and update them accordingly.

MD5Node provides the cloning functionality so that users can fast clone model nodes that may be used by multiple entities. The newly cloned MD5Node is already initialized and ready to be used.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jme.scene.Spatial
com.jme.scene.Spatial.CullHint, com.jme.scene.Spatial.LightCombineMode, com.jme.scene.Spatial.NormalsMode, com.jme.scene.Spatial.TextureCombineMode
 
Field Summary
 
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
MD5Node()
          Constructor of MD5Node.
MD5Node(java.lang.String name, IJoint[] joints, IMesh[] meshes)
          Constructor of MD5Node.
 
Method Summary
 void addController(IMD5Controller controller)
          Add a controller to control this node.
 void attachChild(IMD5Node node, int jointIndex)
          Attach the given MD5 node to the joint with given index.
 void attachChild(IMD5Node node, java.lang.String jointID)
          Attach the given MD5 node to the joint with given ID.
 void attachDependent(IMD5Node node)
          Attach the given MD5 node as a dependent child which shares the skeleton with this node.
 IMD5Node clone()
          Clone this MD5 node.
 boolean equals(java.lang.Object object)
           
 void flagUpdate()
          Notify the IMD5Node that its skeleton has been modified.
 java.lang.Class getClassTag()
           
 IJoint getJoint(int index)
          Retrieve the joint with given index.
 IJoint[] getJoints()
          Retrieve the skeleton of this MD5 node.
 IMesh getMesh(int index)
          Retrieve the mesh with given index.
 IMesh[] getMeshes()
          Retrieve all the meshes maintained by this node.
 IJoint getRootJoint()
          Retrieve the root joint.
 int hashCode()
           
 void initialize()
          Initialize the IMD5Node.
 boolean isDependent()
          Check if this MD5 node is a dependent child of some other node.
 void read(com.jme.util.export.JMEImporter im)
           
 void removeChild(IMD5Node node)
          Remove the given child from this node.
 void removeController(IMD5Controller controller)
          Remove the given controller from this node.
 void removeDependent(IMD5Node node)
          Remove the given dependent child.
protected  void setDependent(boolean dependent, IMD5Node parent)
          Set this MD5 node as a dependent child of another MD5 node.
 java.lang.String toString()
           
 void updateGeometricState(float time, boolean initiator)
           
 void write(com.jme.util.export.JMEExporter ex)
           
 
Methods inherited from class com.jme.scene.Node
applyRenderState, attachChild, attachChildAt, childChange, detachAllChildren, detachChild, detachChildAt, detachChildNamed, draw, findCollisions, findPick, getChild, getChild, getChildIndex, getChildren, getQuantity, getTriangleCount, getVertexCount, hasChild, hasCollision, lockBounds, lockMeshes, lockShadows, lockTransforms, setModelBound, sortLights, swapChildren, unlockBounds, unlockMeshes, unlockShadows, unlockTransforms, updateModelBound, updateWorldBound, updateWorldData, updateWorldVectors
 
Methods inherited from class com.jme.scene.Spatial
addController, calculateCollisions, calculatePick, clearControllers, clearRenderState, clearRenderState, getController, getControllerCount, getControllers, getCullHint, getLastFrustumIntersection, getLightCombineMode, getLocalCullHint, getLocalLightCombineMode, getLocalNormalsMode, getLocalRenderQueueMode, getLocalRotation, getLocalScale, getLocalTextureCombineMode, getLocalToWorldMatrix, getLocalTranslation, getLocks, getName, getNormalsMode, getParent, getRenderQueueMode, getRenderState, getRenderState, getTextureCombineMode, getUserData, getWorldBound, getWorldRotation, getWorldScale, getWorldTranslation, getZOrder, hasAncestor, isCollidable, localToWorld, lock, lock, lockBranch, lockMeshes, lookAt, onDraw, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeController, removeFromParent, removeUserData, rotateUpTo, setCullHint, setIsCollidable, setLastFrustumIntersection, setLightCombineMode, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setLocalTranslation, setLocks, setLocks, setName, setNormalsMode, setParent, setRenderQueueMode, setRenderState, setTextureCombineMode, setUserData, setZOrder, setZOrder, unlock, unlock, unlockBranch, unlockMeshes, updateRenderState, updateRenderState, updateWorldRotation, updateWorldScale, updateWorldTranslation, updateWorldVectors, worldToLocal
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.model.md5.interfaces.IMD5Node
getName
 

Constructor Detail

MD5Node

public MD5Node()
Constructor of MD5Node.


MD5Node

public MD5Node(java.lang.String name,
               IJoint[] joints,
               IMesh[] meshes)
Constructor of MD5Node.

Parameters:
name - The String name.
Method Detail

initialize

public void initialize()
Description copied from interface: IMD5Node
Initialize the IMD5Node.

Specified by:
initialize in interface IMD5Node

updateGeometricState

public void updateGeometricState(float time,
                                 boolean initiator)
Overrides:
updateGeometricState in class com.jme.scene.Spatial

addController

public void addController(IMD5Controller controller)
Description copied from interface: IMD5Node
Add a controller to control this node.

Specified by:
addController in interface IMD5Node
Parameters:
controller - The IMD5Controller instance.

attachChild

public void attachChild(IMD5Node node,
                        java.lang.String jointID)
Description copied from interface: IMD5Node
Attach the given MD5 node to the joint with given ID.

Specified by:
attachChild in interface IMD5Node
Parameters:
node - The IMD5Node needs to be attached.
jointID - The String ID of the joint.

attachChild

public void attachChild(IMD5Node node,
                        int jointIndex)
Description copied from interface: IMD5Node
Attach the given MD5 node to the joint with given index.

Specified by:
attachChild in interface IMD5Node
Parameters:
node - The IMD5Node needs to be attached.
jointIndex - The Integer index of the joint.

attachDependent

public void attachDependent(IMD5Node node)
Description copied from interface: IMD5Node
Attach the given MD5 node as a dependent child which shares the skeleton with this node.

Specified by:
attachDependent in interface IMD5Node
Parameters:
node - The dependent IMD5Node needs to be attached.

removeController

public void removeController(IMD5Controller controller)
Description copied from interface: IMD5Node
Remove the given controller from this node.

Specified by:
removeController in interface IMD5Node
Parameters:
controller - The IMD5Controller instance.

removeChild

public void removeChild(IMD5Node node)
Description copied from interface: IMD5Node
Remove the given child from this node.

Specified by:
removeChild in interface IMD5Node
Parameters:
node - The IMD5Node instance.

removeDependent

public void removeDependent(IMD5Node node)
Description copied from interface: IMD5Node
Remove the given dependent child.

Specified by:
removeDependent in interface IMD5Node
Parameters:
node - The IMD5Node instance.

flagUpdate

public void flagUpdate()
Description copied from interface: IMD5Node
Notify the IMD5Node that its skeleton has been modified.

Specified by:
flagUpdate in interface IMD5Node

setDependent

protected void setDependent(boolean dependent,
                            IMD5Node parent)
Set this MD5 node as a dependent child of another MD5 node. This makes this node share the skeleton structure of its parent node.

Parameters:
dependent - True if this mesh should be set as dependent.
parent - The IMD5Node parent.

getJoints

public IJoint[] getJoints()
Description copied from interface: IMD5Node
Retrieve the skeleton of this MD5 node.

Specified by:
getJoints in interface IMD5Node
Returns:
The array of IJoint.

getJoint

public IJoint getJoint(int index)
Description copied from interface: IMD5Node
Retrieve the joint with given index.

Specified by:
getJoint in interface IMD5Node
Parameters:
index - The Integer index number.
Returns:
The IJoint instance.

getRootJoint

public IJoint getRootJoint()
Description copied from interface: IMD5Node
Retrieve the root joint.

Specified by:
getRootJoint in interface IMD5Node
Returns:
The root IJoint instance.

getMesh

public IMesh getMesh(int index)
Description copied from interface: IMD5Node
Retrieve the mesh with given index.

Specified by:
getMesh in interface IMD5Node
Parameters:
index - The Integer index number.
Returns:
The IMesh instance.

getMeshes

public IMesh[] getMeshes()
Description copied from interface: IMD5Node
Retrieve all the meshes maintained by this node.

Specified by:
getMeshes in interface IMD5Node
Returns:
The array of IMesh instances.

getClassTag

public java.lang.Class getClassTag()
Specified by:
getClassTag in interface com.jme.util.export.Savable
Overrides:
getClassTag in class com.jme.scene.Spatial

isDependent

public boolean isDependent()
Description copied from interface: IMD5Node
Check if this MD5 node is a dependent child of some other node.

Specified by:
isDependent in interface IMD5Node
Returns:
True if this MD5 node is dependent. False otherwise.

write

public void write(com.jme.util.export.JMEExporter ex)
           throws java.io.IOException
Specified by:
write in interface com.jme.util.export.Savable
Overrides:
write in class com.jme.scene.Node
Throws:
java.io.IOException

read

public void read(com.jme.util.export.JMEImporter im)
          throws java.io.IOException
Specified by:
read in interface com.jme.util.export.Savable
Overrides:
read in class com.jme.scene.Node
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class com.jme.scene.Spatial

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

clone

public IMD5Node clone()
Description copied from interface: IMD5Node
Clone this MD5 node.

Specified by:
clone in interface IMD5Node
Overrides:
clone in class java.lang.Object
Returns:
The cloned IMD5Node instance.