com.jmex.model.animation
Class JointController

java.lang.Object
  extended by com.jme.scene.Controller
      extended by com.jmex.model.animation.JointController
All Implemented Interfaces:
Savable, java.io.Serializable

public class JointController
extends Controller

Started Date: Jun 9, 2004
This controller animates a Node's JointMesh children acording to the joints stored inside movementInfo.

Author:
Jack Lindamood
See Also:
Serialized Form

Field Summary
 float FPS
          Currently unused.
 TransformMatrix[] localRefMatrix
          Local refrence matrix that can determine a joint's position in space relative to its parent.
 java.util.ArrayList<PointInTime> movementInfo
          movementInfo[i] contains a float value time and an array of TransformMatrix.
 java.util.ArrayList<JointMesh> movingMeshes
          Array of all the meshes this controller should consider animating.
 int numJoints
          It is JointController's responsibility to keep changePoints sorted by time at all times.
 int[] parentIndex
          parentIndex contains a list of who's parent a joint is.
 float skipRate
          Tells update that it should be called every skipRate seconds
 
Fields inherited from class com.jme.scene.Controller
RT_CLAMP, RT_CYCLE, RT_WRAP
 
Constructor Summary
JointController()
           
JointController(int numJoints)
          Constructs a new JointController that will hold the given number of joints.
 
Method Summary
 void addJointMesh(JointMesh child)
          Adds a jointmesh for this JointController to consider animating.
 float getCurrentTime()
           
 boolean getModelUpdate()
          Returns true if the model's bounding volume is being updated every frame.
 void processController()
          Processes a JointController by filling holes and creating inverse matrixes.
 void read(JMEImporter e)
           
 void setModelUpdate(boolean update)
          If true, the model's bounding volume will be updated every frame.
 void setRotation(int jointNumber, float time, float x, float y, float z)
          Tells JointController that at time time the joint jointNumber will rotate acording to the euler angles x,y,z relative to its parent's rotation
 void setRotation(int jointNumber, float time, Quaternion quaternion)
          Tells JointController that at time time the joint jointNumber will rotate acording to Quaternion.
 void setTimes(int start, int end)
          Sets the frames the joint controller will animate from and to.
 void setTranslation(int jointNumber, float time, float x, float y, float z)
          Tells JointController that at time time the joint jointNumber will translate to x,y,z relative to its parent
 void setTranslation(int jointNumber, float time, Vector3f trans)
          Tells JointController that at time time the joint jointNumber will translate to x,y,z relative to its parent
 void update(float time)
          Updates the movingMeshes by updating their joints +=time
 void write(JMEExporter e)
           
 
Methods inherited from class com.jme.scene.Controller
getClassTag, getControllerValues, getMaxTime, getMinTime, getRepeatType, getSpeed, isActive, setActive, setControllerValues, setMaxTime, setMinTime, setRepeatType, setSpeed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numJoints

public int numJoints
It is JointController's responsibility to keep changePoints sorted by time at all times.


movementInfo

public java.util.ArrayList<PointInTime> movementInfo
movementInfo[i] contains a float value time and an array of TransformMatrix. At time time the joint i is at movement jointChange[i]


parentIndex

public int[] parentIndex
parentIndex contains a list of who's parent a joint is. -1 indicates a root joint with no parent


localRefMatrix

public TransformMatrix[] localRefMatrix
Local refrence matrix that can determine a joint's position in space relative to its parent.


FPS

public float FPS
Currently unused.


movingMeshes

public java.util.ArrayList<JointMesh> movingMeshes
Array of all the meshes this controller should consider animating.


skipRate

public float skipRate
Tells update that it should be called every skipRate seconds

Constructor Detail

JointController

public JointController()

JointController

public JointController(int numJoints)
Constructs a new JointController that will hold the given number of joints.

Parameters:
numJoints - The number of joints this jointController will have
Method Detail

getCurrentTime

public float getCurrentTime()

setTranslation

public void setTranslation(int jointNumber,
                           float time,
                           float x,
                           float y,
                           float z)
Tells JointController that at time time the joint jointNumber will translate to x,y,z relative to its parent

Parameters:
jointNumber - Index of joint to affect
time - Which time the joint will take these values
x - Joint's x translation
y - Joint's y translation
z - Joint's z translation

setTranslation

public void setTranslation(int jointNumber,
                           float time,
                           Vector3f trans)
Tells JointController that at time time the joint jointNumber will translate to x,y,z relative to its parent

Parameters:
jointNumber - Index of joint to affect
time - Which time the joint will take these values
trans - Joint's translation

setRotation

public void setRotation(int jointNumber,
                        float time,
                        float x,
                        float y,
                        float z)
Tells JointController that at time time the joint jointNumber will rotate acording to the euler angles x,y,z relative to its parent's rotation

Parameters:
jointNumber - Index of joint to affect
time - Which time the joint will take these values
x - Joint's x rotation
y - Joint's y rotation
z - Joint's z rotation

setRotation

public void setRotation(int jointNumber,
                        float time,
                        Quaternion quaternion)
Tells JointController that at time time the joint jointNumber will rotate acording to Quaternion.

Parameters:
jointNumber - Index of joint to affect
time - Which time the joint will take these values
quaternion - The joint's new rotation

update

public void update(float time)
Updates the movingMeshes by updating their joints +=time

Specified by:
update in class Controller
Parameters:
time - Time from last update

setTimes

public void setTimes(int start,
                     int end)
Sets the frames the joint controller will animate from and to. The frames are dependant upon the FPS. Remember that the first frame starts at 1, NOT 0.

Parameters:
start - The starting frame number.
end - The ending frame number.

processController

public void processController()
Processes a JointController by filling holes and creating inverse matrixes. Should only be called once per JointController object lifetime


setModelUpdate

public void setModelUpdate(boolean update)
If true, the model's bounding volume will be updated every frame. If false, it will not.

Parameters:
update - The new update model volume per frame value.

getModelUpdate

public boolean getModelUpdate()
Returns true if the model's bounding volume is being updated every frame.

Returns:
True if bounding volume is updating.

addJointMesh

public void addJointMesh(JointMesh child)
Adds a jointmesh for this JointController to consider animating.

Parameters:
child - Child JointMesh to consider

write

public void write(JMEExporter e)
           throws java.io.IOException
Specified by:
write in interface Savable
Overrides:
write in class Controller
Throws:
java.io.IOException

read

public void read(JMEImporter e)
          throws java.io.IOException
Specified by:
read in interface Savable
Overrides:
read in class Controller
Throws:
java.io.IOException