Last change
on this file since 12228 was
12115,
checked in by wiesep, 6 years ago
|
Changed folder structure, deletet some unused files and cleaned up code
|
File size:
660 bytes
|
Line | |
---|
1 | #version 120 |
---|
2 | |
---|
3 | uniform mat4 world; |
---|
4 | uniform mat4 worldIT; |
---|
5 | uniform mat4 worldViewProj; |
---|
6 | uniform mat4 texViewProj; |
---|
7 | uniform vec4 lightPosition; |
---|
8 | uniform vec4 lightColour; |
---|
9 | |
---|
10 | attribute vec4 vertex; |
---|
11 | attribute vec3 normal; |
---|
12 | |
---|
13 | varying vec4 oUv; |
---|
14 | varying vec4 outColor; |
---|
15 | |
---|
16 | void main() |
---|
17 | { |
---|
18 | gl_Position = worldViewProj * vertex; |
---|
19 | |
---|
20 | vec4 worldPos = world * vertex; |
---|
21 | |
---|
22 | vec3 worldNorm = (worldIT * vec4(normal, 1.0)).xyz; |
---|
23 | |
---|
24 | // calculate lighting (simple vertex lighting) |
---|
25 | vec3 lightDir = normalize( |
---|
26 | lightPosition.xyz - (worldPos.xyz * lightPosition.w)); |
---|
27 | |
---|
28 | outColor = lightColour * max(dot(lightDir, worldNorm), 0.0); |
---|
29 | |
---|
30 | // calculate shadow map coords |
---|
31 | oUv = texViewProj * worldPos; |
---|
32 | } |
---|
33 | |
---|
Note: See
TracBrowser
for help on using the repository browser.