summaryrefslogtreecommitdiff
path: root/src/assets/shaders/scene/vert.glsl
blob: 64f400c3c6d4532a6c4d583343794d646be45360 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
in vec4 joint;
in vec4 weight;

uniform mat4 joint_matrices[128];

void main()
{
    vertex_texcoord = texcoord;
    vertex_normal = (normal_matrix * vec4(normal, 1.0)).xyz;
    mat4 skin
        = weight.x * joint_matrices[int(joint.x)]
        + weight.y * joint_matrices[int(joint.y)]
        + weight.z * joint_matrices[int(joint.z)]
        + weight.w * joint_matrices[int(joint.w)];
    vec3 pos = (position * skin * vec4(vertex, 1.0)).xyz;
    vertex_view_vector = camera_pos - pos;
    gl_Position = projection * view * vec4(pos, 1.0);
}