2022-07-26 00:47:31 -04:00
|
|
|
#include "utils/spm_layout.h"
|
2022-08-25 21:36:30 -04:00
|
|
|
#include "../utils/get_world_location.vert"
|
2022-07-26 00:47:31 -04:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
int offset = u_object_buffer.m_objects[gl_InstanceIndex].m_skinning_offest;
|
|
|
|
mat4 joint_matrix =
|
|
|
|
v_weight[0] * u_skinning_matrices.m_mat[max(v_joint[0] + offset, 0)] +
|
|
|
|
v_weight[1] * u_skinning_matrices.m_mat[max(v_joint[1] + offset, 0)] +
|
|
|
|
v_weight[2] * u_skinning_matrices.m_mat[max(v_joint[2] + offset, 0)] +
|
|
|
|
v_weight[3] * u_skinning_matrices.m_mat[max(v_joint[3] + offset, 0)];
|
2022-08-25 21:36:30 -04:00
|
|
|
vec4 v_skinning_position = joint_matrix * vec4(v_position.xyz, 1.0);
|
|
|
|
vec4 v_world_position = getWorldPosition(
|
|
|
|
u_object_buffer.m_objects[gl_InstanceIndex].m_position.xyz,
|
|
|
|
u_object_buffer.m_objects[gl_InstanceIndex].m_rotation,
|
|
|
|
u_object_buffer.m_objects[gl_InstanceIndex].m_scale.xyz,
|
|
|
|
v_skinning_position.xyz);
|
|
|
|
gl_Position = u_camera.m_projection_view_matrix * v_world_position;
|
2022-07-26 00:47:31 -04:00
|
|
|
f_vertex_color = v_color.zyxw;
|
|
|
|
f_uv = v_uv;
|
2022-07-28 01:37:09 -04:00
|
|
|
f_uv_two = v_uv_two;
|
2022-07-26 00:47:31 -04:00
|
|
|
f_material_id = u_object_buffer.m_objects[gl_InstanceIndex].m_material_id;
|
|
|
|
}
|