mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-27 22:22:08 +00:00
4d005bdfa0
All those special shaders have been merged together. Mostly working but the non-shader lighting seems a bit broken.
30 lines
927 B
Text
30 lines
927 B
Text
|
|
out vec4 pixelpos;
|
|
out vec2 glowdist;
|
|
|
|
void main()
|
|
{
|
|
vec4 worldcoord = ModelMatrix * gl_Vertex;
|
|
vec4 eyeCoordPos = ViewMatrix * worldcoord;
|
|
|
|
gl_FrontColor = gl_Color;
|
|
|
|
pixelpos.xyz = worldcoord.xyz;
|
|
pixelpos.w = -eyeCoordPos.z/eyeCoordPos.w;
|
|
|
|
glowdist.x = -((uGlowTopPlane.w + uGlowTopPlane.x * worldcoord.x + uGlowTopPlane.y * worldcoord.z) * uGlowTopPlane.z) - worldcoord.y;
|
|
glowdist.y = worldcoord.y + ((uGlowBottomPlane.w + uGlowBottomPlane.x * worldcoord.x + uGlowBottomPlane.y * worldcoord.z) * uGlowBottomPlane.z);
|
|
|
|
#ifdef SPHEREMAP
|
|
vec3 u = normalize(eyeCoordPos.xyz);
|
|
vec3 n = normalize(gl_NormalMatrix * gl_Normal);
|
|
vec3 r = reflect(u, n);
|
|
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;
|
|
#else
|
|
gl_TexCoord[0] = TextureMatrix * gl_MultiTexCoord0;
|
|
#endif
|
|
|
|
gl_Position = ProjectionMatrix * eyeCoordPos;
|
|
}
|