1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-24 17:49:52 +01:00

fix palette bug

This commit is contained in:
FunkyFr3sh 2018-10-06 05:02:53 +02:00
parent 1b23e1d42b
commit a741fa9dca
2 changed files with 8 additions and 10 deletions

View File

@ -2,7 +2,7 @@
#define vxstr(a,b,c,d) str(a##.##b##.##c##.##d) #define vxstr(a,b,c,d) str(a##.##b##.##c##.##d)
#define str(s) #s #define str(s) #s
#define VERSION 1,2,0,1 #define VERSION 1,2,0,2
1 VERSIONINFO 1 VERSIONINFO
FILEVERSION VERSION FILEVERSION VERSION

View File

@ -2,25 +2,24 @@
static const char PassthroughVertShader110Src[] = static const char PassthroughVertShader110Src[] =
"#version 110\n" "#version 110\n"
"varying vec2 TexCoord0; \n" "varying vec2 TEX0; \n"
"\n" "\n"
"void main()\n" "void main()\n"
"{\n" "{\n"
" gl_Position = ftransform(); \n" " gl_Position = ftransform(); \n"
" TexCoord0 = gl_MultiTexCoord0.xy; \n" " TEX0 = gl_MultiTexCoord0.xy; \n"
"}\n"; "}\n";
static const char PaletteFragShader110Src[] = static const char PaletteFragShader110Src[] =
"#version 110\n" "#version 110\n"
"uniform sampler2D SurfaceTex; \n" "uniform sampler2D SurfaceTex; \n"
"uniform sampler2D PaletteTex; \n" "uniform sampler2D PaletteTex; \n"
"varying vec2 TexCoord0; \n" "varying vec2 TEX0; \n"
"\n" "\n"
"void main()\n" "void main()\n"
"{\n" "{\n"
" vec4 paletteIndex = texture2D(SurfaceTex, TexCoord0); \n" " vec4 pIndex = texture2D(SurfaceTex, TEX0); \n"
" vec4 outTexel = texture2D(PaletteTex, vec2(paletteIndex.r, 0)); \n" " gl_FragColor = texture2D(PaletteTex, vec2(pIndex.r * (255.0/256.0) + (0.5/256.0), 0)); \n"
" gl_FragColor = outTexel;\n"
"}\n"; "}\n";
@ -52,9 +51,8 @@ static const char PaletteFragShaderSrc[] =
"\n" "\n"
"void main()\n" "void main()\n"
"{\n" "{\n"
" vec4 paletteIndex = texture(SurfaceTex, TEX0.xy);\n" " vec4 pIndex = texture(SurfaceTex, TEX0.xy);\n"
" vec4 outTexel = texture(PaletteTex, vec2(paletteIndex.r, 0));\n" " FragColor = texture(PaletteTex, vec2(pIndex.r * (255.0/256.0) + (0.5/256.0), 0));\n"
" FragColor = outTexel;\n"
"}\n"; "}\n";