Last change
on this file since 12412 was
12115,
checked in by wiesep, 6 years ago
|
Changed folder structure, deletet some unused files and cleaned up code
|
File size:
712 bytes
|
Line | |
---|
1 | #version 120 |
---|
2 | |
---|
3 | // General functions |
---|
4 | |
---|
5 | // Expand a range-compressed vector |
---|
6 | vec3 expand(vec3 v) |
---|
7 | { |
---|
8 | return (v - 0.5) * 2.0; |
---|
9 | } |
---|
10 | |
---|
11 | uniform sampler2D shadowMap; |
---|
12 | uniform sampler2D normalMap; |
---|
13 | uniform vec4 lightDiffuse; |
---|
14 | |
---|
15 | varying vec4 uvproj; |
---|
16 | varying vec4 oUv0; |
---|
17 | varying vec3 oTSLightDir; |
---|
18 | |
---|
19 | void main() |
---|
20 | { |
---|
21 | // retrieve normalised light vector, expand from range-compressed |
---|
22 | vec3 lightVec = expand(normalize(oTSLightDir).xyz); |
---|
23 | |
---|
24 | // get bump map vector, again expand from range-compressed |
---|
25 | vec3 bumpVec = expand(texture2D(normalMap, oUv0.xy).xyz); |
---|
26 | |
---|
27 | // get shadow value |
---|
28 | vec3 shadow = texture2DProj(shadowMap, uvproj).xyz; |
---|
29 | |
---|
30 | // Calculate dot product |
---|
31 | gl_FragColor = vec4(shadow * lightDiffuse.xyz * dot(bumpVec, lightVec), 1.0); |
---|
32 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.