org.jagatoo.loaders.models.collada.datastructs.controllers
Class SkeletalController

java.lang.Object
  extended by org.jagatoo.loaders.models.collada.datastructs.geometries.GeometryProvider
      extended by org.jagatoo.loaders.models.collada.datastructs.controllers.Controller
          extended by org.jagatoo.loaders.models.collada.datastructs.controllers.SkeletalController
All Implemented Interfaces:
AnimatableModel

public class SkeletalController
extends Controller
implements AnimatableModel

A COLLADA Skeletal Controller. It computes mesh deformation from the keyframe information.

See Also:
GeometryProvider

Field Summary
 LibraryAnimations libAnims
          Library Of Animations
 
Fields inherited from class org.jagatoo.loaders.models.collada.datastructs.geometries.GeometryProvider
destinationGeometry
 
Constructor Summary
SkeletalController(LibraryGeometries libGeoms, java.lang.String sourceMeshId, XMLController controller, LibraryAnimations libAnims, Skeleton skel)
          Creates a new COLLADASkeletalController
 
Method Summary
 void calcActions(java.lang.String actionId)
           
 COLLADAAction getAction(java.lang.String id)
          Get a specific action
 java.util.HashMap<java.lang.String,COLLADAAction> getActions()
           
 ColladaProtoypeModel getPrototypeModel()
          Get the prototype model (Jagatoo side) used by this model (Game engine side).
 java.lang.String getSourceMeshId()
           
 boolean hasActions()
           
 boolean isLooping()
           
 boolean isPlaying()
           
 int numActions()
           
 void pause()
          Pause the model (stop to play an animation).
 void play(COLLADAAction action, boolean loop)
          Starts playing the selected animation
 void play(java.lang.String actionId, boolean loop)
          Begin to play a particular action, whatever the model was doing (we don't mind if it was paused or what..)
 void resume()
          Pause the model (stop to play an animation).
 void setSkeleton(Skeleton skeleton)
          Set the skeleton of this controller
 Geometry updateDestinationGeometry(long currTime)
           
 
Methods inherited from class org.jagatoo.loaders.models.collada.datastructs.controllers.Controller
getController
 
Methods inherited from class org.jagatoo.loaders.models.collada.datastructs.geometries.GeometryProvider
getDestinationGeometry, getLibraryGeometries, setDestinationMesh
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

libAnims

public LibraryAnimations libAnims
Library Of Animations

Constructor Detail

SkeletalController

public SkeletalController(LibraryGeometries libGeoms,
                          java.lang.String sourceMeshId,
                          XMLController controller,
                          LibraryAnimations libAnims,
                          Skeleton skel)
Creates a new COLLADASkeletalController

Parameters:
libGeoms - The LibraryGeometries we need to get our sourceMesh from
sourceMeshId - The source mesh ID
controller - The XML Controller instance
libAnims - The library of animations to load actions from
Method Detail

getSourceMeshId

public java.lang.String getSourceMeshId()
Returns:
the sourceMeshId

play

public void play(COLLADAAction action,
                 boolean loop)
Starts playing the selected animation

Specified by:
play in interface AnimatableModel
Parameters:
action - The action to play
loop - true if we should loop the animation

updateDestinationGeometry

public Geometry updateDestinationGeometry(long currTime)
Specified by:
updateDestinationGeometry in class GeometryProvider
Parameters:
currTime - the frame time in miliseconds
Returns:
the destinationGeometry computed from the source mesh

setSkeleton

public void setSkeleton(Skeleton skeleton)
Set the skeleton of this controller

Parameters:
skeleton - The skeleton to use

getAction

public final COLLADAAction getAction(java.lang.String id)
Description copied from interface: AnimatableModel
Get a specific action

Specified by:
getAction in interface AnimatableModel
Parameters:
id - The ID string of this action
Returns:
The action which has the specified ID string.

getActions

public final java.util.HashMap<java.lang.String,COLLADAAction> getActions()
Specified by:
getActions in interface AnimatableModel
Returns:
the map of all the actions thie model has, or null if this model isn't animated.

getPrototypeModel

public ColladaProtoypeModel getPrototypeModel()
Description copied from interface: AnimatableModel
Get the prototype model (Jagatoo side) used by this model (Game engine side).

Specified by:
getPrototypeModel in interface AnimatableModel
Returns:
the prototype model

numActions

public final int numActions()
Specified by:
numActions in interface AnimatableModel
Returns:
the number of actions this model has, or 0 if it isn't animated at all (static model)

hasActions

public final boolean hasActions()
Specified by:
hasActions in interface AnimatableModel
Returns:
true if this model has skeletal animations (called "actions"), or false if it's a static model.

isLooping

public final boolean isLooping()
Specified by:
isLooping in interface AnimatableModel
Returns:
true if the model is looping. It's the case if an animation has been played with the boolean argument "loop" set to "true"

isPlaying

public final boolean isPlaying()
Specified by:
isPlaying in interface AnimatableModel
Returns:
true if the model is playing an animation, or false if the model isn't playing any animation, ex : - The model has no animation - No animation has been played since the model loading - The last played animation has been ended and it wasn't looped - The model has been paused manually (pause() method).

calcActions

public void calcActions(java.lang.String actionId)

play

public void play(java.lang.String actionId,
                 boolean loop)
Description copied from interface: AnimatableModel
Begin to play a particular action, whatever the model was doing (we don't mind if it was paused or what..)

Specified by:
play in interface AnimatableModel
Parameters:
actionId - The ID String of the action to play
loop - true if we should loop the animation

pause

public void pause()
Description copied from interface: AnimatableModel
Pause the model (stop to play an animation). The model will remind which animation it was playing, and where it was in this animation, so that you can resume() whenever you want.

Specified by:
pause in interface AnimatableModel

resume

public void resume()
Description copied from interface: AnimatableModel
Pause the model (stop to play an animation). The model will remind which animation it was playing, and where it was in this animation, so that you can resume() whenever you want.

Specified by:
resume in interface AnimatableModel