olivieryuyu / N64-Microcode-

Testing - Phase 1
3 stars 0 forks source link

G_TRI1 #2

Open olivieryuyu opened 2 years ago

olivieryuyu commented 2 years ago

G_TRI1

Header of the command: 0x08

Function: as for FAST3D, this command generates a single triangle face (using the vertices v0, v1, and v2) in the internal vertex buffer loaded by the gSPVertex macro. The flag (0, 1, or 2) identifies which of the three vertices contains the normal or the color for the face (for flat shading).

This command, on the contrary of G_STRI1, does not pick up colors and texture coordinates in the related buffer stored in DMEM.

The colors and the textures coordinates of the vertex are the ones defined in the Vtx structure (colidx and stidx). They are picked up from in their related buffer when gSPVertex macro is performed and stored by default in the internal vertex buffer.

Vtx:

short           ob[3];          /* x, y, z */
unsigned char       colidx;         /* index in the colors buffer << 2 */ 
unsigned char       stidx;          /* index in the S&T buffer << 2 */

_Important note: if you do not intend to use GTRI1 command or the upcoming triangle strips command, those indexes will not be used so you don't have to bother much about them.

Related GBI macros:

gSP1Triangle(Gfx *gdl, v0, v1, v2, flag) gsSP1Triangle( v0, v1, v2, flag)

gSP2Triangles( gfx *gdl, v00, v01, v02, flag0, v10, v11, v12, flag1) gsSP2Triangles( s32 v00, v01, v02, flag0, v10, v11, v12, flag1)

They is exactly the same macro than in Fast3D. gSP2Triangles is actually emulated as it uses two times G_TRI1 command (G_TRI2 does not exist at microcode level).