From 81fad0f20c851a2bdd8410e1aea77a3dc8d55117 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 14 Dec 2025 10:39:21 +0100 Subject: [PATCH] Prepare jt importer --- code/AssetLib/JT/JTImporter.cpp | 1 + code/AssetLib/JT/JTImporter.h | 4 +++ code/AssetLib/glTF/glTFAsset.h | 41 +++++++++++++------------------ code/AssetLib/glTF/glTFImporter.h | 3 +-- code/CMakeLists.txt | 5 ++++ 5 files changed, 28 insertions(+), 26 deletions(-) create mode 100644 code/AssetLib/JT/JTImporter.cpp create mode 100644 code/AssetLib/JT/JTImporter.h diff --git a/code/AssetLib/JT/JTImporter.cpp b/code/AssetLib/JT/JTImporter.cpp new file mode 100644 index 000000000..8337712ea --- /dev/null +++ b/code/AssetLib/JT/JTImporter.cpp @@ -0,0 +1 @@ +// diff --git a/code/AssetLib/JT/JTImporter.h b/code/AssetLib/JT/JTImporter.h new file mode 100644 index 000000000..834eb5da8 --- /dev/null +++ b/code/AssetLib/JT/JTImporter.h @@ -0,0 +1,4 @@ +#pragma once + +namespace Assimp::JT { +} diff --git a/code/AssetLib/glTF/glTFAsset.h b/code/AssetLib/glTF/glTFAsset.h index bc9264565..54e7265f4 100644 --- a/code/AssetLib/glTF/glTFAsset.h +++ b/code/AssetLib/glTF/glTFAsset.h @@ -914,29 +914,16 @@ class Asset { friend struct Buffer; // To access OpenFile friend class AssetWriter; -private: - IOSystem *mIOSystem; - - std::string mCurrentAssetDir; - - size_t mSceneLength; - size_t mBodyOffset, mBodyLength; - - std::vector mDicts; - - IdMap mUsedIds; - - Ref mBodyBuffer; - - Asset(Asset &); - Asset &operator=(const Asset &); public: + // Copy policies + Asset(Asset &) = delete; + Asset &operator=(const Asset &) = delete; + //! Keeps info about the enabled extensions struct Extensions { - bool KHR_binary_glTF; - bool KHR_materials_common; - + bool KHR_binary_glTF{ false }; + bool KHR_materials_common{ false }; } extensionsUsed; AssetMetadata asset; @@ -961,8 +948,7 @@ public: Ref scene; -public: - Asset(IOSystem *io = nullptr) : + explicit Asset(IOSystem *io = nullptr) : mIOSystem(io), asset(), accessors(*this, "accessors"), @@ -979,7 +965,7 @@ public: skins(*this, "skins"), textures(*this, "textures"), lights(*this, "lights", "KHR_materials_common") { - memset(&extensionsUsed, 0, sizeof(extensionsUsed)); + // empty } //! Main function @@ -995,10 +981,17 @@ public: private: void ReadBinaryHeader(IOStream &stream); - void ReadExtensionsUsed(Document &doc); - IOStream *OpenFile(const std::string &path, const char *mode, bool absolute = false); + +private: + IOSystem *mIOSystem; + std::string mCurrentAssetDir; + size_t mSceneLength; + size_t mBodyOffset, mBodyLength; + std::vector mDicts; + IdMap mUsedIds; + Ref mBodyBuffer; }; } // namespace glTF diff --git a/code/AssetLib/glTF/glTFImporter.h b/code/AssetLib/glTF/glTFImporter.h index 42acd7897..6ad3e6be0 100644 --- a/code/AssetLib/glTF/glTFImporter.h +++ b/code/AssetLib/glTF/glTFImporter.h @@ -49,7 +49,6 @@ struct aiNode; namespace glTF { class Asset; - } namespace Assimp { @@ -58,7 +57,7 @@ namespace Assimp { * Load the glTF format. * https://github.com/KhronosGroup/glTF/tree/master/specification */ -class glTFImporter : public BaseImporter { +class glTFImporter final : public BaseImporter { public: glTFImporter(); ~glTFImporter() override = default; diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 65dbff304..0b7941045 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -401,6 +401,11 @@ ADD_ASSIMP_IMPORTER( IRR AssetLib/Irr/IRRShared.h ) +ADD_ASSIMP_IMPORTER(JT + AssetLib/JT/JTImporter.cpp + AssetLib/JT/JTImporter.h +) + ADD_ASSIMP_IMPORTER( LWO AssetLib/LWO/LWOAnimation.cpp AssetLib/LWO/LWOAnimation.h