2019-10-06 08:29:17 +00:00
|
|
|
#version 330
|
2019-10-05 11:17:26 +00:00
|
|
|
|
|
|
|
//s_texture points to an indexed color texture
|
|
|
|
uniform sampler2D s_texture;
|
|
|
|
//s_palette is the palette texture
|
|
|
|
uniform sampler2D s_palette;
|
|
|
|
|
2019-10-06 08:29:17 +00:00
|
|
|
in vec2 v_texCoord;
|
2019-10-06 08:46:23 +00:00
|
|
|
out vec4 FragColor;
|
2019-10-05 11:17:26 +00:00
|
|
|
|
|
|
|
const float c_paletteScale = 255.0/256.0;
|
|
|
|
const float c_paletteOffset = 0.5/256.0;
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2020-01-26 14:44:08 +00:00
|
|
|
vec4 color = texture(s_texture, v_texCoord.xy);
|
2019-10-05 11:17:26 +00:00
|
|
|
color.r = c_paletteOffset + c_paletteScale*color.r;
|
2020-01-26 14:44:08 +00:00
|
|
|
color.rgb = texture(s_palette, color.rg).rgb;
|
2019-10-05 11:17:26 +00:00
|
|
|
|
2019-10-06 08:46:23 +00:00
|
|
|
FragColor = color;
|
2019-10-05 11:17:26 +00:00
|
|
|
}
|