gSPModifyVertex [macro]
Modifies a vertex after it has been loaded in the RSP.
Syntax
#include <ultra64.h> /* gbi.h */
gSPModifyVertex(Gfx *gdl, u32 vtx, u32 where, u32 val)
gsSPModifyVertex(u32 vtx, u32 where, u32 val)
Arguments
- gdl is the pointer to the graphics display list
- vtx specifies which RSP vertex to modify
F3DEX
F3DEX.NoN
F3DLX
F3DLX.NoN
L3DEX |
0~31 |
F3DLX.Rej |
0~63 |
F3DLP.Rej |
0~79 |
For the F3DEX2 microcode group (F3DEX2, F3DLX2, F3DLP2, and L3DEX2), the values are as follows:
F3DEX2 F3DEX2.NoN F3DLX2 F3DLX2.NoN L3DEX2 |
0~31 |
F3DEX2.Rej F3DLX2.Rej |
0~63 |
- where specifies which part of vertex data to modify
G_MWO_POINT_RGBA (Color)
G_MWO_POINT_ST (Texture coordinate s, t values)
G_MWO_POINT_XYSCREEN (Screen coordinate x, y values)
G_MWO_POINT_ZSCREEN (Screen coordinate z value)
- val is the new value (32-bit integer) for the data part specified by where
Explanation
Modifies part of the vertex data after the data has been sent to the RSP by gSPVertex. The new value that is to be assigned to the part described by where is specified as follows in val:
- Color (G_MWO_POINT_RGBA):
- R, G, B and alpha (4 bytes each) from high-order byte to low-order byte.
-
- Texture coordinate s, t values (G_MWO_POINT_ST):
- High-order 16 bits are the s coordinate value. Low-order 16 bits are the t coordinate value (s10.5).
-
- Screen coordinate x, y values (G_MWO_POINT_XYSCREEN):
- High-order 16 bits are the x coordinate value. Low-order 16 bits are the y coordinate value (s13.2).
- * The upper-left corner of the screen is (0,0). Positive x values increase to the right, and positive y values increase downward.
-
- Screen coordinate z value (G_MWO_POINT_ZSCREEN):
- All 32 bits are the z-coordinate value (16.6, 0x00000000~0x03ff0000)
This macro is effective for use on a vertex that is shared by two or more triangles but has different properties depending on the triangle. For example, consider a vertex that is shared by two adjacent triangles, one of which is smooth-shaded from red to yellow, and the other which is smooth-shaded from green to cyan. In this case, you would first use gSPVertex to draw a triangle in which the vertex that is shared by both triangles is red and the other two vertices are yellow. Next, you could use this macro to change the color of the shared vertex to green for drawing the second triangle. The main use of this macro is to modify the texture coordinate of the shared vertex used by the first texture so it can be used by the second texture.
Notes
This is an advanced command. Be sure that you understand how vertices work in the RSP microcode before using this macro (see gSPVertex).
Since lighting is not performed after this macro is run, modifying the vertex color with G_MWO_POINT_RGBA actually modifies the output color, and not the normal value.
The s, t coordinates specified by this macro are not scaled by the texture scale value set by gSPTexture. These coordinates must be pre-scaled before they are transferred. For example, to use 1/2 (0x8000) as the texture scale, use a value that is one half of the value used by gSPVertex.
Cautions
This macro is faster than reloading a new vertex because no transformation or lighting is performed when it is used.
Example
When two triangles having different textures and texture coordinates share a vertex, specify the following code:
/* Load vertices with gSPVertex */
gSPVertex(...);
/* Load texture of triangle 1 */
gDPLoadTextureBlock(...);
/* Draw triangle 1 using vertex #3 */
gSP1Triangle(glistp++, 1, 2, 3, 0);
/* Change the value of vertex #3 to S=3.10 and T=2.5 */
gSPModifyVertex(glistp++, 3, G_MWO_POINT_ST, 0x00600050);
/* Load the texture of triangle 2 */
gDPLoadTextureBlock(...);
/* Draw triangle 2 using vertex #3 */
gSP1Triangle(glistp++, 1, 2, 3, 0);
See Also
gSP1Triangle
gSPTexture
gSPVertex
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
|