1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

Refine node mesh scaling logic

We now do scale static meshes, as the bug that caused meshes not to be scaled was limited to skeletally animated meshes,
hence we ought not to reproduce it for skinned meshes that do not take advantage of skeletal animations (e.g. current MTG doors).

However, gltf models (e.g. Wuzzy's eyeballs) up until recently were always affected due to technical reasons
(using skeletal animation for rigid animation).

Thus, to preserve behavior, we:

1. Do not apply 10x scale to glTF models.
2. Apply 10x scale to obj models.
3. Apply 10x scale to static x or b3d models, but not to animated ones.
This commit is contained in:
Lars Mueller 2025-05-15 02:53:33 +02:00
parent 511c637c2a
commit 740223d30c
4 changed files with 33 additions and 12 deletions

View file

@ -339,6 +339,10 @@ public:
return AllJoints;
}
//! Whether the mesh originated from a glTF file.
//! This is important for legacy reasons.
bool isGltf() const { return IsGltf; }
protected:
void checkForAnimation();
@ -382,12 +386,14 @@ protected:
bool PreparedForSkinning;
bool AnimateNormals;
bool HardwareSkinning;
bool IsGltf = false;
};
// Interface for mesh loaders
class SkinnedMeshBuilder : public SkinnedMesh {
public:
SkinnedMeshBuilder() : SkinnedMesh() {}
SkinnedMeshBuilder(bool is_gltf = false) : SkinnedMesh() { IsGltf = is_gltf; }
//! loaders should call this after populating the mesh
// returns *this, so do not try to drop the mesh builder instance

View file

@ -347,7 +347,7 @@ IAnimatedMesh* SelfType::createMesh(io::IReadFile* file)
const char *filename = file->getFileName().c_str();
try {
tiniergltf::GlTF model = parseGLTF(file);
irr_ptr<SkinnedMeshBuilder> mesh(new SkinnedMeshBuilder());
irr_ptr<SkinnedMeshBuilder> mesh(new SkinnedMeshBuilder(true));
MeshExtractor extractor(std::move(model), mesh.get());
try {
extractor.load();