al - Audio Library Functions gDP - DP GBI Macros gdSP - General GBI Macros gSP - SP GBI Macros gt - Turbo Microcode RDP gu - Graphics Utilities Math - Math Functions nuSys - NuSystem os - N64 Operating System sp - Sprite Library Functions uh - Host to Target IO 64DD - N64 Disk Drive
|
gSPModifyVertexFormat#include "gbi.h" gSPModifyVertex(Gfx *gdl, unsigned int vtx, unsigned int where, unsigned int val); gsSPModifyVertex(unsigned int vtx, unsigned int where, unsigned int val); gsSPNearClip(nc)Arguments
This is an advanced macro. You need a good understanding of how vertices work in the RSP microcode before you use this macro (refer to gSPVertex ). The range of vtx has been changed with as the vertex cache increased. Its range is now the same as that for gSPVertex. You can use this macro to modify certain sections of a vertex after it has been sent to the RSP (by the gSPVertex macro). This is useful for vertices that are shared between two or more triangles that must have different properties when associated with one triangle versus the other triangle. For example, you might have two adjacent triangles that both need smooth-shaded color, but one is smooth-shaded red-to-yellow and the other is smooth-shaded green-to-cyan. In this case, the vertex that is shared by both triangles is sent with red/yellow color by using the gSPVertex macro. The first triangle is drawn. Then, the gSPModifyVertex macro is used to change the color to green/cyan, and the second triangle is drawn. The primary use of the gSPModifyVertex macro is to modify the texture coordinate of a vertex so that a vertex that is shared by two triangles with different textures and different texture coordinate spaces can contain the texture coordinate for the first texture and then be modified to contain the texture coordinate for the second texture. It is faster to use the gSPModifyVertex macro than to send a new vertex macro with a different but similar vertex because no transformations or lighting are done to the vertex when you use the gSPModifyVertex macro. The where argument specifies which part of the vertex is to be modified. It can hold one of the following values:
Lighting is not performed after a gSPModifyVertex macro, so modifying the color of the vertex with G_MWO_POINT_RGBA is just that - modifying the actual color that will be output. It is not a modification of normal values. This means it cannot be used to update vertex normals for lighting. The S and T coordinates supplied in the gSPModifyVertex macro are never multiplied by the texture scale (from the gSPTexture macro), so you must pre-scale them before sending them. For example, if you want a texture scale of 1/2 (0x8000), make the S and T values sent with the gSPModifyVertex macro half the value of the equivalent values used with the gSPVertex macro. Example To share a vertex between two triangles with different textures and texture coordinates, use this code: /* load vertex by gSPVertex */ gSPVertex(...); /* load texture of triangle 1 */ gDPLoadTextureBlock(...); /* draw triangle 1 using vertex #3 */ gSP1Triangle(glistp++, 1,2,3,0); /* change a value of vertex 3 to S=3.0 and T=2.5 */ gSPModifyVertex(glistp++, 3, G_MWO_POINT_ST, 0x00600050); /* load texture of triangle 2 */ gDPLoadTextureBlock(...); /* draw triangle 2 using vertex #3 */ gSP1Triangle(glistp++, 1,2,3,0);See Also gSPVertex gSPTexture gSP1Triangle
|