accommodate inspector change
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / model_skinned.vs
1 layout (location=0) in vec3 a_co;
2 layout (location=1) in vec3 a_norm;
3 layout (location=2) in vec2 a_uv;
4 layout (location=3) in vec4 a_colour;
5 layout (location=4) in vec4 a_weights;
6 layout (location=5) in ivec4 a_groups;
7
8 #include "motion_vectors_vs.glsl"
9
10 uniform mat4 uPv;
11 uniform mat4x3 uTransforms[32];
12
13 out vec4 aColour;
14 out vec2 aUv;
15 out vec3 aNorm;
16 out vec3 aCo;
17 out vec3 aWorldCo;
18
19 void main()
20 {
21 vec4 co_local = vec4( a_co, 1.0 );
22 vec3 co0 = uTransforms[ a_groups[0] ] * co_local;
23 vec3 co1 = uTransforms[ a_groups[1] ] * co_local;
24 vec3 co2 = uTransforms[ a_groups[2] ] * co_local;
25 vec3 n0 = mat3(uTransforms[ a_groups[0] ]) * a_norm;
26 vec3 n1 = mat3(uTransforms[ a_groups[1] ]) * a_norm;
27 vec3 n2 = mat3(uTransforms[ a_groups[2] ]) * a_norm;
28
29 vec3 world_pos = co0*a_weights[0] + co1*a_weights[1] + co2*a_weights[2];
30 vec3 world_normal = n0*a_weights[0] + n1*a_weights[1] + n2*a_weights[2];
31
32 gl_Position = uPv * vec4( world_pos, 1.0 );
33 aColour = a_colour;
34 aUv = a_uv;
35 aNorm = world_normal;
36 aCo = a_co;
37 aWorldCo = world_pos;
38
39 // TODO: motion vectors
40 aMotionVec0 = vec3(1.0);
41 aMotionVec1 = vec3(1.0);
42 }