Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

RtAnim
[Animation Tools]


Data Structures

struct   RtAnimAnimation
struct   RtAnimInterpFrameHeader
struct   RtAnimInterpolator
struct   RtAnimInterpolatorInfo
struct   RtAnimKeyFrameHeader

Typedefs

typedef RtAnimAnimation  RtAnimAnimation
typedef void(*  RtAnimKeyFrameApplyCallBack )(void *result, void *voidIFrame)
typedef void(*  RtAnimKeyFrameBlendCallBack )(void *voidOut, void *voidIn1, void *voidIn2, RwReal alpha)
typedef void(*  RtAnimKeyFrameInterpolateCallBack )(void *voidOut, void *voidIn1, void *voidIn2, RwReal time, void *customData)
typedef void(*  RtAnimKeyFrameAddCallBack )(void *voidOut, void *voidIn1, void *voidIn2)
typedef void(*  RtAnimKeyFrameMulRecipCallBack )(void *voidFrame, void *voidStart)
typedef RtAnimAnimation *(*  RtAnimKeyFrameStreamReadCallBack )(RwStream *stream, RtAnimAnimation *animation)
typedef RwBool(*  RtAnimKeyFrameStreamWriteCallBack )(RtAnimAnimation *animation, RwStream *stream)
typedef RwInt32(*  RtAnimKeyFrameStreamGetSizeCallBack )(RtAnimAnimation *animation)
typedef RtAnimInterpolatorInfo  RtAnimInterpolatorInfo
typedef RtAnimKeyFrameHeader  RtAnimKeyFrameHeader
typedef RtAnimInterpFrameHeader  RtAnimInterpFrameHeader
typedef RtAnimInterpolator  RtAnimInterpolator
typedef RtAnimInterpolator *(*  RtAnimCallBack )(RtAnimInterpolator *animInstance, void *data)

Functions

void  RtAnimAnimationFreeListCreateParams (RwInt32 blockSize, RwInt32 numBlocksToPrealloc)
RwBool  RtAnimInitialize (void)
RwBool  RtAnimRegisterInterpolationScheme (RtAnimInterpolatorInfo *interpolatorInfo)
RtAnimInterpolatorInfo RtAnimGetInterpolatorInfo (RwInt32 typeID)
RtAnimAnimation RtAnimAnimationCreate (RwInt32 typeID, RwInt32 numFrames, RwInt32 flags, RwReal duration)
RtAnimAnimation RtAnimAnimationDestroy (RtAnimAnimation *animation)
RtAnimAnimation RtAnimAnimationRead (const RwChar *filename)
RwBool  RtAnimAnimationWrite (RtAnimAnimation *animation, const RwChar *filename)
RtAnimAnimation RtAnimAnimationStreamRead (RwStream *stream)
RwBool  RtAnimAnimationStreamWrite (RtAnimAnimation *animation, RwStream *stream)
RwInt32  RtAnimAnimationStreamGetSize (RtAnimAnimation *animation)
RwUInt32  RtAnimAnimationGetNumNodes (RtAnimAnimation *animation)
RwInt32  RtAnimAnimationGetTypeID (RtAnimAnimation *animation)
RtAnimInterpolator RtAnimInterpolatorCreate (RwInt32 numNodes, RwInt32 maxInterpKeyFrameSize)
void  RtAnimInterpolatorDestroy (RtAnimInterpolator *anim)
RwBool  RtAnimInterpolatorSetCurrentAnim (RtAnimInterpolator *animI, RtAnimAnimation *anim)
RtAnimAnimation RtAnimInterpolatorGetCurrentAnim (RtAnimInterpolator *animI)
RwBool  RtAnimInterpolatorSetKeyFrameCallBacks (RtAnimInterpolator *anim, RwInt32 keyFrameTypeID)
void  RtAnimInterpolatorSetAnimLoopCallBack (RtAnimInterpolator *anim, RtAnimCallBack callBack, void *data)
void  RtAnimInterpolatorSetAnimCallBack (RtAnimInterpolator *anim, RtAnimCallBack callBack, RwReal time, void *data)
RwBool  RtAnimInterpolatorCopy (RtAnimInterpolator *outAnim, RtAnimInterpolator *inAnim)
RwBool  RtAnimInterpolatorSubAnimTime (RtAnimInterpolator *anim, RwReal time)
RwBool  RtAnimInterpolatorAddAnimTime (RtAnimInterpolator *anim, RwReal time)
RwBool  RtAnimInterpolatorSetCurrentTime (RtAnimInterpolator *anim, RwReal time)
RwBool  RtAnimAnimationMakeDelta (RtAnimAnimation *animation, RwInt32 numNodes, RwReal time)
RwBool  RtAnimInterpolatorBlend (RtAnimInterpolator *outAnim, RtAnimInterpolator *inAnim1, RtAnimInterpolator *inAnim2, RwReal alpha)
RwBool  RtAnimInterpolatorAddTogether (RtAnimInterpolator *outAnim, RtAnimInterpolator *inAnim1, RtAnimInterpolator *inAnim2)
void  RtAnimKeyFrameInterpolate (RtAnimInterpolator *animation, void *out, void *in1, void *in2, RwReal time)
void  RtAnimKeyFrameBlend (RtAnimInterpolator *animation, void *out, void *in1, void *in2, RwReal alpha)
void  RtAnimKeyFrameApply (RtAnimInterpolator *animation, void *result, void *iFrame)
void  RtAnimKeyFrameAddTogether (RtAnimInterpolator *animation, void *out, void *in1, void *in2)
RtAnimInterpolator RtAnimInterpolatorCreateSubInterpolator (RtAnimInterpolator *parentAnim, RwInt32 startNode, RwInt32 numNodes, RwInt32 maxInterpKeyFrameSize)
RwBool  RtAnimInterpolatorBlendSubInterpolator (RtAnimInterpolator *outAnim, RtAnimInterpolator *inAnim1, RtAnimInterpolator *inAnim2, RwReal alpha)
RwBool  RtAnimInterpolatorAddSubInterpolator (RtAnimInterpolator *outAnim, RtAnimInterpolator *mainAnim, RtAnimInterpolator *subAnim)

Detailed Description

Animation Toolkit for RenderWare Graphics.

RtAnim Toolkit Overview

Requirements

Overview

RtAnim is an animation toolkit, enabling the user to create, stream and play any type of keyframed animation.

RtAnimAnimation's are a block of keyframe data representing an animation. For each node (i.e. joint) in the object that the animation is applied to, the .ANM file contains a start keyframe, an end keyframe, and any number of intermediate keyframes as necessary. This is normally created by loading an .ANM file. When a node is at a time where no keyframe is applied, the actual state of that node will be positioned by linear interpolation between the two adjacent keyframes.

RtAnim supports the concept of overloadable interpolation schemes. This requires specifying a custom keyframe type (identified by a unique ID) and a set of callbacks for manipulating the keyframes. The callback functions will implement tasks such as interpolation and converting to final result. Animations are associated with a particular scheme using the ID, and the relevant callbacks are automatically used whenever an animation is updated by the standard RtAnim API interface. To support this, the keyframe types must share a common header giving a pointer to the previous keyframe, and the time of the keyframe. See RtAnimRegisterInterpolationScheme for more information.


Typedef Documentation

typedef struct RtAnimAnimation RtAnimAnimation
 

Typedef for struct RtAnimAnimation.

typedef RtAnimInterpolator*(* RtAnimCallBack)(RtAnimInterpolator *animInstance, void *data)
 

RtAnimCallBack defines a callback function for use with the RtAnimInterpolatorSetAnimCallBack and RtAnimInterpolatorSetAnimLoopCallBack functions.

Parameters:
animInstance  A pointer to the RtAnimInterpolator structure.
data  Void pointer for user-defined data. You can use this to pass your own data structure(s) to the callback function.
See also:
RtAnimInterpolatorSetAnimCallBack , RtAnimInterpolatorSetAnimLoopCallBack
typedef struct RtAnimInterpFrameHeader RtAnimInterpFrameHeader
 

RtAnimInterpFrameHeader Typedef for struct RtAnimInterpFrameHeader

typedef struct RtAnimInterpolator RtAnimInterpolator
 

RtAnimInterpolator Typedef for struct RtAnimInterpolator

typedef struct RtAnimInterpolatorInfo RtAnimInterpolatorInfo
 

RtAnimInterpolatorInfo Typedef for struct RtAnimInterpolatorInfo

typedef void(* RtAnimKeyFrameAddCallBack)(void *voidOut, void *voidIn1, void *voidIn2)
 

RtAnimKeyFrameAddCallBack defines a callback function for adding two interpolated keyframes together. This is used when adding the states of two RtAnimInterpolator objects, such as when adding a delta animation to a base animation.

Parameters:
voidOut  Void pointer for the output interpolated frame.
voidIn1  Void pointer containing the first input interpoalted keyframe.
voidIn2  Void pointer containing the second input interpolated keyframe.
typedef void(* RtAnimKeyFrameApplyCallBack)(void *result, void *voidIFrame)
 

RtAnimKeyFrameApplyCallBack defines a callback function for converting an interpolated animation keyframe into the required result.

Parameters:
result  Void pointer to store the output of the conversion.
voidIFrame  Void pointer to the keyframe and should be cast to the interpolated keyframe type this callback is for.
typedef void(* RtAnimKeyFrameBlendCallBack)(void *voidOut, void *voidIn1, void *voidIn2, RwReal alpha)
 

RtAnimKeyFrameBlendCallBack defines a callback function for blending between two interpolated keyframes by the given blend factor. This is used for blending the states of two different RtAnimInterpolator objects. The RtAnimKeyFrameInterpolateCallBack is used for interpolating actual animation keyframes into an interpolated frame.

Parameters:
voidOut  Void pointer to store the output of the blend.
voidIn1  Void pointer containing the first input interpolated keyframe.
voidIn2  Void pointer containing the second input interpolated keyframe.
alpha  RwReal containing the blend factor.
typedef struct RtAnimKeyFrameHeader RtAnimKeyFrameHeader
 

RtAnimKeyFrameHeader Typedef for struct RtAnimKeyFrameHeader

typedef void(* RtAnimKeyFrameInterpolateCallBack)(void *voidOut, void *voidIn1, void *voidIn2, RwReal time, void *customData)
 

RtAnimKeyFrameInterpolateCallBack defines a callback function for interpolating between two animation keyframes according to the given time. The output is an interpolated frame object residing in an RtAnimInterpolator and will usually have the same structure as the keyframe apart from the header data (RtAnimInterpFrameHeader).

Parameters:
voidOut  Void pointer for the output of the interpolation.
voidIn1  Void pointer containing the first input keyframe.
voidIn2  Void pointer containing the second input keyframe.
time  RwReal containing the time at which to interpolate.
customData  Void pointer to the custom data associated with this animation
typedef void(* RtAnimKeyFrameMulRecipCallBack)(void *voidFrame, void *voidStart)
 

RtAnimKeyFrameMulRecipCallBack defines a callback function for multiplying a keyframe by the inverse of another keyframe. This is used for creating delta animations.

Parameters:
voidFrame  Void pointer for the keyframe to be modified.
voidStart  Void pointer for the start keyframe to take the reciprocal of.
typedef RwInt32(* RtAnimKeyFrameStreamGetSizeCallBack)(RtAnimAnimation *animation)
 

RtAnimKeyFrameStreamGetSizeCallBack defines a callback function for calculating the binary stream size of keyframe data within an animation.

Parameters:
animation  Pointer to the RtAnimAnimation to calculate sizes from.
Returns:
RwInt32 containing the size, in bytes, of the keyframe data.
typedef RtAnimAnimation*(* RtAnimKeyFrameStreamReadCallBack)(RwStream *stream, RtAnimAnimation *animation)
 

RtAnimKeyFrameStreamReadCallBack defines a callback function for reading in keyframes from an RwStream for the given animation.

Parameters:
stream  Pointer to the RwStream to read the keyframes from.
animation  Pointer to the RtAnimAnimation to read the keyframes into.
Returns:
Pointer to the RtAnimAnimation.
typedef RwBool(* RtAnimKeyFrameStreamWriteCallBack)(RtAnimAnimation *animation, RwStream *stream)
 

RtAnimKeyFrameStreamWriteCallBack defines a callback function for writing keyframes from the given animation to an RwStream.

Parameters:
animation  Pointer to the RtAnimAnimation to write out from.
stream  Pointer to the RwStream to write the keyframes to.
Returns:
RwBool, TRUE if successful.

Function Documentation

RtAnimAnimation* RtAnimAnimationCreate RwInt32    typeID,
RwInt32    numFrames,
RwInt32    flags,
RwReal    duration
 

RtAnimAnimationCreate creates an animation, and allocates space for the number of keyframes required. This keyframe block should be filled with keyframe sequences. See RtAnimAnimation for details of the required layout of the keyframes.

Parameters:
typeID  RwInt32 containing the ID number specifying the interpolation scheme to be used with this animation, that also determines the keyframe size.
numFrames  RwInt32 containing the number of keyframes in the animation.
flags  RwInt32 reserved for future use - should be 0.
duration  RwReal containing the total length of the animation.
Returns:
Pointer to the created RtAnimAnimationCreate, or NULL if an error occurs.
RtAnimAnimation* RtAnimAnimationDestroy RtAnimAnimation   animation
 

RtAnimAnimationDestroy destroys an animation.

Parameters:
animation  Pointer to the RtAnimAnimation to be destroyed.
Returns:
Pointer to RtAnimAnimation, or NULL if an error occurs.
See also:
RtAnimAnimationCreate
void RtAnimAnimationFreeListCreateParams RwInt32    blockSize,
RwInt32    numBlocksToPrealloc
 

RtAnimAnimationFreeListCreateParams allows the developer to specify how many RtAnimAnimation's to preallocate space for. Call before RwEngineInit.

Parameters:
blockSize  RwInt32 containing the number of entries per freelist block.
numBlocksToPrealloc  RwInt32 containing the number of blocks to allocate on RwFreeListCreateAndPreallocateSpace.
See also:
RwFreeList
RwUInt32 RtAnimAnimationGetNumNodes RtAnimAnimation   animation
 

RtAnimAnimationGetNumNodes returns the number of nodes supported by the animation, that is, the number of nodes required for an interpolator to read the animation.

Parameters:
animation  A pointer to the RtAnimAnimation.
Returns:
The number of nodes
RwInt32 RtAnimAnimationGetTypeID RtAnimAnimation   animation
 

RtAnimAnimationGetTypeID

Returns the typeID of an animation

Parameters:
animation  A pointer to the RtAnimAnimation.
Returns:
RwInt32 containing the typeID of the animation passed in.
RwBool RtAnimAnimationMakeDelta RtAnimAnimation   animation,
RwInt32    numNodes,
RwReal    time
 

RtAnimAnimationMakeDelta makes a delta animation from a given RtAnimAnimation. It requires the number of nodes to decode the animation and a time from which to make the delta. This will give you an animation which can be added on to another animation, e.g. characters leaning whilst running. This calls the overloaded interpolation scheme RtAnimKeyFrameMulRecipCallBack which multiplies the incoming keyframe by the reciprocal of the start keyframe given.

Parameters:
animation  A pointer to an RtAnimAnimation.
numNodes  RwInt32 containing the number of node to decode the animation.
time  RwReal containing the time in the animation to delta from.
Returns:
RwBool, TRUE on success, or FALSE if an error occurs.
RtAnimAnimation* RtAnimAnimationRead const RwChar   filename
 

RtAnimAnimationRead is a wrapper around RtAnimAnimationStreamRead. Read opens the stream and searches for the appropriate chunk header and then calls RtAnimAnimationStreamRead.

Reads a .ANM animation file from disk.

Parameters:
filename  Pointer to a constant RwChar string containing the name of the file to be read.
Returns:
Pointer to the RtAnimAnimation, or NULL if an error occurs.
RwInt32 RtAnimAnimationStreamGetSize RtAnimAnimation   animation
 

RtAnimAnimationStreamGetSize is used in stream writing and will call the overloaded interpolator RtAnimKeyFrameStreamGetSizeCallBack function in order to acquire the size of the keyframe data.

Parameters:
animation  A pointer to the RtAnimAnimation to determine the size of its keyframe data.
Returns:
RwInt32 containing the size of the hierarchical animation in bytes.
RtAnimAnimation* RtAnimAnimationStreamRead RwStream   stream
 

RtAnimAnimationStreamRead creates and reads in animation data. Upon reading, it will look up pointers to interpolation functions based on the interpolation scheme ID which was written out to the file. If the interpolation scheme is not available then the read will fail.

This function calls the overloaded RtAnimKeyFrameStreamReadCallBack function for the particular keyframe type allowing keyframes to be of varying sizes/data types etc. This not only allows interpolation schemes to perform higher order interpolation but allows them to attach extra data to achieve it or compress data in order to save memory space.

The sequence to locate and read animation data from a binary stream is as follows:

   RwStream *stream;
   RtAnimAnimation *newAnimAnimation;

   stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "mybinary.xxx");
   if( stream )
   {
       if( RwStreamFindChunk(stream, rwID_HANIMANIMATION, NULL, NULL) )
       {
           newAnimAnimation = RtAnimAnimationStreamRead(stream);
       }

       RwStreamClose(stream, NULL);
   }
Parameters:
stream  A pointer to the RwStream to be read from.
Returns:
A pointer to the RtAnimAnimation, or NULL if an error occurs.
See also:
RtAnimAnimationStreamGetSize , RtAnimAnimationStreamWrite , RwStreamOpen , RwStreamClose , RwStreamFindChunk , RtAnimInitialize
RwBool RtAnimAnimationStreamWrite RtAnimAnimation   animation,
RwStream   stream
 

RtAnimAnimationStreamWrite writes an animation to a stream. This function calls the overloaded RtAnimKeyFrameStreamWriteCallBack function for the particular keyframe type allowing keyframes to be of varying sizes/data types etc. This not only allows interpolation schemes to perform higher order interpolation but allows them to attach extra data to achieve it or compress data in order to save memory space.

Parameters:
animation  A pointer to the RtAnimAnimation to be written.
stream  A pointer to the RwStream to be written to.
Returns:
RwBool, TRUE on success, or FALSE if an error occurs.
RwBool RtAnimAnimationWrite RtAnimAnimation   animation,
const RwChar   filename
 

RtAnimAnimationWrite is a wrapper around RtAnimAnimationStreamWrite. Write will open a stream and call RtAnimAnimationStreamWrite.

Writes a .ANM animation file to disk.

Parameters:
animation  A pointer to the RtAnimAnimation to be written.
filename  A pointer to the name of the file to be written to.
Returns:
RwBool, TRUE on success, or FALSE if an error occurs.
RtAnimInterpolatorInfo* RtAnimGetInterpolatorInfo RwInt32    typeID
 

RtAnimGetInterpolatorInfo retrieves the information for the interpolation scheme of the given type ID. The scheme must first have been registered using RtAnimRegisterInterpolationScheme, unless it is provided as standard. The RpHAnim plugin provides a standard animation scheme.

Parameters:
typeID  RwInt32 containing the type ID of the interpolation scheme.
Returns:
Pointer to the interpolator information RtAnimInterpolatorInfo, or NULL if no scheme is registered under the given ID.
See also:
RtAnimRegisterInterpolationScheme
RwBool RtAnimInitialize void   
 

RtAnimInitialize is used to initialize the animation toolkit with the RenderWare Graphics system to enable the manipulation of keyframed animation. The toolkit must be initialized between initializing the system with RwEngineInit and opening it with RwEngineOpen.

Returns:
RwBool, TRUE if successful, FALSE if an error occurs.
See also:
RwEngineInit , RwEngineOpen
RwBool RtAnimInterpolatorAddAnimTime RtAnimInterpolator   interp,
RwReal    time
 

RtAnimInterpolatorAddAnimTime adds time to the animation's current time and 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 RtAnimInterpolatorSetAnimCallBack then the appropriate callback will be called. By default the animation will simply loop continuously.

The added time must be positive. For backwards playing, use RtAnimInterpolatorSubAnimTime. If an animation has been playing backwards prior to RtAnimInterpolatorAddAnimTime being called, then this will be detected and the change will be handled appropriately.

Parameters:
interp  A pointer to RtAnimInterpolator.
time  RwReal containing the amount of time to add to the animation.
Returns:
RwBool, TRUE on success.
See also:
RtAnimInterpolatorAddAnimTime , RtAnimInterpolatorSetCurrentAnim , RtAnimInterpolatorSetCurrentTime , RtAnimInterpolatorSubAnimTime
RwBool RtAnimInterpolatorAddSubInterpolator RtAnimInterpolator   outAnim,
RtAnimInterpolator   mainAnim,
RtAnimInterpolator   subAnim
 

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

Parameters:
outAnim  Pointer to an RtAnimInterpolator in which the result is returned.
mainAnim  Pointer to the parent RtAnimInterpolator.
subAnim  Pointer to the sub-RtAnimInterpolator.
Note:
outAnim, mainAnim and subAnim MUST be different.
Returns:
RwBool, TRUE on success, FALSE otherwise.
See also:
RtAnimAnimationMakeDelta
RwBool RtAnimInterpolatorAddTogether RtAnimInterpolator   outAnim,
RtAnimInterpolator   inAnim1,
RtAnimInterpolator   inAnim2
 

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

Note:
outAnim, inAnim1 and inAnim2 MUST be different.
Parameters:
outAnim  Pointer to an RtAnimInterpolator in which the result is returned.
inAnim1  Pointer to the first input RtAnimInterpolator.
inAnim2  Pointer to the second input RtAnimInterpolator.
Returns:
RwBool, TRUE on success, FALSE otherwise.
See also:
RtAnimAnimationMakeDelta
RwBool RtAnimInterpolatorBlend RtAnimInterpolator   outAnim,
RtAnimInterpolator   inAnim1,
RtAnimInterpolator   inAnim2,
RwReal    alpha
 

RtAnimInterpolatorBlend interpolates between two animation interpolators. The result will be interpolated between the current state of the two input animation interpolators.

Parameters:
outAnim  Pointer to an RtAnimInterpolator in which the result is returned.
inAnim1  Pointer to the first input RtAnimInterpolator.
inAnim2  Pointer to the second input RtAnimInterpolator.
alpha  RwReal containing the blending parameter, where
  • 0.0 returns inAnim1
  • 1.0 returns inAnim2
Returns:
RwBool, TRUE on success, FALSE otherwise.
RwBool RtAnimInterpolatorBlendSubInterpolator RtAnimInterpolator   outAnim,
RtAnimInterpolator   inAnim1,
RtAnimInterpolator   inAnim2,
RwReal    alpha
 

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

Parameters:
outAnim  Pointer to an RtAnimInterpolator in which the result is returned.
inAnim1  Pointer to the first source RtAnimInterpolator.
inAnim2  Pointer to the second source RtAnimInterpolator.
alpha  RwReal containing the blending parameter where:
  • 0.0 returns inAnim1
  • 1.0 returns inAnim2
Returns:
RwBool, TRUE on success, FALSE otherwise.
RwBool RtAnimInterpolatorCopy RtAnimInterpolator   outAnim,
RtAnimInterpolator   inAnim
 

RtAnimInterpolatorCopy copies the state of nodes in the in-animation interpolator into the out-animation interpolator.

Parameters:
outAnim  Pointer to the RtAnimInterpolator in which the result is returned.
inAnim  Pointer to the input RtAnimInterpolator.
Returns:
RwBool, TRUE on success, FALSE otherwise.
RtAnimInterpolator* RtAnimInterpolatorCreate RwInt32    numNodes,
RwInt32    maxInterpKeyFrameSize
 

RtAnimInterpolatorCreate creates an instanced version of an animation. Each RtAnimAnimation object contains a full sequence of keyframes to be interpolated as time advances. The RtAnimInterpolator object contains the current state of an animation at a particular point in time. Any number of interpolators may be connected to a single RtAnimAnimation.

Internally, the interpolator stores a table of interpolated keyframes. When calling RtAnimInterpolatorAddAnimTime, RtAnimInterpolatorSubAnimTime, or RtAnimInterpolatorSetCurrentTime the contents of the interpolated keyframe table is updated using the callbacks registered in the corresponding RtAnimInterpolatorInfo for the animation.

The interpolator also manages user callbacks that may be triggered when the animation reaches a particular time, or loops back to the start.

For advanced purposes such as procedural animation, the table of interpolated frames can be accessed using the macro rtANIMGETINTERPFRAME(anim, nodeIndex), where anim is a pointer to an RtAnimInterpolator, and nodeIndex is the index of the keyframe/node. Note, however, that each interpolated frame has an RtAnimInterpFrameHeader rather than an RtAnimKeyFrameHeader and this header data should not be modified .

Parameters:
numNodes  RwInt32 containing the number of nodes.
maxInterpKeyFrameSize  RwInt32 containing the maximum size of an interpolated keyframe.
Returns:
Pointer to the new RtAnimInterpolator on success, NULL on failure.
See also:
RtAnimAnimationCreate , RtAnimAnimationDestroy , RtAnimInterpolatorCreate , RtAnimInterpolatorCreateSubInterpolator
RtAnimInterpolator* RtAnimInterpolatorCreateSubInterpolator RtAnimInterpolator   parentAnim,
RwInt32    startNode,
RwInt32    numNodes,
RwInt32    maxInterpKeyFrameSize
 

RtAnimInterpolatorCreateSubInterpolator creates a sub-animation interpolator of a given main animation interpolator. The parent-animation interpolator and the offset into the animation interpolator are provided along with flags defining the sub-animation interpolators settings. You can specify a different maxkeyframesize for the sub-animation interpolator and use different types of keyframe on sub-animation interpolators and main animation interpolators. Specifying -1 will adopt the parent animation interpolators size settings.

The sub-animation interpolator can then be used to run a different animation from the base animation interpolator.

Parameters:
parentAnim  The parent RtAnimInterpolator to be used for this sub-animation interpolator.
startNode  RwInt32 containing the index of the node representing the root of the new sub-animation interpolator.
numNodes  RwInt32 containing the number of nodes to create.
maxInterpKeyFrameSize  RwInt32 containing the maximum keyframe size to allow in the sub-animation interpolator, passing -1 will copy the parent animation interpolators settings.
Returns:
Pointer to the new sub-RtAnimInterpolator on success.
See also:
RtAnimInterpolatorCreate , RtAnimAnimationDestroy
void RtAnimInterpolatorDestroy RtAnimInterpolator   anim
 

RtAnimInterpolatorDestroy destroys an RtAnimInterpolator object.

Parameters:
anim  Pointer to the RtAnimAnimation to be destroyed.
See also:
RtAnimAnimationCreate , RtAnimAnimationDestroy , RtAnimInterpolatorCreate , RtAnimInterpolatorCreateSubInterpolator
RtAnimAnimation* RtAnimInterpolatorGetCurrentAnim RtAnimInterpolator   animI
 

RtAnimInterpolatorGetCurrentAnim return the current animation on the animation interpolator.

Parameters:
animI  Pointer to the RtAnimInterpolator.
Returns:
a pointer to the current RtAnimAnimation if any.
See also:
RtAnimInterpolatorSetCurrentAnim
void RtAnimInterpolatorSetAnimCallBack RtAnimInterpolator   anim,
RtAnimCallBack    callBack,
RwReal    time,
void *    data
 

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

Parameters:
anim  Pointer to an RtAnimInterpolator.
callBack  Pointer to a RtAnimCallBack function.
time  RwReal containing the time at which the callback function should be called.
data  Void pointer to a block of data to be passed into the callback function.
void RtAnimInterpolatorSetAnimLoopCallBack RtAnimInterpolator   anim,
RtAnimCallBack    callBack,
void *    data
 

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

Parameters:
anim  Pointer to an RtAnimInterpolator.
callBack  Pointer to a RtAnimCallBack function.
data  Void pointer to a block of data to be passed into the callback function.
RwBool RtAnimInterpolatorSetCurrentAnim RtAnimInterpolator   animI,
RtAnimAnimation   anim
 

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

Parameters:
animI  Pointer to the RtAnimInterpolator.
anim  Pointer to the RtAnimAnimation.
Returns:
RwBool, TRUE on success, FALSE if an error occurs.
RwBool RtAnimInterpolatorSetCurrentTime RtAnimInterpolator   anim,
RwReal    time
 

RtAnimInterpolatorSetCurrentTime sets the current animation time of an animation interpolator.

Parameters:
anim  A pointer to RtAnimInterpolator.
time  RwReal containing the time to which to set the current animation.
Returns:
RwBool, TRUE on success, FALSE otherwise.
See also:
RtAnimInterpolatorAddAnimTime , RtAnimInterpolatorSubAnimTime , RtAnimInterpolatorSetCurrentTime
RwBool RtAnimInterpolatorSetKeyFrameCallBacks RtAnimInterpolator   anim,
RwInt32    keyFrameTypeID
 

RtAnimInterpolatorSetKeyFrameCallBacks sets up the callbacks to be used by the animation interpolator. These callbacks perform keyframe blending, interpolation and conversion to matrices. The callback setup is implicitly performed when setting the current animation on an animation interpolator. However if you wish to fully procedurally drive the keyframe data this function allows the callbacks to be set up.

Parameters:
anim  Pointer to the RtAnimInterpolator.
keyFrameTypeID  RwInt32 containing the ID of the keyframe type to retrieve the callbacks for.
Returns:
RwBool, TRUE on success, FALSE if an error occurs.
RwBool RtAnimInterpolatorSubAnimTime RtAnimInterpolator   interp,
RwReal    time
 

RtAnimInterpolatorSubAnimTime subtracts time from the current animation time and 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 RtAnimInterpolatorSetAnimCallBack then the appropriate callback will be called. By default the animation will simply loop continuously.

Parameters:
interp  A pointer to RtAnimInterpolator.
time  RwReal containing the amount of time to subtract from the animation.
Returns:
RwBool, TRUE on success.
See also:
RtAnimInterpolatorAddAnimTime , RtAnimInterpolatorSetCurrentTime
void RtAnimKeyFrameAddTogether RtAnimInterpolator   animation,
void *    out,
void *    in1,
void *    in2
 

RtAnimKeyFrameAddTogether adds two interpolated keyframes together. These would normally be from two different RtAnimInterpolator objects, with the results being stored in a third RtAnimInterpolator.

Parameters:
animation  Pointer to the RtAnimInterpolator in use.
out  Void pointer to the output summed frame.
in1  Void pointer to the first input frame.
in2  Void pointer to the second input frame.
void RtAnimKeyFrameApply RtAnimInterpolator   animation,
void *    result,
void *    iFrame
 

RtAnimKeyFrameApply converts an interpolated keyframe structure into a usable format, such as a matrix in the case of hierarchical animation.

Parameters:
animation  Pointer to the RtAnimInterpolator in use.
result  Void pointer to the output data.
iFrame  Void pointer to the input keyframe.
void RtAnimKeyFrameBlend RtAnimInterpolator   animation,
void *    out,
void *    in1,
void *    in2,
RwReal    alpha
 

RtAnimKeyFrameBlend blends between two interpolated keyframes using a given blend factor. These would normally be from different RtAnimInterpolator objects, with the results being stored in a third RtAnimInterpolator.

Parameters:
animation  Pointer to the RtAnimInterpolator in use.
out  Void pointer to the output keyframe.
in1  Void pointer to the first input keyframe.
in2  Void pointer to the second input keyframe.
alpha  RwReal containing the blending factor.
void RtAnimKeyFrameInterpolate RtAnimInterpolator   animation,
void *    out,
void *    in1,
void *    in2,
RwReal    time
 

RtAnimKeyFrameInterpolate interpolates between two keyframes and returns the result.

Parameters:
animation  Pointer to the RtAnimInterpolator in use.
out  Void pointer to the output keyframe.
in1  Void pointer to the first input keyframe.
in2  Void pointer to the second input keyframe.
time  RwReal containing the time to which to interpolate.
RwBool RtAnimRegisterInterpolationScheme RtAnimInterpolatorInfo   interpInfo
 

RtAnimRegisterInterpolationScheme registers a keyframe interpolation scheme. The function must be called before any animations using the scheme are created or read from a stream.

An RtAnimInterpolatorInfo structure should be filled with the type ID of the scheme, the size of the keyframe structure and a list of callbacks for processing keyframes, before being passed to this function.

The type ID must be unique and it is recommended that values in the range 1 to 255 are reserved for internal use by RenderWare Graphics. It is suggested that developers construct unique IDs using MAKECHUNKID(vendorID, typeID). An animation using the scheme may be created by passing in the type ID.

The keyframe structure should always begin with a standard header (RtAnimKeyFrameHeader), i.e. the first 4 bytes hold a pointer to the previous keyframe for the particular node, and the second 4 bytes hold the time of the keyframe. This allows the keyframe type to function with RtAnimInterpolatorAddAnimTime etc. The header size should be included in the animKeyFrameSize entry. For an interpolated keyframe, a different header is used (RtAnimInterpFrameHeader) which has the same size and should be included in the interpKeyFrameSize entry.

See RtAnimInterpolatorInfo for information about the callbacks.

Parameters:
interpInfo  Pointer to the RtAnimInterpolatorInfo structure containing the interpolator information. This information will be copied to an internal data block.
Returns:
RwBool, TRUE if successful, or FALSE if an error occurred.
See also:
RtAnimGetInterpolatorInfo

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