From a67762ebf5b140afa198e31f8d035ee687b045c6 Mon Sep 17 00:00:00 2001 From: korenkonder Date: Sun, 7 Jan 2024 20:49:39 +0300 Subject: [PATCH] Messing with obj skin stuff --- src/CRE/object.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/CRE/object.cpp b/src/CRE/object.cpp index 77738258..687e4fc3 100644 --- a/src/CRE/object.cpp +++ b/src/CRE/object.cpp @@ -573,29 +573,28 @@ void obj_skin_set_matrix_buffer(const obj_skin* s, const mat4* matrices, if (!s->num_bone) return; + obj_skin_bone* bone = s->bone_array; if (mat) - for (uint32_t i = 0; i < s->num_bone; i++) { + for (uint32_t i = 0; i < s->num_bone; i++, bone++, matrix_buffer++) { mat4 temp; - int32_t bone_id = s->bone_array[i].id; - if (bone_id & 0x8000) - mat4_mul(mat, &ex_data_matrices[bone_id & 0x7FFF], &temp); + if (bone->id & 0x8000) + mat4_mul(mat, &ex_data_matrices[bone->id & 0x7FFF], &temp); else - mat4_mul(mat, &matrices[bone_id], &temp); + mat4_mul(mat, &matrices[bone->id], &temp); mat4_mul(&temp, global_mat, &temp); - mat4_mul(&s->bone_array[i].inv_bind_pose_mat, &temp, &matrix_buffer[i]); + mat4_mul(&bone->inv_bind_pose_mat, &temp, matrix_buffer); } else - for (uint32_t i = 0; i < s->num_bone; i++) { + for (uint32_t i = 0; i < s->num_bone; i++, bone++, matrix_buffer++) { mat4 temp; - int32_t bone_id = s->bone_array[i].id; - if (bone_id & 0x8000) - temp = ex_data_matrices[bone_id & 0x7FFF]; + if (bone->id & 0x8000) + temp = ex_data_matrices[bone->id & 0x7FFF]; else - temp = matrices[bone_id]; + temp = matrices[bone->id]; mat4_mul(&temp, global_mat, &temp); - mat4_mul(&s->bone_array[i].inv_bind_pose_mat, &temp, &matrix_buffer[i]); + mat4_mul(&bone->inv_bind_pose_mat, &temp, matrix_buffer); } }