Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

RpHAnim
[Objects, Frames & Hierarchies]


Modules

RpHAnim Changes

Data Structures

struct   RpHAnimFrameExtension
struct   RpHAnimHierarchy
struct   RpHAnimInterpFrame
struct   RpHAnimKeyFrame
struct   RpHAnimNodeInfo

Typedefs

typedef RpHAnimKeyFrame  RpHAnimKeyFrame
typedef RpHAnimInterpFrame  RpHAnimInterpFrame
typedef RpHAnimHierarchy  RpHAnimHierarchy
typedef RpHAnimNodeInfo  RpHAnimNodeInfo
typedef RpHAnimFrameExtension  RpHAnimFrameExtension

Enumerations

enum   RpHAnimHierarchyFlag {
  rpHANIMHIERARCHYSUBHIERARCHY = 0x01, rpHANIMHIERARCHYNOMATRICES = 0x02, rpHANIMHIERARCHYUPDATEMODELLINGMATRICES = 0x1000, rpHANIMHIERARCHYUPDATELTMS = 0x2000,
  rpHANIMHIERARCHYLOCALSPACEMATRICES = 0x4000, rpHANIMHIERARCHYFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
}

Functions

void  RpHAnimKeyFrameApply (void *matrix, void *voidIFrame)
void  RpHAnimKeyFrameInterpolate (void *voidOut, void *voidIn1, void *voidIn2, RwReal time, void *customData)
void  RpHAnimKeyFrameBlend (void *voidOut, void *voidIn1, void *voidIn2, RwReal alpha)
RtAnimAnimation RpHAnimKeyFrameStreamRead (RwStream *stream, RtAnimAnimation *animation)
RwBool  RpHAnimKeyFrameStreamWrite (RtAnimAnimation *animation, RwStream *stream)
RwInt32  RpHAnimKeyFrameStreamGetSize (RtAnimAnimation *animation)
void  RpHAnimKeyFrameMulRecip (void *voidFrame, void *voidStart)
void  RpHAnimKeyFrameAdd (void *voidOut, void *voidIn1, void *voidIn2)
void  RpHAnimHierarchySetFreeListCreateParams (RwInt32 blockSize, RwInt32 numBlocksToPrealloc)
RwBool  RpHAnimPluginAttach (void)
RpHAnimHierarchy RpHAnimHierarchySetFlags (RpHAnimHierarchy *hierarchy, RpHAnimHierarchyFlag flags)
RpHAnimHierarchyFlag  RpHAnimHierarchyGetFlags (RpHAnimHierarchy *hierarchy)
RpHAnimHierarchy RpHAnimHierarchyCreate (RwInt32 numNodes, RwUInt32 *nodeFlags, RwInt32 *nodeIDs, RpHAnimHierarchyFlag flags, RwInt32 maxInterpKeyFrameSize)
RpHAnimHierarchy RpHAnimHierarchyDestroy (RpHAnimHierarchy *hierarchy)
RpHAnimHierarchy RpHAnimHierarchyCreateSubHierarchy (RpHAnimHierarchy *parentHierarchy, RwInt32 startNode, RpHAnimHierarchyFlag flags, RwInt32 maxInterpKeyFrameSize)
RpHAnimHierarchy RpHAnimHierarchyCreateFromHierarchy (RpHAnimHierarchy *hierarchy, RpHAnimHierarchyFlag flags, RwInt32 maxInterpKeyFrameSize)
RpHAnimHierarchy RpHAnimHierarchyAttach (RpHAnimHierarchy *hierarchy)
RpHAnimHierarchy RpHAnimHierarchyDetach (RpHAnimHierarchy *hierarchy)
RpHAnimHierarchy RpHAnimHierarchyAttachFrameIndex (RpHAnimHierarchy *hierarchy, RwInt32 nodeIndex)
RpHAnimHierarchy RpHAnimHierarchyDetachFrameIndex (RpHAnimHierarchy *hierarchy, RwInt32 nodeIndex)
RwMatrix RpHAnimHierarchyGetMatrixArray (RpHAnimHierarchy *hierarchy)
RwBool  RpHAnimFrameSetHierarchy (RwFrame *frame, RpHAnimHierarchy *hierarchy)
RpHAnimHierarchy RpHAnimFrameGetHierarchy (RwFrame *frame)
RwBool  RpHAnimFrameSetID (RwFrame *frame, RwInt32 id)
RwInt32  RpHAnimFrameGetID (RwFrame *frame)
RwInt32  RpHAnimIDGetIndex (RpHAnimHierarchy *hierarchy, RwInt32 ID)
RwBool  RpHAnimHierarchyUpdateMatrices (RpHAnimHierarchy *hierarchy)
RwBool  RpHAnimHierarchySetCurrentAnim (RpHAnimHierarchy *hierarchy, RtAnimAnimation *anim)
RtAnimAnimation RpHAnimHierarchyGetCurrentAnim (RpHAnimHierarchy *hierarchy)
RwBool  RpHAnimHierarchySetCurrentAnimTime (RpHAnimHierarchy *hierarchy, RwReal time)
RwBool  RpHAnimHierarchyAddAnimTime (RpHAnimHierarchy *hierarchy, RwReal time)
RwBool  RpHAnimHierarchySubAnimTime (RpHAnimHierarchy *hierarchy, RwReal time)
RwBool  RpHAnimHierarchySetKeyFrameCallBacks (RpHAnimHierarchy *hierarchy, RwInt32 keyFrameTypeID)
RwBool  RpHAnimHierarchyBlend (RpHAnimHierarchy *outHierarchy, RpHAnimHierarchy *inHierarchy1, RpHAnimHierarchy *inHierarchy2, RwReal alpha)
RwBool  RpHAnimHierarchyAddTogether (RpHAnimHierarchy *outHierarchy, RpHAnimHierarchy *inHierarchy1, RpHAnimHierarchy *inHierarchy2)
void  RpHAnimHierarchySetAnimCallBack (RpHAnimHierarchy *hierarchy, RtAnimCallBack callBack, RwReal time, void *data)
void  RpHAnimHierarchySetAnimLoopCallBack (RpHAnimHierarchy *hierarchy, RtAnimCallBack callBack, void *data)
RwBool  RpHAnimHierarchyBlendSubHierarchy (RpHAnimHierarchy *outHierarchy, RpHAnimHierarchy *inHierarchy1, RpHAnimHierarchy *inHierarchy2, RwReal alpha)
RwBool  RpHAnimHierarchyAddSubHierarchy (RpHAnimHierarchy *outHierarchy, RpHAnimHierarchy *mainHierarchy1, RpHAnimHierarchy *subHierarchy2)
RwBool  RpHAnimHierarchyCopy (RpHAnimHierarchy *outHierarchy, RpHAnimHierarchy *inHierarchy)

Detailed Description

Hierarchical Animation Plugin for RenderWare Graphics.

RpHAnim Plugin Overview

Requirements

Overview

The RpHAnim plugin is designed to offer hierarchical animation that can drive RenderWare RwFrame hierarchies and RenderWare skinned (RpSkin) atomics.

The main objects managed and used by RpHAnim are the RpHAnimHierarchy and the RtAnimAnimation. The RpHAnimHierarchy data structure describes the order of the joints, the shoulder, elbow and so on, that control the model's animation. Its topology is a tree structure, or hierarchy of nodes that represent the model's animated joints. The RtAnimAnimation holds the state of the animation as it is being run. So it stores the current position of each joint as it is interpolated between key frames at the current point in the animation.

A sub-hierarchy can be defined by specifying a node in the main hierarchy. All nodes that are descendants of it (children, grandchildren etc) become part of this sub-hierarchy. This is useful for running more than one animation at a time on a single model. The main hierarchy normally has an animation that can animate the joints of the whole model (or at least the part of the model not animated by a sub-hierarchy). Any sub-hierarchies can have an animation, and this animation replaces the main hierarchy animation for the sub-hierarchy (i.e. that branch of the main hierarchy) to which it is applied. It does this by overwriting the joint matrices held in the main hierarchy data structure directly.

For each node (i.e. joint) in the hierarchy (or sub-hierarchy) that the animation is applied to, the RtAnimAnimation contains a start keyframe, an end keyframe, and any number of intermediate keyframes as necessary. Each keyframe consists of a quaternion (the positional information for the joint) and a time, at which the joint is at exactly that position. This is normally created by loading an ANM file. They can be run on multiple hierarchies at once as long as all the hierarchies were created with the same topology. When the joint is at a time where no keyframe is applied the joint is positioned by linear interpolation between the two adjacent keyframes. It is possible to use non-linear interpolations, see overloadable interpolation schemes in RtAnim.

RpHAnimHierarchy's can be attached and detached from a standard RwFrame hierarchy and when attached flags can be set so that the RwFrame's modeling matrices and/or LTMs (Local Transform Matrices) are updated when the animation is being run. This allows the animation system to provide animation to atomics attached to the RwFrame hierarchy. The RpHAnimHierarchy also (optionally) maintains an array of matrices held as either world space or local hierarchy space LTMs. These are used to drive RpSkin atomics as skinned models. A Hierarchy that is attached to RwFrame, updating RwFrame and attached to a skin will provide animation to both atomic hierarchies and skinned atomics whilst only needing to update a single animation.

Alternatively, the RtAnimAnimation system may be completely overridden for animating skinned atomics by accessing the array of matrices in the RpHAnimHierarchy directly. See RpHAnimHierarchyGetMatrixArray in the API Reference Guide.

Quick how-to:
  1. Export the animated model with HAnim data to create an .rws file containing an rwID_CLUMP and an rwID_HANIMANIMATION chunk representing the model and its animation. For more complex animations, there may be more than one rwID_CLUMP chunk (you only need one main one), and more than one rwID_HANIMANIMATION (animations to play back each hierarchy or subhierarchy) in the .rws file.
  2. Open the .rws for read-only streaming, and find and read the rwID_CLUMP to create a skinned character with the hierarchy in it.
  3. If necessary, create any sub-hierarchies, by marking the nodes of the main hierarchy to be the roots of the sub-hierarchies. This not required for simple cases.
  4. Create animation(s) from the rwID_HANIMANIMATION chunk(s) in the .rws file.
  5. Attach the animation to the hierarchy or sub-hierarchy it is intended to animate.
  6. Start rolling time forward for the hierarchy...
  7. ...whilst rendering the thing on the screen of course.
  8. When an animation is finished, load (or use from memory) the next one and blend from the old one to the new one before starting to play the new one in earnest. This will involve creating a blend position from the old and new animations and applying it to the hierarchy.
See also:
RtCmpKey

Typedef Documentation

typedef struct RpHAnimFrameExtension RpHAnimFrameExtension
 

RpHAnimFrameExtension typedef for struct RpHAnimFrameExtension

typedef struct RpHAnimHierarchy RpHAnimHierarchy
 

RpHAnimHierarchy typedef for struct RpHAnimHierarchy

typedef struct RpHAnimInterpFrame RpHAnimInterpFrame
 

RpHAnimInterpFrame typedef for struct RpHAnimInterpFrame. Based on RtAnimInterpFrameHeader.

typedef struct RpHAnimKeyFrame RpHAnimKeyFrame
 

RpHAnimKeyFrame typedef for struct RpHAnimKeyFrame. Based on RtAnimKeyFrameHeader.

typedef struct RpHAnimNodeInfo RpHAnimNodeInfo
 

RpHAnimNodeInfo typedef for struct RpHAnimNodeInfo


Enumeration Type Documentation

enum RpHAnimHierarchyFlag
 

RpHAnimHierarchyFlag defines type and update modes in HAnimHierarchies

Enumeration values:
rpHANIMHIERARCHYSUBHIERARCHY  This hierarchy is a sub-hierarchy
rpHANIMHIERARCHYNOMATRICES  This hierarchy has no local matrices
rpHANIMHIERARCHYUPDATEMODELLINGMATRICES  This hierarchy updates modeling matrices
rpHANIMHIERARCHYUPDATELTMS  This hierarchy updates LTMs
rpHANIMHIERARCHYLOCALSPACEMATRICES  This hierarchy calculates matrices in a space relative to its root

Function Documentation

RpHAnimHierarchy* RpHAnimFrameGetHierarchy RwFrame   frame
 

RpHAnimFrameGetHierarchy gets the hierarchy pointed to by this RwFrame.

Parameters:
frame  A pointer to the RwFrame for which the hierarchy is to be got.
Returns:
A pointer to the hierarchy attached to the RwFrame
See also:
RpHAnimFrameSetHierarchy
RwInt32 RpHAnimFrameGetID RwFrame   frame
 

RpHAnimFrameGetID gets the ID stored with the RwFrame, these are used to attach hierarchies to RwFrames.

Parameters:
frame  pointer to the RwFrame from which the ID is to be retrieved.
Returns:
The ID stored on the RwFrame.
See also:
RpHAnimFrameSetHierarchy
RwBool RpHAnimFrameSetHierarchy RwFrame   frame,
RpHAnimHierarchy   hierarchy
 

RpHAnimFrameSetHierarchy sets the RwFrame to point to a hierarchy allowing it to be streamed out

Parameters:
frame  A pointer to the root RwFrame for which the hierarchy is to be used.
hierarchy  A pointer to the hierarchy to use for animating the RwFrame hierarchy
Returns:
TRUE on success, FALSE if an error occurs.
See also:
RpHAnimFrameGetHierarchy
RwBool RpHAnimFrameSetID RwFrame   frame,
RwInt32    id
 

RpHAnimFrameSetID sets the ID stored with the RwFrame, these are used to attach hierarchies to RwFrames.

Parameters:
frame  A pointer to the RwFrame to set the ID on.
id  The ID to set.
Returns:
TRUE on success, FALSE if an error occurs.
See also:
RpHAnimFrameGetHierarchy
RwBool RpHAnimHierarchyAddAnimTime RpHAnimHierarchy   hierarchy,
RwReal    time
 

RpHAnimHierarchyAddAnimTime add anim time will step through the keyframes to find the current pair for each node to interpolate. These will then be interpolated by calling the appropriate overloaded interpolation scheme functions. If the animation loops or passes the time set in RpHAnimHierarchySetKeyFrameCallBacks then the appropriate callback will be called. By default the animation will simply loop continuously.

This function does not make assumptions about the direction of animation prior to calling. It is not therefore necessary for the user to keep track of the direction of play, nor handle a change of direction explicitly.

The hierarchy's matrices and attached RwFrames will not update until RpHAnimHierarchyUpdateMatrices is called.

Parameters:
hierarchy  A pointer to a hierarchy.
time  The amount of time to add to the animation.
Returns:
TRUE on success
See also:
RpHAnimHierarchyAddAnimTime , RpHAnimHierarchySetCurrentAnim , RpHAnimHierarchyGetCurrentAnim , RpHAnimHierarchySetCurrentAnimTime , RpHAnimHierarchySubAnimTime , RpHAnimHierarchyUpdateMatrices , RtAnimInterpolatorAddAnimTime , RtAnimInterpolatorSetCurrentAnim , RtAnimInterpolatorGetCurrentAnim , RtAnimInterpolatorSetCurrentTime , RtAnimInterpolatorSubAnimTime
RwBool RpHAnimHierarchyAddSubHierarchy RpHAnimHierarchy   outHierarchy,
RpHAnimHierarchy   mainHierarchy,
RpHAnimHierarchy   subHierarchy
 

RpHAnimHierarchyAddSubHierarchy adds together two hierarchies. Each hierarchy should have an animation attached, and the result will be the addition of the two input hierarchies. The output hierarchy must be identical in structure to either the main or sub-hierarchy.

Parameters:
outHierarchy  A pointer to a hierarchy in which the result is returned.
mainHierarchy  A pointer to the parent hierarchy
subHierarchy  A pointer to the sub hierarchy
Note:
outHierarchy, mainHierarchy and subHierarchy MUST be different.
Returns:
TRUE on success, FALSE otherwise.
See also:
RpHAnimAnimationMakeDelta
RwBool RpHAnimHierarchyAddTogether RpHAnimHierarchy   outHierarchy,
RpHAnimHierarchy   inHierarchy1,
RpHAnimHierarchy   inHierarchy2
 

RpHAnimHierarchyAddTogether adds together two hierarchies. Each hierarchy should have an animation attached, and the result will be the addition of the two input hierarchies. This is mainly useful where the second hierarchy's pose is a delta from a set pose to be added to the pose held in the first hierarchy. For example, a walk animation could have a crouch pose added to it as a delta from a standing pose.

Note:
outHierarchy, inHierarchy1 and inHierarchy2 MUST be different.
Parameters:
outHierarchy  A pointer to a hierarchy in which the result is returned.
inHierarchy1  A pointer to the first input hierarchy
inHierarchy2  A pointer to the second input hierarchy
Returns:
TRUE on success, FALSE otherwise.
See also:
RtAnimAnimationMakeDelta , RtAnimAnimationAddTogether
RpHAnimHierarchy* RpHAnimHierarchyAttach RpHAnimHierarchy   hierarchy
 

RpHAnimHierarchyAttach attaches hierarchies from RwFrame. When attached the RpHAnimHierarchy's can update RwFrame directly through animation updates. The attachment is done by linking ID's set on the RwFrame with RpHAnimFrameSetID and the ID's for the nodes passed into RpHAnimHierarchyCreate.

Parameters:
hierarchy  The hierarchy which you want to attach to an RwFrame hierarchy.
Returns:
A pointer to the hierarchy on success
See also:
RpHAnimHierarchyDetach
RpHAnimHierarchy* RpHAnimHierarchyAttachFrameIndex RpHAnimHierarchy   hierarchy,
RwInt32    nodeIndex
 

RpHAnimHierarchyAttachFrameIndex attaches a single node within the hierarchy to an RwFrame. This allows you to setup RwFrame updates on only a few necessary RwFrames rather than the whole RwFrame hierarchy.

Parameters:
hierarchy  The hierarchy in which you want to attach to an RwFrame
nodeIndex  The index of the node you wish to be attached
Returns:
A pointer to the hierarchy on success
See also:
RpHAnimHierarchyAttach , RpHAnimIDGetIndex
RwBool RpHAnimHierarchyBlend RpHAnimHierarchy   outHierarchy,
RpHAnimHierarchy   inHierarchy1,
RpHAnimHierarchy   inHierarchy2,
RwReal    alpha
 

RpHAnimHierarchyBlend interpolates between two hierarchies.The result will be interpolated between the current state of the two input hierarchies.

The most common use of this function will probably be to blend from the end of one animation to the start of the next. This would be done with 3 hierarchies, anim1skel, hanimskel and tempskel.

Initially anim1 would be running on anim1skel which is attached to the skin. When the blend is required hanim is attached to hanimskel and tempskel is now attached to the skin. For each update during the blend duration RpHAnimHierarchyBlend is used to blend between anim1skel and hanimskel, storing the results in tempskel. At the end of the blend hanimskel is attached to the skin.

Parameters:
outHierarchy  A pointer to a hierarchy in which the result is returned.
inHierarchy1  A pointer to the first input hierarchy
inHierarchy2  A pointer to the second input hierarchy
alpha  The blending parameter
  • 0.0 returns inHierarchy1
  • 1.0 returns inHierarchy2
Returns:
TRUE on success, FALSE otherwise.
See also:
RtAnimInterpolatorBlend
RwBool RpHAnimHierarchyBlendSubHierarchy RpHAnimHierarchy   outHierarchy,
RpHAnimHierarchy   inHierarchy1,
RpHAnimHierarchy   inHierarchy2,
RwReal    alpha
 

RpHAnimHierarchyBlendSubHierarchy interpolates the nodes in a sub-hierarchy with it parent hierarchy. Each hierarchy should have an animation attached, and the result will be interpolated between the current state of the two input hierarchies. Either source hierarchy can be the sub-hierarchy, the blend is performed from inHierarchy1 to inHierarchy2. The output hierarchy must be identical in structure to either the main or sub-hierarchy.

Parameters:
outHierarchy  A pointer to a hierarchy in which the result is returned.
inHierarchy1  A pointer to the first source hierarchy
inHierarchy2  A pointer to the second source hierarchy
alpha  The blending parameter
  • 0.0 returns inHierarchy1
  • 1.0 returns inHierarchy2
Returns:
TRUE on success, FALSE otherwise.
RwBool RpHAnimHierarchyCopy RpHAnimHierarchy   outHierarchy,
RpHAnimHierarchy   inHierarchy
 

RpHAnimHierarchyCopy copies state of nodes in the in-hierarchy into the out-hierarchy.

Parameters:
outHierarchy  A pointer to a hierarchy in which the result is returned.
inHierarchy  A pointer to the input hierarchy
Returns:
TRUE on success, FALSE otherwise.
RpHAnimHierarchy* RpHAnimHierarchyCreate RwInt32    numNodes,
RwUInt32   nodeFlags,
RwInt32   nodeIDs,
RpHAnimHierarchyFlag    flags,
RwInt32    maxInterpKeyFrameSize
 

RpHAnimHierarchyCreate creates and returns a standard RpHAnimHierarchy . This takes the number of nodes in the hierarchy and arrays of push/pop node flags and node IDs. It also takes hierarchy flags and a maximum keyframe size.

The flags are used to define certain creation time aspects and update aspects of a hierarchy (see below for description)

Parameters:
numNodes  The number of nodes required in the hierarchy.
nodeFlags  The push/pop flags should be setup such that any node with no children has a POP flag and all but the last sibling of a level of nodes has a push flag.
nodeIDs  The nodeIDs are one per node and should match up to the ids set on RwFrames with RpHAnimFrameSetID, if these are setup matching RpHAnimHierarchyAttach is able to attach all the RwFrames to allow their update.
flags  Defines the type and specific properties of the RpHAnimHierarchy
maxInterpKeyFrameSize  Defines the size of the biggest type of keyframe you wish to use on this hierarchy, currently there is only one keyframe type whose size is rpHANIMSTDKEYFRAMESIZE. Overloaded interpolation schemes will be available which may use larger more complex schemes or support compressed data.
The flags include:

Creation time flags:

  • rpHANIMHIERARCHYSUBHIERARCHY This defines that this hierarchy is a sub-hierarchy, meaning that it represents a branch of a full hierarchy. The sub-hierarchy is linked to the main hierarchy by the matrix array. This means the sub-hierarchy holds it's own arrays of interpolated keys and only updates the main hierarchy when you update the sub-hierarchy matrix array.
  • rpHANIMHIERARCHYNOMATRICES this flag specifies that the hierarchy should be created with no local matrix array. This type of hierarchy will directly update an RwFrame hierarchy but not store extra matrices. Skinning will then extract the matrices it needs from RwFrame, this is slightly less efficient but will save memory.
Update flags
  • rpHANIMHIERARCHYUPDATEMODELLINGMATRICES
  • rpHANIMHIERARCHYUPDATELTMS These two flags specify whether a hierarchy should update the modeling matrices and/or LTMs in an RwFrame hierarchy, for the RwFrames to be updated you must first attach the hierarchy using RpHAnimHierarchyAttach. The choice of which matrices in RwFrames to update is down to the applications use of the results. If you are likely to modify the RwFrames yourself forcing hierarchies to be resynchronized it's important to update the modeling matrices since otherwise the resynchronized hierarchies will contain the wrong LTMs. If you are going to modify lots of the hierarchy or root nodes it's probably sensible just to update the modeling matrices. If you plan on only updating a few lower down matrices (procedural IK on arms/legs etc) you can update both sets of matrices this way only those you procedurally modify will be resynchronized. If you can guarantee no updates between animation and usage of the RwFrames in rendering you can update only the LTMs.
  • rpHANIMHIERARCHYLOCALSPACEMATRICES this flag causes the local copy of the matrices to be updated as LTMs relative to the RwFrame the hierarchy is attached to. This will provide the most optimal method for animating skinned objects with RpSkin but will add slightly more complication to any procedural animation you may wish to apply.
Returns:
A pointer to the new hierarchy on success, NULL if there is an error.
See also:
RpHAnimHierarchyDestroy , RtAnimInterpolatorCreate , RtAnimInterpolatorDestroy
RpHAnimHierarchy* RpHAnimHierarchyCreateFromHierarchy RpHAnimHierarchy   hierarchy,
RpHAnimHierarchyFlag    flags,
RwInt32    maxInterpKeyFrameSize
 

RpHAnimHierarchyCreateFromHierarchy creates a hierarchy with the same structure as the source hierarchy. This can be used to create multiple secondary hierarchies for blending.

Parameters:
hierarchy  The source hierarchy to copy info from
flags  Flags for the new hierarchy, if cloning a hierarchy simply pass in the source hierarchy flags
maxInterpKeyFrameSize  specifies the maximum size of keyframes that will be usable on the new hierarchy
Returns:
A pointer to the new hierarchy on success, NULL if there is an error.
RpHAnimHierarchy* RpHAnimHierarchyCreateSubHierarchy RpHAnimHierarchy   parentHierarchy,
RwInt32    startNode,
RpHAnimHierarchyFlag    flags,
RwInt32    maxInterpKeyFrameSize
 

RpHAnimHierarchyCreateSubHierarchy This function creates a sub-hierarchy of a given main hierarchy. The parent-hierarchy and the offset into the hierarchy are given along with flags defining the sub-hierarchies settings. You can specify a different maxkeyframesize for the sub-hierarchy and use different types of keyframe on sub-hierarchies and main hierarchies, specifying -1 will adopt the parent hierarchies size settings.

The sub-hierarchy can then be used to run a different animation from the base hierarchy. The general loop process would be as follows.

Here we update the main hierarchy interpolated keyframe array and then convert the keyframes into the matrix array. We then update the sub-hierarchies keyframes locally to the sub-hierarchy and the update matrices overwrites the appropriate matrices in the main hierarchy, because of this you cannot update LTM's of a sub-hierarchy if the main hierarchy LTM's were not updated.
Parameters:
parentHierarchy  the parent hierarchy to be used for this sub-hierarchy
startNode  the index of the node representing the root of the new sub-hierarchy
flags  the flags to be used in the new sub-hierarchy, these can be copied from the source hierarchy.
maxInterpKeyFrameSize  the maximum keyframe size to allow in the sub-hierarchy, passing -1 will copy the parent hierarchies settings.
Returns:
A pointer to the new sub-hierarchy on success
See also:
RtAnimInterpolatorCreateSubInterpolator
RpHAnimHierarchy* RpHAnimHierarchyDestroy RpHAnimHierarchy   hierarchy
 

RpHAnimHierarchyDestroy destroys a hierarchy

Parameters:
hierarchy  A pointer to the hierarchy to be destroyed.
Returns:
NULL
See also:
RpHAnimHierarchyCreate , RtAnimInterpolatorCreate , RtAnimInterpolatorDestroy
RpHAnimHierarchy* RpHAnimHierarchyDetach RpHAnimHierarchy   hierarchy
 

RpHAnimHierarchyDetach detaches hierarchies from RwFrame. When attached the RpHAnimHierarchy's can update RwFrame directly through anim updates. Hierarchies are automatically detached when they are destroyed, however currently if you destroy an RwFrame which is referenced by an AnimHierarchy but not at the root of a hierarchy things may break. Since in general RwFrame hierarchies are destroyed in one go rather than one at a time this shouldn't be a huge issue.

Parameters:
hierarchy  The hierarchy to be detached.
Returns:
A pointer to the hierarchy on success.
See also:
RpHAnimHierarchyAttach
RpHAnimHierarchy* RpHAnimHierarchyDetachFrameIndex RpHAnimHierarchy   hierarchy,
RwInt32    nodeIndex
 

RpHAnimHierarchyDetachFrameIndex detaches a single node within the hierarchy from an RwFrame.

Parameters:
hierarchy  The hierarchy in which you want to detach a RwFrame
nodeIndex  The index of the node you wish to be detached
Returns:
A pointer to the hierarchy on success
See also:
RpHAnimHierarchyDetach , RpHAnimIDGetIndex
RtAnimAnimation* RpHAnimHierarchyGetCurrentAnim RpHAnimHierarchy   hierarchy
 

RpHAnimHierarchyGetCurrentAnim Returns the current animation on the hierarchy.

Parameters:
hierarchy  A pointer to the hierarchy
Returns:
a pointer to the current RtAnimAnimation if any.
See also:
RpHAnimHierarchySetCurrentAnim , RtAnimInterpolatorSetCurrentAnim , RtAnimInterpolatorGetCurrentAnim
RpHAnimHierarchyFlag RpHAnimHierarchyGetFlags RpHAnimHierarchy   hierarchy
 

RpHAnimHierarchyGetFlags allows you flags defining how the RpHAnimHierarchy was created and how it should be updated. Only the flags defining update modes should be changed after creation.

Parameters:
hierarchy  A pointer to the hierarchy to get the flags from.
Returns:
the flags set on the hierarchy
See also:
RpHAnimHierarchySetFlags
RwMatrix* RpHAnimHierarchyGetMatrixArray RpHAnimHierarchy   hierarchy
 

RpHAnimHierarchyGetMatrixArray function call access to the pMatrixArray in a hierarchy.

Parameters:
hierarchy  pointer to the hierarchy to retrieve the matrix array pointer.
Returns:
A pointer to the hierarchies matrix array on success
void RpHAnimHierarchySetAnimCallBack RpHAnimHierarchy   hierarchy,
RtAnimCallBack    callBack,
RwReal    time,
void *    data
 

RpHAnimHierarchySetAnimCallBack is used to set a callback function that will be called when a hierarchy reaches a specified time. The callback function should return a pointer to the hierarchy if the function should continue to be called, or NULL if it should never be called again.

Parameters:
hierarchy  A pointer to a hierarchy.
callBack  A pointer to a callback function.
time  The time at which the callback function should be called.
data  A pointer to a block of data to be passed into the callback function
Returns:
Nothing.
void RpHAnimHierarchySetAnimLoopCallBack RpHAnimHierarchy   hierarchy,
RtAnimCallBack    callBack,
void *    data
 

RpHAnimHierarchySetAnimLoopCallBack is used to set a callback function that will be called when a hierarchy's animation loops. The callback function should return a pointer to the hierarchy if the function should continue to be called, or NULL if it should never be called again.

Parameters:
hierarchy  A pointer to a hierarchy.
callBack  A pointer to a callback function.
data  A pointer to a block of data to be passed into the callback function
Returns:
Nothing.
RwBool RpHAnimHierarchySetCurrentAnim RpHAnimHierarchy   hierarchy,
RtAnimAnimation   anim
 

RpHAnimHierarchySetCurrentAnim Sets the current animation on the hierarchy. It is assumed that the animation is designed for the hierarchy it is being set on and no hierarchy structure comparisons are made. The animation defines the interpolation schemes used and they will be setup on the hierarchy at this call. The max keyframe size of the hierarchy must be sufficient to support the keyframe size required by the interpolation scheme. The animation is initialized to time zero at this call.

If the hierarchy is attached to a skin, the skin will not update until RpHAnimHierarchyUpdateMatrices is called.

Parameters:
hierarchy  A pointer to the hierarchy
anim  A pointer to the animation
Returns:
TRUE on success, FALSE if an error occurs.
See also:
RtAnimInterpolatorSetCurrentAnim
RwBool RpHAnimHierarchySetCurrentAnimTime RpHAnimHierarchy   hierarchy,
RwReal    time
 

RpHAnimHierarchySetCurrentAnimTime sets the current animation time of a hierarchy.

If the hierarchy is attached to a skin, the skin will not update until RpHAnimHierarchyUpdateMatrices is called.

Parameters:
hierarchy  A pointer to a hierarchy.
time  The time to which to set the current animation.
Returns:
TRUE on success, FALSE otherwise.
See also:
RpHAnimHierarchyUpdateMatrices , RpHAnimHierarchyAddAnimTime , RpHAnimHierarchySubAnimTime , RtAnimInterpolatorAddAnimTime , RtAnimInterpolatorSubAnimTime
RpHAnimHierarchy* RpHAnimHierarchySetFlags RpHAnimHierarchy   hierarchy,
RpHAnimHierarchyFlag    flags
 

RpHAnimHierarchySetFlags allows you to set flags defining how the RpHAnimHierarchy was created and how it should be updated. Only the flags defining update modes should be changed after creation.

Parameters:
hierarchy  A pointer to the hierarchy to set the flags on
flags  Flags to set on the hierarchy
Returns:
A pointer to the hierarchy on success
See also:
RpHAnimHierarchyGetFlags
void RpHAnimHierarchySetFreeListCreateParams RwInt32    blockSize,
RwInt32    numBlocksToPrealloc
 

RpHAnimHierarchySetFreeListCreateParams allows the developer to specify how many RpHAnimHierarchy s to preallocate space for. Call before RwEngineInit.

Parameters:
blockSize  number of entries per freelist block.
numBlocksToPrealloc  number of blocks to allocate on RwFreeListCreateAndPreallocateSpace.
See also:
RwFreeList
RwBool RpHAnimHierarchySetKeyFrameCallBacks RpHAnimHierarchy   hierarchy,
RwInt32    keyFrameTypeID
 

RpHAnimHierarchySetKeyFrameCallBacks Sets up the callbacks to be used by the hierarchy. These callbacks perform keyframe blending, interpolation and conversion to matrices. The callback setup is implicitly performed when setting the current animation on a hierarchy, however if you wish to fully procedurally drive the keyframe data this function allows the callbacks to be setup so that RpHAnimHierarchyUpdateMatrices performs correctly.

Parameters:
hierarchy  A pointer to the hierarchy
keyFrameTypeID  ID of the keyframe type to retrieve the callbacks for
Returns:
TRUE on success, FALSE if an error occurs.
See also:
RtAnimInterpolatorSetKeyFrameCallBacks
RwBool RpHAnimHierarchySubAnimTime RpHAnimHierarchy   hierarchy,
RwReal    time
 

RpHAnimHierarchySubAnimTime subtract anim time will step through the keyframes to find the current pair for each node to interpolate. These will then be interpolated by calling the appropriate overloaded interpolation scheme functions. If the animation loops or passes the time set in RpHAnimHierarchySetAnimCallBack then the appropriate callback will be called. By default the animation will simply loop continuously.

If the hierarchy is attached to a skin, the skin will not update until RpHAnimHierarchyUpdateMatrices is called.

Parameters:
hierarchy  A pointer to a hierarchy
time  The amount of time to subtract from the animation
Returns:
TRUE on success
See also:
RpHAnimHierarchyUpdateMatrices , RpHAnimHierarchyAddAnimTime , RpHAnimHierarchySetCurrentAnimTime , RtAnimInterpolatorAddAnimTime , RtAnimInterpolatorSetCurrentTime , RtAnimInterpolatorSubAnimTime
RwBool RpHAnimHierarchyUpdateMatrices RpHAnimHierarchy   hierarchy
 

RpHAnimHierarchyUpdateMatrices iterates over all the nodes in the hierarchy updating a combination of three members those being the local array of matrices, the modeling matrices in RwFrame's and the LTMs in RwFrame. If this hierarchy is a sub-hierarchy then the matrices updated will be a sub range of the parent hierarchies matrices.

Parameters:
hierarchy  A pointer to a hierarchy
Returns:
TRUE on success, FALSE if an error occurs.
RwInt32 RpHAnimIDGetIndex RpHAnimHierarchy   hierarchy,
RwInt32    ID
 

RpHAnimIDGetIndex returns the index of a node in the node arrays based on a given node ID. This is useful for procedurally animating nodes since you need the index to access the matrices/keyframes. This is also very useful for creating sub-hierarchies. Given the ID on the root of the sub-hierarchy this gives you the index to pass into RpHAnimHierarchyCreateSubHierarchy

Parameters:
hierarchy  Hierarchy to find the node index within
ID  ID of the node for which you want the index
Returns:
The index of the node in the node arrays, based on a given node ID
void RpHAnimKeyFrameAdd void *    pVoidOut,
void *    pVoidIn1,
void *    pVoidIn2
 

RpHAnimKeyFrameAdd adds two interpolated keyframes together.

Parameters:
pVoidOut  A void pointer to the output frame.
pVoidIn1  A void pointer to the first frame to add.
pVoidIn2  A void pointer to the second frame to add.
Returns:
None
void RpHAnimKeyFrameApply void *    pMatrix,
void *    pVoidIFrame
 

RpHAnimKeyFrameApply converts a standard keyframe to a matrix

Parameters:
pMatrix  A pointer to the output matrix
pVoidIFrame  A pointer to the input frame
Returns:
None
void RpHAnimKeyFrameBlend void *    pVoidOut,
void *    pVoidIn1,
void *    pVoidIn2,
RwReal    fAlpha
 

RpHAnimKeyFrameBlend blends between two RpHAnimInterpFrame objects using a given blend factor.

Parameters:
pVoidOut  A pointer to the output frame.
pVoidIn1  A pointer to the first input frame.
pVoidIn2  A pointer to the second input frame.
fAlpha  The blending factor.
Returns:
None
void RpHAnimKeyFrameInterpolate void *    pVoidOut,
void *    pVoidIn1,
void *    pVoidIn2,
RwReal    time,
void *    customData
 

RpHAnimKeyFrameInterpolate interpolates between two skin frames and returns the result.

Parameters:
pVoidOut  A pointer to the output frame
pVoidIn1  A pointer to the first input frame
pVoidIn2  A pointer to the second input frame
time  The time to which to interpolate
customData  A pointer to custom data for the animation, unused in this keyframe scheme
Returns:
None
void RpHAnimKeyFrameMulRecip void *    pVoidFrame,
void *    pVoidStart
 

RpHAnimKeyFrameMulRecip multiplies one keyframe by the reciprocal of another (in place).

Parameters:
pVoidFrame  A void pointer to the keyframe to modify.
pVoidStart  A void pointer to the start keyframe to multiply by.
Returns:
None
RwInt32 RpHAnimKeyFrameStreamGetSize RtAnimAnimation   animation
 

RpHAnimKeyFrameStreamGetSize calculates the size of a hierarchical animation keyframes when written to a stream.

Parameters:
animation  A pointer to the hierarchical animation.
Returns:
Size of the hierarchical animation keyframes in bytes.
RtAnimAnimation* RpHAnimKeyFrameStreamRead RwStream   stream,
RtAnimAnimation   pAnimation
 

RpHAnimKeyFrameStreamRead reads a hierarchical animation from a stream.

Parameters:
stream  A pointer to the stream to be read from.
pAnimation  A pointer to the animation into which to read the data
Returns:
A pointer to the animation, or NULL if an error occurs
RwBool RpHAnimKeyFrameStreamWrite RtAnimAnimation   pAnimation,
RwStream   stream
 

RpHAnimKeyFrameStreamWrite writes a hierarchical animation to a stream.

Parameters:
pAnimation  A pointer to the animation to be written.
stream  A pointer to the stream to be written to.
Returns:
TRUE on success, or FALSE if an error occurs.
RwBool RpHAnimPluginAttach void   
 

RpHAnimPluginAttach is used to attach the Animation plugin to the RenderWare system to enable the manipulation of animating node hierarchies. The plugin must be attached between initializing the system with RwEngineInit and opening it with RwEngineOpen.

Returns:
TRUE if successful, FALSE if an error occurs.

Criterion Software © 1993-2003 Criterion Software Limited. All rights reserved. Built Tue Apr 22 12:46:26 2003. Send Feedback
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)