Test paletted stuff
Some checks failed
Build Dusk / run-tests (push) Failing after 26s
Build Dusk / build-linux (push) Failing after 25s
Build Dusk / build-psp (push) Failing after 18s
Build Dusk / build-gamecube (push) Failing after 18s
Build Dusk / build-wii (push) Failing after 18s

This commit is contained in:
2026-03-26 14:48:20 -05:00
parent 98947dea26
commit 407620387d
10 changed files with 138 additions and 33 deletions

View File

@@ -13,28 +13,39 @@
shaderdefinition_t SHADER_UNLIT_DEFINITION = {
.vert =
"#version 330 core\n"
"layout(location = 0) in vec3 aPos;\n"
"layout(location = 1) in vec2 aTexCoord;\n"
"layout(location = 2) in vec4 aColor;\n"
"layout(location = 0) in vec3 a_Pos;\n"
"layout(location = 1) in vec2 a_TexCoord;\n"
"layout(location = 2) in vec4 a_Color;\n"
"uniform mat4 u_Proj;\n"
"uniform mat4 u_View;\n"
"uniform mat4 u_Model;\n"
"out vec4 v_Color;\n"
"out vec2 v_TexCoord;\n"
"void main() {\n"
" gl_Position = u_Proj * u_View * u_Model * vec4(aPos, 1.0);\n"
" v_Color = aColor;\n"
" v_TexCoord = aTexCoord;\n"
" gl_Position = u_Proj * u_View * u_Model * vec4(a_Pos, 1.0);\n"
" v_Color = a_Color;\n"
" v_TexCoord = a_TexCoord;\n"
"}\n",
.frag =
"#version 330 core\n"
"uniform sampler2D u_Texture;\n"
"uniform uint u_Colors[256];\n"
"uniform int u_ColorCount;\n"
"in vec4 v_Color;\n"
"in vec2 v_TexCoord;\n"
"out vec4 FragColor;\n"
"void main() {\n"
" FragColor = texture(u_Texture, v_TexCoord) * v_Color;\n"
" vec4 texColor = texture(u_Texture, v_TexCoord);\n"
" uint index = uint(floor(texColor.r * 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"
" float b = float((palColor >> 8) & 0xFFu) / 255.0;\n"
" 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