- started modernizing the shader.

This is one unbelievable piece of weird coding based on the 15 year old concept to avoid conditionals at all costs.
As a result the code is totally unreadable and no longer really portable to modern OpenGL.
This has to be done in small pieces.
This commit is contained in:
Christoph Oelckers 2019-10-06 10:07:09 +02:00
parent 126f670239
commit 8fd8d0858c
2 changed files with 15 additions and 6 deletions

View file

@ -1,7 +1,6 @@
#version 110
#version 120
//include an additional space here so that we can programmatically search for and disable this preprocessor definition easily
#define POLYMOST1_EXTENDED
#extension GL_ARB_uniform_buffer_object:enable
//s_texture points to an indexed color texture
uniform sampler2D s_texture;
@ -34,6 +33,9 @@ uniform float u_brightness;
uniform float u_useDetailMapping;
uniform float u_useGlowMapping;
uniform int u_tinteffect;
uniform vec3 u_tintcolor;
varying vec4 v_color;
varying float v_distance;
@ -46,6 +48,13 @@ const float c_two = 2.0;
const vec4 c_vec4_one = vec4(c_one);
const float c_wrapThreshold = 0.9;
layout(std140) uniform Palette {
vec4 palette[256];
};
layout(std140) uniform Palswap {
int palswap[256];
};
//===========================================================================
//

View file

@ -1,4 +1,4 @@
#version 110
#version 120
varying vec4 v_color;
varying float v_distance;
@ -17,8 +17,8 @@ void main()
eyeCoordPosition.xyz /= eyeCoordPosition.w;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
gl_TexCoord[0] = mix(gl_TexCoord[0].xyzw, gl_TexCoord[0].yxzw, u_usePalette);
gl_TexCoord[0] = gl_MultiTexCoord0;
//gl_TexCoord[0] = mix(gl_TexCoord[0].xyzw, gl_TexCoord[0].yxzw, u_usePalette); WTF is this???
gl_TexCoord[3] = gl_TextureMatrix[3] * gl_MultiTexCoord0;
gl_TexCoord[4] = gl_TextureMatrix[4] * gl_MultiTexCoord0;