raze/wadsrc/static/demolition/shaders/glsl/polymost.vp
Christoph Oelckers 8fd8d0858c - 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.
2019-10-06 10:07:09 +02:00

30 lines
750 B
Text

#version 120
varying vec4 v_color;
varying float v_distance;
uniform float u_usePalette;
uniform mat4 u_rotMatrix;
const float c_zero = 0.0;
const float c_one = 1.0;
void main()
{
vec4 vertex = u_rotMatrix * gl_Vertex;
vec4 eyeCoordPosition = gl_ModelViewMatrix * vertex;
gl_Position = gl_ModelViewProjectionMatrix * vertex;
eyeCoordPosition.xyz /= eyeCoordPosition.w;
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;
gl_FogFragCoord = abs(eyeCoordPosition.z);
v_color = gl_Color;
v_distance = gl_Vertex.z;
}