1 uniform sampler2DShadow shadow;
\r
2 uniform sampler2D mainmap;
\r
3 uniform sampler2D detailmap;
\r
5 varying vec3 normal,lightDir;
\r
10 float fog = exp2(-gl_Fog.density * gl_FogFragCoord * 3.0 * 1.442695);
\r
11 float fog_factor = clamp(fog, 0.0, 1.0);
\r
13 // Look up the diffuse color and shadow states for each light source.
\r
14 float s0 = shadow2DProj(shadow, gl_TexCoord[2]).r;
\r
16 // compute the dot product between normal and normalized lightdir
\r
17 vec3 n = normalize(normal);
\r
18 float NdotL = max(dot(n,normalize(lightDir)),0.0) * s0;
\r
21 vec4 ambient = gl_LightSource[1].ambient; //* gl_FrontMaterial.ambient;
\r
22 vec4 diffuse = gl_LightSource[1].diffuse; //* gl_FrontMaterial.diffuse;
\r
23 vec4 lightcolor = (diffuse * NdotL + ambient);
\r
25 // Compute the final pixel color
\r
26 vec4 groundColor = texture2D(mainmap, gl_TexCoord[0].xy);
\r
27 vec4 detailColor = texture2D(detailmap, gl_TexCoord[1].xy);
\r
30 ((groundColor.rgb * 3.5) + detailColor.rgb) / 4.0 * lightcolor.rgb;
\r
32 gl_FragColor = vec4(mix(vec3(gl_Fog.color), finalColor, fog_factor), 1.0);
\r