jglanim
Class JGL_Animation

java.lang.Object
  extended by jglanim.JGL_Animation
All Implemented Interfaces:
JGL_3DStruct

public final class JGL_Animation
extends java.lang.Object
implements JGL_3DStruct

Representation of a 3D animated mesh. It's composed by a JGL_3DMesh object, a JGL_Skeleton object and a mesh points/ skeleton bones mapping list.
This one is a list of Integer used to associate each mesh point to a bone (same size as the mesh points list, each Integer is the index of a bone in the skeleton structure).

Author:
Nicolas Devere

Constructor Summary
JGL_Animation(JGL_3DMesh _mesh, java.util.Vector _mapPointsBones, JGL_Skeleton _skeleton)
          Constructs an animation given a mesh, a skeleton and a points/bones mapping list.
 
Method Summary
 void display(JGL_3DVector eye)
          JGL_3DStruct 's eye display method implementation.
 void display(JGL_3DVector eye, JGL_3DVector[] cone)
          JGL_3DStruct 's vision cone display method implementation.
 JGL_3DBsp getBsp()
          Returns the BSP tree witch contains the current animated object.
 java.util.Vector getFaces()
          Returns faces list in currently transformed state (different instances than the mesh's faces).
 int getFramesNumber()
          Returns the frames number currently in the animation.
 JGL_3DMesh getMesh()
          Returns the current mesh in the animation.
 java.util.Vector getPoints()
          Returns points list in currently transformed state (different instances than the mesh's points).
 JGL_Skeleton getSkeleton()
          Returns the current skeleton in the animation.
 void loadMapPointsBones(java.util.Vector _mapPointsBones)
          Loads the specified points/bones mapping list in the animation.
 void loadMesh(JGL_3DMesh _mesh, java.util.Vector _mapPointsBones)
          Loads the specified mesh in the animation according to the specified points/bones mapping list.
 void loadSkeleton(JGL_Skeleton _skeleton)
          Loads the skeleton in the animation.
 void mapSkeleton(JGL_Skeleton _skeleton)
          Configures the specified skeleton with the animation points/bones mapping list by adding to each bone its corresponding points.
 void moveBackward(float deltaT)
          Moves backward the animation according to the specified parametric lapse.
 void moveForward(float deltaT)
          Moves forward the animation according to the specified parametric lapse.
 void moveHere(float t)
          Moves the animation to the specified parametric variables's place.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JGL_Animation

public JGL_Animation(JGL_3DMesh _mesh,
                     java.util.Vector _mapPointsBones,
                     JGL_Skeleton _skeleton)
Constructs an animation given a mesh, a skeleton and a points/bones mapping list.

Parameters:
_mesh - : the mesh to store in the animation
_mapPointsBones - : the points/bones mapping list
_skeleton - : the skeleton to store in the animation
Method Detail

getMesh

public JGL_3DMesh getMesh()
Returns the current mesh in the animation.

Returns:
the current mesh

getSkeleton

public JGL_Skeleton getSkeleton()
Returns the current skeleton in the animation.

Returns:
the current skeleton

getFramesNumber

public int getFramesNumber()
Returns the frames number currently in the animation.

Returns:
the frames number

getPoints

public java.util.Vector getPoints()
Returns points list in currently transformed state (different instances than the mesh's points).

Returns:
the transformed points list

getFaces

public java.util.Vector getFaces()
Returns faces list in currently transformed state (different instances than the mesh's faces).

Returns:
the transformed faces list

getBsp

public JGL_3DBsp getBsp()
Returns the BSP tree witch contains the current animated object.

Returns:
the animation BSP tree

loadMesh

public void loadMesh(JGL_3DMesh _mesh,
                     java.util.Vector _mapPointsBones)
Loads the specified mesh in the animation according to the specified points/bones mapping list.
WARNING : The points/bones mapping list must be compatible with the current skeleton.

Parameters:
_mesh - : the mesh to load
_mapPointsBones - : the mesh points/bones mapping list

loadMapPointsBones

public void loadMapPointsBones(java.util.Vector _mapPointsBones)
Loads the specified points/bones mapping list in the animation.
WARNING : The points/bones mapping list must be compatible with the current mesh and the current skeleton.

Parameters:
_mapPointsBones - : the points/bones mapping list

loadSkeleton

public void loadSkeleton(JGL_Skeleton _skeleton)
Loads the skeleton in the animation. WARNING : The skeleton must be correctly mapped on the current mesh (see the map_skeleton(JGL_Skeleton) method).

Parameters:
_skeleton - : the skeleton to load

mapSkeleton

public void mapSkeleton(JGL_Skeleton _skeleton)
Configures the specified skeleton with the animation points/bones mapping list by adding to each bone its corresponding points.
WARNING : the skeleton must be compatible with the current points/bones mapping list.

Parameters:
_skeleton - : the skeleton to map

moveForward

public void moveForward(float deltaT)
Moves forward the animation according to the specified parametric lapse.

Parameters:
deltaT - : the parametric lapse

moveBackward

public void moveBackward(float deltaT)
Moves backward the animation according to the specified parametric lapse.

Parameters:
deltaT - : the parametric lapse

moveHere

public void moveHere(float t)
Moves the animation to the specified parametric variables's place.

Parameters:
t - : the parametric variable

display

public void display(JGL_3DVector eye)
JGL_3DStruct 's eye display method implementation.

Specified by:
display in interface JGL_3DStruct
Parameters:
eye - : the eye position

display

public void display(JGL_3DVector eye,
                    JGL_3DVector[] cone)
JGL_3DStruct 's vision cone display method implementation.

Specified by:
display in interface JGL_3DStruct
Parameters:
eye - : the eye position (cone base)
cone - : the vision cone represented by 4 points