1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Refactor: Merge [IC]SkinnedMesh into SkinnedMesh (#15511)

This commit is contained in:
Lars Müller 2024-12-06 18:03:44 +01:00 committed by GitHub
parent 810f39767c
commit 3e10d9ccf5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 326 additions and 646 deletions

View file

@ -12,7 +12,7 @@
#include "IFileSystem.h"
#include "IReadFile.h"
#include "ISceneManager.h"
#include "ISkinnedMesh.h"
#include "SkinnedMesh.h"
#include "irrlicht.h"
#include "catch.h"
@ -379,14 +379,14 @@ SECTION("simple sparse accessor")
// https://github.com/KhronosGroup/glTF-Sample-Models/tree/main/2.0/SimpleSkin
SECTION("simple skin")
{
using ISkinnedMesh = irr::scene::ISkinnedMesh;
using SkinnedMesh = irr::scene::SkinnedMesh;
const auto mesh = loadMesh(model_stem + "simple_skin.gltf");
REQUIRE(mesh != nullptr);
auto csm = dynamic_cast<const ISkinnedMesh*>(mesh);
auto csm = dynamic_cast<const SkinnedMesh*>(mesh);
const auto joints = csm->getAllJoints();
REQUIRE(joints.size() == 3);
const auto findJoint = [&](const std::function<bool(ISkinnedMesh::SJoint*)> &predicate) {
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];
@ -420,7 +420,7 @@ SECTION("simple skin")
SECTION("weights are correct")
{
const auto weights = [&](const ISkinnedMesh::SJoint *joint) {
const auto weights = [&](const SkinnedMesh::SJoint *joint) {
std::unordered_map<irr::u32, irr::f32> weights;
for (std::size_t i = 0; i < joint->Weights.size(); ++i) {
const auto weight = joint->Weights[i];