# NNS_G3dRenderObjSetMatAnmBuffer

## Syntax

      #include <nnsys/g3d/kernel.h>

      void
      NNS_G3dRenderObjSetMatAnmBuffer(
          NNSG3dRenderObj*    pRenderObj,
          NNSG3dMatAnmResult* buf
      );

## Arguments

pRenderObj | Pointer to the `NNSG3dRenderObj` structure.
buf | Pointer to the record buffer for the material animation

## Return Values

None.

## Description

Attaches the record buffer, for storing and playing the calculation results of the material animation, to the rendering object. The record buffer to register must have a region of `NNS_G3D_RENDEROBJ_MATBUFFER_SIZE`(`pRenderObj->resMdl->info.numMat`) bytes or greater.
This buffer is for saving the calculation results of each material of the model to be rendered. Normally this information is not saved. However, by attaching the record buffer using the `NNS_G3dRenderObjSetMatAnmBuffer` function, you can save data in the record buffer and play animations from the record buffer. To save data in the record buffer, run the `NNS_G3dDraw` function after setting the `NNS_G3D_RENDEROBJ_FLAG_RECORD` flag using the `NNS_G3dRenderObjSetFlag` function. When playing data recorded in the record buffer, run the `NNS_G3dDraw` function after resetting the `NNS_G3D_RENDEROBJ_FLAG_RECORD` flag.
The following examples show some of the ways to use this function:

- To omit the material calculation of models to which the material animation is not applied.
- To perform material animation LOD (omit the animation of distant objects).
- To record all frames of the animation in the buffer and reduce the time needed to calculate the material animation.
- To omit the calculation of the second and subsequent models when making several identical models.

## See Also

`NNS_G3dRenderObjReleaseMatAnmBuffer, NNS_G3dRenderObjSetJntAnmBuffer`

## Revision History

2004/09/16 Added usage examples.
2004/08/02 Initial version.

CONFIDENTIAL