SBC and Callbacks

Description

The calculation for the rendering and animation is performed by processing the stream of multiple types of (user definable) SBC (structure byte code) byte code commands inside the model resource binary when NNS_G3dDraw executes. The SBC includes elements that: define the parent / child relationship of the joint, designate the material to be used, and designate the primitive to be rendered. Rendering and animation is performed by appropriately interpreting them at execution time.

Below is a table summarizing each of the SBC commands. The first byte of each command is split into 5-bit and 3-bit fields. The former corresponds to each SBC command, and its variations are designated by the latter. There are also cases in which each command has several arguments.

NNS_G3D_SBC_NOP Does nothing. g3dcvtr outputs this code to achieve 4-byte alignment at the end of the SBC command string.
NNS_G3D_SBC_RET Terminates the processing of the SBC command string.
NNS_G3D_SBC_NODE Designates which node is currently being processed with the node ID of the argument. Also designates whether the primitive belonging to that node is visible or invisible. The visibility animation is processed by this command.
NNS_G3D_SBC_MTX Loads the matrix from the designated location of the position / vector matrix stack in the geometry engine to the current matrix.
NNS_G3D_SBC_MAT Designates which material to use with the material ID of the argument. Also sends the corresponding material information to the geometry engine. The material animation is processed by this command.
NNS_G3D_SBC_SHP Designates which shape to use with the shape ID of the argument. Also sends the corresponding shape (the display list of the primitive) to the geometry engine.
NNS_G3D_SBC_NODEDESC Defines the node parent / child relationship with an argument. May also designate the ID of the matrix stack storing the Position/Vector matrix corresponding to the node. Joint animations are processed by this command.
NNS_G3D_SBC_BB Performs billboard conversion. Some variations of this command can store the billboard-converted matrix on the stack.
NNS_G3D_SBC_BBY Performs Y axis billboard conversion. Some variations of this command can store the Y axis billboard-converted matrix on the stack.
NNS_G3D_SBC_NODEMIX Calculates the matrix that is used in weighted envelope display. Stores the results in the matrix stack.
NNS_G3D_SBC_CALLDL Sends the display list that designated offset and size using arguments to the geometry engine. g3dcvtr does not output this SBC command.
NNS_G3D_SBC_POSSCALE This is the SBC command output by g3dcvtr to process the <model_info>::pos_scale designated by the .imd format of the NITRO intermediate file.
NNS_G3D_SBC_ENVMAP SBC command that performs texture matrix calculation for environment mapping.
NNS_G3D_SBC_PRJMAP SBC command that performs texture matrix calculation for projection mapping.

For each command, a maximum of three points in the process (timings) can be configured for callbacks. One callback can be set to each command. When you want to use only one callback, it can be designated by using the NNS_G3dRenderObjSetCallBack function. When you want to use multiple callbacks, multiple callbacks can be registered by registering the callback function that is executed immediately before rendering by using the NNS_G3dRenderObjSetInitFunc function, and using the NNS_G3dRSSetCallBack function in the callback function. Refer to the descriptions of each command for information about what sorts of applications are appropriate for each timing.

See Also

Revision History

2004/10/11 Revised version.
2004/08/02 Initial version.


CONFIDENTIAL