gSPInsertMatrix

gSPInsertMatrix [Macro]

Function

gSPInsertMatrix

Updates elements of the matrix (without performing multiplication)

Syntax

#include <ultra64.h>        /* gbi.h */
gSPInsertMatrix(Gfx *gdl, u32 where, u32 num)
gsSPInsertMatrix(         u32 where, u32 num)

Arguments

gdl
the display list pointer.
where
the two elements of the matrix to be changed:
<Integer part>
G_MWO_MATRIX_XX_XY_I (x scale and xy components)
G_MWO_MATRIX_XZ_XW_I (xz and xw components)
G_MWO_MATRIX_YX_YY_I (yx and y scale components)
G_MWO_MATRIX_YZ_YW_I (yz and yw components)
G_MWO_MATRIX_ZX_ZY_I (zx and zy components)
G_MWO_MATRIX_ZZ_ZW_I (z scale and zw components)
G_MWO_MATRIX_WX_WY_I (x and y translation components)
G_MWO_MATRIX_WZ_WW_I (z translation and w scale components)
<Fractional part>
G_MWO_MATRIX_XX_XY_F (x scale and xy components)
G_MWO_MATRIX_XZ_XW_F (xz and xw components)
G_MWO_MATRIX_YX_YY_F (yx and y scale components)
G_MWO_MATRIX_YZ_YW_F (yz and yw components)
G_MWO_MATRIX_ZX_ZY_F (zx and zy components)
G_MWO_MATRIX_ZZ_ZW_F (z scale and zw components)
G_MWO_MATRIX_WX_WY_F (x and y translation components)
G_MWO_MATRIX_WZ_WW_F (z translation w scale components)
num
the new values of the elements (32-bit integer: High-order 16 bits for the first element, and low-order 16 bits for the second element).

Description

This macro substitutes new values for two elements of the matrix used for vertex transformations (This matrix is the concatenated matrix of the model view and projection matrix). The internal format of the RSP matrix elements are modified in pairs. Please note that this matrix is the modified matrix of the model view matrix and projection matrix, and after this macro there is no matrix multiplication. Also, there is no matrix pushing or popping on the model view and projection matrix stacks, and the tops of the stacks are not modified. If gSPMatrix follows this macro, the matrix supplied by this macro will be destroyed, and it will have no effect on the RSP's new matrix (i.e., the result is the same as if this macro had not been used).

The elements that are to be replaced are specified by where. To completely modify the elements, both the integer part and fractional part of the matrix must be modified. For details, see gSPMatrix.

Since this is an advanced macro, before using it, you should have a good understanding of how matrices are used in the RSP microcode. For details, see gSPMatrix and Section 11.3, "Matrix State" in the N64 Online Programming Manual.

Note

This macro does not affect lighting. Therefore, if this macro is used when light is being used, the object will be rendered in accordance with the light of the RSP matrix state prior to this macro. The object's position and orientation, however, will be determined by the matrix resulting from this macro.

For information related to the matrix format, see gSPMatrix.

This macro is not supported by F3DEX2.

Example

The following instructions modify the x and y transformation terms of the matrix to 20.5 and 15.25, respectively:

gSPInsertMatrix(glistp++, G_MWO_MATRIX_WX_WY_I, 0x0014000f);
gSPInsertMatrix(glistp++, G_MWO_MATRIX_WX_WY_F, 0x80004000);

See Also

gSPForceMatrix, gSPMatrix

Revision History

02/01/99 Entirely revised.