Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/skybox/Media/materials/programs/DepthShadowmapReceiverVp.glsl @ 2518

Last change on this file since 2518 was 390, checked in by landauf, 17 years ago

added materials

File size: 758 bytes
RevLine 
[390]1uniform mat4 world;
2uniform mat4 worldIT;
3uniform mat4 worldViewProj;
4uniform mat4 texViewProj;
5uniform vec4 lightPosition;
6uniform vec4 lightColour;
7uniform vec4 shadowDepthRange;
8
9
10void main()
11{
12        gl_Position = ftransform();
13       
14        vec4 worldPos = world * gl_Vertex;
15
16        vec3 worldNorm = (worldIT * vec4(gl_Normal, 1)).xyz;
17
18        // calculate lighting (simple vertex lighting)
19        vec3 lightDir = normalize(
20                lightPosition.xyz -  (worldPos.xyz * lightPosition.w));
21
22        gl_FrontColor = lightColour * max(dot(lightDir, worldNorm), 0.0);
23
24        // calculate shadow map coords
25        gl_TexCoord[0] = texViewProj * worldPos;
26#if LINEAR_RANGE
27        // adjust by fixed depth bias, rescale into range
28        gl_TexCoord[0].z = (gl_TexCoord[0].z - shadowDepthRange.x) * shadowDepthRange.w;
29#endif
30
31}
32
Note: See TracBrowser for help on using the repository browser.