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:
1009 bytes
|
Line | |
---|
1 | #version 150 |
---|
2 | |
---|
3 | in vec4 position; |
---|
4 | in vec3 normal; |
---|
5 | in vec4 uv0; |
---|
6 | in float uv1; |
---|
7 | |
---|
8 | out vec4 oColor_0; |
---|
9 | #if SHADOW_CASTER |
---|
10 | #else |
---|
11 | out vec2 oTexcoord2_0; |
---|
12 | #endif |
---|
13 | |
---|
14 | uniform mat4x3 worldMatrix3x4Array[80]; |
---|
15 | uniform mat4 viewProjectionMatrix; |
---|
16 | uniform vec4 lightPos; |
---|
17 | uniform vec4 ambient; |
---|
18 | uniform vec4 lightDiffuseColour; |
---|
19 | |
---|
20 | void main() |
---|
21 | { |
---|
22 | #if SHADOW_CASTER |
---|
23 | // transform by indexed matrix |
---|
24 | vec4 transformedPos = vec4((worldMatrix3x4Array[int(uv1)] * position).xyz, 1.0); |
---|
25 | |
---|
26 | // view / projection |
---|
27 | gl_Position = viewProjectionMatrix * transformedPos; |
---|
28 | |
---|
29 | oColor_0 = ambient; |
---|
30 | #else |
---|
31 | // transform by indexed matrix |
---|
32 | vec4 transformedPos = vec4((worldMatrix3x4Array[int(uv1)] * position).xyz, 1.0); |
---|
33 | |
---|
34 | // view / projection |
---|
35 | gl_Position = viewProjectionMatrix * transformedPos; |
---|
36 | oTexcoord2_0 = uv0.xy; |
---|
37 | |
---|
38 | vec3 norm = mat3(worldMatrix3x4Array[int(uv1)]) * normal; |
---|
39 | |
---|
40 | vec3 lightDir = normalize( |
---|
41 | lightPos.xyz - (transformedPos.xyz * lightPos.w)); |
---|
42 | |
---|
43 | oColor_0 = ambient + clamp(dot(lightDir, norm), 0.0, 1.0) * lightDiffuseColour; |
---|
44 | #endif |
---|
45 | } |
---|
46 | |
---|
Note: See
TracBrowser
for help on using the repository browser.