N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

## gSPObjMatrix [macro]

Sets the 2D matrix for a rotating sprite.

Syntax

    #include <ultra64.h> /* gs2dex.h */
    gSPObjMatrix(Gfx *gdl, uObjMtx *mtx)
    gsSPObjMatrix(uObjMtx *mtx)

Arguments

- gdl is the pointer to the graphics display list.

- mtx is the pointer to the 2D matrix structure

Explanation
Loads the 2D matrix parameters of the uObjMtx structure into the 2D matrix area in the RSP. This macro is normally used for a rotating sprite. It is used primarily in conjunction with gSPObjSprite.

Cautions
The uObjMtx structure is shown below:

    typedef struct {
      s32 A, B, C, D;   /* s15.16 */
      s16 X, Y;         /* s10.2 */
      u16 BaseScaleX;   /* u5.10 */
      u16 BaseScaleY;   /* u5.10 */
    } uObjMtx_t;
    typedef union {
      uObjMtx_t      m;
      long long int  force_structure_alignment;
    } uObjMtx;

Since the six matrix elements (A, B, C, D, X, Y) are the only ones needed for the rotation process, there is no need to transfer the entire 2D matrix. However, because data is transferred from main memory to the RSP's matrix area in 8-byte units, the BaseScaleX and BaseScaleY elements are also transferred to make the total data transfer size 24 bytes. For this reason, the values of BaseScaleX and BaseScaleY are always overwritten. If you are not going to use these parameters (if you are not immediately going to use g*SPObjRectangleR), we recommend assigning the default value 1024 (1.0 in s5.10 format) to BaseScaleX and BaseScaleY.

See Also
gSPObjSprite
gSPObjSubMatrix

Revision History
2/1/1999 Completely rewritten

Nintendo® Confidential Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.
Copyright © 1998-1999
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated March 1999