# 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. This function internally performs the following processes:

1. Sets the `NNS_G3dMatAnmResult` pointer in `pMatAnmResult` member in the `NNS_G3dRS` structure.
2. Checks the timing `A` callback. Callbacks in this position are convenient when substituting the material calculation to 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 `*pMatAnmResult` in response to whether the material information is static image or animation.
4. Checks the timing `B` callback. Callbacks in this position are 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. Callbacks in this position are 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 insert 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

2004/10/14 Added description.
2004/08/02 Initial version.

CONFIDENTIAL