gSPObjMatrix

gSPObjMatrix [Macro]

Function

gSPObjMatrix

Sets the 2D matrix for a rotating sprite

Syntax

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

Arguments

gdl
the pointer to the display list.
mtx
the pointer to the 2D matrix structure

Description

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.

Note

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

02/01/99 Entirely revised.