#include<revolution/mtx.h> void MTXInitStack ( MtxStack* sPtr, u32 numMtx );
| sPtr | Pointer to a MtxStack structure. |
|---|---|
| numMtx | Number of matrices in the matrix stack referenced by sPtr. This must be the same value as that used immediately before calling MTXAllocStack. |
None.
This function is the companion to MTXAllocStack. After MTXAllocStack allocates memory to an MTXStack's stackBase pointer, MTXInitStack must be called to initialize the remaining members of MTXStack. MTXAllocStack and MTXInitStack are essentially two halves of the same function. MTXAllocStack was separated out and converted to a macro in mtx.h to expose its memory allocation call.
MTXInitStack sets sPtr->numMtx to numMtx and, to indicate an empty stack, sets sPtr->stackPtr to NULL.
Creation of a matrix stack must follow these steps:
a) Create an MtxStack structure either through a normal variable definition or by a call to a memory allocation routine. For example:
MtxStack sPtr; MtxStackPtr sPtr = OSAlloc( sizeof(MtxStack) ) ;
b) Use the MTXAllocStack (sPtr, numMtx) macro to allocate numMtx matrices to sPtr->stackBase.
c) Initialize the remaining members of the MtxStack structure with a call to MTXInitStack. numMtx must have the same value as that used for MTXAllocStack.
Mtx, MtxPtr, MtxStack, MtxStackPtr, MTXAllocStack, MTXFreeStack, OSAlloc, OSFree
2006/03/01 Initial version.
CONFIDENTIAL