Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/GLSL150/HardwareMorphAnimationWithNormalsVp.glsl @ 12181

Last change on this file since 12181 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
3in vec4 vertex;
4in vec3 normal;
5in vec4 uv0;
6in vec4 uv1; // pos2
7in vec4 uv2; // normal2
8
9out vec4 colour;
10// out vec2 oUv;
11
12uniform mat4 worldViewProj;
13uniform vec4 anim_t;
14uniform vec4 objSpaceLightPos;
15uniform vec4 ambient;
16
17// hardware morph animation (with normals)
18void 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.