1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

minor cleanup

This commit is contained in:
Lars Mueller 2025-01-27 18:01:18 +01:00
parent 66e779b87f
commit 07963f1af5
3 changed files with 7 additions and 6 deletions

View file

@ -349,8 +349,11 @@ public:
// The .x and .gltf formats pre-calculate this
std::optional<core::matrix4> GlobalInversedMatrix;
// TODO friends?
u16 JointID; // TODO refactor away: pointers -> IDs
void setParent(SJoint *parent) {
ParentJointID = parent ? parent->JointID : std::optional<u16>{};
}
u16 JointID; // TODO refactor away: pointers -> IDs (problem: .x loader abuses SJoint)
std::optional<u16> ParentJointID;
};

View file

@ -514,8 +514,7 @@ bool CXMeshFileLoader::parseDataObjectFrame(SkinnedMesh::SJoint *Parent)
if (n.has_value()) {
JointID = *n;
joint = AnimatedMesh->getAllJoints()[JointID];
if (Parent)
joint->ParentJointID = Parent->JointID;
joint->setParent(Parent);
}
}

View file

@ -509,8 +509,7 @@ void SkinnedMeshBuilder::addMeshBuffer(SSkinMeshBuffer *meshbuf)
SkinnedMesh::SJoint *SkinnedMeshBuilder::addJoint(SJoint *parent)
{
SJoint *joint = new SJoint;
if (parent)
joint->ParentJointID = parent->JointID;
joint->setParent(parent);
joint->JointID = AllJoints.size();
AllJoints.push_back(joint);