dtAnim::Cal3DModelWrapper Class Reference

Wraps the Cal3D CalModel class. More...

#include <cal3dmodelwrapper.h>

List of all members.

Public Member Functions

 Cal3DModelWrapper (CalModel *model)
void SetCalModel (CalModel *model)
CalModel * GetCalModel ()
 Get a pointer to the internal CalModel. For advanced users only!
const CalModel * GetCalModel () const
 Get a const pointer to the internal CalModel. For advanced users only!
bool AttachMesh (int meshID)
bool DetachMesh (int meshID)
void SetMaterialSet (int materialSetID)
void SetLODLevel (float level)
void Update (float deltaTime)
 Update the Cal3D system using the CalModel's update.
void UpdateAnimation (float deltaTime)
 Update just the Cal3D's animation using the mixer.
void UpdateSkeleton ()
 Update just Cal3D's skeleton using the mixer.
void UpdateMorphTargetMixer (float deltaTime)
 Update the CalModel's morph target mixer.
void UpdatePhysique ()
 Update the CalModel's physique.
void UpdateSpringSystem (float deltaTime)
 Update the CalModel's spring system.
bool BeginRenderingQuery ()
void EndRenderingQuery ()
bool SelectMeshSubmesh (int meshID, int submeshID)
int GetVertexCount ()
int GetFaceCount ()
int GetMapCount ()
int GetMeshCount ()
int GetSubmeshCount (int submeshID)
int GetCoreMeshCount () const
const std::string & GetCoreMeshName (int meshID) const
 Get the name for the mesh using the supplied meshID.
int GetCoreAnimationCount () const
osg::Quat GetCoreTrackKeyFrameQuat (unsigned int animID, unsigned int boneID, unsigned int keyframeindex) const
 Get the Cal3D rotation values.
osg::Quat GetBoneAbsoluteRotation (unsigned int boneID) const
 
Parameters:
boneID the ID for the CalBone instance.

osg::Quat GetBoneAbsoluteRotationForKeyFrame (unsigned int animid, unsigned int boneid, unsigned int keyframeindex) const
 Get the Cal3D rotation values.
osg::Vec3 GetBoneAbsoluteTranslation (unsigned int boneID) const
 Get the current translation for the CalBone.
osg::Quat GetBoneRelativeRotation (unsigned int boneID) const
 
Parameters:
boneID the ID for the CalBone instance.

int GetCoreBoneID (const std::string &name) const
 Get the Cal3D CoreBone ID.
void GetCoreBoneNames (std::vector< std::string > &toFill) const
 Get all bone IDs within the CoreSkeleton.
const std::string & GetCoreAnimationName (int animID) const
 Get the name that equates to the supplied animation ID.
int GetCoreAnimationIDByName (const std::string &name)
unsigned int GetCoreAnimationTrackCount (int animID) const
 Get the number of tracks this animation uses.
int GetParentBoneID (unsigned int boneID) const
 Get the id of the parent to boneID.
void GetCoreBoneChildrenIDs (int parentCoreBoneID, std::vector< int > &toFill) const
 Get the bone IDs of all children for a parent bone.
void GetRootBoneIDs (std::vector< int > &toFill) const
 Get all the root bone IDs.
unsigned int GetCoreAnimationKeyframeCount (int animID) const
 Get the total number of keyframes in this animation.
unsigned int GetCoreAnimationKeyframeCountForTrack (int animID, int boneID) const
 Get the number of keyframes in the animation for a particular bone.
float GetCoreAnimationDuration (int animID) const
 Get the duration of this animation (seconds?).
int GetCoreMaterialCount () const
CalCoreMaterial * GetCoreMaterial (int matID)
osg::Vec4 GetCoreMaterialDiffuse (int matID) const
 Get the core material diffuse color (rgba 0-255).
osg::Vec4 GetCoreMaterialAmbient (int matID) const
 Get the core material ambient color (rgba 0-255).
osg::Vec4 GetCoreMaterialSpecular (int matID) const
 Get the core material specular color (rgba 0-255).
float GetCoreMaterialShininess (int matID) const
 Get the core material shininess.
const std::string & GetCoreMaterialName (int matID) const
 Get the name associated with the material using the supplied material ID.
int GetFaces (int *faces)
int GetNormals (float *normals, int stride=0)
int GetTextureCoords (int mapID, float *coords, int stride=0)
int GetVertices (float *vertBuffer, int stride=0)
void GetAmbientColor (unsigned char *colorBuffer)
void GetDiffuseColor (unsigned char *colorBuffer)
void GetSpecularColor (unsigned char *colorBuffer)
float GetShininess ()
void * GetMapUserData (int mapID)
bool HasTrackForBone (unsigned int animID, int boneID) const
bool HasBone (int boneID) const
bool HasAnimation (int animID) const
bool BlendCycle (int id, float weight, float delay)
 Add a new looping animation to blend in using the mixer.
bool ClearCycle (int id, float delay)
 Remove an existing looping animation from the mixer.
bool ExecuteAction (int id, float delayIn, float delayOut, float weightTgt=1.0f, bool autoLock=false)
 Perform a one-time animation from the mixer.
bool RemoveAction (int id)
 Remove an existing one-time animation from the mixer.
void SetAnimationTime (float time)
 sets the offset time used in synchronized looping animations.
float GetAnimationTime ()
 
Returns:
the offset time used when playing looping animations.


Static Public Attributes

static const int NULL_BONE = -1

Protected Member Functions

virtual ~Cal3DModelWrapper ()


Detailed Description

Wraps the Cal3D CalModel class.

It is expected that users will use the Cal3DModelWrapper instead of using the CalModel class directly. To create a new Cal3DModelWrapper:

 dtCore::RefPtr<Cal3DModelWrapper> wrap = new Cal3DModelWrapper( calModel );

Constructor & Destructor Documentation

dtAnim::Cal3DModelWrapper::Cal3DModelWrapper ( CalModel *  model  ) 

dtAnim::Cal3DModelWrapper::~Cal3DModelWrapper (  )  [protected, virtual]


Member Function Documentation

void dtAnim::Cal3DModelWrapper::SetCalModel ( CalModel *  model  ) 

CalModel * dtAnim::Cal3DModelWrapper::GetCalModel (  ) 

Get a pointer to the internal CalModel. For advanced users only!

Warning! This violates the protective services brought to you by the wrapper.

Only modify the CalModel if you know how it will impact the rest of the Delta3D animation system. You have been warned.

Returns:
A pointer to the internal CalModel this class operates on.

const CalModel * dtAnim::Cal3DModelWrapper::GetCalModel (  )  const

Get a const pointer to the internal CalModel. For advanced users only!

Warning! This violates the protective services brought to you by the wrapper.

Only modify the CalModel if you know how it will impact the rest of the Delta3D animation system. You have been warned.

Returns:
A const pointer to the internal CalModel this class operates on.

bool dtAnim::Cal3DModelWrapper::AttachMesh ( int  meshID  ) 

bool dtAnim::Cal3DModelWrapper::DetachMesh ( int  meshID  ) 

void dtAnim::Cal3DModelWrapper::SetMaterialSet ( int  materialSetID  )  [inline]

void dtAnim::Cal3DModelWrapper::SetLODLevel ( float  level  )  [inline]

void dtAnim::Cal3DModelWrapper::Update ( float  deltaTime  )  [inline]

Update the Cal3D system using the CalModel's update.

void dtAnim::Cal3DModelWrapper::UpdateAnimation ( float  deltaTime  )  [inline]

Update just the Cal3D's animation using the mixer.

void dtAnim::Cal3DModelWrapper::UpdateSkeleton (  )  [inline]

Update just Cal3D's skeleton using the mixer.

void dtAnim::Cal3DModelWrapper::UpdateMorphTargetMixer ( float  deltaTime  )  [inline]

Update the CalModel's morph target mixer.

void dtAnim::Cal3DModelWrapper::UpdatePhysique (  )  [inline]

Update the CalModel's physique.

void dtAnim::Cal3DModelWrapper::UpdateSpringSystem ( float  deltaTime  )  [inline]

Update the CalModel's spring system.

bool dtAnim::Cal3DModelWrapper::BeginRenderingQuery (  )  [inline]

void dtAnim::Cal3DModelWrapper::EndRenderingQuery (  )  [inline]

bool dtAnim::Cal3DModelWrapper::SelectMeshSubmesh ( int  meshID,
int  submeshID 
) [inline]

int dtAnim::Cal3DModelWrapper::GetVertexCount (  )  [inline]

int dtAnim::Cal3DModelWrapper::GetFaceCount (  )  [inline]

int dtAnim::Cal3DModelWrapper::GetMapCount (  )  [inline]

int dtAnim::Cal3DModelWrapper::GetMeshCount (  )  [inline]

int dtAnim::Cal3DModelWrapper::GetSubmeshCount ( int  submeshID  )  [inline]

int dtAnim::Cal3DModelWrapper::GetCoreMeshCount (  )  const [inline]

const std::string & dtAnim::Cal3DModelWrapper::GetCoreMeshName ( int  meshID  )  const

Get the name for the mesh using the supplied meshID.

int dtAnim::Cal3DModelWrapper::GetCoreAnimationCount (  )  const

osg::Quat dtAnim::Cal3DModelWrapper::GetCoreTrackKeyFrameQuat ( unsigned int  animID,
unsigned int  boneID,
unsigned int  keyframeindex 
) const

Get the Cal3D rotation values.

Parameters:
animid the core animation of interest.
boneid the core bone within the animation, identifying the track.
keyframeindex the keyframe array index of interest for the animation track.
Returns:
the rotation values that cal3d is using, converted into right hand coordinate frame.

osg::Quat dtAnim::Cal3DModelWrapper::GetBoneAbsoluteRotation ( unsigned int  boneID  )  const

Parameters:
boneID the ID for the CalBone instance.

osg::Quat dtAnim::Cal3DModelWrapper::GetBoneAbsoluteRotationForKeyFrame ( unsigned int  animid,
unsigned int  boneid,
unsigned int  keyframeindex 
) const

Get the Cal3D rotation values.

Parameters:
animid the core animation of interest.
boneid the core bone within the animation, identifying the track.
keyframeindex the keyframe array index of interest for the animation track.
Returns:
the rotation values that cal3d is using, converted into right hand coordinate frame.

osg::Vec3 dtAnim::Cal3DModelWrapper::GetBoneAbsoluteTranslation ( unsigned int  boneID  )  const

Get the current translation for the CalBone.

Parameters:
boneID the ID for the CalBone of interest.
Returns:
the translation vector in a right-hand coordinate system.

osg::Quat dtAnim::Cal3DModelWrapper::GetBoneRelativeRotation ( unsigned int  boneID  )  const

Parameters:
boneID the ID for the CalBone instance.

int dtAnim::Cal3DModelWrapper::GetCoreBoneID ( const std::string &  name  )  const

Get the Cal3D CoreBone ID.

Returns:
the ID for the CoreBone.

void dtAnim::Cal3DModelWrapper::GetCoreBoneNames ( std::vector< std::string > &  toFill  )  const

Get all bone IDs within the CoreSkeleton.

Parameters:
toFill a vector to be filled with the bone IDs for the entire CoreSkeleton.

const std::string & dtAnim::Cal3DModelWrapper::GetCoreAnimationName ( int  animID  )  const

Get the name that equates to the supplied animation ID.

int dtAnim::Cal3DModelWrapper::GetCoreAnimationIDByName ( const std::string &  name  ) 

unsigned int dtAnim::Cal3DModelWrapper::GetCoreAnimationTrackCount ( int  animID  )  const

Get the number of tracks this animation uses.

int dtAnim::Cal3DModelWrapper::GetParentBoneID ( unsigned int  boneID  )  const

Get the id of the parent to boneID.

void dtAnim::Cal3DModelWrapper::GetCoreBoneChildrenIDs ( int  parentCoreBoneID,
std::vector< int > &  toFill 
) const

Get the bone IDs of all children for a parent bone.

Parameters:
parentCoreBoneID the bone ID for the parent bone.
toFill a vector to be filled with the bone IDs for all child bones.

void dtAnim::Cal3DModelWrapper::GetRootBoneIDs ( std::vector< int > &  toFill  )  const

Get all the root bone IDs.

Parameters:
toFill a container of bone IDs consisting only of root bones.

unsigned int dtAnim::Cal3DModelWrapper::GetCoreAnimationKeyframeCount ( int  animID  )  const

Get the total number of keyframes in this animation.

unsigned int dtAnim::Cal3DModelWrapper::GetCoreAnimationKeyframeCountForTrack ( int  animID,
int  boneID 
) const

Get the number of keyframes in the animation for a particular bone.

float dtAnim::Cal3DModelWrapper::GetCoreAnimationDuration ( int  animID  )  const

Get the duration of this animation (seconds?).

int dtAnim::Cal3DModelWrapper::GetCoreMaterialCount (  )  const [inline]

CalCoreMaterial* dtAnim::Cal3DModelWrapper::GetCoreMaterial ( int  matID  )  [inline]

osg::Vec4 dtAnim::Cal3DModelWrapper::GetCoreMaterialDiffuse ( int  matID  )  const

Get the core material diffuse color (rgba 0-255).

osg::Vec4 dtAnim::Cal3DModelWrapper::GetCoreMaterialAmbient ( int  matID  )  const

Get the core material ambient color (rgba 0-255).

osg::Vec4 dtAnim::Cal3DModelWrapper::GetCoreMaterialSpecular ( int  matID  )  const

Get the core material specular color (rgba 0-255).

float dtAnim::Cal3DModelWrapper::GetCoreMaterialShininess ( int  matID  )  const

Get the core material shininess.

const std::string& dtAnim::Cal3DModelWrapper::GetCoreMaterialName ( int  matID  )  const [inline]

Get the name associated with the material using the supplied material ID.

int dtAnim::Cal3DModelWrapper::GetFaces ( int *  faces  )  [inline]

int dtAnim::Cal3DModelWrapper::GetNormals ( float *  normals,
int  stride = 0 
) [inline]

int dtAnim::Cal3DModelWrapper::GetTextureCoords ( int  mapID,
float *  coords,
int  stride = 0 
) [inline]

int dtAnim::Cal3DModelWrapper::GetVertices ( float *  vertBuffer,
int  stride = 0 
) [inline]

void dtAnim::Cal3DModelWrapper::GetAmbientColor ( unsigned char *  colorBuffer  )  [inline]

void dtAnim::Cal3DModelWrapper::GetDiffuseColor ( unsigned char *  colorBuffer  )  [inline]

void dtAnim::Cal3DModelWrapper::GetSpecularColor ( unsigned char *  colorBuffer  )  [inline]

float dtAnim::Cal3DModelWrapper::GetShininess (  )  [inline]

void* dtAnim::Cal3DModelWrapper::GetMapUserData ( int  mapID  )  [inline]

bool dtAnim::Cal3DModelWrapper::HasTrackForBone ( unsigned int  animID,
int  boneID 
) const

bool dtAnim::Cal3DModelWrapper::HasBone ( int  boneID  )  const

bool dtAnim::Cal3DModelWrapper::HasAnimation ( int  animID  )  const

bool dtAnim::Cal3DModelWrapper::BlendCycle ( int  id,
float  weight,
float  delay 
)

Add a new looping animation to blend in using the mixer.

Parameters:
id : a valid ID of an animation (0 based)
weight : the strength of this animation in relation to the other animations already being blended.
delay : how long it takes for this animation to become full strength (seconds)
Returns:
true if successful, false if an error happened.

bool dtAnim::Cal3DModelWrapper::ClearCycle ( int  id,
float  delay 
)

Remove an existing looping animation from the mixer.

Parameters:
id : a valid ID of an animation already being blended (0 based)
delay : how long it takes to fade this animation out (seconds)
Returns:
true if successful, false if an error happened.

bool dtAnim::Cal3DModelWrapper::ExecuteAction ( int  id,
float  delayIn,
float  delayOut,
float  weightTgt = 1.0f,
bool  autoLock = false 
)

Perform a one-time animation from the mixer.

Parameters:
id : a valid ID of a animation to perform one-time (0 based)
delayIn : how long it takes to fade in this animation to full strength (seconds)
delayOut,: how long it takes to fade out this animation (seconds)
weightTgt : the strength of this animation
autoLock : true prevents the action from being reset and removed on the last key frame
Returns:
true if successful, false if an error happened.

bool dtAnim::Cal3DModelWrapper::RemoveAction ( int  id  ) 

Remove an existing one-time animation from the mixer.

Parameters:
id : a valid ID of a one-time animation already playing (0 based)
Returns:
true if successful, false if an error happened or animation doesn't exist.

void dtAnim::Cal3DModelWrapper::SetAnimationTime ( float  time  ) 

sets the offset time used in synchronized looping animations.

float dtAnim::Cal3DModelWrapper::GetAnimationTime (  ) 

Returns:
the offset time used when playing looping animations.


Member Data Documentation

const int dtAnim::Cal3DModelWrapper::NULL_BONE = -1 [static]


http://www.delta3d.org
2.0.0 generated 14 Feb 2008