Modifies part of the vertex data after the data has been sent to the RSP
#include <ultra64.h> /* gbi.h */ gSPModifyVertex(Gfx *gdl, u32 vtx, u32 where, u32 val) gsSPModifyVertex( u32 vtx, u32 where, u32 val)
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.
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.
This macro is faster than reloading a new vertex because no transformation or lighting is performed when it is used.
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);
gSP1Triangle, gSPTexture, and gSPVertex
02/01/99 Entirely revised.