# NNS_G3D_SBC_MAT

## Command Format

Offset (bytes) | Description
--- | ---
0 (when upper 3 bits are 000) | `NNS_G3D_SBC_MAT | NNS_G3D_SBCFLG_000`
0 (when upper 3 bits are 001) | `NNS_G3D_SBC_MAT | NNS_G3D_SBCFLG_001`
0 (when upper 3 bits are 010) | `NNS_G3D_SBC_MAT | NNS_G3D_SBCFLG_010`
1 | The material ID.

## Description

The `NNS_G3D_SBC_MAT` command gets the material information from the model and animation resources, then sends it to the geometry engine. By default, this command calls the `sbc.c` `NNSi_G3dFuncSbc_MAT` function. The following processes are performed inside this function:

1. Sets the `NNS_G3dMatAnmResult` pointer in `pMatAnmResult` member in the `NNS_G3dRS` structure.
2. Checks the timing `A` callback. The callback in this position is convenient when substituting the material calculation in the callback function. You can skip processing until the next callback by setting the `NNS_G3D_RSFLAG_SKIP` flag in the `NNS_G3dRS` structure in the callback function.
3. Sets the material information in `*pMatAnmResult` when the material information is static image / animation.
4. Checks the timing `B` callback. The callback in this position is convenient when processing the results of the material calculation in the callback function.
5. Sends the material information to the geometry engine.
6. Checks the timing `C` callback. The callback in this position is used when performing some sort of operation after this command finishes.

Timing for Calling a Callback Function | Usage
--- | ---
`NNS_G3D_SBC_CALLBACK_TIMING_A` | When you want a user program to do the material calculation.
`NNS_G3D_SBC_CALLBACK_TIMING_B` | When you want a user program to manipulate material calculation results.
`NNS_G3D_SBC_CALLBACK_TIMING_C` | When you want to enter some process after this command ends.

Option Flag | Operation
--- | ---
`NNS_G3D_SBCFLG_000` | Does not check the buffer that holds material calculation results. Does not buffer calculation results.
`NNS_G3D_SBCFLG_001` | Uses material calculation results if they are being buffered. If there is no buffer, calculates, but does not buffer the results.
`NNS_G3D_SBCFLG_010` | Uses material calculation results if they are being buffered. If there is no buffer, calculates, and buffers the results.

## See Also

## Revision History

10/14/2004 Revised description.

08/02/2004 Initial version.