Tweak MSAA font fix

This commit is contained in:
Agent X 2024-12-22 16:27:04 -05:00
parent f1e216649d
commit c519ecb76b
4 changed files with 11 additions and 11 deletions

View file

@ -16,7 +16,7 @@ static void djui_font_normal_render_char(char* c) {
u32 ty = index / 32;
extern ALIGNED8 const u8 texture_font_normal[];
djui_gfx_render_texture_tile(texture_font_normal, 256, 128, 32, tx * 8, ty * 16, 8, 16, false);
djui_gfx_render_texture_tile(texture_font_normal, 256, 128, 32, tx * 8, ty * 16, 8, 16, false, true);
}
static f32 djui_font_normal_char_width(char* c) {
@ -54,7 +54,7 @@ static void djui_font_title_render_char(char* c) {
u32 ty = index / 16;
extern ALIGNED8 const u8 texture_font_title[];
djui_gfx_render_texture_tile(texture_font_title, 1024, 512, 32, tx * 64, ty * 64, 64, 64, false);
djui_gfx_render_texture_tile(texture_font_title, 1024, 512, 32, tx * 64, ty * 64, 64, 64, false, true);
}
static f32 djui_font_title_char_width(char* text) {
@ -147,7 +147,7 @@ static void djui_font_aliased_render_char(char* c) {
u32 ty = index / 32;
extern ALIGNED8 const u8 texture_font_aliased[];
djui_gfx_render_texture_tile(texture_font_aliased, 512, 256, 32, tx * 16, ty * 32, 16, 32, false);
djui_gfx_render_texture_tile(texture_font_aliased, 512, 256, 32, tx * 16, ty * 32, 16, 32, false, true);
}
static f32 djui_font_aliased_char_width(char* c) {
@ -180,7 +180,7 @@ static void djui_font_custom_hud_render_char(char* c) {
u32 ty = index / 16;
extern ALIGNED8 const u8 texture_font_hud[];
djui_gfx_render_texture_tile(texture_font_hud, 512, 512, 32, tx * 32, ty * 32, 32, 32, false);
djui_gfx_render_texture_tile(texture_font_hud, 512, 512, 32, tx * 32, ty * 32, 32, 32, false, true);
}
static void djui_font_custom_hud_recolor_render_char(char* c) {
@ -193,7 +193,7 @@ static void djui_font_custom_hud_recolor_render_char(char* c) {
u32 ty = index / 16;
extern ALIGNED8 const u8 texture_font_hud_recolor[];
djui_gfx_render_texture_tile(texture_font_hud_recolor, 512, 512, 32, tx * 32, ty * 32, 32, 32, false);
djui_gfx_render_texture_tile(texture_font_hud_recolor, 512, 512, 32, tx * 32, ty * 32, 32, 32, false, true);
}
static f32 djui_font_custom_hud_char_width(char* text) {
@ -237,7 +237,7 @@ static void djui_font_special_render_char(char* c) {
u32 ty = index / 32;
extern ALIGNED8 const u8 texture_font_special[];
djui_gfx_render_texture_tile(texture_font_special, 256, 128, 32, tx * 8, ty * 16, 8, 16, false);
djui_gfx_render_texture_tile(texture_font_special, 256, 128, 32, tx * 8, ty * 16, 8, 16, false, true);
}
static f32 djui_font_special_char_width(char* c) {

View file

@ -113,7 +113,7 @@ void djui_gfx_render_texture(const u8* texture, u32 w, u32 h, u32 bitSize, bool
gSPDisplayList(gDisplayListHead++, dl_djui_image);
}
void djui_gfx_render_texture_tile(const u8* texture, u32 w, u32 h, u32 bitSize, u32 tileX, u32 tileY, u32 tileW, u32 tileH, bool filter) {
void djui_gfx_render_texture_tile(const u8* texture, u32 w, u32 h, u32 bitSize, u32 tileX, u32 tileY, u32 tileW, u32 tileH, bool filter, bool font) {
if (!gDisplayListHead) {
LOG_ERROR("Retrieved a null displaylist head");
return;
@ -131,8 +131,8 @@ void djui_gfx_render_texture_tile(const u8* texture, u32 w, u32 h, u32 bitSize,
}
f32 aspect = tileH ? ((f32)tileW / (f32)tileH) : 1;
f32 halfPxX = 1024.0f / (f32)w;
f32 halfPxY = 1024.0f / (f32)h;
f32 halfPxX = font && configWindow.msaa > 0 ? 1024.0f / (f32)w : 0;
f32 halfPxY = font && configWindow.msaa > 0 ? 1024.0f / (f32)h : 0;
// 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 * 2048.0f) / (f32)w - halfPxX, ((tileY + tileH) * 2048.0f) / (f32)h - halfPxY }, { 0xff, 0xff, 0xff, 0xff }}};
vtx[1] = (Vtx) {{{ 1 * aspect, -1, 0 }, 0, { ((tileX + tileW) * 2048.0f) / (f32)w - halfPxX, ((tileY + tileH) * 2048.0f) / (f32)h - halfPxY }, { 0xff, 0xff, 0xff, 0xff }}};

View file

@ -15,7 +15,7 @@ void djui_gfx_displaylist_end(void);
f32 djui_gfx_get_scale(void);
void djui_gfx_render_texture(const u8* texture, u32 w, u32 h, u32 bitSize, bool filter);
void djui_gfx_render_texture_tile(const u8* texture, u32 w, u32 h, u32 bitSize, u32 tileX, u32 tileY, u32 tileW, u32 tileH, bool filter);
void djui_gfx_render_texture_tile(const u8* texture, u32 w, u32 h, u32 bitSize, u32 tileX, u32 tileY, u32 tileW, u32 tileH, bool filter, bool font);
void djui_gfx_position_translate(f32* x, f32* y);
void djui_gfx_scale_translate(f32* width, f32* height);

View file

@ -487,7 +487,7 @@ void djui_hud_render_texture_tile_raw(const u8* texture, u32 bitSize, u32 width,
create_dl_scale_matrix(DJUI_MTX_NOPUSH, width * translatedW, height * translatedH, 1.0f);
// render
djui_gfx_render_texture_tile(texture, width, height, bitSize, tileX, tileY, tileW, tileH, sFilter);
djui_gfx_render_texture_tile(texture, width, height, bitSize, tileX, tileY, tileW, tileH, sFilter, false);
// pop
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);