Fixed text rendering again

This commit is contained in:
MysterD 2023-04-20 20:57:09 -07:00
parent 13cfebca7a
commit 370ab9894b
1 changed files with 4 additions and 4 deletions

View File

@ -105,10 +105,10 @@ void djui_gfx_render_texture_tile(const u8* texture, u32 w, u32 h, u32 bitSize,
Vtx *vtx = alloc_display_list(sizeof(Vtx) * 4);
f32 aspect = tileH ? ((f32)tileW / (f32)tileH) : 1;
// I don't know why adding 1 to all of the UVs seems to fix rendering, but it does...
vtx[0] = (Vtx) {{{ 0, -1, 0 }, 0, { ( tileX * 512) / w + 1, ((tileY + tileH) * 512) / h + 1 }, { 0xff, 0xff, 0xff, 0xff }}};
vtx[1] = (Vtx) {{{ 1 * aspect, -1, 0 }, 0, { ((tileX + tileW) * 512) / w + 1, ((tileY + tileH) * 512) / h + 1 }, { 0xff, 0xff, 0xff, 0xff }}};
vtx[2] = (Vtx) {{{ 1 * aspect, 0, 0 }, 0, { ((tileX + tileW) * 512) / w + 1, ( tileY * 512) / h + 1 }, { 0xff, 0xff, 0xff, 0xff }}};
vtx[3] = (Vtx) {{{ 0, 0, 0 }, 0, { ( tileX * 512) / w + 1, ( tileY * 512) / h + 1 }, { 0xff, 0xff, 0xff, 0xff }}};
vtx[0] = (Vtx) {{{ 0, -1, 0 }, 0, { ( tileX * 512) / w + 1, ((tileY + tileH) * 512) / h }, { 0xff, 0xff, 0xff, 0xff }}};
vtx[1] = (Vtx) {{{ 1 * aspect, -1, 0 }, 0, { ((tileX + tileW) * 512) / w + 1, ((tileY + tileH) * 512) / h }, { 0xff, 0xff, 0xff, 0xff }}};
vtx[2] = (Vtx) {{{ 1 * aspect, 0, 0 }, 0, { ((tileX + tileW) * 512) / w + 1, ( tileY * 512) / h }, { 0xff, 0xff, 0xff, 0xff }}};
vtx[3] = (Vtx) {{{ 0, 0, 0 }, 0, { ( tileX * 512) / w + 1, ( tileY * 512) / h }, { 0xff, 0xff, 0xff, 0xff }}};
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
gDPSetCombineMode(gDisplayListHead++, G_CC_FADEA, G_CC_FADEA);