jarp
Class Character

java.lang.Object
  extended by jarp.Character

public class Character
extends java.lang.Object

The main avatar definition class: this maintains definitions of both the static and the dynamic aspects of the avatar's skeleton and surface mesh, and provides methods to support rendering of the avatar in its current configuration.


Field Summary
static int EYEL_4CC
           
static int EYER_4CC
           
static int HEAD_4CC
           
static Quaternion QUAT_Z_MINUS_PI_BY_2
          Quaternion [with components (w,x,y,z)] for a rotation by -PI/2 round the Z-axis.
static boolean USE_EMBEDDED_TEXTURE
           
static boolean V21_IS_VJJ_FORMAT
           
 
Constructor Summary
Character(java.lang.String avurl, JAInputStream jins, java.lang.String rqstversion, javax.media.opengl.GL gl, javax.media.opengl.glu.GLU glu, JAOptions jopts)
          Constructs this Character using avatar definition data from the given stream.
Character(java.lang.String avurl, JAOptions jopts)
          Minimal constructor, without specific avatar definition data.
 
Method Summary
 void buildSkin()
          Computes the new mesh data for the current skeleton and morphs, and passes the result to GL for rendering.
 void draw(javax.media.opengl.GL gl)
          Draws this character, using the given GL interface.
 void drawNormalsColour(javax.media.opengl.GL gl)
          Draws the normals colour for this character, using the given GL interface.
 void generateFrame()
          Generates the mesh-rendering data for the current frame.
 void generateFrame(float camX, float camY, float camZ)
          Update mesh-data (vertex coordinates and normals) based on latest skeleton and morph data.
 Bone getBone(int id)
          Returns the bone with the given ID.
 int getMeshCount()
          Returns the number of meshes for this character.
 java.lang.String getVersion()
          Returns the version number string for this character.
 void save(JAOutputStream jouts)
          Writes this Character to the given stream in V2.2 format.
 void saveTextureFile()
          Saves this avatar's texture image to a file.
 void setFrame(CASFrame frame)
          Sets a new frame (pose) for this character.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USE_EMBEDDED_TEXTURE

public static boolean USE_EMBEDDED_TEXTURE

HEAD_4CC

public static int HEAD_4CC

EYER_4CC

public static int EYER_4CC

EYEL_4CC

public static int EYEL_4CC

V21_IS_VJJ_FORMAT

public static boolean V21_IS_VJJ_FORMAT

QUAT_Z_MINUS_PI_BY_2

public static final Quaternion QUAT_Z_MINUS_PI_BY_2
Quaternion [with components (w,x,y,z)] for a rotation by -PI/2 round the Z-axis.

Constructor Detail

Character

public Character(java.lang.String avurl,
                 JAOptions jopts)
Minimal constructor, without specific avatar definition data.


Character

public Character(java.lang.String avurl,
                 JAInputStream jins,
                 java.lang.String rqstversion,
                 javax.media.opengl.GL gl,
                 javax.media.opengl.glu.GLU glu,
                 JAOptions jopts)
          throws java.io.IOException,
                 JAException
Constructs this Character using avatar definition data from the given stream.

Throws:
java.io.IOException
JAException
Method Detail

getVersion

public java.lang.String getVersion()
Returns the version number string for this character.


getMeshCount

public int getMeshCount()
Returns the number of meshes for this character.


getBone

public Bone getBone(int id)
Returns the bone with the given ID.


setFrame

public void setFrame(CASFrame frame)
Sets a new frame (pose) for this character.


save

public void save(JAOutputStream jouts)
          throws java.io.IOException
Writes this Character to the given stream in V2.2 format.

NB
W.e.f. 2007-04 we save only in v2.2 avatar definition format, i.e. the current format.

Throws:
java.io.IOException

saveTextureFile

public void saveTextureFile()
                     throws java.io.IOException
Saves this avatar's texture image to a file.

Throws:
java.io.IOException

drawNormalsColour

public void drawNormalsColour(javax.media.opengl.GL gl)
Draws the normals colour for this character, using the given GL interface.


draw

public void draw(javax.media.opengl.GL gl)
Draws this character, using the given GL interface.


generateFrame

public void generateFrame()
                   throws JAException
Generates the mesh-rendering data for the current frame.

Throws:
JAException

generateFrame

public void generateFrame(float camX,
                          float camY,
                          float camZ)
                   throws JAException
Update mesh-data (vertex coordinates and normals) based on latest skeleton and morph data.

Throws:
JAException

buildSkin

public void buildSkin()
               throws JAException
Computes the new mesh data for the current skeleton and morphs, and passes the result to GL for rendering.

Throws:
JAException