Last change
on this file since 12292 was
12115,
checked in by wiesep, 6 years ago
|
Changed folder structure, deletet some unused files and cleaned up code
|
File size:
875 bytes
|
Line | |
---|
1 | #version 150 |
---|
2 | |
---|
3 | in vec4 vertex; |
---|
4 | in vec3 normal; |
---|
5 | in vec4 uv0; |
---|
6 | in vec4 uv1; // pos2 |
---|
7 | in vec4 uv2; // normal2 |
---|
8 | |
---|
9 | out vec4 colour; |
---|
10 | // out vec2 oUv; |
---|
11 | |
---|
12 | uniform mat4 worldViewProj; |
---|
13 | uniform vec4 anim_t; |
---|
14 | uniform vec4 objSpaceLightPos; |
---|
15 | uniform vec4 ambient; |
---|
16 | |
---|
17 | // hardware morph animation (with normals) |
---|
18 | void main() |
---|
19 | { |
---|
20 | // interpolate position |
---|
21 | vec4 posinterp = vec4(vertex.xyz + anim_t.x*(uv1.xyz - vertex.xyz), 1.0); |
---|
22 | |
---|
23 | // nlerp normal |
---|
24 | vec3 ninterp = normal + anim_t.x*(uv2.xyz - normal); |
---|
25 | ninterp = normalize(ninterp); |
---|
26 | |
---|
27 | gl_Position = worldViewProj * posinterp; |
---|
28 | // oUv = uv0.xy; |
---|
29 | |
---|
30 | vec3 lightDir = normalize( |
---|
31 | objSpaceLightPos.xyz - (posinterp.xyz * objSpaceLightPos.w)); |
---|
32 | |
---|
33 | // Colour it red to make it easy to identify |
---|
34 | float lit = clamp(dot(lightDir, ninterp), 0.0, 1.0); |
---|
35 | colour = vec4((ambient.rgb + vec3(lit,lit,lit)) * vec3(1.0,0.0,0.0), 1.0); |
---|
36 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.