mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
fix
moar fix optimize cool guy texture
This commit is contained in:
parent
307ab111d0
commit
63b9979ff7
6 changed files with 16 additions and 20 deletions
BIN
games/devtest/mods/testentities/models/testentities_cool_guy.png
Executable file → Normal file
BIN
games/devtest/mods/testentities/models/testentities_cool_guy.png
Executable file → Normal file
Binary file not shown.
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 3.6 KiB |
|
@ -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"
|
||||
|
@ -70,8 +71,11 @@ public:
|
|||
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.
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "ISceneManager.h"
|
||||
#include "S3DVertex.h"
|
||||
#include "Transform.h"
|
||||
#include "irrTypes.h"
|
||||
#include "matrix4.h"
|
||||
#include "os.h"
|
||||
#include "SkinnedMesh.h"
|
||||
|
@ -549,7 +550,7 @@ void CAnimatedMeshSceneNode::addJoints()
|
|||
ISceneNode *parent = this;
|
||||
if (joint->ParentJointID)
|
||||
parent = PerJoint.SceneNodes.at(*joint->ParentJointID); // exists because of topo. order
|
||||
assert(parent);
|
||||
_IRR_DEBUG_BREAK_IF(!parent);
|
||||
const auto *matrix = std::get_if<core::matrix4>(&joint->transform);
|
||||
PerJoint.SceneNodes.push_back(new CBoneSceneNode(
|
||||
parent, SceneManager, 0, i, joint->Name,
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -412,7 +412,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) {
|
||||
|
@ -429,7 +429,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;
|
||||
|
|
|
@ -394,22 +394,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")
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue