From 8fd8d0858cd85cbb100056f21d0cd6433f0b902e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 6 Oct 2019 10:07:09 +0200 Subject: [PATCH] - 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. --- wadsrc/static/demolition/shaders/glsl/polymost.fp | 15 ++++++++++++--- wadsrc/static/demolition/shaders/glsl/polymost.vp | 6 +++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/wadsrc/static/demolition/shaders/glsl/polymost.fp b/wadsrc/static/demolition/shaders/glsl/polymost.fp index 08d5fadcb..f1e830848 100644 --- a/wadsrc/static/demolition/shaders/glsl/polymost.fp +++ b/wadsrc/static/demolition/shaders/glsl/polymost.fp @@ -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]; +}; //=========================================================================== // diff --git a/wadsrc/static/demolition/shaders/glsl/polymost.vp b/wadsrc/static/demolition/shaders/glsl/polymost.vp index 57695a6a3..df5a9fcc3 100644 --- a/wadsrc/static/demolition/shaders/glsl/polymost.vp +++ b/wadsrc/static/demolition/shaders/glsl/polymost.vp @@ -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;