NNSG3dRS Structure and Accessors
Description
The NNSG3dRS
structure is a structure for holding data corresponding to the state during rendering. This structure is referenced and changed when doing rendering and animation calculations; in other words, it maintains the data equivalent to the machine state. This structure is normally internally allocated to the stack region (DTCM) by the NNS_G3dDraw
function. When executing things such as callback functions or functions to process SBC commands, a pointer is passed to NNSG3dRS
as the first argument. While the NNS_G3dDraw
function is being executed, a pointer is also stored in the global variable NNSG3dRS
.
Normally, lack of knowledge about this structure will not cause any problems, but if you want to customize rendering operations in detail using a callback, the data kept in this structure will need to be referenced and changed. The table below contains descriptions of the accessors to the data members in the NNS_G3dRS
structure.
Accessor Functions
#include <nnsys/g3d/sbc.h> void NNS_G3dRSSetCallBack(NNSG3dRS* rs, NNSG3dSbcCallBackFunc func, u8 cmd, NNSG3dSbcCallBackTiming timing); |
Sets the callback corresponding to the SBC command cmd . For details on arguments, refer to the NNS_G3dRenderObjSetCallBack function. It is valid to have one callback for each cmd . If two or more callbacks are executed on the same cmd , the setting will be overwritten. To set multiple callbacks, use this function rather than calling the NNS_G3dRenderObjSetCallBack function multiple times. |
#include <nnsys/g3d/sbc.h> void NNS_G3dRSResetCallBack(NNSG3dRS* rs, u8 cmd); |
Disables the callback that is set for the SBC command cmd . |
#include <nnsys/g3d/sbc.h> NNSG3dRenderObj* NNS_G3dRSGetRenderObj(NNSG3dRS* rs); |
Obtains a pointer to the NNSG3dRenderObj structure. |
#include <nnsys/g3d/sbc.h> NNSG3dMatAnmResult* NNS_G3dRSGetMatAnmResult(NNSG3dRS* rs); |
Obtains a pointer to the NNSG3dMatAnmResult structure. It can be referenced or changed with the timing A and timing B callbacks of the NNS_G3D_SBC_MAT command. For all other cases, it is NULL . |
#include <nnsys/g3d/sbc.h> NNSG3dJntAnmResult* NNS_G3dRSGetJntAnmResult(NNSG3dRS* rs); |
Obtains a pointer to the NNSG3dJntAnmResult structure. It can be referenced or changed with the timing A and timing B callbacks of the NNS_G3D_SBC_NODEDESC command. For all other cases, it is NULL . |
#include <nnsys/g3d/sbc.h> NNSG3dVisAnmResult* NNS_G3dRSGetVisAnmResult(NNSG3dRS* rs); |
Obtains a pointer to the NNSG3dVisAnmResult structure. It can be referenced or changed with the timing A and timing B callbacks of the NNS_G3D_SBC_NODE command. For all other cases, it is NULL . |
#include <nnsys/g3d/sbc.h> u8* NNS_G3dRSGetSbcPtr(NNSG3dRS* rs); |
Obtains a pointer to the SBC command that is currently being executed. |
#include <nnsys/g3d/sbc.h> u8* NNS_G3dRSSetFlag(NNSG3dRS* rs, NNSG3dRSFlag flag); |
Specifies the NNSG3dRSFlag type flag that is defined in sbc.h and turns it ON. |
#include <nnsys/g3d/sbc.h> u8* NNS_G3dRSResetFlag(NNSG3dRS* rs, NNSG3dRSFlag flag); |
Specifies the NNSG3dRSFlag type flag that is defined in sbc.h and turns it OFF. |
#include <nnsys/g3d/sbc.h> int NNS_G3dRSGetCurrentMatID(const NNSG3dRS* rs); |
Returns either the ID of the material being calculated on by the current NNS_G3D_SBC_MAT command, or that set by the previously executed NNS_G3D_SBC_MAT command. The material ID is set by the SBC NNS_G3D_SBC_MAT command. It will be maintained until the next NNS_G3D_SBC_MAT command overrides it, or it is modified inside a callback function. This function will return -1 if no NNS_G3D_SBC_MAT command has been run, or if the previous NNS_G3D_SBC_MAT command's results are invalid. |
#include <nnsys/g3d/sbc.h> int NNS_G3dRSGetCurrentNodeID(const NNSG3dRS* rs); |
Returns either the ID of the node being calculated on by the current NNS_G3D_SBC_NODE command, or that set by the previously executed NNS_G3D_SBC_NODE command. The node ID is set by the SBC NNS_G3D_SBC_NODE command. It will be maintained until the next NNS_G3D_SBC_NODE command overrides it, or it is modified inside a callback function. This function will return -1 if no NNS_G3D_SBC_NODE command has been run, or if the previous NNS_G3D_SBC_NODE command's results are invalid. |
#include <nnsys/g3d/sbc.h> int NNS_G3dRSGetCurrentNodeDescID(const NNSG3dRS* rs); |
Returns either the ID of the node being calculated on by the current NNS_G3D_SBC_NODEDESC command, or that set by the previously executed NNS_G3D_SBC_NODEDESC command. The node ID is set by the SBC NNS_G3D_SBC_NODEDESC command. It will be maintained until the next NNS_G3D_SBC_NODEDESC command overrides it, or it is modified inside a callback function. This function will return -1 if no NNS_G3D_SBC_NODEDESC command has been run, or if the previous NNS_G3D_SBC_NODEDESC command's results are invalid. |
#include <nnsys/g3d/sbc.h> fx32 NNS_G3dRSGetPosScale(const NNSG3dRS* rs); |
Acquires a scale value for vertex coordinates that are cached in the NNSG3dRS structure. |
#include <nnsys/g3d/sbc.h> fx32 NNS_G3dRSGetInvPosScale(const NNSG3dRS* rs); |
Acquires the inverse scale value for vertex coordinates that are cached in the NNSG3dRS structure. |
Below is a description of the main values taken by the NNSG3dRSFlag
type.
NNS_G3D_RSFLAG_NODE_VISIBLE
|
This flag is set with the NNS_G3D_SBC_NODE command when the polygons belonging to the node are visible. |
NNS_G3D_RSFLAG_MAT_TRANSPARENT
|
This flag is set with the NNS_G3D_SBC_MAT command when the material is transparent. |
NNS_G3D_RSFLAG_CURRENT_NODE_VALID
|
This flag is set when a valid value is in currentNode . |
NNS_G3D_RSFLAG_CURRENT_MAT_VALID
|
This flag is set when a valid value is in currentMat . |
NNS_G3D_RSFLAG_RETURN
|
If this flag is set, execution of the NNS_G3dDraw function will finish after the end of the current SBC command. |
NNS_G3D_RSFLAG_SKIP
|
If this flag is set, then the processing will be skipped until the next callback point or the current command ends. |
See Also
Revision History
2004/10/11 Revised version.
2004/08/02 Initial version.
CONFIDENTIAL