summaryrefslogtreecommitdiffstats
path: root/sdk/rwsdk/include/d3d8/rphanim.h
diff options
context:
space:
mode:
Diffstat (limited to 'sdk/rwsdk/include/d3d8/rphanim.h')
-rw-r--r--sdk/rwsdk/include/d3d8/rphanim.h756
1 files changed, 262 insertions, 494 deletions
diff --git a/sdk/rwsdk/include/d3d8/rphanim.h b/sdk/rwsdk/include/d3d8/rphanim.h
index a9b0438a..0d1bba7a 100644
--- a/sdk/rwsdk/include/d3d8/rphanim.h
+++ b/sdk/rwsdk/include/d3d8/rphanim.h
@@ -26,7 +26,6 @@
* Purpose : Hierarchical animation *
* *
**************************************************************************/
-
#ifndef RPHANIM_H
#define RPHANIM_H
@@ -38,7 +37,7 @@
/**
* \defgroup rphanim RpHAnim
- * \ingroup rpplugin
+ * \ingroup objectframehanim
*
* Hierarchical Animation Plugin for RenderWare Graphics.
*/
@@ -66,45 +65,26 @@
*/
#include <rphanim.rpe> /* automatically generated header file */
#include <rtquat.h>
+#include <rtanim.h>
#define rpHANIMSTREAMCURRENTVERSION 0x100
-/**
- * \ingroup rphanim
- * \ref RpHAnimAtomicGlobalVars typedef for struct RpHAnimAtomicGlobalVars
- */
+#if (!defined(DOXYGEN))
+
typedef struct RpHAnimAtomicGlobalVars RpHAnimAtomicGlobalVars;
-/**
- * \ingroup rphanim
- * \struct RpHAnimAtomicGlobalVars
- */
struct RpHAnimAtomicGlobalVars
{
- RwInt32 engineOffset ; /* Offset into global data */
+ RwInt32 engineOffset;
RwFreeList *HAnimFreeList;
- RwFreeList *HAnimAnimationFreeList;
};
-extern RpHAnimAtomicGlobalVars RpHAnimAtomicGlobals;
+#endif /* (!defined(DOXYGEN)) */
-#define rpHANIMSTDKEYFRAMESIZE sizeof(RpHAnimStdKeyFrame)
+#define rpHANIMSTDKEYFRAMESIZE sizeof(RpHAnimKeyFrame)
#define rpHANIMSTDKEYFRAMETYPEID 0x1
-#define RwAnimMalloc() \
- RwFreeListAlloc(RpHAnimAtomicGlobals.HAnimFreeList)
-
-#define RwAnimFree(_anim) \
- RwFreeListFree(RpHAnimAtomicGlobals.HAnimFreeList, (_anim))
-
-#define RwAnimAnimationMalloc() \
- RwFreeListAlloc(RpHAnimAtomicGlobals.HAnimAnimationFreeList)
-
-#define RwAnimAnimationFree(_animAnimation) \
- RwFreeListFree(RpHAnimAtomicGlobals.HAnimAnimationFreeList, \
- (_animAnimation))
-
-#define RpV3dInterpolate(o, a, s, b) \
+#define RpV3dInterpolate(o,a,s,b) \
MACRO_START \
{ \
(o)->x = (((a)->x) + ((s)) * (((b)->x) - ((a)->x))); \
@@ -113,223 +93,57 @@ MACRO_START \
} \
MACRO_STOP
-/**
- * \ingroup rphanim
- * \ref RpHAnimHierarchy typedef for struct RpHAnimHierarchy
- */
-typedef struct RpHAnimHierarchy RpHAnimHierarchy;
-
-/**
- * \ingroup rphanim
- * \ref RpHAnimAnimation typedef for struct RpHAnimAnimation
- */
-typedef struct RpHAnimAnimation RpHAnimAnimation;
-
-/**
- * \ingroup rphanim
- * \ref RpHAnimHierarchyCallBack
- * This typedef defines a callback function for use with the
- * \ref RpHAnimHierarchySetAnimCallBack and
- * \ref RpHAnimHierarchySetAnimLoopCallBack functions.
- *
- * \param hierarchy
- * A pointer to the AnimHierarchy structure.
- *
- * \param data User-defined data.
- * You can use this to pass your own data
- * structure(s) to the callback function.
- *
- * \see RpHAnimHierarchySetAnimCallBack
- * \see RpHAnimHierarchySetAnimLoopCallBack
- *
- */
-
-typedef RpHAnimHierarchy * (*RpHAnimHierarchyCallBack) (RpHAnimHierarchy *hierarchy,
- void *data);
-
-/*
- * The following CallBacks are needed for each overloaded interpolation
- * scheme. See RpHAnimInterpolatorInfo.
- */
-
-/**
- * \ingroup rphanim
- * \ref RpHAnimKeyFrameToMatrixCallBack
- * This typedef defines a callback function for converting
- * an animation keyframe into a modeling matrix. The output matrix will be
- * used to construct the array of world or local space matrices for the
- * hierarchy as obtained with \ref RpHAnimHierarchyGetMatrixArray, and
- * possibly used for updating an external \ref RwFrame hierarchy.
- *
- * \param matrix This is the matrix to store the output of the conversion
- * \param voidIFrame This is a void pointer to the keyframe and should be cast
- * to the keyframe type this callback is for.
- */
-typedef void (*RpHAnimKeyFrameToMatrixCallBack) (RwMatrix *matrix, void *voidIFrame);
-
-/**
- * \ingroup rphanim
- * \ref RpHAnimKeyFrameBlendCallBack
- * This typedef defines a callback function for blending between two animation
- * keyframes by the given blend factor.
- *
- * \param voidOut This is the void pointer for the output of the blend
- * \param voidIn1 First input keyframe
- * \param voidIn2 Second input keyframe
- * \param alpha Blend factor
- */
-typedef void (*RpHAnimKeyFrameBlendCallBack) (void *voidOut, void *voidIn1,
- void *voidIn2, RwReal alpha);
-
-/**
- * \ingroup rphanim
- * \ref RpHAnimKeyFrameInterpolateCallBack
- * This typedef defines a callback function for interpolating between two
- * animation keyframes according to the given time.
- *
- * \param voidOut This is the void pointer for the output of the
- * interpolation
- * \param voidIn1 First input keyframe
- * \param voidIn2 Second input keyframe
- * \param time Time at which to interpolate
- */
-typedef void (*RpHAnimKeyFrameInterpolateCallBack) (void *voidOut, void *voidIn1,
- void *voidIn2, RwReal time);
-
-/**
- * \ingroup rphanim
- * \ref RpHAnimKeyFrameAddCallBack
- * This typedef defines a callback function for adding together two animation
- * keyframes. One of the keyframes would usually be a delta.
- *
- * \param voidOut This is the void pointer for the output summed keyframe
- * \param voidIn1 First input keyframe
- * \param voidIn2 Second input keyframe
- */
-typedef void (*RpHAnimKeyFrameAddCallBack) (void *voidOut, void *voidIn1,
- void *voidIn2);
-
-/**
- * \ingroup rphanim
- * \ref RpHAnimKeyFrameMulRecipCallBack
- * This typedef defines a callback function for multiplying a keyframe
- * by the inverse of another keyframe
- *
- * \param voidFrame This is the void pointer for the keyframe to be modified
- * \param voidStart First start keyframe to take the reciprocal of.
- */
-typedef void (*RpHAnimKeyFrameMulRecipCallBack) (void *voidFrame, void *voidStart);
-
-/**
- * \ingroup rphanim
- * \ref RpHAnimKeyFrameStreamReadCallBack
- * This typedef defines a callback function for reading in keyframes
- * from an \ref RwStream for the given animation.
- *
- * \param stream The stream to read the keyframes from
- * \param animation The animation to read the keyframes into
- *
- * \return Pointer to the animation.
- */
-typedef RpHAnimAnimation * (*RpHAnimKeyFrameStreamReadCallBack) (RwStream *stream, RpHAnimAnimation *animation);
-
-/**
- * \ingroup rphanim
- * \ref RpHAnimKeyFrameStreamWriteCallBack
- * This typedef defines a callback function for writing keyframes from the
- * given animation to an \ref RwStream.
- *
- * \param animation The animation to write out from
- * \param stream The stream to write the keyframes to
- *
- * \return TRUE if successful.
- */
-typedef RwBool (*RpHAnimKeyFrameStreamWriteCallBack) (RpHAnimAnimation *animation, RwStream *stream);
-
-/**
- * \ingroup rphanim
- * \ref RpHAnimKeyFrameStreamGetSizeCallBack
- * This typedef defines a callback function for calculating the binary stream
- * size of keyframe data within an animation.
- *
- * \param animation The animation to calculate sizes of
- *
- * \return Size in bytes of the keyframe data.
- */
-typedef RwInt32 (*RpHAnimKeyFrameStreamGetSizeCallBack) (RpHAnimAnimation *animation);
/**
* \ingroup rphanim
- * \ref RpHAnimInterpolatorInfo
- * typedef for struct \ref RpHAnimInterpolatorInfo
+ * \ref RpHAnimKeyFrame
+ * typedef for struct RpHAnimKeyFrame. Based on \ref RtAnimKeyFrameHeader.
*/
-typedef struct RpHAnimInterpolatorInfo RpHAnimInterpolatorInfo;
+typedef struct RpHAnimKeyFrame RpHAnimKeyFrame;
/**
* \ingroup rphanim
- * \struct RpHAnimInterpolatorInfo
- * This is used to hold information for a keyframe interpolation scheme.
- *
- * \see RpHAnimRegisterInterpolationScheme
- * \see RpHAnimGetInterpolatorInfo
+ * \struct RpHAnimKeyFrame
+ * A structure representing the standard keyframe data. Sequences of
+ * such keyframes in an \ref RtAnimAnimation defines the animation of each
+ * node in a hierarchy.
*/
-struct RpHAnimInterpolatorInfo
+struct RpHAnimKeyFrame
{
- RwInt32 typeID; /**< The ID of the interpolation scheme */
- RwInt32 keyFrameSize; /**< Size in bytes of the keyframe structure */
- RpHAnimKeyFrameToMatrixCallBack keyFrameToMatrixCB; /**< Pointer to a function that converts a keyframe to a matrix */
- RpHAnimKeyFrameBlendCallBack keyFrameBlendCB; /**< Pointer to a function that blends between a pair of keyframes for a given delta value */
- RpHAnimKeyFrameInterpolateCallBack keyFrameInterpolateCB; /**< Pointer to a function that interpolates between two keyframes for a given time in between */
- RpHAnimKeyFrameAddCallBack keyFrameAddCB; /**< Pointer to a function that adds two keyframes (one of which may be a delta) */
- RpHAnimKeyFrameMulRecipCallBack keyFrameMulRecipCB; /**< Pointer to a function that multiplies a keyframe by the reciprocal of another */
- RpHAnimKeyFrameStreamReadCallBack keyFrameStreamReadCB; /**< Pointer to a function that reads the keyframes from a stream for a given animation */
- RpHAnimKeyFrameStreamWriteCallBack keyFrameStreamWriteCB; /**< Pointer to a function that writes the keyframes to a stream for a given animation */
- RpHAnimKeyFrameStreamGetSizeCallBack keyFrameStreamGetSizeCB; /**< Pointer to a function that returns the binary stream size of the keyframes for a given animation */
+ RpHAnimKeyFrame *prevFrame; /**< Pointer to the previous keyframe */
+ RwReal time; /**< Time at keyframe */
+ RtQuat q; /**< Quaternion rotation at keyframe */
+ RwV3d t; /**< Translation at keyframe */
};
/**
* \ingroup rphanim
- * \ref RpHAnimKeyFrameHeader
- * typedef for struct RpHAnimKeyFrameHeader
+ * \ref RpHAnimInterpFrame
+ * typedef for struct RpHAnimInterpFrame. Based on \ref RtAnimInterpFrameHeader.
*/
-typedef struct RpHAnimKeyFrameHeader RpHAnimKeyFrameHeader;
+typedef struct RpHAnimInterpFrame RpHAnimInterpFrame;
/**
* \ingroup rphanim
- * \struct RpHAnimKeyFrameHeader
- * Holds header information for a keyframe. All keyframe structures used with
- * the overloadable interpolation system should start with this data.
- *
- * \see RpHAnimStdKeyFrame
- * \see RpHAnimRegisterInterpolationScheme
+ * \struct RpHAnimInterpFrame
+ * A structure representing an interpolated keyframe. The initial part of the
+ * structure matches \ref RtAnimInterpFrameHeader.
*/
-struct RpHAnimKeyFrameHeader
+struct RpHAnimInterpFrame
{
- void *prevFrame; /**< Previous keyframe for particular hierarchy node */
- RwReal time; /**< Time at keyframe */
+ RpHAnimKeyFrame *keyFrame1;
+ /**< Pointer to 1st keyframe of current interpolation pair */
+ RpHAnimKeyFrame *keyFrame2;
+ /**< Pointer to 2nd keyframe of current interpolation pair */
+ RtQuat q; /**< Quaternion rotation */
+ RwV3d t; /**< Translation */
};
/**
* \ingroup rphanim
- * \ref RpHAnimStdKeyFrame
- * typedef for struct RpHAnimStdKeyFrame
- */
-typedef struct RpHAnimStdKeyFrame RpHAnimStdKeyFrame;
-
-/**
- * \ingroup rphanim
- * \struct RpHAnimStdKeyFrame
- * A structure representing the standard keyframe data. Sequences of
- * such keyframes in an \ref RpHAnimAnimation defines the animation of each
- * node in a hierarchy.
+ * \ref RpHAnimHierarchy typedef for struct RpHAnimHierarchy
*/
-struct RpHAnimStdKeyFrame
-{
- RpHAnimStdKeyFrame *prevFrame; /**< Previous keyframe for particular hierarchy node */
- RwReal time; /**< Time at keyframe */
- RtQuat q; /**< Quaternion rotation at keyframe */
- RwV3d t; /**< Translation at keyframe */
-};
+typedef struct RpHAnimHierarchy RpHAnimHierarchy;
/* Flags for FrameInfos */
@@ -347,54 +161,23 @@ typedef struct RpHAnimNodeInfo RpHAnimNodeInfo;
* \ingroup rphanim
* \struct RpHAnimNodeInfo
*
+ * Used to describe a hierarchy toplogy.
+ * It holds flags representing its position in the
+ * hierarchy as well as a pointer to the matching \ref RwFrame if the
+ * hierarchy has been attached to a \ref RwFrame hierarchy.
+ *
*/
struct RpHAnimNodeInfo
{
- RwInt32 nodeID; /**< User defined ID for this node */
- RwInt32 nodeIndex; /**< Array index of node */
+ RwInt32 nodeID; /**< User defined ID for this node */
+ RwInt32 nodeIndex; /**< Array index of node */
RwInt32 flags; /**< Matrix push/pop flags */
RwFrame * pFrame; /**< Pointer to an attached RwFrame (see \ref RpHAnimHierarchyAttach) */
};
/**
* \ingroup rphanim
- * \struct RpHAnimAnimation
- * A hierarchical animation consists of an array of keyframe structures,
- * along with some flags and a duration.
- *
- * The keyframes should be presented in the order they are needed
- * to animate forwards through time. Pointers link all of the keyframes
- * for a particular node backwards through time in a list.
- *
- * For example, a 3 node animation, with keyframes at the following times:
- *
- * Node 1: 0.0, 1.0, 2.0, 3.0
- * Node 2: 0.0, 3.0
- * Node 3: 0.0, 2.0, 2.5, 3.0
- *
- * should be formatted in an RpHAnimAnimation animation like this:
- *
- * B1,0.0 B2,0.0 B3,0.0 B1,1.0, B2,3.0, B3,2.0, B1,2.0, B1,3.0, B3,2.5 B3,3.0
- *
- * Each node MUST start at time = 0.0, and each node must terminate with a keyframe
- * at time = duration of animation.
- *
- * \see RpHAnimAnimationCreate
- */
-struct RpHAnimAnimation
-{
- RpHAnimInterpolatorInfo *interpInfo; /**< Pointer to interpolation scheme information */
- RwInt32 numFrames; /**< Number of keyframes in the animation */
- RwInt32 flags; /**< Specifies details about animation, relative translation modes etc */
- RwReal duration; /**< Duration of animation in seconds */
- void *pFrames; /**< Pointer to the animation keyframes */
-};
-
-/**
- * \ingroup rphanim
* \ref RpHAnimHierarchyFlag defines type and update modes in HAnimHierarchies
- *
- * \see RpAnimHierarchyFlag
*/
enum RpHAnimHierarchyFlag
{
@@ -411,9 +194,7 @@ enum RpHAnimHierarchyFlag
rpHANIMHIERARCHYFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
};
-/**
- * \ingroup rphanim
- * \typedef RpHAnimHierarchyFlag
+/*
* These flags are used to control the creation and
* update status of the hierarchy
*/
@@ -422,13 +203,7 @@ typedef enum RpHAnimHierarchyFlag RpHAnimHierarchyFlag;
/**
* \ingroup rphanim
* \struct RpHAnimHierarchy
- * An RpHAnimHierarchy is used to "play back" an animation - it holds the
- * interpolated keyframe data for the current state of an animation
- * concatenated on the end of the structure.
- *
- * The rpHANIMHIERARCHYGETINTERPFRAME() macro can be used to access the current
- * interpolated data, for the current time or to write to this data to override
- * it with procedural animation.
+ * An RpHAnimHierarchy is used to "play back" an animation.
*
* The structure of a hierarchy is defined by an array
* of \ref RpHAnimNodeInfo structures.
@@ -443,48 +218,18 @@ struct RpHAnimHierarchy
{
RwInt32 flags; /**< Flags for the hierarchy */
RwInt32 numNodes; /**< Number of nodes in the hierarchy */
- RpHAnimAnimation *pCurrentAnim; /**< Current animation applied to hierarchy */
- RwReal currentTime; /**< Current animation time */
- void *pNextFrame; /**< Next animation keyframe to be played */
- RpHAnimHierarchyCallBack pAnimCallBack; /**< Animation callback function pointer */
- void *pAnimCallBackData; /**< Animation callback function user data */
- RwReal animCallBackTime; /**< Trigger time for callback function */
- RpHAnimHierarchyCallBack pAnimLoopCallBack; /**< Animation loop callback function pointer */
- void *pAnimLoopCallBackData; /**< Animation loop callback function data */
+
RwMatrix *pMatrixArray; /**< Pointer to node matrices*/
void *pMatrixArrayUnaligned; /**< Pointer to memory used for node matrices
* from which the aligned pMatrixArray is allocated */
RpHAnimNodeInfo *pNodeInfo; /**< Array of node information (push/pop flags etc) */
RwFrame *parentFrame; /**< Pointer to the Root RwFrame of the hierarchy this
* RpHAnimHierarchy represents */
- RwInt32 maxKeyFrameSize; /**< Maximum size of keyframes usable on this hierarhcy
- * (set at creation time) */
- RwInt32 currentKeyFrameSize; /**< Size of keyframes in the current animation */
- RpHAnimKeyFrameToMatrixCallBack keyFrameToMatrixCB; /**< Internal use */
- RpHAnimKeyFrameBlendCallBack keyFrameBlendCB; /**< Internal use */
- RpHAnimKeyFrameInterpolateCallBack keyFrameInterpolateCB; /**< Internal use */
- RpHAnimKeyFrameAddCallBack keyFrameAddCB; /**< Internal use */
RpHAnimHierarchy *parentHierarchy; /**< Internal use */
- RwInt32 offsetInParent; /**< Internal use */
RwInt32 rootParentOffset; /**< Internal use */
-};
-#define rpHANIMHIERARCHYGETINTERPFRAME( hierarchy, nodeIndex ) \
- ( (void *)( ( (RwUInt8 *)&(hierarchy[1]) + \
- ((nodeIndex) * \
- hierarchy->currentKeyFrameSize) ) ) )
-
-#define rpHANIMHIERARCHYGETINTERPFRAME1( hierarchy, nodeIndex ) \
- ( (void *)( ( (RwUInt8 *)&(hierarchy[1]) + \
- ((hierarchy->numNodes + \
- (nodeIndex)) * \
- hierarchy->currentKeyFrameSize) ) ) )
-
-#define rpHANIMHIERARCHYGETINTERPFRAME2( hierarchy, nodeIndex ) \
- ( (void *)( ( (RwUInt8 *)&(hierarchy[1]) + \
- ((hierarchy->numNodes * 2 + \
- (nodeIndex)) * \
- hierarchy->currentKeyFrameSize) ) ) )
+ RtAnimInterpolator *currentAnim; /**< Internal use */
+};
/**
* \ingroup rphanim
@@ -496,36 +241,40 @@ typedef struct RpHAnimFrameExtension RpHAnimFrameExtension;
/**
* \ingroup rphanim
* \struct RpHAnimFrameExtension
+ *
+ * Used to extend \ref RwFrame objects, and thus
+ * allow the mapping between animation hierarchy node ID and \ref RwFrame.
+ *
*/
struct RpHAnimFrameExtension
{
- RwInt32 id; /**< ID given to this RwFrame (default of -1) */
+ RwInt32 id; /**< ID given to this RwFrame (default of -1) */
RpHAnimHierarchy *hierarchy; /**< Pointer to Animation hierarchy attached to this RwFrame */
};
/*--- Plugin API Functions ---*/
-#define RpHAnimHierarchySetFlagsMacro(hierarchy, _flags) \
+#define RpHAnimHierarchySetFlagsMacro(hierarchy,_flags) \
MACRO_START \
{ \
- (hierarchy)->flags = _flags; \
+ (hierarchy)->flags = _flags; \
} \
MACRO_STOP
#define RpHAnimHierarchyGetFlagsMacro(hierarchy) \
((hierarchy)->flags)
-#define RpHAnimStdKeyFrameToMatrixMacro(_matrix, _voidIFrame) \
+#define RpHAnimKeyFrameToMatrixMacro(_matrix,_voidIFrame) \
MACRO_START \
{ \
- RpHAnimStdKeyFrame * iFrame = (RpHAnimStdKeyFrame *)(_voidIFrame); \
+ RpHAnimInterpFrame * iFrame = (RpHAnimInterpFrame *)(_voidIFrame); \
\
/* \
* RpHAnim uses the same types of quaternion as RtQuat \
* hence no conjugate call as in RpSkin \
*/ \
\
- RtQuatUnitConvertToMatrix(&iFrame->q, (_matrix)); \
+ RtQuatUnitConvertToMatrix(&iFrame->q,(_matrix)); \
\
(_matrix)->pos.x = iFrame->t.x; \
(_matrix)->pos.y = iFrame->t.y; \
@@ -534,14 +283,14 @@ MACRO_START \
MACRO_STOP
+
#if (! defined(RWDEBUG))
-#define RpHAnimHierarchySetFlags(hierarchy, _flags) \
- RpHAnimHierarchySetFlagsMacro(hierarchy, _flags)
+#define RpHAnimHierarchySetFlags(hierarchy,_flags) \
+ RpHAnimHierarchySetFlagsMacro(hierarchy,_flags)
#define RpHAnimHierarchyGetFlags(hierarchy) \
(RpHAnimHierarchyFlag)RpHAnimHierarchyGetFlagsMacro(hierarchy)
-
#endif /* (! defined(RWDEBUG)) */
#ifdef __cplusplus
@@ -549,6 +298,8 @@ extern "C"
{
#endif /* __cplusplus */
+extern RpHAnimAtomicGlobalVars RpHAnimAtomicGlobals;
+
#if (defined(RWDEBUG))
extern RpHAnimHierarchy *
@@ -560,15 +311,9 @@ RpHAnimHierarchyGetFlags(RpHAnimHierarchy *hierarchy);
#endif /* (defined(RWDEBUG)) */
-/* Keyframe Interpolator Types */
-
-extern RwBool
-RpHAnimRegisterInterpolationScheme(RpHAnimInterpolatorInfo *interpolatorInfo);
-
-extern RpHAnimInterpolatorInfo *
-RpHAnimGetInterpolatorInfo(RwInt32 typeID);
-
/* Animation hierarchy creation */
+extern void
+RpHAnimHierarchySetFreeListCreateParams(RwInt32 blockSize,RwInt32 numBlocksToPrealloc);
extern RpHAnimHierarchy *
RpHAnimHierarchyCreate(RwInt32 numNodes,
@@ -613,45 +358,10 @@ extern RpHAnimHierarchy *
RpHAnimFrameGetHierarchy(RwFrame *frame);
/* Macros for legacy support of old function names */
-#define RpHAnimSetHierarchy(frame, hierarchy) \
- RpHAnimFrameSetHierarchy(frame, hierarchy)
+#define RpHAnimSetHierarchy(frame,hierarchy) \
+ RpHAnimFrameSetHierarchy(frame,hierarchy)
#define RpHAnimGetHierarchy(frame) RpHAnimFrameGetHierarchy(frame)
-extern RwBool
-RpHAnimHierarchySetKeyFrameCallBacks(RpHAnimHierarchy *hierarchy,
- RwInt32 keyFrameTypeID);
-
-extern RwBool
-RpHAnimHierarchySetCurrentAnim(RpHAnimHierarchy *hierarchy,
- RpHAnimAnimation *anim);
-
-extern RwBool
-RpHAnimHierarchySetCurrentAnimTime(RpHAnimHierarchy *hierarchy,
- RwReal time);
-
-extern RwBool
-RpHAnimHierarchySubAnimTime(RpHAnimHierarchy *hierarchy,
- RwReal time);
-
-extern RwBool
-RpHAnimHierarchyStdKeyFrameAddAnimTime(RpHAnimHierarchy *hierarchy,
- RwReal time);
-
-extern RwBool
-RpHAnimHierarchyAddAnimTime(RpHAnimHierarchy *hierarchy,
- RwReal time);
-
-extern RpHAnimHierarchy *
-RpHAnimHierarchySetAnimCallBack(RpHAnimHierarchy *hierarchy,
- RpHAnimHierarchyCallBack callBack,
- RwReal time,
- void *data );
-
-extern RpHAnimHierarchy *
-RpHAnimHierarchySetAnimLoopCallBack(RpHAnimHierarchy *hierarchy,
- RpHAnimHierarchyCallBack callBack,
- void *data );
-
extern RwMatrix *
RpHAnimHierarchyGetMatrixArray(RpHAnimHierarchy *hierarchy);
@@ -665,209 +375,267 @@ extern RwInt32
RpHAnimIDGetIndex(RpHAnimHierarchy *hierarchy,
RwInt32 ID);
-/* Animations */
-
-extern RpHAnimAnimation *
-RpHAnimAnimationCreate(RwInt32 typeID,
- RwInt32 numFrames,
- RwInt32 flags,
- RwReal duration);
-
-extern RpHAnimAnimation *
-RpHAnimAnimationDestroy(RpHAnimAnimation *animation);
+/* Plugin support */
-#ifdef RWDEBUG
+extern RwBool
+RpHAnimPluginAttach(void);
-extern RwInt32
-RpHAnimAnimationGetTypeID(RpHAnimAnimation *animation);
+/* Hanim keyframe functions */
-#else /* RWDEBUG */
+extern void
+RpHAnimKeyFrameApply(void *matrix,
+ void *voidIFrame);
-#define RpHAnimAnimationGetTypeID(animation) \
- (animation->interpInfo->typeID)
+extern void
+RpHAnimKeyFrameBlend(void *voidOut,
+ void *voidIn1,
+ void *voidIn2,
+ RwReal alpha);
-#endif /* RWDEBUG */
+extern void
+RpHAnimKeyFrameInterpolate(void *voidOut,
+ void *voidIn1,
+ void *voidIn2,
+ RwReal time);
-extern RpHAnimAnimation *
-RpHAnimAnimationRead(const RwChar * filename);
+extern void
+RpHAnimKeyFrameAdd(void *voidOut,
+ void *voidIn1,
+ void *voidIn2);
-extern RwBool
-RpHAnimAnimationWrite(RpHAnimAnimation *animation,
- const RwChar * filename);
+extern void
+RpHAnimKeyFrameMulRecip(void *voidFrame,
+ void *voidStart);
-extern RpHAnimAnimation *
-RpHAnimAnimationStreamRead(RwStream *stream);
+extern RtAnimAnimation *
+RpHAnimKeyFrameStreamRead(RwStream *stream,
+ RtAnimAnimation *animation);
extern RwBool
-RpHAnimAnimationStreamWrite(RpHAnimAnimation *animation,
- RwStream *stream);
+RpHAnimKeyFrameStreamWrite(RtAnimAnimation *animation,
+ RwStream *stream);
extern RwInt32
-RpHAnimAnimationStreamGetSize(RpHAnimAnimation *animation);
+RpHAnimKeyFrameStreamGetSize(RtAnimAnimation *animation);
-extern RwBool
-RpHAnimAnimationMakeDelta(RpHAnimAnimation *animation,
- RwInt32 numNodes,
- RwReal time);
-
-/* Plugin support */
+/* Access to RwFrame ID's */
extern RwBool
-RpHAnimPluginAttach(void);
+RpHAnimFrameSetID(RwFrame *frame,
+ RwInt32 id);
-/* Overloadable keyframe functions */
+extern RwInt32
+RpHAnimFrameGetID(RwFrame *frame);
-#define RpHAnimFrameToMatrixMacro(hierarchy, matrix, iFrame) \
-MACRO_START \
-{ \
- const RpHAnimKeyFrameToMatrixCallBack keyFrameToMatrixCB = \
- (hierarchy)->keyFrameToMatrixCB; \
- \
- if (RpHAnimStdKeyFrameToMatrix == keyFrameToMatrixCB) \
- { \
- RpHAnimStdKeyFrameToMatrixMacro((matrix), (iFrame)); \
- } \
- else \
- { \
- keyFrameToMatrixCB((matrix), (iFrame)); \
- } \
-} \
-MACRO_STOP
+/*
+ * Utility Functions
+ */
+#define RpHAnimHierarchySetCurrentAnimMacro(hierarchy,anim)\
+ RtAnimInterpolatorSetCurrentAnim((hierarchy)->currentAnim,anim)
-#define RpHAnimFrameInterpolateMacro(hierarchy, out, in1, in2, time) \
-MACRO_START \
-{ \
- (hierarchy)->keyFrameInterpolateCB((out), (in1), (in2), (time)); \
-} \
-MACRO_STOP
+#define RpHAnimHierarchyGetCurrentAnimMacro(hierarchy)\
+ RtAnimInterpolatorGetCurrentAnim((hierarchy)->currentAnim)
-#define RpHAnimFrameBlendMacro(hierarchy, out, in1, in2, fAlpha) \
-MACRO_START \
-{ \
- (hierarchy)->keyFrameBlendCB((out), (in1), (in2), (fAlpha)); \
-} \
-MACRO_STOP
+#define RpHAnimHierarchySetCurrentAnimTimeMacro(hierarchy,time)\
+ RtAnimInterpolatorSetCurrentTime((hierarchy)->currentAnim,time)
-#define RpHAnimFrameAddTogetherMacro(hierarchy, out, in1, in2) \
-MACRO_START \
-{ \
- (hierarchy)->keyFrameAddCB((out), (in1), (in2)); \
-} \
-MACRO_STOP
+#define RpHAnimHierarchyAddAnimTimeMacro(hierarchy,time)\
+ RtAnimInterpolatorAddAnimTime((hierarchy)->currentAnim,time)
-#ifdef RWDEBUG
-void
-RpHAnimFrameInterpolate(RpHAnimHierarchy *hierarchy,
- void *out, void *in1,
- void *in2, RwReal time);
+#define RpHAnimHierarchySubAnimTimeMacro(hierarchy,time)\
+ RtAnimInterpolatorSubAnimTime((hierarchy)->currentAnim,time)
-void
-RpHAnimFrameBlend(RpHAnimHierarchy *hierarchy,
- void *out,
- void *in1,
- void *in2,
- RwReal alpha);
+#define RpHAnimHierarchySetKeyFrameCallBacksMacro(hierarchy,keyFrameTypeID) \
+ RtAnimInterpolatorSetKeyFrameCallBacks((hierarchy)->currentAnim,\
+ keyFrameTypeID)
-void
-RpHAnimFrameToMatrix(RpHAnimHierarchy *hierarchy,
- RwMatrix *matrix, void *iFrame);
+#define RpHAnimHierarchyBlendMacro(outHierarchy,inHierarchy1,inHierarchy2,alpha)\
+ RtAnimInterpolatorBlend((outHierarchy)->currentAnim,\
+ (inHierarchy1)->currentAnim,\
+ (inHierarchy2)->currentAnim,\
+ alpha)
-void
-RpHAnimFrameAddTogether(RpHAnimHierarchy *hierarchy,
- void *out, void *in1, void *in2);
+#define RpHAnimHierarchyAddTogetherMacro(outHierarchy,inHierarchy1,inHierarchy2)\
+ RtAnimInterpolatorAddTogether((outHierarchy)->currentAnim,\
+ (inHierarchy1)->currentAnim,\
+ (inHierarchy2)->currentAnim)
-#else /* RWDEBUG */
-#define RpHAnimFrameToMatrix(hierarchy, matrix, iFrame) \
- RpHAnimFrameToMatrixMacro(hierarchy, matrix, iFrame)
+#define RpHAnimHierarchySetAnimCallBackMacro(hierarchy,callBack,time,data)\
+ RtAnimInterpolatorSetAnimCallBack((hierarchy)->currentAnim,callBack,time,data)
-#define RpHAnimFrameInterpolate(hierarchy, out, in1, in2, time) \
- RpHAnimFrameInterpolateMacro(hierarchy, out, in1, in2, time)
+#define RpHAnimHierarchySetAnimLoopCallBackMacro(hierarchy,callBack,data)\
+ RtAnimInterpolatorSetAnimLoopCallBack((hierarchy)->currentAnim,callBack,data)
-#define RpHAnimFrameBlend(hierarchy, out, in1, in2, alpha) \
- RpHAnimFrameBlendMacro(hierarchy, out, in1, in2, alpha)
+#define RpHAnimHierarchyBlendSubHierarchyMacro(outHierarchy,inHierarchy1,inHierarchy2,alpha)\
+ RtAnimInterpolatorBlendSubInterpolator((outHierarchy)->currentAnim,(inHierarchy1)->currentAnim,(inHierarchy2)->currentAnim,alpha)
-#define RpHAnimFrameAddTogether(hierarchy, out, in1, in2) \
- RpHAnimFrameAddTogetherMacro(hierarchy, out, in1, in2)
+#define RpHAnimHierarchyAddSubHierarchyMacro(outHierarchy,mainHierarchy,subHierarchy)\
+ RtAnimInterpolatorAddSubInterpolator((outHierarchy)->currentAnim,(mainHierarchy)->currentAnim,(subHierarchy)->currentAnim)
-#endif /* RWDEBUG */
-
-/* Standard keyframe functions */
+#define RpHAnimHierarchyCopyMacro(outHierarchy,inHierarchy)\
+ RtAnimInterpolatorCopy((outHierarchy)->currentAnim,(inHierarchy)->currentAnim)
-extern void
-RpHAnimStdKeyFrameToMatrix(RwMatrix *matrix,
- void * voidIFrame);
-extern void
-RpHAnimStdKeyFrameBlend(void *voidOut,
- void *voidIn1,
- void *voidIn2,
- RwReal alpha);
-extern void
-RpHAnimStdKeyFrameInterpolate(void *voidOut,
- void *voidIn1,
- void *voidIn2,
- RwReal time);
+#ifdef RWDEBUG
+extern RwBool
+RpHAnimHierarchySetCurrentAnim(RpHAnimHierarchy *hierarchy,
+ RtAnimAnimation *anim);
-extern void
-RpHAnimStdKeyFrameAdd(void *voidOut,
- void *voidIn1,
- void *voidIn2);
+extern RtAnimAnimation *
+RpHAnimHierarchyGetCurrentAnim(RpHAnimHierarchy *hierarchy);
-extern void
-RpHAnimStdKeyFrameMulRecip(void *voidFrame,
- void *voidStart);
+extern RwBool
+RpHAnimHierarchySetCurrentAnimTime(RpHAnimHierarchy *hierarchy,
+ RwReal time);
-extern RpHAnimAnimation *
-RpHAnimStdKeyFrameStreamRead(RwStream *stream,
- RpHAnimAnimation *animation);
+extern RwBool
+RpHAnimHierarchyAddAnimTime(RpHAnimHierarchy *hierarchy,
+ RwReal time);
extern RwBool
-RpHAnimStdKeyFrameStreamWrite(RpHAnimAnimation *animation,
- RwStream *stream);
+RpHAnimHierarchySubAnimTime(RpHAnimHierarchy *hierarchy,
+ RwReal time);
-extern RwInt32
-RpHAnimStdKeyFrameStreamGetSize(RpHAnimAnimation *animation);
+extern RwBool
+RpHAnimHierarchySetKeyFrameCallBacks(RpHAnimHierarchy *hierarchy,
+ RwInt32 keyFrameTypeID);
-/* Hierarchy blending/combination functions */
+extern void
+RpHAnimHierarchySetAnimCallBack(RpHAnimHierarchy *hierarchy,
+ RtAnimCallBack callBack,
+ RwReal time,
+ void *data);
extern RwBool
RpHAnimHierarchyBlend(RpHAnimHierarchy *outHierarchy,
RpHAnimHierarchy *inHierarchy1,
RpHAnimHierarchy *inHierarchy2,
RwReal alpha);
+
extern RwBool
RpHAnimHierarchyAddTogether(RpHAnimHierarchy *outHierarchy,
RpHAnimHierarchy *inHierarchy1,
RpHAnimHierarchy *inHierarchy2);
+extern void
+RpHAnimHierarchySetAnimLoopCallBack(RpHAnimHierarchy *hierarchy,
+ RtAnimCallBack callBack,
+ void *data);
extern RwBool
RpHAnimHierarchyBlendSubHierarchy(RpHAnimHierarchy *outHierarchy,
- RpHAnimHierarchy *inHierarchy1,
- RpHAnimHierarchy *inHierarchy2,
- RwReal alpha);
+ RpHAnimHierarchy *inHierarchy1,
+ RpHAnimHierarchy *inHierarchy2,
+ RwReal alpha);
extern RwBool
RpHAnimHierarchyAddSubHierarchy(RpHAnimHierarchy *outHierarchy,
- RpHAnimHierarchy *mainHierarchy,
- RpHAnimHierarchy *subHierarchy);
-
+ RpHAnimHierarchy *mainHierarchy1,
+ RpHAnimHierarchy *subHierarchy2);
extern RwBool
RpHAnimHierarchyCopy(RpHAnimHierarchy *outHierarchy,
RpHAnimHierarchy *inHierarchy);
-/* Access to RwFrame ID's */
+#else
-extern RwBool
-RpHAnimFrameSetID(RwFrame *frame,
- RwInt32 id);
+#define RpHAnimHierarchySetCurrentAnim(hierarchy,anim) \
+ RpHAnimHierarchySetCurrentAnimMacro((hierarchy),(anim))
-extern RwInt32
-RpHAnimFrameGetID(RwFrame *frame);
+#define RpHAnimHierarchyGetCurrentAnim(hierarchy) \
+ RpHAnimHierarchyGetCurrentAnimMacro((hierarchy))
+
+#define RpHAnimHierarchySetCurrentAnimTime(hierarchy,time) \
+ RpHAnimHierarchySetCurrentAnimTimeMacro((hierarchy),(time))
+
+#define RpHAnimHierarchyAddAnimTime(hierarchy,time) \
+ RpHAnimHierarchyAddAnimTimeMacro((hierarchy),(time))
+
+#define RpHAnimHierarchySubAnimTime(hierarchy,time) \
+ RpHAnimHierarchySubAnimTimeMacro((hierarchy),(time))
+
+#define RpHAnimHierarchySetKeyFrameCallBacks(hierarchy,keyFrameTypeID) \
+ RpHAnimHierarchySetKeyFrameCallBacksMacro((hierarchy),(keyFrameTypeID))
+
+#define RpHAnimHierarchyBlend(outHierarchy,inHierarchy1,inHierarchy2,alpha) \
+ RpHAnimHierarchyBlendMacro((outHierarchy),(inHierarchy1),(inHierarchy2),(alpha))
+
+#define RpHAnimHierarchyAddTogether(outHierarchy,inHierarchy1,inHierarchy2) \
+ RpHAnimHierarchyAddTogetherMacro((outHierarchy),(inHierarchy1),(inHierarchy2))
+
+#define RpHAnimHierarchySetAnimCallBack(hierarchy,callBack,time,data)\
+ RpHAnimHierarchySetAnimCallBackMacro((hierarchy),(callBack),(time),(data))
+
+#define RpHAnimHierarchySetAnimLoopCallBack(hierarchy,callBack,data)\
+ RpHAnimHierarchySetAnimLoopCallBackMacro((hierarchy),(callBack),(data))
+
+#define RpHAnimHierarchyBlendSubHierarchy(outHierarchy,inHierarchy1,inHierarchy2,alpha)\
+ RpHAnimHierarchyBlendSubHierarchyMacro((outHierarchy),(inHierarchy1),(inHierarchy2),(alpha))
+
+#define RpHAnimHierarchyAddSubHierarchy(outHierarchy,mainHierarchy,subHierarchy)\
+ RpHAnimHierarchyAddSubHierarchyMacro((outHierarchy),(mainHierarchy),(subHierarchy))
+
+#define RpHAnimHierarchyCopy(outHierarchy,inHierarchy)\
+ RpHAnimHierarchyCopyMacro((outHierarchy),(inHierarchy))
+
+#endif /* RWDEBUG */
#ifdef __cplusplus
}
#endif /* __cplusplus */
+/* Legacy TypeDef */
+
+
+typedef RtAnimAnimation RpHAnimAnimation;
+typedef RpHAnimKeyFrame RpHAnimStdKeyFrame;
+
+/* Legacy Macros */
+
+
+/* Animations */
+
+
+#define RpHAnimAnimationCreate(typeID,numFrames,flags,duration)\
+ RtAnimAnimationCreate((typeID),(numFrames),(flags),(duration))
+
+
+#define RpHAnimAnimationDestroy(animation)\
+ RtAnimAnimationDestroy((animation))
+
+#define RpHAnimAnimationGetTypeID(animation)\
+ RtAnimAnimationGetTypeID((animation))
+
+
+#define RpHAnimAnimationRead(filename)\
+ RtAnimAnimationRead((filename))
+
+
+#define RpHAnimAnimationWrite(animation,filename)\
+ RtAnimAnimationWrite((animation),(filename))
+
+
+#define RpHAnimAnimationStreamRead(stream)\
+ RtAnimAnimationStreamRead((stream))
+
+
+#define RpHAnimAnimationStreamWrite(animation,stream)\
+ RtAnimAnimationStreamWrite((animation),(stream))
+
+
+#define RpHAnimAnimationStreamGetSize(animation)\
+ RtAnimAnimationStreamGetSize((animation))
+
+
+#define RpHAnimAnimationMakeDelta(animation,numNodes,time)\
+ RtAnimAnimationMakeDelta((animation),(numNodes),(time))
+
+
+/* Animation Interpolator */
+
+#define RpHAnimHierarchyStdKeyFrameAddAnimTime(hierarchy,time)\
+ RpHAnimHierarchyHAnimKeyFrameAddAnimTime((hierarchy),(time))
+
+#define RpHAnimHierarchyHAnimKeyFrameAddAnimTime(hierarchy,time)\
+ RpHAnimHierarchyAddAnimTime((hierarchy),(time))
#endif /* RPHANIM_H */