varying float Z; varying vec4 Color; varying vec3 MCposition; varying float LightIntensity; void main( void ) { vec3 tnorm = normalize( gl_NormalMatrix * gl_Normal ); vec3 LightPos = vec3( 0., 0., 10. ); vec3 ECposition = ( gl_ModelViewMatrix * gl_Vertex ).xyz; LightIntensity = dot( normalize(LightPos - ECposition), tnorm ); LightIntensity = abs( LightIntensity ); LightIntensity *= 1.25; Color = gl_Color; MCposition = gl_Vertex.xyz; Z = -ECposition.z; // distance in front of the eye gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; }