2013-06-23 09:13:01 +00:00
|
|
|
#ifndef NO_FOG
|
|
|
|
varying vec4 pixelpos;
|
|
|
|
attribute vec4 fogparams;
|
|
|
|
varying vec4 fogparm;
|
|
|
|
#endif
|
|
|
|
#ifndef NO_GLOW
|
|
|
|
varying vec2 glowdist;
|
2014-05-10 15:09:43 +00:00
|
|
|
uniform vec4 glowbottomplane, glowtopplane;
|
2013-06-23 09:13:01 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef SOFTLIGHT
|
|
|
|
attribute float lightlevel_in;
|
|
|
|
varying float lightlevel;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
#ifdef SOFTLIGHT
|
|
|
|
lightlevel = lightlevel_in;
|
|
|
|
#endif
|
|
|
|
|
2014-05-11 11:27:51 +00:00
|
|
|
// We use texture matrix 7 as the model matrix and the modelview matrix as the view matrix.
|
|
|
|
vec4 worldcoord = gl_TextureMatrix[7] * gl_Vertex;
|
2013-06-23 09:13:01 +00:00
|
|
|
vec4 eyeCoordPos = gl_ModelViewMatrix * worldcoord;
|
|
|
|
|
|
|
|
gl_FrontColor = gl_Color;
|
|
|
|
|
|
|
|
#ifndef NO_FOG
|
|
|
|
pixelpos.xyz = worldcoord.xyz;
|
|
|
|
pixelpos.w = -eyeCoordPos.z/eyeCoordPos.w;
|
|
|
|
fogparm = fogparams;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef NO_GLOW
|
2014-05-10 15:09:43 +00:00
|
|
|
glowdist.x = -((glowtopplane.w + glowtopplane.x * worldcoord.x + glowtopplane.y * worldcoord.z) * glowtopplane.z) - worldcoord.y;
|
|
|
|
glowdist.y = worldcoord.y + ((glowbottomplane.w + glowbottomplane.x * worldcoord.x + glowbottomplane.y * worldcoord.z) * glowbottomplane.z);
|
2013-06-23 09:13:01 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#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);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef SPHEREMAP_0
|
|
|
|
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
|
|
|
#else
|
|
|
|
gl_TexCoord[0].xy = sst;
|
|
|
|
#endif
|
|
|
|
|
2014-05-11 11:27:51 +00:00
|
|
|
gl_Position = gl_ModelViewProjectionMatrix * worldcoord;
|
2013-06-23 09:13:01 +00:00
|
|
|
#ifdef __GLSL_CG_DATA_TYPES
|
|
|
|
gl_ClipVertex = eyeCoordPos;
|
|
|
|
#endif
|
|
|
|
}
|