gePose

Description: Bone hierarchy interface.

Source file: …\genesis3d\OpenSource\Source\Actor\pose.h

Contents:

Functions: Create, Destroy, AddJoint, GetScale, SetScale, FindNamedJointIndex, GetJointCount, MatchesMotionExactly, Clear, SetMotion, SetMotionForABone, BlendMotion, GetJointTransform, GetAllJointTransforms, GetJointLocalTransform, SetJointLocalTransform, GetJointAttachment, SetJointAttachment, GetJointName, Attach, Detach, ClearCoverage, AccumulateCoverage

Types: gePose_BlendingType, gePose

Constants: GE_POSE_ROOT_JOINT

Overview: view

Additions for Genesis3D v1.6: None

 

Overview: 

This object is a hierarchical set of attached joints. The joints can have names.

A 'gePose' keeps track of which children joints move in the hierarchy when a parent

joint moves. A gePose also remembers the position transform matrices for each joint.

 

The gePose is set by applying a motion at a specific time. This queries the motion

to determine each joint's change and applies them to the hierarchy. Each joint can

then be queried for it's world transform (for drawing, etc.)

 

Additional motions can modify or be blended into the pose. A motion that describes

only a few joint changes can be applied to only those joints, or a motion can be

blended with the current pose.

 

Something to watch for: since setting the pose by applying a motion is powerful

enough to resolve intentionally mismatched motion-pose sets, this can lead to

problems if the motion UNintentionally does not match the pose. Use

gePose_MatchesgeMotionExactly() to test for an exact name-based match.

 

 Constants:

#define GE_POSE_ROOT_JOINT (-1)

 

Return to Contents

 

 Types:

gePose_BlendingType
typedef enum {
     GE_POSE_BLEND_LINEAR,
     GE_POSE_BLEND_HERMITE
} gePose_BlendingType;
Return to Contents

 

typedef struct gePose gePose;

NOTE: The contents of this structure have been intentionally left out of the interface, by the designers of this module. Think of this as a handle only.

 Return to Contents

Functions:

gePose* GENESISCC gePose_Create(void);

Creates a new pose with no joints.

 

Return to Contents

void GENESISCC gePose_Destroy(gePose* *PM);

Destroys an existing pose.

 

Return to Contents

geBoolean GENESISCC gePose_AddJoint(gePose* P, int ParentJointIndex, const char * JointName, const geXForm3d* Attachment, int * JointIndex);

  Adds a new joint to a pose.

 

Return to Contents

void GENESISCC gePose_GetScale(const gePose* P, geVec3d* Scale);

Retrieves current joint attachment scaling factors

 

Return to Contents

void GENESISCC gePose_SetScale(gePose* P, const geVec3d* Scale);

Scales all joint attachments by component scaling factors in Scale

 

Return to Contents

geBoolean GENESISCC gePose_FindNamedJointIndex(const gePose* P, const char * JointName, int * Index);

Returns the index of a joint named JointName. Returns GE_TRUE if it is

located, and Index is set. Returns GE_FALSE if not, and Index is not changed.

 

Return to Contents

int GENESISCC gePose_GetJointCount(const gePose* P);

returns the number of joints in the pose

 

Return to Contents

geBoolean GENESISCC gePose_MatchesMotionExactly(const gePose* P, const geMotion* M);

 

Return to Contents

void GENESISCC gePose_Clear(gePose* P, const geXForm3d* Transform);

 

Return to Contents

void GENESISCC gePose_SetMotion(gePose* P, const geMotion* M, geFloat Time, const geXForm3d* Transform);

set the pose according to a motion. Use the motion at time 'Time'.

if the motion does not describe motion for all joints, name-based resolution

will be used to decide which motion to attach to which joints.

joints that are unaffected are unchanged.

if Transform is non-BasetypesIndexed.htm - NULLNULL, it is applied to the Motion

 

Return to Contents

void GENESISCC gePose_SetMotionForABone(gePose* P, const geMotion* M, geFloat Time, const geXForm3d* Transform, int BoneIndex);

optimization: if this is called, then all pose computations are limited to the BoneIndex'th bone, and

it's parents (including the root bone). This is true for all queries until an entire motion is set or blended

into the pose.

  

Return to Contents

void GENESISCC gePose_BlendMotion(gePose* P, const geMotion* M, geFloat Time, const geXForm3d* Transform, geFloat BlendAmount, gePose_BlendingType BlendingType);

blend in the pose according to a motion. Use the motion at time 'Time'.

the blending is between the 'current' pose and the pose described by the motion.

a BlendAmount of 0 will result in the 'current' pose, and a BlendAmount of 1.0

will result in the pose according to the new motion.

if the motion does not describe motion for all joints, name-based resolution

will be used to decide which motion to attach to which joints.

joints that are unaffected are unchanged.

if Transform is non-BasetypesIndexed.htm - NULLNULL, it is applied to the Motion prior to blending

 

Return to Contents

void GENESISCC gePose_GetJointTransform(const gePose* P, int JointIndex, geXForm3d* Transform);

get a joint's current transform (relative to world space)

 

Return to Contents

const geXFArray* GENESISCC gePose_GetAllJointTransforms(const gePose* P);

get the transforms for the entire pose.* TransformArray must not be changed.

 

Return to Contents

void GENESISCC gePose_GetJointLocalTransform(const gePose* P, int JointIndex, geXForm3d* Transform);

query a joint's current transform relative to it's attachment to it's parent.

 

Return to Contents

void GENESISCC gePose_SetJointLocalTransform(gePose* P, int JointIndex, const geXForm3d* Transform);

adjust a joint's current transform relative to it's attachment to it's parent.

this is like setting a mini-motion into this joint only: this will only affect

the current pose

 

Return to Contents

void GENESISCC gePose_GetJointAttachment(const gePose* P, int JointIndex, geXForm3d* AttachmentTransform);

query how a joint is attached to it's parent. (it's base attachment)

 

Return to Contents

void GENESISCC gePose_SetJointAttachment(gePose* P, int JointIndex, const geXForm3d* AttachmentTransform);

adjust how a joint is attached to it's parent. These changes are permanent: all

future pose motions will incorporate this joint's new relation to it's parent* /

 

Return to Contents

const char * GENESISCC gePose_GetJointName(const gePose* P, int JointIndex);

 

Return to Contents

geBoolean GENESISCC gePose_Attach(gePose* Slave, int SlaveBoneIndex, gePose* Master, int MasterBoneIndex, const geXForm3d* Attachment);

 

Return to Contents

void GENESISCC gePose_Detach(gePose* P);

 

 Return to Contents

 

void GENESISCC gePose_ClearCoverage(gePose* P, int ClearTo);

a pose can also maintain a record of which joints are touched by a given motion.

these funtions set,clear and query the record.

ClearCoverage clears the coverage flag for all joints

 

Return to Contents

 

int GENESISCC gePose_AccumulateCoverage(gePose* P, const geMotion* M, geBoolean QueryOnly);

AccumulateCoverage returns the number of joints that are not already 'covered'

that will be affected by a motion M,

if QueryOnly is GE_FALSE, affected joints are tagged as 'covered', otherwise no changes

are made to the joint coverage flags.

  
Return to Contents