1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-27 17:28:41 +00:00

Switch from "is gltf" bool to source file format enum

This commit is contained in:
Lars Mueller 2025-05-19 00:16:53 +02:00
parent f0abe80bcb
commit 3b6ec864b5
6 changed files with 25 additions and 13 deletions

View file

@ -26,12 +26,21 @@ class ISceneManager;
class SkinnedMesh : public IAnimatedMesh
{
public:
enum class SourceFormat {
B3D,
X,
GLTF,
OTHER,
};
//! constructor
SkinnedMesh() :
SkinnedMesh(SourceFormat src_format) :
EndFrame(0.f), FramesPerSecond(25.f),
LastAnimatedFrame(-1), SkinnedLastFrame(false),
HasAnimation(false), PreparedForSkinning(false),
AnimateNormals(true), HardwareSkinning(false)
AnimateNormals(true), HardwareSkinning(false),
SrcFormat(src_format)
{
SkinningBuffers = &LocalBuffers;
}
@ -39,6 +48,10 @@ public:
//! destructor
virtual ~SkinnedMesh();
//! The source (file) format the mesh was loaded from.
//! Important for legacy reasons pertaining to different mesh loader behavior.
SourceFormat getSourceFormat() const { return SrcFormat; }
//! If the duration is 0, it is a static (=non animated) mesh.
f32 getMaxFrameNumber() const override;
@ -339,10 +352,6 @@ 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();
@ -387,13 +396,13 @@ protected:
bool AnimateNormals;
bool HardwareSkinning;
bool IsGltf = false;
SourceFormat SrcFormat;
};
// Interface for mesh loaders
class SkinnedMeshBuilder : public SkinnedMesh {
public:
SkinnedMeshBuilder(bool is_gltf = false) : SkinnedMesh() { IsGltf = is_gltf; }
SkinnedMeshBuilder(SourceFormat src_format) : SkinnedMesh(src_format) {}
//! loaders should call this after populating the mesh
// returns *this, so do not try to drop the mesh builder instance