Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
moar fix

optimize cool guy texture
  • Loading branch information
appgurueu committed Jan 27, 2025
1 parent cc663b4 commit c9b1981
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 19 deletions.
Binary file modified games/devtest/mods/testentities/models/testentities_cool_guy.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions irr/include/SkinnedMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "SSkinMeshBuffer.h"
#include "aabbox3d.h"
#include "irrMath.h"
#include "irrTypes.h"
#include "matrix4.h"
#include "quaternion.h"
#include "vector3d.h"
Expand Down Expand Up @@ -57,8 +58,11 @@ class SkinnedMesh : public IAnimatedMesh
void setAnimationSpeed(f32 fps) override;

//! **Must not be called**.
//! TODO refactor Irrlicht so that we need not implement this.
IMesh *getMesh(f32) override { assert(false); };
IMesh *getMesh(f32) override {
// TODO refactor Irrlicht so that we need not implement this.
_IRR_DEBUG_BREAK_IF(true);
return nullptr;
};

//! Turns the given array of local matrices into an array of global matrices
//! by multiplying with respective parent matrices.
Expand Down
8 changes: 1 addition & 7 deletions irr/src/CXMeshFileLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,13 +555,7 @@ bool CXMeshFileLoader::parseDataObjectFrame(SkinnedMesh::SJoint *Parent)
core::matrix4 matrix;
if (!parseDataObjectTransformationMatrix(matrix))
return false;
auto transform = core::Transform::decompose(matrix);
// Try to decompose. If the recomposed matrix equals the old one with a liberal tolerance, use that.
if (transform.buildMatrix().equals(matrix, 1e-5)) {
joint->transform = transform;
} else {
joint->transform = matrix;
}
joint->transform = matrix;
} else if (objectName == "Mesh") {
/*
frame.Meshes.push_back(SXMesh());
Expand Down
3 changes: 1 addition & 2 deletions irr/src/SkinnedMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ void SkinnedMesh::topoSortJoints()
{
size_t n = AllJoints.size();

std::vector<u16> new_to_old_id; // new id -> old id
std::vector<u16> new_to_old_id;

std::vector<std::vector<u16>> children(n);
for (u16 i = 0; i < n; ++i) {
Expand All @@ -428,7 +428,6 @@ void SkinnedMesh::topoSortJoints()
children[new_to_old_id[i]].end());
}

// old id -> new id
std::vector<u16> old_to_new_id(n);
for (u16 i = 0; i < n; ++i)
old_to_new_id[new_to_old_id[i]] = i;
Expand Down
14 changes: 6 additions & 8 deletions src/unittest/test_irr_gltf_mesh_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,22 +386,20 @@ SECTION("simple skin")
const auto joints = csm->getAllJoints();
REQUIRE(joints.size() == 3);

const auto findJoint = [&](const std::function<bool(SkinnedMesh::SJoint*)> &predicate) {
for (std::size_t i = 0; i < joints.size(); ++i) {
if (predicate(joints[i])) {
return joints[i];
const auto findJoint = [&](const std::function<bool(const SkinnedMesh::SJoint*)> &predicate) {
for (const auto *joint : joints) {
if (predicate(joint)) {
return joint;
}
}
throw std::runtime_error("joint not found");
};

// Check the node hierarchy
const auto *parent = findJoint([](auto *joint) {
return !joint->ParentJointID;
});
const auto child = findJoint([&](auto *joint) {
return joint->ParentJointID && *joint->ParentJointID == parent->JointID;
return !!joint->ParentJointID;
});
const auto *parent = joints.at(*child->ParentJointID);

SECTION("transformations are correct")
{
Expand Down

0 comments on commit c9b1981

Please sign in to comment.