Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/GLSL150/DepthShadowmapReceiverVp.glsl @ 12232

Last change on this file since 12232 was 12115, checked in by wiesep, 6 years ago

Changed folder structure, deletet some unused files and cleaned up code

File size: 923 bytes
Line 
1#version 150
2
3uniform mat4 world;
4uniform mat4 worldIT;
5uniform mat4 worldViewProj;
6uniform mat4 texViewProj;
7uniform vec4 lightPosition;
8uniform vec4 lightColour;
9uniform vec4 shadowDepthRange;
10
11in vec4 position;
12in vec3 normal;
13in vec4 ambient;
14
15out vec4 shadowUV;
16out vec4 oColour;
17
18void main()
19{
20        gl_Position = worldViewProj * position;
21        vec4 worldPos = world * position;
22        vec3 worldNorm = (worldIT * vec4(normal, 1)).xyz;
23
24        // calculate lighting (simple vertex lighting)
25        vec3 lightDir = normalize(
26                lightPosition.xyz - (worldPos.xyz * lightPosition.w));
27
28        oColour = lightColour * max(dot(lightDir, worldNorm), 0.0);
29
30        // calculate shadow map coords
31        shadowUV = texViewProj * worldPos;
32#if LINEAR_RANGE
33        // adjust by fixed depth bias, rescale into range
34//      shadowUV.z = (shadowUV.z - shadowDepthRange.x) * shadowDepthRange.w;
35        shadowUV.xy = shadowUV.xy / shadowUV.w;
36#else
37        shadowUV = shadowUV / shadowUV.w;
38#endif
39}
Note: See TracBrowser for help on using the repository browser.