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