DepthShadowmapReceiverVp.glsl
资源名称:3dwind2.0.rar [点击查看]
上传用户:xhbjoy
上传日期:2014-10-07
资源大小:38068k
文件大小:1k
源码类别:
游戏引擎
开发平台:
Visual C++
- uniform mat4 world;
- uniform mat4 worldIT;
- uniform mat4 worldViewProj;
- uniform mat4 texViewProj;
- uniform vec4 lightPosition;
- uniform vec4 lightColour;
- uniform vec4 shadowDepthRange;
- void main()
- {
- gl_Position = ftransform();
- vec4 worldPos = world * gl_Vertex;
- vec3 worldNorm = (worldIT * vec4(gl_Normal, 1)).xyz;
- // calculate lighting (simple vertex lighting)
- vec3 lightDir = normalize(
- lightPosition.xyz - (worldPos.xyz * lightPosition.w));
- gl_FrontColor = lightColour * max(dot(lightDir, worldNorm), 0.0);
- // calculate shadow map coords
- gl_TexCoord[0] = texViewProj * worldPos;
- #if LINEAR_RANGE
- // adjust by fixed depth bias, rescale into range
- gl_TexCoord[0].z = (gl_TexCoord[0].z - shadowDepthRange.x) * shadowDepthRange.w;
- #endif
- }