Function
gSPModifyVertex
Modifies part of the vertex data after the data has been sent to 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
F3DEX F3DEX.NoN F3DLX F3DLX.NoN L3DEX |
0~31 |
F3DLX.Rej | 0~63 |
F3DLP.Rej | 0~79 |
F3DEX2 F3DEX2.NoN F3DLX2 F3DLX2.NoN L3DEX2 |
0~31 |
F3DEX2.Rej F3DLX2.Rej |
0~63 |
Description
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:
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.
Note
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 line 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.
Comment
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.0 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, and gSPVertex
Revision History
02/01/99 Entirely revised.