Remove some fixed-function logic from the worldsurf glsl.

This commit is contained in:
Shpoike 2020-01-12 07:45:10 +00:00
parent e259d0db52
commit 598038b7f2
1 changed files with 10 additions and 6 deletions

View File

@ -840,12 +840,14 @@ void GLWorld_CreateShaders (void)
"attribute vec2 LMCoords;\n"
"\n"
"varying float FogFragCoord;\n"
"varying vec2 tc_tex;\n"
"varying vec2 tc_lm;\n"
"\n"
"void main()\n"
"{\n"
" gl_TexCoord[0] = vec4(TexCoords, 0.0, 0.0);\n"
" gl_TexCoord[1] = vec4(LMCoords, 0.0, 0.0);\n"
" gl_Position = gl_ModelViewProjectionMatrix * Vert;\n"
" tc_tex = TexCoords;\n"
" tc_lm = LMCoords;\n"
" gl_Position = gl_ModelViewProjectionMatrix * vec4(Vert, 1.0);\n"
" FogFragCoord = gl_Position.w;\n"
"}\n";
@ -861,17 +863,19 @@ void GLWorld_CreateShaders (void)
"uniform float Alpha;\n"
"\n"
"varying float FogFragCoord;\n"
"varying vec2 tc_tex;\n"
"varying vec2 tc_lm;\n"
"\n"
"void main()\n"
"{\n"
" vec4 result = texture2D(Tex, gl_TexCoord[0].xy);\n"
" vec4 result = texture2D(Tex, tc_tex.xy);\n"
" if (UseAlphaTest && (result.a < 0.666))\n"
" discard;\n"
" result *= texture2D(LMTex, gl_TexCoord[1].xy);\n"
" result *= texture2D(LMTex, tc_lm.xy);\n"
" if (UseOverbright)\n"
" result.rgb *= 2.0;\n"
" if (UseFullbrightTex)\n"
" result += texture2D(FullbrightTex, gl_TexCoord[0].xy);\n"
" result += texture2D(FullbrightTex, tc_tex.xy);\n"
" result = clamp(result, 0.0, 1.0);\n"
" float fog = exp(-gl_Fog.density * gl_Fog.density * FogFragCoord * FogFragCoord);\n"
" fog = clamp(fog, 0.0, 1.0);\n"