mirror of
https://github.com/zeldaret/tww.git
synced 2026-07-08 21:54:50 -04:00
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.
This commit is contained in:
@@ -178,9 +178,11 @@ void JUTResFont::setGX() {
|
||||
GXSetChanCtrl(GX_COLOR0A0, false, GX_SRC_REG, GX_SRC_VTX, 0, GX_DF_NONE, GX_AF_NONE);
|
||||
GXSetTevOp(GX_TEVSTAGE0, GX_MODULATE);
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_SET);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0);
|
||||
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 0xf);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_U16, 0xf);
|
||||
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT);
|
||||
@@ -209,9 +211,11 @@ void JUTResFont::setGX(JUtility::TColor col1, JUtility::TColor col2) {
|
||||
GXSetTevColorOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_SET);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0);
|
||||
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 15);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_U16, 0xf);
|
||||
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT);
|
||||
@@ -256,6 +260,7 @@ f32 JUTResFont::drawChar_scale(f32 posX, f32 posY, f32 scaleX, f32 scaleY, int c
|
||||
s32 v2 = ((mHeight + mpGlyphBlocks[field_0x66]->cellHeight) * 0x8000) / mpGlyphBlocks[field_0x66]->textureHeight;
|
||||
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
|
||||
// Bottom Left
|
||||
@@ -278,6 +283,8 @@ f32 JUTResFont::drawChar_scale(f32 posX, f32 posY, f32 scaleX, f32 scaleY, int c
|
||||
GXColor1u32(mColor3);
|
||||
GXTexCoord2s16(u1, v2);
|
||||
|
||||
GXEnd();
|
||||
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
|
||||
|
||||
return retval;
|
||||
@@ -361,7 +368,7 @@ int JUTResFont::getFontCode(int chr) const {
|
||||
ret = chr - map->startCode;
|
||||
break;
|
||||
} else if (map->mappingMethod == 2) {
|
||||
ret = *(&mpMapBlocks[i]->mLeading + ((chr - mpMapBlocks[i]->startCode)));
|
||||
ret = *(&mpMapBlocks[i]->mLeading + (chr - mpMapBlocks[i]->startCode));
|
||||
break;
|
||||
} else if (map->mappingMethod == 3) {
|
||||
u16* leading_temp = &map->mLeading;
|
||||
@@ -420,9 +427,16 @@ void JUTResFont::loadImage(int code, GXTexMapID id) {
|
||||
mHeight = cellRow * mpGlyphBlocks[i]->cellHeight;
|
||||
|
||||
if (pageIdx != mTexPageIdx || i != field_0x66) {
|
||||
GXInitTexObj(&mTexObj, &mpGlyphBlocks[i]->data[pageIdx * mpGlyphBlocks[i]->textureSize],
|
||||
mpGlyphBlocks[i]->textureWidth, mpGlyphBlocks[i]->textureHeight,
|
||||
(GXTexFmt)mpGlyphBlocks[i]->textureFormat, GX_CLAMP, GX_CLAMP, 0);
|
||||
GXInitTexObj(
|
||||
&mTexObj,
|
||||
&mpGlyphBlocks[i]->data[pageIdx * mpGlyphBlocks[i]->textureSize],
|
||||
mpGlyphBlocks[i]->textureWidth,
|
||||
mpGlyphBlocks[i]->textureHeight,
|
||||
(GXTexFmt)mpGlyphBlocks[i]->textureFormat,
|
||||
GX_CLAMP,
|
||||
GX_CLAMP,
|
||||
0
|
||||
);
|
||||
|
||||
GXInitTexObjLOD(&mTexObj, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, 0U, 0U, GX_ANISO_1);
|
||||
mTexPageIdx = pageIdx;
|
||||
|
||||
Reference in New Issue
Block a user