Slightly more accurate, likely going to have to change how paletted textures work

This commit is contained in:
2026-03-27 21:01:29 -05:00
parent 09c35f0aa6
commit 9474a68995

View File

@@ -9,7 +9,7 @@
#ifdef DUSK_OPENGL_LEGACY
shaderdefinition_t SHADER_UNLIT_DEFINITION = { 0 };
#elifdef DUSK_OPENGL_ES
#elif defined(DUSK_OPENGL_ES)
shaderdefinition_t SHADER_UNLIT_DEFINITION = {
.vert =
"#version 300 es\n"
@@ -38,7 +38,7 @@
"out vec4 FragColor;\n"
"void main() {\n"
" vec4 texColor = texture(u_Texture, v_TexCoord);\n"
" uint index = uint(floor(texColor.r * 255.0));\n"
" uint index = uint(clamp(texColor.r * 255.0 + 0.5, 0.0, 255.0));\n"
" uint palColor = u_Colors[index];\n"
" float r = float((palColor >> 24) & 0xFFu) / 255.0;\n"
" float g = float((palColor >> 16) & 0xFFu) / 255.0;\n"
@@ -84,7 +84,6 @@
" float a = float((palColor >> 0) & 0xFFu) / 255.0;\n"
" vec4 paletteColor = vec4(r, g, b, a);\n"
" FragColor = paletteColor;\n"
// " FragColor = paletteColor * v_Color;\n"
"}\n"
};
#endif