SBC and Callbacks

Description

The calculation for the rendering and animation is performed by processing the stream of the (user definable) SBC (structure byte code) multiple-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 for the 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 parent / child relationship of the node with the argument. Also designates the ID of the matrix stack stored by the position / vector matrix corresponding to the node. The joint animation is processed by this command.
NNS_G3D_SBC_BB Performs billboard conversion. Due to variations, the billboard converted matrix can be stored on the stack.
NNS_G3D_SBC_BBY Performs Y axis billboard conversion. Due to variations, the Y axis billboard converted matrix can be stored 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 the offset and size with the argument 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 instruction that performs texture matrix calculation for environment mapping.
NNS_G3D_SBC_PRJMAP SBC instruction that performs texture matrix calculation for projection mapping.

A maximum of three points (timings) that can be called back are configured in each command. One callback can be set to each instruction. 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 the drawing 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

10/11/2004 Revised version.

08/02/2004 Initial version.


CONFIDENTIAL