#include <nnsys/g3d/kernel.h>
typedef struct NNSG3dAnmObj_
{
fx32 frame;
fx32 ratio;
void* resAnm; // Pointer to the animation data block within the resource file
void* funcAnm; // Cast as function pointer to various animations. This comes with a default value, but can be changed
struct NNSG3dAnmObj_* next;
const NNSG3dResTex* resTex; // When texture block information is required (only for texture pattern animations)
u8 priority;
u8 numMapData;
u16 mapData[1]; // Becomes an array with number of elements equal to numMapData (NNSG3dAnmObjMapData)
}
NNSG3dAnmObj;
The NNSG3dAnmObj structure collects the data needed to fetch animation data from the animation resource. The NNSG3dAnmObj structure stores the following data. mapData is a variable-length array, so it is not correct to get its size with sizeof(NNSG3dAnmObj).
NNSG3dAnmObj Structure Members |
Description |
|---|---|
| frame | Animation frame count. |
| ratio | The animation blend ratio (used for motion blending). |
| resAnm | The pointer to a single animation resource. |
| funcAnm | The pointer to a function that computes animations |
| next | Specified with NNS_G3dRenderObjBindAnmObj or NNS_G3dRenderObjReleaseAnmObj. |
| resTex | Pointer to the texture resource. Used only for texture pattern animations. |
| priority | The order of priority for being registered to NNSG3dRenderObj. |
| numMapData | Length of the mapData array. |
| mapData | The table used to map the model resource material IDs/joint IDs to the animation resource index. |
The NNSG3dAnmObj structure can be used for the playback of animation by registering it in the NNSG3dRenderObj structure with the NNS_G3dRenderObjAddAnmObj function. The following processes are necessary to use NNSG3dAnmObj for animation playback:
NNS_G3dAllocAnmObj function. Note that the size of the structure will differ, depending on the number of material IDs and joint IDs for the model.
NNSG3dAnmObj structure using the NNS_G3dAnmObjInit function.
NNSG3dRenderObj using the NNS_G3dRenderObjAddAnmObj function.
NNS_G3dAnmObjSetBlendRatio function to set the blend ratio for the number of frames that will be played by the NNS_G3dAnmObjSetFrame function. (This is usually only done when multiple joint animations have been registered).
NNS_G3dDraw function.
NNS_G3dRenderObjRemoveAnmObj function to remove the animation object from NNSG3dRenderObj.
NNSG3dAnmObj is no longer being used, release the structure's region using the NNS_G3dFreeAnmObj function.
NNSG3dAnmObj cannot be used for animation playback if rendering is performed with the NNS_G3dDraw1Mat1Shp function.
2007/05/17 Added structure definition.
2004/10/12 Initial version.
CONFIDENTIAL