You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

48 lines
1.2 KiB

layout(location = 0) in vec3 in_position;
layout(location = 1) in vec3 in_tex_coord;
layout(location = 2) in vec3 in_normal;
layout(location = 3) in vec3 in_tangent;
layout(location = 4) in vec4 in_bl_indices;
layout(location = 5) in vec4 in_bl_weights;
layout(location = 6) in vec4 in_color;
layout(location = 0) out vec3 out_tex_coord;
layout(location = 1) out vec4 out_color;
layout(binding = 0) uniform Uniforms {
mat4 object;
mat4 camera;
mat4 projec;
} u_matrices;
layout(binding = 1) uniform BoneMatrices {
mat4 matrices[128];
} u_bones;
void main() {
mat4 pos_mat =
u_bones.matrices[int(in_bl_indices.x)] * in_bl_weights.x +
u_bones.matrices[int(in_bl_indices.y)] * in_bl_weights.y +
u_bones.matrices[int(in_bl_indices.z)] * in_bl_weights.z +
u_bones.matrices[int(in_bl_indices.w)] * in_bl_weights.w;
mat3 adj_mat =
mat3(cross(pos_mat[1].xyz, pos_mat[2].xyz),
cross(pos_mat[2].xyz, pos_mat[0].xyz),
cross(pos_mat[0].xyz, pos_mat[1].xyz));
vec3 pos = vec3(pos_mat * vec4(in_position, 1.0));
vec3 nrm = adj_mat * in_normal;
vec3 tng = adj_mat * in_tangent;
gl_Position =
u_matrices.projec *
u_matrices.camera *
u_matrices.object *
vec4(pos, 1.0);
out_tex_coord = in_tex_coord;
out_color = in_color;
}
// EOF