Last change
on this file since 12091 was
12091,
checked in by wiesep, 5 years ago
|
Updated programs and adjusted Material to work with GLSL>150
|
File size:
887 bytes
|
Line | |
---|
1 | #version 100 |
---|
2 | |
---|
3 | precision highp int; |
---|
4 | precision highp float; |
---|
5 | |
---|
6 | uniform mat4 worldMatrixArray[80]; |
---|
7 | uniform mat4 viewProjectionMatrix; |
---|
8 | uniform vec4 lightPos; |
---|
9 | uniform vec4 ambient; |
---|
10 | uniform vec4 lightDiffuseColour; |
---|
11 | |
---|
12 | attribute vec4 position; |
---|
13 | attribute vec3 normal; |
---|
14 | attribute vec4 uv0; |
---|
15 | attribute float uv1; |
---|
16 | |
---|
17 | varying vec4 oColor_0; |
---|
18 | #if SHADOW_CASTER |
---|
19 | #else |
---|
20 | varying vec2 oTexcoord2_0; |
---|
21 | #endif |
---|
22 | |
---|
23 | void main() |
---|
24 | { |
---|
25 | // transform by indexed matrix |
---|
26 | vec4 transformedPos = vec4((worldMatrixArray[int(uv1)] * position).xyz, 1.0); |
---|
27 | |
---|
28 | // view / projection |
---|
29 | gl_Position = viewProjectionMatrix * transformedPos; |
---|
30 | |
---|
31 | #if SHADOW_CASTER |
---|
32 | |
---|
33 | oColor_0 = ambient; |
---|
34 | #else |
---|
35 | oTexcoord2_0 = uv0.xy; |
---|
36 | |
---|
37 | vec3 norm = mat3(worldMatrixArray[int(uv1)]) * normal; |
---|
38 | |
---|
39 | vec3 lightDir = normalize( |
---|
40 | lightPos.xyz - (transformedPos.xyz * lightPos.w)); |
---|
41 | |
---|
42 | oColor_0 = ambient + clamp(dot(lightDir, norm), 0.0, 1.0) * lightDiffuseColour; |
---|
43 | #endif |
---|
44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.