From 74af523b3ef6a68fa07749ac974d4fd51c6324e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20R=C3=B6sner?= Date: Thu, 12 Jan 2023 13:13:46 +0100 Subject: [PATCH 01/15] Generalize JoinVerticesProcess for multiple UV and color channels --- code/PostProcessing/JoinVerticesProcess.cpp | 49 +++++++++++++-------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/code/PostProcessing/JoinVerticesProcess.cpp b/code/PostProcessing/JoinVerticesProcess.cpp index ef5999875..f752ed0eb 100644 --- a/code/PostProcessing/JoinVerticesProcess.cpp +++ b/code/PostProcessing/JoinVerticesProcess.cpp @@ -105,7 +105,11 @@ void JoinVerticesProcess::Execute( aiScene* pScene) { namespace { -bool areVerticesEqual(const Vertex &lhs, const Vertex &rhs, bool complex) { +bool areVerticesEqual( + const Vertex &lhs, + const Vertex &rhs, + unsigned numUVChannels, + unsigned numColorChannels) { // A little helper to find locally close vertices faster. // Try to reuse the lookup table from the last step. const static float epsilon = 1e-5f; @@ -124,10 +128,6 @@ bool areVerticesEqual(const Vertex &lhs, const Vertex &rhs, bool complex) { return false; } - if ((lhs.texcoords[0] - rhs.texcoords[0]).SquareLength() > squareEpsilon) { - return false; - } - if ((lhs.tangent - rhs.tangent).SquareLength() > squareEpsilon) { return false; } @@ -136,19 +136,18 @@ bool areVerticesEqual(const Vertex &lhs, const Vertex &rhs, bool complex) { return false; } - // Usually we won't have vertex colors or multiple UVs, so we can skip from here - // Actually this increases runtime performance slightly, at least if branch - // prediction is on our side. - if (complex) { - for (int i = 0; i < 8; i++) { - if (i > 0 && (lhs.texcoords[i] - rhs.texcoords[i]).SquareLength() > squareEpsilon) { - return false; - } - if (GetColorDifference(lhs.colors[i], rhs.colors[i]) > squareEpsilon) { - return false; - } + for (unsigned i = 0; i < numUVChannels; i++) { + if ((lhs.texcoords[i] - rhs.texcoords[i]).SquareLength() > squareEpsilon) { + return false; } } + + for (unsigned i = 0; i < numColorChannels; i++) { + if (GetColorDifference(lhs.colors[i], rhs.colors[i]) > squareEpsilon) { + return false; + } + } + return true; } @@ -241,9 +240,16 @@ struct std::hash { //template specialization for std::equal_to for Vertex template<> struct std::equal_to { + equal_to(unsigned numUVChannels, unsigned numColorChannels) : + mNumUVChannels(numUVChannels), + mNumColorChannels(numColorChannels) {} bool operator()(const Vertex &lhs, const Vertex &rhs) const { - return areVerticesEqual(lhs, rhs, false); + return areVerticesEqual(lhs, rhs, mNumUVChannels, mNumColorChannels); } + +private: + unsigned mNumUVChannels; + unsigned mNumColorChannels; }; // now start the JoinVerticesProcess int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) { @@ -316,8 +322,13 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) { uniqueAnimatedVertices[animMeshIndex].reserve(pMesh->mNumVertices); } } - // a map that maps a vertix to its new index - std::unordered_map vertex2Index; + // a map that maps a vertex to its new index + const auto numBuckets = pMesh->mNumVertices; + const auto hasher = std::hash(); + const auto comparator = std::equal_to( + pMesh->GetNumUVChannels(), + pMesh->GetNumColorChannels()); + std::unordered_map vertex2Index(numBuckets, hasher, comparator); // we can not end up with more vertices than we started with vertex2Index.reserve(pMesh->mNumVertices); // Now check each vertex if it brings something new to the table From 43c0f8bb3d41250d6b566e6cb5b9a5c79e36aae3 Mon Sep 17 00:00:00 2001 From: Martin Mory Date: Sun, 15 Jan 2023 23:03:41 +0100 Subject: [PATCH 02/15] Remove whitespace between a tag and the first number, otherwise first call to strtoul10() returns 0 and the indices are broken, leading to possible out-of-bound access and memory corruption/crash --- code/AssetLib/Collada/ColladaParser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/code/AssetLib/Collada/ColladaParser.cpp b/code/AssetLib/Collada/ColladaParser.cpp index 91f32f485..cce6a0db6 100644 --- a/code/AssetLib/Collada/ColladaParser.cpp +++ b/code/AssetLib/Collada/ColladaParser.cpp @@ -762,6 +762,7 @@ void ColladaParser::ReadControllerWeights(XmlNode &node, Collada::Controller &pC if (text == nullptr) { throw DeadlyImportError("Out of data while reading "); } + SkipSpacesAndLineEnd(&text); it->first = strtoul10(text, &text); SkipSpacesAndLineEnd(&text); if (*text == 0) { From e5c02e8d45489ac89b13333f034c5361afa5cd71 Mon Sep 17 00:00:00 2001 From: Krishty Date: Mon, 16 Jan 2023 08:12:24 +0100 Subject: [PATCH 03/15] =?UTF-8?q?Remove=20Useless=20=E2=80=9Cvirtual?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These functions are already marked “override”, and their neighbors had “virtual” removed as well. --- code/AssetLib/Ogre/OgreImporter.h | 8 ++++---- code/AssetLib/glTF2/glTF2Importer.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/code/AssetLib/Ogre/OgreImporter.h b/code/AssetLib/Ogre/OgreImporter.h index dc8b09051..3a72ae70e 100644 --- a/code/AssetLib/Ogre/OgreImporter.h +++ b/code/AssetLib/Ogre/OgreImporter.h @@ -60,17 +60,17 @@ namespace Ogre { class OgreImporter : public BaseImporter { public: /// BaseImporter override. - virtual bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override; + bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override; protected: /// BaseImporter override. - virtual void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override; + void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override; /// BaseImporter override. - virtual const aiImporterDesc *GetInfo() const override; + const aiImporterDesc *GetInfo() const override; /// BaseImporter override. - virtual void SetupProperties(const Importer *pImp) override; + void SetupProperties(const Importer *pImp) override; private: /// Read materials referenced by the @c mesh to @c pScene. diff --git a/code/AssetLib/glTF2/glTF2Importer.h b/code/AssetLib/glTF2/glTF2Importer.h index 831bcd7d2..80cf689dc 100644 --- a/code/AssetLib/glTF2/glTF2Importer.h +++ b/code/AssetLib/glTF2/glTF2Importer.h @@ -65,7 +65,7 @@ public: protected: const aiImporterDesc *GetInfo() const override; void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override; - virtual void SetupProperties(const Importer *pImp) override; + void SetupProperties(const Importer *pImp) override; private: void ImportEmbeddedTextures(glTF2::Asset &a); From bad76fd0f18e82279c2812773727fec884b22c9b Mon Sep 17 00:00:00 2001 From: Krishty Date: Mon, 16 Jan 2023 08:18:36 +0100 Subject: [PATCH 04/15] Replace Variables With Literals --- code/AssetLib/Blender/BlenderBMesh.cpp | 3 +-- code/AssetLib/Blender/BlenderLoader.cpp | 3 +-- code/AssetLib/Blender/BlenderTessellator.cpp | 6 ++---- code/AssetLib/C4D/C4DImporter.cpp | 3 +-- code/AssetLib/FBX/FBXImporter.cpp | 3 +-- code/AssetLib/IFC/IFCLoader.cpp | 3 +-- code/AssetLib/XGL/XGLLoader.cpp | 3 +-- 7 files changed, 8 insertions(+), 16 deletions(-) diff --git a/code/AssetLib/Blender/BlenderBMesh.cpp b/code/AssetLib/Blender/BlenderBMesh.cpp index b15da185d..a82e7c678 100644 --- a/code/AssetLib/Blender/BlenderBMesh.cpp +++ b/code/AssetLib/Blender/BlenderBMesh.cpp @@ -52,8 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace Assimp { template <> const char *LogFunctions::Prefix() { - static auto prefix = "BLEND_BMESH: "; - return prefix; + return "BLEND_BMESH: "; } } // namespace Assimp diff --git a/code/AssetLib/Blender/BlenderLoader.cpp b/code/AssetLib/Blender/BlenderLoader.cpp index f1fb0246d..269c90b96 100644 --- a/code/AssetLib/Blender/BlenderLoader.cpp +++ b/code/AssetLib/Blender/BlenderLoader.cpp @@ -80,8 +80,7 @@ namespace Assimp { template <> const char *LogFunctions::Prefix() { - static auto prefix = "BLEND: "; - return prefix; + return "BLEND: "; } } // namespace Assimp diff --git a/code/AssetLib/Blender/BlenderTessellator.cpp b/code/AssetLib/Blender/BlenderTessellator.cpp index d3ef5ae5e..9c78d0a2a 100644 --- a/code/AssetLib/Blender/BlenderTessellator.cpp +++ b/code/AssetLib/Blender/BlenderTessellator.cpp @@ -62,8 +62,7 @@ namspace Assimp { template< > const char* LogFunctions< BlenderTessellatorGL >::Prefix() { - static auto prefix = "BLEND_TESS_GL: "; - return prefix; + return "BLEND_TESS_GL: "; } } @@ -259,8 +258,7 @@ namespace Assimp { template< > const char* LogFunctions< BlenderTessellatorP2T >::Prefix() { - static auto prefix = "BLEND_TESS_P2T: "; - return prefix; + return "BLEND_TESS_P2T: "; } } diff --git a/code/AssetLib/C4D/C4DImporter.cpp b/code/AssetLib/C4D/C4DImporter.cpp index 06d7a3412..f21ff8602 100644 --- a/code/AssetLib/C4D/C4DImporter.cpp +++ b/code/AssetLib/C4D/C4DImporter.cpp @@ -86,8 +86,7 @@ void GetWriterInfo(int &id, String &appname) { namespace Assimp { template<> const char* LogFunctions::Prefix() { - static auto prefix = "C4D: "; - return prefix; + return "C4D: "; } } diff --git a/code/AssetLib/FBX/FBXImporter.cpp b/code/AssetLib/FBX/FBXImporter.cpp index 7ff194905..7a106d535 100644 --- a/code/AssetLib/FBX/FBXImporter.cpp +++ b/code/AssetLib/FBX/FBXImporter.cpp @@ -62,8 +62,7 @@ namespace Assimp { template <> const char *LogFunctions::Prefix() { - static auto prefix = "FBX: "; - return prefix; + return "FBX: "; } } // namespace Assimp diff --git a/code/AssetLib/IFC/IFCLoader.cpp b/code/AssetLib/IFC/IFCLoader.cpp index 908dc8dfa..ee718681e 100644 --- a/code/AssetLib/IFC/IFCLoader.cpp +++ b/code/AssetLib/IFC/IFCLoader.cpp @@ -73,8 +73,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace Assimp { template <> const char *LogFunctions::Prefix() { - static auto prefix = "IFC: "; - return prefix; + return "IFC: "; } } // namespace Assimp diff --git a/code/AssetLib/XGL/XGLLoader.cpp b/code/AssetLib/XGL/XGLLoader.cpp index 7cacbca4d..04e303370 100644 --- a/code/AssetLib/XGL/XGLLoader.cpp +++ b/code/AssetLib/XGL/XGLLoader.cpp @@ -65,8 +65,7 @@ namespace Assimp { // this has to be in here because LogFunctions is in ::Assimp template <> const char *LogFunctions::Prefix() { - static auto prefix = "XGL: "; - return prefix; + return "XGL: "; } } // namespace Assimp From 5cbc00a595db2166463bc494435a67b4080d28fc Mon Sep 17 00:00:00 2001 From: Krishty Date: Mon, 16 Jan 2023 08:29:49 +0100 Subject: [PATCH 05/15] Fix Build With M3D Import Only `M3DWrapper.h` is designed to omit the definition of `class M3DWrapper` if neither M3D import nor M3D export are compiled. 608bccd9cf3a28c55163c10e84aec025293b7ab0 touched the corresponding preprocessor checks and introduced a bug: ``` #ifndef ASSIMP_BUILD_NO_M3D_IMPORTER #if !(ASSIMP_BUILD_NO_EXPORT || ASSIMP_BUILD_NO_M3D_EXPORTER) class M3DWrapper { ``` When compiling - with M3D import enabled, - but with either export generally disabled or M3D export disabled specifically, These checks evaluate to the wrong result and skip the definition, leading to a build failure in dependent code. ``` #if 1 // import enabled #if !(1 || 1) // export disabled and M3D export disabled ``` This commit fixes the check to compile the definition if neither import is disabled. --- code/AssetLib/M3D/M3DWrapper.cpp | 4 +--- code/AssetLib/M3D/M3DWrapper.h | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/code/AssetLib/M3D/M3DWrapper.cpp b/code/AssetLib/M3D/M3DWrapper.cpp index 30452c776..05087d592 100644 --- a/code/AssetLib/M3D/M3DWrapper.cpp +++ b/code/AssetLib/M3D/M3DWrapper.cpp @@ -39,8 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------- */ -#ifndef ASSIMP_BUILD_NO_M3D_IMPORTER -#if !(ASSIMP_BUILD_NO_EXPORT || ASSIMP_BUILD_NO_M3D_EXPORTER) +#if !defined ASSIMP_BUILD_NO_M3D_IMPORTER || !(defined ASSIMP_BUILD_NO_EXPORT || defined ASSIMP_BUILD_NO_M3D_EXPORTER) #include "M3DWrapper.h" @@ -149,4 +148,3 @@ void M3DWrapper::ClearSave() { } // namespace Assimp #endif -#endif diff --git a/code/AssetLib/M3D/M3DWrapper.h b/code/AssetLib/M3D/M3DWrapper.h index c75ff1027..880aca996 100644 --- a/code/AssetLib/M3D/M3DWrapper.h +++ b/code/AssetLib/M3D/M3DWrapper.h @@ -47,8 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_M3DWRAPPER_H_INC #define AI_M3DWRAPPER_H_INC -#ifndef ASSIMP_BUILD_NO_M3D_IMPORTER -#if !(ASSIMP_BUILD_NO_EXPORT || ASSIMP_BUILD_NO_M3D_EXPORTER) +#if !defined ASSIMP_BUILD_NO_M3D_IMPORTER || !(defined ASSIMP_BUILD_NO_EXPORT || defined ASSIMP_BUILD_NO_M3D_EXPORTER) #include #include @@ -126,7 +125,6 @@ inline m3d_t *M3DWrapper::M3D() const { } // namespace Assimp -#endif #endif // ASSIMP_BUILD_NO_M3D_IMPORTER #endif // AI_M3DWRAPPER_H_INC From 3d3e8569255a113bc4e12d6f79297ea66cf3c357 Mon Sep 17 00:00:00 2001 From: Krishty Date: Mon, 16 Jan 2023 09:12:35 +0100 Subject: [PATCH 06/15] Trim Trailing Whitespace --- code/AssetLib/3MF/D3MFOpcPackage.cpp | 2 +- code/AssetLib/3MF/XmlSerializer.cpp | 4 ++-- code/AssetLib/Assbin/AssbinExporter.h | 2 +- code/AssetLib/Assbin/AssbinFileWriter.cpp | 6 +++--- code/AssetLib/Assjson/json_exporter.cpp | 10 ++++----- code/AssetLib/C4D/C4DImporter.cpp | 2 +- code/AssetLib/Collada/ColladaLoader.cpp | 2 +- code/AssetLib/DXF/DXFLoader.cpp | 2 +- code/AssetLib/FBX/FBXConverter.cpp | 4 ++-- code/AssetLib/FBX/FBXMeshGeometry.h | 6 +++--- code/AssetLib/FBX/FBXParser.cpp | 2 +- code/AssetLib/HMP/HMPLoader.cpp | 6 +++--- code/AssetLib/LWO/LWOAnimation.cpp | 2 +- code/AssetLib/LWO/LWOLoader.cpp | 2 +- code/AssetLib/MD5/MD5Parser.h | 2 +- code/AssetLib/MDL/MDLMaterialLoader.cpp | 2 +- code/AssetLib/NFF/NFFLoader.h | 2 +- code/AssetLib/Obj/ObjFileMtlImporter.cpp | 10 ++++----- code/AssetLib/Obj/ObjFileParser.cpp | 2 +- code/AssetLib/Obj/ObjTools.h | 22 ++++++++++---------- code/AssetLib/SMD/SMDLoader.cpp | 10 ++++----- code/AssetLib/SMD/SMDLoader.h | 2 +- code/AssetLib/Step/STEPFile.h | 14 ++++++------- code/AssetLib/X/XFileParser.cpp | 2 +- code/AssetLib/X3D/X3DImporter.cpp | 2 +- code/AssetLib/X3D/X3DImporter_Geometry2D.cpp | 2 +- code/AssetLib/glTF/glTFAsset.h | 16 +++++++------- code/AssetLib/glTF/glTFExporter.cpp | 6 +++--- code/AssetLib/glTF2/glTF2Asset.h | 14 ++++++------- code/AssetLib/glTF2/glTF2Asset.inl | 2 +- code/AssetLib/glTF2/glTF2Exporter.cpp | 18 ++++++++-------- code/Common/BaseImporter.cpp | 2 +- code/Common/Importer.cpp | 4 ++-- code/Common/PolyTools.h | 2 +- code/Common/RemoveComments.cpp | 2 +- code/Common/ScenePreprocessor.cpp | 2 +- code/Common/SpatialSort.cpp | 2 +- code/Common/Version.cpp | 2 +- code/PostProcessing/JoinVerticesProcess.cpp | 6 +++--- include/assimp/Bitmap.h | 2 +- include/assimp/DefaultIOStream.h | 2 +- include/assimp/Hash.h | 2 +- include/assimp/LogAux.h | 2 +- include/assimp/ObjMaterial.h | 4 ++-- include/assimp/SpatialSort.h | 2 +- include/assimp/XmlParser.h | 4 ++-- include/assimp/aabb.h | 4 ++-- include/assimp/ai_assert.h | 2 +- include/assimp/anim.h | 6 +++--- include/assimp/defs.h | 2 +- include/assimp/material.inl | 6 +++--- include/assimp/quaternion.inl | 2 +- include/assimp/scene.h | 2 +- include/assimp/vector3.h | 8 +++---- port/AndroidJNI/AndroidJNIIOSystem.cpp | 8 +++---- port/jassimp/jassimp-native/src/jassimp.cpp | 6 +++--- test/unit/AssimpAPITest_aiQuaternion.cpp | 2 +- test/unit/Common/uiScene.cpp | 2 +- tools/assimp_cmd/Main.cpp | 2 +- tools/assimp_view/MaterialManager.h | 2 +- 60 files changed, 137 insertions(+), 137 deletions(-) diff --git a/code/AssetLib/3MF/D3MFOpcPackage.cpp b/code/AssetLib/3MF/D3MFOpcPackage.cpp index a2182dc29..934305d49 100644 --- a/code/AssetLib/3MF/D3MFOpcPackage.cpp +++ b/code/AssetLib/3MF/D3MFOpcPackage.cpp @@ -160,7 +160,7 @@ D3MFOpcPackage::D3MFOpcPackage(IOSystem *pIOHandler, const std::string &rFile) : // deal with zip-bug rootFile = rootFile.substr(1); } - } + } ASSIMP_LOG_VERBOSE_DEBUG(rootFile); diff --git a/code/AssetLib/3MF/XmlSerializer.cpp b/code/AssetLib/3MF/XmlSerializer.cpp index 674c6b916..c77111728 100644 --- a/code/AssetLib/3MF/XmlSerializer.cpp +++ b/code/AssetLib/3MF/XmlSerializer.cpp @@ -216,7 +216,7 @@ void XmlSerializer::ImportXml(aiScene *scene) { if (nullptr == scene) { return; } - + scene->mRootNode = new aiNode(XmlTag::RootTag); XmlNode node = mXmlParser->getRootNode().child(XmlTag::model); if (node.empty()) { @@ -444,7 +444,7 @@ void XmlSerializer::ImportTriangles(XmlNode &node, aiMesh *mesh) { } mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices]; } - } + } } } diff --git a/code/AssetLib/Assbin/AssbinExporter.h b/code/AssetLib/Assbin/AssbinExporter.h index 1801c1680..8b721994d 100644 --- a/code/AssetLib/Assbin/AssbinExporter.h +++ b/code/AssetLib/Assbin/AssbinExporter.h @@ -56,5 +56,5 @@ namespace Assimp { void ASSIMP_API ExportSceneAssbin(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/); } -#endif +#endif #endif // AI_ASSBINEXPORTER_H_INC diff --git a/code/AssetLib/Assbin/AssbinFileWriter.cpp b/code/AssetLib/Assbin/AssbinFileWriter.cpp index 97be634de..e9d857a84 100644 --- a/code/AssetLib/Assbin/AssbinFileWriter.cpp +++ b/code/AssetLib/Assbin/AssbinFileWriter.cpp @@ -291,15 +291,15 @@ public: size_t Read(void * /*pvBuffer*/, size_t /*pSize*/, size_t /*pCount*/) override { return 0; } - + aiReturn Seek(size_t /*pOffset*/, aiOrigin /*pOrigin*/) override { return aiReturn_FAILURE; } - + size_t Tell() const override { return cursor; } - + void Flush() override { // not implemented } diff --git a/code/AssetLib/Assjson/json_exporter.cpp b/code/AssetLib/Assjson/json_exporter.cpp index 7a8403831..ea5194fb0 100644 --- a/code/AssetLib/Assjson/json_exporter.cpp +++ b/code/AssetLib/Assjson/json_exporter.cpp @@ -43,7 +43,7 @@ public: Flag_WriteSpecialFloats = 0x2, Flag_SkipWhitespaces = 0x4 }; - + JSONWriter(Assimp::IOStream &out, unsigned int flags = 0u) : out(out), indent (""), newline("\n"), space(" "), buff (), first(false), flags(flags) { // make sure that all formatting happens using the standard, C locale and not the user's current locale @@ -499,18 +499,18 @@ static void Write(JSONWriter &out, const aiMaterial &ai, bool is_elem = true) { } break; - case aiPTI_String: + case aiPTI_String: { aiString s; aiGetMaterialString(&ai, prop->mKey.data, prop->mSemantic, prop->mIndex, &s); out.SimpleValue(s); - } + } break; - case aiPTI_Buffer: + case aiPTI_Buffer: { // binary data is written as series of hex-encoded octets out.SimpleValue(prop->mData, prop->mDataLength); - } + } break; default: ai_assert(false); diff --git a/code/AssetLib/C4D/C4DImporter.cpp b/code/AssetLib/C4D/C4DImporter.cpp index 06d7a3412..866229626 100644 --- a/code/AssetLib/C4D/C4DImporter.cpp +++ b/code/AssetLib/C4D/C4DImporter.cpp @@ -124,7 +124,7 @@ bool C4DImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, b } else if ((!extension.length() || checkSig) && pIOHandler) { // TODO } - + return false; } diff --git a/code/AssetLib/Collada/ColladaLoader.cpp b/code/AssetLib/Collada/ColladaLoader.cpp index 2d578aff3..0a732a8db 100644 --- a/code/AssetLib/Collada/ColladaLoader.cpp +++ b/code/AssetLib/Collada/ColladaLoader.cpp @@ -1523,7 +1523,7 @@ void ColladaLoader::AddTexture(aiMaterial &mat, map = -1; for (std::string::const_iterator it = sampler.mUVChannel.begin(); it != sampler.mUVChannel.end(); ++it) { if (IsNumeric(*it)) { - map = strtoul10(&(*it)); + map = strtoul10(&(*it)); break; } } diff --git a/code/AssetLib/DXF/DXFLoader.cpp b/code/AssetLib/DXF/DXFLoader.cpp index 46c723375..1fb9490cc 100644 --- a/code/AssetLib/DXF/DXFLoader.cpp +++ b/code/AssetLib/DXF/DXFLoader.cpp @@ -371,7 +371,7 @@ void DXFImporter::ExpandBlockReferences(DXF::Block& bl,const DXF::BlockMap& bloc ASSIMP_LOG_ERROR("DXF: PolyLine instance is nullptr, skipping."); continue; } - + std::shared_ptr pl_out = std::shared_ptr(new DXF::PolyLine(*pl_in)); if (bl_src.base.Length() || insert.scale.x!=1.f || insert.scale.y!=1.f || insert.scale.z!=1.f || insert.angle || insert.pos.Length()) { diff --git a/code/AssetLib/FBX/FBXConverter.cpp b/code/AssetLib/FBX/FBXConverter.cpp index 75d28fbdf..e2f43b885 100644 --- a/code/AssetLib/FBX/FBXConverter.cpp +++ b/code/AssetLib/FBX/FBXConverter.cpp @@ -1563,7 +1563,7 @@ void FBXConverter::ConvertWeights(aiMesh *out, const MeshGeometry &geo, const ai out->mBones = nullptr; out->mNumBones = 0; return; - } + } out->mBones = new aiBone *[bones.size()](); out->mNumBones = static_cast(bones.size()); @@ -3228,7 +3228,7 @@ aiNodeAnim* FBXConverter::GenerateSimpleNodeAnim(const std::string& name, } bool ok = false; - + const auto zero_epsilon = ai_epsilon; const aiVector3D& preRotation = PropertyGet(props, "PreRotation", ok); diff --git a/code/AssetLib/FBX/FBXMeshGeometry.h b/code/AssetLib/FBX/FBXMeshGeometry.h index ad24877e4..03f01b763 100644 --- a/code/AssetLib/FBX/FBXMeshGeometry.h +++ b/code/AssetLib/FBX/FBXMeshGeometry.h @@ -59,9 +59,9 @@ class Geometry : public Object { public: /// @brief The class constructor with all parameters. /// @param id The id. - /// @param element - /// @param name - /// @param doc + /// @param element + /// @param name + /// @param doc Geometry( uint64_t id, const Element& element, const std::string& name, const Document& doc ); virtual ~Geometry() = default; diff --git a/code/AssetLib/FBX/FBXParser.cpp b/code/AssetLib/FBX/FBXParser.cpp index da6d3889a..d71321452 100644 --- a/code/AssetLib/FBX/FBXParser.cpp +++ b/code/AssetLib/FBX/FBXParser.cpp @@ -187,7 +187,7 @@ Scope::Scope(Parser& parser,bool topLevel) if (str.empty()) { ParseError("unexpected content: empty string."); } - + elements.insert(ElementMap::value_type(str,new_Element(*n,parser))); // Element() should stop at the next Key token (or right after a Close token) diff --git a/code/AssetLib/HMP/HMPLoader.cpp b/code/AssetLib/HMP/HMPLoader.cpp index efb148eae..3dd27eb02 100644 --- a/code/AssetLib/HMP/HMPLoader.cpp +++ b/code/AssetLib/HMP/HMPLoader.cpp @@ -327,7 +327,7 @@ void HMPImporter::CreateMaterial(const unsigned char *szCurrent, ReadFirstSkin(pcHeader->numskins, szCurrent, &szCurrent); *szCurrentOut = szCurrent; return; - } + } // generate a default material const int iMode = (int)aiShadingMode_Gouraud; @@ -484,11 +484,11 @@ void HMPImporter::GenerateTextureCoords(const unsigned int width, const unsigned if (uv == nullptr) { return; } - + if (height == 0.0f || width == 0.0) { return; } - + const float fY = (1.0f / height) + (1.0f / height) / height; const float fX = (1.0f / width) + (1.0f / width) / width; diff --git a/code/AssetLib/LWO/LWOAnimation.cpp b/code/AssetLib/LWO/LWOAnimation.cpp index 7ebbfb810..8dda4586f 100644 --- a/code/AssetLib/LWO/LWOAnimation.cpp +++ b/code/AssetLib/LWO/LWOAnimation.cpp @@ -165,7 +165,7 @@ void AnimResolver::UpdateAnimRangeSetup() { if (delta == 0.0) { continue; } - + const size_t old_size = (*it).keys.size(); const float value_delta = (*it).keys.back().value - (*it).keys.front().value; diff --git a/code/AssetLib/LWO/LWOLoader.cpp b/code/AssetLib/LWO/LWOLoader.cpp index c3cee0607..96fed248b 100644 --- a/code/AssetLib/LWO/LWOLoader.cpp +++ b/code/AssetLib/LWO/LWOLoader.cpp @@ -215,7 +215,7 @@ void LWOImporter::InternReadFile(const std::string &pFile, } else { mIsLWO2 = true; } - + LoadLWO2File(); // The newer lightwave format allows the user to configure the diff --git a/code/AssetLib/MD5/MD5Parser.h b/code/AssetLib/MD5/MD5Parser.h index e39ce8a8e..bb4843cf9 100644 --- a/code/AssetLib/MD5/MD5Parser.h +++ b/code/AssetLib/MD5/MD5Parser.h @@ -394,7 +394,7 @@ private: bool SkipLine(const char* in, const char** out); bool SkipLine( ); - bool SkipSpacesAndLineEnd( const char* in, const char** out); + bool SkipSpacesAndLineEnd( const char* in, const char** out); bool SkipSpacesAndLineEnd(); bool SkipSpaces(); diff --git a/code/AssetLib/MDL/MDLMaterialLoader.cpp b/code/AssetLib/MDL/MDLMaterialLoader.cpp index db4b534f2..799368264 100644 --- a/code/AssetLib/MDL/MDLMaterialLoader.cpp +++ b/code/AssetLib/MDL/MDLMaterialLoader.cpp @@ -470,7 +470,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7( ASSIMP_LOG_ERROR("Found a reference to an embedded DDS texture, but texture width is zero, aborting import."); return; } - + pcNew.reset(new aiTexture); pcNew->mHeight = 0; pcNew->mWidth = iWidth; diff --git a/code/AssetLib/NFF/NFFLoader.h b/code/AssetLib/NFF/NFFLoader.h index 0fa615b19..7fd094306 100644 --- a/code/AssetLib/NFF/NFFLoader.h +++ b/code/AssetLib/NFF/NFFLoader.h @@ -107,7 +107,7 @@ private: aiColor3D color, diffuse, specular, ambient, emissive; ai_real refracti; - std::string texFile; + std::string texFile; bool twoSided; // For NFF2 bool shaded; ai_real opacity, shininess; diff --git a/code/AssetLib/Obj/ObjFileMtlImporter.cpp b/code/AssetLib/Obj/ObjFileMtlImporter.cpp index 78743dd05..2c3ce9ee5 100644 --- a/code/AssetLib/Obj/ObjFileMtlImporter.cpp +++ b/code/AssetLib/Obj/ObjFileMtlImporter.cpp @@ -514,16 +514,16 @@ void ObjFileMtlImporter::getTextureOption(bool &clamp, int &clampIndex, aiString DataArrayIt it = getNextToken(m_DataIt, m_DataItEnd); getFloat(it, m_DataItEnd, m_pModel->mCurrentMaterial->bump_multiplier); skipToken = 2; - } else if (!ASSIMP_strincmp(pPtr, BlendUOption, static_cast(strlen(BlendUOption))) || + } else if (!ASSIMP_strincmp(pPtr, BlendUOption, static_cast(strlen(BlendUOption))) || !ASSIMP_strincmp(pPtr, BlendVOption, static_cast(strlen(BlendVOption))) || - !ASSIMP_strincmp(pPtr, BoostOption, static_cast(strlen(BoostOption))) || - !ASSIMP_strincmp(pPtr, ResolutionOption, static_cast(strlen(ResolutionOption))) || + !ASSIMP_strincmp(pPtr, BoostOption, static_cast(strlen(BoostOption))) || + !ASSIMP_strincmp(pPtr, ResolutionOption, static_cast(strlen(ResolutionOption))) || !ASSIMP_strincmp(pPtr, ChannelOption, static_cast(strlen(ChannelOption)))) { skipToken = 2; } else if (!ASSIMP_strincmp(pPtr, ModifyMapOption, static_cast(strlen(ModifyMapOption)))) { skipToken = 3; - } else if (!ASSIMP_strincmp(pPtr, OffsetOption, static_cast(strlen(OffsetOption))) || - !ASSIMP_strincmp(pPtr, ScaleOption, static_cast(strlen(ScaleOption))) || + } else if (!ASSIMP_strincmp(pPtr, OffsetOption, static_cast(strlen(OffsetOption))) || + !ASSIMP_strincmp(pPtr, ScaleOption, static_cast(strlen(ScaleOption))) || !ASSIMP_strincmp(pPtr, TurbulenceOption, static_cast(strlen(TurbulenceOption)))) { skipToken = 4; } diff --git a/code/AssetLib/Obj/ObjFileParser.cpp b/code/AssetLib/Obj/ObjFileParser.cpp index 360c1d0e9..c7121083a 100644 --- a/code/AssetLib/Obj/ObjFileParser.cpp +++ b/code/AssetLib/Obj/ObjFileParser.cpp @@ -458,7 +458,7 @@ void ObjFileParser::getFace(aiPrimitiveType type) { //OBJ USES 1 Base ARRAYS!!!! const char *token = &(*m_DataIt); const int iVal = ::atoi(token); - + // increment iStep position based off of the sign and # of digits int tmp = iVal; if (iVal < 0) { diff --git a/code/AssetLib/Obj/ObjTools.h b/code/AssetLib/Obj/ObjTools.h index a76054825..ca173de0a 100644 --- a/code/AssetLib/Obj/ObjTools.h +++ b/code/AssetLib/Obj/ObjTools.h @@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace Assimp { -/** +/** * @brief Returns true, if the last entry of the buffer is reached. * @param[in] it Iterator of current position. * @param[in] end Iterator with end of buffer. @@ -67,7 +67,7 @@ inline bool isEndOfBuffer(char_t it, char_t end) { return (it == end); } -/** +/** * @brief Returns next word separated by a space * @param[in] pBuffer Pointer to data buffer * @param[in] pEnd Pointer to end of buffer @@ -85,7 +85,7 @@ inline Char_T getNextWord(Char_T pBuffer, Char_T pEnd) { return pBuffer; } -/** +/** * @brief Returns pointer a next token * @param[in] pBuffer Pointer to data buffer * @param[in] pEnd Pointer to end of buffer @@ -102,7 +102,7 @@ inline Char_T getNextToken(Char_T pBuffer, Char_T pEnd) { return getNextWord(pBuffer, pEnd); } -/** +/** * @brief Skips a line * @param[in] it Iterator set to current position * @param[in] end Iterator set to end of scratch buffer for readout @@ -131,7 +131,7 @@ inline char_t skipLine(char_t it, char_t end, unsigned int &uiLine) { return it; } -/** +/** * @brief Get a name from the current line. Preserve space in the middle, * but trim it at the end. * @param[in] it set to current position @@ -162,13 +162,13 @@ inline char_t getName(char_t it, char_t end, std::string &name) { std::string strName(pStart, &(*it)); if (!strName.empty()) { name = strName; - } - + } + return it; } -/** +/** * @brief Get a name from the current line. Do not preserve space * in the middle, but trim it at the end. * @param it set to current position @@ -202,11 +202,11 @@ inline char_t getNameNoSpace(char_t it, char_t end, std::string &name) { if (!strName.empty()) { name = strName; } - + return it; } -/** +/** * @brief Get next word from given line * @param[in] it set to current position * @param[in] end set to end of scratch buffer for readout @@ -230,7 +230,7 @@ inline char_t CopyNextWord(char_t it, char_t end, char *pBuffer, size_t length) return it; } -/** +/** * @brief Get next float from given line * @param[in] it set to current position * @param[in] end set to end of scratch buffer for readout diff --git a/code/AssetLib/SMD/SMDLoader.cpp b/code/AssetLib/SMD/SMDLoader.cpp index 896d0b196..039760b94 100644 --- a/code/AssetLib/SMD/SMDLoader.cpp +++ b/code/AssetLib/SMD/SMDLoader.cpp @@ -82,13 +82,13 @@ static const aiImporterDesc desc = { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer SMDImporter::SMDImporter() : - configFrameID(), - mBuffer(), - pScene( nullptr ), - iFileSize( 0 ), + configFrameID(), + mBuffer(), + pScene( nullptr ), + iFileSize( 0 ), iSmallestFrame( INT_MAX ), dLengthOfAnim( 0.0 ), - bHasUVs(false ), + bHasUVs(false ), iLineNumber((unsigned int)-1) { // empty } diff --git a/code/AssetLib/SMD/SMDLoader.h b/code/AssetLib/SMD/SMDLoader.h index db882a241..26f8c751a 100644 --- a/code/AssetLib/SMD/SMDLoader.h +++ b/code/AssetLib/SMD/SMDLoader.h @@ -90,7 +90,7 @@ struct Face { iTexture(0x0), avVertices{} { // empty } - + //! Texture index for the face unsigned int iTexture; diff --git a/code/AssetLib/Step/STEPFile.h b/code/AssetLib/Step/STEPFile.h index 47d6f5010..76a9370f5 100644 --- a/code/AssetLib/Step/STEPFile.h +++ b/code/AssetLib/Step/STEPFile.h @@ -121,7 +121,7 @@ namespace STEP { // ------------------------------------------------------------------------------- /** Exception class used by the STEP loading & parsing code. It is typically - * coupled with a line number. + * coupled with a line number. */ // ------------------------------------------------------------------------------- struct SyntaxError : DeadlyImportError { @@ -230,7 +230,7 @@ private: }; // ------------------------------------------------------------------------------- -/** Shared implementation for some of the primitive data type, i.e. int, float +/** Shared implementation for some of the primitive data type, i.e. int, float */ // ------------------------------------------------------------------------------- template @@ -278,7 +278,7 @@ public: typedef ENUMERATION BOOLEAN; // ------------------------------------------------------------------------------- -/** This is just a reference to an entity/object somewhere else +/** This is just a reference to an entity/object somewhere else */ // ------------------------------------------------------------------------------- class ENTITY : public PrimitiveDataType { @@ -302,7 +302,7 @@ public: } public: - /** @see DaraType::Parse + /** @see DaraType::Parse */ static std::shared_ptr Parse(const char *&inout, uint64_t line = SyntaxError::LINE_NOT_SPECIFIED, @@ -322,7 +322,7 @@ public: // ------------------------------------------------------------------------------- /* Not exactly a full EXPRESS schema but rather a list of conversion functions * to extract valid C++ objects out of a STEP file. Those conversion functions - * may, however, perform further schema validations. + * may, however, perform further schema validations. */ // ------------------------------------------------------------------------------- class ConversionSchema { @@ -384,7 +384,7 @@ struct HeaderInfo { }; // ------------------------------------------------------------------------------ -/** Base class for all concrete object instances +/** Base class for all concrete object instances */ // ------------------------------------------------------------------------------ class Object { @@ -511,7 +511,7 @@ private: // ------------------------------------------------------------------------------ /** A LazyObject is created when needed. Before this happens, we just keep - * the text line that contains the object definition. + * the text line that contains the object definition. */ // ------------------------------------------------------------------------------- class LazyObject { diff --git a/code/AssetLib/X/XFileParser.cpp b/code/AssetLib/X/XFileParser.cpp index 808bb9efd..8786c3166 100644 --- a/code/AssetLib/X/XFileParser.cpp +++ b/code/AssetLib/X/XFileParser.cpp @@ -183,7 +183,7 @@ XFileParser::XFileParser(const std::vector &pBuffer) : P1 += ofs; est_out += MSZIP_BLOCK; // one decompressed block is 327861 in size } - + // Allocate storage and terminating zero and do the actual uncompressing Compression compression; uncompressed.resize(est_out + 1); diff --git a/code/AssetLib/X3D/X3DImporter.cpp b/code/AssetLib/X3D/X3DImporter.cpp index 6e25fb60f..eeb20b7c1 100644 --- a/code/AssetLib/X3D/X3DImporter.cpp +++ b/code/AssetLib/X3D/X3DImporter.cpp @@ -471,7 +471,7 @@ void X3DImporter::ParseHelper_Node_Enter(X3DNodeElementBase *pNode) { mNodeElementCur->Children.push_back(pNode); // add new element to current element child list. mNodeElementCur = pNode; // switch current element to new one. -} +} void X3DImporter::ParseHelper_Node_Exit() { // check if we can walk up. diff --git a/code/AssetLib/X3D/X3DImporter_Geometry2D.cpp b/code/AssetLib/X3D/X3DImporter_Geometry2D.cpp index 653203b4e..2e97902d8 100644 --- a/code/AssetLib/X3D/X3DImporter_Geometry2D.cpp +++ b/code/AssetLib/X3D/X3DImporter_Geometry2D.cpp @@ -263,7 +263,7 @@ void X3DImporter::readDisk2D(XmlNode &node) { // if (tlist_i.size() < 2) { // tlist_i and tlist_o has equal size. - throw DeadlyImportError("Disk2D. Not enough points for creating quad list."); + throw DeadlyImportError("Disk2D. Not enough points for creating quad list."); } // add all quads except last diff --git a/code/AssetLib/glTF/glTFAsset.h b/code/AssetLib/glTF/glTFAsset.h index 26ef239cd..8dd7c8d45 100644 --- a/code/AssetLib/glTF/glTFAsset.h +++ b/code/AssetLib/glTF/glTFAsset.h @@ -260,7 +260,7 @@ public: VEC4, MAT2, MAT3, - MAT4 + MAT4 }; inline static Value FromString(const char *str) { @@ -288,8 +288,8 @@ private: }; template - struct data { - static const Info infos[NUM_VALUES]; + struct data { + static const Info infos[NUM_VALUES]; }; }; @@ -297,11 +297,11 @@ private: template const AttribType::Info AttribType::data::infos[AttribType::NUM_VALUES] = { { "SCALAR", 1 }, - { "VEC2", 2 }, - { "VEC3", 3 }, - { "VEC4", 4 }, - { "MAT2", 4 }, - { "MAT3", 9 }, + { "VEC2", 2 }, + { "VEC3", 3 }, + { "VEC4", 4 }, + { "MAT2", 4 }, + { "MAT3", 9 }, { "MAT4", 16 } }; diff --git a/code/AssetLib/glTF/glTFExporter.cpp b/code/AssetLib/glTF/glTFExporter.cpp index 4010f2b18..91d88f1ae 100644 --- a/code/AssetLib/glTF/glTFExporter.cpp +++ b/code/AssetLib/glTF/glTFExporter.cpp @@ -322,7 +322,7 @@ void glTFExporter::GetTexSampler(const aiMaterial* mat, glTF::TexProperty& prop) prop.texture->sampler->minFilter = SamplerMinFilter_Linear; } -void glTFExporter::GetMatColorOrTex(const aiMaterial* mat, glTF::TexProperty& prop, +void glTFExporter::GetMatColorOrTex(const aiMaterial* mat, glTF::TexProperty& prop, const char* propName, int type, int idx, aiTextureType tt) { aiString tex; aiColor4D col; @@ -370,9 +370,9 @@ void glTFExporter::GetMatColorOrTex(const aiMaterial* mat, glTF::TexProperty& pr } if (mat->Get(propName, type, idx, col) == AI_SUCCESS) { - prop.color[0] = col.r; + prop.color[0] = col.r; prop.color[1] = col.g; - prop.color[2] = col.b; + prop.color[2] = col.b; prop.color[3] = col.a; } } diff --git a/code/AssetLib/glTF2/glTF2Asset.h b/code/AssetLib/glTF2/glTF2Asset.h index 85af49acf..2b58eec23 100644 --- a/code/AssetLib/glTF2/glTF2Asset.h +++ b/code/AssetLib/glTF2/glTF2Asset.h @@ -1123,13 +1123,13 @@ public: bool KHR_texture_basisu; Extensions() : - KHR_materials_pbrSpecularGlossiness(false), - KHR_materials_unlit(false), - KHR_lights_punctual(false), - KHR_texture_transform(false), - KHR_materials_sheen(false), - KHR_materials_clearcoat(false), - KHR_materials_transmission(false), + KHR_materials_pbrSpecularGlossiness(false), + KHR_materials_unlit(false), + KHR_lights_punctual(false), + KHR_texture_transform(false), + KHR_materials_sheen(false), + KHR_materials_clearcoat(false), + KHR_materials_transmission(false), KHR_materials_volume(false), KHR_materials_ior(false), KHR_materials_emissive_strength(false), diff --git a/code/AssetLib/glTF2/glTF2Asset.inl b/code/AssetLib/glTF2/glTF2Asset.inl index af41c23c3..0e2998357 100644 --- a/code/AssetLib/glTF2/glTF2Asset.inl +++ b/code/AssetLib/glTF2/glTF2Asset.inl @@ -1903,7 +1903,7 @@ inline void Asset::Load(const std::string &pFile, bool isBinary) std::vector sceneData; rapidjson::Document doc = ReadDocument(*stream, isBinary, sceneData); - // If a schemaDocumentProvider is available, see if the glTF schema is present. + // If a schemaDocumentProvider is available, see if the glTF schema is present. // If so, use it to validate the document. if (mSchemaDocumentProvider) { if (const rapidjson::SchemaDocument *gltfSchema = mSchemaDocumentProvider->GetRemoteDocument("glTF.schema.json", 16)) { diff --git a/code/AssetLib/glTF2/glTF2Exporter.cpp b/code/AssetLib/glTF2/glTF2Exporter.cpp index 0fdb8e510..51c7f8e05 100644 --- a/code/AssetLib/glTF2/glTF2Exporter.cpp +++ b/code/AssetLib/glTF2/glTF2Exporter.cpp @@ -516,7 +516,7 @@ void glTF2Exporter::GetMatTex(const aiMaterial &mat, Ref &texture, unsi if (mat.GetTextureCount(tt) == 0) { return; } - + aiString tex; // Read texcoord (UV map index) @@ -855,13 +855,13 @@ void glTF2Exporter::ExportMaterials() { mAsset->extensionsUsed.KHR_materials_transmission = true; m->materialTransmission = Nullable(transmission); } - + MaterialVolume volume; if (GetMatVolume(mat, volume)) { mAsset->extensionsUsed.KHR_materials_volume = true; m->materialVolume = Nullable(volume); } - + MaterialIOR ior; if (GetMatIOR(mat, ior)) { mAsset->extensionsUsed.KHR_materials_ior = true; @@ -921,7 +921,7 @@ Ref FindSkeletonRootJoint(Ref &skinRef) { return parentNodeRef; } -void ExportSkin(Asset &mAsset, const aiMesh *aimesh, Ref &meshRef, Ref &bufferRef, Ref &skinRef, +void ExportSkin(Asset &mAsset, const aiMesh *aimesh, Ref &meshRef, Ref &bufferRef, Ref &skinRef, std::vector &inverseBindMatricesData) { if (aimesh->mNumBones < 1) { return; @@ -985,14 +985,14 @@ void ExportSkin(Asset &mAsset, const aiMesh *aimesh, Ref &meshRef, Ref(jointNamesIndex); vertexWeightData[vertexId][jointsPerVertex[vertexId]] = vertWeight; - jointsPerVertex[vertexId] += 1; + jointsPerVertex[vertexId] += 1; } } } // End: for-loop mNumMeshes Mesh::Primitive &p = meshRef->primitives.back(); - Ref vertexJointAccessor = ExportData(mAsset, skinRef->id, bufferRef, aimesh->mNumVertices, + Ref vertexJointAccessor = ExportData(mAsset, skinRef->id, bufferRef, aimesh->mNumVertices, vertexJointData, AttribType::VEC4, AttribType::VEC4, ComponentType_FLOAT); if (vertexJointAccessor) { size_t offset = vertexJointAccessor->bufferView->byteOffset; @@ -1090,7 +1090,7 @@ void glTF2Exporter::ExportMeshes() { } } - Ref n = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mNormals, AttribType::VEC3, + Ref n = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mNormals, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT, BufferViewTarget_ARRAY_BUFFER); if (n) { p.attributes.normal.push_back(n); @@ -1112,7 +1112,7 @@ void glTF2Exporter::ExportMeshes() { if (aim->mNumUVComponents[i] > 0) { AttribType::Value type = (aim->mNumUVComponents[i] == 2) ? AttribType::VEC2 : AttribType::VEC3; - Ref tc = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mTextureCoords[i], + Ref tc = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mTextureCoords[i], AttribType::VEC3, type, ComponentType_FLOAT, BufferViewTarget_ARRAY_BUFFER); if (tc) { p.attributes.texcoord.push_back(tc); @@ -1140,7 +1140,7 @@ void glTF2Exporter::ExportMeshes() { } } - p.indices = ExportData(*mAsset, meshId, b, indices.size(), &indices[0], AttribType::SCALAR, AttribType::SCALAR, + p.indices = ExportData(*mAsset, meshId, b, indices.size(), &indices[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_UNSIGNED_INT, BufferViewTarget_ELEMENT_ARRAY_BUFFER); } diff --git a/code/Common/BaseImporter.cpp b/code/Common/BaseImporter.cpp index 587fa7bc1..87b385268 100644 --- a/code/Common/BaseImporter.cpp +++ b/code/Common/BaseImporter.cpp @@ -247,7 +247,7 @@ void BaseImporter::GetExtensionList(std::set &extensions) { } if (ext2 && !ASSIMP_stricmp(ext_real, ext2)) { - return true; + return true; } return false; diff --git a/code/Common/Importer.cpp b/code/Common/Importer.cpp index 52b6097e7..df2895eef 100644 --- a/code/Common/Importer.cpp +++ b/code/Common/Importer.cpp @@ -1118,7 +1118,7 @@ bool Importer::SetPropertyMatrix(const char* szName, const aiMatrix4x4& value) { // Set a configuration property bool Importer::SetPropertyPointer(const char* szName, void* value) { ai_assert(nullptr != pimpl); - + bool existing; ASSIMP_BEGIN_EXCEPTION_REGION(); existing = SetGenericProperty(pimpl->mPointerProperties, szName,value); @@ -1162,7 +1162,7 @@ aiMatrix4x4 Importer::GetPropertyMatrix(const char* szName, const aiMatrix4x4& i // Get a configuration property void* Importer::GetPropertyPointer(const char* szName, void* iErrorReturn /*= nullptr*/) const { ai_assert(nullptr != pimpl); - + return GetGenericProperty(pimpl->mPointerProperties,szName,iErrorReturn); } diff --git a/code/Common/PolyTools.h b/code/Common/PolyTools.h index 11f627392..9837a2991 100644 --- a/code/Common/PolyTools.h +++ b/code/Common/PolyTools.h @@ -88,7 +88,7 @@ inline bool PointInTriangle2D(const T& p0, const T& p1,const T& p2, const T& pp) if (denom == 0.0) { return false; } - + const double invDenom = 1.0 / denom; dot11 = (dot11 * dot02 - dot01 * dot12) * invDenom; dot00 = (dot00 * dot12 - dot01 * dot02) * invDenom; diff --git a/code/Common/RemoveComments.cpp b/code/Common/RemoveComments.cpp index 4fae21c95..52dd37ff0 100644 --- a/code/Common/RemoveComments.cpp +++ b/code/Common/RemoveComments.cpp @@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------- */ -/** +/** * @file RemoveComments.cpp * @brief Defines the CommentRemover utility class */ diff --git a/code/Common/ScenePreprocessor.cpp b/code/Common/ScenePreprocessor.cpp index 95c63ae1c..18a257ad4 100644 --- a/code/Common/ScenePreprocessor.cpp +++ b/code/Common/ScenePreprocessor.cpp @@ -106,7 +106,7 @@ void ScenePreprocessor::ProcessMesh(aiMesh *mesh) { if (!mesh->mTextureCoords[i]) { mesh->mNumUVComponents[i] = 0; continue; - } + } if (!mesh->mNumUVComponents[i]) { mesh->mNumUVComponents[i] = 2; diff --git a/code/Common/SpatialSort.cpp b/code/Common/SpatialSort.cpp index a35ebb055..c8c5c30ed 100644 --- a/code/Common/SpatialSort.cpp +++ b/code/Common/SpatialSort.cpp @@ -94,7 +94,7 @@ ai_real SpatialSort::CalculateDistance(const aiVector3D &pPosition) const { void SpatialSort::Finalize() { const ai_real scale = 1.0f / mPositions.size(); for (unsigned int i = 0; i < mPositions.size(); i++) { - mCentroid += scale * mPositions[i].mPosition; + mCentroid += scale * mPositions[i].mPosition; } for (unsigned int i = 0; i < mPositions.size(); i++) { mPositions[i].mDistance = CalculateDistance(mPositions[i].mPosition); diff --git a/code/Common/Version.cpp b/code/Common/Version.cpp index 808c3598d..9c3d0250c 100644 --- a/code/Common/Version.cpp +++ b/code/Common/Version.cpp @@ -185,6 +185,6 @@ ASSIMP_API aiScene::~aiScene() { aiMetadata::Dealloc(mMetaData); delete[] mSkeletons; - + delete static_cast(mPrivate); } diff --git a/code/PostProcessing/JoinVerticesProcess.cpp b/code/PostProcessing/JoinVerticesProcess.cpp index ef5999875..acb1e9651 100644 --- a/code/PostProcessing/JoinVerticesProcess.cpp +++ b/code/PostProcessing/JoinVerticesProcess.cpp @@ -95,7 +95,7 @@ void JoinVerticesProcess::Execute( aiScene* pScene) { ASSIMP_LOG_DEBUG("JoinVerticesProcess finished "); return; } - + // Show statistics ASSIMP_LOG_INFO("JoinVerticesProcess finished | Verts in: ", iNumOldVertices, " out: ", iNumVertices, " | ~", @@ -235,7 +235,7 @@ struct std::hash { std::size_t operator()(Vertex const& v) const noexcept { size_t seed = 0; hash_combine(seed, v.position.x ,v.position.y,v.position.z); - return seed; + return seed; } }; //template specialization for std::equal_to for Vertex @@ -399,7 +399,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) { } if (weightAlreadyExists) { continue; - } + } aiVertexWeight nw; nw.mVertexId = replaceIndex[ ow.mVertexId ]; nw.mWeight = ow.mWeight; diff --git a/include/assimp/Bitmap.h b/include/assimp/Bitmap.h index 94dd0b81b..2678b5f64 100644 --- a/include/assimp/Bitmap.h +++ b/include/assimp/Bitmap.h @@ -63,7 +63,7 @@ namespace Assimp { class IOStream; // --------------------------------------------------------------------------- -/** +/** * This class is used to store and write bitmap information. */ class ASSIMP_API Bitmap { diff --git a/include/assimp/DefaultIOStream.h b/include/assimp/DefaultIOStream.h index aa298a667..e8d9ed329 100644 --- a/include/assimp/DefaultIOStream.h +++ b/include/assimp/DefaultIOStream.h @@ -74,7 +74,7 @@ class ASSIMP_API DefaultIOStream : public IOStream { #endif // __ANDROID__ protected: - /// @brief + /// @brief DefaultIOStream() AI_NO_EXCEPT; /// @brief The class constructor with the file name and the stream. diff --git a/include/assimp/Hash.h b/include/assimp/Hash.h index 188e98a94..cf889362c 100644 --- a/include/assimp/Hash.h +++ b/include/assimp/Hash.h @@ -77,7 +77,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. inline uint32_t SuperFastHash (const char * data, uint32_t len = 0, uint32_t hash = 0) { uint32_t tmp; int rem; - + if (data == NULL) return 0; if (len == 0)len = (uint32_t)::strlen(data); diff --git a/include/assimp/LogAux.h b/include/assimp/LogAux.h index c7b86a185..a8cb8f24c 100644 --- a/include/assimp/LogAux.h +++ b/include/assimp/LogAux.h @@ -57,7 +57,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace Assimp { /// @brief Logger class, which will extend the class by log-functions. -/// @tparam TDeriving +/// @tparam TDeriving template class LogFunctions { public: diff --git a/include/assimp/ObjMaterial.h b/include/assimp/ObjMaterial.h index bba207638..9c511916a 100644 --- a/include/assimp/ObjMaterial.h +++ b/include/assimp/ObjMaterial.h @@ -41,7 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file OBJMATERIAL.h * @brief Obj-specific material macros - * + * */ #ifndef AI_OBJMATERIAL_H_INC @@ -64,7 +64,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Pure key names for all obj texture-related properties //! @cond MATS_DOC_FULL -// support for bump -bm +// support for bump -bm #define _AI_MATKEY_OBJ_BUMPMULT_BASE "$tex.bumpmult" //! @endcond diff --git a/include/assimp/SpatialSort.h b/include/assimp/SpatialSort.h index 87b009da7..cd055450e 100644 --- a/include/assimp/SpatialSort.h +++ b/include/assimp/SpatialSort.h @@ -162,7 +162,7 @@ protected: unsigned int mIndex; ///< The vertex referred by this entry aiVector3D mPosition; ///< Position /// Distance of this vertex to the sorting plane. This is set by Finalize. - ai_real mDistance; + ai_real mDistance; Entry() AI_NO_EXCEPT : mIndex(std::numeric_limits::max()), diff --git a/include/assimp/XmlParser.h b/include/assimp/XmlParser.h index 2b850e6c2..52a23bd83 100644 --- a/include/assimp/XmlParser.h +++ b/include/assimp/XmlParser.h @@ -58,8 +58,8 @@ namespace Assimp { struct find_node_by_name_predicate { /// @brief The default constructor. find_node_by_name_predicate() = default; - - + + std::string mName; ///< The name to find. find_node_by_name_predicate(const std::string &name) : mName(name) { diff --git a/include/assimp/aabb.h b/include/assimp/aabb.h index fac77993d..b38aa1697 100644 --- a/include/assimp/aabb.h +++ b/include/assimp/aabb.h @@ -50,8 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include // --------------------------------------------------------------------------- -/** - * An axis-aligned bounding box. +/** + * An axis-aligned bounding box. */ struct aiAABB { C_STRUCT aiVector3D mMin; diff --git a/include/assimp/ai_assert.h b/include/assimp/ai_assert.h index b41c08f52..e49a482dd 100644 --- a/include/assimp/ai_assert.h +++ b/include/assimp/ai_assert.h @@ -55,7 +55,7 @@ namespace Assimp { /// @brief Assert violation behavior can be customized: see AssertHandler.h. /// @param failedExpression The expression to validate. -/// @param file The file location +/// @param file The file location /// @param line The line number ASSIMP_API void aiAssertViolation(const char* failedExpression, const char* file, int line); diff --git a/include/assimp/anim.h b/include/assimp/anim.h index ef56c1dc2..edb048f50 100644 --- a/include/assimp/anim.h +++ b/include/assimp/anim.h @@ -98,7 +98,7 @@ struct aiVectorKey { bool operator<(const aiVectorKey &rhs) const { return mTime < rhs.mTime; } - + bool operator>(const aiVectorKey &rhs) const { return mTime > rhs.mTime; } @@ -132,7 +132,7 @@ struct aiQuatKey { bool operator==(const aiQuatKey &rhs) const { return rhs.mValue == this->mValue; } - + bool operator!=(const aiQuatKey &rhs) const { return rhs.mValue != this->mValue; } @@ -141,7 +141,7 @@ struct aiQuatKey { bool operator<(const aiQuatKey &rhs) const { return mTime < rhs.mTime; } - + bool operator>(const aiQuatKey &rhs) const { return mTime > rhs.mTime; } diff --git a/include/assimp/defs.h b/include/assimp/defs.h index 0626a8d8a..ddb209bec 100644 --- a/include/assimp/defs.h +++ b/include/assimp/defs.h @@ -190,7 +190,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifdef __cplusplus /* No explicit 'struct' and 'enum' tags for C++, this keeps showing up - * in doxydocs. + * in doxydocs. */ #define C_STRUCT #define C_ENUM diff --git a/include/assimp/material.inl b/include/assimp/material.inl index 342c26646..744743bc7 100644 --- a/include/assimp/material.inl +++ b/include/assimp/material.inl @@ -100,7 +100,7 @@ AI_FORCE_INLINE aiReturn aiMaterial::Get(const char* pKey,unsigned int type, // std::min has in some cases a conflict with a defined min #ifdef min # undef min -#endif +#endif iNum = static_cast(std::min(static_cast(iNum),prop->mDataLength / sizeof(Type))); std::memcpy(pOut,prop->mData,iNum * sizeof(Type)); if (pMax) { @@ -227,8 +227,8 @@ AI_FORCE_INLINE aiReturn aiMaterial::Get(const char* pKey,unsigned int type, // --------------------------------------------------------------------------- template -aiReturn aiMaterial::AddProperty (const TYPE* pInput, - const unsigned int pNumValues, const char* pKey, unsigned int type, +aiReturn aiMaterial::AddProperty (const TYPE* pInput, + const unsigned int pNumValues, const char* pKey, unsigned int type, unsigned int index) { return AddBinaryProperty((const void*)pInput, pNumValues * sizeof(TYPE), pKey,type,index,aiPTI_Buffer); diff --git a/include/assimp/quaternion.inl b/include/assimp/quaternion.inl index 1b93be9ed..2cb24653c 100644 --- a/include/assimp/quaternion.inl +++ b/include/assimp/quaternion.inl @@ -237,7 +237,7 @@ inline void aiQuaterniont::Interpolate( aiQuaterniont& pOut, const aiQuat // Calculate coefficients TReal sclp, sclq; - + if ((static_cast(1.0) - cosom) > ai_epsilon) // 0.0001 -> some epsillon { // Standard case (slerp) diff --git a/include/assimp/scene.h b/include/assimp/scene.h index 9b173f939..1b830a5b0 100644 --- a/include/assimp/scene.h +++ b/include/assimp/scene.h @@ -450,7 +450,7 @@ struct aiScene }; #ifdef __cplusplus -} +} #endif //! extern "C" #endif // AI_SCENE_H_INC diff --git a/include/assimp/vector3.h b/include/assimp/vector3.h index a886def1d..5d0962b6a 100644 --- a/include/assimp/vector3.h +++ b/include/assimp/vector3.h @@ -70,17 +70,17 @@ class aiVector3t { public: /// @brief The default class constructor. aiVector3t() AI_NO_EXCEPT : x(), y(), z() {} - + /// @brief The class constructor with the components. /// @param _x The x-component for the vector. /// @param _y The y-component for the vector. /// @param _z The z-component for the vector. aiVector3t(TReal _x, TReal _y, TReal _z) : x(_x), y(_y), z(_z) {} - + /// @brief The class constructor with a default value. /// @param _xyz The value for x, y and z. explicit aiVector3t (TReal _xyz ) : x(_xyz), y(_xyz), z(_xyz) {} - + /// @brief The copy constructor. /// @param o The instance to copy from. aiVector3t( const aiVector3t& o ) = default; @@ -113,7 +113,7 @@ public: bool operator!= (const aiVector3t& other) const; bool operator < (const aiVector3t& other) const; - /// @brief + /// @brief bool Equal(const aiVector3t &other, TReal epsilon = ai_epsilon) const; template diff --git a/port/AndroidJNI/AndroidJNIIOSystem.cpp b/port/AndroidJNI/AndroidJNIIOSystem.cpp index e0f812362..4625d3f30 100644 --- a/port/AndroidJNI/AndroidJNIIOSystem.cpp +++ b/port/AndroidJNI/AndroidJNIIOSystem.cpp @@ -84,7 +84,7 @@ AndroidJNIIOSystem::~AndroidJNIIOSystem() { bool AndroidJNIIOSystem::Exists( const char* pFile) const { AAsset* asset = AAssetManager_open(mApkAssetManager, pFile, AASSET_MODE_UNKNOWN); FILE* file = ::fopen( (mApkWorkspacePath + getOsSeparator() + std::string(pFile)).c_str(), "rb"); - + if (!asset && !file) { __android_log_print(ANDROID_LOG_ERROR, "Assimp", "Asset manager can not find: %s", pFile); return false; @@ -94,7 +94,7 @@ bool AndroidJNIIOSystem::Exists( const char* pFile) const { if (file) { ::fclose( file); } - + return true; } @@ -140,7 +140,7 @@ bool AndroidJNIIOSystem::AndroidExtractAsset(std::string name) { __android_log_print(ANDROID_LOG_DEFAULT, "Assimp", "Asset already extracted"); return true; } - + // Open file AAsset* asset = AAssetManager_open(mApkAssetManager, name.c_str(), AASSET_MODE_UNKNOWN); @@ -182,7 +182,7 @@ bool AndroidJNIIOSystem::AndroidExtractAsset(std::string name) { __android_log_print(ANDROID_LOG_ERROR, "assimp", "Asset not found: %s", name.c_str()); return false; } - + return true; } diff --git a/port/jassimp/jassimp-native/src/jassimp.cpp b/port/jassimp/jassimp-native/src/jassimp.cpp index 6661ce9c4..979357b52 100644 --- a/port/jassimp/jassimp-native/src/jassimp.cpp +++ b/port/jassimp/jassimp-native/src/jassimp.cpp @@ -558,13 +558,13 @@ class JavaIOSystem : public Assimp::IOSystem { lprintf("NULL object from AiIOSystem.open\n"); return NULL; } - + size_t size = calli(mJniEnv, jStream, "jassimp/AiIOStream", "getFileSize", "()I"); lprintf("Model file size is %d\n", size); - + char* buffer = (char*)malloc(size); jobject javaBuffer = mJniEnv->NewDirectByteBuffer(buffer, size); - + jvalue readParams[1]; readParams[0].l = javaBuffer; if(call(mJniEnv, jStream, "jassimp/AiIOStream", "read", "(Ljava/nio/ByteBuffer;)Z", readParams)) diff --git a/test/unit/AssimpAPITest_aiQuaternion.cpp b/test/unit/AssimpAPITest_aiQuaternion.cpp index 7e93033cf..68daeefec 100644 --- a/test/unit/AssimpAPITest_aiQuaternion.cpp +++ b/test/unit/AssimpAPITest_aiQuaternion.cpp @@ -120,7 +120,7 @@ TEST_F(AssimpAPITest_aiQuaternion, aiQuaternionMultiplyTest) { result_c = result_cpp = random_quat(); result_cpp = result_cpp * temp; aiQuaternionMultiply(&result_c, &temp); - + EXPECT_FLOAT_EQ(result_cpp.x, result_c.x); EXPECT_FLOAT_EQ(result_cpp.y, result_c.y); EXPECT_FLOAT_EQ(result_cpp.z, result_c.z); diff --git a/test/unit/Common/uiScene.cpp b/test/unit/Common/uiScene.cpp index 87001cef4..509bf71b1 100644 --- a/test/unit/Common/uiScene.cpp +++ b/test/unit/Common/uiScene.cpp @@ -91,7 +91,7 @@ TEST_F(utScene, getShortFilenameTest) { TEST_F(utScene, deepCopyTest) { scene->mRootNode = new aiNode(); - + scene->mNumMeshes = 1; scene->mMeshes = new aiMesh *[scene->mNumMeshes] (); scene->mMeshes[0] = new aiMesh (); diff --git a/tools/assimp_cmd/Main.cpp b/tools/assimp_cmd/Main.cpp index c6349550f..06c44f029 100644 --- a/tools/assimp_cmd/Main.cpp +++ b/tools/assimp_cmd/Main.cpp @@ -303,7 +303,7 @@ const aiScene* ImportModel( const clock_t first = clock(); ConsoleProgressHandler *ph = new ConsoleProgressHandler; globalImporter->SetProgressHandler(ph); - + const aiScene* scene = globalImporter->ReadFile(path,imp.ppFlags); if (imp.showLog) { diff --git a/tools/assimp_view/MaterialManager.h b/tools/assimp_view/MaterialManager.h index 625cae27e..b708fb337 100644 --- a/tools/assimp_view/MaterialManager.h +++ b/tools/assimp_view/MaterialManager.h @@ -73,7 +73,7 @@ public: /// A shader is considered to be identical if it has the same input /// signature and takes the same number of texture channels. int CreateMaterial(AssetHelper::MeshHelper *pcMesh, const aiMesh *pcSource); - + /// @brief Setup the material for a given mesh. /// @param pcMesh Mesh to be rendered /// @param pcProj Projection matrix From 39cbef1e21c2910366e58d28f2d955030e04bac6 Mon Sep 17 00:00:00 2001 From: shimaowo <45767709+shimaowo@users.noreply.github.com> Date: Mon, 16 Jan 2023 11:39:13 -0800 Subject: [PATCH 07/15] Fix: fix incorrect math for calculating the horizontal FOV of a perspective camera in GLTF2 import #4435 --- code/AssetLib/glTF2/glTF2Importer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/AssetLib/glTF2/glTF2Importer.cpp b/code/AssetLib/glTF2/glTF2Importer.cpp index 7d3a4b9fe..0cf5472d6 100644 --- a/code/AssetLib/glTF2/glTF2Importer.cpp +++ b/code/AssetLib/glTF2/glTF2Importer.cpp @@ -853,7 +853,7 @@ void glTF2Importer::ImportCameras(glTF2::Asset &r) { if (cam.type == Camera::Perspective) { aicam->mAspect = cam.cameraProperties.perspective.aspectRatio; - aicam->mHorizontalFOV = cam.cameraProperties.perspective.yfov * ((aicam->mAspect == 0.f) ? 1.f : aicam->mAspect); + aicam->mHorizontalFOV = 2.0f * std::atan(std::tan(cam.cameraProperties.perspective.yfov * 0.5f) * (aicam->mAspect == 0.f) ? 1.f : aicam->mAspect); aicam->mClipPlaneFar = cam.cameraProperties.perspective.zfar; aicam->mClipPlaneNear = cam.cameraProperties.perspective.znear; } else { From 43a062a5d7f867b71e0aed2d2906855ecf473838 Mon Sep 17 00:00:00 2001 From: Krishty Date: Mon, 16 Jan 2023 20:45:00 +0100 Subject: [PATCH 08/15] Remove Stray Semicolon --- code/AssetLib/glTF2/glTF2Importer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/code/AssetLib/glTF2/glTF2Importer.cpp b/code/AssetLib/glTF2/glTF2Importer.cpp index 7d3a4b9fe..a6674ccb3 100644 --- a/code/AssetLib/glTF2/glTF2Importer.cpp +++ b/code/AssetLib/glTF2/glTF2Importer.cpp @@ -185,7 +185,6 @@ static void SetMaterialTextureProperty(std::vector &embeddedTexIdxs, Asset const ai_real rsin(sin(-transform.mRotation)); transform.mTranslation.x = (static_cast(0.5) * transform.mScaling.x) * (-rcos + rsin + 1) + prop.TextureTransformExt_t.offset[0]; transform.mTranslation.y = ((static_cast(0.5) * transform.mScaling.y) * (rsin + rcos - 1)) + 1 - transform.mScaling.y - prop.TextureTransformExt_t.offset[1]; - ; mat->AddProperty(&transform, 1, _AI_MATKEY_UVTRANSFORM_BASE, texType, texSlot); } From 36305cf987788b01c64dcd891584e11cf7c205c0 Mon Sep 17 00:00:00 2001 From: Krishty Date: Mon, 16 Jan 2023 21:47:11 +0100 Subject: [PATCH 09/15] Tidy Up Constructors and Destructors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit does not add or remove c’tors or d’tors, so it is *not* ABI-breaking. If a c’tor/d’tor does nothing else than the default behavior, this commit replaces it with “= default”. If an initializer list entry does nothing else than the default behavior, this commit removes it. First and foremost, remove default c’tor calls of base classes (always called by the compiler if no other base c’tor is explicitly called) and c’tor calls of members with complex types (e.g. “std::vector”). In a few instances, user-defined copy c’tors / move c’tors / assignment operators / move assignment operators were replaced with “= default”, too. I only did this if I had a clear understanding of what’s going on. --- code/AssetLib/3DS/3DSHelper.h | 125 ++----------------- code/AssetLib/3MF/3MFTypes.h | 4 +- code/AssetLib/3MF/D3MFExporter.cpp | 2 +- code/AssetLib/AMF/AMFImporter.cpp | 6 +- code/AssetLib/AMF/AMFImporter_Node.hpp | 10 +- code/AssetLib/Blender/BlenderDNA.h | 4 +- code/AssetLib/Blender/BlenderModifier.h | 4 +- code/AssetLib/Blender/BlenderScene.h | 25 ++-- code/AssetLib/Blender/BlenderTessellator.cpp | 4 +- code/AssetLib/C4D/C4DImporter.cpp | 9 +- code/AssetLib/Collada/ColladaLoader.cpp | 9 -- code/AssetLib/DXF/DXFHelper.h | 4 +- code/AssetLib/FBX/FBXExportNode.h | 4 - code/AssetLib/FBX/FBXImporter.cpp | 5 +- code/AssetLib/Irr/IRRMeshLoader.cpp | 6 +- code/AssetLib/Irr/IRRShared.h | 4 +- code/AssetLib/M3D/M3DImporter.h | 2 +- code/AssetLib/OpenGEX/OpenGEXImporter.cpp | 1 - code/AssetLib/Ply/PlyParser.h | 20 +-- code/AssetLib/Q3BSP/Q3BSPFileData.h | 14 +-- code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp | 2 +- code/AssetLib/SMD/SMDLoader.cpp | 1 - code/AssetLib/SMD/SMDLoader.h | 2 +- code/AssetLib/X/XFileHelper.h | 23 +--- code/AssetLib/X/XFileImporter.cpp | 4 +- code/AssetLib/X3D/X3DExporter.hpp | 12 +- code/AssetLib/X3D/X3DImporter_Node.hpp | 8 +- code/AssetLib/glTF/glTFAsset.h | 8 +- code/AssetLib/glTF/glTFImporter.cpp | 2 +- code/AssetLib/glTF2/glTF2Asset.h | 14 +-- code/AssetLib/glTF2/glTF2Importer.cpp | 3 - code/Common/FileSystemFilter.h | 4 +- include/assimp/IOStream.hpp | 4 +- include/assimp/IOStreamBuffer.h | 4 +- include/assimp/IOSystem.hpp | 5 +- include/assimp/LineSplitter.h | 5 +- include/assimp/MemoryIOWrapper.h | 3 +- include/assimp/Profiler.h | 4 +- include/assimp/ProgressHandler.hpp | 8 +- include/assimp/SceneCombiner.h | 8 +- 40 files changed, 63 insertions(+), 323 deletions(-) diff --git a/code/AssetLib/3DS/3DSHelper.h b/code/AssetLib/3DS/3DSHelper.h index dc1098035..06c36bfeb 100644 --- a/code/AssetLib/3DS/3DSHelper.h +++ b/code/AssetLib/3DS/3DSHelper.h @@ -322,7 +322,6 @@ struct Texture { //! Default constructor Texture() AI_NO_EXCEPT : mTextureBlend(0.0f), - mMapName(), mOffsetU(0.0), mOffsetV(0.0), mScaleU(1.0), @@ -334,51 +333,11 @@ struct Texture { mTextureBlend = get_qnan(); } - Texture(const Texture &other) : - mTextureBlend(other.mTextureBlend), - mMapName(other.mMapName), - mOffsetU(other.mOffsetU), - mOffsetV(other.mOffsetV), - mScaleU(other.mScaleU), - mScaleV(other.mScaleV), - mRotation(other.mRotation), - mMapMode(other.mMapMode), - bPrivate(other.bPrivate), - iUVSrc(other.iUVSrc) { - // empty - } + Texture(const Texture &other) = default; - Texture(Texture &&other) AI_NO_EXCEPT : mTextureBlend(other.mTextureBlend), - mMapName(std::move(other.mMapName)), - mOffsetU(other.mOffsetU), - mOffsetV(other.mOffsetV), - mScaleU(other.mScaleU), - mScaleV(other.mScaleV), - mRotation(other.mRotation), - mMapMode(other.mMapMode), - bPrivate(other.bPrivate), - iUVSrc(other.iUVSrc) { - // empty - } + Texture(Texture &&other) AI_NO_EXCEPT = default; - Texture &operator=(Texture &&other) AI_NO_EXCEPT { - if (this == &other) { - return *this; - } - - mTextureBlend = other.mTextureBlend; - mMapName = std::move(other.mMapName); - mOffsetU = other.mOffsetU; - mOffsetV = other.mOffsetV; - mScaleU = other.mScaleU; - mScaleV = other.mScaleV; - mRotation = other.mRotation; - mMapMode = other.mMapMode; - bPrivate = other.bPrivate; - iUVSrc = other.iUVSrc; - - return *this; - } + Texture &operator=(Texture &&other) AI_NO_EXCEPT = default; //! Specifies the blend factor for the texture ai_real mTextureBlend; @@ -436,83 +395,13 @@ struct Material { // empty } - Material(const Material &other) : - mName(other.mName), - mDiffuse(other.mDiffuse), - mSpecularExponent(other.mSpecularExponent), - mShininessStrength(other.mShininessStrength), - mSpecular(other.mSpecular), - mAmbient(other.mAmbient), - mShading(other.mShading), - mTransparency(other.mTransparency), - sTexDiffuse(other.sTexDiffuse), - sTexOpacity(other.sTexOpacity), - sTexSpecular(other.sTexSpecular), - sTexReflective(other.sTexReflective), - sTexBump(other.sTexBump), - sTexEmissive(other.sTexEmissive), - sTexShininess(other.sTexShininess), - mBumpHeight(other.mBumpHeight), - mEmissive(other.mEmissive), - sTexAmbient(other.sTexAmbient), - mTwoSided(other.mTwoSided) { - // empty - } + Material(const Material &other) = default; - //! Move constructor. This is explicitly written because MSVC doesn't support defaulting it - Material(Material &&other) AI_NO_EXCEPT : mName(std::move(other.mName)), - mDiffuse(other.mDiffuse), - mSpecularExponent(other.mSpecularExponent), - mShininessStrength(other.mShininessStrength), - mSpecular(other.mSpecular), - mAmbient(other.mAmbient), - mShading(other.mShading), - mTransparency(other.mTransparency), - sTexDiffuse(std::move(other.sTexDiffuse)), - sTexOpacity(std::move(other.sTexOpacity)), - sTexSpecular(std::move(other.sTexSpecular)), - sTexReflective(std::move(other.sTexReflective)), - sTexBump(std::move(other.sTexBump)), - sTexEmissive(std::move(other.sTexEmissive)), - sTexShininess(std::move(other.sTexShininess)), - mBumpHeight(other.mBumpHeight), - mEmissive(other.mEmissive), - sTexAmbient(std::move(other.sTexAmbient)), - mTwoSided(other.mTwoSided) { - // empty - } + Material(Material &&other) AI_NO_EXCEPT = default; - Material &operator=(Material &&other) AI_NO_EXCEPT { - if (this == &other) { - return *this; - } + Material &operator=(Material &&other) AI_NO_EXCEPT = default; - mName = std::move(other.mName); - mDiffuse = other.mDiffuse; - mSpecularExponent = other.mSpecularExponent; - mShininessStrength = other.mShininessStrength, - mSpecular = other.mSpecular; - mAmbient = other.mAmbient; - mShading = other.mShading; - mTransparency = other.mTransparency; - sTexDiffuse = std::move(other.sTexDiffuse); - sTexOpacity = std::move(other.sTexOpacity); - sTexSpecular = std::move(other.sTexSpecular); - sTexReflective = std::move(other.sTexReflective); - sTexBump = std::move(other.sTexBump); - sTexEmissive = std::move(other.sTexEmissive); - sTexShininess = std::move(other.sTexShininess); - mBumpHeight = other.mBumpHeight; - mEmissive = other.mEmissive; - sTexAmbient = std::move(other.sTexAmbient); - mTwoSided = other.mTwoSided; - - return *this; - } - - virtual ~Material() { - // empty - } + virtual ~Material() = default; //! Name of the material std::string mName; diff --git a/code/AssetLib/3MF/3MFTypes.h b/code/AssetLib/3MF/3MFTypes.h index 987cdf613..02238ceab 100644 --- a/code/AssetLib/3MF/3MFTypes.h +++ b/code/AssetLib/3MF/3MFTypes.h @@ -69,9 +69,7 @@ public: // empty } - virtual ~Resource() { - // empty - } + virtual ~Resource() = default; virtual ResourceType getType() const { return ResourceType::RT_Unknown; diff --git a/code/AssetLib/3MF/D3MFExporter.cpp b/code/AssetLib/3MF/D3MFExporter.cpp index 42cd991e6..4ba3bbf24 100644 --- a/code/AssetLib/3MF/D3MFExporter.cpp +++ b/code/AssetLib/3MF/D3MFExporter.cpp @@ -83,7 +83,7 @@ void ExportScene3MF(const char *pFile, IOSystem *pIOSystem, const aiScene *pScen namespace D3MF { D3MFExporter::D3MFExporter(const char *pFile, const aiScene *pScene) : - mArchiveName(pFile), m_zipArchive(nullptr), mScene(pScene), mModelOutput(), mRelOutput(), mContentOutput(), mBuildItems(), mRelations() { + mArchiveName(pFile), m_zipArchive(nullptr), mScene(pScene) { // empty } diff --git a/code/AssetLib/AMF/AMFImporter.cpp b/code/AssetLib/AMF/AMFImporter.cpp index b95fdf540..ff581b492 100644 --- a/code/AssetLib/AMF/AMFImporter.cpp +++ b/code/AssetLib/AMF/AMFImporter.cpp @@ -83,11 +83,7 @@ void AMFImporter::Clear() { AMFImporter::AMFImporter() AI_NO_EXCEPT : mNodeElement_Cur(nullptr), - mXmlParser(nullptr), - mUnit(), - mVersion(), - mMaterial_Converted(), - mTexture_Converted() { + mXmlParser(nullptr) { // empty } diff --git a/code/AssetLib/AMF/AMFImporter_Node.hpp b/code/AssetLib/AMF/AMFImporter_Node.hpp index c827533a6..dd27316d3 100644 --- a/code/AssetLib/AMF/AMFImporter_Node.hpp +++ b/code/AssetLib/AMF/AMFImporter_Node.hpp @@ -88,9 +88,7 @@ public: std::list Child; ///< Child elements. public: /// Destructor, virtual.. - virtual ~AMFNodeElementBase() { - // empty - } + virtual ~AMFNodeElementBase() = default; /// Disabled copy constructor and co. AMFNodeElementBase(const AMFNodeElementBase &pNodeElement) = delete; @@ -103,7 +101,7 @@ protected: /// \param [in] pType - element type. /// \param [in] pParent - parent element. AMFNodeElementBase(const EType pType, AMFNodeElementBase *pParent) : - Type(pType), ID(), Parent(pParent), Child() { + Type(pType), Parent(pParent) { // empty } }; // class IAMFImporter_NodeElement @@ -174,7 +172,7 @@ struct AMFColor : public AMFNodeElementBase { /// @brief Constructor. /// @param [in] pParent - pointer to parent node. AMFColor(AMFNodeElementBase *pParent) : - AMFNodeElementBase(ENET_Color, pParent), Composed(false), Color(), Profile() { + AMFNodeElementBase(ENET_Color, pParent), Composed(false), Color() { // empty } }; @@ -270,7 +268,7 @@ struct AMFTexMap : public AMFNodeElementBase { /// Constructor. /// \param [in] pParent - pointer to parent node. AMFTexMap(AMFNodeElementBase *pParent) : - AMFNodeElementBase(ENET_TexMap, pParent), TextureCoordinate{}, TextureID_R(), TextureID_G(), TextureID_B(), TextureID_A() { + AMFNodeElementBase(ENET_TexMap, pParent), TextureCoordinate{} { // empty } }; diff --git a/code/AssetLib/Blender/BlenderDNA.h b/code/AssetLib/Blender/BlenderDNA.h index dcae3198b..494dc4b34 100644 --- a/code/AssetLib/Blender/BlenderDNA.h +++ b/code/AssetLib/Blender/BlenderDNA.h @@ -106,9 +106,7 @@ struct ElemBase { // empty } - virtual ~ElemBase() { - // empty - } + virtual ~ElemBase() = default; /** Type name of the element. The type * string points is the `c_str` of the `name` attribute of the diff --git a/code/AssetLib/Blender/BlenderModifier.h b/code/AssetLib/Blender/BlenderModifier.h index 5af560caf..180a456a1 100644 --- a/code/AssetLib/Blender/BlenderModifier.h +++ b/code/AssetLib/Blender/BlenderModifier.h @@ -62,9 +62,7 @@ public: /** * The class destructor, virtual. */ - virtual ~BlenderModifier() { - // empty - } + virtual ~BlenderModifier() = default; // -------------------- /** diff --git a/code/AssetLib/Blender/BlenderScene.h b/code/AssetLib/Blender/BlenderScene.h index 436e47061..ba7ded909 100644 --- a/code/AssetLib/Blender/BlenderScene.h +++ b/code/AssetLib/Blender/BlenderScene.h @@ -182,7 +182,7 @@ struct MVert : ElemBase { int bweight; MVert() : - ElemBase(), flag(0), mat_nr(0), bweight(0) {} + flag(0), mat_nr(0), bweight(0) {} }; // ------------------------------------------------------------------------------- @@ -417,7 +417,6 @@ struct CustomDataLayer : ElemBase { std::shared_ptr data; // must be converted to real type according type member CustomDataLayer() : - ElemBase(), type(0), offset(0), flag(0), @@ -729,7 +728,7 @@ struct Object : ElemBase { ListBase modifiers; Object() : - ElemBase(), type(Type_EMPTY), parent(nullptr), track(), proxy(), proxy_from(), data() { + type(Type_EMPTY), parent(nullptr) { // empty } }; @@ -741,8 +740,7 @@ struct Base : ElemBase { std::shared_ptr object WARN; Base() : - ElemBase(), prev(nullptr), next(), object() { - // empty + prev(nullptr) { // empty } }; @@ -758,10 +756,7 @@ struct Scene : ElemBase { ListBase base; - Scene() : - ElemBase(), camera(), world(), basact(), master_collection() { - // empty - } + Scene() = default; }; // ------------------------------------------------------------------------------- @@ -791,10 +786,7 @@ struct Image : ElemBase { short gen_x, gen_y, gen_type; - Image() : - ElemBase() { - // empty - } + Image() = default; }; // ------------------------------------------------------------------------------- @@ -884,7 +876,7 @@ struct Tex : ElemBase { //char use_nodes; Tex() : - ElemBase(), imaflag(ImageFlags_INTERPOL), type(Type_CLOUDS), ima() { + imaflag(ImageFlags_INTERPOL), type(Type_CLOUDS) { // empty } }; @@ -976,10 +968,7 @@ struct MTex : ElemBase { //float shadowfac; //float zenupfac, zendownfac, blendfac; - MTex() : - ElemBase() { - // empty - } + MTex() = default; }; } // namespace Blender diff --git a/code/AssetLib/Blender/BlenderTessellator.cpp b/code/AssetLib/Blender/BlenderTessellator.cpp index d3ef5ae5e..40117a974 100644 --- a/code/AssetLib/Blender/BlenderTessellator.cpp +++ b/code/AssetLib/Blender/BlenderTessellator.cpp @@ -81,9 +81,7 @@ BlenderTessellatorGL::BlenderTessellatorGL( BlenderBMeshConverter& converter ): } // ------------------------------------------------------------------------------------------------ -BlenderTessellatorGL::~BlenderTessellatorGL( ) -{ -} +BlenderTessellatorGL::~BlenderTessellatorGL() = default; // ------------------------------------------------------------------------------------------------ void BlenderTessellatorGL::Tessellate( const MLoop* polyLoop, int vertexCount, const std::vector< MVert >& vertices ) diff --git a/code/AssetLib/C4D/C4DImporter.cpp b/code/AssetLib/C4D/C4DImporter.cpp index 06d7a3412..9a3a72667 100644 --- a/code/AssetLib/C4D/C4DImporter.cpp +++ b/code/AssetLib/C4D/C4DImporter.cpp @@ -106,15 +106,10 @@ static const aiImporterDesc desc = { // ------------------------------------------------------------------------------------------------ -C4DImporter::C4DImporter() -: BaseImporter() { - // empty -} +C4DImporter::C4DImporter() = default; // ------------------------------------------------------------------------------------------------ -C4DImporter::~C4DImporter() { - // empty -} +C4DImporter::~C4DImporter() = default; // ------------------------------------------------------------------------------------------------ bool C4DImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, bool /*checkSig*/) const { diff --git a/code/AssetLib/Collada/ColladaLoader.cpp b/code/AssetLib/Collada/ColladaLoader.cpp index 2d578aff3..1280fd0d1 100644 --- a/code/AssetLib/Collada/ColladaLoader.cpp +++ b/code/AssetLib/Collada/ColladaLoader.cpp @@ -92,15 +92,6 @@ inline void AddNodeMetaData(aiNode *node, const std::string &key, const T &value // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer ColladaLoader::ColladaLoader() : - mFileName(), - mMeshIndexByID(), - mMaterialIndexByName(), - mMeshes(), - newMats(), - mCameras(), - mLights(), - mTextures(), - mAnims(), noSkeletonMesh(false), removeEmptyBones(false), ignoreUpDirection(false), diff --git a/code/AssetLib/DXF/DXFHelper.h b/code/AssetLib/DXF/DXFHelper.h index e50c471d2..4d7893cc4 100644 --- a/code/AssetLib/DXF/DXFHelper.h +++ b/code/AssetLib/DXF/DXFHelper.h @@ -65,7 +65,6 @@ public: LineReader(StreamReaderLE& reader) : splitter(reader,false,true) , groupcode( 0 ) - , value() , end() { // empty } @@ -186,8 +185,7 @@ struct InsertBlock { InsertBlock() : pos() , scale(1.f,1.f,1.f) - , angle() - , name() { + , angle() { // empty } diff --git a/code/AssetLib/FBX/FBXExportNode.h b/code/AssetLib/FBX/FBXExportNode.h index 62c06e16b..99644b216 100644 --- a/code/AssetLib/FBX/FBXExportNode.h +++ b/code/AssetLib/FBX/FBXExportNode.h @@ -77,8 +77,6 @@ public: // constructors /// The class constructor with the name. Node(const std::string& n) : name(n) - , properties() - , children() , force_has_children( false ) { // empty } @@ -87,8 +85,6 @@ public: // constructors template Node(const std::string& n, More&&... more) : name(n) - , properties() - , children() , force_has_children(false) { AddProperties(std::forward(more)...); } diff --git a/code/AssetLib/FBX/FBXImporter.cpp b/code/AssetLib/FBX/FBXImporter.cpp index 7ff194905..6a727c3d7 100644 --- a/code/AssetLib/FBX/FBXImporter.cpp +++ b/code/AssetLib/FBX/FBXImporter.cpp @@ -90,10 +90,7 @@ static const aiImporterDesc desc = { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by #Importer -FBXImporter::FBXImporter() : - mSettings() { - // empty -} +FBXImporter::FBXImporter() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. diff --git a/code/AssetLib/Irr/IRRMeshLoader.cpp b/code/AssetLib/Irr/IRRMeshLoader.cpp index 9b4faec83..52fb82ff9 100644 --- a/code/AssetLib/Irr/IRRMeshLoader.cpp +++ b/code/AssetLib/Irr/IRRMeshLoader.cpp @@ -71,11 +71,7 @@ static const aiImporterDesc desc = { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer -IRRMeshImporter::IRRMeshImporter() : - BaseImporter(), - IrrlichtBase() { - // empty -} +IRRMeshImporter::IRRMeshImporter() = default; // ------------------------------------------------------------------------------------------------ // Destructor, private as well diff --git a/code/AssetLib/Irr/IRRShared.h b/code/AssetLib/Irr/IRRShared.h index 90e212d65..ee1309e14 100644 --- a/code/AssetLib/Irr/IRRShared.h +++ b/code/AssetLib/Irr/IRRShared.h @@ -63,9 +63,7 @@ protected: // empty } - ~IrrlichtBase() { - // empty - } + ~IrrlichtBase() = default; /** @brief Data structure for a simple name-value property */ diff --git a/code/AssetLib/M3D/M3DImporter.h b/code/AssetLib/M3D/M3DImporter.h index 5d3fcaa7b..9ca8f9211 100644 --- a/code/AssetLib/M3D/M3DImporter.h +++ b/code/AssetLib/M3D/M3DImporter.h @@ -65,7 +65,7 @@ class M3DImporter : public BaseImporter { public: /// \brief Default constructor M3DImporter(); - ~M3DImporter() override {} + ~M3DImporter() override = default; /// \brief Returns whether the class can handle the format of the given file. /// \remark See BaseImporter::CanRead() for details. diff --git a/code/AssetLib/OpenGEX/OpenGEXImporter.cpp b/code/AssetLib/OpenGEX/OpenGEXImporter.cpp index 2883f9612..1bd981656 100644 --- a/code/AssetLib/OpenGEX/OpenGEXImporter.cpp +++ b/code/AssetLib/OpenGEX/OpenGEXImporter.cpp @@ -261,7 +261,6 @@ OpenGEXImporter::RefInfo::RefInfo(aiNode *node, Type type, std::vector alProperties; @@ -386,10 +381,7 @@ class ElementInstanceList public: //! Default constructor - ElementInstanceList() AI_NO_EXCEPT - : alInstances() { - // empty - } + ElementInstanceList() AI_NO_EXCEPT = default; //! List of all element instances std::vector< ElementInstance > alInstances; @@ -413,11 +405,7 @@ class DOM public: //! Default constructor - DOM() AI_NO_EXCEPT - : alElements() - , alElementData() { - - } + DOM() AI_NO_EXCEPT = default; //! Contains all elements of the file format diff --git a/code/AssetLib/Q3BSP/Q3BSPFileData.h b/code/AssetLib/Q3BSP/Q3BSPFileData.h index 8ccee0b0a..086cf7842 100644 --- a/code/AssetLib/Q3BSP/Q3BSPFileData.h +++ b/code/AssetLib/Q3BSP/Q3BSPFileData.h @@ -169,19 +169,7 @@ struct Q3BSPModel { std::vector m_EntityData; std::string m_ModelName; - Q3BSPModel() : - m_Data(), - m_Lumps(), - m_Vertices(), - m_Faces(), - m_Indices(), - m_Textures(), - m_Lightmaps(), - m_EntityData(), - m_ModelName() - { - // empty - } + Q3BSPModel() = default; ~Q3BSPModel() { for ( unsigned int i=0; i mMeshes; Node() AI_NO_EXCEPT - : mName(), - mTrafoMatrix(), - mParent(nullptr), - mChildren(), - mMeshes() { + : mTrafoMatrix(), + mParent(nullptr) { // empty } explicit Node(Node *pParent) : - mName(), mTrafoMatrix(), mParent(pParent), mChildren(), mMeshes() { + mTrafoMatrix(), mParent(pParent) { // empty } @@ -211,8 +198,6 @@ struct Scene { Scene() AI_NO_EXCEPT : mRootNode(nullptr), - mGlobalMeshes(), - mGlobalMaterials(), mAnimTicksPerSecond(0) { // empty } diff --git a/code/AssetLib/X/XFileImporter.cpp b/code/AssetLib/X/XFileImporter.cpp index 8bd5d9e88..32865e8a8 100644 --- a/code/AssetLib/X/XFileImporter.cpp +++ b/code/AssetLib/X/XFileImporter.cpp @@ -75,9 +75,7 @@ static const aiImporterDesc desc = { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer -XFileImporter::XFileImporter() : mBuffer() { - // empty -} +XFileImporter::XFileImporter() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. diff --git a/code/AssetLib/X3D/X3DExporter.hpp b/code/AssetLib/X3D/X3DExporter.hpp index 7a87821b4..e77aa6877 100644 --- a/code/AssetLib/X3D/X3DExporter.hpp +++ b/code/AssetLib/X3D/X3DExporter.hpp @@ -52,22 +52,14 @@ class X3DExporter { struct SAttribute { const std::string Name; const std::string Value; - SAttribute() : - Name(), - Value() { - // empty - } + SAttribute() = default; SAttribute(const std::string &name, const std::string &value) : Name(name), Value(value) { // empty } - SAttribute(SAttribute &&rhs) AI_NO_EXCEPT : - Name(rhs.Name), - Value(rhs.Value) { - // empty - } + SAttribute(SAttribute &&rhs) AI_NO_EXCEPT = default; }; /***********************************************/ diff --git a/code/AssetLib/X3D/X3DImporter_Node.hpp b/code/AssetLib/X3D/X3DImporter_Node.hpp index 8d33c4b7a..62bf857e4 100644 --- a/code/AssetLib/X3D/X3DImporter_Node.hpp +++ b/code/AssetLib/X3D/X3DImporter_Node.hpp @@ -108,9 +108,7 @@ struct X3DNodeElementBase { std::list Children; X3DElemType Type; - virtual ~X3DNodeElementBase() { - // empty - } + virtual ~X3DNodeElementBase() = default; protected: X3DNodeElementBase(X3DElemType type, X3DNodeElementBase *pParent) : @@ -367,9 +365,7 @@ struct X3DNodeElementMeta : X3DNodeElementBase { std::string Name; ///< Name of metadata object. std::string Reference; - virtual ~X3DNodeElementMeta() { - // empty - } + virtual ~X3DNodeElementMeta() = default; protected: X3DNodeElementMeta(X3DElemType type, X3DNodeElementBase *parent) : diff --git a/code/AssetLib/glTF/glTFAsset.h b/code/AssetLib/glTF/glTFAsset.h index 26ef239cd..955dea40f 100644 --- a/code/AssetLib/glTF/glTFAsset.h +++ b/code/AssetLib/glTF/glTFAsset.h @@ -629,9 +629,7 @@ struct Mesh : public Object { SExtension(const EType pType) : Type(pType) {} - virtual ~SExtension() { - // empty - } + virtual ~SExtension() = default; }; #ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC @@ -657,9 +655,7 @@ struct Mesh : public Object { // empty } - virtual ~SCompression_Open3DGC() { - // empty - } + virtual ~SCompression_Open3DGC() = default; }; #endif diff --git a/code/AssetLib/glTF/glTFImporter.cpp b/code/AssetLib/glTF/glTFImporter.cpp index 3a5b0ef3c..61c11f594 100644 --- a/code/AssetLib/glTF/glTFImporter.cpp +++ b/code/AssetLib/glTF/glTFImporter.cpp @@ -80,7 +80,7 @@ static const aiImporterDesc desc = { }; glTFImporter::glTFImporter() : - BaseImporter(), meshOffsets(), embeddedTexIdxs(), mScene(nullptr) { + mScene(nullptr) { // empty } diff --git a/code/AssetLib/glTF2/glTF2Asset.h b/code/AssetLib/glTF2/glTF2Asset.h index 85af49acf..e8d1d88d1 100644 --- a/code/AssetLib/glTF2/glTF2Asset.h +++ b/code/AssetLib/glTF2/glTF2Asset.h @@ -365,16 +365,7 @@ struct CustomExtension { ~CustomExtension() = default; - CustomExtension(const CustomExtension &other) : - name(other.name), - mStringValue(other.mStringValue), - mDoubleValue(other.mDoubleValue), - mUint64Value(other.mUint64Value), - mInt64Value(other.mInt64Value), - mBoolValue(other.mBoolValue), - mValues(other.mValues) { - // empty - } + CustomExtension(const CustomExtension &other) = default; CustomExtension& operator=(const CustomExtension&) = default; }; @@ -1086,8 +1077,7 @@ struct AssetMetadata { void Read(Document &doc); - AssetMetadata() : - version() {} + AssetMetadata() = default; }; // diff --git a/code/AssetLib/glTF2/glTF2Importer.cpp b/code/AssetLib/glTF2/glTF2Importer.cpp index 7d3a4b9fe..d6b65b458 100644 --- a/code/AssetLib/glTF2/glTF2Importer.cpp +++ b/code/AssetLib/glTF2/glTF2Importer.cpp @@ -96,9 +96,6 @@ static const aiImporterDesc desc = { }; glTF2Importer::glTF2Importer() : - BaseImporter(), - meshOffsets(), - mEmbeddedTexIdxs(), mScene(nullptr) { // empty } diff --git a/code/Common/FileSystemFilter.h b/code/Common/FileSystemFilter.h index 9ab3812e2..d28233ae9 100644 --- a/code/Common/FileSystemFilter.h +++ b/code/Common/FileSystemFilter.h @@ -93,9 +93,7 @@ public: } /** Destructor. */ - ~FileSystemFilter() { - // empty - } + ~FileSystemFilter() = default; // ------------------------------------------------------------------- /** Tests for the existence of a file at the given path. */ diff --git a/include/assimp/IOStream.hpp b/include/assimp/IOStream.hpp index 3b9b3c3f8..12beb0dbb 100644 --- a/include/assimp/IOStream.hpp +++ b/include/assimp/IOStream.hpp @@ -128,9 +128,7 @@ public: // ---------------------------------------------------------------------------------- AI_FORCE_INLINE -IOStream::IOStream() AI_NO_EXCEPT { - // empty -} +IOStream::IOStream() AI_NO_EXCEPT = default; // ---------------------------------------------------------------------------------- AI_FORCE_INLINE diff --git a/include/assimp/IOStreamBuffer.h b/include/assimp/IOStreamBuffer.h index 09ca1c962..b34fc9ee1 100644 --- a/include/assimp/IOStreamBuffer.h +++ b/include/assimp/IOStreamBuffer.h @@ -141,9 +141,7 @@ AI_FORCE_INLINE IOStreamBuffer::IOStreamBuffer(size_t cache) : } template -AI_FORCE_INLINE IOStreamBuffer::~IOStreamBuffer() { - // empty -} +AI_FORCE_INLINE IOStreamBuffer::~IOStreamBuffer() = default; template AI_FORCE_INLINE bool IOStreamBuffer::open(IOStream *stream) { diff --git a/include/assimp/IOSystem.hpp b/include/assimp/IOSystem.hpp index b4531f96a..30f48b81c 100644 --- a/include/assimp/IOSystem.hpp +++ b/include/assimp/IOSystem.hpp @@ -237,10 +237,7 @@ private: }; // ---------------------------------------------------------------------------- -AI_FORCE_INLINE IOSystem::IOSystem() AI_NO_EXCEPT : - m_pathStack() { - // empty -} +AI_FORCE_INLINE IOSystem::IOSystem() AI_NO_EXCEPT = default; // ---------------------------------------------------------------------------- AI_FORCE_INLINE IOSystem::~IOSystem() = default; diff --git a/include/assimp/LineSplitter.h b/include/assimp/LineSplitter.h index a8aa665db..379821f03 100644 --- a/include/assimp/LineSplitter.h +++ b/include/assimp/LineSplitter.h @@ -145,7 +145,6 @@ private: AI_FORCE_INLINE LineSplitter::LineSplitter(StreamReaderLE& stream, bool skip_empty_lines, bool trim ) : mIdx(0), - mCur(), mStream(stream), mSwallow(), mSkip_empty_lines(skip_empty_lines), @@ -155,9 +154,7 @@ AI_FORCE_INLINE LineSplitter::LineSplitter(StreamReaderLE& stream, bool skip_emp mIdx = 0; } -AI_FORCE_INLINE LineSplitter::~LineSplitter() { - // empty -} +AI_FORCE_INLINE LineSplitter::~LineSplitter() = default; AI_FORCE_INLINE LineSplitter& LineSplitter::operator++() { if (mSwallow) { diff --git a/include/assimp/MemoryIOWrapper.h b/include/assimp/MemoryIOWrapper.h index b4c37763d..0bd3bc108 100644 --- a/include/assimp/MemoryIOWrapper.h +++ b/include/assimp/MemoryIOWrapper.h @@ -162,8 +162,7 @@ public: } /** Destructor. */ - ~MemoryIOSystem() { - } + ~MemoryIOSystem() = default; // ------------------------------------------------------------------- /** Tests for the existence of a file at the given path. */ diff --git a/include/assimp/Profiler.h b/include/assimp/Profiler.h index fe0ffbb10..3b9263b40 100644 --- a/include/assimp/Profiler.h +++ b/include/assimp/Profiler.h @@ -68,9 +68,7 @@ using namespace Formatter; */ class Profiler { public: - Profiler() { - // empty - } + Profiler() = default; /** Start a named timer */ diff --git a/include/assimp/ProgressHandler.hpp b/include/assimp/ProgressHandler.hpp index 1a272bb87..93d881659 100644 --- a/include/assimp/ProgressHandler.hpp +++ b/include/assimp/ProgressHandler.hpp @@ -67,15 +67,11 @@ class ASSIMP_API ProgressHandler { protected: /// @brief Default constructor - ProgressHandler () AI_NO_EXCEPT { - // empty - } + ProgressHandler () AI_NO_EXCEPT = default; public: /// @brief Virtual destructor. - virtual ~ProgressHandler () { - // empty - } + virtual ~ProgressHandler () = default; // ------------------------------------------------------------------- /** @brief Progress callback. diff --git a/include/assimp/SceneCombiner.h b/include/assimp/SceneCombiner.h index 6da38cd15..d6096900c 100644 --- a/include/assimp/SceneCombiner.h +++ b/include/assimp/SceneCombiner.h @@ -191,13 +191,9 @@ struct SceneHelper { */ class ASSIMP_API SceneCombiner { // class cannot be instanced - SceneCombiner() { - // empty - } + SceneCombiner() = delete; - ~SceneCombiner() { - // empty - } + ~SceneCombiner() = delete; public: // ------------------------------------------------------------------- From b298b79a46bb30545dcd82979a5320a9b9b55e27 Mon Sep 17 00:00:00 2001 From: shimaowo <45767709+shimaowo@users.noreply.github.com> Date: Tue, 17 Jan 2023 10:53:41 -0800 Subject: [PATCH 10/15] add missing parens --- code/AssetLib/glTF2/glTF2Importer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/AssetLib/glTF2/glTF2Importer.cpp b/code/AssetLib/glTF2/glTF2Importer.cpp index 0cf5472d6..94b7ad665 100644 --- a/code/AssetLib/glTF2/glTF2Importer.cpp +++ b/code/AssetLib/glTF2/glTF2Importer.cpp @@ -853,7 +853,7 @@ void glTF2Importer::ImportCameras(glTF2::Asset &r) { if (cam.type == Camera::Perspective) { aicam->mAspect = cam.cameraProperties.perspective.aspectRatio; - aicam->mHorizontalFOV = 2.0f * std::atan(std::tan(cam.cameraProperties.perspective.yfov * 0.5f) * (aicam->mAspect == 0.f) ? 1.f : aicam->mAspect); + aicam->mHorizontalFOV = 2.0f * std::atan(std::tan(cam.cameraProperties.perspective.yfov * 0.5f) * ((aicam->mAspect == 0.f) ? 1.f : aicam->mAspect)); aicam->mClipPlaneFar = cam.cameraProperties.perspective.zfar; aicam->mClipPlaneNear = cam.cameraProperties.perspective.znear; } else { From ab0a119626a93d55944208b96be856c914900f65 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 20 Jan 2023 19:14:04 +0100 Subject: [PATCH 11/15] Update LimitBoneWeightsProcess.cpp - Removing empty bones only if AI_CONFIG_IMPORT_REMOVE_EMPTY_BONES is enabled. - closes https://github.com/assimp/assimp/issues/4840 --- .../LimitBoneWeightsProcess.cpp | 70 ++++++++----------- 1 file changed, 31 insertions(+), 39 deletions(-) diff --git a/code/PostProcessing/LimitBoneWeightsProcess.cpp b/code/PostProcessing/LimitBoneWeightsProcess.cpp index 3192e07bc..1db9158ef 100644 --- a/code/PostProcessing/LimitBoneWeightsProcess.cpp +++ b/code/PostProcessing/LimitBoneWeightsProcess.cpp @@ -55,10 +55,7 @@ using namespace Assimp; // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer -LimitBoneWeightsProcess::LimitBoneWeightsProcess() -{ - mMaxWeights = AI_LMW_MAX_WEIGHTS; -} +LimitBoneWeightsProcess::LimitBoneWeightsProcess() : mMaxWeights(AI_LMW_MAX_WEIGHTS) {} // ------------------------------------------------------------------------------------------------ // Destructor, private as well @@ -66,15 +63,15 @@ LimitBoneWeightsProcess::~LimitBoneWeightsProcess() = default; // ------------------------------------------------------------------------------------------------ // Returns whether the processing step is present in the given flag field. -bool LimitBoneWeightsProcess::IsActive( unsigned int pFlags) const -{ +bool LimitBoneWeightsProcess::IsActive( unsigned int pFlags) const { return (pFlags & aiProcess_LimitBoneWeights) != 0; } // ------------------------------------------------------------------------------------------------ // Executes the post processing step on the given imported data. -void LimitBoneWeightsProcess::Execute( aiScene* pScene) -{ +void LimitBoneWeightsProcess::Execute( aiScene* pScene) { + ai_assert(pScene != nullptr); + ASSIMP_LOG_DEBUG("LimitBoneWeightsProcess begin"); for (unsigned int m = 0; m < pScene->mNumMeshes; ++m) { @@ -86,16 +83,28 @@ void LimitBoneWeightsProcess::Execute( aiScene* pScene) // ------------------------------------------------------------------------------------------------ // Executes the post processing step on the given imported data. -void LimitBoneWeightsProcess::SetupProperties(const Importer* pImp) -{ - // get the current value of the property +void LimitBoneWeightsProcess::SetupProperties(const Importer* pImp) { this->mMaxWeights = pImp->GetPropertyInteger(AI_CONFIG_PP_LBW_MAX_WEIGHTS,AI_LMW_MAX_WEIGHTS); } +// ------------------------------------------------------------------------------------------------ +static void removeEmptyBones(aiMesh *pMesh) { + ai_assert(pMesh != nullptr); + + unsigned int writeBone = 0; + for (unsigned int readBone = 0; readBone< pMesh->mNumBones; ++readBone) { + aiBone* bone = pMesh->mBones[readBone]; + if (bone->mNumWeights > 0) { + pMesh->mBones[writeBone++] = bone; + } else { + delete bone; + } + } +} + // ------------------------------------------------------------------------------------------------ // Unites identical vertices in the given mesh -void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh) -{ +void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh) { if (!pMesh->HasBones()) return; @@ -105,11 +114,9 @@ void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh) WeightsPerVertex vertexWeights(pMesh->mNumVertices); size_t maxVertexWeights = 0; - for (unsigned int b = 0; b < pMesh->mNumBones; ++b) - { + for (unsigned int b = 0; b < pMesh->mNumBones; ++b) { const aiBone* bone = pMesh->mBones[b]; - for (unsigned int w = 0; w < bone->mNumWeights; ++w) - { + for (unsigned int w = 0; w < bone->mNumWeights; ++w) { const aiVertexWeight& vw = bone->mWeights[w]; if (vertexWeights.size() <= vw.mVertexId) @@ -126,8 +133,7 @@ void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh) unsigned int removed = 0, old_bones = pMesh->mNumBones; // now cut the weight count if it exceeds the maximum - for (WeightsPerVertex::iterator vit = vertexWeights.begin(); vit != vertexWeights.end(); ++vit) - { + for (WeightsPerVertex::iterator vit = vertexWeights.begin(); vit != vertexWeights.end(); ++vit) { if (vit->size() <= mMaxWeights) continue; @@ -154,39 +160,25 @@ void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh) } // clear weight count for all bone - for (unsigned int a = 0; a < pMesh->mNumBones; ++a) - { + for (unsigned int a = 0; a < pMesh->mNumBones; ++a) { pMesh->mBones[a]->mNumWeights = 0; } // rebuild the vertex weight array for all bones - for (unsigned int a = 0; a < vertexWeights.size(); ++a) - { + for (unsigned int a = 0; a < vertexWeights.size(); ++a) { const VertexWeightArray& vw = vertexWeights[a]; - for (const Weight* it = vw.begin(); it != vw.end(); ++it) - { + for (const Weight* it = vw.begin(); it != vw.end(); ++it) { aiBone* bone = pMesh->mBones[it->mBone]; bone->mWeights[bone->mNumWeights++] = aiVertexWeight(a, it->mWeight); } } // remove empty bones - unsigned int writeBone = 0; +#ifdef AI_CONFIG_IMPORT_REMOVE_EMPTY_BONES + removeEmptyBones(pMesh); +#endif // AI_CONFIG_IMPORT_REMOVE_EMPTY_BONES - for (unsigned int readBone = 0; readBone< pMesh->mNumBones; ++readBone) - { - aiBone* bone = pMesh->mBones[readBone]; - if (bone->mNumWeights > 0) - { - pMesh->mBones[writeBone++] = bone; - } - else - { - delete bone; - } - } pMesh->mNumBones = writeBone; - if (!DefaultLogger::isNullLogger()) { ASSIMP_LOG_INFO("Removed ", removed, " weights. Input bones: ", old_bones, ". Output bones: ", pMesh->mNumBones); } From 81cf1369dbf905dffbedd6fb6cd427455025b73f Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 20 Jan 2023 19:20:06 +0100 Subject: [PATCH 12/15] Set correct number of bones in mesh instance --- .../LimitBoneWeightsProcess.cpp | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/code/PostProcessing/LimitBoneWeightsProcess.cpp b/code/PostProcessing/LimitBoneWeightsProcess.cpp index 1db9158ef..8820c0113 100644 --- a/code/PostProcessing/LimitBoneWeightsProcess.cpp +++ b/code/PostProcessing/LimitBoneWeightsProcess.cpp @@ -2,8 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2022, assimp team - +Copyright (c) 2006-2023, assimp team All rights reserved. @@ -36,13 +35,7 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ----------------------------------------------------------------------- -*/ - -/** Implementation of the LimitBoneWeightsProcess post processing step */ - - +---------------------------------------------------------------------- */ #include "LimitBoneWeightsProcess.h" #include #include @@ -51,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -using namespace Assimp; +namespace Assimp { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer @@ -88,7 +81,7 @@ void LimitBoneWeightsProcess::SetupProperties(const Importer* pImp) { } // ------------------------------------------------------------------------------------------------ -static void removeEmptyBones(aiMesh *pMesh) { +static unsigned int removeEmptyBones(aiMesh *pMesh) { ai_assert(pMesh != nullptr); unsigned int writeBone = 0; @@ -100,6 +93,8 @@ static void removeEmptyBones(aiMesh *pMesh) { delete bone; } } + + return writeBone; } // ------------------------------------------------------------------------------------------------ @@ -175,11 +170,12 @@ void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh) { // remove empty bones #ifdef AI_CONFIG_IMPORT_REMOVE_EMPTY_BONES - removeEmptyBones(pMesh); + pMesh->mNumBones = removeEmptyBones(pMesh); #endif // AI_CONFIG_IMPORT_REMOVE_EMPTY_BONES - pMesh->mNumBones = writeBone; if (!DefaultLogger::isNullLogger()) { ASSIMP_LOG_INFO("Removed ", removed, " weights. Input bones: ", old_bones, ". Output bones: ", pMesh->mNumBones); } } + +} // namespace Assimp From 9e1de3ec6e6a5749ff23f3b8640da96bb32b1046 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 20 Jan 2023 19:45:45 +0100 Subject: [PATCH 13/15] Remove /Zi compiler flag for MSVC, release config - closes https://github.com/assimp/assimp/issues/4845 --- CMakeLists.txt | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e613a43cc..d20e6c9e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # Open Asset Import Library (assimp) # ---------------------------------------------------------------------- -# Copyright (c) 2006-2022, assimp team +# Copyright (c) 2006-2023, assimp team # # All rights reserved. # @@ -262,13 +262,13 @@ IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT MINGW) ENDIF() # hide all not-exported symbols IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "mips64" ) - SET(CMAKE_CXX_FLAGS "-mxgot -fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}") - SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}") - SET(LIBSTDC++_LIBRARIES -lstdc++) + SET(CMAKE_CXX_FLAGS "-mxgot -fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}") + SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}") + SET(LIBSTDC++_LIBRARIES -lstdc++) ELSE() - SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}") - SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}") - SET(LIBSTDC++_LIBRARIES -lstdc++) + SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}") + SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}") + SET(LIBSTDC++_LIBRARIES -lstdc++) ENDIF() ELSEIF(MSVC) # enable multi-core compilation with MSVC @@ -277,13 +277,15 @@ ELSEIF(MSVC) ELSE() # msvc ADD_COMPILE_OPTIONS(/MP /bigobj /W4 /WX) ENDIF() + # disable "elements of array '' will be default initialized" warning on MSVC2013 IF(MSVC12) ADD_COMPILE_OPTIONS(/wd4351) ENDIF() - ADD_COMPILE_OPTIONS(/wd4244) #supress warning for double to float conversion if Double precission is activated + # supress warning for double to float conversion if Double precission is activated + ADD_COMPILE_OPTIONS(/wd4244) SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /Zi /Od") - SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi") + SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG:FULL /PDBALTPATH:%_PDB% /OPT:REF /OPT:ICF") ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) IF(NOT ASSIMP_HUNTER_ENABLED) From 5ed01bcfa386ec889d4840eaa399d30d082e09e6 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 20 Jan 2023 20:00:36 +0100 Subject: [PATCH 14/15] Ensure initializer exists - Fixing a Codaxy finding. --- code/PostProcessing/LimitBoneWeightsProcess.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/PostProcessing/LimitBoneWeightsProcess.cpp b/code/PostProcessing/LimitBoneWeightsProcess.cpp index 8820c0113..51fb43dfc 100644 --- a/code/PostProcessing/LimitBoneWeightsProcess.cpp +++ b/code/PostProcessing/LimitBoneWeightsProcess.cpp @@ -46,6 +46,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace Assimp { +// Make sure this value is set. +#ifndef AI_LMW_MAX_WEIGHTS +# define AI_LMW_MAX_WEIGHTS 16 +#endif + // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer LimitBoneWeightsProcess::LimitBoneWeightsProcess() : mMaxWeights(AI_LMW_MAX_WEIGHTS) {} From f8bc8293cec316f37c0b86a481ef53ce103b3edc Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 22 Jan 2023 16:48:45 +0100 Subject: [PATCH 15/15] Update FBXMeshGeometry.h --- code/AssetLib/FBX/FBXMeshGeometry.h | 81 +++++++++++++++++------------ 1 file changed, 48 insertions(+), 33 deletions(-) diff --git a/code/AssetLib/FBX/FBXMeshGeometry.h b/code/AssetLib/FBX/FBXMeshGeometry.h index 03f01b763..f4a1a2673 100644 --- a/code/AssetLib/FBX/FBXMeshGeometry.h +++ b/code/AssetLib/FBX/FBXMeshGeometry.h @@ -2,8 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2022, assimp team - +Copyright (c) 2006-2023, assimp team All rights reserved. @@ -53,22 +52,26 @@ namespace Assimp { namespace FBX { /** - * DOM base class for all kinds of FBX geometry + * @brief DOM base class for all kinds of FBX geometry */ class Geometry : public Object { public: /// @brief The class constructor with all parameters. /// @param id The id. - /// @param element - /// @param name - /// @param doc + /// @param element The element instance + /// @param name The name instance + /// @param doc The document instance Geometry( uint64_t id, const Element& element, const std::string& name, const Document& doc ); + + /// @brief The class destructor, default. virtual ~Geometry() = default; - /// Get the Skin attached to this geometry or nullptr + /// @brief Get the Skin attached to this geometry or nullptr. + /// @return The deformer skip instance as a pointer, nullptr if none. const Skin* DeformerSkin() const; - /// Get the BlendShape attached to this geometry or nullptr + /// @brief Get the BlendShape attached to this geometry or nullptr + /// @return The blendshape arrays. const std::vector& GetBlendShapes() const; private: @@ -78,59 +81,71 @@ private: typedef std::vector MatIndexArray; - /** - * DOM class for FBX geometry of type "Mesh" + * @brief DOM class for FBX geometry of type "Mesh" */ class MeshGeometry : public Geometry { public: - /** The class constructor */ + /// @brief The class constructor + /// @param id The id. + /// @param element The element instance + /// @param name The name instance + /// @param doc The document instance MeshGeometry( uint64_t id, const Element& element, const std::string& name, const Document& doc ); - /** The class destructor */ + /// @brief The class destructor, default. virtual ~MeshGeometry() = default; - /** Get a list of all vertex points, non-unique*/ + /// brief Get a vector of all vertex points, non-unique. + /// @return The vertices vector. const std::vector& GetVertices() const; - /** Get a list of all vertex normals or an empty array if - * no normals are specified. */ + /// @brief Get a vector of all vertex normals or an empty array if no normals are specified. + /// @return The normal vector. const std::vector& GetNormals() const; - /** Get a list of all vertex tangents or an empty array - * if no tangents are specified */ + /// @brief Get a vector of all vertex tangents or an empty array if no tangents are specified. + /// @return The vertex tangents vector. const std::vector& GetTangents() const; - /** Get a list of all vertex bi-normals or an empty array - * if no bi-normals are specified */ + /// @brief Get a vector of all vertex bi-normals or an empty array if no bi-normals are specified. + /// @return The binomal vector. const std::vector& GetBinormals() const; - /** Return list of faces - each entry denotes a face and specifies - * how many vertices it has. Vertices are taken from the - * vertex data arrays in sequential order. */ + /// @brief Return list of faces - each entry denotes a face and specifies how many vertices it has. + /// Vertices are taken from the vertex data arrays in sequential order. + /// @return The face indices vector. const std::vector& GetFaceIndexCounts() const; - /** Get a UV coordinate slot, returns an empty array if - * the requested slot does not exist. */ + /// @brief Get a UV coordinate slot, returns an empty array if the requested slot does not exist. + /// @param index The requested texture coordinate slot. + /// @return The texture coordinates. const std::vector& GetTextureCoords( unsigned int index ) const; - /** Get a UV coordinate slot, returns an empty array if - * the requested slot does not exist. */ + /// @brief Get a UV coordinate slot, returns an empty array if the requested slot does not exist. + /// @param index The requested texture coordinate slot. + /// @return The texture coordinate channel name. std::string GetTextureCoordChannelName( unsigned int index ) const; - /** Get a vertex color coordinate slot, returns an empty array if - * the requested slot does not exist. */ + /// @brief Get a vertex color coordinate slot, returns an empty array if the requested slot does not exist. + /// @param index The requested texture coordinate slot. + /// @return The vertex color vector. const std::vector& GetVertexColors( unsigned int index ) const; - /** Get per-face-vertex material assignments */ + /// @brief Get per-face-vertex material assignments. + /// @return The Material indices Array. const MatIndexArray& GetMaterialIndices() const; - /** Convert from a fbx file vertex index (for example from a #Cluster weight) or nullptr - * if the vertex index is not valid. */ + /// @brief Convert from a fbx file vertex index (for example from a #Cluster weight) or nullptr if the vertex index is not valid. + /// @param in_index The requested input index. + /// @param count The number of indices. + /// @return The indices. const unsigned int* ToOutputVertexIndex( unsigned int in_index, unsigned int& count ) const; - /** Determine the face to which a particular output vertex index belongs. - * This mapping is always unique. */ + /// @brief Determine the face to which a particular output vertex index belongs. + /// This mapping is always unique. + /// @param in_index The requested input index. + /// @return The face-to-vertex index. unsigned int FaceForVertexIndex( unsigned int in_index ) const; private: