2019-05-18 12:39:39 +02:00
|
|
|
/******************************************
|
|
|
|
* *
|
|
|
|
* RenderWare(TM) Graphics Library *
|
|
|
|
* *
|
|
|
|
******************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file is a product of Criterion Software Ltd.
|
|
|
|
*
|
|
|
|
* This file is provided as is with no warranties of any kind and is
|
|
|
|
* provided without any obligation on Criterion Software Ltd.
|
|
|
|
* or Canon Inc. to assist in its use or modification.
|
|
|
|
*
|
|
|
|
* Criterion Software Ltd. and Canon Inc. will not, under any
|
|
|
|
* circumstances, be liable for any lost revenue or other damages
|
|
|
|
* arising from the use of this file.
|
|
|
|
*
|
|
|
|
* Copyright (c) 1998. Criterion Software Ltd.
|
|
|
|
* All Rights Reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* *
|
|
|
|
* Module : rpanim.h *
|
|
|
|
* *
|
|
|
|
* Purpose : Hierarchical animation *
|
|
|
|
* *
|
|
|
|
**************************************************************************/
|
|
|
|
#ifndef RPHANIM_H
|
|
|
|
#define RPHANIM_H
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hierarchal animation plugin
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Doxygen plugin groups. */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \defgroup rphanim RpHAnim
|
2020-07-18 12:30:51 +02:00
|
|
|
* \ingroup objectframehanim
|
2019-05-18 12:39:39 +02:00
|
|
|
*
|
|
|
|
* Hierarchical Animation Plugin for RenderWare Graphics.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \defgroup rphanimchanges RpHAnim Changes
|
|
|
|
* \ingroup rphanim
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
Includes
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <rwcore.h>
|
|
|
|
#include <rpworld.h>
|
|
|
|
|
|
|
|
#include <rpcriter.h> /* Note: each vendor can choose their own method for
|
|
|
|
* allocation of unique ID's. This file defines
|
|
|
|
* the ID's used by Criterion.
|
|
|
|
*/
|
|
|
|
#include <rphanim.rpe> /* automatically generated header file */
|
|
|
|
#include <rtquat.h>
|
2020-07-18 12:30:51 +02:00
|
|
|
#include <rtanim.h>
|
2019-05-18 12:39:39 +02:00
|
|
|
|
|
|
|
#define rpHANIMSTREAMCURRENTVERSION 0x100
|
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#if (!defined(DOXYGEN))
|
|
|
|
|
2019-05-18 12:39:39 +02:00
|
|
|
typedef struct RpHAnimAtomicGlobalVars RpHAnimAtomicGlobalVars;
|
|
|
|
|
|
|
|
struct RpHAnimAtomicGlobalVars
|
|
|
|
{
|
2020-07-18 12:30:51 +02:00
|
|
|
RwInt32 engineOffset;
|
2019-05-18 12:39:39 +02:00
|
|
|
RwFreeList *HAnimFreeList;
|
|
|
|
};
|
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#endif /* (!defined(DOXYGEN)) */
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#define rpHANIMSTDKEYFRAMESIZE sizeof(RpHAnimKeyFrame)
|
2019-05-18 12:39:39 +02:00
|
|
|
#define rpHANIMSTDKEYFRAMETYPEID 0x1
|
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#define RpV3dInterpolate(o,a,s,b) \
|
2019-05-18 12:39:39 +02:00
|
|
|
MACRO_START \
|
|
|
|
{ \
|
|
|
|
(o)->x = (((a)->x) + ((s)) * (((b)->x) - ((a)->x))); \
|
|
|
|
(o)->y = (((a)->y) + ((s)) * (((b)->y) - ((a)->y))); \
|
|
|
|
(o)->z = (((a)->z) + ((s)) * (((b)->z) - ((a)->z))); \
|
|
|
|
} \
|
|
|
|
MACRO_STOP
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \ingroup rphanim
|
2020-07-18 12:30:51 +02:00
|
|
|
* \ref RpHAnimKeyFrame
|
|
|
|
* typedef for struct RpHAnimKeyFrame. Based on \ref RtAnimKeyFrameHeader.
|
2019-05-18 12:39:39 +02:00
|
|
|
*/
|
2020-07-18 12:30:51 +02:00
|
|
|
typedef struct RpHAnimKeyFrame RpHAnimKeyFrame;
|
2019-05-18 12:39:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \ingroup rphanim
|
2020-07-18 12:30:51 +02:00
|
|
|
* \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.
|
2019-05-18 12:39:39 +02:00
|
|
|
*/
|
2020-07-18 12:30:51 +02:00
|
|
|
struct RpHAnimKeyFrame
|
2019-05-18 12:39:39 +02:00
|
|
|
{
|
2020-07-18 12:30:51 +02:00
|
|
|
RpHAnimKeyFrame *prevFrame; /**< Pointer to the previous keyframe */
|
|
|
|
RwReal time; /**< Time at keyframe */
|
|
|
|
RtQuat q; /**< Quaternion rotation at keyframe */
|
|
|
|
RwV3d t; /**< Translation at keyframe */
|
2019-05-18 12:39:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \ingroup rphanim
|
2020-07-18 12:30:51 +02:00
|
|
|
* \ref RpHAnimInterpFrame
|
|
|
|
* typedef for struct RpHAnimInterpFrame. Based on \ref RtAnimInterpFrameHeader.
|
2019-05-18 12:39:39 +02:00
|
|
|
*/
|
2020-07-18 12:30:51 +02:00
|
|
|
typedef struct RpHAnimInterpFrame RpHAnimInterpFrame;
|
2019-05-18 12:39:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \ingroup rphanim
|
2020-07-18 12:30:51 +02:00
|
|
|
* \struct RpHAnimInterpFrame
|
|
|
|
* A structure representing an interpolated keyframe. The initial part of the
|
|
|
|
* structure matches \ref RtAnimInterpFrameHeader.
|
2019-05-18 12:39:39 +02:00
|
|
|
*/
|
2020-07-18 12:30:51 +02:00
|
|
|
struct RpHAnimInterpFrame
|
2019-05-18 12:39:39 +02:00
|
|
|
{
|
2020-07-18 12:30:51 +02:00
|
|
|
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 */
|
2019-05-18 12:39:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \ingroup rphanim
|
2020-07-18 12:30:51 +02:00
|
|
|
* \ref RpHAnimHierarchy typedef for struct RpHAnimHierarchy
|
2019-05-18 12:39:39 +02:00
|
|
|
*/
|
2020-07-18 12:30:51 +02:00
|
|
|
typedef struct RpHAnimHierarchy RpHAnimHierarchy;
|
2019-05-18 12:39:39 +02:00
|
|
|
|
|
|
|
/* Flags for FrameInfos */
|
|
|
|
|
|
|
|
#define rpHANIMPOPPARENTMATRIX 0x01
|
|
|
|
#define rpHANIMPUSHPARENTMATRIX 0x02
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \ingroup rphanim
|
|
|
|
* \ref RpHAnimNodeInfo
|
|
|
|
* typedef for struct RpHAnimNodeInfo
|
|
|
|
*/
|
|
|
|
typedef struct RpHAnimNodeInfo RpHAnimNodeInfo;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \ingroup rphanim
|
|
|
|
* \struct RpHAnimNodeInfo
|
|
|
|
*
|
2020-07-18 12:30:51 +02:00
|
|
|
* 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.
|
|
|
|
*
|
2019-05-18 12:39:39 +02:00
|
|
|
*/
|
|
|
|
struct RpHAnimNodeInfo
|
|
|
|
{
|
2020-07-18 12:30:51 +02:00
|
|
|
RwInt32 nodeID; /**< User defined ID for this node */
|
|
|
|
RwInt32 nodeIndex; /**< Array index of node */
|
2019-05-18 12:39:39 +02:00
|
|
|
RwInt32 flags; /**< Matrix push/pop flags */
|
|
|
|
RwFrame * pFrame; /**< Pointer to an attached RwFrame (see \ref RpHAnimHierarchyAttach) */
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \ingroup rphanim
|
|
|
|
* \ref RpHAnimHierarchyFlag defines type and update modes in HAnimHierarchies
|
|
|
|
*/
|
|
|
|
enum RpHAnimHierarchyFlag
|
|
|
|
{
|
|
|
|
/* creation flags */
|
|
|
|
rpHANIMHIERARCHYSUBHIERARCHY = 0x01, /**< This hierarchy is a sub-hierarchy */
|
|
|
|
rpHANIMHIERARCHYNOMATRICES = 0x02, /**< This hierarchy has no local matrices */
|
|
|
|
|
|
|
|
/* update flags */
|
|
|
|
rpHANIMHIERARCHYUPDATEMODELLINGMATRICES = 0x1000, /**< This hierarchy updates modeling matrices */
|
|
|
|
rpHANIMHIERARCHYUPDATELTMS = 0x2000, /**< This hierarchy updates LTMs */
|
|
|
|
rpHANIMHIERARCHYLOCALSPACEMATRICES = 0x4000, /**< This hierarchy calculates matrices in a space
|
|
|
|
relative to its root */
|
|
|
|
|
|
|
|
rpHANIMHIERARCHYFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
|
|
|
|
};
|
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
/*
|
2019-05-18 12:39:39 +02:00
|
|
|
* These flags are used to control the creation and
|
|
|
|
* update status of the hierarchy
|
|
|
|
*/
|
|
|
|
typedef enum RpHAnimHierarchyFlag RpHAnimHierarchyFlag;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \ingroup rphanim
|
|
|
|
* \struct RpHAnimHierarchy
|
2020-07-18 12:30:51 +02:00
|
|
|
* An RpHAnimHierarchy is used to "play back" an animation.
|
2019-05-18 12:39:39 +02:00
|
|
|
*
|
|
|
|
* The structure of a hierarchy is defined by an array
|
|
|
|
* of \ref RpHAnimNodeInfo structures.
|
|
|
|
*
|
|
|
|
* The hierarchy is defined by running through the node array in order,
|
|
|
|
* pushing the parent-node's matrix whenever a child is reached that has
|
|
|
|
* more than one sibling, and popping the parent matrix when a "leaf"
|
|
|
|
* node is encountered.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
struct RpHAnimHierarchy
|
|
|
|
{
|
|
|
|
RwInt32 flags; /**< Flags for the hierarchy */
|
|
|
|
RwInt32 numNodes; /**< Number of nodes in the hierarchy */
|
2020-07-18 12:30:51 +02:00
|
|
|
|
2019-05-18 12:39:39 +02:00
|
|
|
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 */
|
|
|
|
RpHAnimHierarchy *parentHierarchy; /**< Internal use */
|
|
|
|
RwInt32 rootParentOffset; /**< Internal use */
|
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
RtAnimInterpolator *currentAnim; /**< Internal use */
|
|
|
|
};
|
2019-05-18 12:39:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \ingroup rphanim
|
|
|
|
* \ref RpHAnimFrameExtension typedef for struct RpHAnimFrameExtension
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct RpHAnimFrameExtension RpHAnimFrameExtension;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \ingroup rphanim
|
|
|
|
* \struct RpHAnimFrameExtension
|
2020-07-18 12:30:51 +02:00
|
|
|
*
|
|
|
|
* Used to extend \ref RwFrame objects, and thus
|
|
|
|
* allow the mapping between animation hierarchy node ID and \ref RwFrame.
|
|
|
|
*
|
2019-05-18 12:39:39 +02:00
|
|
|
*/
|
|
|
|
struct RpHAnimFrameExtension
|
|
|
|
{
|
2020-07-18 12:30:51 +02:00
|
|
|
RwInt32 id; /**< ID given to this RwFrame (default of -1) */
|
2019-05-18 12:39:39 +02:00
|
|
|
RpHAnimHierarchy *hierarchy; /**< Pointer to Animation hierarchy attached to this RwFrame */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*--- Plugin API Functions ---*/
|
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#define RpHAnimHierarchySetFlagsMacro(hierarchy,_flags) \
|
2019-05-18 12:39:39 +02:00
|
|
|
MACRO_START \
|
|
|
|
{ \
|
2020-07-18 12:30:51 +02:00
|
|
|
(hierarchy)->flags = _flags; \
|
2019-05-18 12:39:39 +02:00
|
|
|
} \
|
|
|
|
MACRO_STOP
|
|
|
|
|
|
|
|
#define RpHAnimHierarchyGetFlagsMacro(hierarchy) \
|
|
|
|
((hierarchy)->flags)
|
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#define RpHAnimKeyFrameToMatrixMacro(_matrix,_voidIFrame) \
|
2019-05-18 12:39:39 +02:00
|
|
|
MACRO_START \
|
|
|
|
{ \
|
2020-07-18 12:30:51 +02:00
|
|
|
RpHAnimInterpFrame * iFrame = (RpHAnimInterpFrame *)(_voidIFrame); \
|
2019-05-18 12:39:39 +02:00
|
|
|
\
|
|
|
|
/* \
|
|
|
|
* RpHAnim uses the same types of quaternion as RtQuat \
|
|
|
|
* hence no conjugate call as in RpSkin \
|
|
|
|
*/ \
|
|
|
|
\
|
2020-07-18 12:30:51 +02:00
|
|
|
RtQuatUnitConvertToMatrix(&iFrame->q,(_matrix)); \
|
2019-05-18 12:39:39 +02:00
|
|
|
\
|
|
|
|
(_matrix)->pos.x = iFrame->t.x; \
|
|
|
|
(_matrix)->pos.y = iFrame->t.y; \
|
|
|
|
(_matrix)->pos.z = iFrame->t.z; \
|
|
|
|
} \
|
|
|
|
MACRO_STOP
|
|
|
|
|
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
|
2019-05-18 12:39:39 +02:00
|
|
|
#if (! defined(RWDEBUG))
|
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#define RpHAnimHierarchySetFlags(hierarchy,_flags) \
|
|
|
|
RpHAnimHierarchySetFlagsMacro(hierarchy,_flags)
|
2019-05-18 12:39:39 +02:00
|
|
|
|
|
|
|
#define RpHAnimHierarchyGetFlags(hierarchy) \
|
|
|
|
(RpHAnimHierarchyFlag)RpHAnimHierarchyGetFlagsMacro(hierarchy)
|
|
|
|
#endif /* (! defined(RWDEBUG)) */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
extern RpHAnimAtomicGlobalVars RpHAnimAtomicGlobals;
|
|
|
|
|
2019-05-18 12:39:39 +02:00
|
|
|
#if (defined(RWDEBUG))
|
|
|
|
|
|
|
|
extern RpHAnimHierarchy *
|
|
|
|
RpHAnimHierarchySetFlags(RpHAnimHierarchy *hierarchy,
|
|
|
|
RpHAnimHierarchyFlag flags);
|
|
|
|
|
|
|
|
extern RpHAnimHierarchyFlag
|
|
|
|
RpHAnimHierarchyGetFlags(RpHAnimHierarchy *hierarchy);
|
|
|
|
|
|
|
|
#endif /* (defined(RWDEBUG)) */
|
|
|
|
|
|
|
|
/* Animation hierarchy creation */
|
2020-07-18 12:30:51 +02:00
|
|
|
extern void
|
|
|
|
RpHAnimHierarchySetFreeListCreateParams(RwInt32 blockSize,RwInt32 numBlocksToPrealloc);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
|
|
|
extern RpHAnimHierarchy *
|
|
|
|
RpHAnimHierarchyCreate(RwInt32 numNodes,
|
|
|
|
RwUInt32 *nodeFlags,
|
|
|
|
RwInt32 *nodeIDs,
|
|
|
|
RpHAnimHierarchyFlag flags,
|
|
|
|
RwInt32 maxKeyFrameSize);
|
|
|
|
|
|
|
|
extern RpHAnimHierarchy *
|
|
|
|
RpHAnimHierarchyCreateFromHierarchy(RpHAnimHierarchy *hierarchy,
|
|
|
|
RpHAnimHierarchyFlag flags,
|
|
|
|
RwInt32 maxKeyFrameSize);
|
|
|
|
|
|
|
|
extern RpHAnimHierarchy *
|
|
|
|
RpHAnimHierarchyDestroy(RpHAnimHierarchy *hierarchy);
|
|
|
|
|
|
|
|
extern RpHAnimHierarchy *
|
|
|
|
RpHAnimHierarchyCreateSubHierarchy(RpHAnimHierarchy *parentHierarchy,
|
|
|
|
RwInt32 startNode,
|
|
|
|
RpHAnimHierarchyFlag flags,
|
|
|
|
RwInt32 maxKeyFrameSize);
|
|
|
|
|
|
|
|
extern RpHAnimHierarchy *
|
|
|
|
RpHAnimHierarchyAttach(RpHAnimHierarchy *hierarchy);
|
|
|
|
|
|
|
|
extern RpHAnimHierarchy *
|
|
|
|
RpHAnimHierarchyDetach(RpHAnimHierarchy *hierarchy);
|
|
|
|
|
|
|
|
extern RpHAnimHierarchy *
|
|
|
|
RpHAnimHierarchyAttachFrameIndex(RpHAnimHierarchy *hierarchy,
|
|
|
|
RwInt32 nodeIndex);
|
|
|
|
|
|
|
|
extern RpHAnimHierarchy *
|
|
|
|
RpHAnimHierarchyDetachFrameIndex(RpHAnimHierarchy *hierarchy,
|
|
|
|
RwInt32 nodeIndex);
|
|
|
|
|
|
|
|
extern RwBool
|
|
|
|
RpHAnimFrameSetHierarchy(RwFrame *frame,
|
|
|
|
RpHAnimHierarchy *hierarchy);
|
|
|
|
|
|
|
|
extern RpHAnimHierarchy *
|
|
|
|
RpHAnimFrameGetHierarchy(RwFrame *frame);
|
|
|
|
|
|
|
|
/* Macros for legacy support of old function names */
|
2020-07-18 12:30:51 +02:00
|
|
|
#define RpHAnimSetHierarchy(frame,hierarchy) \
|
|
|
|
RpHAnimFrameSetHierarchy(frame,hierarchy)
|
2019-05-18 12:39:39 +02:00
|
|
|
#define RpHAnimGetHierarchy(frame) RpHAnimFrameGetHierarchy(frame)
|
|
|
|
|
|
|
|
extern RwMatrix *
|
|
|
|
RpHAnimHierarchyGetMatrixArray(RpHAnimHierarchy *hierarchy);
|
|
|
|
|
|
|
|
extern RwBool
|
|
|
|
RpHAnimHierarchyUpdateMatrices(RpHAnimHierarchy *hierarchy);
|
|
|
|
|
|
|
|
/* Macro for legacy support of old function name */
|
|
|
|
#define RpHAnimUpdateHierarchyMatrices RpHAnimHierarchyUpdateMatrices
|
|
|
|
|
|
|
|
extern RwInt32
|
|
|
|
RpHAnimIDGetIndex(RpHAnimHierarchy *hierarchy,
|
|
|
|
RwInt32 ID);
|
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
/* Plugin support */
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
extern RwBool
|
|
|
|
RpHAnimPluginAttach(void);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
/* Hanim keyframe functions */
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
extern void
|
|
|
|
RpHAnimKeyFrameApply(void *matrix,
|
|
|
|
void *voidIFrame);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
extern void
|
|
|
|
RpHAnimKeyFrameBlend(void *voidOut,
|
|
|
|
void *voidIn1,
|
|
|
|
void *voidIn2,
|
|
|
|
RwReal alpha);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
extern void
|
|
|
|
RpHAnimKeyFrameInterpolate(void *voidOut,
|
|
|
|
void *voidIn1,
|
|
|
|
void *voidIn2,
|
|
|
|
RwReal time);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
extern void
|
|
|
|
RpHAnimKeyFrameAdd(void *voidOut,
|
|
|
|
void *voidIn1,
|
|
|
|
void *voidIn2);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
extern void
|
|
|
|
RpHAnimKeyFrameMulRecip(void *voidFrame,
|
|
|
|
void *voidStart);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
extern RtAnimAnimation *
|
|
|
|
RpHAnimKeyFrameStreamRead(RwStream *stream,
|
|
|
|
RtAnimAnimation *animation);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
|
|
|
extern RwBool
|
2020-07-18 12:30:51 +02:00
|
|
|
RpHAnimKeyFrameStreamWrite(RtAnimAnimation *animation,
|
|
|
|
RwStream *stream);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
|
|
|
extern RwInt32
|
2020-07-18 12:30:51 +02:00
|
|
|
RpHAnimKeyFrameStreamGetSize(RtAnimAnimation *animation);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
/* Access to RwFrame ID's */
|
2019-05-18 12:39:39 +02:00
|
|
|
|
|
|
|
extern RwBool
|
2020-07-18 12:30:51 +02:00
|
|
|
RpHAnimFrameSetID(RwFrame *frame,
|
|
|
|
RwInt32 id);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
extern RwInt32
|
|
|
|
RpHAnimFrameGetID(RwFrame *frame);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
/*
|
|
|
|
* Utility Functions
|
|
|
|
*/
|
|
|
|
#define RpHAnimHierarchySetCurrentAnimMacro(hierarchy,anim)\
|
|
|
|
RtAnimInterpolatorSetCurrentAnim((hierarchy)->currentAnim,anim)
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#define RpHAnimHierarchyGetCurrentAnimMacro(hierarchy)\
|
|
|
|
RtAnimInterpolatorGetCurrentAnim((hierarchy)->currentAnim)
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#define RpHAnimHierarchySetCurrentAnimTimeMacro(hierarchy,time)\
|
|
|
|
RtAnimInterpolatorSetCurrentTime((hierarchy)->currentAnim,time)
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#define RpHAnimHierarchyAddAnimTimeMacro(hierarchy,time)\
|
|
|
|
RtAnimInterpolatorAddAnimTime((hierarchy)->currentAnim,time)
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#define RpHAnimHierarchySubAnimTimeMacro(hierarchy,time)\
|
|
|
|
RtAnimInterpolatorSubAnimTime((hierarchy)->currentAnim,time)
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#define RpHAnimHierarchySetKeyFrameCallBacksMacro(hierarchy,keyFrameTypeID) \
|
|
|
|
RtAnimInterpolatorSetKeyFrameCallBacks((hierarchy)->currentAnim,\
|
|
|
|
keyFrameTypeID)
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#define RpHAnimHierarchyBlendMacro(outHierarchy,inHierarchy1,inHierarchy2,alpha)\
|
|
|
|
RtAnimInterpolatorBlend((outHierarchy)->currentAnim,\
|
|
|
|
(inHierarchy1)->currentAnim,\
|
|
|
|
(inHierarchy2)->currentAnim,\
|
|
|
|
alpha)
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#define RpHAnimHierarchyAddTogetherMacro(outHierarchy,inHierarchy1,inHierarchy2)\
|
|
|
|
RtAnimInterpolatorAddTogether((outHierarchy)->currentAnim,\
|
|
|
|
(inHierarchy1)->currentAnim,\
|
|
|
|
(inHierarchy2)->currentAnim)
|
2019-05-18 12:39:39 +02:00
|
|
|
|
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#define RpHAnimHierarchySetAnimCallBackMacro(hierarchy,callBack,time,data)\
|
|
|
|
RtAnimInterpolatorSetAnimCallBack((hierarchy)->currentAnim,callBack,time,data)
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#define RpHAnimHierarchySetAnimLoopCallBackMacro(hierarchy,callBack,data)\
|
|
|
|
RtAnimInterpolatorSetAnimLoopCallBack((hierarchy)->currentAnim,callBack,data)
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#define RpHAnimHierarchyBlendSubHierarchyMacro(outHierarchy,inHierarchy1,inHierarchy2,alpha)\
|
|
|
|
RtAnimInterpolatorBlendSubInterpolator((outHierarchy)->currentAnim,(inHierarchy1)->currentAnim,(inHierarchy2)->currentAnim,alpha)
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#define RpHAnimHierarchyAddSubHierarchyMacro(outHierarchy,mainHierarchy,subHierarchy)\
|
|
|
|
RtAnimInterpolatorAddSubInterpolator((outHierarchy)->currentAnim,(mainHierarchy)->currentAnim,(subHierarchy)->currentAnim)
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#define RpHAnimHierarchyCopyMacro(outHierarchy,inHierarchy)\
|
|
|
|
RtAnimInterpolatorCopy((outHierarchy)->currentAnim,(inHierarchy)->currentAnim)
|
2019-05-18 12:39:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#ifdef RWDEBUG
|
|
|
|
extern RwBool
|
|
|
|
RpHAnimHierarchySetCurrentAnim(RpHAnimHierarchy *hierarchy,
|
|
|
|
RtAnimAnimation *anim);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
extern RtAnimAnimation *
|
|
|
|
RpHAnimHierarchyGetCurrentAnim(RpHAnimHierarchy *hierarchy);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
extern RwBool
|
|
|
|
RpHAnimHierarchySetCurrentAnimTime(RpHAnimHierarchy *hierarchy,
|
|
|
|
RwReal time);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
extern RwBool
|
|
|
|
RpHAnimHierarchyAddAnimTime(RpHAnimHierarchy *hierarchy,
|
|
|
|
RwReal time);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
|
|
|
extern RwBool
|
2020-07-18 12:30:51 +02:00
|
|
|
RpHAnimHierarchySubAnimTime(RpHAnimHierarchy *hierarchy,
|
|
|
|
RwReal time);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
extern RwBool
|
|
|
|
RpHAnimHierarchySetKeyFrameCallBacks(RpHAnimHierarchy *hierarchy,
|
|
|
|
RwInt32 keyFrameTypeID);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
extern void
|
|
|
|
RpHAnimHierarchySetAnimCallBack(RpHAnimHierarchy *hierarchy,
|
|
|
|
RtAnimCallBack callBack,
|
|
|
|
RwReal time,
|
|
|
|
void *data);
|
2019-05-18 12:39:39 +02:00
|
|
|
|
|
|
|
extern RwBool
|
|
|
|
RpHAnimHierarchyBlend(RpHAnimHierarchy *outHierarchy,
|
|
|
|
RpHAnimHierarchy *inHierarchy1,
|
|
|
|
RpHAnimHierarchy *inHierarchy2,
|
|
|
|
RwReal alpha);
|
2020-07-18 12:30:51 +02:00
|
|
|
|
2019-05-18 12:39:39 +02:00
|
|
|
extern RwBool
|
|
|
|
RpHAnimHierarchyAddTogether(RpHAnimHierarchy *outHierarchy,
|
|
|
|
RpHAnimHierarchy *inHierarchy1,
|
|
|
|
RpHAnimHierarchy *inHierarchy2);
|
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
extern void
|
|
|
|
RpHAnimHierarchySetAnimLoopCallBack(RpHAnimHierarchy *hierarchy,
|
|
|
|
RtAnimCallBack callBack,
|
|
|
|
void *data);
|
2019-05-18 12:39:39 +02:00
|
|
|
extern RwBool
|
|
|
|
RpHAnimHierarchyBlendSubHierarchy(RpHAnimHierarchy *outHierarchy,
|
2020-07-18 12:30:51 +02:00
|
|
|
RpHAnimHierarchy *inHierarchy1,
|
|
|
|
RpHAnimHierarchy *inHierarchy2,
|
|
|
|
RwReal alpha);
|
2019-05-18 12:39:39 +02:00
|
|
|
extern RwBool
|
|
|
|
RpHAnimHierarchyAddSubHierarchy(RpHAnimHierarchy *outHierarchy,
|
2020-07-18 12:30:51 +02:00
|
|
|
RpHAnimHierarchy *mainHierarchy1,
|
|
|
|
RpHAnimHierarchy *subHierarchy2);
|
2019-05-18 12:39:39 +02:00
|
|
|
extern RwBool
|
|
|
|
RpHAnimHierarchyCopy(RpHAnimHierarchy *outHierarchy,
|
|
|
|
RpHAnimHierarchy *inHierarchy);
|
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#else
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#define RpHAnimHierarchySetCurrentAnim(hierarchy,anim) \
|
|
|
|
RpHAnimHierarchySetCurrentAnimMacro((hierarchy),(anim))
|
2019-05-18 12:39:39 +02:00
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
#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 */
|
2019-05-18 12:39:39 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2020-07-18 12:30:51 +02:00
|
|
|
/* 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))
|
2019-05-18 12:39:39 +02:00
|
|
|
|
|
|
|
#endif /* RPHANIM_H */
|