void msModel::SetupJoints() { for (size_t i = 0; i < m_joints.size(); i++) { ms3d_joint_t *joint = &m_joints[i]; joint->parentIndex = FindJointByName(joint->parentName); } for (size_t i = 0; i < m_joints.size(); i++) { ms3d_joint_t *joint = &m_joints[i]; AngleMatrix(joint->rot, joint->matLocalSkeleton); joint->matLocalSkeleton[0][3]= joint->pos[0]; joint->matLocalSkeleton[1][3]= joint->pos[1]; joint->matLocalSkeleton[2][3]= joint->pos[2]; if (joint->parentIndex == -1) { memcpy(joint->matGlobalSkeleton, joint->matLocalSkeleton, sizeof(joint->matGlobalSkeleton)); } else { ms3d_joint_t *parentJoint = &m_joints[joint->parentIndex]; R_ConcatTransforms(parentJoint->matGlobalSkeleton, joint->matLocalSkeleton, joint->matGlobalSkeleton); } SetupTangents(); } }
void msModel::SetupJoints() { for (size_t i = 0; i < m_joints.size(); i++) { ms3d_joint_t *joint = &m_joints[i]; joint->parentIndex = FindJointByName(joint->parentName); SetupTangents(i); } }