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