From f64d5000b622e00a9c59265075eaa696e09493e3 Mon Sep 17 00:00:00 2001 From: Briggs Baltzell Date: Sat, 14 Mar 2026 17:47:46 -0500 Subject: GX Vertex Format Fixes (#938) * Update vertex attribute formats in `d_a_hookshot.cpp` for improved correctness. * Fix texture coordinate formats in `J3DSys.cpp` to use `GX_TEX_ST` for improved semantics. * Update vertex attribute formats in `JFWDisplay.cpp` for improved semantics. * Update texture coordinate vertex format in `J2DWindow.cpp` to use `GX_TEX_ST` for improved semantics. * Refactor `J2DWindow.cpp` for improved readability: update constructor initialization style, inline function arguments, and add spacing for clarity in GX rendering logic. * Update vertex attribute formats in `JUTResFont.cpp` for improved correctness and semantic clarity. * Update vertex attribute format in `d_kankyo_rain.cpp` to use `GX_POS_XYZ` for improved correctness. * Update texture coordinate formats in `d_ovlp_fade2.cpp` to use `GX_TEX_ST` for improved semantics. * Update texture coordinate format in `d_ovlp_fade4.cpp` to use `GX_TEX_ST` for improved semantics * Format vertex attribute and texture coordinate initialization in `d_a_goal_flag.cpp` for improved consistency and semantics. * Update vertex attribute and texture coordinate formats in `d_a_majuu_flag.cpp` for improved correctness and semantics. * Update vertex attribute and texture coordinate formats in `d_a_pirate_flag.cpp` for improved correctness and semantics. * Update vertex attribute and texture coordinate formats in `d_a_sail.cpp` for improved correctness and semantics. * Update vertex attribute and texture coordinate formats in `d_a_player_particle.inc` for improved correctness and semantics. * Update vertex attribute and texture coordinate formats in `d_a_player_particle.inc` for improved correctness and semantics. * Update vertex attribute and texture coordinate formats in `d_a_sea.cpp` for improved correctness and semantics. * Update vertex attribute and texture coordinate formats in `d_wood.cpp` for improved correctness and semantics. * Update vertex attribute and texture coordinate formats in `m_Do_ext.cpp` for improved correctness and semantics. * Undid formatting of `halftofull` array in `JUTResFont.cpp` * Update vertex attribute and texture coordinate formats in `d_tree.cpp` for improved correctness and semantics. * Update vertex attribute and texture coordinate formats in `d_a_bwdg.cpp` for improved correctness and semantics. --- src/m_Do/m_Do_ext.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/m_Do/m_Do_ext.cpp') diff --git a/src/m_Do/m_Do_ext.cpp b/src/m_Do/m_Do_ext.cpp index a2bae260..62fd0c23 100644 --- a/src/m_Do/m_Do_ext.cpp +++ b/src/m_Do/m_Do_ext.cpp @@ -1958,12 +1958,16 @@ void mDoExt_3DlineMat0_c::setMaterial() { GXSetNumIndStages(0); #endif dKy_setLight_again(); + GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_INDEX16); GXSetVtxDesc(GX_VA_NRM, GX_INDEX8); - GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); - GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_NRM, GX_CLR_RGB, GX_RGB8, 6); + + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_NRM, GX_NRM_XYZ, GX_S8, 6); + GXSetArray(GX_VA_NRM, l_normal, sizeof(*l_normal)); + if (mpTevStr) { dKy_GxFog_tevstr_set(mpTevStr); GXCallDisplayList(l_toonMatDL, 0x80); @@ -1971,6 +1975,7 @@ void mDoExt_3DlineMat0_c::setMaterial() { dKy_GxFog_set(); GXCallDisplayList(l_matDL, 0x80); } + GXLoadPosMtxImm(j3dSys.getViewMtx(), GX_PNMTX0); GXLoadNrmMtxImm(cMtx_getIdentity(), GX_PNMTX0); } @@ -2219,14 +2224,18 @@ void mDoExt_3DlineMat1_c::setMaterial() { GXSetNumIndStages(0); #endif dKy_setLight_again(); + GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_INDEX16); GXSetVtxDesc(GX_VA_NRM, GX_INDEX8); GXSetVtxDesc(GX_VA_TEX0, GX_INDEX16); - GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); - GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_NRM, GX_CLR_RGB, GX_RGB8, 6); - GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_F32, 0); + + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_NRM, GX_NRM_XYZ, GX_S8, 6); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0); + GXSetArray(GX_VA_NRM, l_normal, sizeof(*l_normal)); + if (mpTevStr) { dKy_GxFog_tevstr_set(mpTevStr); GXCallDisplayList(l_toonMat1DL, 0xA0); @@ -2234,6 +2243,7 @@ void mDoExt_3DlineMat1_c::setMaterial() { dKy_GxFog_set(); GXCallDisplayList(l_mat1DL, 0x80); } + GXLoadPosMtxImm(j3dSys.getViewMtx(), GX_PNMTX0); GXLoadNrmMtxImm(cMtx_getIdentity(), GX_PNMTX0); } -- cgit v1.2.3