- remove use of builtin deprecated varyings in shaders.

This commit is contained in:
Christoph Oelckers 2014-07-15 00:19:41 +02:00
parent ed8a21fd86
commit 5193f6cfef
15 changed files with 31 additions and 24 deletions

View File

@ -1,12 +1,14 @@
uniform sampler2D tex;
uniform sampler2D texture2;
in vec4 vTexCoord;
in vec4 vColor;
void main()
{
vec4 frag = gl_Color;
vec4 frag = vColor;
vec4 t1 = texture2D(texture2, gl_TexCoord[0].xy);
vec4 t2 = texture2D(tex, vec2(gl_TexCoord[0].x, 1.0-gl_TexCoord[0].y));
vec4 t1 = texture2D(texture2, vTexCoord.xy);
vec4 t2 = texture2D(tex, vec2(vTexCoord.x, 1.0-vTexCoord.y));
gl_FragColor = frag * vec4(t1.r, t1.g, t1.b, t2.a);
}

View File

@ -2,11 +2,11 @@ uniform sampler2D texture2;
vec4 ProcessTexel()
{
return getTexel(gl_TexCoord[0].st);
return getTexel(vTexCoord.st);
}
vec4 ProcessLight(vec4 color)
{
vec4 brightpix = desaturate(texture2D(texture2, gl_TexCoord[0].st));
vec4 brightpix = desaturate(texture2D(texture2, vTexCoord.st));
return vec4(min (color.rgb + brightpix.rgb, 1.0), color.a);
}

View File

@ -1,6 +1,6 @@
vec4 ProcessTexel()
{
return getTexel(gl_TexCoord[0].st);
return getTexel(vTexCoord.st);
}

View File

@ -2,7 +2,7 @@ uniform float timer;
vec4 ProcessTexel()
{
vec2 texCoord = gl_TexCoord[0].st;
vec2 texCoord = vTexCoord.st;
const float pi = 3.14159265358979323846;
vec2 offset = vec2(0,0);

View File

@ -2,7 +2,7 @@ uniform float timer;
vec4 ProcessTexel()
{
vec2 texCoord = gl_TexCoord[0].st;
vec2 texCoord = vTexCoord.st;
const float pi = 3.14159265358979323846;
vec2 offset = vec2(0.0,0.0);

View File

@ -2,7 +2,7 @@ uniform float timer;
vec4 ProcessTexel()
{
vec2 texCoord = gl_TexCoord[0].st;
vec2 texCoord = vTexCoord.st;
const float pi = 3.14159265358979323846;

View File

@ -3,7 +3,7 @@ uniform float timer;
vec4 ProcessTexel()
{
vec2 texCoord = gl_TexCoord[0].st;
vec2 texCoord = vTexCoord.st;
vec2 texSplat;
const float pi = 3.14159265358979323846;

View File

@ -3,7 +3,7 @@ uniform float timer;
vec4 ProcessTexel()
{
vec2 texCoord = gl_TexCoord[0].st;
vec2 texCoord = vTexCoord.st;
vec4 basicColor = getTexel(texCoord);
texCoord.x = float( int(texCoord.x * 128.0) ) / 128.0;

View File

@ -3,7 +3,7 @@ uniform float timer;
vec4 ProcessTexel()
{
vec2 texCoord = gl_TexCoord[0].st;
vec2 texCoord = vTexCoord.st;
vec4 basicColor = getTexel(texCoord);
float texX = texCoord.x / 3.0 + 0.66;

View File

@ -3,7 +3,7 @@ uniform float timer;
vec4 ProcessTexel()
{
vec2 texCoord = gl_TexCoord[0].st;
vec2 texCoord = vTexCoord.st;
vec4 basicColor = getTexel(texCoord);
float texX = sin(mod(texCoord.x * 100.0 + timer*5.0, 3.489)) + texCoord.x / 4.0;

View File

@ -3,7 +3,7 @@ uniform float timer;
vec4 ProcessTexel()
{
vec2 texCoord = gl_TexCoord[0].st;
vec2 texCoord = vTexCoord.st;
vec4 basicColor = getTexel(texCoord);
float texX = sin(texCoord.x * 100.0 + timer*5.0);

View File

@ -3,7 +3,7 @@ uniform float timer;
vec4 ProcessTexel()
{
vec2 texCoord = gl_TexCoord[0].st;
vec2 texCoord = vTexCoord.st;
vec4 basicColor = getTexel(texCoord);
texCoord.x = float( int(texCoord.x * 128.0) ) / 128.0;

View File

@ -3,7 +3,7 @@ uniform float timer;
vec4 ProcessTexel()
{
vec2 texCoord = gl_TexCoord[0].st;
vec2 texCoord = vTexCoord.st;
vec4 basicColor = getTexel(texCoord);
float texX = sin(texCoord.x * 100.0 + timer*5.0);

View File

@ -1,6 +1,8 @@
in vec4 pixelpos;
in vec2 glowdist;
in vec4 vTexCoord;
in vec4 vColor;
#ifdef SHADER_STORAGE_LIGHTS
layout(std430, binding = 3) buffer ParameterBuffer
@ -120,7 +122,7 @@ float R_DoomLightingEquation(float light, float dist)
vec4 getLightColor(float fogdist, float fogfactor)
{
vec4 color = gl_Color;
vec4 color = vColor;
if (uLightLevel >= 0.0)
{
@ -193,7 +195,7 @@ vec4 getLightColor(float fogdist, float fogfactor)
color.rgb = clamp(color.rgb + desaturate(dynlight).rgb, 0.0, 1.4);
// prevent any unintentional messing around with the alpha.
return vec4(color.rgb, gl_Color.a);
return vec4(color.rgb, vColor.a);
}
//===========================================================================
@ -291,14 +293,14 @@ void main()
{
float gray = (frag.r * 0.3 + frag.g * 0.56 + frag.b * 0.14);
vec4 cm = uFixedColormapStart + gray * uFixedColormapRange;
frag = vec4(clamp(cm.rgb, 0.0, 1.0), frag.a*gl_Color.a);
frag = vec4(clamp(cm.rgb, 0.0, 1.0), frag.a*vColor.a);
break;
}
case 2:
{
frag = frag * uFixedColormapStart;
frag.a *= gl_Color.a;
frag.a *= vColor.a;
break;
}
@ -320,7 +322,7 @@ void main()
}
fogfactor = exp2 (uFogDensity * fogdist);
frag = vec4(uFogColor.rgb, (1.0 - fogfactor) * frag.a * 0.75 * gl_Color.a);
frag = vec4(uFogColor.rgb, (1.0 - fogfactor) * frag.a * 0.75 * vColor.a);
break;
}
}

View File

@ -5,6 +5,9 @@ out vec4 pixelpos;
out vec2 glowdist;
#endif
out vec4 vTexCoord;
out vec4 vColor;
#ifdef UNIFORM_VB
uniform float fakeVB[100];
#endif
@ -40,7 +43,7 @@ void main()
vec4 eyeCoordPos = ViewMatrix * worldcoord;
gl_FrontColor = gl_Color;
vColor = gl_Color;
#ifndef SIMPLE
pixelpos.xyz = worldcoord.xyz;
@ -56,9 +59,9 @@ void main()
vec3 r = reflect(u, n.xyz);
float m = 2.0 * sqrt( r.x*r.x + r.y*r.y + (r.z+1.0)*(r.z+1.0) );
vec2 sst = vec2(r.x/m + 0.5, r.y/m + 0.5);
gl_TexCoord[0].xy = sst;
vTexCoord.xy = sst;
#else
gl_TexCoord[0] = TextureMatrix * tc;
vTexCoord = TextureMatrix * tc;
#endif
gl_Position = ProjectionMatrix * eyeCoordPos;