mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 12:32:34 +00:00
b34d7f9e08
It still looks like shit and only works on the modern render path but at least the basics are working.
31 lines
628 B
GLSL
31 lines
628 B
GLSL
in vec4 vTexCoord;
|
|
out vec4 FragColor;
|
|
|
|
vec4 TextureLookup(vec2 tex_coord)
|
|
{
|
|
if (uTextureMode == 1)
|
|
{
|
|
float index = texture(tex, tex_coord).x;
|
|
index = index * 256.0 + 0.5; // We only have 256 color palettes here.
|
|
return texture(texture2, vec2(index, 0.5));
|
|
}
|
|
else
|
|
{
|
|
return texture(tex, tex_coord);
|
|
}
|
|
}
|
|
|
|
void main()
|
|
{
|
|
if (uFixedColormap == 0)
|
|
{
|
|
FragColor = TextureLookup(vTexCoord.xy);
|
|
}
|
|
else
|
|
{
|
|
vec4 frag = TextureLookup(vTexCoord.xy);
|
|
float gray = dot(frag.rgb, vec3(0.4, 0.56, 0.14));
|
|
vec4 cm = uFixedColormapStart + gray * uFixedColormapRange;
|
|
FragColor = vec4(clamp(cm.rgb, 0.0, 1.0), 1.0);
|
|
}
|
|
}
|