Browse Source

Merge branch 'master' into const-tokens

krishty 4 years ago
parent
commit
8c84afaff0
100 changed files with 2576 additions and 3056 deletions
  1. 1 1
      code/AssetLib/3DS/3DSExporter.cpp
  2. 1 1
      code/AssetLib/3DS/3DSHelper.h
  3. 5 5
      code/AssetLib/3DS/3DSLoader.h
  4. 3 2
      code/AssetLib/3MF/D3MFExporter.h
  5. 4 0
      code/AssetLib/3MF/D3MFImporter.h
  6. 1 2
      code/AssetLib/3MF/D3MFOpcPackage.cpp
  7. 1 1
      code/AssetLib/3MF/D3MFOpcPackage.h
  8. 5 5
      code/AssetLib/AC/ACLoader.h
  9. 4 4
      code/AssetLib/AMF/AMFImporter.hpp
  10. 4 5
      code/AssetLib/AMF/AMFImporter_Node.hpp
  11. 0 2
      code/AssetLib/ASE/ASELoader.cpp
  12. 5 20
      code/AssetLib/ASE/ASELoader.h
  13. 0 2
      code/AssetLib/ASE/ASEParser.cpp
  14. 1 1
      code/AssetLib/Assbin/AssbinExporter.h
  15. 5 12
      code/AssetLib/Assbin/AssbinLoader.h
  16. 6 7
      code/AssetLib/Assjson/mesh_splitter.cpp
  17. 13 22
      code/AssetLib/Assjson/mesh_splitter.h
  18. 1 0
      code/AssetLib/Assxml/AssxmlExporter.h
  19. 1 2
      code/AssetLib/Assxml/AssxmlFileWriter.h
  20. 8 10
      code/AssetLib/B3D/B3DImporter.h
  21. 94 104
      code/AssetLib/Blender/BlenderLoader.h
  22. 54 58
      code/AssetLib/COB/COBLoader.h
  23. 4 5
      code/AssetLib/COB/COBScene.h
  24. 11 15
      code/AssetLib/CSM/CSMLoader.h
  25. 0 1
      code/AssetLib/Collada/ColladaLoader.cpp
  26. 1 0
      code/AssetLib/Collada/ColladaParser.h
  27. 6 9
      code/AssetLib/DXF/DXFLoader.h
  28. 6 5
      code/AssetLib/FBX/FBXImporter.h
  29. 20 33
      code/AssetLib/HMP/HMPLoader.h
  30. 0 1
      code/AssetLib/IFC/IFCBoolean.cpp
  31. 34 52
      code/AssetLib/IFC/IFCLoader.h
  32. 0 1
      code/AssetLib/IFC/IFCUtil.cpp
  33. 5 6
      code/AssetLib/Irr/IRRLoader.h
  34. 4 4
      code/AssetLib/Irr/IRRMeshLoader.h
  35. 1 1
      code/AssetLib/Irr/IRRShared.h
  36. 95 113
      code/AssetLib/LWO/LWOLoader.h
  37. 7 7
      code/AssetLib/LWS/LWSLoader.h
  38. 11 9
      code/AssetLib/M3D/M3DImporter.h
  39. 14 22
      code/AssetLib/MD2/MD2Loader.h
  40. 43 65
      code/AssetLib/MD3/MD3Loader.h
  41. 6 6
      code/AssetLib/MD5/MD5Loader.h
  42. 12 22
      code/AssetLib/MDC/MDCLoader.h
  43. 7 7
      code/AssetLib/MDL/MDLLoader.h
  44. 1 2
      code/AssetLib/MDL/MDLMaterialLoader.cpp
  45. 4 4
      code/AssetLib/MMD/MMDImporter.h
  46. 24 40
      code/AssetLib/MS3D/MS3DLoader.h
  47. 19 29
      code/AssetLib/NDO/NDOLoader.h
  48. 48 72
      code/AssetLib/NFF/NFFLoader.h
  49. 0 2
      code/AssetLib/OFF/OFFLoader.cpp
  50. 9 17
      code/AssetLib/OFF/OFFLoader.h
  51. 14 25
      code/AssetLib/Obj/ObjFileData.h
  52. 6 6
      code/AssetLib/Obj/ObjFileImporter.h
  53. 3 3
      code/AssetLib/Obj/ObjFileMtlImporter.h
  54. 0 1
      code/AssetLib/Obj/ObjFileParser.h
  55. 19 20
      code/AssetLib/Ogre/OgreImporter.cpp
  56. 16 20
      code/AssetLib/Ogre/OgreImporter.h
  57. 1 1
      code/AssetLib/OpenGEX/OpenGEXExporter.h
  58. 0 4
      code/AssetLib/OpenGEX/OpenGEXImporter.cpp
  59. 10 9
      code/AssetLib/OpenGEX/OpenGEXImporter.h
  60. 5 4
      code/AssetLib/Ply/PlyLoader.h
  61. 1 2
      code/AssetLib/Ply/PlyParser.h
  62. 0 4
      code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp
  63. 7 8
      code/AssetLib/Q3BSP/Q3BSPFileImporter.h
  64. 0 2
      code/AssetLib/Q3BSP/Q3BSPFileParser.cpp
  65. 2 3
      code/AssetLib/Q3BSP/Q3BSPFileParser.h
  66. 15 33
      code/AssetLib/Q3D/Q3DLoader.h
  67. 10 23
      code/AssetLib/Raw/RawLoader.h
  68. 11 20
      code/AssetLib/SIB/SIBImporter.h
  69. 17 40
      code/AssetLib/SMD/SMDLoader.h
  70. 8 11
      code/AssetLib/STL/STLExporter.h
  71. 3 2
      code/AssetLib/STL/STLLoader.cpp
  72. 4 5
      code/AssetLib/STL/STLLoader.h
  73. 6 2
      code/AssetLib/Terragen/TerragenLoader.cpp
  74. 7 6
      code/AssetLib/Terragen/TerragenLoader.h
  75. 1 1
      code/AssetLib/Unreal/UnrealLoader.cpp
  76. 8 8
      code/AssetLib/Unreal/UnrealLoader.h
  77. 52 63
      code/AssetLib/X/XFileHelper.h
  78. 0 1
      code/AssetLib/X/XFileImporter.cpp
  79. 6 7
      code/AssetLib/X/XFileImporter.h
  80. 10 9
      code/AssetLib/XGL/XGLLoader.cpp
  81. 4 4
      code/AssetLib/XGL/XGLLoader.h
  82. 778 871
      code/AssetLib/glTF/glTFAsset.h
  83. 0 119
      code/AssetLib/glTF/glTFAsset.inl
  84. 299 15
      code/AssetLib/glTF/glTFCommon.h
  85. 56 57
      code/AssetLib/glTF/glTFExporter.h
  86. 18 21
      code/AssetLib/glTF/glTFImporter.h
  87. 29 61
      code/AssetLib/glTF2/glTF2Asset.h
  88. 20 233
      code/AssetLib/glTF2/glTF2Asset.inl
  89. 282 293
      code/AssetLib/glTF2/glTF2Exporter.cpp
  90. 76 76
      code/AssetLib/glTF2/glTF2Exporter.h
  91. 63 52
      code/AssetLib/glTF2/glTF2Importer.cpp
  92. 17 23
      code/AssetLib/glTF2/glTF2Importer.h
  93. 0 1
      code/CApi/CInterfaceIOWrapper.cpp
  94. 0 1
      code/CMakeLists.txt
  95. 29 28
      code/Common/Bitmap.cpp
  96. 0 1
      code/Common/DefaultIOStream.cpp
  97. 0 1
      code/Common/StandardShapes.cpp
  98. 0 1
      code/Common/ZipArchiveIOSystem.cpp
  99. 10 4
      include/assimp/Bitmap.h
  100. 44 35
      include/assimp/BlobIOSystem.h

+ 1 - 1
code/AssetLib/3DS/3DSExporter.cpp

@@ -56,8 +56,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include <memory>
 
-using namespace Assimp;
 namespace Assimp {
+
 using namespace D3DS;
 
 namespace {

+ 1 - 1
code/AssetLib/3DS/3DSHelper.h

@@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <assimp/light.h>
 #include <assimp/material.h>
 #include <assimp/qnan.h>
-#include <stdio.h> //sprintf
+#include <cstdio> //sprintf
 
 namespace Assimp {
 namespace D3DS {

+ 5 - 5
code/AssetLib/3DS/3DSLoader.h

@@ -46,11 +46,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #ifndef AI_3DSIMPORTER_H_INC
 #define AI_3DSIMPORTER_H_INC
+#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
 
 #include <assimp/BaseImporter.h>
 #include <assimp/types.h>
 
-#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
 
 #include "3DSHelper.h"
 #include <assimp/StreamReader.h>
@@ -75,14 +75,14 @@ public:
      * See BaseImporter::CanRead() for details.
      */
     bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
+        bool checkSig) const override;
 
     // -------------------------------------------------------------------
     /** Called prior to ReadFile().
      * The function is a request to the importer to update its configuration
      * basing on the Importer's configuration property list.
      */
-    void SetupProperties(const Importer* pImp);
+    void SetupProperties(const Importer* pImp) override;
 
 protected:
 
@@ -90,14 +90,14 @@ protected:
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc* GetInfo () const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
      * See BaseImporter::InternReadFile() for details
      */
     void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
+        IOSystem* pIOHandler) override;
 
     // -------------------------------------------------------------------
     /** Converts a temporary material to the outer representation

+ 3 - 2
code/AssetLib/3MF/D3MFExporter.h

@@ -40,6 +40,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 #pragma once
 
+#ifndef ASSIMP_BUILD_NO_EXPORT
+#ifndef ASSIMP_BUILD_NO_3MF_EXPORTER
+
 #include <memory>
 #include <sstream>
 #include <vector>
@@ -58,8 +61,6 @@ class IOStream;
 
 namespace D3MF {
 
-#ifndef ASSIMP_BUILD_NO_EXPORT
-#ifndef ASSIMP_BUILD_NO_3MF_EXPORTER
 
 struct OpcPackageRelationship;
 

+ 4 - 0
code/AssetLib/3MF/D3MFImporter.h

@@ -42,6 +42,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #ifndef AI_D3MFLOADER_H_INCLUDED
 #define AI_D3MFLOADER_H_INCLUDED
 
+#ifndef ASSIMP_BUILD_NO_3MF_IMPORTER
+
 #include <assimp/BaseImporter.h>
 
 namespace Assimp {
@@ -84,4 +86,6 @@ protected:
 
 } // Namespace Assimp
 
+#endif // #ifndef ASSIMP_BUILD_NO_3MF_IMPORTER
+
 #endif // AI_D3MFLOADER_H_INCLUDED

+ 1 - 2
code/AssetLib/3MF/D3MFOpcPackage.cpp

@@ -51,11 +51,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <assimp/IOSystem.hpp>
 #include <assimp/texture.h>
 #include "3MFXmlTags.h"
+
 #include <algorithm>
 #include <cassert>
 #include <cstdlib>
 #include <map>
-#include <memory>
 #include <vector>
 
 namespace Assimp {
@@ -186,7 +186,6 @@ D3MFOpcPackage::D3MFOpcPackage(IOSystem *pIOHandler, const std::string &rFile) :
 D3MFOpcPackage::~D3MFOpcPackage() {
     mZipArchive->Close(mRootStream);
     delete mZipArchive;
-    mZipArchive = nullptr;
 }
 
 IOStream *D3MFOpcPackage::RootStream() const {

+ 1 - 1
code/AssetLib/3MF/D3MFOpcPackage.h

@@ -42,9 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #ifndef D3MFOPCPACKAGE_H
 #define D3MFOPCPACKAGE_H
 
+#include <assimp/IOSystem.hpp>
 #include <memory>
 #include <string>
-#include <assimp/IOSystem.hpp>
 
 struct aiTexture;
 

+ 5 - 5
code/AssetLib/AC/ACLoader.h

@@ -63,7 +63,7 @@ namespace Assimp {
 class AC3DImporter : public BaseImporter {
 public:
     AC3DImporter();
-    ~AC3DImporter();
+    ~AC3DImporter() override;
 
     // Represents an AC3D material
     struct Material {
@@ -185,25 +185,25 @@ public:
      * See BaseImporter::CanRead() for details.
      */
     bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
-            bool checkSig) const;
+            bool checkSig) const override;
 
 protected:
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details */
-    const aiImporterDesc *GetInfo() const;
+    const aiImporterDesc *GetInfo() const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
      * See BaseImporter::InternReadFile() for details*/
     void InternReadFile(const std::string &pFile, aiScene *pScene,
-            IOSystem *pIOHandler);
+            IOSystem *pIOHandler) override;
 
     // -------------------------------------------------------------------
     /** Called prior to ReadFile().
     * The function is a request to the importer to update its configuration
     * basing on the Importer's configuration property list.*/
-    void SetupProperties(const Importer *pImp);
+    void SetupProperties(const Importer *pImp) override;
 
 private:
     // -------------------------------------------------------------------

+ 4 - 4
code/AssetLib/AMF/AMFImporter.hpp

@@ -267,7 +267,7 @@ public:
     AMFImporter() AI_NO_EXCEPT;
 
     /// Default destructor.
-    ~AMFImporter();
+    ~AMFImporter() override;
 
     /// Parse AMF file and fill scene graph. The function has no return value. Result can be found by analyzing the generated graph.
     /// Also exception can be thrown if trouble will found.
@@ -276,9 +276,9 @@ public:
     void ParseFile(const std::string &pFile, IOSystem *pIOHandler);
     void ParseHelper_Node_Enter(AMFNodeElementBase *child);
     void ParseHelper_Node_Exit();
-    bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool pCheckSig) const;
-    void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler);
-    const aiImporterDesc *GetInfo() const;
+    bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool pCheckSig) const override;
+    void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
+    const aiImporterDesc *GetInfo() const override;
     bool Find_NodeElement(const std::string &pID, const AMFNodeElementBase::EType pType, AMFNodeElementBase **pNodeElement) const;
     bool Find_ConvertedNode(const std::string &pID, NodeArray &nodeArray, aiNode **pNode) const;
     bool Find_ConvertedMaterial(const std::string &pID, const SPP_Material **pConvertedMaterial) const;

+ 4 - 5
code/AssetLib/AMF/AMFImporter_Node.hpp

@@ -48,15 +48,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #ifndef INCLUDED_AI_AMF_IMPORTER_NODE_H
 #define INCLUDED_AI_AMF_IMPORTER_NODE_H
 
-// Header files, stdlib.
+// Header files, Assimp.
+#include <assimp/scene.h>
+#include <assimp/types.h>
+
 #include <list>
 #include <string>
 #include <vector>
 
-// Header files, Assimp.
-#include "assimp/scene.h"
-#include "assimp/types.h"
-
 /// \class CAMFImporter_NodeElement
 /// Base class for elements of nodes.
 class AMFNodeElementBase {

+ 0 - 2
code/AssetLib/ASE/ASELoader.cpp

@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,

+ 5 - 20
code/AssetLib/ASE/ASELoader.h

@@ -62,42 +62,37 @@ namespace Assimp {
 class ASEImporter : public BaseImporter {
 public:
     ASEImporter();
-    ~ASEImporter();
+    ~ASEImporter() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
      * See BaseImporter::CanRead() for details.
      */
     bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
+        bool checkSig) const override;
 
 protected:
-
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc* GetInfo () const;
-
+    const aiImporterDesc* GetInfo () const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
     * See BaseImporter::InternReadFile() for details
     */
     void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
-
+        IOSystem* pIOHandler) override;
 
     // -------------------------------------------------------------------
     /** Called prior to ReadFile().
     * The function is a request to the importer to update its configuration
     * basing on the Importer's configuration property list.
     */
-    void SetupProperties(const Importer* pImp);
-
+    void SetupProperties(const Importer* pImp) override;
 
 private:
-
     // -------------------------------------------------------------------
     /** Generate normal vectors basing on smoothing groups
      * (in some cases the normal are already contained in the file)
@@ -106,7 +101,6 @@ private:
      */
     bool GenerateNormals(ASE::Mesh& mesh);
 
-
     // -------------------------------------------------------------------
     /** Create valid vertex/normal/UV/color/face lists.
      *  All elements are unique, faces have only one set of indices
@@ -115,51 +109,43 @@ private:
      */
     void BuildUniqueRepresentation(ASE::Mesh& mesh);
 
-
     /** Create one-material-per-mesh meshes ;-)
      * \param mesh Mesh to work with
      *  \param Receives the list of all created meshes
      */
     void ConvertMeshes(ASE::Mesh& mesh, std::vector<aiMesh*>& avOut);
 
-
     // -------------------------------------------------------------------
     /** Convert a material to a aiMaterial object
      * \param mat Input material
      */
     void ConvertMaterial(ASE::Material& mat);
 
-
     // -------------------------------------------------------------------
     /** Setup the final material indices for each mesh
      */
     void BuildMaterialIndices();
 
-
     // -------------------------------------------------------------------
     /** Build the node graph
      */
     void BuildNodes(std::vector<ASE::BaseNode*>& nodes);
 
-
     // -------------------------------------------------------------------
     /** Build output cameras
      */
     void BuildCameras();
 
-
     // -------------------------------------------------------------------
     /** Build output lights
      */
     void BuildLights();
 
-
     // -------------------------------------------------------------------
     /** Build output animations
      */
     void BuildAnimations(const std::vector<ASE::BaseNode*>& nodes);
 
-
     // -------------------------------------------------------------------
     /** Add sub nodes to a node
      *  \param pcParent parent node to be filled
@@ -183,7 +169,6 @@ private:
     void GenerateDefaultMaterial();
 
 protected:
-
     /** Parser instance */
     ASE::Parser* mParser;
 

+ 0 - 2
code/AssetLib/ASE/ASEParser.cpp

@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,

+ 1 - 1
code/AssetLib/Assbin/AssbinExporter.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -43,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file AssbinExporter.h
  * ASSBIN Exporter Main Header
  */
+#pragma once
 #ifndef AI_ASSBINEXPORTER_H_INC
 #define AI_ASSBINEXPORTER_H_INC
 

+ 5 - 12
code/AssetLib/Assbin/AssbinLoader.h

@@ -5,7 +5,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -74,17 +73,11 @@ private:
     bool compressed;
 
 public:
-    virtual bool CanRead(
-        const std::string& pFile,
-        IOSystem* pIOHandler,
-        bool checkSig
-    ) const;
-    virtual const aiImporterDesc* GetInfo() const;
-    virtual void InternReadFile(
-    const std::string& pFile,
-        aiScene* pScene,
-        IOSystem* pIOHandler
-    );
+    bool CanRead(const std::string& pFile,
+        IOSystem* pIOHandler, bool checkSig) const override;
+    const aiImporterDesc* GetInfo() const override;
+    void InternReadFile(
+    const std::string& pFile,aiScene* pScene,IOSystem* pIOHandler) override;
     void ReadHeader();
     void ReadBinaryScene( IOStream * stream, aiScene* pScene );
     void ReadBinaryNode( IOStream * stream, aiNode** mRootNode, aiNode* parent );

+ 6 - 7
code/AssetLib/Assjson/mesh_splitter.cpp

@@ -69,13 +69,12 @@ void MeshSplitter::UpdateNode(aiNode* pcNode, const std::vector<std::pair<aiMesh
 	for (unsigned int i = 0, end = pcNode->mNumChildren; i < end;++i)	{
 		UpdateNode ( pcNode->mChildren[i], source_mesh_map );
 	}
-	return;
 }
 
-#define WAS_NOT_COPIED 0xffffffff
+static const unsigned int WAS_NOT_COPIED = 0xffffffff;
 
-typedef std::pair <unsigned int,float> PerVertexWeight;
-typedef std::vector	<PerVertexWeight> VertexWeightTable;
+using PerVertexWeight = std::pair <unsigned int,float>;
+using VertexWeightTable = std::vector	<PerVertexWeight>;
 
 // ------------------------------------------------------------------------------------------------
 VertexWeightTable* ComputeVertexBoneWeightTable(const aiMesh* pMesh) {
@@ -89,7 +88,7 @@ VertexWeightTable* ComputeVertexBoneWeightTable(const aiMesh* pMesh) {
 		aiBone* bone = pMesh->mBones[i];
 		for (unsigned int a = 0; a < bone->mNumWeights;++a)	{
 			const aiVertexWeight& weight = bone->mWeights[a];
-			avPerVertexWeights[weight.mVertexId].push_back( std::make_pair(i,weight.mWeight) );
+			avPerVertexWeights[weight.mVertexId].emplace_back(i,weight.mWeight);
 		}
 	}
 	return avPerVertexWeights;
@@ -100,7 +99,7 @@ void MeshSplitter :: SplitMesh(unsigned int a, aiMesh* in_mesh, std::vector<std:
 	// TODO: should better use std::(multi)set for source_mesh_map.
 
 	if (in_mesh->mNumVertices <= LIMIT)	{
-		source_mesh_map.push_back(std::make_pair(in_mesh,a));
+		source_mesh_map.emplace_back(in_mesh,a);
 		return;
 	}
 
@@ -187,7 +186,7 @@ void MeshSplitter :: SplitMesh(unsigned int a, aiMesh* in_mesh, std::vector<std:
 				break;
 			}
 
-			vFaces.push_back(aiFace());
+			vFaces.emplace_back();
 			aiFace& rFace = vFaces.back();
 
 			// setup face type and number of indices

+ 13 - 22
code/AssetLib/Assjson/mesh_splitter.h

@@ -24,38 +24,29 @@ struct aiNode;
 /** Splits meshes of unique vertices into meshes with no more vertices than
  *  a given, configurable threshold value.
  */
-class MeshSplitter
-{
-
+class MeshSplitter {
 public:
+    unsigned int LIMIT;
 
-	void SetLimit(unsigned int l) {
-		LIMIT = l;
-	}
-
-	unsigned int GetLimit() const {
-		return LIMIT;
-	}
+    void SetLimit(unsigned int l) {
+        LIMIT = l;
+    }
 
-public:
+    unsigned int GetLimit() const {
+        return LIMIT;
+    }
 
-	// -------------------------------------------------------------------
-	/** Executes the post processing step on the given imported data.
+    // -------------------------------------------------------------------
+    /** Executes the post processing step on the given imported data.
 	 * At the moment a process is not supposed to fail.
 	 * @param pScene The imported data to work at.
 	 */
-	void Execute( aiScene* pScene);
-
+    void Execute(aiScene *pScene);
 
 private:
+    void UpdateNode(aiNode *pcNode, const std::vector<std::pair<aiMesh *, unsigned int>> &source_mesh_map);
+    void SplitMesh(unsigned int index, aiMesh *mesh, std::vector<std::pair<aiMesh *, unsigned int>> &source_mesh_map);
 
-	void UpdateNode(aiNode* pcNode, const std::vector<std::pair<aiMesh*, unsigned int> >& source_mesh_map);
-	void SplitMesh (unsigned int index, aiMesh* mesh, std::vector<std::pair<aiMesh*, unsigned int> >& source_mesh_map);
-
-public:
-
-	unsigned int LIMIT;
 };
 
 #endif // INCLUDED_MESH_SPLITTER
-

+ 1 - 0
code/AssetLib/Assxml/AssxmlExporter.h

@@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file AssxmlExporter.h
  * ASSXML Exporter Main Header
  */
+#pragma once
 #ifndef AI_ASSXMLEXPORTER_H_INC
 #define AI_ASSXMLEXPORTER_H_INC
 

+ 1 - 2
code/AssetLib/Assxml/AssxmlFileWriter.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -43,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file AssxmlFileWriter.h
  *  @brief Declaration of Assxml file writer.
  */
-
+#pragma once
 #ifndef AI_ASSXMLFILEWRITER_H_INC
 #define AI_ASSXMLFILEWRITER_H_INC
 

+ 8 - 10
code/AssetLib/B3D/B3DImporter.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -40,8 +39,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ----------------------------------------------------------------------
 */
 
-/** @file Definition of the .b3d importer class. */
-
+/**
+ *  @file Definition of the .b3d importer class.
+ */
+#pragma once
 #ifndef AI_B3DIMPORTER_H_INC
 #define AI_B3DIMPORTER_H_INC
 
@@ -62,14 +63,12 @@ namespace Assimp{
 class B3DImporter : public BaseImporter{
 public:
     B3DImporter() = default;
-    virtual ~B3DImporter();
-
-    virtual bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const;
+    ~B3DImporter() override;
+    bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const override;
 
 protected:
-
-    virtual const aiImporterDesc* GetInfo () const;
-    virtual void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler);
+    const aiImporterDesc* GetInfo () const override;
+    void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) override;
 
 private:
 
@@ -113,7 +112,6 @@ private:
     void ReadBB3D( aiScene *scene );
 
     size_t _pos;
-//  unsigned _size;
     std::vector<unsigned char> _buf;
     std::vector<size_t> _stack;
 

+ 94 - 104
code/AssetLib/Blender/BlenderLoader.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -43,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file  BlenderLoader.h
  *  @brief Declaration of the Blender 3D (*.blend) importer class.
  */
+#pragma once
 #ifndef INCLUDED_AI_BLEND_LOADER_H
 #define INCLUDED_AI_BLEND_LOADER_H
 
@@ -56,149 +56,139 @@ struct aiLight;
 struct aiCamera;
 struct aiMaterial;
 
-namespace Assimp    {
-
-    // TinyFormatter.h
-    namespace Formatter {
-        template <typename T,typename TR, typename A> class basic_formatter;
-        typedef class basic_formatter< char, std::char_traits<char>, std::allocator<char> > format;
-    }
-
-    // BlenderDNA.h
-    namespace Blender {
-        class  FileDatabase;
-        struct ElemBase;
-    }
-
-    // BlenderScene.h
-    namespace Blender {
-        struct Scene;
-        struct Object;
-        struct Mesh;
-        struct Camera;
-        struct Lamp;
-        struct MTex;
-        struct Image;
-        struct Material;
-    }
-
-    // BlenderIntermediate.h
-    namespace Blender {
-        struct ConversionData;
-        template <template <typename,typename> class TCLASS, typename T> struct TempArray;
-    }
-
-    // BlenderModifier.h
-    namespace Blender {
-        class BlenderModifierShowcase;
-        class BlenderModifier;
-    }
-
-
+namespace Assimp {
+
+// TinyFormatter.h
+namespace Formatter {
+
+template <typename T, typename TR, typename A>
+class basic_formatter;
+
+typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>> format;
+
+} // namespace Formatter
+
+// BlenderDNA.h
+namespace Blender {
+class FileDatabase;
+struct ElemBase;
+} // namespace Blender
+
+// BlenderScene.h
+namespace Blender {
+struct Scene;
+struct Object;
+struct Mesh;
+struct Camera;
+struct Lamp;
+struct MTex;
+struct Image;
+struct Material;
+} // namespace Blender
+
+// BlenderIntermediate.h
+namespace Blender {
+struct ConversionData;
+template <template <typename, typename> class TCLASS, typename T>
+struct TempArray;
+} // namespace Blender
+
+// BlenderModifier.h
+namespace Blender {
+class BlenderModifierShowcase;
+class BlenderModifier;
+} // namespace Blender
 
 // -------------------------------------------------------------------------------------------
 /** Load blenders official binary format. The actual file structure (the `DNA` how they
  *  call it is outsourced to BlenderDNA.cpp/BlenderDNA.h. This class only performs the
  *  conversion from intermediate format to aiScene. */
 // -------------------------------------------------------------------------------------------
-class BlenderImporter : public BaseImporter, public LogFunctions<BlenderImporter>
-{
+class BlenderImporter : public BaseImporter, public LogFunctions<BlenderImporter> {
 public:
     BlenderImporter();
-    ~BlenderImporter();
-    bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const;
+    ~BlenderImporter() override;
+    bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override;
 
 protected:
-    const aiImporterDesc* GetInfo () const;
-    void SetupProperties(const Importer* pImp);
-    void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler);
-    void ParseBlendFile(Blender::FileDatabase& out, std::shared_ptr<IOStream> stream);
-    void ExtractScene(Blender::Scene& out, const Blender::FileDatabase& file);
-    void ConvertBlendFile(aiScene* out, const Blender::Scene& in, const Blender::FileDatabase& file);
+    const aiImporterDesc *GetInfo() const override;
+    void SetupProperties(const Importer *pImp) override;
+    void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
+    void ParseBlendFile(Blender::FileDatabase &out, std::shared_ptr<IOStream> stream);
+    void ExtractScene(Blender::Scene &out, const Blender::FileDatabase &file);
+    void ConvertBlendFile(aiScene *out, const Blender::Scene &in, const Blender::FileDatabase &file);
 
 private:
-    aiNode* ConvertNode(const Blender::Scene& in,
-        const Blender::Object* obj,
-        Blender::ConversionData& conv_info,
-        const aiMatrix4x4& parentTransform
-    );
+    aiNode *ConvertNode(const Blender::Scene &in,
+            const Blender::Object *obj,
+            Blender::ConversionData &conv_info,
+            const aiMatrix4x4 &parentTransform);
 
     // --------------------
-    void ConvertMesh(const Blender::Scene& in,
-        const Blender::Object* obj,
-        const Blender::Mesh* mesh,
-        Blender::ConversionData& conv_data,
-        Blender::TempArray<std::vector,aiMesh>& temp
-    );
+    void ConvertMesh(const Blender::Scene &in,
+            const Blender::Object *obj,
+            const Blender::Mesh *mesh,
+            Blender::ConversionData &conv_data,
+            Blender::TempArray<std::vector, aiMesh> &temp);
 
     // --------------------
-    aiLight* ConvertLight(const Blender::Scene& in,
-        const Blender::Object* obj,
-        const Blender::Lamp* mesh,
-        Blender::ConversionData& conv_data
-    );
+    aiLight *ConvertLight(const Blender::Scene &in,
+            const Blender::Object *obj,
+            const Blender::Lamp *mesh,
+            Blender::ConversionData &conv_data);
 
     // --------------------
-    aiCamera* ConvertCamera(const Blender::Scene& in,
-        const Blender::Object* obj,
-        const Blender::Camera* mesh,
-        Blender::ConversionData& conv_data
-    );
+    aiCamera *ConvertCamera(const Blender::Scene &in,
+            const Blender::Object *obj,
+            const Blender::Camera *mesh,
+            Blender::ConversionData &conv_data);
 
     // --------------------
     void BuildDefaultMaterial(
-        Blender::ConversionData& conv_data
-    );
+            Blender::ConversionData &conv_data);
 
+    // --------------------
     void AddBlendParams(
-        aiMaterial* result,
-        const Blender::Material* source
-    );
+            aiMaterial *result,
+            const Blender::Material *source);
 
+    // --------------------
     void BuildMaterials(
-        Blender::ConversionData& conv_data
-    );
+            Blender::ConversionData &conv_data);
 
     // --------------------
     void ResolveTexture(
-        aiMaterial* out,
-        const Blender::Material* mat,
-        const Blender::MTex* tex,
-        Blender::ConversionData& conv_data
-    );
+            aiMaterial *out,
+            const Blender::Material *mat,
+            const Blender::MTex *tex,
+            Blender::ConversionData &conv_data);
 
     // --------------------
     void ResolveImage(
-        aiMaterial* out,
-        const Blender::Material* mat,
-        const Blender::MTex* tex,
-        const Blender::Image* img,
-        Blender::ConversionData& conv_data
-    );
+            aiMaterial *out,
+            const Blender::Material *mat,
+            const Blender::MTex *tex,
+            const Blender::Image *img,
+            Blender::ConversionData &conv_data);
 
+    // --------------------
     void AddSentinelTexture(
-        aiMaterial* out,
-        const Blender::Material* mat,
-        const Blender::MTex* tex,
-        Blender::ConversionData& conv_data
-    );
+            aiMaterial *out,
+            const Blender::Material *mat,
+            const Blender::MTex *tex,
+            Blender::ConversionData &conv_data);
 
 private: // static stuff, mostly logging and error reporting.
-
     // --------------------
-    static void CheckActualType(const Blender::ElemBase* dt,
-        const char* check
-    );
+    static void CheckActualType(const Blender::ElemBase *dt,
+            const char *check);
 
     // --------------------
-    static void NotSupportedObjectType(const Blender::Object* obj,
-        const char* type
-    );
-
+    static void NotSupportedObjectType(const Blender::Object *obj,
+            const char *type);
 
 private:
-
-    Blender::BlenderModifierShowcase* modifier_cache;
+    Blender::BlenderModifierShowcase *modifier_cache;
 
 }; // !class BlenderImporter
 

+ 54 - 58
code/AssetLib/COB/COBLoader.h

@@ -51,104 +51,100 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 struct aiNode;
 
-namespace Assimp    {
-    class LineSplitter;
-
-    // TinyFormatter.h
-    namespace Formatter {
-        template <typename T,typename TR, typename A> class basic_formatter;
-        typedef class basic_formatter< char, std::char_traits<char>, std::allocator<char> > format;
-    }
-
-    // COBScene.h
-    namespace COB {
-        struct ChunkInfo;
-        struct Node;
-        struct Scene;
-    }
+namespace Assimp {
+class LineSplitter;
+
+// TinyFormatter.h
+namespace Formatter {
+template <typename T, typename TR, typename A>
+class basic_formatter;
+typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>> format;
+} // namespace Formatter
+
+// COBScene.h
+namespace COB {
+struct ChunkInfo;
+struct Node;
+struct Scene;
+} // namespace COB
 
 // -------------------------------------------------------------------------------------------
 /** Importer class to load TrueSpace files (cob,scn) up to v6.
  *
  *  Currently relatively limited, loads only ASCII files and needs more test coverage. */
 // -------------------------------------------------------------------------------------------
-class COBImporter : public BaseImporter
-{
+class COBImporter : public BaseImporter {
 public:
     COBImporter();
-    ~COBImporter();
+    ~COBImporter() override;
 
     // --------------------
-    bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
+    bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
+            bool checkSig) const override;
 
 protected:
-
     // --------------------
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc *GetInfo() const override;
 
     // --------------------
-    void SetupProperties(const Importer* pImp);
+    void SetupProperties(const Importer *pImp) override;
 
     // --------------------
-    void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
+    void InternReadFile(const std::string &pFile, aiScene *pScene,
+            IOSystem *pIOHandler) override;
 
 private:
-
     // -------------------------------------------------------------------
     /** Prepend 'COB: ' and throw msg.*/
-    AI_WONT_RETURN static void ThrowException(const std::string& msg) AI_WONT_RETURN_SUFFIX;
+    AI_WONT_RETURN static void ThrowException(const std::string &msg) AI_WONT_RETURN_SUFFIX;
 
     // -------------------------------------------------------------------
     /** @brief Read from an ascii scene/object file
      *  @param out Receives output data.
      *  @param stream Stream to read from. */
-    void ReadAsciiFile(COB::Scene& out, StreamReaderLE* stream);
+    void ReadAsciiFile(COB::Scene &out, StreamReaderLE *stream);
 
     // -------------------------------------------------------------------
     /** @brief Read from a binary scene/object file
      *  @param out Receives output data.
      *  @param stream Stream to read from.  */
-    void ReadBinaryFile(COB::Scene& out, StreamReaderLE* stream);
+    void ReadBinaryFile(COB::Scene &out, StreamReaderLE *stream);
 
     // Conversion to Assimp output format
-
-    aiNode* BuildNodes(const COB::Node& root,const COB::Scene& scin,aiScene* fill);
+    aiNode *BuildNodes(const COB::Node &root, const COB::Scene &scin, aiScene *fill);
 
 private:
     // ASCII file support
 
-    void UnsupportedChunk_Ascii(LineSplitter& splitter, const COB::ChunkInfo& nfo, const char* name);
-    void ReadChunkInfo_Ascii(COB::ChunkInfo& out, const LineSplitter& splitter);
-    void ReadBasicNodeInfo_Ascii(COB::Node& msh, LineSplitter& splitter, const COB::ChunkInfo& nfo);
-    template <typename T> void ReadFloat3Tuple_Ascii(T& fill, const char** in);
-
-    void ReadPolH_Ascii(COB::Scene& out, LineSplitter& splitter, const COB::ChunkInfo& nfo);
-    void ReadBitM_Ascii(COB::Scene& out, LineSplitter& splitter, const COB::ChunkInfo& nfo);
-    void ReadMat1_Ascii(COB::Scene& out, LineSplitter& splitter, const COB::ChunkInfo& nfo);
-    void ReadGrou_Ascii(COB::Scene& out, LineSplitter& splitter, const COB::ChunkInfo& nfo);
-    void ReadBone_Ascii(COB::Scene& out, LineSplitter& splitter, const COB::ChunkInfo& nfo);
-    void ReadCame_Ascii(COB::Scene& out, LineSplitter& splitter, const COB::ChunkInfo& nfo);
-    void ReadLght_Ascii(COB::Scene& out, LineSplitter& splitter, const COB::ChunkInfo& nfo);
-    void ReadUnit_Ascii(COB::Scene& out, LineSplitter& splitter, const COB::ChunkInfo& nfo);
-    void ReadChan_Ascii(COB::Scene& out, LineSplitter& splitter, const COB::ChunkInfo& nfo);
-
+    void UnsupportedChunk_Ascii(LineSplitter &splitter, const COB::ChunkInfo &nfo, const char *name);
+    void ReadChunkInfo_Ascii(COB::ChunkInfo &out, const LineSplitter &splitter);
+    void ReadBasicNodeInfo_Ascii(COB::Node &msh, LineSplitter &splitter, const COB::ChunkInfo &nfo);
+    template <typename T>
+    void ReadFloat3Tuple_Ascii(T &fill, const char **in);
+
+    void ReadPolH_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
+    void ReadBitM_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
+    void ReadMat1_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
+    void ReadGrou_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
+    void ReadBone_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
+    void ReadCame_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
+    void ReadLght_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
+    void ReadUnit_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
+    void ReadChan_Ascii(COB::Scene &out, LineSplitter &splitter, const COB::ChunkInfo &nfo);
 
     // Binary file support
 
-    void UnsupportedChunk_Binary(StreamReaderLE& reader, const COB::ChunkInfo& nfo, const char* name);
-    void ReadString_Binary(std::string& out, StreamReaderLE& reader);
-    void ReadBasicNodeInfo_Binary(COB::Node& msh, StreamReaderLE& reader, const COB::ChunkInfo& nfo);
-
-    void ReadPolH_Binary(COB::Scene& out, StreamReaderLE& reader, const COB::ChunkInfo& nfo);
-    void ReadBitM_Binary(COB::Scene& out, StreamReaderLE& reader, const COB::ChunkInfo& nfo);
-    void ReadMat1_Binary(COB::Scene& out, StreamReaderLE& reader, const COB::ChunkInfo& nfo);
-    void ReadCame_Binary(COB::Scene& out, StreamReaderLE& reader, const COB::ChunkInfo& nfo);
-    void ReadLght_Binary(COB::Scene& out, StreamReaderLE& reader, const COB::ChunkInfo& nfo);
-    void ReadGrou_Binary(COB::Scene& out, StreamReaderLE& reader, const COB::ChunkInfo& nfo);
-    void ReadUnit_Binary(COB::Scene& out, StreamReaderLE& reader, const COB::ChunkInfo& nfo);
-
+    void UnsupportedChunk_Binary(StreamReaderLE &reader, const COB::ChunkInfo &nfo, const char *name);
+    void ReadString_Binary(std::string &out, StreamReaderLE &reader);
+    void ReadBasicNodeInfo_Binary(COB::Node &msh, StreamReaderLE &reader, const COB::ChunkInfo &nfo);
+
+    void ReadPolH_Binary(COB::Scene &out, StreamReaderLE &reader, const COB::ChunkInfo &nfo);
+    void ReadBitM_Binary(COB::Scene &out, StreamReaderLE &reader, const COB::ChunkInfo &nfo);
+    void ReadMat1_Binary(COB::Scene &out, StreamReaderLE &reader, const COB::ChunkInfo &nfo);
+    void ReadCame_Binary(COB::Scene &out, StreamReaderLE &reader, const COB::ChunkInfo &nfo);
+    void ReadLght_Binary(COB::Scene &out, StreamReaderLE &reader, const COB::ChunkInfo &nfo);
+    void ReadGrou_Binary(COB::Scene &out, StreamReaderLE &reader, const COB::ChunkInfo &nfo);
+    void ReadUnit_Binary(COB::Scene &out, StreamReaderLE &reader, const COB::ChunkInfo &nfo);
 
 }; // !class COBImporter
 

+ 4 - 5
code/AssetLib/COB/COBScene.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -43,16 +42,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file  COBScene.h
 *  @brief Utilities for the COB importer.
 */
+#pragma once
 #ifndef INCLUDED_AI_COB_SCENE_H
 #define INCLUDED_AI_COB_SCENE_H
 
-#include <memory>
-#include <deque>
-#include <map>
-
 #include <assimp/BaseImporter.h>
 #include <assimp/material.h>
 
+#include <deque>
+#include <map>
+
 namespace Assimp {
 namespace COB {
 

+ 11 - 15
code/AssetLib/CSM/CSMLoader.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -48,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include <assimp/BaseImporter.h>
 
-namespace Assimp    {
+namespace Assimp {
 
 // ---------------------------------------------------------------------------
 /** Importer class to load MOCAPs in CharacterStudio Motion format.
@@ -59,35 +58,32 @@ namespace Assimp    {
  *  Link to file format specification:
  *  <max_8_dvd>\samples\Motion\Docs\CSM.rtf
 */
-class CSMImporter : public BaseImporter
-{
+class CSMImporter : public BaseImporter {
 public:
     CSMImporter();
-    ~CSMImporter();
-
+    ~CSMImporter() override;
 
-public:
     // -------------------------------------------------------------------
-    bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
+    bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
+            bool checkSig) const override;
 
 protected:
-
     // -------------------------------------------------------------------
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc *GetInfo() const override;
 
     // -------------------------------------------------------------------
-    void SetupProperties(const Importer* pImp);
+    void SetupProperties(const Importer *pImp) override;
 
     // -------------------------------------------------------------------
-    void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
+    void InternReadFile(const std::string &pFile, aiScene *pScene,
+            IOSystem *pIOHandler) override;
 
 private:
-
     bool noSkeletonMesh;
 
 }; // end of class CSMImporter
+
 } // end of namespace Assimp
+
 #endif // AI_AC3DIMPORTER_H_INC
 

+ 0 - 1
code/AssetLib/Collada/ColladaLoader.cpp

@@ -47,7 +47,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "ColladaParser.h"
 #include <assimp/ColladaMetaData.h>
 #include <assimp/CreateAnimMesh.h>
-#include <assimp/Defines.h>
 #include <assimp/ParsingUtils.h>
 #include <assimp/SkeletonMeshBuilder.h>
 #include <assimp/ZipArchiveIOSystem.h>

+ 1 - 0
code/AssetLib/Collada/ColladaParser.h

@@ -43,6 +43,7 @@
  *  @brief Defines the parser helper class for the collada loader
  */
 
+#pragma once
 #ifndef AI_COLLADAPARSER_H_INC
 #define AI_COLLADAPARSER_H_INC
 

+ 6 - 9
code/AssetLib/DXF/DXFLoader.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -43,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file  DXFLoader.h
  *  @brief Declaration of the .dxf importer class.
  */
+#pragma once
 #ifndef AI_DXFLOADER_H_INCLUDED
 #define AI_DXFLOADER_H_INCLUDED
 
@@ -59,7 +59,7 @@ namespace DXF {
     struct Block;
     struct InsertBlock;
 
-    typedef std::map<std::string, const DXF::Block*> BlockMap;
+    using BlockMap = std::map<std::string, const DXF::Block*>;
 }
 
 // ---------------------------------------------------------------------------
@@ -69,29 +69,26 @@ namespace DXF {
 class DXFImporter : public BaseImporter {
 public:
     DXFImporter();
-    ~DXFImporter();
+    ~DXFImporter() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
     * See BaseImporter::CanRead() for details.  */
     bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
+        bool checkSig) const override;
 
 protected:
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details*/
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc* GetInfo () const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
      * See BaseImporter::InternReadFile() for details */
-    void InternReadFile( const std::string& pFile,
-        aiScene* pScene,
-        IOSystem* pIOHandler);
+    void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) override;
 
 private:
-
     // -----------------------------------------------------
     void SkipSection(DXF::LineReader& reader);
 

+ 6 - 5
code/AssetLib/FBX/FBXImporter.h

@@ -70,28 +70,29 @@ typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>
 class FBXImporter : public BaseImporter, public LogFunctions<FBXImporter> {
 public:
     FBXImporter();
-    virtual ~FBXImporter();
+    ~FBXImporter() override;
 
     // --------------------
     bool CanRead(const std::string &pFile,
             IOSystem *pIOHandler,
-            bool checkSig) const;
+            bool checkSig) const override;
 
 protected:
     // --------------------
-    const aiImporterDesc *GetInfo() const;
+    const aiImporterDesc *GetInfo() const override;
 
     // --------------------
-    void SetupProperties(const Importer *pImp);
+    void SetupProperties(const Importer *pImp) override;
 
     // --------------------
     void InternReadFile(const std::string &pFile,
             aiScene *pScene,
-            IOSystem *pIOHandler);
+            IOSystem *pIOHandler) override;
 
 private:
     FBX::ImportSettings settings;
 }; // !class FBXImporter
 
 } // end of namespace Assimp
+
 #endif // !INCLUDED_AI_FBX_IMPORTER_H

+ 20 - 33
code/AssetLib/HMP/HMPLoader.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -42,15 +41,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file  HMPLoader.h
  *  @brief Declaration of the HMP importer class
  */
-
+#pragma once
 #ifndef AI_HMPLOADER_H_INCLUDED
 #define AI_HMPLOADER_H_INCLUDED
 
-// internal headers
 #include <assimp/BaseImporter.h>
 
-#include "AssetLib/MDL/MDLLoader.h"
+// internal headers
 #include "AssetLib/HMP/HMPFileData.h"
+#include "AssetLib/MDL/MDLLoader.h"
 
 namespace Assimp {
 using namespace HMP;
@@ -58,66 +57,58 @@ using namespace HMP;
 // ---------------------------------------------------------------------------
 /** Used to load 3D GameStudio HMP files (terrains)
 */
-class HMPImporter : public MDLImporter
-{
+class HMPImporter : public MDLImporter {
 public:
     HMPImporter();
-    ~HMPImporter();
-
-
-public:
+    ~HMPImporter() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
      * See BaseImporter::CanRead() for details.
      */
-    bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
+    bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
+            bool checkSig) const override;
 
 protected:
-
-
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc *GetInfo() const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
     * See BaseImporter::InternReadFile() for details
     */
-    void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
-
-protected:
+    void InternReadFile(const std::string &pFile, aiScene *pScene,
+            IOSystem *pIOHandler) override;
 
     // -------------------------------------------------------------------
     /** Import a HMP4 file
     */
-    void InternReadFile_HMP4( );
+    void InternReadFile_HMP4();
 
     // -------------------------------------------------------------------
     /** Import a HMP5 file
     */
-    void InternReadFile_HMP5( );
+    void InternReadFile_HMP5();
 
     // -------------------------------------------------------------------
     /** Import a HMP7 file
     */
-    void InternReadFile_HMP7( );
+    void InternReadFile_HMP7();
 
     // -------------------------------------------------------------------
     /** Validate a HMP 5,4,7 file header
     */
-    void ValidateHeader_HMP457( );
+    void ValidateHeader_HMP457();
 
     // -------------------------------------------------------------------
     /** Try to load one material from the file, if this fails create
      * a default material
     */
-    void CreateMaterial(const unsigned char* szCurrent,
-        const unsigned char** szCurrentOut);
+    void CreateMaterial(const unsigned char *szCurrent,
+            const unsigned char **szCurrentOut);
 
     // -------------------------------------------------------------------
     /** Build a list of output faces and vertices. The function
@@ -125,7 +116,7 @@ protected:
      * \param width Width of the height field
      * \param width Height of the height field
     */
-    void CreateOutputFaceList(unsigned int width,unsigned int height);
+    void CreateOutputFaceList(unsigned int width, unsigned int height);
 
     // -------------------------------------------------------------------
     /** Generate planar texture coordinates for a terrain
@@ -133,21 +124,17 @@ protected:
      * \param height Height of the terrain, in vertices
     */
     void GenerateTextureCoords(const unsigned int width,
-        const unsigned int height);
+            const unsigned int height);
 
     // -------------------------------------------------------------------
     /** Read the first skin from the file and skip all others ...
      *  \param iNumSkins Number of skins in the file
      *  \param szCursor Position of the first skin (offset 84)
     */
-    void ReadFirstSkin(unsigned int iNumSkins, const unsigned char* szCursor,
-        const unsigned char** szCursorOut);
-
-private:
-
+    void ReadFirstSkin(unsigned int iNumSkins, const unsigned char *szCursor,
+            const unsigned char **szCursorOut);
 };
 
 } // end of namespace Assimp
 
 #endif // AI_HMPIMPORTER_H_INC
-

+ 0 - 1
code/AssetLib/IFC/IFCBoolean.cpp

@@ -48,7 +48,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "Common/PolyTools.h"
 #include "PostProcessing/ProcessHelper.h"
 
-#include <assimp/Defines.h>
 
 #include <iterator>
 #include <tuple>

+ 34 - 52
code/AssetLib/IFC/IFCLoader.h

@@ -49,18 +49,22 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <assimp/BaseImporter.h>
 #include <assimp/LogAux.h>
 
-namespace Assimp    {
+namespace Assimp {
 
-    // TinyFormatter.h
-    namespace Formatter {
-        template <typename T,typename TR, typename A> class basic_formatter;
-        typedef class basic_formatter< char, std::char_traits<char>, std::allocator<char> > format;
-    }
+// TinyFormatter.h
+namespace Formatter {
 
-    namespace STEP {
-        class DB;
-    }
+template <typename T, typename TR, typename A>
+class basic_formatter;
+typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>> format;
 
+} // namespace Formatter
+
+namespace STEP {
+
+class DB;
+
+}
 
 // -------------------------------------------------------------------------------------------
 /** Load the IFC format, which is an open specification to describe building and construction
@@ -69,63 +73,41 @@ namespace Assimp    {
  See http://en.wikipedia.org/wiki/Industry_Foundation_Classes
 */
 // -------------------------------------------------------------------------------------------
-class IFCImporter : public BaseImporter, public LogFunctions<IFCImporter>
-{
+class IFCImporter : public BaseImporter, public LogFunctions<IFCImporter> {
 public:
-    IFCImporter();
-    ~IFCImporter();
+    // loader settings, publicly accessible via their corresponding AI_CONFIG constants
+    struct Settings {
+        Settings() :
+                skipSpaceRepresentations(), useCustomTriangulation(), skipAnnotations(), conicSamplingAngle(10.f), cylindricalTessellation(32) {}
 
+        bool skipSpaceRepresentations;
+        bool useCustomTriangulation;
+        bool skipAnnotations;
+        float conicSamplingAngle;
+        int cylindricalTessellation;
+    };
 
-public:
+    IFCImporter();
+    ~IFCImporter() override;
 
     // --------------------
-    bool CanRead( const std::string& pFile,
-        IOSystem* pIOHandler,
-        bool checkSig
-    ) const;
+    bool CanRead(const std::string &pFile,
+            IOSystem *pIOHandler,
+            bool checkSig) const override;
 
 protected:
-
     // --------------------
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc *GetInfo() const override;
 
     // --------------------
-    void SetupProperties(const Importer* pImp);
+    void SetupProperties(const Importer *pImp) override;
 
     // --------------------
-    void InternReadFile( const std::string& pFile,
-        aiScene* pScene,
-        IOSystem* pIOHandler
-    );
-
-private:
-
-
-public:
-
-
-    // loader settings, publicly accessible via their corresponding AI_CONFIG constants
-    struct Settings
-    {
-        Settings()
-            : skipSpaceRepresentations()
-            , useCustomTriangulation()
-            , skipAnnotations()
-            , conicSamplingAngle(10.f)
-			, cylindricalTessellation(32)
-        {}
-
-
-        bool skipSpaceRepresentations;
-        bool useCustomTriangulation;
-        bool skipAnnotations;
-        float conicSamplingAngle;
-		int cylindricalTessellation;
-    };
-
+    void InternReadFile(const std::string &pFile,
+            aiScene *pScene,
+            IOSystem *pIOHandler) override;
 
 private:
-
     Settings settings;
 
 }; // !class IFCImporter

+ 0 - 1
code/AssetLib/IFC/IFCUtil.cpp

@@ -49,7 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "AssetLib/IFC/IFCUtil.h"
 #include "Common/PolyTools.h"
 #include "PostProcessing/ProcessHelper.h"
-#include <assimp/Defines.h>
 
 namespace Assimp {
 namespace IFC {

+ 5 - 6
code/AssetLib/Irr/IRRLoader.h

@@ -65,22 +65,21 @@ namespace Assimp    {
 class IRRImporter : public BaseImporter, public IrrlichtBase {
 public:
     IRRImporter();
-    ~IRRImporter();
+    ~IRRImporter() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
      *  See BaseImporter::CanRead() for details.
      */
     bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
+        bool checkSig) const override;
 
 protected:
-    const aiImporterDesc* GetInfo () const;
-    void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler);
-    void SetupProperties(const Importer* pImp);
+    const aiImporterDesc* GetInfo () const override;
+    void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) override;
+    void SetupProperties(const Importer* pImp) override;
 
 private:
-
     /** Data structure for a scene-graph node animator
      */
     struct Animator {

+ 4 - 4
code/AssetLib/Irr/IRRMeshLoader.h

@@ -63,28 +63,28 @@ namespace Assimp {
 class IRRMeshImporter : public BaseImporter, public IrrlichtBase {
 public:
     IRRMeshImporter();
-    ~IRRMeshImporter();
+    ~IRRMeshImporter() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
      *  See BaseImporter::CanRead() for details.
      */
     bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
-            bool checkSig) const;
+            bool checkSig) const override;
 
 protected:
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc *GetInfo() const;
+    const aiImporterDesc *GetInfo() const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
      * See BaseImporter::InternReadFile() for details
      */
     void InternReadFile(const std::string &pFile, aiScene *pScene,
-            IOSystem *pIOHandler);
+            IOSystem *pIOHandler) override;
 };
 
 } // end of namespace Assimp

+ 1 - 1
code/AssetLib/Irr/IRRShared.h

@@ -9,7 +9,7 @@
 
 #include <assimp/BaseImporter.h>
 #include <assimp/XmlParser.h>
-#include <stdint.h>
+#include <cstdint>
 
 struct aiMaterial;
 

+ 95 - 113
code/AssetLib/LWO/LWOLoader.h

@@ -41,15 +41,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 /** @file Declaration of the LWO importer class. */
+#pragma once
 #ifndef AI_LWOLOADER_H_INCLUDED
 #define AI_LWOLOADER_H_INCLUDED
 
-#include <assimp/types.h>
-#include <assimp/material.h>
-#include <assimp/DefaultLogger.hpp>
-
 #include "LWOFileData.h"
 #include <assimp/BaseImporter.h>
+#include <assimp/material.h>
+#include <assimp/DefaultLogger.hpp>
 
 #include <map>
 
@@ -57,7 +56,7 @@ struct aiTexture;
 struct aiNode;
 struct aiMaterial;
 
-namespace Assimp    {
+namespace Assimp {
 using namespace LWO;
 
 // ---------------------------------------------------------------------------
@@ -70,41 +69,38 @@ using namespace LWO;
  *         they aren't specific to one format version
 */
 // ---------------------------------------------------------------------------
-class LWOImporter : public BaseImporter
-{
+class LWOImporter : public BaseImporter {
 public:
     LWOImporter();
-    ~LWOImporter();
+    ~LWOImporter() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
      * See BaseImporter::CanRead() for details.
      */
-    bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
+    bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
+            bool checkSig) const override;
 
     // -------------------------------------------------------------------
     /** Called prior to ReadFile().
     * The function is a request to the importer to update its configuration
     * basing on the Importer's configuration property list.
     */
-    void SetupProperties(const Importer* pImp);
+    void SetupProperties(const Importer *pImp) override;
 
 protected:
-
     // -------------------------------------------------------------------
     // Get list of supported extensions
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc *GetInfo() const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
     * See BaseImporter::InternReadFile() for details
     */
-    void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
+    void InternReadFile(const std::string &pFile, aiScene *pScene,
+            IOSystem *pIOHandler) override;
 
 private:
-
     // -------------------------------------------------------------------
     /** Loads a LWO file in the older LWOB format (LW < 6)
      */
@@ -115,16 +111,14 @@ private:
      */
     void LoadLWO2File();
 
-
     // -------------------------------------------------------------------
     /** Parsing functions used for all file format versions
     */
-    inline void GetS0(std::string& out,unsigned int max);
+    inline void GetS0(std::string &out, unsigned int max);
     inline float GetF4();
     inline uint32_t GetU4();
     inline uint16_t GetU2();
-    inline uint8_t  GetU1();
-
+    inline uint8_t GetU1();
 
     // -------------------------------------------------------------------
     /** Loads a surface chunk from an LWOB file
@@ -143,28 +137,28 @@ private:
      *  @param size Maximum size to be read, in bytes.
      *  @param head Header of the SUF.BLOK header
      */
-    void LoadLWO2TextureBlock(LE_NCONST IFF::SubChunkHeader* head,
-        unsigned int size );
+    void LoadLWO2TextureBlock(LE_NCONST IFF::SubChunkHeader *head,
+            unsigned int size);
 
     // -------------------------------------------------------------------
     /** Loads a shader block from a LWO2 file.
      *  @param size Maximum size to be read, in bytes.
      *  @param head Header of the SUF.BLOK header
      */
-    void LoadLWO2ShaderBlock(LE_NCONST IFF::SubChunkHeader* head,
-        unsigned int size );
+    void LoadLWO2ShaderBlock(LE_NCONST IFF::SubChunkHeader *head,
+            unsigned int size);
 
     // -------------------------------------------------------------------
     /** Loads an image map from a LWO2 file
      *  @param size Maximum size to be read, in bytes.
      *  @param tex Texture object to be filled
      */
-    void LoadLWO2ImageMap(unsigned int size, LWO::Texture& tex );
-    void LoadLWO2Gradient(unsigned int size, LWO::Texture& tex );
-    void LoadLWO2Procedural(unsigned int size, LWO::Texture& tex );
+    void LoadLWO2ImageMap(unsigned int size, LWO::Texture &tex);
+    void LoadLWO2Gradient(unsigned int size, LWO::Texture &tex);
+    void LoadLWO2Procedural(unsigned int size, LWO::Texture &tex);
 
     // loads the header - used by thethree functions above
-    void LoadLWO2TextureHeader(unsigned int size, LWO::Texture& tex );
+    void LoadLWO2TextureHeader(unsigned int size, LWO::Texture &tex);
 
     // -------------------------------------------------------------------
     /** Loads the LWO tag list from the file
@@ -213,30 +207,30 @@ private:
     // -------------------------------------------------------------------
     /** Count vertices and faces in a LWOB/LWO2 file
     */
-    void CountVertsAndFacesLWO2(unsigned int& verts,
-        unsigned int& faces,
-        uint16_t*& cursor,
-        const uint16_t* const end,
-        unsigned int max = UINT_MAX);
+    void CountVertsAndFacesLWO2(unsigned int &verts,
+            unsigned int &faces,
+            uint16_t *&cursor,
+            const uint16_t *const end,
+            unsigned int max = UINT_MAX);
 
-    void CountVertsAndFacesLWOB(unsigned int& verts,
-        unsigned int& faces,
-        LE_NCONST uint16_t*& cursor,
-        const uint16_t* const end,
-        unsigned int max = UINT_MAX);
+    void CountVertsAndFacesLWOB(unsigned int &verts,
+            unsigned int &faces,
+            LE_NCONST uint16_t *&cursor,
+            const uint16_t *const end,
+            unsigned int max = UINT_MAX);
 
     // -------------------------------------------------------------------
     /** Read vertices and faces in a LWOB/LWO2 file
     */
-    void CopyFaceIndicesLWO2(LWO::FaceList::iterator& it,
-        uint16_t*& cursor,
-        const uint16_t* const end);
+    void CopyFaceIndicesLWO2(LWO::FaceList::iterator &it,
+            uint16_t *&cursor,
+            const uint16_t *const end);
 
     // -------------------------------------------------------------------
-    void CopyFaceIndicesLWOB(LWO::FaceList::iterator& it,
-        LE_NCONST uint16_t*& cursor,
-        const uint16_t* const end,
-        unsigned int max = UINT_MAX);
+    void CopyFaceIndicesLWOB(LWO::FaceList::iterator &it,
+            LE_NCONST uint16_t *&cursor,
+            const uint16_t *const end,
+            unsigned int max = UINT_MAX);
 
     // -------------------------------------------------------------------
     /** Resolve the tag and surface lists that have been loaded.
@@ -257,19 +251,18 @@ private:
      *  @param in Input texture list
      *  @param type Type identifier of the texture list
     */
-    bool HandleTextures(aiMaterial* pcMat, const TextureList& in,
-        aiTextureType type);
+    bool HandleTextures(aiMaterial *pcMat, const TextureList &in,
+            aiTextureType type);
 
     // -------------------------------------------------------------------
     /** Adjust a texture path
     */
-    void AdjustTexturePath(std::string& out);
+    void AdjustTexturePath(std::string &out);
 
     // -------------------------------------------------------------------
     /** Convert a LWO surface description to an ASSIMP material
     */
-    void ConvertMaterial(const LWO::Surface& surf,aiMaterial* pcMat);
-
+    void ConvertMaterial(const LWO::Surface &surf, aiMaterial *pcMat);
 
     // -------------------------------------------------------------------
     /** Get a list of all UV/VC channels required by a specific surface.
@@ -279,27 +272,27 @@ private:
      *  @param out Output list. The members are indices into the
      *    UV/VC channel lists of the layer
     */
-    void FindUVChannels(/*const*/ LWO::Surface& surf,
-        LWO::SortedRep& sorted,
-        /*const*/ LWO::Layer& layer,
-        unsigned int out[AI_MAX_NUMBER_OF_TEXTURECOORDS]);
+    void FindUVChannels(/*const*/ LWO::Surface &surf,
+            LWO::SortedRep &sorted,
+            /*const*/ LWO::Layer &layer,
+            unsigned int out[AI_MAX_NUMBER_OF_TEXTURECOORDS]);
 
     // -------------------------------------------------------------------
-    char FindUVChannels(LWO::TextureList& list,
-        LWO::Layer& layer,LWO::UVChannel& uv, unsigned int next);
+    char FindUVChannels(LWO::TextureList &list,
+            LWO::Layer &layer, LWO::UVChannel &uv, unsigned int next);
 
     // -------------------------------------------------------------------
-    void FindVCChannels(const LWO::Surface& surf,
-        LWO::SortedRep& sorted,
-        const LWO::Layer& layer,
-        unsigned int out[AI_MAX_NUMBER_OF_COLOR_SETS]);
+    void FindVCChannels(const LWO::Surface &surf,
+            LWO::SortedRep &sorted,
+            const LWO::Layer &layer,
+            unsigned int out[AI_MAX_NUMBER_OF_COLOR_SETS]);
 
     // -------------------------------------------------------------------
     /** Generate the final node graph
      *  Unused nodes are deleted.
      *  @param apcNodes Flat list of nodes
     */
-    void GenerateNodeGraph(std::map<uint16_t,aiNode*>& apcNodes);
+    void GenerateNodeGraph(std::map<uint16_t, aiNode *> &apcNodes);
 
     // -------------------------------------------------------------------
     /** Add children to a node
@@ -307,14 +300,14 @@ private:
      *  @param parent Index of the node
      *  @param apcNodes Flat list of nodes - used nodes are set to nullptr.
     */
-    void AddChildren(aiNode* node, uint16_t parent,
-        std::vector<aiNode*>& apcNodes);
+    void AddChildren(aiNode *node, uint16_t parent,
+            std::vector<aiNode *> &apcNodes);
 
     // -------------------------------------------------------------------
     /** Read a variable sized integer
      *  @param inout Input and output buffer
     */
-    int ReadVSizedIntLWO2(uint8_t*& inout);
+    int ReadVSizedIntLWO2(uint8_t *&inout);
 
     // -------------------------------------------------------------------
     /** Assign a value from a VMAP to a vertex and all vertices
@@ -325,8 +318,8 @@ private:
      *  @param data Value of the VMAP to be assigned - read numRead
      *    floats from this array.
     */
-    void DoRecursiveVMAPAssignment(VMapEntry* base, unsigned int numRead,
-        unsigned int idx, float* data);
+    void DoRecursiveVMAPAssignment(VMapEntry *base, unsigned int numRead,
+            unsigned int idx, float *data);
 
     // -------------------------------------------------------------------
     /** Compute normal vectors for a mesh
@@ -334,9 +327,8 @@ private:
      *  @param smoothingGroups Smoothing-groups-per-face array
      *  @param surface Surface for the mesh
     */
-    void ComputeNormals(aiMesh* mesh, const std::vector<unsigned int>& smoothingGroups,
-        const LWO::Surface& surface);
-
+    void ComputeNormals(aiMesh *mesh, const std::vector<unsigned int> &smoothingGroups,
+            const LWO::Surface &surface);
 
     // -------------------------------------------------------------------
     /** Setup a new texture after the corresponding chunk was
@@ -345,11 +337,10 @@ private:
      *  @param size Maximum number of bytes to be read
      *  @return Pointer to new texture
     */
-    LWO::Texture* SetupNewTextureLWOB(LWO::TextureList& list,
-        unsigned int size);
+    LWO::Texture *SetupNewTextureLWOB(LWO::TextureList &list,
+            unsigned int size);
 
 protected:
-
     /** true if the file is a LWO2 file*/
     bool mIsLWO2;
 
@@ -357,20 +348,20 @@ protected:
     bool mIsLXOB;
 
     /** Temporary list of layers from the file */
-    LayerList* mLayers;
+    LayerList *mLayers;
 
     /** Pointer to the current layer */
-    LWO::Layer* mCurLayer;
+    LWO::Layer *mCurLayer;
 
     /** Temporary tag list from the file */
-    TagList* mTags;
+    TagList *mTags;
 
     /** Mapping table to convert from tag to surface indices.
         UINT_MAX indicates that a no corresponding surface is available */
-    TagMappingTable* mMapping;
+    TagMappingTable *mMapping;
 
     /** Temporary surface list from the file */
-    SurfaceList* mSurfaces;
+    SurfaceList *mSurfaces;
 
     /** Temporary clip list from the file */
     ClipList mClips;
@@ -379,13 +370,13 @@ protected:
     EnvelopeList mEnvelopes;
 
     /** file buffer */
-    uint8_t* mFileBuffer;
+    uint8_t *mFileBuffer;
 
     /** Size of the file, in bytes */
     unsigned int fileSize;
 
     /** Output scene */
-    aiScene* mScene;
+    aiScene *mScene;
 
     /** Configuration option: speed flag set? */
     bool configSpeedFlag;
@@ -394,16 +385,14 @@ protected:
     unsigned int configLayerIndex;
 
     /** Configuration option: name of layer to be loaded */
-    std::string  configLayerName;
+    std::string configLayerName;
 
     /** True if we have a named layer */
     bool hasNamedLayer;
 };
 
-
 // ------------------------------------------------------------------------------------------------
-inline
-float LWOImporter::GetF4() {
+inline float LWOImporter::GetF4() {
     float f;
     ::memcpy(&f, mFileBuffer, 4);
     mFileBuffer += 4;
@@ -412,8 +401,7 @@ float LWOImporter::GetF4() {
 }
 
 // ------------------------------------------------------------------------------------------------
-inline uint32_t LWOImporter::GetU4()
-{
+inline uint32_t LWOImporter::GetU4() {
     uint32_t f;
     ::memcpy(&f, mFileBuffer, 4);
     mFileBuffer += 4;
@@ -422,8 +410,7 @@ inline uint32_t LWOImporter::GetU4()
 }
 
 // ------------------------------------------------------------------------------------------------
-inline uint16_t LWOImporter::GetU2()
-{
+inline uint16_t LWOImporter::GetU2() {
     uint16_t f;
     ::memcpy(&f, mFileBuffer, 2);
     mFileBuffer += 2;
@@ -432,55 +419,50 @@ inline uint16_t LWOImporter::GetU2()
 }
 
 // ------------------------------------------------------------------------------------------------
-inline uint8_t LWOImporter::GetU1()
-{
+inline uint8_t LWOImporter::GetU1() {
     return *mFileBuffer++;
 }
 
 // ------------------------------------------------------------------------------------------------
-inline int LWOImporter::ReadVSizedIntLWO2(uint8_t*& inout)
-{
+inline int LWOImporter::ReadVSizedIntLWO2(uint8_t *&inout) {
     int i;
-    int c = *inout;inout++;
-    if(c != 0xFF)
-    {
+    int c = *inout;
+    inout++;
+    if (c != 0xFF) {
         i = c << 8;
-        c = *inout;inout++;
+        c = *inout;
+        inout++;
         i |= c;
-    }
-    else
-    {
-        c = *inout;inout++;
+    } else {
+        c = *inout;
+        inout++;
         i = c << 16;
-        c = *inout;inout++;
+        c = *inout;
+        inout++;
         i |= c << 8;
-        c = *inout;inout++;
+        c = *inout;
+        inout++;
         i |= c;
     }
     return i;
 }
 
 // ------------------------------------------------------------------------------------------------
-inline void LWOImporter::GetS0(std::string& out,unsigned int max)
-{
+inline void LWOImporter::GetS0(std::string &out, unsigned int max) {
     unsigned int iCursor = 0;
-    const char*sz = (const char*)mFileBuffer;
-    while (*mFileBuffer)
-    {
-        if (++iCursor > max)
-        {
+    const char *sz = (const char *)mFileBuffer;
+    while (*mFileBuffer) {
+        if (++iCursor > max) {
             ASSIMP_LOG_WARN("LWO: Invalid file, string is is too long");
             break;
         }
         ++mFileBuffer;
     }
-    size_t len = (size_t) ((const char*)mFileBuffer-sz);
-    out = std::string(sz,len);
-    mFileBuffer += (len&0x1 ? 1 : 2);
+    size_t len = (size_t)((const char *)mFileBuffer - sz);
+    out = std::string(sz, len);
+    mFileBuffer += (len & 0x1 ? 1 : 2);
 }
 
-
-
 } // end of namespace Assimp
 
 #endif // AI_LWOIMPORTER_H_INCLUDED

+ 7 - 7
code/AssetLib/LWS/LWSLoader.h

@@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file  LWSLoader.h
  *  @brief Declaration of the LightWave scene importer class.
  */
+#pragma once
 #ifndef AI_LWSLOADER_H_INCLUDED
 #define AI_LWSLOADER_H_INCLUDED
 
@@ -53,6 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 struct aiImporterDesc;
 
 namespace Assimp {
+
 class BatchLoader;
 class Importer;
 class IOSystem;
@@ -172,26 +174,26 @@ struct NodeDesc {
 class LWSImporter : public BaseImporter {
 public:
     LWSImporter();
-    ~LWSImporter();
+    ~LWSImporter() override;
 
     // -------------------------------------------------------------------
     // Check whether we can read a specific file
     bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
-            bool checkSig) const;
+            bool checkSig) const override;
 
 protected:
     // -------------------------------------------------------------------
     // Get list of supported extensions
-    const aiImporterDesc *GetInfo() const;
+    const aiImporterDesc *GetInfo() const override;
 
     // -------------------------------------------------------------------
     // Import file into given scene data structure
     void InternReadFile(const std::string &pFile, aiScene *pScene,
-            IOSystem *pIOHandler);
+            IOSystem *pIOHandler) override;
 
     // -------------------------------------------------------------------
     // Setup import properties
-    void SetupProperties(const Importer *pImp);
+    void SetupProperties(const Importer *pImp) override;
 
 private:
     // -------------------------------------------------------------------
@@ -226,9 +228,7 @@ private:
 private:
     bool configSpeedFlag;
     IOSystem *io;
-
     double first, last, fps;
-
     bool noSkeletonMesh;
 };
 

+ 11 - 9
code/AssetLib/M3D/M3DImporter.h

@@ -65,21 +65,20 @@ class M3DImporter : public BaseImporter {
 public:
 	/// \brief  Default constructor
 	M3DImporter();
+    ~M3DImporter() override {}
 
-public:
 	/// \brief  Returns whether the class can handle the format of the given file.
 	/// \remark See BaseImporter::CanRead() for details.
-	bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const;
-
-private:
-	aiScene *mScene = nullptr; // the scene to import to
+	bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override;
 
-	//! \brief  Appends the supported extension.
-	const aiImporterDesc *GetInfo() const;
+protected:
+    //! \brief  Appends the supported extension.
+    const aiImporterDesc *GetInfo() const override;
 
-	//! \brief  File import implementation.
-	void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler);
+    //! \brief  File import implementation.
+    void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
 
+private:
 	void importMaterials(const M3DWrapper &m3d);
 	void importTextures(const M3DWrapper &m3d);
 	void importMeshes(const M3DWrapper &m3d);
@@ -94,6 +93,9 @@ private:
 	void populateMesh(const M3DWrapper &m3d, aiMesh *pMesh, std::vector<aiFace> *faces, std::vector<aiVector3D> *verteces,
 			std::vector<aiVector3D> *normals, std::vector<aiVector3D> *texcoords, std::vector<aiColor4D> *colors,
 			std::vector<unsigned int> *vertexids);
+
+private:
+    aiScene *mScene = nullptr; // the scene to import to
 };
 
 } // Namespace Assimp

+ 14 - 22
code/AssetLib/MD2/MD2Loader.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -43,61 +42,55 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file  MD2Loader.h
  *  @brief Declaration of the .MD2 importer class.
  */
+#pragma once
 #ifndef AI_MD2LOADER_H_INCLUDED
 #define AI_MD2LOADER_H_INCLUDED
 
+#include "MD2FileData.h"
 #include <assimp/BaseImporter.h>
-#include <assimp/types.h>
 #include <assimp/ByteSwapper.h>
-#include "MD2FileData.h"
+#include <assimp/types.h>
 
 struct aiNode;
 
-namespace Assimp  {
+namespace Assimp {
 
 using namespace MD2;
 
 // ---------------------------------------------------------------------------
 /** Importer class for MD2
 */
-class MD2Importer : public BaseImporter
-{
+class MD2Importer : public BaseImporter {
 public:
     MD2Importer();
-    ~MD2Importer();
-
-
-public:
+    ~MD2Importer() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
     * See BaseImporter::CanRead() for details.  */
-    bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
-
+    bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
+            bool checkSig) const override;
 
     // -------------------------------------------------------------------
     /** Called prior to ReadFile().
     * The function is a request to the importer to update its configuration
     * basing on the Importer's configuration property list.
     */
-    void SetupProperties(const Importer* pImp);
+    void SetupProperties(const Importer *pImp) override;
 
 protected:
-
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc *GetInfo() const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
     * See BaseImporter::InternReadFile() for details
     */
-    void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
-
+    void InternReadFile(const std::string &pFile, aiScene *pScene,
+            IOSystem *pIOHandler) override;
 
     // -------------------------------------------------------------------
     /** Validate the header of the file
@@ -105,15 +98,14 @@ protected:
     void ValidateHeader();
 
 protected:
-
     /** Configuration option: frame to be loaded */
     unsigned int configFrameID;
 
     /** Header of the MD2 file */
-    BE_NCONST MD2::Header* m_pcHeader;
+    BE_NCONST MD2::Header *m_pcHeader;
 
     /** Buffer to hold the loaded file */
-    BE_NCONST uint8_t* mBuffer;
+    BE_NCONST uint8_t *mBuffer;
 
     /** Size of the file, in bytes */
     unsigned int fileSize;

+ 43 - 65
code/AssetLib/MD3/MD3Loader.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -46,9 +45,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #ifndef AI_MD3LOADER_H_INCLUDED
 #define AI_MD3LOADER_H_INCLUDED
 
+#include "MD3FileData.h"
 #include <assimp/BaseImporter.h>
 #include <assimp/ByteSwapper.h>
-#include "MD3FileData.h"
 #include <assimp/StringComparison.h>
 #include <assimp/types.h>
 
@@ -56,8 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 struct aiMaterial;
 
-namespace Assimp    {
-
+namespace Assimp {
 
 using namespace MD3;
 namespace Q3Shader {
@@ -65,16 +63,14 @@ namespace Q3Shader {
 // ---------------------------------------------------------------------------
 /** @brief Tiny utility data structure to hold the data of a .skin file
  */
-struct SkinData
-{
-    //! A single entryin texture list
-    struct TextureEntry : public std::pair<std::string,std::string>
-    {
+struct SkinData {
+    //! A single entry in texture list
+    struct TextureEntry : public std::pair<std::string, std::string> {
         // did we resolve this texture entry?
         bool resolved;
 
         // for std::find()
-        bool operator == (const std::string& f) const {
+        bool operator==(const std::string &f) const {
             return f == first;
         }
     };
@@ -88,8 +84,7 @@ struct SkinData
 // ---------------------------------------------------------------------------
 /** @brief Specifies cull modi for Quake shader files.
  */
-enum ShaderCullMode
-{
+enum ShaderCullMode {
     CULL_NONE,
     CULL_CW,
     CULL_CCW
@@ -98,8 +93,7 @@ enum ShaderCullMode
 // ---------------------------------------------------------------------------
 /** @brief Specifies alpha blend modi (src + dest) for Quake shader files
  */
-enum BlendFunc
-{
+enum BlendFunc {
     BLEND_NONE,
     BLEND_GL_ONE,
     BLEND_GL_ZERO,
@@ -112,8 +106,7 @@ enum BlendFunc
 // ---------------------------------------------------------------------------
 /** @brief Specifies alpha test modi for Quake texture maps
  */
-enum AlphaTestFunc
-{
+enum AlphaTestFunc {
     AT_NONE,
     AT_GT0,
     AT_LT128,
@@ -123,36 +116,31 @@ enum AlphaTestFunc
 // ---------------------------------------------------------------------------
 /** @brief Tiny utility data structure to hold a .shader map data block
  */
-struct ShaderMapBlock
-{
+struct ShaderMapBlock {
     ShaderMapBlock() AI_NO_EXCEPT
-         :  blend_src   (BLEND_NONE)
-         ,  blend_dest  (BLEND_NONE)
-         ,  alpha_test  (AT_NONE)
-    {}
+            : blend_src(BLEND_NONE),
+              blend_dest(BLEND_NONE),
+              alpha_test(AT_NONE) {}
 
     //! Name of referenced map
     std::string name;
 
     //! Blend and alpha test settings for texture
-    BlendFunc blend_src,blend_dest;
+    BlendFunc blend_src, blend_dest;
     AlphaTestFunc alpha_test;
 
-
     //! For std::find()
-    bool operator== (const std::string& o) const {
-        return !ASSIMP_stricmp(o,name);
+    bool operator==(const std::string &o) const {
+        return !ASSIMP_stricmp(o, name);
     }
 };
 
 // ---------------------------------------------------------------------------
 /** @brief Tiny utility data structure to hold a .shader data block
  */
-struct ShaderDataBlock
-{
+struct ShaderDataBlock {
     ShaderDataBlock() AI_NO_EXCEPT
-        :   cull    (CULL_CW)
-    {}
+            : cull(CULL_CW) {}
 
     //! Name of referenced data element
     std::string name;
@@ -163,18 +151,16 @@ struct ShaderDataBlock
     //! Maps defined in the shader
     std::list<ShaderMapBlock> maps;
 
-
     //! For std::find()
-    bool operator== (const std::string& o) const {
-        return !ASSIMP_stricmp(o,name);
+    bool operator==(const std::string &o) const {
+        return !ASSIMP_stricmp(o, name);
     }
 };
 
 // ---------------------------------------------------------------------------
 /** @brief Tiny utility data structure to hold the data of a .shader file
  */
-struct ShaderData
-{
+struct ShaderData {
     //! Shader data blocks
     std::list<ShaderDataBlock> blocks;
 };
@@ -188,8 +174,7 @@ struct ShaderData
  *  @param io IOSystem to be used for reading
  *  @return false if file is not accessible
  */
-bool LoadShader(ShaderData& fill, const std::string& file,IOSystem* io);
-
+bool LoadShader(ShaderData &fill, const std::string &file, IOSystem *io);
 
 // ---------------------------------------------------------------------------
 /** @brief Convert a Q3Shader to an aiMaterial
@@ -197,7 +182,7 @@ bool LoadShader(ShaderData& fill, const std::string& file,IOSystem* io);
  *  @param[out] out Material structure to be filled.
  *  @param[in] shader Input shader
  */
-void ConvertShaderToMaterial(aiMaterial* out, const ShaderDataBlock& shader);
+void ConvertShaderToMaterial(aiMaterial *out, const ShaderDataBlock &shader);
 
 // ---------------------------------------------------------------------------
 /** @brief Load a skin file
@@ -208,56 +193,50 @@ void ConvertShaderToMaterial(aiMaterial* out, const ShaderDataBlock& shader);
  *  @param io IOSystem to be used for reading
  *  @return false if file is not accessible
  */
-bool LoadSkin(SkinData& fill, const std::string& file,IOSystem* io);
+bool LoadSkin(SkinData &fill, const std::string &file, IOSystem *io);
 
-} // ! namespace Q3SHader
+} // namespace Q3Shader
 
 // ---------------------------------------------------------------------------
 /** @brief Importer class to load MD3 files
 */
-class MD3Importer : public BaseImporter
-{
+class MD3Importer : public BaseImporter {
 public:
     MD3Importer();
-    ~MD3Importer();
-
-
-public:
+    ~MD3Importer() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
     * See BaseImporter::CanRead() for details.  */
-    bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
-
+    bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
+            bool checkSig) const override;
 
     // -------------------------------------------------------------------
     /** Called prior to ReadFile().
     * The function is a request to the importer to update its configuration
     * basing on the Importer's configuration property list.
     */
-    void SetupProperties(const Importer* pImp);
+    void SetupProperties(const Importer *pImp) override;
 
 protected:
-
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc *GetInfo() const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
      * See BaseImporter::InternReadFile() for details
      */
-    void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
+    void InternReadFile(const std::string &pFile, aiScene *pScene,
+            IOSystem *pIOHandler) override;
 
     // -------------------------------------------------------------------
     /** Validate offsets in the header
      */
     void ValidateHeaderOffsets();
-    void ValidateSurfaceHeaderOffsets(const MD3::Surface* pcSurfHeader);
+    void ValidateSurfaceHeaderOffsets(const MD3::Surface *pcSurfHeader);
 
     // -------------------------------------------------------------------
     /** Read a Q3 multipart file
@@ -269,13 +248,13 @@ protected:
     /** Try to read the skin for a MD3 file
      *  @param fill Receives output information
      */
-    void ReadSkin(Q3Shader::SkinData& fill) const;
+    void ReadSkin(Q3Shader::SkinData &fill) const;
 
     // -------------------------------------------------------------------
     /** Try to read the shader for a MD3 file
      *  @param fill Receives output information
      */
-    void ReadShader(Q3Shader::ShaderData& fill) const;
+    void ReadShader(Q3Shader::ShaderData &fill) const;
 
     // -------------------------------------------------------------------
     /** Convert a texture path in a MD3 file to a proper value
@@ -283,11 +262,10 @@ protected:
      *  @param[in] header_path Base path specified in MD3 header
      *  @param[out] out Receives the converted output string
      */
-    void ConvertPath(const char* texture_name, const char* header_path,
-        std::string& out) const;
+    void ConvertPath(const char *texture_name, const char *header_path,
+            std::string &out) const;
 
 protected:
-
     /** Configuration option: frame to be loaded */
     unsigned int configFrameID;
 
@@ -307,10 +285,10 @@ protected:
     bool configSpeedFlag;
 
     /** Header of the MD3 file */
-    BE_NCONST MD3::Header* pcHeader;
+    BE_NCONST MD3::Header *pcHeader;
 
     /** File buffer  */
-    BE_NCONST unsigned char* mBuffer;
+    BE_NCONST unsigned char *mBuffer;
 
     /** Size of the file, in bytes */
     unsigned int fileSize;
@@ -325,11 +303,11 @@ protected:
     std::string filename;
 
     /** Output scene to be filled */
-    aiScene* mScene;
+    aiScene *mScene;
 
     /** IO system to be used to access the data*/
-    IOSystem* mIOHandler;
-    };
+    IOSystem *mIOHandler;
+};
 
 } // end of namespace Assimp
 

+ 6 - 6
code/AssetLib/MD5/MD5Loader.h

@@ -43,12 +43,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *  @brief Definition of the .MD5 importer class.
  *  http://www.modwiki.net/wiki/MD5_(file_format)
 */
+#pragma once
 #ifndef AI_MD5LOADER_H_INCLUDED
 #define AI_MD5LOADER_H_INCLUDED
 
 #include "MD5Parser.h"
 #include <assimp/BaseImporter.h>
-
 #include <assimp/types.h>
 
 struct aiNode;
@@ -65,35 +65,35 @@ using namespace Assimp::MD5;
 class MD5Importer : public BaseImporter {
 public:
     MD5Importer();
-    ~MD5Importer();
+    ~MD5Importer() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
      * See BaseImporter::CanRead() for details.
      */
     bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
-            bool checkSig) const;
+            bool checkSig) const override;
 
 protected:
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc *GetInfo() const;
+    const aiImporterDesc *GetInfo() const override;
 
     // -------------------------------------------------------------------
     /** Called prior to ReadFile().
      * The function is a request to the importer to update its configuration
      * basing on the Importer's configuration property list.
      */
-    void SetupProperties(const Importer *pImp);
+    void SetupProperties(const Importer *pImp) override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
      * See BaseImporter::InternReadFile() for details
      */
     void InternReadFile(const std::string &pFile, aiScene *pScene,
-            IOSystem *pIOHandler);
+            IOSystem *pIOHandler) override;
 
     // -------------------------------------------------------------------
     /** Load a *.MD5MESH file.

+ 12 - 22
code/AssetLib/MDC/MDCLoader.h

@@ -48,8 +48,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include <assimp/types.h>
 
-#include <assimp/BaseImporter.h>
 #include "MDCFileData.h"
+#include <assimp/BaseImporter.h>
 #include <assimp/ByteSwapper.h>
 
 namespace Assimp {
@@ -59,45 +59,37 @@ using namespace MDC;
 // ---------------------------------------------------------------------------
 /** Importer class to load the RtCW MDC file format
 */
-class MDCImporter : public BaseImporter
-{
+class MDCImporter : public BaseImporter {
 public:
     MDCImporter();
-    ~MDCImporter();
-
-
-public:
+    ~MDCImporter() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
     * See BaseImporter::CanRead() for details.  */
-    bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
+    bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
+            bool checkSig) const override;
 
     // -------------------------------------------------------------------
     /** Called prior to ReadFile().
     * The function is a request to the importer to update its configuration
     * basing on the Importer's configuration property list.
     */
-    void SetupProperties(const Importer* pImp);
+    void SetupProperties(const Importer *pImp) override;
 
 protected:
-
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc *GetInfo() const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
     * See BaseImporter::InternReadFile() for details
     */
-    void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
-
-protected:
-
+    void InternReadFile(const std::string &pFile, aiScene *pScene,
+            IOSystem *pIOHandler) override;
 
     // -------------------------------------------------------------------
     /** Validate the header of the file
@@ -107,19 +99,17 @@ protected:
     // -------------------------------------------------------------------
     /** Validate the header of a MDC surface
     */
-    void ValidateSurfaceHeader(BE_NCONST MDC::Surface* pcSurf);
+    void ValidateSurfaceHeader(BE_NCONST MDC::Surface *pcSurf);
 
 protected:
-
-
     /** Configuration option: frame to be loaded */
     unsigned int configFrameID;
 
     /** Header of the MDC file */
-    BE_NCONST MDC::Header* pcHeader;
+    BE_NCONST MDC::Header *pcHeader;
 
     /** Buffer to hold the loaded file */
-    unsigned char* mBuffer;
+    unsigned char *mBuffer;
 
     /** size of the file, in bytes */
     unsigned int fileSize;

+ 7 - 7
code/AssetLib/MDL/MDLLoader.h

@@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /**  @file MDLLoader.h
  *   @brief Declaration of the loader for MDL files
  */
-
+#pragma once
 #ifndef AI_MDLLOADER_H_INCLUDED
 #define AI_MDLLOADER_H_INCLUDED
 
@@ -55,7 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 struct aiNode;
 struct aiTexture;
 
-namespace Assimp    {
+namespace Assimp {
 
 using namespace MDL;
 
@@ -87,34 +87,34 @@ class MDLImporter : public BaseImporter
 {
 public:
     MDLImporter();
-    ~MDLImporter();
+    ~MDLImporter() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
     * See BaseImporter::CanRead() for details.  */
     bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
+        bool checkSig) const override;
 
     // -------------------------------------------------------------------
     /** Called prior to ReadFile().
     * The function is a request to the importer to update its configuration
     * basing on the Importer's configuration property list.
     */
-    void SetupProperties(const Importer* pImp);
+    void SetupProperties(const Importer* pImp) override;
 
 protected:
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc* GetInfo () const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
     * See BaseImporter::InternReadFile() for details
     */
     void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
+        IOSystem* pIOHandler) override;
 
     // -------------------------------------------------------------------
     /** Import a quake 1 MDL file (IDPO)

+ 1 - 2
code/AssetLib/MDL/MDLMaterialLoader.cpp

@@ -43,10 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #ifndef ASSIMP_BUILD_NO_MDL_IMPORTER
 
-// internal headers
 #include "MDLDefaultColorMap.h"
 #include "MDLLoader.h"
-#include <assimp/Defines.h>
+
 #include <assimp/StringUtils.h>
 #include <assimp/qnan.h>
 #include <assimp/scene.h>

+ 4 - 4
code/AssetLib/MMD/MMDImporter.h

@@ -59,19 +59,19 @@ public:
     MMDImporter();
 
     /// \brief  Destructor
-    ~MMDImporter();
+    ~MMDImporter() override;
 
 public:
     /// \brief  Returns whether the class can handle the format of the given file.
     /// \remark See BaseImporter::CanRead() for details.
-    bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const;
+    bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const override;
 
 private:
     //! \brief  Appends the supported extension.
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc* GetInfo() const override;
 
     //! \brief  File import implementation.
-    void InternReadFile(const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler);
+    void InternReadFile(const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) override;
 
     //! \brief  Create the data from imported content.
     void CreateDataFromImport(const pmx::PmxModel* pModel, aiScene* pScene);

+ 24 - 40
code/AssetLib/MS3D/MS3DLoader.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -43,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file  MS3DLoader.h
  *  @brief Declaration of the MS3D importer class.
  */
+#pragma once
 #ifndef AI_MS3DLOADER_H_INCLUDED
 #define AI_MS3DLOADER_H_INCLUDED
 
@@ -50,65 +50,53 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <assimp/StreamReader.h>
 struct aiNode;
 
-namespace Assimp    {
+namespace Assimp {
 
 // ----------------------------------------------------------------------------------------------
 /** Milkshape 3D importer implementation */
 // ----------------------------------------------------------------------------------------------
-class MS3DImporter
-    : public BaseImporter
-{
-
+class MS3DImporter : public BaseImporter {
 public:
-
     MS3DImporter();
-    ~MS3DImporter();
-
-public:
+    ~MS3DImporter() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
     * See BaseImporter::CanRead() for details.  */
-    bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
+    bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
+            bool checkSig) const override;
 
 protected:
-
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details */
-    const aiImporterDesc* GetInfo () const;
-
+    const aiImporterDesc *GetInfo() const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
     * See BaseImporter::InternReadFile() for details */
-    void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
-
+    void InternReadFile(const std::string &pFile, aiScene *pScene,
+            IOSystem *pIOHandler) override;
 
 private:
-
     struct TempJoint;
-    void CollectChildJoints(const std::vector<TempJoint>& joints, std::vector<bool>& hadit, aiNode* nd,const aiMatrix4x4& absTrafo);
-    void CollectChildJoints(const std::vector<TempJoint>& joints, aiNode* nd);
+    void CollectChildJoints(const std::vector<TempJoint> &joints, std::vector<bool> &hadit, aiNode *nd, const aiMatrix4x4 &absTrafo);
+    void CollectChildJoints(const std::vector<TempJoint> &joints, aiNode *nd);
 
-    template<typename T> void ReadComments(StreamReaderLE& stream, std::vector<T>& outp);
-private:
-
-    aiScene* mScene;
+    template <typename T>
+    void ReadComments(StreamReaderLE &stream, std::vector<T> &outp);
 
 private:
+    aiScene *mScene;
 
-    struct TempVertex
-    {
+private:
+    struct TempVertex {
         aiVector3D pos;
         unsigned int bone_id[4], ref_cnt;
         float weights[4];
     };
 
-    struct TempTriangle
-    {
+    struct TempTriangle {
         unsigned int indices[3];
         aiVector3D normals[3];
         aiVector2D uv[3];
@@ -116,34 +104,30 @@ private:
         unsigned int sg, group;
     };
 
-    struct TempGroup
-    {
+    struct TempGroup {
         char name[33]; // +0
         std::vector<unsigned int> triangles;
         unsigned int mat; // 0xff is no material
         std::string comment;
     };
 
-    struct TempMaterial
-    {
+    struct TempMaterial {
         // again, add an extra 0 character to all strings -
         char name[33];
         char texture[129];
         char alphamap[129];
 
-        aiColor4D diffuse,specular,ambient,emissive;
-        float shininess,transparency;
+        aiColor4D diffuse, specular, ambient, emissive;
+        float shininess, transparency;
         std::string comment;
     };
 
-    struct TempKeyFrame
-    {
+    struct TempKeyFrame {
         float time;
         aiVector3D value;
     };
 
-    struct TempJoint
-    {
+    struct TempJoint {
         char name[33];
         char parentName[33];
         aiVector3D rotation, position;
@@ -158,5 +142,5 @@ private:
     //};
 };
 
-}
+} // namespace Assimp
 #endif

+ 19 - 29
code/AssetLib/NDO/NDOLoader.h

@@ -44,19 +44,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #ifndef INCLUDED_AI_NDO_LOADER_H
 #define INCLUDED_AI_NDO_LOADER_H
 
-#include <assimp/vector3.h>
 #include <assimp/BaseImporter.h>
-#include <stdint.h>
+#include <assimp/vector3.h>
+#include <cstdint>
 #include <string>
 #include <vector>
 
-
 struct aiImporterDesc;
 struct aiScene;
 
-namespace Assimp    {
-    class IOSystem;
-    class Importer;
+namespace Assimp {
+class IOSystem;
+class Importer;
 
 // ---------------------------------------------------------------------------
 /** @brief Importer class to load meshes from Nendo.
@@ -64,38 +63,30 @@ namespace Assimp    {
  *  Basing on
  *  <blender>/blender/release/scripts/nendo_import.py by Anthony D'Agostino.
 */
-class NDOImporter : public BaseImporter
-{
+class NDOImporter : public BaseImporter {
 public:
     NDOImporter();
-    ~NDOImporter();
-
-
-public:
+    ~NDOImporter() override;
 
     //! Represents a single edge
-    struct Edge
-    {
+    struct Edge {
         unsigned int edge[8];
         unsigned int hard;
         uint8_t color[8];
     };
 
     //! Represents a single face
-    struct Face
-    {
+    struct Face {
         unsigned int elem;
     };
 
-    struct Vertex
-    {
+    struct Vertex {
         unsigned int num;
         aiVector3D val;
     };
 
     //! Represents a single object
-    struct Object
-    {
+    struct Object {
         std::string name;
 
         std::vector<Edge> edges;
@@ -104,23 +95,22 @@ public:
     };
 
     // -------------------------------------------------------------------
-    bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
+    bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
+            bool checkSig) const override;
 
 protected:
-
     // -------------------------------------------------------------------
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc *GetInfo() const override;
 
     // -------------------------------------------------------------------
-    void SetupProperties(const Importer* pImp);
+    void SetupProperties(const Importer *pImp) override;
 
     // -------------------------------------------------------------------
-    void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
-
-private:
+    void InternReadFile(const std::string &pFile, aiScene *pScene,
+            IOSystem *pIOHandler) override;
 
 }; // end of class NDOImporter
+
 } // end of namespace Assimp
+
 #endif // INCLUDED_AI_NDO_LOADER_H

+ 48 - 72
code/AssetLib/NFF/NFFLoader.h

@@ -43,16 +43,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file NFFLoader.h
  *  @brief Declaration of the NFF importer class.
  */
+#pragma once
 #ifndef AI_NFFLOADER_H_INCLUDED
 #define AI_NFFLOADER_H_INCLUDED
 
 #include <assimp/BaseImporter.h>
-#include <assimp/types.h>
 #include <assimp/material.h>
+#include <assimp/types.h>
 #include <vector>
 
-
-namespace Assimp    {
+namespace Assimp {
 
 // ----------------------------------------------------------------------------------
 /** NFF (Neutral File Format) Importer class.
@@ -61,67 +61,56 @@ namespace Assimp    {
  * Both are quite different and the loading code is somewhat dirty at
  * the moment. Sense8 should be moved to a separate loader.
 */
-class NFFImporter : public BaseImporter
-{
+class NFFImporter : public BaseImporter {
 public:
     NFFImporter();
-    ~NFFImporter();
-
-
-public:
+    ~NFFImporter() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
      * See BaseImporter::CanRead() for details.
      */
-    bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
+    bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
+            bool checkSig) const override;
 
 protected:
-
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc *GetInfo() const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
     * See BaseImporter::InternReadFile() for details
     */
-    void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
+    void InternReadFile(const std::string &pFile, aiScene *pScene,
+            IOSystem *pIOHandler) override;
 
 private:
-
-
     // describes face material properties
-    struct ShadingInfo
-    {
-        ShadingInfo()
-            : color     (0.6f,0.6f,0.6f)
-            , diffuse   (1.f,1.f,1.f)
-            , specular  (1.f,1.f,1.f)
-            , ambient   (0.f,0.f,0.f)
-            , emissive  (0.f,0.f,0.f)
-            , refracti  (1.f)
-            , twoSided  (false) // for NFF2
-            , shaded    (true)  // for NFF2
-            , opacity   (1.f)
-            , shininess (0.f)
-            , mapping   (aiTextureMapping_UV)
-        {}
-
-        aiColor3D color,diffuse,specular,ambient,emissive;
-        ai_real refracti;
-
-        std::string texFile;
+    struct ShadingInfo {
+        ShadingInfo() :
+                color(0.6f, 0.6f, 0.6f),
+                diffuse(1.f, 1.f, 1.f),
+                specular(1.f, 1.f, 1.f),
+                ambient(0.f, 0.f, 0.f),
+                emissive(0.f, 0.f, 0.f),
+                refracti(1.f),
+                twoSided(false), // for NFF2
+                shaded(true), // for NFF2
+                opacity(1.f),
+                shininess(0.f),
+                mapping(aiTextureMapping_UV) {
+            // empty
+        }
 
-        // For NFF2
-        bool twoSided;
+        aiColor3D color, diffuse, specular, ambient, emissive;
+        ai_real refracti;
+        std::string texFile;        
+        bool twoSided; // For NFF2
         bool shaded;
         ai_real opacity, shininess;
-
         std::string name;
 
         // texture mapping to be generated for the mesh - uv is the default
@@ -130,16 +119,15 @@ private:
         aiTextureMapping mapping;
 
         // shininess is ignored for the moment
-        bool operator == (const ShadingInfo& other) const
-        {
-            return color == other.color     &&
-                diffuse  == other.diffuse   &&
-                specular == other.specular  &&
-                ambient  == other.ambient   &&
-                refracti == other.refracti  &&
-                texFile  == other.texFile   &&
-                twoSided == other.twoSided  &&
-                shaded   == other.shaded;
+        bool operator == (const ShadingInfo &other) const {
+            return color == other.color &&
+                   diffuse == other.diffuse &&
+                   specular == other.specular &&
+                   ambient == other.ambient &&
+                   refracti == other.refracti &&
+                   texFile == other.texFile &&
+                   twoSided == other.twoSided &&
+                   shaded == other.shaded;
 
             // Some properties from NFF2 aren't compared by this operator.
             // Comparing MeshInfo::matIndex should do that.
@@ -147,35 +135,25 @@ private:
     };
 
     // describes a NFF light source
-    struct Light
-    {
-        Light()
-            : intensity (1.f)
-            , color     (1.f,1.f,1.f)
-        {}
+    struct Light {
+        Light() :
+                intensity(1.f), color(1.f, 1.f, 1.f) {}
 
         aiVector3D position;
         ai_real intensity;
         aiColor3D color;
     };
 
-    enum PatchType
-    {
+    enum PatchType {
         PatchType_Simple = 0x0,
         PatchType_Normals = 0x1,
         PatchType_UVAndNormals = 0x2
     };
 
     // describes a NFF mesh
-    struct MeshInfo
-    {
-        MeshInfo(PatchType _pType, bool bL = false)
-            : pType     (_pType)
-            , bLocked   (bL)
-            , radius    (1.f,1.f,1.f)
-            , dir       (0.f,1.f,0.f)
-            , matIndex  (0)
-        {
+    struct MeshInfo {
+        MeshInfo(PatchType _pType, bool bL = false) :
+                pType(_pType), bLocked(bL), radius(1.f, 1.f, 1.f), dir(0.f, 1.f, 0.f), matIndex(0) {
             name[0] = '\0'; // by default meshes are unnamed
         }
 
@@ -192,11 +170,10 @@ private:
         std::vector<unsigned int> faces;
 
         // for NFF2
-        std::vector<aiColor4D>  colors;
+        std::vector<aiColor4D> colors;
         unsigned int matIndex;
     };
 
-
     // -------------------------------------------------------------------
     /** Loads the material table for the NFF2 file format from an
      *  external file.
@@ -205,9 +182,8 @@ private:
      *  @param path Path to the file (abs. or rel.)
      *  @param pIOHandler IOSystem to be used to open the file
     */
-    void LoadNFF2MaterialTable(std::vector<ShadingInfo>& output,
-        const std::string& path, IOSystem* pIOHandler);
-
+    void LoadNFF2MaterialTable(std::vector<ShadingInfo> &output,
+            const std::string &path, IOSystem *pIOHandler);
 };
 
 } // end of namespace Assimp

+ 0 - 2
code/AssetLib/OFF/OFFLoader.cpp

@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,

+ 9 - 17
code/AssetLib/OFF/OFFLoader.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -43,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file  OFFLoader.h
  *  @brief Declaration of the OFF importer class.
  */
+#pragma once
 #ifndef AI_OFFLOADER_H_INCLUDED
 #define AI_OFFLOADER_H_INCLUDED
 
@@ -50,43 +50,35 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <assimp/types.h>
 #include <vector>
 
-namespace Assimp    {
+namespace Assimp {
 
 // ---------------------------------------------------------------------------
 /** Importer class for the Object File Format (.off)
 */
-class OFFImporter : public BaseImporter
-{
+class OFFImporter : public BaseImporter {
 public:
     OFFImporter();
-    ~OFFImporter();
-
-
-public:
+    ~OFFImporter() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
     * See BaseImporter::CanRead() for details.  */
-    bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
+    bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
+            bool checkSig) const override;
 
 protected:
-
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc *GetInfo() const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
     * See BaseImporter::InternReadFile() for details
     */
-    void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
-
-private:
-
+    void InternReadFile(const std::string &pFile, aiScene *pScene,
+            IOSystem *pIOHandler) override;
 };
 
 } // end of namespace Assimp

+ 14 - 25
code/AssetLib/Obj/ObjFileData.h

@@ -60,7 +60,7 @@ struct Material;
 //! \brief  Data structure for a simple obj-face, describes discredit,l.ation and materials
 // ------------------------------------------------------------------------------------------------
 struct Face {
-    typedef std::vector<unsigned int> IndexArray;
+    using IndexArray = std::vector<unsigned int>;
 
     //! Primitive type
     aiPrimitiveType m_PrimitiveType;
@@ -122,7 +122,6 @@ struct Object {
 struct Material {
     //! Name of material description
     aiString MaterialName;
-
     //! Texture names
     aiString texture;
     aiString textureSpecular;
@@ -237,9 +236,9 @@ struct Mesh {
 //! \brief  Data structure to store all obj-specific model datas
 // ------------------------------------------------------------------------------------------------
 struct Model {
-    typedef std::map<std::string, std::vector<unsigned int> *> GroupMap;
-    typedef std::map<std::string, std::vector<unsigned int> *>::iterator GroupMapIt;
-    typedef std::map<std::string, std::vector<unsigned int> *>::const_iterator ConstGroupMapIt;
+    using GroupMap = std::map<std::string, std::vector<unsigned int> *>;
+    using GroupMapIt = std::map<std::string, std::vector<unsigned int> *>::iterator;
+    using ConstGroupMapIt = std::map<std::string, std::vector<unsigned int> *>::const_iterator;
 
     //! Model name
     std::string m_ModelName;
@@ -278,12 +277,12 @@ struct Model {
 
     //! \brief  The default class constructor
     Model() :
-            m_ModelName(""),
+            m_ModelName(),
             m_pCurrent(nullptr),
             m_pCurrentMaterial(nullptr),
             m_pDefaultMaterial(nullptr),
             m_pGroupFaceIDs(nullptr),
-            m_strActiveGroup(""),
+            m_strActiveGroup(),
             m_TextureCoordDim(0),
             m_pCurrentMesh(nullptr) {
         // empty
@@ -291,27 +290,17 @@ struct Model {
 
     //! \brief  The class destructor
     ~Model() {
-        // Clear all stored object instances
-        for (std::vector<Object *>::iterator it = m_Objects.begin();
-                it != m_Objects.end(); ++it) {
-            delete *it;
+        for (auto & it : m_Objects) {
+            delete it;
         }
-        m_Objects.clear();
-
-        // Clear all stored mesh instances
-        for (std::vector<Mesh *>::iterator it = m_Meshes.begin();
-                it != m_Meshes.end(); ++it) {
-            delete *it;
+        for (auto & Meshe : m_Meshes) {
+            delete Meshe;
         }
-        m_Meshes.clear();
-
-        for (GroupMapIt it = m_Groups.begin(); it != m_Groups.end(); ++it) {
-            delete it->second;
+        for (auto & Group : m_Groups) {
+            delete Group.second;
         }
-        m_Groups.clear();
-
-        for (std::map<std::string, Material *>::iterator it = m_MaterialMap.begin(); it != m_MaterialMap.end(); ++it) {
-            delete it->second;
+        for (auto & it : m_MaterialMap) {
+            delete it.second;
         }
     }
 };

+ 6 - 6
code/AssetLib/Obj/ObjFileImporter.h

@@ -38,6 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 ----------------------------------------------------------------------
 */
+#pragma once
 #ifndef OBJ_FILE_IMPORTER_H_INC
 #define OBJ_FILE_IMPORTER_H_INC
 
@@ -65,19 +66,18 @@ public:
     ObjFileImporter();
 
     /// \brief  Destructor
-    ~ObjFileImporter();
+    ~ObjFileImporter() override;
 
-public:
     /// \brief  Returns whether the class can handle the format of the given file.
     /// \remark See BaseImporter::CanRead() for details.
-    bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const;
+    bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override;
 
-private:
+protected:
     //! \brief  Appends the supported extension.
-    const aiImporterDesc *GetInfo() const;
+    const aiImporterDesc *GetInfo() const override;
 
     //! \brief  File import implementation.
-    void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler);
+    void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
 
     //! \brief  Create the data from imported content.
     void CreateDataFromImport(const ObjFile::Model *pModel, aiScene *pScene);

+ 3 - 3
code/AssetLib/Obj/ObjFileMtlImporter.h

@@ -61,9 +61,9 @@ struct Material;
 class ObjFileMtlImporter {
 public:
     static const size_t BUFFERSIZE = 2048;
-    typedef std::vector<char> DataArray;
-    typedef std::vector<char>::iterator DataArrayIt;
-    typedef std::vector<char>::const_iterator ConstDataArrayIt;
+    using DataArray = std::vector<char>;
+    using DataArrayIt = std::vector<char>::iterator;
+    using ConstDataArrayIt = std::vector<char>::const_iterator;
 
     //! \brief  The class default constructor
     ObjFileMtlImporter(std::vector<char> &buffer, const std::string &strAbsPath,

+ 0 - 1
code/AssetLib/Obj/ObjFileParser.h

@@ -73,7 +73,6 @@ public:
     typedef std::vector<char>::iterator DataArrayIt;
     typedef std::vector<char>::const_iterator ConstDataArrayIt;
 
-public:
     /// @brief  The default constructor.
     ObjFileParser();
     /// @brief  Constructor with data array.

+ 19 - 20
code/AssetLib/Ogre/OgreImporter.cpp

@@ -81,10 +81,10 @@ bool OgreImporter::CanRead(const std::string &pFile, Assimp::IOSystem *pIOHandle
     if (EndsWith(pFile, ".mesh.xml", false)) {
         static const char * const tokens[] = { "<mesh>" };
         return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1);
-    } else {
-        /// @todo Read and validate first header chunk?
-        return EndsWith(pFile, ".mesh", false);
     }
+
+    /// @todo Read and validate first header chunk?
+    return EndsWith(pFile, ".mesh", false);
 }
 
 void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Assimp::IOSystem *pIOHandler) {
@@ -110,28 +110,27 @@ void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Ass
 
         // Convert to Assimp
         mesh->ConvertToAssimpScene(pScene);
+        return;
     }
     // XML .mesh.xml import
-    else {
-        /// @note XmlReader does not take ownership of f, hence the scoped ptr.
-        std::unique_ptr<IOStream> scopedFile(f);
-        XmlParser xmlParser;
-
-        //std::unique_ptr<CIrrXML_IOStreamReader> xmlStream(new CIrrXML_IOStreamReader(scopedFile.get()));
-        //std::unique_ptr<XmlReader> reader(irr::io::createIrrXMLReader(xmlStream.get()));
-        xmlParser.parse(scopedFile.get());
-        // Import mesh
-        std::unique_ptr<MeshXml> mesh(OgreXmlSerializer::ImportMesh(&xmlParser));
+    /// @note XmlReader does not take ownership of f, hence the scoped ptr.
+    std::unique_ptr<IOStream> scopedFile(f);
+    XmlParser xmlParser;
 
-        // Import skeleton
-        OgreXmlSerializer::ImportSkeleton(pIOHandler, mesh.get());
+    //std::unique_ptr<CIrrXML_IOStreamReader> xmlStream(new CIrrXML_IOStreamReader(scopedFile.get()));
+    //std::unique_ptr<XmlReader> reader(irr::io::createIrrXMLReader(xmlStream.get()));
+    xmlParser.parse(scopedFile.get());
+    // Import mesh
+    std::unique_ptr<MeshXml> mesh(OgreXmlSerializer::ImportMesh(&xmlParser));
 
-        // Import mesh referenced materials
-        ReadMaterials(pFile, pIOHandler, pScene, mesh.get());
+    // Import skeleton
+    OgreXmlSerializer::ImportSkeleton(pIOHandler, mesh.get());
 
-        // Convert to Assimp
-        mesh->ConvertToAssimpScene(pScene);
-    }
+    // Import mesh referenced materials
+    ReadMaterials(pFile, pIOHandler, pScene, mesh.get());
+
+    // Convert to Assimp
+    mesh->ConvertToAssimpScene(pScene);
 }
 
 } // namespace Ogre

+ 16 - 20
code/AssetLib/Ogre/OgreImporter.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -39,64 +38,61 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 ----------------------------------------------------------------------
 */
-
+#pragma once
 #ifndef AI_OGREIMPORTER_H_INC
 #define AI_OGREIMPORTER_H_INC
 
 #ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER
 
 #include <assimp/BaseImporter.h>
+#include <assimp/material.h>
 
-#include "OgreStructs.h"
 #include "OgreParsingUtils.h"
+#include "OgreStructs.h"
 
-#include <assimp/material.h>
-
-namespace Assimp
-{
-namespace Ogre
-{
+namespace Assimp {
+namespace Ogre {
 
 /** Importer for Ogre mesh, skeleton and material formats.
     @todo Support vertex colors.
     @todo Support poses/animations from the mesh file.
     Currently only skeleton file animations are supported. */
-class OgreImporter : public BaseImporter
-{
+class OgreImporter : public BaseImporter {
 public:
     /// BaseImporter override.
-    virtual bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const;
+    virtual 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);
+    virtual void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
 
     /// BaseImporter override.
-    virtual const aiImporterDesc *GetInfo() const;
+    virtual const aiImporterDesc *GetInfo() const override;
 
     /// BaseImporter override.
-    virtual void SetupProperties(const Importer *pImp);
+    virtual void SetupProperties(const Importer *pImp) override;
 
 private:
     /// Read materials referenced by the @c mesh to @c pScene.
     void ReadMaterials(const std::string &pFile, Assimp::IOSystem *pIOHandler, aiScene *pScene, Mesh *mesh);
     void ReadMaterials(const std::string &pFile, Assimp::IOSystem *pIOHandler, aiScene *pScene, MeshXml *mesh);
-    void AssignMaterials(aiScene *pScene, std::vector<aiMaterial*> &materials);
+    void AssignMaterials(aiScene *pScene, std::vector<aiMaterial *> &materials);
 
     /// Reads material
-    aiMaterial* ReadMaterial(const std::string &pFile, Assimp::IOSystem *pIOHandler, const std::string &MaterialName);
+    aiMaterial *ReadMaterial(const std::string &pFile, Assimp::IOSystem *pIOHandler, const std::string &MaterialName);
 
     // These functions parse blocks from a material file from @c ss. Starting parsing from "{" and ending it to "}".
     bool ReadTechnique(const std::string &techniqueName, std::stringstream &ss, aiMaterial *material);
     bool ReadPass(const std::string &passName, std::stringstream &ss, aiMaterial *material);
     bool ReadTextureUnit(const std::string &textureUnitName, std::stringstream &ss, aiMaterial *material);
 
+private:
     std::string m_userDefinedMaterialLibFile;
     bool m_detectTextureTypeFromFilename;
-
     std::map<aiTextureType, unsigned int> m_textures;
 };
-} // Ogre
-} // Assimp
+} // namespace Ogre
+} // namespace Assimp
 
 #endif // ASSIMP_BUILD_NO_OGRE_IMPORTER
 #endif // AI_OGREIMPORTER_H_INC

+ 1 - 1
code/AssetLib/OpenGEX/OpenGEXExporter.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -39,6 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 ----------------------------------------------------------------------
 */
+#pragma once
 #ifndef AI_OPENGEX_EXPORTER_H
 #define AI_OPENGEX_EXPORTER_H
 

+ 0 - 4
code/AssetLib/OpenGEX/OpenGEXImporter.cpp

@@ -47,14 +47,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <assimp/StringComparison.h>
 #include <assimp/StringUtils.h>
 #include <assimp/DefaultLogger.hpp>
-
 #include <assimp/ai_assert.h>
 #include <assimp/importerdesc.h>
 #include <assimp/scene.h>
 #include <openddlparser/OpenDDLParser.h>
 
-#include <vector>
-
 static const aiImporterDesc desc = {
     "Open Game Engine Exchange",
     "",
@@ -290,7 +287,6 @@ OpenGEXImporter::OpenGEXImporter() :
 
 //------------------------------------------------------------------------------------------------
 OpenGEXImporter::~OpenGEXImporter() {
-    m_ctx = nullptr;
 }
 
 //------------------------------------------------------------------------------------------------

+ 10 - 9
code/AssetLib/OpenGEX/OpenGEXImporter.h

@@ -39,6 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 ----------------------------------------------------------------------
 */
+#pragma once
 #ifndef AI_OPENGEX_IMPORTER_H
 #define AI_OPENGEX_IMPORTER_H
 
@@ -96,21 +97,21 @@ public:
     OpenGEXImporter();
 
     /// The class destructor.
-    virtual ~OpenGEXImporter();
+    ~OpenGEXImporter() override;
 
     /// BaseImporter override.
-    virtual bool CanRead( const std::string &file, IOSystem *pIOHandler, bool checkSig ) const;
+    bool CanRead( const std::string &file, IOSystem *pIOHandler, bool checkSig ) const override;
 
+protected:
     /// BaseImporter override.
-    virtual void InternReadFile( const std::string &file, aiScene *pScene, IOSystem *pIOHandler );
+    void InternReadFile( const std::string &file, aiScene *pScene, IOSystem *pIOHandler ) override;
 
     /// BaseImporter override.
-    virtual const aiImporterDesc *GetInfo() const;
+    virtual const aiImporterDesc *GetInfo() const override;
 
     /// BaseImporter override.
-    virtual void SetupProperties( const Importer *pImp );
+    virtual void SetupProperties( const Importer *pImp ) override;
 
-protected:
     void handleNodes( ODDLParser::DDLNode *node, aiScene *pScene );
     void handleMetricNode( ODDLParser::DDLNode *node, aiScene *pScene );
     void handleNameNode( ODDLParser::DDLNode *node, aiScene *pScene );
@@ -176,15 +177,15 @@ private:
     };
 
     struct ChildInfo {
-        typedef std::list<aiNode*> NodeList;
+        using NodeList = std::list<aiNode*>;
         std::list<aiNode*> m_children;
     };
     ChildInfo *m_root;
-    typedef std::map<aiNode*, std::unique_ptr<ChildInfo> > NodeChildMap;
+    using NodeChildMap = std::map<aiNode*, std::unique_ptr<ChildInfo> >;
     NodeChildMap m_nodeChildMap;
 
     std::vector<std::unique_ptr<aiMesh> > m_meshCache;
-    typedef std::map<std::string, size_t> ReferenceMap;
+    using ReferenceMap = std::map<std::string, size_t>;
     std::map<std::string, size_t> m_mesh2refMap;
     std::map<std::string, size_t> m_material2refMap;
 

+ 5 - 4
code/AssetLib/Ply/PlyLoader.h

@@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file  PLYLoader.h
  *  @brief Declaration of the .ply importer class.
  */
+#pragma once
 #ifndef AI_PLYLOADER_H_INCLUDED
 #define AI_PLYLOADER_H_INCLUDED
 
@@ -64,14 +65,14 @@ using namespace PLY;
 class PLYImporter : public BaseImporter {
 public:
     PLYImporter();
-    ~PLYImporter();
+    ~PLYImporter() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
      * See BaseImporter::CanRead() for details.
      */
     bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
-            bool checkSig) const;
+            bool checkSig) const override;
 
     // -------------------------------------------------------------------
     /** Extract a vertex from the DOM
@@ -88,14 +89,14 @@ protected:
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc *GetInfo() const;
+    const aiImporterDesc *GetInfo() const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
     * See BaseImporter::InternReadFile() for details
     */
     void InternReadFile(const std::string &pFile, aiScene *pScene,
-            IOSystem *pIOHandler);
+            IOSystem *pIOHandler) override;
 
     // -------------------------------------------------------------------
     /** Extract a material list from the DOM

+ 1 - 2
code/AssetLib/Ply/PlyParser.h

@@ -48,8 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <assimp/IOStreamBuffer.h>
 #include <vector>
 
-namespace Assimp
-{
+namespace Assimp {
 
 //pre-declaration
 class PLYImporter;

+ 0 - 4
code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp

@@ -146,9 +146,6 @@ Q3BSPFileImporter::Q3BSPFileImporter() :
 // ------------------------------------------------------------------------------------------------
 //  Destructor.
 Q3BSPFileImporter::~Q3BSPFileImporter() {
-    m_pCurrentMesh = nullptr;
-    m_pCurrentFace = nullptr;
-
     // Clear face-to-material map
     for (FaceMap::iterator it = m_MaterialLookupMap.begin(); it != m_MaterialLookupMap.end(); ++it) {
         const std::string &matName = it->first;
@@ -156,7 +153,6 @@ Q3BSPFileImporter::~Q3BSPFileImporter() {
             delete it->second;
         }
     }
-    m_MaterialLookupMap.clear();
 }
 
 // ------------------------------------------------------------------------------------------------

+ 7 - 8
code/AssetLib/Q3BSP/Q3BSPFileImporter.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -71,19 +70,19 @@ public:
     Q3BSPFileImporter();
 
     /// @brief  Destructor.
-    ~Q3BSPFileImporter();
+    ~Q3BSPFileImporter() override;
 
     /// @brief  Returns whether the class can handle the format of the given file.
     /// @remark See BaseImporter::CanRead() for details.
-    bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig ) const;
+    bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig ) const override;
 
 protected:
-    typedef std::map<std::string, std::vector<Q3BSP::sQ3BSPFace*>*> FaceMap;
-    typedef std::map<std::string, std::vector<Q3BSP::sQ3BSPFace*>* >::iterator FaceMapIt;
-    typedef std::map<std::string, std::vector<Q3BSP::sQ3BSPFace*>*>::const_iterator FaceMapConstIt;
+    using FaceMap = std::map<std::string, std::vector<Q3BSP::sQ3BSPFace*>*>;
+    using FaceMapIt = std::map<std::string, std::vector<Q3BSP::sQ3BSPFace*>* >::iterator;
+    using FaceMapConstIt = std::map<std::string, std::vector<Q3BSP::sQ3BSPFace*>*>::const_iterator;
 
-    const aiImporterDesc* GetInfo () const;
-    void InternReadFile(const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler);
+    const aiImporterDesc* GetInfo () const override;
+    void InternReadFile(const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) override;
     void separateMapName( const std::string &rImportName, std::string &rArchiveName, std::string &rMapName );
     bool findFirstMapInArchive(ZipArchiveIOSystem &rArchive, std::string &rMapName );
     void CreateDataFromImport( const Q3BSP::Q3BSPModel *pModel, aiScene* pScene, ZipArchiveIOSystem *pArchive );

+ 0 - 2
code/AssetLib/Q3BSP/Q3BSPFileParser.cpp

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -78,7 +77,6 @@ Q3BSPFileParser::Q3BSPFileParser( const std::string &mapName, ZipArchiveIOSystem
 // ------------------------------------------------------------------------------------------------
 Q3BSPFileParser::~Q3BSPFileParser() {
     delete m_pModel;
-    m_pModel = nullptr;
 }
 
 // ------------------------------------------------------------------------------------------------

+ 2 - 3
code/AssetLib/Q3BSP/Q3BSPFileParser.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -57,9 +56,9 @@ namespace Q3BSP
 }
 
 // -------------------------------------------------------------------
+///	@brief  This class implements th Q3DSP file parsing.
 // -------------------------------------------------------------------
-class Q3BSPFileParser
-{
+class Q3BSPFileParser {
 public:
     Q3BSPFileParser( const std::string &rMapName, ZipArchiveIOSystem *pZipArchive );
     ~Q3BSPFileParser();

+ 15 - 33
code/AssetLib/Q3D/Q3DLoader.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -36,80 +35,66 @@ 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.
-
 ----------------------------------------------------------------------
 */
 
 /** @file  Q3DLoader.h
  *  @brief Declaration of the Q3D importer class.
  */
+#pragma once
 #ifndef AI_Q3DLOADER_H_INCLUDED
 #define AI_Q3DLOADER_H_INCLUDED
 
 #include <assimp/BaseImporter.h>
 #include <assimp/types.h>
 #include <vector>
-#include <stdint.h>
+#include <cstdint>
 
 namespace Assimp    {
 
 // ---------------------------------------------------------------------------
 /** Importer class for the Quick3D Object and Scene formats.
 */
-class Q3DImporter : public BaseImporter
-{
+class Q3DImporter : public BaseImporter {
 public:
     Q3DImporter();
-    ~Q3DImporter();
-
-
-public:
+    ~Q3DImporter() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
     * See BaseImporter::CanRead() for details.  */
     bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
+        bool checkSig) const override;
 
 protected:
-
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc* GetInfo () const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
     * See BaseImporter::InternReadFile() for details
     */
     void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
+        IOSystem* pIOHandler) override;
 
 private:
-
-    struct Material
-    {
-        Material()
-            :   diffuse         (0.6f,0.6f,0.6f)
-            ,   transparency    (0.f)
-            ,   texIdx          (UINT_MAX)
-        {}
+    struct Material {
+        Material() : diffuse(0.6f,0.6f,0.6f), transparency(0.f), texIdx(UINT_MAX) {
+            // empty
+        }
 
         aiString name;
         aiColor3D ambient, diffuse, specular;
         float transparency;
-
         unsigned int texIdx;
     };
 
-    struct Face
-    {
-        explicit Face(unsigned int s)
-            :   indices   (s)
-            ,   uvindices (s)
-            ,   mat       (0)
-        {
+    struct Face {
+        explicit Face(unsigned int s) : indices(s), uvindices(s), mat(0) {
+            // empty
         }
 
         std::vector<unsigned int> indices;
@@ -117,14 +102,11 @@ private:
         unsigned int mat;
     };
 
-    struct Mesh
-    {
-
+    struct Mesh {
         std::vector<aiVector3D> verts;
         std::vector<aiVector3D> normals;
         std::vector<aiVector3D> uv;
         std::vector<Face>       faces;
-
         uint32_t prevUVIdx;
     };
 };

+ 10 - 23
code/AssetLib/Raw/RawLoader.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -43,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file  RAWLoader.h
  *  @brief Declaration of the RAW importer class.
  */
+#pragma once
 #ifndef AI_RAWLOADER_H_INCLUDED
 #define AI_RAWLOADER_H_INCLUDED
 
@@ -50,64 +50,51 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <assimp/types.h>
 #include <vector>
 
-namespace Assimp    {
+namespace Assimp {
 
 // ---------------------------------------------------------------------------
 /** Importer class for the PovRay RAW triangle format
 */
-class RAWImporter : public BaseImporter
-{
+class RAWImporter : public BaseImporter {
 public:
     RAWImporter();
     ~RAWImporter();
 
-
-public:
-
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
      * See BaseImporter::CanRead() for details.
      */
     bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
+        bool checkSig) const override;
 
 protected:
-
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc* GetInfo () const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
     * See BaseImporter::InternReadFile() for details
     */
     void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
+        IOSystem* pIOHandler) override;
 
 private:
-
-    struct MeshInformation
-    {
-        explicit MeshInformation(const std::string& _name)
-            : name(_name)
-        {
+    struct MeshInformation {
+        explicit MeshInformation(const std::string& _name) : name(_name) {
             vertices.reserve(100);
             colors.reserve(100);
         }
 
         std::string name;
-
         std::vector<aiVector3D> vertices;
         std::vector<aiColor4D> colors;
     };
 
-    struct GroupInformation
-    {
-        explicit GroupInformation(const std::string& _name)
-            : name(_name)
-        {
+    struct GroupInformation {
+        explicit GroupInformation(const std::string& _name) : name(_name) {
             meshes.reserve(10);
         }
 

+ 11 - 20
code/AssetLib/SIB/SIBImporter.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -43,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file  SIBImporter.h
  *  @brief Declaration of the SIB importer class.
  */
+#pragma once
 #ifndef AI_SIBIMPORTER_H_INCLUDED
 #define AI_SIBIMPORTER_H_INCLUDED
 
@@ -50,60 +50,51 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <assimp/types.h>
 #include <vector>
 
-namespace Assimp    {
+namespace Assimp {
 
 // ---------------------------------------------------------------------------
 /** Importer class for the Nevercenter Silo SIB scene format
 */
-class ASSIMP_API SIBImporter : public BaseImporter
-{
+class ASSIMP_API SIBImporter : public BaseImporter {
 public:
     SIBImporter();
-    ~SIBImporter();
+    ~SIBImporter() override;
 
-public:
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
      * See BaseImporter::CanRead() for details.
      */
     bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
+        bool checkSig) const override;
 
 protected:
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc* GetInfo () const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
     * See BaseImporter::InternReadFile() for details
     */
     void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
+        IOSystem* pIOHandler) override;
 
 private:
-    struct MeshInformation
-    {
-        explicit MeshInformation(const std::string& _name)
-            : name(_name)
-        {
+    struct MeshInformation {
+        explicit MeshInformation(const std::string& _name) : name(_name) {
             vertices.reserve(100);
             colors.reserve(100);
         }
 
         std::string name;
-
         std::vector<aiVector3D> vertices;
         std::vector<aiColor4D> colors;
     };
 
-    struct GroupInformation
-    {
-        explicit GroupInformation(const std::string& _name)
-            : name(_name)
-        {
+    struct GroupInformation {
+        explicit GroupInformation(const std::string& _name) : name(_name) {
             meshes.reserve(10);
         }
 

+ 17 - 40
code/AssetLib/SMD/SMDLoader.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -44,24 +43,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *  @brief Definition of the Valve SMD file format
  */
 
+#pragma once
 #ifndef AI_SMDLOADER_H_INCLUDED
 #define AI_SMDLOADER_H_INCLUDED
 
-// internal headers
 #include <assimp/BaseImporter.h>
 #include <assimp/ParsingUtils.h>
-
-// public Assimp headers
 #include <assimp/types.h>
 #include <assimp/texture.h>
 #include <assimp/anim.h>
 #include <assimp/material.h>
 
-struct aiNode;
-
-// STL headers
 #include <vector>
 
+struct aiNode;
+
 namespace Assimp {
 namespace SMD {
 
@@ -69,8 +65,7 @@ namespace SMD {
 /** Data structure for a vertex in a SMD file
 */
 struct Vertex {
-    Vertex() AI_NO_EXCEPT
-    : iParentNode(UINT_MAX) {
+    Vertex() AI_NO_EXCEPT : iParentNode(UINT_MAX) {
         // empty
     }
 
@@ -91,12 +86,11 @@ struct Vertex {
 /** Data structure for a face in a SMD file
 */
 struct Face {
-    Face() AI_NO_EXCEPT
-    : iTexture(0x0)
-    , avVertices{} {
+    Face() AI_NO_EXCEPT :
+            iTexture(0x0), avVertices{} {
         // empty
     }
-
+    
     //! Texture index for the face
     unsigned int iTexture;
 
@@ -109,17 +103,10 @@ struct Face {
 */
 struct Bone {
     //! Default constructor
-    Bone() AI_NO_EXCEPT
-    : iParent(UINT_MAX)
-    , bIsUsed(false) {
+    Bone() AI_NO_EXCEPT : iParent(UINT_MAX), bIsUsed(false) {
         // empty
     }
 
-    //! Destructor
-    ~Bone()
-    {
-    }
-
     //! Name of the bone
     std::string mName;
 
@@ -129,14 +116,12 @@ struct Bone {
     //! Animation of the bone
     struct Animation {
         //! Public default constructor
-        Animation() AI_NO_EXCEPT
-        : iFirstTimeKey() {
+        Animation() AI_NO_EXCEPT : iFirstTimeKey() {
             asKeys.reserve(20);
         }
 
         //! Data structure for a matrix key
-        struct MatrixKey
-        {
+        struct MatrixKey {
             //! Matrix at this time
             aiMatrix4x4 matrix;
 
@@ -174,46 +159,38 @@ struct Bone {
 // ---------------------------------------------------------------------------
 /** Used to load Half-life 1 and 2 SMD models
 */
-class ASSIMP_API SMDImporter : public BaseImporter
-{
+class ASSIMP_API SMDImporter : public BaseImporter {
 public:
     SMDImporter();
-    ~SMDImporter();
-
-
-public:
+    ~SMDImporter() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
      * See BaseImporter::CanRead() for details.
      */
     bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool checkSig) const;
+        bool checkSig) const override;
 
     // -------------------------------------------------------------------
     /** Called prior to ReadFile().
      * The function is a request to the importer to update its configuration
      * basing on the Importer's configuration property list.
      */
-    void SetupProperties(const Importer* pImp);
+    void SetupProperties(const Importer* pImp) override;
 
 protected:
-
-
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc* GetInfo () const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
     * See BaseImporter::InternReadFile() for details
     */
     void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
-
-protected:
+        IOSystem* pIOHandler) override;
 
     // -------------------------------------------------------------------
     /** Parse the SMD file and create the output scene
@@ -405,7 +382,7 @@ private:
      */
     bool bHasUVs;
 
-    /** Current line numer
+    /** Current line number
      */
     unsigned int iLineNumber;
 

+ 8 - 11
code/AssetLib/STL/STLExporter.h

@@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file STLExporter.h
  * Declares the exporter class to write a scene to a Stereolithography (STL) file
  */
+#pragma once
 #ifndef AI_STLEXPORTER_H_INC
 #define AI_STLEXPORTER_H_INC
 
@@ -57,28 +58,24 @@ namespace Assimp {
 // ------------------------------------------------------------------------------------------------
 /** Helper class to export a given scene to a STL file. */
 // ------------------------------------------------------------------------------------------------
-class STLExporter
-{
+class STLExporter {
 public:
     /// Constructor for a specific scene to export
-    STLExporter(const char* filename, const aiScene* pScene, bool exportPOintClouds, bool binary = false);
+    STLExporter(const char *filename, const aiScene *pScene, bool exportPOintClouds, bool binary = false);
 
-    /// public stringstreams to write all output into
+    /// public string-streams to write all output into
     std::ostringstream mOutput;
 
 private:
-    void WritePointCloud(const std::string &name, const aiScene* pScene);
-    void WriteMesh(const aiMesh* m);
-    void WriteMeshBinary(const aiMesh* m);
+    void WritePointCloud(const std::string &name, const aiScene *pScene);
+    void WriteMesh(const aiMesh *m);
+    void WriteMeshBinary(const aiMesh *m);
 
 private:
-
     const std::string filename;
-
-    // this endl() doesn't flush() the stream
     const std::string endl;
 };
 
-}
+} // namespace Assimp
 
 #endif

+ 3 - 2
code/AssetLib/STL/STLLoader.cpp

@@ -43,7 +43,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #ifndef ASSIMP_BUILD_NO_STL_IMPORTER
 
-// internal headers
 #include "STLLoader.h"
 #include <assimp/ParsingUtils.h>
 #include <assimp/fast_atof.h>
@@ -146,7 +145,9 @@ bool STLImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool c
 
     if (extension == "stl") {
         return true;
-    } else if (!extension.length() || checkSig) {
+    }
+
+    if (!extension.length() || checkSig) {
         if (!pIOHandler) {
             return true;
         }

+ 4 - 5
code/AssetLib/STL/STLLoader.h

@@ -53,7 +53,6 @@ struct aiNode;
 
 namespace Assimp {
 
-
 // ---------------------------------------------------------------------------
 /**
  * @brief   Importer class for the sterolithography STL file format.
@@ -68,13 +67,13 @@ public:
     /**
      * @brief   The class destructor.
      */
-    ~STLImporter();
+    ~STLImporter() override;
 
     /**
      * @brief   Returns whether the class can handle the format of the given file.
      *  See BaseImporter::CanRead() for details.
      */
-    bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const;
+    bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const override;
 
 protected:
 
@@ -82,14 +81,14 @@ protected:
      * @brief   Return importer meta information.
      *  See #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc* GetInfo () const override;
 
     /**
      * @brief   Imports the given file into the given scene structure.
     * See BaseImporter::InternReadFile() for details
     */
     void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
+        IOSystem* pIOHandler) override;
 
     /**
      * @brief   Loads a binary .stl file

+ 6 - 2
code/AssetLib/Terragen/TerragenLoader.cpp

@@ -69,11 +69,15 @@ static const aiImporterDesc desc = {
 // ------------------------------------------------------------------------------------------------
 // Constructor to be privately used by Importer
 TerragenImporter::TerragenImporter() :
-        configComputeUVs(false) {}
+        configComputeUVs(false) {
+    // empty
+}
 
 // ------------------------------------------------------------------------------------------------
 // Destructor, private as well
-TerragenImporter::~TerragenImporter() {}
+TerragenImporter::~TerragenImporter() {
+    // empty
+}
 
 // ------------------------------------------------------------------------------------------------
 // Returns whether the class can handle the format of the given file.

+ 7 - 6
code/AssetLib/Terragen/TerragenLoader.h

@@ -42,10 +42,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file  TerragenLoader.h
  *  @brief Declaration of the .ter importer class.
  */
+#pragma once
 #ifndef INCLUDED_AI_TERRAGEN_TERRAIN_LOADER_H
 #define INCLUDED_AI_TERRAGEN_TERRAIN_LOADER_H
 
 #include <assimp/BaseImporter.h>
+
 namespace Assimp {
 
 // Magic strings
@@ -71,23 +73,22 @@ namespace Assimp {
 class TerragenImporter : public BaseImporter {
 public:
     TerragenImporter();
-    ~TerragenImporter();
+    ~TerragenImporter() override;
 
-public:
     // -------------------------------------------------------------------
     bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
-            bool checkSig) const;
+            bool checkSig) const override;
 
 protected:
     // -------------------------------------------------------------------
-    const aiImporterDesc *GetInfo() const;
+    const aiImporterDesc *GetInfo() const override;
 
     // -------------------------------------------------------------------
     void InternReadFile(const std::string &pFile, aiScene *pScene,
-            IOSystem *pIOHandler);
+            IOSystem *pIOHandler) override;
 
     // -------------------------------------------------------------------
-    void SetupProperties(const Importer *pImp);
+    void SetupProperties(const Importer *pImp) override;
 
 private:
     bool configComputeUVs;

+ 1 - 1
code/AssetLib/Unreal/UnrealLoader.cpp

@@ -60,7 +60,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <assimp/IOSystem.hpp>
 #include <assimp/Importer.hpp>
 
-#include <stdint.h>
+#include <cstdint>
 #include <memory>
 
 using namespace Assimp;

+ 8 - 8
code/AssetLib/Unreal/UnrealLoader.h

@@ -50,8 +50,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 namespace Assimp {
 
 // ---------------------------------------------------------------------------
-/** @brief Importer class to load UNREAL files (*.3d)
-*/
+/**
+ *  @brief Importer class to load UNREAL files (*.3d)
+ */
 class UnrealImporter : public BaseImporter {
 public:
     UnrealImporter();
@@ -62,23 +63,22 @@ public:
      *
      *  See BaseImporter::CanRead() for details.
      **/
-    bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
-            bool checkSig) const;
+    bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override;
 
 protected:
     // -------------------------------------------------------------------
     /** @brief Called by Importer::GetExtensionList()
      *
-     * See #BaseImporter::GetInfo for the details
+     * @see #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc *GetInfo() const;
+    const aiImporterDesc *GetInfo() const override;
 
     // -------------------------------------------------------------------
     /** @brief Setup properties for the importer
      *
      * See BaseImporter::SetupProperties() for details
      */
-    void SetupProperties(const Importer *pImp);
+    void SetupProperties(const Importer *pImp) override;
 
     // -------------------------------------------------------------------
     /** @brief Imports the given file into the given scene structure.
@@ -86,7 +86,7 @@ protected:
      * See BaseImporter::InternReadFile() for details
      */
     void InternReadFile(const std::string &pFile, aiScene *pScene,
-            IOSystem *pIOHandler);
+            IOSystem *pIOHandler) override;
 
 private:
     //! frame to be loaded

+ 52 - 63
code/AssetLib/X/XFileHelper.h

@@ -40,20 +40,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ----------------------------------------------------------------------
 */
 
-
 /** @file Defines the helper data structures for importing XFiles */
 #ifndef AI_XFILEHELPER_H_INC
 #define AI_XFILEHELPER_H_INC
 
+#include <cstdint>
 #include <string>
 #include <vector>
-#include <stdint.h>
 
-#include <assimp/types.h>
-#include <assimp/quaternion.h>
-#include <assimp/mesh.h>
 #include <assimp/anim.h>
-#include <assimp/Defines.h>
+#include <assimp/mesh.h>
+#include <assimp/quaternion.h>
+#include <assimp/types.h>
 
 namespace Assimp {
 namespace XFile {
@@ -68,14 +66,13 @@ struct TexEntry {
     std::string mName;
     bool mIsNormalMap; // true if the texname was specified in a NormalmapFilename tag
 
-    TexEntry() AI_NO_EXCEPT
-    : mName()
-    , mIsNormalMap(false) {
+    TexEntry() AI_NO_EXCEPT :
+            mName(),
+            mIsNormalMap(false) {
         // empty
     }
-    TexEntry(const std::string& pName, bool pIsNormalMap = false)
-    : mName(pName)
-    , mIsNormalMap(pIsNormalMap) {
+    TexEntry(const std::string &pName, bool pIsNormalMap = false) :
+            mName(pName), mIsNormalMap(pIsNormalMap) {
         // empty
     }
 };
@@ -91,10 +88,10 @@ struct Material {
     std::vector<TexEntry> mTextures;
     size_t sceneIndex; ///< the index under which it was stored in the scene's material list
 
-    Material() AI_NO_EXCEPT
-    : mIsReference(false)
-    , mSpecularExponent()
-    , sceneIndex(SIZE_MAX) {
+    Material() AI_NO_EXCEPT :
+            mIsReference(false),
+            mSpecularExponent(),
+            sceneIndex(SIZE_MAX) {
         // empty
     }
 };
@@ -106,8 +103,7 @@ struct BoneWeight {
 };
 
 /** Helper structure to represent a bone in a mesh */
-struct Bone
-{
+struct Bone {
     std::string mName;
     std::vector<BoneWeight> mWeights;
     aiMatrix4x4 mOffsetMatrix;
@@ -131,18 +127,18 @@ struct Mesh {
     std::vector<Bone> mBones;
 
     explicit Mesh(const std::string &pName = std::string()) AI_NO_EXCEPT
-    : mName( pName )
-    , mPositions()
-    , mPosFaces()
-    , mNormals()
-    , mNormFaces()
-    , mNumTextures(0)
-    , mTexCoords{}
-    , mNumColorSets(0)
-    , mColors{}
-    , mFaceMaterials()
-    , mMaterials()
-    , mBones() {
+            : mName(pName),
+              mPositions(),
+              mPosFaces(),
+              mNormals(),
+              mNormFaces(),
+              mNumTextures(0),
+              mTexCoords{},
+              mNumColorSets(0),
+              mColors{},
+              mFaceMaterials(),
+              mMaterials(),
+              mBones() {
         // empty
     }
 };
@@ -151,29 +147,25 @@ struct Mesh {
 struct Node {
     std::string mName;
     aiMatrix4x4 mTrafoMatrix;
-    Node* mParent;
-    std::vector<Node*> mChildren;
-    std::vector<Mesh*> mMeshes;
+    Node *mParent;
+    std::vector<Node *> mChildren;
+    std::vector<Mesh *> mMeshes;
 
     Node() AI_NO_EXCEPT
-    : mName()
-    , mTrafoMatrix()
-    , mParent(nullptr)
-    , mChildren()
-    , mMeshes() {
+            : mName(),
+              mTrafoMatrix(),
+              mParent(nullptr),
+              mChildren(),
+              mMeshes() {
         // empty
     }
-    explicit Node( Node* pParent)
-    : mName()
-    , mTrafoMatrix()
-    , mParent(pParent)
-    , mChildren()
-    , mMeshes() {
+    explicit Node(Node *pParent) :
+            mName(), mTrafoMatrix(), mParent(pParent), mChildren(), mMeshes() {
         // empty
     }
 
     ~Node() {
-        for (unsigned int a = 0; a < mChildren.size(); ++a ) {
+        for (unsigned int a = 0; a < mChildren.size(); ++a) {
             delete mChildren[a];
         }
         for (unsigned int a = 0; a < mMeshes.size(); ++a) {
@@ -190,50 +182,47 @@ struct MatrixKey {
 /** Helper structure representing a single animated bone in a XFile */
 struct AnimBone {
     std::string mBoneName;
-    std::vector<aiVectorKey> mPosKeys;  // either three separate key sequences for position, rotation, scaling
+    std::vector<aiVectorKey> mPosKeys; // either three separate key sequences for position, rotation, scaling
     std::vector<aiQuatKey> mRotKeys;
     std::vector<aiVectorKey> mScaleKeys;
     std::vector<MatrixKey> mTrafoKeys; // or a combined key sequence of transformation matrices.
 };
 
 /** Helper structure to represent an animation set in a XFile */
-struct Animation
-{
+struct Animation {
     std::string mName;
-    std::vector<AnimBone*> mAnims;
+    std::vector<AnimBone *> mAnims;
 
-    ~Animation()
-    {
-        for( unsigned int a = 0; a < mAnims.size(); a++)
+    ~Animation() {
+        for (unsigned int a = 0; a < mAnims.size(); a++)
             delete mAnims[a];
     }
 };
 
 /** Helper structure analogue to aiScene */
-struct Scene
-{
-    Node* mRootNode;
+struct Scene {
+    Node *mRootNode;
 
-    std::vector<Mesh*> mGlobalMeshes; // global meshes found outside of any frames
+    std::vector<Mesh *> mGlobalMeshes; // global meshes found outside of any frames
     std::vector<Material> mGlobalMaterials; // global materials found outside of any meshes.
 
-    std::vector<Animation*> mAnims;
+    std::vector<Animation *> mAnims;
     unsigned int mAnimTicksPerSecond;
 
     Scene() AI_NO_EXCEPT
-    : mRootNode(nullptr)
-    , mGlobalMeshes()
-    , mGlobalMaterials()
-    , mAnimTicksPerSecond(0) {
+            : mRootNode(nullptr),
+              mGlobalMeshes(),
+              mGlobalMaterials(),
+              mAnimTicksPerSecond(0) {
         // empty
     }
     ~Scene() {
         delete mRootNode;
         mRootNode = nullptr;
-        for (unsigned int a = 0; a < mGlobalMeshes.size(); ++a ) {
+        for (unsigned int a = 0; a < mGlobalMeshes.size(); ++a) {
             delete mGlobalMeshes[a];
         }
-        for (unsigned int a = 0; a < mAnims.size(); ++a ) {
+        for (unsigned int a = 0; a < mAnims.size(); ++a) {
             delete mAnims[a];
         }
     }

+ 0 - 1
code/AssetLib/X/XFileImporter.cpp

@@ -49,7 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "PostProcessing/ConvertToLHProcess.h"
 
 #include <assimp/TinyFormatter.h>
-#include <assimp/Defines.h>
 #include <assimp/IOSystem.hpp>
 #include <assimp/scene.h>
 #include <assimp/DefaultLogger.hpp>

+ 6 - 7
code/AssetLib/X/XFileImporter.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -43,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file  XFileImporter.h
  *  @brief Definition of the XFile importer class.
  */
+#pragma once
 #ifndef AI_XFILEIMPORTER_H_INC
 #define AI_XFILEIMPORTER_H_INC
 
@@ -69,28 +69,27 @@ namespace XFile {
 class XFileImporter : public BaseImporter {
 public:
     XFileImporter();
-    ~XFileImporter();
+    ~XFileImporter() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
      * See BaseImporter::CanRead() for details. */
     bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
-        bool CheckSig) const;
+        bool CheckSig) const override;
 
 protected:
-
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details
      */
-    const aiImporterDesc* GetInfo () const;
+    const aiImporterDesc* GetInfo () const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
      * See BaseImporter::InternReadFile() for details
      */
     void InternReadFile( const std::string& pFile, aiScene* pScene,
-        IOSystem* pIOHandler);
+        IOSystem* pIOHandler) override;
 
     // -------------------------------------------------------------------
     /** Constructs the return data structure out of the imported data.
@@ -140,7 +139,7 @@ protected:
     void ConvertMaterials( aiScene* pScene, std::vector<XFile::Material>& pMaterials);
 
 protected:
-    /** Buffer to hold the loaded file */
+    /// Buffer to hold the loaded file
     std::vector<char> mBuffer;
 };
 

+ 10 - 9
code/AssetLib/XGL/XGLLoader.cpp

@@ -100,7 +100,6 @@ XGLImporter::XGLImporter() :
 // Destructor, private as well
 XGLImporter::~XGLImporter() {
 	delete mXmlParser;
-    mXmlParser = nullptr;
 }
 
 // ------------------------------------------------------------------------------------------------
@@ -115,13 +114,15 @@ bool XGLImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool c
 
 	if (extension == "xgl" || extension == "zgl") {
 		return true;
-	} else if (extension == "xml" || checkSig) {
-		ai_assert(pIOHandler != NULL);
+	}
 
+  if (extension == "xml" || checkSig) {
+		ai_assert(pIOHandler != nullptr);
 		static const char * const tokens[] = { "<world>", "<World>", "<WORLD>" };
 		return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 3);
 	}
-	return false;
+
+    return false;
 }
 
 // ------------------------------------------------------------------------------------------------
@@ -454,12 +455,12 @@ aiMesh *XGLImporter::ToOutputMesh(const TempMaterialMesh &m) {
 	mesh->mVertices = new aiVector3D[mesh->mNumVertices];
 	std::copy(m.positions.begin(), m.positions.end(), mesh->mVertices);
 
-	if (m.normals.size()) {
+	if (!m.normals.empty()) {
 		mesh->mNormals = new aiVector3D[mesh->mNumVertices];
 		std::copy(m.normals.begin(), m.normals.end(), mesh->mNormals);
 	}
 
-	if (m.uvs.size()) {
+	if (!m.uvs.empty()) {
 		mesh->mNumUVComponents[0] = 2;
 		mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices];
 
@@ -595,7 +596,7 @@ bool XGLImporter::ReadMesh(XmlNode &node, TempScope &scope) {
 	}
 
 	// finally extract output meshes and add them to the scope
-	typedef std::pair<const unsigned int, TempMaterialMesh> pairt;
+	using pairt = std::pair<const unsigned int, TempMaterialMesh>;
 	for (const pairt &p : bymat) {
 		aiMesh *const m = ToOutputMesh(p.second);
 		scope.meshes_linear.push_back(m);
@@ -620,7 +621,7 @@ unsigned int XGLImporter::ResolveMaterialRef(XmlNode &node, TempScope &scope) {
 
 	const int id = ReadIndexFromText(node);
 
-	std::map<unsigned int, aiMaterial *>::iterator it = scope.materials.find(id), end = scope.materials.end();
+	auto it = scope.materials.find(id), end = scope.materials.end();
 	if (it == end) {
 		ThrowException("<matref> index out of range");
 	}
@@ -644,7 +645,7 @@ unsigned int XGLImporter::ResolveMaterialRef(XmlNode &node, TempScope &scope) {
 void XGLImporter::ReadMaterial(XmlNode &node, TempScope &scope) {
     const unsigned int mat_id = ReadIDAttr(node);
 
-	aiMaterial *mat(new aiMaterial);
+	auto *mat(new aiMaterial);
 	for (XmlNode &child : node.children()) {
         const std::string &s = ai_stdStrToLower(child.name());
 		if (s == "amb") {

+ 4 - 4
code/AssetLib/XGL/XGLLoader.h

@@ -70,25 +70,25 @@ namespace Assimp {
 class XGLImporter : public BaseImporter, public LogFunctions<XGLImporter> {
 public:
     XGLImporter();
-    ~XGLImporter();
+    ~XGLImporter() override;
 
     // -------------------------------------------------------------------
     /** Returns whether the class can handle the format of the given file.
      *  See BaseImporter::CanRead() for details.    */
     bool CanRead(const std::string &pFile, IOSystem *pIOHandler,
-            bool checkSig) const;
+            bool checkSig) const override;
 
 protected:
     // -------------------------------------------------------------------
     /** Return importer meta information.
      * See #BaseImporter::GetInfo for the details  */
-    const aiImporterDesc *GetInfo() const;
+    const aiImporterDesc *GetInfo() const override;
 
     // -------------------------------------------------------------------
     /** Imports the given file into the given scene structure.
      * See BaseImporter::InternReadFile() for details */
     void InternReadFile(const std::string &pFile, aiScene *pScene,
-            IOSystem *pIOHandler);
+            IOSystem *pIOHandler) override;
 
 private:
     struct TempScope {

+ 778 - 871
code/AssetLib/glTF/glTFAsset.h

@@ -51,14 +51,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_IMPORTER)
 
+#include "glTFCommon.h"
 #include <assimp/Exceptional.h>
-
+#include <algorithm>
+#include <list>
 #include <map>
+#include <stdexcept>
 #include <string>
-#include <list>
 #include <vector>
-#include <algorithm>
-#include <stdexcept>
+
+// clang-format off
 
 #if (__GNUC__ == 8 && __GNUC_MINOR__ >= 0)
 #pragma GCC diagnostic push
@@ -99,208 +101,205 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #   endif
 #endif
 
-#include "AssetLib/glTF/glTFCommon.h"
-
-namespace glTF
-{
-    using glTFCommon::shared_ptr;
-    using glTFCommon::IOSystem;
-    using glTFCommon::IOStream;
-
-    using rapidjson::Value;
-    using rapidjson::Document;
-
-    class Asset;
-    class AssetWriter;
+// clang-format on
 
-    struct BufferView; // here due to cross-reference
-    struct Texture;
-    struct Light;
-    struct Skin;
+#include "AssetLib/glTF/glTFCommon.h"
 
-    using glTFCommon::vec3;
-    using glTFCommon::vec4;
-    using glTFCommon::mat4;
+namespace glTF {
 
-    //! Magic number for GLB files
-    #define AI_GLB_MAGIC_NUMBER "glTF"
+using glTFCommon::IOStream;
+using glTFCommon::IOSystem;
+using glTFCommon::Nullable;
+using glTFCommon::Ref;
+using glTFCommon::shared_ptr;
 
-    #ifdef ASSIMP_API
-        #include <assimp/Compiler/pushpack1.h>
-    #endif
+using rapidjson::Document;
+using rapidjson::Value;
 
-    //! For the KHR_binary_glTF extension (binary .glb file)
-    //! 20-byte header (+ the JSON + a "body" data section)
-    struct GLB_Header
-    {
-        uint8_t magic[4];     //!< Magic number: "glTF"
-        uint32_t version;     //!< Version number (always 1 as of the last update)
-        uint32_t length;      //!< Total length of the Binary glTF, including header, scene, and body, in bytes
-        uint32_t sceneLength; //!< Length, in bytes, of the glTF scene
-        uint32_t sceneFormat; //!< Specifies the format of the glTF scene (see the SceneFormat enum)
-    } PACK_STRUCT;
+class Asset;
+class AssetWriter;
 
-    #ifdef ASSIMP_API
-        #include <assimp/Compiler/poppack1.h>
-    #endif
+struct BufferView; // here due to cross-reference
+struct Texture;
+struct Light;
+struct Skin;
 
+using glTFCommon::mat4;
+using glTFCommon::vec3;
+using glTFCommon::vec4;
 
-    //! Values for the GLB_Header::sceneFormat field
-    enum SceneFormat
-    {
-        SceneFormat_JSON = 0
-    };
+//! Magic number for GLB files
+#define AI_GLB_MAGIC_NUMBER "glTF"
 
-    //! Values for the mesh primitive modes
-    enum PrimitiveMode
-    {
-        PrimitiveMode_POINTS = 0,
-        PrimitiveMode_LINES = 1,
-        PrimitiveMode_LINE_LOOP = 2,
-        PrimitiveMode_LINE_STRIP = 3,
-        PrimitiveMode_TRIANGLES = 4,
-        PrimitiveMode_TRIANGLE_STRIP = 5,
-        PrimitiveMode_TRIANGLE_FAN = 6
-    };
-
-    //! Values for the Accessor::componentType field
-    enum ComponentType
-    {
-        ComponentType_BYTE = 5120,
-        ComponentType_UNSIGNED_BYTE = 5121,
-        ComponentType_SHORT = 5122,
-        ComponentType_UNSIGNED_SHORT = 5123,
-        ComponentType_UNSIGNED_INT = 5125,
-        ComponentType_FLOAT = 5126
-    };
-
-    inline unsigned int ComponentTypeSize(ComponentType t)
-    {
-        switch (t) {
-            case ComponentType_SHORT:
-            case ComponentType_UNSIGNED_SHORT:
-                return 2;
-
-            case ComponentType_UNSIGNED_INT:
-            case ComponentType_FLOAT:
-                return 4;
-
-            case ComponentType_BYTE:
-            case ComponentType_UNSIGNED_BYTE:
-                return 1;
-            default:
-                std::string err = "GLTF: Unsupported Component Type ";
-                err += std::to_string( t );
-                throw DeadlyImportError(err);
-        }
+// clang-format off
+#ifdef ASSIMP_API
+#   include <assimp/Compiler/pushpack1.h>
+#endif
+// clang-format on
+
+//! For the KHR_binary_glTF extension (binary .glb file)
+//! 20-byte header (+ the JSON + a "body" data section)
+struct GLB_Header {
+    uint8_t magic[4]; //!< Magic number: "glTF"
+    uint32_t version; //!< Version number (always 1 as of the last update)
+    uint32_t length; //!< Total length of the Binary glTF, including header, scene, and body, in bytes
+    uint32_t sceneLength; //!< Length, in bytes, of the glTF scene
+    uint32_t sceneFormat; //!< Specifies the format of the glTF scene (see the SceneFormat enum)
+} PACK_STRUCT;
+
+// clang-format off
+#ifdef ASSIMP_API
+#   include <assimp/Compiler/poppack1.h>
+#endif
+// clang-format on
+
+//! Values for the GLB_Header::sceneFormat field
+enum SceneFormat {
+    SceneFormat_JSON = 0
+};
+
+//! Values for the mesh primitive modes
+enum PrimitiveMode {
+    PrimitiveMode_POINTS = 0,
+    PrimitiveMode_LINES = 1,
+    PrimitiveMode_LINE_LOOP = 2,
+    PrimitiveMode_LINE_STRIP = 3,
+    PrimitiveMode_TRIANGLES = 4,
+    PrimitiveMode_TRIANGLE_STRIP = 5,
+    PrimitiveMode_TRIANGLE_FAN = 6
+};
+
+//! Values for the Accessor::componentType field
+enum ComponentType {
+    ComponentType_BYTE = 5120,
+    ComponentType_UNSIGNED_BYTE = 5121,
+    ComponentType_SHORT = 5122,
+    ComponentType_UNSIGNED_SHORT = 5123,
+    ComponentType_UNSIGNED_INT = 5125,
+    ComponentType_FLOAT = 5126
+};
+
+inline unsigned int ComponentTypeSize(ComponentType t) {
+    switch (t) {
+    case ComponentType_SHORT:
+    case ComponentType_UNSIGNED_SHORT:
+        return 2;
+
+    case ComponentType_UNSIGNED_INT:
+    case ComponentType_FLOAT:
+        return 4;
+
+    case ComponentType_BYTE:
+    case ComponentType_UNSIGNED_BYTE:
+        return 1;
+    default:
+        std::string err = "GLTF: Unsupported Component Type ";
+        err += std::to_string(t);
+        throw DeadlyImportError(err);
     }
+}
 
-    //! Values for the BufferView::target field
-    enum BufferViewTarget
-    {
-        BufferViewTarget_NONE = 0,
-        BufferViewTarget_ARRAY_BUFFER = 34962,
-        BufferViewTarget_ELEMENT_ARRAY_BUFFER = 34963
-    };
-
-    //! Values for the Sampler::magFilter field
-    enum SamplerMagFilter
-    {
-        SamplerMagFilter_Nearest = 9728,
-        SamplerMagFilter_Linear = 9729
-    };
-
-    //! Values for the Sampler::minFilter field
-    enum SamplerMinFilter
-    {
-        SamplerMinFilter_Nearest = 9728,
-        SamplerMinFilter_Linear = 9729,
-        SamplerMinFilter_Nearest_Mipmap_Nearest = 9984,
-        SamplerMinFilter_Linear_Mipmap_Nearest = 9985,
-        SamplerMinFilter_Nearest_Mipmap_Linear = 9986,
-        SamplerMinFilter_Linear_Mipmap_Linear = 9987
-    };
-
-    //! Values for the Sampler::wrapS and Sampler::wrapT field
-    enum SamplerWrap
-    {
-        SamplerWrap_Clamp_To_Edge = 33071,
-        SamplerWrap_Mirrored_Repeat = 33648,
-        SamplerWrap_Repeat = 10497
-    };
-
-    //! Values for the Texture::format and Texture::internalFormat fields
-    enum TextureFormat
-    {
-        TextureFormat_ALPHA = 6406,
-        TextureFormat_RGB = 6407,
-        TextureFormat_RGBA = 6408,
-        TextureFormat_LUMINANCE = 6409,
-        TextureFormat_LUMINANCE_ALPHA = 6410
-    };
-
-    //! Values for the Texture::target field
-    enum TextureTarget
-    {
-        TextureTarget_TEXTURE_2D = 3553
-    };
-
-    //! Values for the Texture::type field
-    enum TextureType
-    {
-        TextureType_UNSIGNED_BYTE = 5121,
-        TextureType_UNSIGNED_SHORT_5_6_5 = 33635,
-        TextureType_UNSIGNED_SHORT_4_4_4_4 = 32819,
-        TextureType_UNSIGNED_SHORT_5_5_5_1 = 32820
+//! Values for the BufferView::target field
+enum BufferViewTarget {
+    BufferViewTarget_NONE = 0,
+    BufferViewTarget_ARRAY_BUFFER = 34962,
+    BufferViewTarget_ELEMENT_ARRAY_BUFFER = 34963
+};
+
+//! Values for the Sampler::magFilter field
+enum SamplerMagFilter {
+    SamplerMagFilter_Nearest = 9728,
+    SamplerMagFilter_Linear = 9729
+};
+
+//! Values for the Sampler::minFilter field
+enum SamplerMinFilter {
+    SamplerMinFilter_Nearest = 9728,
+    SamplerMinFilter_Linear = 9729,
+    SamplerMinFilter_Nearest_Mipmap_Nearest = 9984,
+    SamplerMinFilter_Linear_Mipmap_Nearest = 9985,
+    SamplerMinFilter_Nearest_Mipmap_Linear = 9986,
+    SamplerMinFilter_Linear_Mipmap_Linear = 9987
+};
+
+//! Values for the Sampler::wrapS and Sampler::wrapT field
+enum SamplerWrap {
+    SamplerWrap_Clamp_To_Edge = 33071,
+    SamplerWrap_Mirrored_Repeat = 33648,
+    SamplerWrap_Repeat = 10497
+};
+
+//! Values for the Texture::format and Texture::internalFormat fields
+enum TextureFormat {
+    TextureFormat_ALPHA = 6406,
+    TextureFormat_RGB = 6407,
+    TextureFormat_RGBA = 6408,
+    TextureFormat_LUMINANCE = 6409,
+    TextureFormat_LUMINANCE_ALPHA = 6410
+};
+
+//! Values for the Texture::target field
+enum TextureTarget {
+    TextureTarget_TEXTURE_2D = 3553
+};
+
+//! Values for the Texture::type field
+enum TextureType {
+    TextureType_UNSIGNED_BYTE = 5121,
+    TextureType_UNSIGNED_SHORT_5_6_5 = 33635,
+    TextureType_UNSIGNED_SHORT_4_4_4_4 = 32819,
+    TextureType_UNSIGNED_SHORT_5_5_5_1 = 32820
+};
+
+//! Values for the Accessor::type field (helper class)
+class AttribType {
+public:
+    enum Value { SCALAR,
+        VEC2,
+        VEC3,
+        VEC4,
+        MAT2,
+        MAT3,
+        MAT4 };
+
+private:
+    static const size_t NUM_VALUES = static_cast<size_t>(MAT4) + 1;
+
+    struct Info {
+        const char *name;
+        unsigned int numComponents;
     };
 
+    template <int N>
+    struct data { static const Info infos[NUM_VALUES]; };
 
-    //! Values for the Accessor::type field (helper class)
-    class AttribType
-    {
-    public:
-        enum Value
-            { SCALAR, VEC2, VEC3, VEC4, MAT2, MAT3, MAT4 };
-
-    private:
-        static const size_t NUM_VALUES = static_cast<size_t>(MAT4)+1;
-
-        struct Info
-            { const char* name; unsigned int numComponents; };
-
-        template<int N> struct data
-            { static const Info infos[NUM_VALUES]; };
-
-    public:
-        inline static Value FromString(const char* str)
-        {
-            for (size_t i = 0; i < NUM_VALUES; ++i) {
-                if (strcmp(data<0>::infos[i].name, str) == 0) {
-                    return static_cast<Value>(i);
-                }
+public:
+    inline static Value FromString(const char *str) {
+        for (size_t i = 0; i < NUM_VALUES; ++i) {
+            if (strcmp(data<0>::infos[i].name, str) == 0) {
+                return static_cast<Value>(i);
             }
-            return SCALAR;
-        }
-
-        inline static const char* ToString(Value type)
-        {
-            return data<0>::infos[static_cast<size_t>(type)].name;
         }
+        return SCALAR;
+    }
 
-        inline static unsigned int GetNumComponents(Value type)
-        {
-            return data<0>::infos[static_cast<size_t>(type)].numComponents;
-        }
-    };
-
-    // must match the order of the AttribTypeTraits::Value enum!
-    template<int N> const AttribType::Info
-    AttribType::data<N>::infos[AttribType::NUM_VALUES] = {
-        { "SCALAR", 1 }, { "VEC2", 2 }, { "VEC3", 3 }, { "VEC4", 4 }, { "MAT2", 4 }, { "MAT3", 9 }, { "MAT4", 16 }
-    };
+    inline static const char *ToString(Value type) {
+        return data<0>::infos[static_cast<size_t>(type)].name;
+    }
 
+    inline static unsigned int GetNumComponents(Value type) {
+        return data<0>::infos[static_cast<size_t>(type)].numComponents;
+    }
+};
 
+// must match the order of the AttribTypeTraits::Value enum!
+template <int N>
+const AttribType::Info
+        AttribType::data<N>::infos[AttribType::NUM_VALUES] = {
+            { "SCALAR", 1 }, { "VEC2", 2 }, { "VEC3", 3 }, { "VEC4", 4 }, { "MAT2", 4 }, { "MAT3", 9 }, { "MAT4", 16 }
+        };
 
+/*
     //! A reference to one top-level object, which is valid
     //! until the Asset instance is destroyed
     template<class T>
@@ -324,834 +323,742 @@ namespace glTF
 
         T& operator*()
             { return *((*vector)[index]); }
-    };
-
-    //! Helper struct to represent values that might not be present
-    template<class T>
-    struct Nullable
-    {
-        T value;
-        bool isPresent;
-
-        Nullable() : isPresent(false) {}
-        Nullable(T& val) : value(val), isPresent(true) {}
-    };
+    };*/
 
+//! Base class for all glTF top-level objects
+struct Object {
+    std::string id; //!< The globally unique ID used to reference this object
+    std::string name; //!< The user-defined name of this object
 
-    //! Base class for all glTF top-level objects
-    struct Object
-    {
-        std::string id;   //!< The globally unique ID used to reference this object
-        std::string name; //!< The user-defined name of this object
-
-        //! Objects marked as special are not exported (used to emulate the binary body buffer)
-        virtual bool IsSpecial() const
-            { return false; }
+    //! Objects marked as special are not exported (used to emulate the binary body buffer)
+    virtual bool IsSpecial() const { return false; }
 
-        virtual ~Object() {}
+    virtual ~Object() {}
 
-        //! Maps special IDs to another ID, where needed. Subclasses may override it (statically)
-        static const char* TranslateId(Asset& /*r*/, const char* id)
-            { return id; }
-    };
+    //! Maps special IDs to another ID, where needed. Subclasses may override it (statically)
+    static const char *TranslateId(Asset & /*r*/, const char *id) { return id; }
+};
 
-    //
-    // Classes for each glTF top-level object type
-    //
+//
+// Classes for each glTF top-level object type
+//
 
-    //! A typed view into a BufferView. A BufferView contains raw binary data.
-    //! An accessor provides a typed view into a BufferView or a subset of a BufferView
-    //! similar to how WebGL's vertexAttribPointer() defines an attribute in a buffer.
-    struct Accessor : public Object
-    {
-        Ref<BufferView> bufferView;  //!< The ID of the bufferView. (required)
-        unsigned int byteOffset;     //!< The offset relative to the start of the bufferView in bytes. (required)
-        unsigned int byteStride;     //!< The stride, in bytes, between attributes referenced by this accessor. (default: 0)
-        ComponentType componentType; //!< The datatype of components in the attribute. (required)
-        unsigned int count;          //!< The number of attributes referenced by this accessor. (required)
-        AttribType::Value type;      //!< Specifies if the attribute is a scalar, vector, or matrix. (required)
-        std::vector<double> max;     //!< Maximum value of each component in this attribute.
-        std::vector<double> min;     //!< Minimum value of each component in this attribute.
+//! A typed view into a BufferView. A BufferView contains raw binary data.
+//! An accessor provides a typed view into a BufferView or a subset of a BufferView
+//! similar to how WebGL's vertexAttribPointer() defines an attribute in a buffer.
+struct Accessor : public Object {
+    Ref<BufferView> bufferView; //!< The ID of the bufferView. (required)
+    unsigned int byteOffset; //!< The offset relative to the start of the bufferView in bytes. (required)
+    unsigned int byteStride; //!< The stride, in bytes, between attributes referenced by this accessor. (default: 0)
+    ComponentType componentType; //!< The datatype of components in the attribute. (required)
+    unsigned int count; //!< The number of attributes referenced by this accessor. (required)
+    AttribType::Value type; //!< Specifies if the attribute is a scalar, vector, or matrix. (required)
+    std::vector<double> max; //!< Maximum value of each component in this attribute.
+    std::vector<double> min; //!< Minimum value of each component in this attribute.
 
-        unsigned int GetNumComponents();
-        unsigned int GetBytesPerComponent();
-        unsigned int GetElementSize();
+    unsigned int GetNumComponents();
+    unsigned int GetBytesPerComponent();
+    unsigned int GetElementSize();
 
-        inline uint8_t* GetPointer();
+    inline uint8_t *GetPointer();
 
-        template<class T>
-        bool ExtractData(T*& outData);
+    template <class T>
+    bool ExtractData(T *&outData);
 
-        void WriteData(size_t count, const void* src_buffer, size_t src_stride);
+    void WriteData(size_t count, const void *src_buffer, size_t src_stride);
 
-        //! Helper class to iterate the data
-        class Indexer
-        {
-            friend struct Accessor;
+    //! Helper class to iterate the data
+    class Indexer {
+        friend struct Accessor;
 
         // This field is reported as not used, making it protectd is the easiest way to work around it without going to the bottom of what the problem is:
         // ../code/glTF2/glTF2Asset.h:392:19: error: private field 'accessor' is not used [-Werror,-Wunused-private-field]
-        protected:
-            Accessor &accessor;
-
-        private:
-            uint8_t* data;
-            size_t elemSize, stride;
-
-            Indexer(Accessor& acc);
+    protected:
+        Accessor &accessor;
 
-        public:
-
-            //! Accesses the i-th value as defined by the accessor
-            template<class T>
-            T GetValue(int i);
+    private:
+        uint8_t *data;
+        size_t elemSize, stride;
 
-            //! Accesses the i-th value as defined by the accessor
-            inline unsigned int GetUInt(int i)
-            {
-                return GetValue<unsigned int>(i);
-            }
+        Indexer(Accessor &acc);
 
-            inline bool IsValid() const
-            {
-                return data != 0;
-            }
-        };
+    public:
+        //! Accesses the i-th value as defined by the accessor
+        template <class T>
+        T GetValue(int i);
 
-        inline Indexer GetIndexer()
-        {
-            return Indexer(*this);
+        //! Accesses the i-th value as defined by the accessor
+        inline unsigned int GetUInt(int i) {
+            return GetValue<unsigned int>(i);
         }
 
-        Accessor() {}
-        void Read(Value& obj, Asset& r);
-    };
-
-    //! A buffer points to binary geometry, animation, or skins.
-    struct Buffer : public Object
-	{
-		/********************* Types *********************/
-	public:
-
-		enum Type
-		{
-			Type_arraybuffer,
-			Type_text
-		};
-
-		/// \struct SEncodedRegion
-		/// Descriptor of encoded region in "bufferView".
-		struct SEncodedRegion
-		{
-			const size_t Offset;///< Offset from begin of "bufferView" to encoded region, in bytes.
-			const size_t EncodedData_Length;///< Size of encoded region, in bytes.
-			uint8_t* const DecodedData;///< Cached encoded data.
-			const size_t DecodedData_Length;///< Size of decoded region, in bytes.
-			const std::string ID;///< ID of the region.
-
-			/// \fn SEncodedRegion(const size_t pOffset, const size_t pEncodedData_Length, uint8_t* pDecodedData, const size_t pDecodedData_Length, const std::string pID)
-			/// Constructor.
-			/// \param [in] pOffset - offset from begin of "bufferView" to encoded region, in bytes.
-			/// \param [in] pEncodedData_Length - size of encoded region, in bytes.
-			/// \param [in] pDecodedData - pointer to decoded data array.
-			/// \param [in] pDecodedData_Length - size of encoded region, in bytes.
-			/// \param [in] pID - ID of the region.
-            SEncodedRegion(const size_t pOffset, const size_t pEncodedData_Length, uint8_t *pDecodedData, const size_t pDecodedData_Length, const std::string &pID) :
-                    Offset(pOffset), EncodedData_Length(pEncodedData_Length), DecodedData(pDecodedData), DecodedData_Length(pDecodedData_Length), ID(pID) {}
-
-            /// \fn ~SEncodedRegion()
-			/// Destructor.
-			~SEncodedRegion() { delete [] DecodedData; }
-		};
-
-		/******************* Variables *******************/
-
-		//std::string uri; //!< The uri of the buffer. Can be a filepath, a data uri, etc. (required)
-		size_t byteLength; //!< The length of the buffer in bytes. (default: 0)
-		//std::string type; //!< XMLHttpRequest responseType (default: "arraybuffer")
-
-		Type type;
-
-		/// \var EncodedRegion_Current
-		/// Pointer to currently active encoded region.
-		/// Why not decoding all regions at once and not to set one buffer with decoded data?
-		/// Yes, why not? Even "accessor" point to decoded data. I mean that fields "byteOffset", "byteStride" and "count" has values which describes decoded
-		/// data array. But only in range of mesh while is active parameters from "compressedData". For another mesh accessors point to decoded data too. But
-		/// offset is counted for another regions is encoded.
-		/// Example. You have two meshes. For every of it you have 4 bytes of data. That data compressed to 2 bytes. So, you have buffer with encoded data:
-		/// M1_E0, M1_E1, M2_E0, M2_E1.
-		/// After decoding you'll get:
-		/// M1_D0, M1_D1, M1_D2, M1_D3, M2_D0, M2_D1, M2_D2, M2_D3.
-		/// "accessors" must to use values that point to decoded data - obviously. So, you'll expect "accessors" like
-		/// "accessor_0" : { byteOffset: 0, byteLength: 4}, "accessor_1" : { byteOffset: 4, byteLength: 4}
-		/// but in real life you'll get:
-		/// "accessor_0" : { byteOffset: 0, byteLength: 4}, "accessor_1" : { byteOffset: 2, byteLength: 4}
-		/// Yes, accessor of next mesh has offset and length which mean: current mesh data is decoded, all other data is encoded.
-		/// And when before you start to read data of current mesh (with encoded data ofcourse) you must decode region of "bufferView", after read finished
-		/// delete encoding mark. And after that you can repeat process: decode data of mesh, read, delete decoded data.
-		///
-		/// Remark. Encoding all data at once is good in world with computers which do not has RAM limitation. So, you must use step by step encoding in
-		/// exporter and importer. And, thanks to such way, there is no need to load whole file into memory.
-		SEncodedRegion* EncodedRegion_Current;
-
-	private:
-
-		shared_ptr<uint8_t> mData; //!< Pointer to the data
-		bool mIsSpecial; //!< Set to true for special cases (e.g. the body buffer)
-        size_t capacity = 0; //!< The capacity of the buffer in bytes. (default: 0)
-		/// \var EncodedRegion_List
-		/// List of encoded regions.
-		std::list<SEncodedRegion*> EncodedRegion_List;
-
-		/******************* Functions *******************/
-
-	public:
-
-		Buffer();
-		~Buffer();
-
-		void Read(Value& obj, Asset& r);
-
-        bool LoadFromStream(IOStream& stream, size_t length = 0, size_t baseOffset = 0);
-
-		/// \fn void EncodedRegion_Mark(const size_t pOffset, const size_t pEncodedData_Length, uint8_t* pDecodedData, const size_t pDecodedData_Length, const std::string& pID)
-		/// Mark region of "bufferView" as encoded. When data is request from such region then "bufferView" use decoded data.
-		/// \param [in] pOffset - offset from begin of "bufferView" to encoded region, in bytes.
-		/// \param [in] pEncodedData_Length - size of encoded region, in bytes.
-		/// \param [in] pDecodedData - pointer to decoded data array.
-		/// \param [in] pDecodedData_Length - size of encoded region, in bytes.
-		/// \param [in] pID - ID of the region.
-		void EncodedRegion_Mark(const size_t pOffset, const size_t pEncodedData_Length, uint8_t* pDecodedData, const size_t pDecodedData_Length, const std::string& pID);
-
-		/// \fn void EncodedRegion_SetCurrent(const std::string& pID)
-		/// Select current encoded region by ID. \sa EncodedRegion_Current.
-		/// \param [in] pID - ID of the region.
-		void EncodedRegion_SetCurrent(const std::string& pID);
-
-		/// \fn bool ReplaceData(const size_t pBufferData_Offset, const size_t pBufferData_Count, const uint8_t* pReplace_Data, const size_t pReplace_Count)
-		/// Replace part of buffer data. Pay attention that function work with original array of data (\ref mData) not with encoded regions.
-		/// \param [in] pBufferData_Offset - index of first element in buffer from which new data will be placed.
-		/// \param [in] pBufferData_Count - count of bytes in buffer which will be replaced.
-		/// \param [in] pReplace_Data - pointer to array with new data for buffer.
-		/// \param [in] pReplace_Count - count of bytes in new data.
-		/// \return true - if successfully replaced, false if input arguments is out of range.
-		bool ReplaceData(const size_t pBufferData_Offset, const size_t pBufferData_Count, const uint8_t* pReplace_Data, const size_t pReplace_Count);
-
-        size_t AppendData(uint8_t* data, size_t length);
-        void Grow(size_t amount);
-
-        uint8_t* GetPointer()
-            { return mData.get(); }
-
-        void MarkAsSpecial()
-            { mIsSpecial = true; }
-
-        bool IsSpecial() const
-            { return mIsSpecial; }
-
-        std::string GetURI()
-            { return std::string(this->id) + ".bin"; }
-
-        static const char* TranslateId(Asset& r, const char* id);
+        inline bool IsValid() const {
+            return data != 0;
+        }
     };
 
-    //! A view into a buffer generally representing a subset of the buffer.
-    struct BufferView : public Object
-    {
-        Ref<Buffer> buffer; //! The ID of the buffer. (required)
-        size_t byteOffset; //! The offset into the buffer in bytes. (required)
-        size_t byteLength; //! The length of the bufferView in bytes. (default: 0)
-
-        BufferViewTarget target; //! The target that the WebGL buffer should be bound to.
+    inline Indexer GetIndexer() {
+        return Indexer(*this);
+    }
 
-        void Read(Value& obj, Asset& r);
+    Accessor() {}
+    void Read(Value &obj, Asset &r);
+};
+
+//! A buffer points to binary geometry, animation, or skins.
+struct Buffer : public Object {
+    /********************* Types *********************/
+public:
+    enum Type {
+        Type_arraybuffer,
+        Type_text
     };
 
-    struct Camera : public Object
-    {
-        enum Type
-        {
-            Perspective,
-            Orthographic
-        };
-
-        Type type;
-
-        union
-        {
-            struct {
-                float aspectRatio; //!<The floating - point aspect ratio of the field of view. (0 = undefined = use the canvas one)
-                float yfov;  //!<The floating - point vertical field of view in radians. (required)
-                float zfar;  //!<The floating - point distance to the far clipping plane. (required)
-                float znear; //!< The floating - point distance to the near clipping plane. (required)
-            } perspective;
-
-            struct {
-                float xmag;  //! The floating-point horizontal magnification of the view. (required)
-                float ymag;  //! The floating-point vertical magnification of the view. (required)
-                float zfar;  //! The floating-point distance to the far clipping plane. (required)
-                float znear; //! The floating-point distance to the near clipping plane. (required)
-            } ortographic;
-        };
+    /// \struct SEncodedRegion
+    /// Descriptor of encoded region in "bufferView".
+    struct SEncodedRegion {
+        const size_t Offset; ///< Offset from begin of "bufferView" to encoded region, in bytes.
+        const size_t EncodedData_Length; ///< Size of encoded region, in bytes.
+        uint8_t *const DecodedData; ///< Cached encoded data.
+        const size_t DecodedData_Length; ///< Size of decoded region, in bytes.
+        const std::string ID; ///< ID of the region.
+
+        /// \fn SEncodedRegion(const size_t pOffset, const size_t pEncodedData_Length, uint8_t* pDecodedData, const size_t pDecodedData_Length, const std::string pID)
+        /// Constructor.
+        /// \param [in] pOffset - offset from begin of "bufferView" to encoded region, in bytes.
+        /// \param [in] pEncodedData_Length - size of encoded region, in bytes.
+        /// \param [in] pDecodedData - pointer to decoded data array.
+        /// \param [in] pDecodedData_Length - size of encoded region, in bytes.
+        /// \param [in] pID - ID of the region.
+        SEncodedRegion(const size_t pOffset, const size_t pEncodedData_Length, uint8_t *pDecodedData, const size_t pDecodedData_Length, const std::string &pID) :
+                Offset(pOffset), EncodedData_Length(pEncodedData_Length), DecodedData(pDecodedData), DecodedData_Length(pDecodedData_Length), ID(pID) {}
+
+        /// \fn ~SEncodedRegion()
+        /// Destructor.
+        ~SEncodedRegion() { delete[] DecodedData; }
+    };
 
-        Camera() {}
-        void Read(Value& obj, Asset& r);
+    /******************* Variables *******************/
+
+    //std::string uri; //!< The uri of the buffer. Can be a filepath, a data uri, etc. (required)
+    size_t byteLength; //!< The length of the buffer in bytes. (default: 0)
+    //std::string type; //!< XMLHttpRequest responseType (default: "arraybuffer")
+
+    Type type;
+
+    /// \var EncodedRegion_Current
+    /// Pointer to currently active encoded region.
+    /// Why not decoding all regions at once and not to set one buffer with decoded data?
+    /// Yes, why not? Even "accessor" point to decoded data. I mean that fields "byteOffset", "byteStride" and "count" has values which describes decoded
+    /// data array. But only in range of mesh while is active parameters from "compressedData". For another mesh accessors point to decoded data too. But
+    /// offset is counted for another regions is encoded.
+    /// Example. You have two meshes. For every of it you have 4 bytes of data. That data compressed to 2 bytes. So, you have buffer with encoded data:
+    /// M1_E0, M1_E1, M2_E0, M2_E1.
+    /// After decoding you'll get:
+    /// M1_D0, M1_D1, M1_D2, M1_D3, M2_D0, M2_D1, M2_D2, M2_D3.
+    /// "accessors" must to use values that point to decoded data - obviously. So, you'll expect "accessors" like
+    /// "accessor_0" : { byteOffset: 0, byteLength: 4}, "accessor_1" : { byteOffset: 4, byteLength: 4}
+    /// but in real life you'll get:
+    /// "accessor_0" : { byteOffset: 0, byteLength: 4}, "accessor_1" : { byteOffset: 2, byteLength: 4}
+    /// Yes, accessor of next mesh has offset and length which mean: current mesh data is decoded, all other data is encoded.
+    /// And when before you start to read data of current mesh (with encoded data ofcourse) you must decode region of "bufferView", after read finished
+    /// delete encoding mark. And after that you can repeat process: decode data of mesh, read, delete decoded data.
+    ///
+    /// Remark. Encoding all data at once is good in world with computers which do not has RAM limitation. So, you must use step by step encoding in
+    /// exporter and importer. And, thanks to such way, there is no need to load whole file into memory.
+    SEncodedRegion *EncodedRegion_Current;
+
+private:
+    shared_ptr<uint8_t> mData; //!< Pointer to the data
+    bool mIsSpecial; //!< Set to true for special cases (e.g. the body buffer)
+    size_t capacity = 0; //!< The capacity of the buffer in bytes. (default: 0)
+    /// \var EncodedRegion_List
+    /// List of encoded regions.
+    std::list<SEncodedRegion *> EncodedRegion_List;
+
+    /******************* Functions *******************/
+
+public:
+    Buffer();
+    ~Buffer();
+
+    void Read(Value &obj, Asset &r);
+
+    bool LoadFromStream(IOStream &stream, size_t length = 0, size_t baseOffset = 0);
+
+    /// \fn void EncodedRegion_Mark(const size_t pOffset, const size_t pEncodedData_Length, uint8_t* pDecodedData, const size_t pDecodedData_Length, const std::string& pID)
+    /// Mark region of "bufferView" as encoded. When data is request from such region then "bufferView" use decoded data.
+    /// \param [in] pOffset - offset from begin of "bufferView" to encoded region, in bytes.
+    /// \param [in] pEncodedData_Length - size of encoded region, in bytes.
+    /// \param [in] pDecodedData - pointer to decoded data array.
+    /// \param [in] pDecodedData_Length - size of encoded region, in bytes.
+    /// \param [in] pID - ID of the region.
+    void EncodedRegion_Mark(const size_t pOffset, const size_t pEncodedData_Length, uint8_t *pDecodedData, const size_t pDecodedData_Length, const std::string &pID);
+
+    /// \fn void EncodedRegion_SetCurrent(const std::string& pID)
+    /// Select current encoded region by ID. \sa EncodedRegion_Current.
+    /// \param [in] pID - ID of the region.
+    void EncodedRegion_SetCurrent(const std::string &pID);
+
+    /// \fn bool ReplaceData(const size_t pBufferData_Offset, const size_t pBufferData_Count, const uint8_t* pReplace_Data, const size_t pReplace_Count)
+    /// Replace part of buffer data. Pay attention that function work with original array of data (\ref mData) not with encoded regions.
+    /// \param [in] pBufferData_Offset - index of first element in buffer from which new data will be placed.
+    /// \param [in] pBufferData_Count - count of bytes in buffer which will be replaced.
+    /// \param [in] pReplace_Data - pointer to array with new data for buffer.
+    /// \param [in] pReplace_Count - count of bytes in new data.
+    /// \return true - if successfully replaced, false if input arguments is out of range.
+    bool ReplaceData(const size_t pBufferData_Offset, const size_t pBufferData_Count, const uint8_t *pReplace_Data, const size_t pReplace_Count);
+
+    size_t AppendData(uint8_t *data, size_t length);
+    void Grow(size_t amount);
+
+    uint8_t *GetPointer() { return mData.get(); }
+
+    void MarkAsSpecial() { mIsSpecial = true; }
+
+    bool IsSpecial() const { return mIsSpecial; }
+
+    std::string GetURI() { return std::string(this->id) + ".bin"; }
+
+    static const char *TranslateId(Asset &r, const char *id);
+};
+
+//! A view into a buffer generally representing a subset of the buffer.
+struct BufferView : public Object {
+    Ref<Buffer> buffer; //! The ID of the buffer. (required)
+    size_t byteOffset; //! The offset into the buffer in bytes. (required)
+    size_t byteLength; //! The length of the bufferView in bytes. (default: 0)
+
+    BufferViewTarget target; //! The target that the WebGL buffer should be bound to.
+
+    void Read(Value &obj, Asset &r);
+};
+
+struct Camera : public Object {
+    enum Type {
+        Perspective,
+        Orthographic
     };
 
+    Type type;
 
-    //! Image data used to create a texture.
-    struct Image : public Object
-    {
-        std::string uri; //! The uri of the image, that can be a file path, a data URI, etc.. (required)
+    union {
+        struct {
+            float aspectRatio; //!<The floating - point aspect ratio of the field of view. (0 = undefined = use the canvas one)
+            float yfov; //!<The floating - point vertical field of view in radians. (required)
+            float zfar; //!<The floating - point distance to the far clipping plane. (required)
+            float znear; //!< The floating - point distance to the near clipping plane. (required)
+        } perspective;
 
-        Ref<BufferView> bufferView;
+        struct {
+            float xmag; //! The floating-point horizontal magnification of the view. (required)
+            float ymag; //! The floating-point vertical magnification of the view. (required)
+            float zfar; //! The floating-point distance to the far clipping plane. (required)
+            float znear; //! The floating-point distance to the near clipping plane. (required)
+        } ortographic;
+    };
 
-        std::string mimeType;
+    Camera() {}
+    void Read(Value &obj, Asset &r);
+};
 
-        int width, height;
+//! Image data used to create a texture.
+struct Image : public Object {
+    std::string uri; //! The uri of the image, that can be a file path, a data URI, etc.. (required)
 
-    private:
-        std::unique_ptr<uint8_t[]> mData;
-        size_t mDataLength;
+    Ref<BufferView> bufferView;
 
-    public:
+    std::string mimeType;
 
-        Image();
-        void Read(Value& obj, Asset& r);
+    int width, height;
 
-        inline bool HasData() const
-            { return mDataLength > 0; }
+private:
+    std::unique_ptr<uint8_t[]> mData;
+    size_t mDataLength;
 
-        inline size_t GetDataLength() const
-            { return mDataLength; }
+public:
+    Image();
+    void Read(Value &obj, Asset &r);
 
-        inline const uint8_t* GetData() const
-            { return mData.get(); }
+    inline bool HasData() const { return mDataLength > 0; }
 
-        inline uint8_t* StealData();
+    inline size_t GetDataLength() const { return mDataLength; }
 
-        inline void SetData(uint8_t* data, size_t length, Asset& r);
-    };
+    inline const uint8_t *GetData() const { return mData.get(); }
 
-    //! Holds a material property that can be a texture or a color
-    struct TexProperty
-    {
-        Ref<Texture> texture;
-        vec4 color;
-    };
+    inline uint8_t *StealData();
 
-    //! The material appearance of a primitive.
-    struct Material : public Object
-    {
-        //Ref<Sampler> source; //!< The ID of the technique.
-        //std::gltf_unordered_map<std::string, std::string> values; //!< A dictionary object of parameter values.
-
-        //! Techniques defined by KHR_materials_common
-        enum Technique
-        {
-            Technique_undefined = 0,
-            Technique_BLINN,
-            Technique_PHONG,
-            Technique_LAMBERT,
-            Technique_CONSTANT
-        };
-
-        TexProperty ambient;
-        TexProperty diffuse;
-        TexProperty specular;
-        TexProperty emission;
+    inline void SetData(uint8_t *data, size_t length, Asset &r);
+};
 
-        bool doubleSided;
-        bool transparent;
-        float transparency;
-        float shininess;
+//! Holds a material property that can be a texture or a color
+struct TexProperty {
+    Ref<Texture> texture;
+    vec4 color;
+};
 
-        Technique technique;
+//! The material appearance of a primitive.
+struct Material : public Object {
+    //Ref<Sampler> source; //!< The ID of the technique.
+    //std::gltf_unordered_map<std::string, std::string> values; //!< A dictionary object of parameter values.
 
-        Material() { SetDefaults(); }
-        void Read(Value& obj, Asset& r);
-        void SetDefaults();
+    //! Techniques defined by KHR_materials_common
+    enum Technique {
+        Technique_undefined = 0,
+        Technique_BLINN,
+        Technique_PHONG,
+        Technique_LAMBERT,
+        Technique_CONSTANT
     };
 
-    //! A set of primitives to be rendered. A node can contain one or more meshes. A node's transform places the mesh in the scene.
-    struct Mesh : public Object
-    {
-        typedef std::vector< Ref<Accessor> > AccessorList;
-
-        struct Primitive
-        {
-            PrimitiveMode mode;
-
-            struct Attributes {
-                AccessorList position, normal, texcoord, color, joint, jointmatrix, weight;
-            } attributes;
+    TexProperty ambient;
+    TexProperty diffuse;
+    TexProperty specular;
+    TexProperty emission;
 
-            Ref<Accessor> indices;
-
-            Ref<Material> material;
-        };
-
-		/// \struct SExtension
-		/// Extension used for mesh.
-		struct SExtension
-		{
-			/// \enum EType
-			/// Type of extension.
-			enum EType
-			{
-				#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
-					Compression_Open3DGC,///< Compression of mesh data using Open3DGC algorithm.
-				#endif
-
-				Unknown
-			};
-
-			EType Type;///< Type of extension.
-
-			/// \fn SExtension
-			/// Constructor.
-			/// \param [in] pType - type of extension.
-			SExtension(const EType pType)
-				: Type(pType)
-			{}
-
-            virtual ~SExtension() {
-                // empty
-            }
-		};
-
-		#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
-			/// \struct SCompression_Open3DGC
-			/// Compression of mesh data using Open3DGC algorithm.
-			struct SCompression_Open3DGC : public SExtension
-			{
-				using SExtension::Type;
-
-				std::string Buffer;///< ID of "buffer" used for storing compressed data.
-				size_t Offset;///< Offset in "bufferView" where compressed data are stored.
-				size_t Count;///< Count of elements in compressed data. Is always equivalent to size in bytes: look comments for "Type" and "Component_Type".
-				bool Binary;///< If true then "binary" mode is used for coding, if false - "ascii" mode.
-				size_t IndicesCount;///< Count of indices in mesh.
-				size_t VerticesCount;///< Count of vertices in mesh.
-				// AttribType::Value Type;///< Is always "SCALAR".
-				// ComponentType Component_Type;///< Is always "ComponentType_UNSIGNED_BYTE" (5121).
-
-				/// \fn SCompression_Open3DGC
-				/// Constructor.
-				SCompression_Open3DGC()
-				: SExtension(Compression_Open3DGC) {
-                    // empty
-                }
-
-                virtual ~SCompression_Open3DGC() {
-                    // empty
-                }
-			};
-		#endif
-
-        std::vector<Primitive> primitives;
-		std::list<SExtension*> Extension;///< List of extensions used in mesh.
-
-        Mesh() {}
-
-		/// \fn ~Mesh()
-		/// Destructor.
-		~Mesh() { for(std::list<SExtension*>::iterator it = Extension.begin(), it_end = Extension.end(); it != it_end; it++) { delete *it; }; }
-
-		/// \fn void Read(Value& pJSON_Object, Asset& pAsset_Root)
-		/// Get mesh data from JSON-object and place them to root asset.
-		/// \param [in] pJSON_Object - reference to pJSON-object from which data are read.
-		/// \param [out] pAsset_Root - reference to root asset where data will be stored.
-		void Read(Value& pJSON_Object, Asset& pAsset_Root);
-
-		#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
-			/// \fn void Decode_O3DGC(const SCompression_Open3DGC& pCompression_Open3DGC, Asset& pAsset_Root)
-			/// Decode part of "buffer" which encoded with Open3DGC algorithm.
-			/// \param [in] pCompression_Open3DGC - reference to structure which describe encoded region.
-			/// \param [out] pAsset_Root - reference to root assed where data will be stored.
-			void Decode_O3DGC(const SCompression_Open3DGC& pCompression_Open3DGC, Asset& pAsset_Root);
-		#endif
-    };
+    bool doubleSided;
+    bool transparent;
+    float transparency;
+    float shininess;
 
-    struct Node : public Object
-    {
-        std::vector< Ref<Node> > children;
-        std::vector< Ref<Mesh> > meshes;
+    Technique technique;
 
-        Nullable<mat4> matrix;
-        Nullable<vec3> translation;
-        Nullable<vec4> rotation;
-        Nullable<vec3> scale;
+    Material() { SetDefaults(); }
+    void Read(Value &obj, Asset &r);
+    void SetDefaults();
+};
 
-        Ref<Camera> camera;
-        Ref<Light>  light;
+//! A set of primitives to be rendered. A node can contain one or more meshes. A node's transform places the mesh in the scene.
+struct Mesh : public Object {
+    typedef std::vector<Ref<Accessor>> AccessorList;
 
-        std::vector< Ref<Node> > skeletons;       //!< The ID of skeleton nodes. Each of which is the root of a node hierarchy.
-        Ref<Skin>  skin;                          //!< The ID of the skin referenced by this node.
-        std::string jointName;                    //!< Name used when this node is a joint in a skin.
+    struct Primitive {
+        PrimitiveMode mode;
 
-        Ref<Node> parent;                         //!< This is not part of the glTF specification. Used as a helper.
+        struct Attributes {
+            AccessorList position, normal, texcoord, color, joint, jointmatrix, weight;
+        } attributes;
 
-        Node() {}
-        void Read(Value& obj, Asset& r);
-    };
+        Ref<Accessor> indices;
 
-    struct Program : public Object
-    {
-        Program() {}
-        void Read(Value& obj, Asset& r);
+        Ref<Material> material;
     };
 
+    /// \struct SExtension
+    /// Extension used for mesh.
+    struct SExtension {
+        /// \enum EType
+        /// Type of extension.
+        enum EType {
+#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
+            Compression_Open3DGC, ///< Compression of mesh data using Open3DGC algorithm.
+#endif
 
-    struct Sampler : public Object
-    {
-        SamplerMagFilter magFilter; //!< The texture magnification filter. (required)
-        SamplerMinFilter minFilter; //!< The texture minification filter. (required)
-        SamplerWrap wrapS;          //!< The texture wrapping in the S direction. (required)
-        SamplerWrap wrapT;          //!< The texture wrapping in the T direction. (required)
-
-        Sampler() {}
-        void Read(Value& obj, Asset& r);
-        void SetDefaults();
-    };
+            Unknown
+        };
 
-    struct Scene : public Object
-    {
-        std::vector< Ref<Node> > nodes;
+        EType Type; ///< Type of extension.
 
-        Scene() {}
-        void Read(Value& obj, Asset& r);
-    };
+        /// \fn SExtension
+        /// Constructor.
+        /// \param [in] pType - type of extension.
+        SExtension(const EType pType) :
+                Type(pType) {}
 
-    struct Shader : public Object
-    {
-        Shader() {}
-        void Read(Value& obj, Asset& r);
+        virtual ~SExtension() {
+            // empty
+        }
     };
 
-    struct Skin : public Object
-    {
-        Nullable<mat4> bindShapeMatrix;       //!< Floating-point 4x4 transformation matrix stored in column-major order.
-        Ref<Accessor> inverseBindMatrices;    //!< The ID of the accessor containing the floating-point 4x4 inverse-bind matrices.
-        std::vector<Ref<Node>> jointNames;    //!< Joint names of the joints (nodes with a jointName property) in this skin.
-        std::string name;                     //!< The user-defined name of this object.
+#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
+    /// \struct SCompression_Open3DGC
+    /// Compression of mesh data using Open3DGC algorithm.
+    struct SCompression_Open3DGC : public SExtension {
+        using SExtension::Type;
+
+        std::string Buffer; ///< ID of "buffer" used for storing compressed data.
+        size_t Offset; ///< Offset in "bufferView" where compressed data are stored.
+        size_t Count; ///< Count of elements in compressed data. Is always equivalent to size in bytes: look comments for "Type" and "Component_Type".
+        bool Binary; ///< If true then "binary" mode is used for coding, if false - "ascii" mode.
+        size_t IndicesCount; ///< Count of indices in mesh.
+        size_t VerticesCount; ///< Count of vertices in mesh.
+        // AttribType::Value Type;///< Is always "SCALAR".
+        // ComponentType Component_Type;///< Is always "ComponentType_UNSIGNED_BYTE" (5121).
+
+        /// \fn SCompression_Open3DGC
+        /// Constructor.
+        SCompression_Open3DGC() :
+                SExtension(Compression_Open3DGC) {
+            // empty
+        }
 
-        Skin() {}
-        void Read(Value& obj, Asset& r);
+        virtual ~SCompression_Open3DGC() {
+            // empty
+        }
     };
+#endif
 
-    struct Technique : public Object
-    {
-        struct Parameters
-        {
-
-        };
-
-        struct States
-        {
-
-        };
+    std::vector<Primitive> primitives;
+    std::list<SExtension *> Extension; ///< List of extensions used in mesh.
 
-        struct Functions
-        {
+    Mesh() {}
 
+    /// \fn ~Mesh()
+    /// Destructor.
+    ~Mesh() {
+        for (std::list<SExtension *>::iterator it = Extension.begin(), it_end = Extension.end(); it != it_end; it++) {
+            delete *it;
         };
+    }
 
-        Technique() {}
-        void Read(Value& obj, Asset& r);
+    /// \fn void Read(Value& pJSON_Object, Asset& pAsset_Root)
+    /// Get mesh data from JSON-object and place them to root asset.
+    /// \param [in] pJSON_Object - reference to pJSON-object from which data are read.
+    /// \param [out] pAsset_Root - reference to root asset where data will be stored.
+    void Read(Value &pJSON_Object, Asset &pAsset_Root);
+
+#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
+    /// \fn void Decode_O3DGC(const SCompression_Open3DGC& pCompression_Open3DGC, Asset& pAsset_Root)
+    /// Decode part of "buffer" which encoded with Open3DGC algorithm.
+    /// \param [in] pCompression_Open3DGC - reference to structure which describe encoded region.
+    /// \param [out] pAsset_Root - reference to root assed where data will be stored.
+    void Decode_O3DGC(const SCompression_Open3DGC &pCompression_Open3DGC, Asset &pAsset_Root);
+#endif
+};
+
+struct Node : public Object {
+    std::vector<Ref<Node>> children;
+    std::vector<Ref<Mesh>> meshes;
+
+    Nullable<mat4> matrix;
+    Nullable<vec3> translation;
+    Nullable<vec4> rotation;
+    Nullable<vec3> scale;
+
+    Ref<Camera> camera;
+    Ref<Light> light;
+
+    std::vector<Ref<Node>> skeletons; //!< The ID of skeleton nodes. Each of which is the root of a node hierarchy.
+    Ref<Skin> skin; //!< The ID of the skin referenced by this node.
+    std::string jointName; //!< Name used when this node is a joint in a skin.
+
+    Ref<Node> parent; //!< This is not part of the glTF specification. Used as a helper.
+
+    Node() {}
+    void Read(Value &obj, Asset &r);
+};
+
+struct Program : public Object {
+    Program() {}
+    void Read(Value &obj, Asset &r);
+};
+
+struct Sampler : public Object {
+    SamplerMagFilter magFilter; //!< The texture magnification filter. (required)
+    SamplerMinFilter minFilter; //!< The texture minification filter. (required)
+    SamplerWrap wrapS; //!< The texture wrapping in the S direction. (required)
+    SamplerWrap wrapT; //!< The texture wrapping in the T direction. (required)
+
+    Sampler() {}
+    void Read(Value &obj, Asset &r);
+    void SetDefaults();
+};
+
+struct Scene : public Object {
+    std::vector<Ref<Node>> nodes;
+
+    Scene() {}
+    void Read(Value &obj, Asset &r);
+};
+
+struct Shader : public Object {
+    Shader() {}
+    void Read(Value &obj, Asset &r);
+};
+
+struct Skin : public Object {
+    Nullable<mat4> bindShapeMatrix; //!< Floating-point 4x4 transformation matrix stored in column-major order.
+    Ref<Accessor> inverseBindMatrices; //!< The ID of the accessor containing the floating-point 4x4 inverse-bind matrices.
+    std::vector<Ref<Node>> jointNames; //!< Joint names of the joints (nodes with a jointName property) in this skin.
+    std::string name; //!< The user-defined name of this object.
+
+    Skin() {}
+    void Read(Value &obj, Asset &r);
+};
+
+struct Technique : public Object {
+    struct Parameters {
     };
 
-    //! A texture and its sampler.
-    struct Texture : public Object
-    {
-        Ref<Sampler> sampler; //!< The ID of the sampler used by this texture. (required)
-        Ref<Image> source;    //!< The ID of the image used by this texture. (required)
-
-        //TextureFormat format; //!< The texture's format. (default: TextureFormat_RGBA)
-        //TextureFormat internalFormat; //!< The texture's internal format. (default: TextureFormat_RGBA)
-
-        //TextureTarget target; //!< The target that the WebGL texture should be bound to. (default: TextureTarget_TEXTURE_2D)
-        //TextureType type; //!< Texel datatype. (default: TextureType_UNSIGNED_BYTE)
+    struct States {
+    };
 
-        Texture() {}
-        void Read(Value& obj, Asset& r);
+    struct Functions {
     };
 
+    Technique() {}
+    void Read(Value &obj, Asset &r);
+};
+
+//! A texture and its sampler.
+struct Texture : public Object {
+    Ref<Sampler> sampler; //!< The ID of the sampler used by this texture. (required)
+    Ref<Image> source; //!< The ID of the image used by this texture. (required)
+
+    //TextureFormat format; //!< The texture's format. (default: TextureFormat_RGBA)
+    //TextureFormat internalFormat; //!< The texture's internal format. (default: TextureFormat_RGBA)
+
+    //TextureTarget target; //!< The target that the WebGL texture should be bound to. (default: TextureTarget_TEXTURE_2D)
+    //TextureType type; //!< Texel datatype. (default: TextureType_UNSIGNED_BYTE)
+
+    Texture() {}
+    void Read(Value &obj, Asset &r);
+};
+
+//! A light (from KHR_materials_common extension)
+struct Light : public Object {
+    enum Type {
+        Type_undefined,
+        Type_ambient,
+        Type_directional,
+        Type_point,
+        Type_spot
+    };
 
-    //! A light (from KHR_materials_common extension)
-    struct Light : public Object
-    {
-        enum Type
-        {
-            Type_undefined,
-            Type_ambient,
-            Type_directional,
-            Type_point,
-            Type_spot
-        };
+    Type type;
 
-        Type type;
+    vec4 color;
+    float distance;
+    float constantAttenuation;
+    float linearAttenuation;
+    float quadraticAttenuation;
+    float falloffAngle;
+    float falloffExponent;
 
-        vec4 color;
-        float distance;
-        float constantAttenuation;
-        float linearAttenuation;
-        float quadraticAttenuation;
-        float falloffAngle;
-        float falloffExponent;
+    Light() {}
+    void Read(Value &obj, Asset &r);
 
-        Light() {}
-        void Read(Value& obj, Asset& r);
+    void SetDefaults();
+};
 
-        void SetDefaults();
+struct Animation : public Object {
+    struct AnimSampler {
+        std::string id; //!< The ID of this sampler.
+        std::string input; //!< The ID of a parameter in this animation to use as key-frame input.
+        std::string interpolation; //!< Type of interpolation algorithm to use between key-frames.
+        std::string output; //!< The ID of a parameter in this animation to use as key-frame output.
     };
 
-    struct Animation : public Object
-    {
-        struct AnimSampler {
-            std::string id;               //!< The ID of this sampler.
-            std::string input;            //!< The ID of a parameter in this animation to use as key-frame input.
-            std::string interpolation;    //!< Type of interpolation algorithm to use between key-frames.
-            std::string output;           //!< The ID of a parameter in this animation to use as key-frame output.
-        };
-
-        struct AnimChannel {
-            std::string sampler;         //!< The ID of one sampler present in the containing animation's samplers property.
-
-            struct AnimTarget {
-                Ref<Node> id;            //!< The ID of the node to animate.
-                std::string path;        //!< The name of property of the node to animate ("translation", "rotation", or "scale").
-            } target;
-        };
+    struct AnimChannel {
+        std::string sampler; //!< The ID of one sampler present in the containing animation's samplers property.
 
-        struct AnimParameters {
-            Ref<Accessor> TIME;           //!< Accessor reference to a buffer storing a array of floating point scalar values.
-            Ref<Accessor> rotation;       //!< Accessor reference to a buffer storing a array of four-component floating-point vectors.
-            Ref<Accessor> scale;          //!< Accessor reference to a buffer storing a array of three-component floating-point vectors.
-            Ref<Accessor> translation;    //!< Accessor reference to a buffer storing a array of three-component floating-point vectors.
-        };
+        struct AnimTarget {
+            Ref<Node> id; //!< The ID of the node to animate.
+            std::string path; //!< The name of property of the node to animate ("translation", "rotation", or "scale").
+        } target;
+    };
 
-        // AnimChannel Channels[3];            //!< Connect the output values of the key-frame animation to a specific node in the hierarchy.
-        // AnimParameters Parameters;          //!< The samplers that interpolate between the key-frames.
-        // AnimSampler Samplers[3];            //!< The parameterized inputs representing the key-frame data.
+    struct AnimParameters {
+        Ref<Accessor> TIME; //!< Accessor reference to a buffer storing a array of floating point scalar values.
+        Ref<Accessor> rotation; //!< Accessor reference to a buffer storing a array of four-component floating-point vectors.
+        Ref<Accessor> scale; //!< Accessor reference to a buffer storing a array of three-component floating-point vectors.
+        Ref<Accessor> translation; //!< Accessor reference to a buffer storing a array of three-component floating-point vectors.
+    };
 
-        std::vector<AnimChannel> Channels;            //!< Connect the output values of the key-frame animation to a specific node in the hierarchy.
-        AnimParameters Parameters;                    //!< The samplers that interpolate between the key-frames.
-        std::vector<AnimSampler> Samplers;         //!< The parameterized inputs representing the key-frame data.
+    // AnimChannel Channels[3];            //!< Connect the output values of the key-frame animation to a specific node in the hierarchy.
+    // AnimParameters Parameters;          //!< The samplers that interpolate between the key-frames.
+    // AnimSampler Samplers[3];            //!< The parameterized inputs representing the key-frame data.
 
-        Animation() {}
-        void Read(Value& obj, Asset& r);
-    };
+    std::vector<AnimChannel> Channels; //!< Connect the output values of the key-frame animation to a specific node in the hierarchy.
+    AnimParameters Parameters; //!< The samplers that interpolate between the key-frames.
+    std::vector<AnimSampler> Samplers; //!< The parameterized inputs representing the key-frame data.
 
+    Animation() {}
+    void Read(Value &obj, Asset &r);
+};
 
-    //! Base class for LazyDict that acts as an interface
-    class LazyDictBase
-    {
-    public:
-        virtual ~LazyDictBase() {}
+//! Base class for LazyDict that acts as an interface
+class LazyDictBase {
+public:
+    virtual ~LazyDictBase() {}
 
-        virtual void AttachToDocument(Document& doc) = 0;
-        virtual void DetachFromDocument() = 0;
+    virtual void AttachToDocument(Document &doc) = 0;
+    virtual void DetachFromDocument() = 0;
 
 #if !defined(ASSIMP_BUILD_NO_EXPORT)
-        virtual void WriteObjects(AssetWriter& writer) = 0;
+    virtual void WriteObjects(AssetWriter &writer) = 0;
 #endif
-    };
+};
 
+template <class T>
+class LazyDict;
 
-    template<class T>
-    class LazyDict;
+//! (Implemented in glTFAssetWriter.h)
+template <class T>
+void WriteLazyDict(LazyDict<T> &d, AssetWriter &w);
 
-    //! (Implemented in glTFAssetWriter.h)
-    template<class T>
-    void WriteLazyDict(LazyDict<T>& d, AssetWriter& w);
+//! Manages lazy loading of the glTF top-level objects, and keeps a reference to them by ID
+//! It is the owner the loaded objects, so when it is destroyed it also deletes them
+template <class T>
+class LazyDict : public LazyDictBase {
+    friend class Asset;
+    friend class AssetWriter;
 
+    typedef typename std::gltf_unordered_map<std::string, unsigned int> Dict;
 
-    //! Manages lazy loading of the glTF top-level objects, and keeps a reference to them by ID
-    //! It is the owner the loaded objects, so when it is destroyed it also deletes them
-    template<class T>
-    class LazyDict : public LazyDictBase
-    {
-        friend class Asset;
-        friend class AssetWriter;
+    std::vector<T *> mObjs; //! The read objects
+    Dict mObjsById; //! The read objects accessible by id
+    const char *mDictId; //! ID of the dictionary object
+    const char *mExtId; //! ID of the extension defining the dictionary
+    Value *mDict; //! JSON dictionary object
+    Asset &mAsset; //! The asset instance
 
-        typedef typename std::gltf_unordered_map< std::string, unsigned int > Dict;
-
-        std::vector<T*>  mObjs;      //! The read objects
-        Dict             mObjsById;  //! The read objects accessible by id
-        const char*      mDictId;    //! ID of the dictionary object
-        const char*      mExtId;     //! ID of the extension defining the dictionary
-        Value*           mDict;      //! JSON dictionary object
-        Asset&           mAsset;     //! The asset instance
-
-        void AttachToDocument(Document& doc);
-        void DetachFromDocument();
+    void AttachToDocument(Document &doc);
+    void DetachFromDocument();
 
 #if !defined(ASSIMP_BUILD_NO_EXPORT)
-        void WriteObjects(AssetWriter& writer)
-            { WriteLazyDict<T>(*this, writer); }
+    void WriteObjects(AssetWriter &writer) { WriteLazyDict<T>(*this, writer); }
 #endif
 
-        Ref<T> Add(T* obj);
-
-    public:
-        LazyDict(Asset& asset, const char* dictId, const char* extId = 0);
-        ~LazyDict();
+    Ref<T> Add(T *obj);
 
-        Ref<T> Get(const char* id);
-        Ref<T> Get(unsigned int i);
-        Ref<T> Get(const std::string& pID) { return Get(pID.c_str()); }
+public:
+    LazyDict(Asset &asset, const char *dictId, const char *extId = 0);
+    ~LazyDict();
 
-        Ref<T> Create(const char* id);
-        Ref<T> Create(const std::string& id)
-            { return Create(id.c_str()); }
+    Ref<T> Get(const char *id);
+    Ref<T> Get(unsigned int i);
+    Ref<T> Get(const std::string &pID) { return Get(pID.c_str()); }
 
-        inline unsigned int Size() const
-            { return unsigned(mObjs.size()); }
+    Ref<T> Create(const char *id);
+    Ref<T> Create(const std::string &id) { return Create(id.c_str()); }
 
-        inline T& operator[](size_t i)
-            { return *mObjs[i]; }
+    inline unsigned int Size() const { return unsigned(mObjs.size()); }
 
-    };
+    inline T &operator[](size_t i) { return *mObjs[i]; }
+};
 
+struct AssetMetadata {
+    std::string copyright; //!< A copyright message suitable for display to credit the content creator.
+    std::string generator; //!< Tool that generated this glTF model.Useful for debugging.
+    bool premultipliedAlpha; //!< Specifies if the shaders were generated with premultiplied alpha. (default: false)
 
-    struct AssetMetadata
-    {
-        std::string copyright; //!< A copyright message suitable for display to credit the content creator.
-        std::string generator; //!< Tool that generated this glTF model.Useful for debugging.
-        bool premultipliedAlpha; //!< Specifies if the shaders were generated with premultiplied alpha. (default: false)
+    struct {
+        std::string api; //!< Specifies the target rendering API (default: "WebGL")
+        std::string version; //!< Specifies the target rendering API (default: "1.0.3")
+    } profile; //!< Specifies the target rendering API and version, e.g., WebGL 1.0.3. (default: {})
 
-        struct {
-            std::string api;     //!< Specifies the target rendering API (default: "WebGL")
-            std::string version; //!< Specifies the target rendering API (default: "1.0.3")
-        } profile; //!< Specifies the target rendering API and version, e.g., WebGL 1.0.3. (default: {})
-
-        std::string version; //!< The glTF format version (should be 1.0)
-
-        void Read(Document& doc);
-
-        AssetMetadata()
-            : premultipliedAlpha(false)
-            , version()
-        {
-        }
-    };
+    std::string version; //!< The glTF format version (should be 1.0)
 
-    //
-    // glTF Asset class
-    //
+    void Read(Document &doc);
 
-    //! Root object for a glTF asset
-    class Asset
-    {
-        typedef std::gltf_unordered_map<std::string, int> IdMap;
+    AssetMetadata() :
+            premultipliedAlpha(false), version() {
+    }
+};
 
-        template<class T>
-        friend class LazyDict;
+//
+// glTF Asset class
+//
 
-        friend struct Buffer; // To access OpenFile
+//! Root object for a glTF asset
+class Asset {
+    typedef std::gltf_unordered_map<std::string, int> IdMap;
 
-        friend class AssetWriter;
+    template <class T>
+    friend class LazyDict;
 
-    private:
-        IOSystem* mIOSystem;
+    friend struct Buffer; // To access OpenFile
 
-        std::string mCurrentAssetDir;
+    friend class AssetWriter;
 
-        size_t mSceneLength;
-        size_t mBodyOffset, mBodyLength;
+private:
+    IOSystem *mIOSystem;
 
-        std::vector<LazyDictBase*> mDicts;
+    std::string mCurrentAssetDir;
 
-        IdMap mUsedIds;
+    size_t mSceneLength;
+    size_t mBodyOffset, mBodyLength;
 
-        Ref<Buffer> mBodyBuffer;
+    std::vector<LazyDictBase *> mDicts;
 
-        Asset(Asset&);
-        Asset& operator=(const Asset&);
+    IdMap mUsedIds;
 
-    public:
+    Ref<Buffer> mBodyBuffer;
 
-        //! Keeps info about the enabled extensions
-        struct Extensions
-        {
-            bool KHR_binary_glTF;
-            bool KHR_materials_common;
+    Asset(Asset &);
+    Asset &operator=(const Asset &);
 
-        } extensionsUsed;
+public:
+    //! Keeps info about the enabled extensions
+    struct Extensions {
+        bool KHR_binary_glTF;
+        bool KHR_materials_common;
 
-        AssetMetadata asset;
+    } extensionsUsed;
 
+    AssetMetadata asset;
 
-        // Dictionaries for each type of object
+    // Dictionaries for each type of object
 
-        LazyDict<Accessor>    accessors;
-        LazyDict<Animation>   animations;
-        LazyDict<Buffer>      buffers;
-        LazyDict<BufferView>  bufferViews;
-        LazyDict<Camera>      cameras;
-        LazyDict<Image>       images;
-        LazyDict<Material>    materials;
-        LazyDict<Mesh>        meshes;
-        LazyDict<Node>        nodes;
-        //LazyDict<Program>   programs;
-        LazyDict<Sampler>     samplers;
-        LazyDict<Scene>       scenes;
-        //LazyDict<Shader>    shaders;
-        LazyDict<Skin>      skins;
-        //LazyDict<Technique> techniques;
-        LazyDict<Texture>     textures;
+    LazyDict<Accessor> accessors;
+    LazyDict<Animation> animations;
+    LazyDict<Buffer> buffers;
+    LazyDict<BufferView> bufferViews;
+    LazyDict<Camera> cameras;
+    LazyDict<Image> images;
+    LazyDict<Material> materials;
+    LazyDict<Mesh> meshes;
+    LazyDict<Node> nodes;
+    //LazyDict<Program>   programs;
+    LazyDict<Sampler> samplers;
+    LazyDict<Scene> scenes;
+    //LazyDict<Shader>    shaders;
+    LazyDict<Skin> skins;
+    //LazyDict<Technique> techniques;
+    LazyDict<Texture> textures;
 
-        LazyDict<Light>       lights; // KHR_materials_common ext
+    LazyDict<Light> lights; // KHR_materials_common ext
 
-        Ref<Scene> scene;
+    Ref<Scene> scene;
 
-    public:
-        Asset(IOSystem* io = 0)
-            : mIOSystem(io)
-            , asset()
-            , accessors     (*this, "accessors")
-            , animations    (*this, "animations")
-            , buffers       (*this, "buffers")
-            , bufferViews   (*this, "bufferViews")
-            , cameras       (*this, "cameras")
-            , images        (*this, "images")
-            , materials     (*this, "materials")
-            , meshes        (*this, "meshes")
-            , nodes         (*this, "nodes")
+public:
+    Asset(IOSystem *io = 0) :
+            mIOSystem(io), asset(), accessors(*this, "accessors"), animations(*this, "animations"), buffers(*this, "buffers"), bufferViews(*this, "bufferViews"), cameras(*this, "cameras"), images(*this, "images"), materials(*this, "materials"), meshes(*this, "meshes"), nodes(*this, "nodes")
             //, programs    (*this, "programs")
-            , samplers      (*this, "samplers")
-            , scenes        (*this, "scenes")
+            ,
+            samplers(*this, "samplers"),
+            scenes(*this, "scenes")
             //, shaders     (*this, "shaders")
-            , skins       (*this, "skins")
+            ,
+            skins(*this, "skins")
             //, techniques  (*this, "techniques")
-            , textures      (*this, "textures")
-            , lights        (*this, "lights", "KHR_materials_common")
-        {
-            memset(&extensionsUsed, 0, sizeof(extensionsUsed));
-        }
+            ,
+            textures(*this, "textures"),
+            lights(*this, "lights", "KHR_materials_common") {
+        memset(&extensionsUsed, 0, sizeof(extensionsUsed));
+    }
 
-        //! Main function
-        void Load(const std::string& file, bool isBinary = false);
+    //! Main function
+    void Load(const std::string &file, bool isBinary = false);
 
-        //! Enables the "KHR_binary_glTF" extension on the asset
-        void SetAsBinary();
+    //! Enables the "KHR_binary_glTF" extension on the asset
+    void SetAsBinary();
 
-        //! Search for an available name, starting from the given strings
-        std::string FindUniqueID(const std::string& str, const char* suffix);
+    //! Search for an available name, starting from the given strings
+    std::string FindUniqueID(const std::string &str, const char *suffix);
 
-        Ref<Buffer> GetBodyBuffer()
-            { return mBodyBuffer; }
+    Ref<Buffer> GetBodyBuffer() { return mBodyBuffer; }
 
-    private:
-        void ReadBinaryHeader(IOStream& stream);
+private:
+    void ReadBinaryHeader(IOStream &stream);
 
-        void ReadExtensionsUsed(Document& doc);
+    void ReadExtensionsUsed(Document &doc);
 
-        IOStream *OpenFile(const std::string &path, const char *mode, bool absolute = false);
-    };
+    IOStream *OpenFile(const std::string &path, const char *mode, bool absolute = false);
+};
 
-}
+} // namespace glTF
 
 // Include the implementation of the methods
 #include "glTFAsset.inl"

+ 0 - 119
code/AssetLib/glTF/glTFAsset.inl

@@ -56,130 +56,11 @@ using namespace glTFCommon;
 
 namespace glTF {
 
-namespace {
-
 #if _MSC_VER
 #    pragma warning(push)
 #    pragma warning(disable : 4706)
 #endif // _MSC_VER
 
-//
-// JSON Value reading helpers
-//
-
-template <class T>
-struct ReadHelper {
-    static bool Read(Value &val, T &out) {
-        return val.IsInt() ? out = static_cast<T>(val.GetInt()), true : false;
-    }
-};
-
-template <>
-struct ReadHelper<bool> {
-    static bool Read(Value &val, bool &out) {
-        return val.IsBool() ? out = val.GetBool(), true : false;
-    }
-};
-
-template <>
-struct ReadHelper<float> {
-    static bool Read(Value &val, float &out) {
-        return val.IsNumber() ? out = static_cast<float>(val.GetDouble()), true : false;
-    }
-};
-
-template <unsigned int N>
-struct ReadHelper<float[N]> {
-    static bool Read(Value &val, float (&out)[N]) {
-        if (!val.IsArray() || val.Size() != N) return false;
-        for (unsigned int i = 0; i < N; ++i) {
-            if (val[i].IsNumber())
-                out[i] = static_cast<float>(val[i].GetDouble());
-        }
-        return true;
-    }
-};
-
-template <>
-struct ReadHelper<const char *> {
-    static bool Read(Value &val, const char *&out) {
-        return val.IsString() ? (out = val.GetString(), true) : false;
-    }
-};
-
-template <>
-struct ReadHelper<std::string> {
-    static bool Read(Value &val, std::string &out) {
-        return val.IsString() ? (out = std::string(val.GetString(), val.GetStringLength()), true) : false;
-    }
-};
-
-template <class T>
-struct ReadHelper<Nullable<T>> {
-    static bool Read(Value &val, Nullable<T> &out) {
-        return out.isPresent = ReadHelper<T>::Read(val, out.value);
-    }
-};
-
-template <>
-struct ReadHelper<uint64_t> {
-    static bool Read(Value &val, uint64_t &out) {
-        return val.IsUint64() ? out = val.GetUint64(), true : false;
-    }
-};
-
-template <>
-struct ReadHelper<int64_t> {
-    static bool Read(Value &val, int64_t &out) {
-        return val.IsInt64() ? out = val.GetInt64(), true : false;
-    }
-};
-
-template <class T>
-inline static bool ReadValue(Value &val, T &out) {
-    return ReadHelper<T>::Read(val, out);
-}
-
-template <class T>
-inline static bool ReadMember(Value &obj, const char *id, T &out) {
-    Value::MemberIterator it = obj.FindMember(id);
-    if (it != obj.MemberEnd()) {
-        return ReadHelper<T>::Read(it->value, out);
-    }
-    return false;
-}
-
-template <class T>
-inline static T MemberOrDefault(Value &obj, const char *id, T defaultValue) {
-    T out;
-    return ReadMember(obj, id, out) ? out : defaultValue;
-}
-
-inline Value *FindMember(Value &val, const char *id) {
-    Value::MemberIterator it = val.FindMember(id);
-    return (it != val.MemberEnd()) ? &it->value : 0;
-}
-
-inline Value *FindString(Value &val, const char *id) {
-    Value::MemberIterator it = val.FindMember(id);
-    return (it != val.MemberEnd() && it->value.IsString()) ? &it->value : 0;
-}
-
-inline Value *FindNumber(Value &val, const char *id) {
-    Value::MemberIterator it = val.FindMember(id);
-    return (it != val.MemberEnd() && it->value.IsNumber()) ? &it->value : 0;
-}
-
-inline Value *FindArray(Value &val, const char *id) {
-    Value::MemberIterator it = val.FindMember(id);
-    return (it != val.MemberEnd() && it->value.IsArray()) ? &it->value : 0;
-}
-
-inline Value *FindObject(Value &val, const char *id) {
-    Value::MemberIterator it = val.FindMember(id);
-    return (it != val.MemberEnd() && it->value.IsObject()) ? &it->value : 0;
-}
-} // namespace
 
 //
 // LazyDict methods

+ 299 - 15
code/AssetLib/glTF/glTFCommon.h

@@ -56,33 +56,40 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <rapidjson/error/en.h>
 #include <rapidjson/rapidjson.h>
 
+// clang-format off
+
 #ifdef ASSIMP_API
-#include <assimp/ByteSwapper.h>
-#include <assimp/DefaultIOSystem.h>
-#include <memory>
+#   include <assimp/ByteSwapper.h>
+#   include <assimp/DefaultIOSystem.h>
+#   include <memory>
 #else
-#include <memory>
-#define AI_SWAP4(p)
-#define ai_assert
+#   include <memory>
+#   define AI_SWAP4(p)
+#   define ai_assert
 #endif
 
 #if _MSC_VER > 1500 || (defined __GNUC___)
-#define ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
+#   define ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
 #else
-#define gltf_unordered_map map
+#   define gltf_unordered_map map
 #endif
 
 #ifdef ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
-#include <unordered_map>
-#if defined(_MSC_VER) && _MSC_VER <= 1600
-#define gltf_unordered_map tr1::unordered_map
-#else
-#define gltf_unordered_map unordered_map
-#endif
+#   include <unordered_map>
+#   if defined(_MSC_VER) && _MSC_VER <= 1600
+#       define gltf_unordered_map tr1::unordered_map
+#   else
+#       define gltf_unordered_map unordered_map
+#   endif
 #endif
+// clang-format on
+
 
 namespace glTFCommon {
 
+using rapidjson::Document;
+using rapidjson::Value;
+
 #ifdef ASSIMP_API
 using Assimp::IOStream;
 using Assimp::IOSystem;
@@ -193,7 +200,6 @@ inline void CopyValue(const glTFCommon::mat4 &v, aiMatrix4x4 &o) {
 #endif // _MSC_VER
 
 inline std::string getCurrentAssetDir(const std::string &pFile) {
-    std::string path = pFile;
     int pos = std::max(int(pFile.rfind('/')), int(pFile.rfind('\\')));
     if (pos == int(std::string::npos)) {
         return std::string();
@@ -262,6 +268,284 @@ void EncodeBase64(const uint8_t *in, size_t inLength, std::string &out);
 #define CHECK_EXT(EXT) \
     if (exts.find(#EXT) != exts.end()) extensionsUsed.EXT = true;
 
+
+
+//! Helper struct to represent values that might not be present
+template <class T>
+struct Nullable {
+    T value;
+    bool isPresent;
+
+    Nullable() :
+            isPresent(false) {}
+    Nullable(T &val) :
+            value(val),
+            isPresent(true) {}
+};
+
+//! A reference to one top-level object, which is valid
+//! until the Asset instance is destroyed
+template <class T>
+class Ref {
+    std::vector<T *> *vector;
+    unsigned int index;
+
+public:
+    Ref() :
+            vector(0),
+            index(0) {}
+    Ref(std::vector<T *> &vec, unsigned int idx) :
+            vector(&vec),
+            index(idx) {}
+
+    inline unsigned int GetIndex() const { return index; }
+
+    operator bool() const { return vector != 0; }
+
+    T *operator->() { return (*vector)[index]; }
+
+    T &operator*() { return *((*vector)[index]); }
+};
+
+//
+// JSON Value reading helpers
+//
+
+template <class T>
+struct ReadHelper {
+    static bool Read(Value &val, T &out) {
+        return val.IsInt() ? out = static_cast<T>(val.GetInt()), true : false;
+    }
+};
+
+template <>
+struct ReadHelper<bool> {
+    static bool Read(Value &val, bool &out) {
+        return val.IsBool() ? out = val.GetBool(), true : false;
+    }
+};
+
+template <>
+struct ReadHelper<float> {
+    static bool Read(Value &val, float &out) {
+        return val.IsNumber() ? out = static_cast<float>(val.GetDouble()), true : false;
+    }
+};
+
+template <unsigned int N>
+struct ReadHelper<float[N]> {
+    static bool Read(Value &val, float (&out)[N]) {
+        if (!val.IsArray() || val.Size() != N) return false;
+        for (unsigned int i = 0; i < N; ++i) {
+            if (val[i].IsNumber())
+                out[i] = static_cast<float>(val[i].GetDouble());
+        }
+        return true;
+    }
+};
+
+template <>
+struct ReadHelper<const char *> {
+    static bool Read(Value &val, const char *&out) {
+        return val.IsString() ? (out = val.GetString(), true) : false;
+    }
+};
+
+template <>
+struct ReadHelper<std::string> {
+    static bool Read(Value &val, std::string &out) {
+        return val.IsString() ? (out = std::string(val.GetString(), val.GetStringLength()), true) : false;
+    }
+};
+
+template <class T>
+struct ReadHelper<Nullable<T>> {
+    static bool Read(Value &val, Nullable<T> &out) {
+        return out.isPresent = ReadHelper<T>::Read(val, out.value);
+    }
+};
+
+template <>
+struct ReadHelper<uint64_t> {
+    static bool Read(Value &val, uint64_t &out) {
+        return val.IsUint64() ? out = val.GetUint64(), true : false;
+    }
+};
+
+template <>
+struct ReadHelper<int64_t> {
+    static bool Read(Value &val, int64_t &out) {
+        return val.IsInt64() ? out = val.GetInt64(), true : false;
+    }
+};
+
+template <class T>
+inline static bool ReadValue(Value &val, T &out) {
+    return ReadHelper<T>::Read(val, out);
+}
+
+template <class T>
+inline static bool ReadMember(Value &obj, const char *id, T &out) {
+    if (!obj.IsObject()) {
+        return false;
+    }
+    Value::MemberIterator it = obj.FindMember(id);
+    if (it != obj.MemberEnd()) {
+        return ReadHelper<T>::Read(it->value, out);
+    }
+    return false;
+}
+
+template <class T>
+inline static T MemberOrDefault(Value &obj, const char *id, T defaultValue) {
+    T out;
+    return ReadMember(obj, id, out) ? out : defaultValue;
+}
+
+inline Value *FindMember(Value &val, const char *id) {
+    if (!val.IsObject()) {
+        return nullptr;
+    }
+    Value::MemberIterator it = val.FindMember(id);
+    return (it != val.MemberEnd()) ? &it->value : nullptr;
+}
+
+template <int N>
+inline void throwUnexpectedTypeError(const char (&expectedTypeName)[N], const char *memberId, const char *context, const char *extraContext) {
+    std::string fullContext = context;
+    if (extraContext && (strlen(extraContext) > 0)) {
+        fullContext = fullContext + " (" + extraContext + ")";
+    }
+    throw DeadlyImportError("Member \"", memberId, "\" was not of type \"", expectedTypeName, "\" when reading ", fullContext);
+}
+
+// Look-up functions with type checks. Context and extra context help the user identify the problem if there's an error.
+
+inline Value *FindStringInContext(Value &val, const char *memberId, const char *context, const char *extraContext = nullptr) {
+    if (!val.IsObject()) {
+        return nullptr;
+    }
+    Value::MemberIterator it = val.FindMember(memberId);
+    if (it == val.MemberEnd()) {
+        return nullptr;
+    }
+    if (!it->value.IsString()) {
+        throwUnexpectedTypeError("string", memberId, context, extraContext);
+    }
+    return &it->value;
+}
+
+inline Value *FindNumberInContext(Value &val, const char *memberId, const char *context, const char *extraContext = nullptr) {
+    if (!val.IsObject()) {
+        return nullptr;
+    }
+    Value::MemberIterator it = val.FindMember(memberId);
+    if (it == val.MemberEnd()) {
+        return nullptr;
+    }
+    if (!it->value.IsNumber()) {
+        throwUnexpectedTypeError("number", memberId, context, extraContext);
+    }
+    return &it->value;
+}
+
+inline Value *FindUIntInContext(Value &val, const char *memberId, const char *context, const char *extraContext = nullptr) {
+    if (!val.IsObject()) {
+        return nullptr;
+    }
+    Value::MemberIterator it = val.FindMember(memberId);
+    if (it == val.MemberEnd()) {
+        return nullptr;
+    }
+    if (!it->value.IsUint()) {
+        throwUnexpectedTypeError("uint", memberId, context, extraContext);
+    }
+    return &it->value;
+}
+
+inline Value *FindArrayInContext(Value &val, const char *memberId, const char *context, const char *extraContext = nullptr) {
+    if (!val.IsObject()) {
+        return nullptr;
+    }
+    Value::MemberIterator it = val.FindMember(memberId);
+    if (it == val.MemberEnd()) {
+        return nullptr;
+    }
+    if (!it->value.IsArray()) {
+        throwUnexpectedTypeError("array", memberId, context, extraContext);
+    }
+    return &it->value;
+}
+
+inline Value *FindObjectInContext(Value &val, const char *memberId, const char *context, const char *extraContext = nullptr) {
+    if (!val.IsObject()) {
+        return nullptr;
+    }
+    Value::MemberIterator it = val.FindMember(memberId);
+    if (it == val.MemberEnd()) {
+        return nullptr;
+    }
+    if (!it->value.IsObject()) {
+        throwUnexpectedTypeError("object", memberId, context, extraContext);
+    }
+    return &it->value;
+}
+
+inline Value *FindExtensionInContext(Value &val, const char *extensionId, const char *context, const char *extraContext = nullptr) {
+    if (Value *extensionList = FindObjectInContext(val, "extensions", context, extraContext)) {
+        if (Value *extension = FindObjectInContext(*extensionList, extensionId, context, extraContext)) {
+            return extension;
+        }
+    }
+    return nullptr;
+}
+
+// Overloads when the value is the document.
+
+inline Value *FindString(Document &doc, const char *memberId) {
+    return FindStringInContext(doc, memberId, "the document");
+}
+
+inline Value *FindNumber(Document &doc, const char *memberId) {
+    return FindNumberInContext(doc, memberId, "the document");
+}
+
+inline Value *FindUInt(Document &doc, const char *memberId) {
+    return FindUIntInContext(doc, memberId, "the document");
+}
+
+inline Value *FindArray(Document &val, const char *memberId) {
+    return FindArrayInContext(val, memberId, "the document");
+}
+
+inline Value *FindObject(Document &doc, const char *memberId) {
+    return FindObjectInContext(doc, memberId, "the document");
+}
+
+inline Value *FindExtension(Value &val, const char *extensionId) {
+    return FindExtensionInContext(val, extensionId, "the document");
+}
+
+inline Value *FindString(Value &val, const char *id) {
+    Value::MemberIterator it = val.FindMember(id);
+    return (it != val.MemberEnd() && it->value.IsString()) ? &it->value : 0;
+}
+
+inline Value *FindObject(Value &val, const char *id) {
+    Value::MemberIterator it = val.FindMember(id);
+    return (it != val.MemberEnd() && it->value.IsObject()) ? &it->value : 0;
+}
+
+inline Value *FindArray(Value &val, const char *id) {
+    Value::MemberIterator it = val.FindMember(id);
+    return (it != val.MemberEnd() && it->value.IsArray()) ? &it->value : 0;
+}
+
+inline Value *FindNumber(Value &val, const char *id) {
+    Value::MemberIterator it = val.FindMember(id);
+    return (it != val.MemberEnd() && it->value.IsNumber()) ? &it->value : 0;
+}
+
 } // namespace glTFCommon
 
 #endif // ASSIMP_BUILD_NO_GLTF_IMPORTER

+ 56 - 57
code/AssetLib/glTF/glTFExporter.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -41,78 +40,78 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 /** @file GltfExporter.h
-* Declares the exporter class to write a scene to a gltf/glb file
-*/
+ * Declares the exporter class to write a scene to a gltf/glb file
+ */
+#pragma once
 #ifndef AI_GLTFEXPORTER_H_INC
 #define AI_GLTFEXPORTER_H_INC
 
 #if !defined(ASSIMP_BUILD_NO_GLTF_EXPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_EXPORTER)
 
-#include <assimp/types.h>
 #include <assimp/material.h>
+#include <assimp/types.h>
 
-#include <sstream>
-#include <vector>
 #include <map>
 #include <memory>
+#include <sstream>
+#include <vector>
 
 struct aiScene;
 struct aiNode;
-struct aiMaterial;
 
-namespace glTF
-{
-    template<class T>
-    class Ref;
+namespace glTFCommon {
+template <class T>
+class Ref;
 
-    class Asset;
-    struct TexProperty;
-    struct Node;
 }
 
-namespace Assimp
-{
-    class IOSystem;
-    class IOStream;
-    class ExportProperties;
-
-    // ------------------------------------------------------------------------------------------------
-    /** Helper class to export a given scene to an glTF file. */
-    // ------------------------------------------------------------------------------------------------
-    class glTFExporter
-    {
-    public:
-        /// Constructor for a specific scene to export
-        glTFExporter(const char* filename, IOSystem* pIOSystem, const aiScene* pScene,
-            const ExportProperties* pProperties, bool binary);
-
-    private:
-
-        const char* mFilename;
-        IOSystem* mIOSystem;
-        std::shared_ptr<const aiScene> mScene;
-        const ExportProperties* mProperties;
-
-        std::map<std::string, unsigned int> mTexturesByPath;
-
-        std::shared_ptr<glTF::Asset> mAsset;
-
-        std::vector<unsigned char> mBodyData;
-
-        void WriteBinaryData(IOStream* outfile, std::size_t sceneLength);
-
-        void GetTexSampler(const aiMaterial* mat, glTF::TexProperty& prop);
-        void GetMatColorOrTex(const aiMaterial* mat, glTF::TexProperty& prop, const char* propName, int type, int idx, aiTextureType tt);
-        void ExportMetadata();
-        void ExportMaterials();
-        void ExportMeshes();
-        unsigned int ExportNodeHierarchy(const aiNode* n);
-        unsigned int ExportNode(const aiNode* node, glTF::Ref<glTF::Node>& parent);
-        void ExportScene();
-        void ExportAnimations();
-    };
-
-}
+namespace glTF {
+class Asset;
+struct TexProperty;
+struct Node;
+
+} // namespace glTF
+
+namespace Assimp {
+class IOSystem;
+class IOStream;
+class ExportProperties;
+
+// ------------------------------------------------------------------------------------------------
+/** Helper class to export a given scene to an glTF file. */
+// ------------------------------------------------------------------------------------------------
+class glTFExporter {
+public:
+    /// Constructor for a specific scene to export
+    glTFExporter(const char *filename, IOSystem *pIOSystem, const aiScene *pScene,
+            const ExportProperties *pProperties, bool binary);
+
+private:
+    const char *mFilename;
+    IOSystem *mIOSystem;
+    std::shared_ptr<const aiScene> mScene;
+    const ExportProperties *mProperties;
+
+    std::map<std::string, unsigned int> mTexturesByPath;
+
+    std::shared_ptr<glTF::Asset> mAsset;
+
+    std::vector<unsigned char> mBodyData;
+
+    void WriteBinaryData(IOStream *outfile, std::size_t sceneLength);
+
+    void GetTexSampler(const aiMaterial *mat, glTF::TexProperty &prop);
+    void GetMatColorOrTex(const aiMaterial *mat, glTF::TexProperty &prop, const char *propName, int type, int idx, aiTextureType tt);
+    void ExportMetadata();
+    void ExportMaterials();
+    void ExportMeshes();
+    unsigned int ExportNodeHierarchy(const aiNode *n);
+    unsigned int ExportNode(const aiNode *node, glTFCommon::Ref<glTF::Node> & parent);
+    void ExportScene();
+    void ExportAnimations();
+};
+
+} // namespace Assimp
 
 #endif // ASSIMP_BUILD_NO_GLTF_EXPORTER
 

+ 18 - 21
code/AssetLib/glTF/glTFImporter.h

@@ -39,6 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 ----------------------------------------------------------------------
 */
+#pragma once
 #ifndef AI_GLTFIMPORTER_H_INC
 #define AI_GLTFIMPORTER_H_INC
 
@@ -47,10 +48,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 struct aiNode;
 
-
-namespace glTF
-{
+namespace glTF {
     class Asset;
+
 }
 
 namespace Assimp {
@@ -59,34 +59,31 @@ namespace Assimp {
  * Load the glTF format.
  * https://github.com/KhronosGroup/glTF/tree/master/specification
  */
-class glTFImporter : public BaseImporter{
+class glTFImporter : public BaseImporter {
 public:
     glTFImporter();
-    virtual ~glTFImporter();
-    virtual bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig ) const;
+    ~glTFImporter() override;
+    bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override;
 
 protected:
-    virtual const aiImporterDesc* GetInfo() const;
-    virtual void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler );
+    const aiImporterDesc *GetInfo() const override;
+    void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
 
 private:
+    void ImportEmbeddedTextures(glTF::Asset &a);
+    void ImportMaterials(glTF::Asset &a);
+    void ImportMeshes(glTF::Asset &a);
+    void ImportCameras(glTF::Asset &a);
+    void ImportLights(glTF::Asset &a);
+    void ImportNodes(glTF::Asset &a);
+    void ImportCommonMetadata(glTF::Asset &a);
 
+private:
     std::vector<unsigned int> meshOffsets;
-
     std::vector<int> embeddedTexIdxs;
-
-    aiScene* mScene;
-
-    void ImportEmbeddedTextures(glTF::Asset& a);
-    void ImportMaterials(glTF::Asset& a);
-    void ImportMeshes(glTF::Asset& a);
-    void ImportCameras(glTF::Asset& a);
-    void ImportLights(glTF::Asset& a);
-    void ImportNodes(glTF::Asset& a);
-    void ImportCommonMetadata(glTF::Asset& a);
+    aiScene *mScene;
 };
 
-} // Namespace assimp
+} // namespace Assimp
 
 #endif // AI_GLTFIMPORTER_H_INC
-

+ 29 - 61
code/AssetLib/glTF2/glTF2Asset.h

@@ -65,6 +65,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <string>
 #include <vector>
 
+// clang-format off
 #if (__GNUC__ == 8 && __GNUC_MINOR__ >= 0)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wclass-memaccess"
@@ -75,37 +76,38 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <rapidjson/rapidjson.h>
 
 #if (__GNUC__ == 8 && __GNUC_MINOR__ >= 0)
-#pragma GCC diagnostic pop
+#   pragma GCC diagnostic pop
 #endif
 
 #ifdef ASSIMP_API
-#include <assimp/ByteSwapper.h>
-#include <assimp/DefaultIOSystem.h>
-#include <memory>
+#   include <assimp/ByteSwapper.h>
+#   include <assimp/DefaultIOSystem.h>
+#   include <memory>
 #else
-#include <memory>
-#define AI_SWAP4(p)
-#define ai_assert
+#   include <memory>
+#   define AI_SWAP4(p)
+#   define ai_assert
 #endif
 
 #if _MSC_VER > 1500 || (defined __GNUC___)
-#define ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
+#   define ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
 #else
-#define gltf_unordered_map map
-#define gltf_unordered_set set
+#   define gltf_unordered_map map
+#   define gltf_unordered_set set
 #endif
 
 #ifdef ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
-#include <unordered_map>
-#include <unordered_set>
-#if defined(_MSC_VER) && _MSC_VER <= 1600
-#define gltf_unordered_map tr1::unordered_map
-#define gltf_unordered_set tr1::unordered_set
-#else
-#define gltf_unordered_map unordered_map
-#define gltf_unordered_set unordered_set
-#endif
+#   include <unordered_map>
+#   include <unordered_set>
+#   if defined(_MSC_VER) && _MSC_VER <= 1600
+#       define gltf_unordered_map tr1::unordered_map
+#       define gltf_unordered_set tr1::unordered_set
+#   else
+#      define gltf_unordered_map unordered_map
+#       define gltf_unordered_set unordered_set
+#   endif
 #endif
+// clang-format on
 
 #include <assimp/StringUtils.h>
 
@@ -113,6 +115,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 namespace glTF2 {
 
+using glTFCommon::Nullable;
+using glTFCommon::Ref;
 using glTFCommon::IOStream;
 using glTFCommon::IOSystem;
 using glTFCommon::shared_ptr;
@@ -319,44 +323,9 @@ const AttribType::Info
             { "SCALAR", 1 }, { "VEC2", 2 }, { "VEC3", 3 }, { "VEC4", 4 }, { "MAT2", 4 }, { "MAT3", 9 }, { "MAT4", 16 }
         };
 
-//! A reference to one top-level object, which is valid
-//! until the Asset instance is destroyed
-template <class T>
-class Ref {
-    std::vector<T *> *vector;
-    unsigned int index;
-
-public:
-    Ref() :
-            vector(0),
-            index(0) {}
-    Ref(std::vector<T *> &vec, unsigned int idx) :
-            vector(&vec),
-            index(idx) {}
-
-    inline unsigned int GetIndex() const { return index; }
-
-    operator bool() const { return vector != 0; }
-
-    T *operator->() { return (*vector)[index]; }
-
-    T &operator*() { return *((*vector)[index]); }
-};
-
-//! Helper struct to represent values that might not be present
-template <class T>
-struct Nullable {
-    T value;
-    bool isPresent;
-
-    Nullable() :
-            isPresent(false) {}
-    Nullable(T &val) :
-            value(val),
-            isPresent(true) {}
-};
 
 struct CustomExtension {
+
     //
     // A struct containing custom extension data added to a glTF2 file
     // Has to contain Object, Array, String, Double, Uint64, and Int64 at a minimum
@@ -553,7 +522,7 @@ public:
 
     void MarkAsSpecial() { mIsSpecial = true; }
 
-    bool IsSpecial() const { return mIsSpecial; }
+    bool IsSpecial() const override { return mIsSpecial; }
 
     std::string GetURI() { return std::string(this->id) + ".bin"; }
 
@@ -849,7 +818,7 @@ struct Material : public Object {
 
 //! A set of primitives to be rendered. A node can contain one or more meshes. A node's transform places the mesh in the scene.
 struct Mesh : public Object {
-    typedef std::vector<Ref<Accessor>> AccessorList;
+    using AccessorList = std::vector<Ref<Accessor>>;
 
     struct Primitive {
         PrimitiveMode mode;
@@ -880,7 +849,6 @@ struct Mesh : public Object {
 
     Mesh() {}
 
-    /// \fn void Read(Value& pJSON_Object, Asset& pAsset_Root)
     /// Get mesh data from JSON-object and place them to root asset.
     /// \param [in] pJSON_Object - reference to pJSON-object from which data are read.
     /// \param [out] pAsset_Root - reference to root asset where data will be stored.
@@ -1023,8 +991,8 @@ class LazyDict : public LazyDictBase {
     friend class Asset;
     friend class AssetWriter;
 
-    typedef typename std::gltf_unordered_map<unsigned int, unsigned int> Dict;
-    typedef typename std::gltf_unordered_map<std::string, unsigned int> IdDict;
+    using Dict = typename std::gltf_unordered_map<unsigned int, unsigned int>;
+    using IdDict = typename std::gltf_unordered_map<std::string, unsigned int>;
 
     std::vector<T *> mObjs; //! The read objects
     Dict mObjsByOIndex; //! The read objects accessible by original index
@@ -1087,7 +1055,7 @@ struct AssetMetadata {
 
 //! Root object for a glTF asset
 class Asset {
-    typedef std::gltf_unordered_map<std::string, int> IdMap;
+    using IdMap = std::gltf_unordered_map<std::string, int>;
 
     template <class T>
     friend class LazyDict;

+ 20 - 233
code/AssetLib/glTF2/glTF2Asset.inl

@@ -45,40 +45,43 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <assimp/StringUtils.h>
 #include <assimp/DefaultLogger.hpp>
 
+// clang-format off
 #ifdef ASSIMP_ENABLE_DRACO
 
 // Google draco library headers spew many warnings. Bad Google, no cookie
-#if _MSC_VER
-#pragma warning(push)
-#pragma warning(disable : 4018) // Signed/unsigned mismatch
-#pragma warning(disable : 4804) // Unsafe use of type 'bool'
-#elif defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wsign-compare"
-#elif defined(__GNUC__)
-#pragma GCC diagnostic push
-#if (__GNUC__ > 4)
-#pragma GCC diagnostic ignored "-Wbool-compare"
-#endif
-#pragma GCC diagnostic ignored "-Wsign-compare"
+#   if _MSC_VER
+#       pragma warning(push)
+#       pragma warning(disable : 4018) // Signed/unsigned mismatch
+#       pragma warning(disable : 4804) // Unsafe use of type 'bool'
+#   elif defined(__clang__)
+#       pragma clang diagnostic push
+#       pragma clang diagnostic ignored "-Wsign-compare"
+#   elif defined(__GNUC__)
+#       pragma GCC diagnostic push
+#       if (__GNUC__ > 4)
+#           pragma GCC diagnostic ignored "-Wbool-compare"
+#       endif
+#   pragma GCC diagnostic ignored "-Wsign-compare"
 #endif
 
 #include "draco/compression/decode.h"
 #include "draco/core/decoder_buffer.h"
 
 #if _MSC_VER
-#pragma warning(pop)
+#   pragma warning(pop)
 #elif defined(__clang__)
-#pragma clang diagnostic pop
+#   pragma clang diagnostic pop
 #elif defined(__GNUC__)
-#pragma GCC diagnostic pop
+#   pragma GCC diagnostic pop
 #endif
 #ifndef DRACO_MESH_COMPRESSION_SUPPORTED
-#error glTF: KHR_draco_mesh_compression: draco library must have DRACO_MESH_COMPRESSION_SUPPORTED
+#   error glTF: KHR_draco_mesh_compression: draco library must have DRACO_MESH_COMPRESSION_SUPPORTED
 #endif
 #endif
+// clang-format on
 
 using namespace Assimp;
+using namespace glTFCommon;
 
 namespace glTF2 {
 
@@ -88,222 +91,6 @@ namespace {
 // JSON Value reading helpers
 //
 
-template <class T>
-struct ReadHelper {
-    static bool Read(Value &val, T &out) {
-        return val.IsInt() ? out = static_cast<T>(val.GetInt()), true : false;
-    }
-};
-
-template <>
-struct ReadHelper<bool> {
-    static bool Read(Value &val, bool &out) {
-        return val.IsBool() ? out = val.GetBool(), true : false;
-    }
-};
-
-template <>
-struct ReadHelper<float> {
-    static bool Read(Value &val, float &out) {
-        return val.IsNumber() ? out = static_cast<float>(val.GetDouble()), true : false;
-    }
-};
-
-template <unsigned int N>
-struct ReadHelper<float[N]> {
-    static bool Read(Value &val, float (&out)[N]) {
-        if (!val.IsArray() || val.Size() != N) return false;
-        for (unsigned int i = 0; i < N; ++i) {
-            if (val[i].IsNumber())
-                out[i] = static_cast<float>(val[i].GetDouble());
-        }
-        return true;
-    }
-};
-
-template <>
-struct ReadHelper<const char *> {
-    static bool Read(Value &val, const char *&out) {
-        return val.IsString() ? (out = val.GetString(), true) : false;
-    }
-};
-
-template <>
-struct ReadHelper<std::string> {
-    static bool Read(Value &val, std::string &out) {
-        return val.IsString() ? (out = std::string(val.GetString(), val.GetStringLength()), true) : false;
-    }
-};
-
-template <>
-struct ReadHelper<uint64_t> {
-    static bool Read(Value &val, uint64_t &out) {
-        return val.IsUint64() ? out = val.GetUint64(), true : false;
-    }
-};
-
-template <>
-struct ReadHelper<int64_t> {
-    static bool Read(Value &val, int64_t &out) {
-        return val.IsInt64() ? out = val.GetInt64(), true : false;
-    }
-};
-
-template <class T>
-struct ReadHelper<Nullable<T>> {
-    static bool Read(Value &val, Nullable<T> &out) {
-        return out.isPresent = ReadHelper<T>::Read(val, out.value);
-    }
-};
-
-template <class T>
-inline static bool ReadValue(Value &val, T &out) {
-    return ReadHelper<T>::Read(val, out);
-}
-
-template <class T>
-inline static bool ReadMember(Value &obj, const char *id, T &out) {
-    if (!obj.IsObject()) {
-        return false;
-    }
-    Value::MemberIterator it = obj.FindMember(id);
-    if (it != obj.MemberEnd()) {
-        return ReadHelper<T>::Read(it->value, out);
-    }
-    return false;
-}
-
-template <class T>
-inline static T MemberOrDefault(Value &obj, const char *id, T defaultValue) {
-    T out;
-    return ReadMember(obj, id, out) ? out : defaultValue;
-}
-
-inline Value *FindMember(Value &val, const char *id) {
-    if (!val.IsObject()) {
-        return nullptr;
-    }
-    Value::MemberIterator it = val.FindMember(id);
-    return (it != val.MemberEnd()) ? &it->value : nullptr;
-}
-
-template<int N>
-inline void throwUnexpectedTypeError(const char (&expectedTypeName)[N], const char* memberId, const char* context, const char* extraContext) {
-    std::string fullContext = context;
-    if (extraContext && (strlen(extraContext) > 0))
-    {
-        fullContext = fullContext + " (" + extraContext + ")";
-    }
-    throw DeadlyImportError("Member \"", memberId, "\" was not of type \"", expectedTypeName, "\" when reading ", fullContext);
-}
-
-// Look-up functions with type checks. Context and extra context help the user identify the problem if there's an error.
-
-inline Value *FindStringInContext(Value &val, const char *memberId, const char* context, const char* extraContext = nullptr) {
-    if (!val.IsObject()) {
-        return nullptr;
-    }
-    Value::MemberIterator it = val.FindMember(memberId);
-    if (it == val.MemberEnd()) {
-        return nullptr;
-    }
-    if (!it->value.IsString()) {
-        throwUnexpectedTypeError("string", memberId, context, extraContext);
-    }
-    return &it->value;
-}
-
-inline Value *FindNumberInContext(Value &val, const char *memberId, const char* context, const char* extraContext = nullptr) {
-    if (!val.IsObject()) {
-        return nullptr;
-    }
-    Value::MemberIterator it = val.FindMember(memberId);
-    if (it == val.MemberEnd()) {
-        return nullptr;
-    }
-    if (!it->value.IsNumber()) {
-        throwUnexpectedTypeError("number", memberId, context, extraContext);
-    }
-    return &it->value;
-}
-
-inline Value *FindUIntInContext(Value &val, const char *memberId, const char* context, const char* extraContext = nullptr) {
-    if (!val.IsObject()) {
-        return nullptr;
-    }
-    Value::MemberIterator it = val.FindMember(memberId);
-    if (it == val.MemberEnd()) {
-        return nullptr;
-    }
-    if (!it->value.IsUint()) {
-        throwUnexpectedTypeError("uint", memberId, context, extraContext);
-    }
-    return &it->value;
-}
-
-inline Value *FindArrayInContext(Value &val, const char *memberId, const char* context, const char* extraContext = nullptr) {
-    if (!val.IsObject()) {
-        return nullptr;
-    }
-    Value::MemberIterator it = val.FindMember(memberId);
-    if (it == val.MemberEnd()) {
-        return nullptr;
-    }
-    if (!it->value.IsArray()) {
-        throwUnexpectedTypeError("array", memberId, context, extraContext);
-    }
-    return &it->value;
-}
-
-inline Value *FindObjectInContext(Value &val, const char *memberId, const char* context, const char* extraContext = nullptr) {
-    if (!val.IsObject()) {
-        return nullptr;
-    }
-    Value::MemberIterator it = val.FindMember(memberId);
-    if (it == val.MemberEnd()) {
-        return nullptr;
-    }
-    if (!it->value.IsObject()) {
-        throwUnexpectedTypeError("object", memberId, context, extraContext);
-    }
-    return &it->value;
-}
-
-inline Value *FindExtensionInContext(Value &val, const char *extensionId, const char* context, const char* extraContext = nullptr) {
-    if (Value *extensionList = FindObjectInContext(val, "extensions", context, extraContext)) {
-        if (Value *extension = FindObjectInContext(*extensionList, extensionId, context, extraContext)) {
-            return extension;
-        }
-    }
-    return nullptr;
-}
-
-// Overloads when the value is the document.
-
-inline Value *FindString(Document &doc, const char *memberId) {
-    return FindStringInContext(doc, memberId, "the document");
-}
-
-inline Value *FindNumber(Document &doc, const char *memberId) {
-    return FindNumberInContext(doc, memberId, "the document");
-}
-
-inline Value *FindUInt(Document &doc, const char *memberId) {
-    return FindUIntInContext(doc, memberId, "the document");
-}
-
-inline Value *FindArray(Document &val, const char *memberId) {
-    return FindArrayInContext(val, memberId, "the document");
-}
-
-inline Value *FindObject(Document &doc, const char *memberId) {
-    return FindObjectInContext(doc, memberId, "the document");
-}
-
-inline Value *FindExtension(Value &val, const char *extensionId) {
-    return FindExtensionInContext(val, extensionId, "the document");
-}
-
 inline CustomExtension ReadExtensions(const char *name, Value &obj) {
     CustomExtension ret;
     ret.name = name;

File diff suppressed because it is too large
+ 282 - 293
code/AssetLib/glTF2/glTF2Exporter.cpp


+ 76 - 76
code/AssetLib/glTF2/glTF2Exporter.h

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -48,93 +47,94 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER)
 
-#include <assimp/types.h>
 #include <assimp/material.h>
+#include <assimp/types.h>
 
-#include <sstream>
-#include <vector>
 #include <map>
 #include <memory>
+#include <sstream>
+#include <vector>
 
 struct aiScene;
 struct aiNode;
 struct aiMaterial;
 
-namespace glTF2
-{
-    template<class T>
-    class Ref;
-
-    class Asset;
-    struct TexProperty;
-    struct TextureInfo;
-    struct NormalTextureInfo;
-    struct OcclusionTextureInfo;
-    struct Node;
-    struct Texture;
-    struct PbrSpecularGlossiness;
-    struct MaterialSheen;
-    struct MaterialClearcoat;
-    struct MaterialTransmission;
-
-    // Vec/matrix types, as raw float arrays
-	typedef float (vec2)[2];
-    typedef float (vec3)[3];
-    typedef float (vec4)[4];
-}
-
-namespace Assimp
-{
-    class IOSystem;
-    class IOStream;
-    class ExportProperties;
-
-    // ------------------------------------------------------------------------------------------------
-    /** Helper class to export a given scene to an glTF file. */
-    // ------------------------------------------------------------------------------------------------
-    class glTF2Exporter {
-    public:
-        /// Constructor for a specific scene to export
-        glTF2Exporter(const char* filename, IOSystem* pIOSystem, const aiScene* pScene,
-            const ExportProperties* pProperties, bool binary);
-        ~glTF2Exporter();
-
-    protected:
-        void WriteBinaryData(IOStream* outfile, std::size_t sceneLength);
-        void GetTexSampler(const aiMaterial& mat, glTF2::Ref<glTF2::Texture> texture, aiTextureType tt, unsigned int slot);
-        void GetMatTexProp(const aiMaterial& mat, unsigned int& prop, const char* propName, aiTextureType tt, unsigned int idx);
-        void GetMatTexProp(const aiMaterial& mat, float& prop, const char* propName, aiTextureType tt, unsigned int idx);
-        void GetMatTex(const aiMaterial& mat, glTF2::Ref<glTF2::Texture>& texture, unsigned int &texCoord, aiTextureType tt, unsigned int slot);
-        void GetMatTex(const aiMaterial& mat, glTF2::TextureInfo& prop, aiTextureType tt, unsigned int slot);
-        void GetMatTex(const aiMaterial& mat, glTF2::NormalTextureInfo& prop, aiTextureType tt, unsigned int slot);
-        void GetMatTex(const aiMaterial& mat, glTF2::OcclusionTextureInfo& prop, aiTextureType tt, unsigned int slot);
-        aiReturn GetMatColor(const aiMaterial& mat, glTF2::vec4& prop, const char* propName, int type, int idx) const;
-        aiReturn GetMatColor(const aiMaterial& mat, glTF2::vec3& prop, const char* propName, int type, int idx) const;
-        bool GetMatSpecGloss(const aiMaterial& mat, glTF2::PbrSpecularGlossiness& pbrSG);
-        bool GetMatSheen(const aiMaterial& mat, glTF2::MaterialSheen& sheen);
-        bool GetMatClearcoat(const aiMaterial& mat, glTF2::MaterialClearcoat& clearcoat);
-        bool GetMatTransmission(const aiMaterial& mat, glTF2::MaterialTransmission& transmission);
-        void ExportMetadata();
-        void ExportMaterials();
-        void ExportMeshes();
-        void MergeMeshes();
-        unsigned int ExportNodeHierarchy(const aiNode* n);
-        unsigned int ExportNode(const aiNode* node, glTF2::Ref<glTF2::Node>& parent);
-        void ExportScene();
-        void ExportAnimations();
-
-    private:
-        const char* mFilename;
-        IOSystem* mIOSystem;
-        const aiScene* mScene;
-        const ExportProperties* mProperties;
-        std::map<std::string, unsigned int> mTexturesByPath;
-        std::shared_ptr<glTF2::Asset> mAsset;
-        std::vector<unsigned char> mBodyData;
-    };
+namespace glTFCommon {
+template <class T>
+class Ref;
 
 }
 
+namespace glTF2 {
+class Asset;
+struct TexProperty;
+struct TextureInfo;
+struct NormalTextureInfo;
+struct OcclusionTextureInfo;
+struct Node;
+struct Texture;
+struct PbrSpecularGlossiness;
+struct MaterialSheen;
+struct MaterialClearcoat;
+struct MaterialTransmission;
+
+// Vec/matrix types, as raw float arrays
+typedef float(vec2)[2];
+typedef float(vec3)[3];
+typedef float(vec4)[4];
+} // namespace glTF2
+
+namespace Assimp {
+class IOSystem;
+class IOStream;
+class ExportProperties;
+
+// ------------------------------------------------------------------------------------------------
+/** Helper class to export a given scene to an glTF file. */
+// ------------------------------------------------------------------------------------------------
+class glTF2Exporter {
+public:
+    /// Constructor for a specific scene to export
+    glTF2Exporter(const char *filename, IOSystem *pIOSystem, const aiScene *pScene,
+            const ExportProperties *pProperties, bool binary);
+    ~glTF2Exporter();
+
+protected:
+    void WriteBinaryData(IOStream *outfile, std::size_t sceneLength);
+    void GetTexSampler(const aiMaterial &mat, glTFCommon::Ref<glTF2::Texture> texture, aiTextureType tt, unsigned int slot);
+    void GetMatTexProp(const aiMaterial &mat, unsigned int &prop, const char *propName, aiTextureType tt, unsigned int idx);
+    void GetMatTexProp(const aiMaterial &mat, float &prop, const char *propName, aiTextureType tt, unsigned int idx);
+    void GetMatTex(const aiMaterial &mat, glTFCommon::Ref<glTF2::Texture> &texture, unsigned int &texCoord, aiTextureType tt, unsigned int slot);
+    void GetMatTex(const aiMaterial &mat, glTF2::TextureInfo &prop, aiTextureType tt, unsigned int slot);
+    void GetMatTex(const aiMaterial &mat, glTF2::NormalTextureInfo &prop, aiTextureType tt, unsigned int slot);
+    void GetMatTex(const aiMaterial &mat, glTF2::OcclusionTextureInfo &prop, aiTextureType tt, unsigned int slot);
+    aiReturn GetMatColor(const aiMaterial &mat, glTF2::vec4 &prop, const char *propName, int type, int idx) const;
+    aiReturn GetMatColor(const aiMaterial &mat, glTF2::vec3 &prop, const char *propName, int type, int idx) const;
+    bool GetMatSpecGloss(const aiMaterial &mat, glTF2::PbrSpecularGlossiness &pbrSG);
+    bool GetMatSheen(const aiMaterial &mat, glTF2::MaterialSheen &sheen);
+    bool GetMatClearcoat(const aiMaterial &mat, glTF2::MaterialClearcoat &clearcoat);
+    bool GetMatTransmission(const aiMaterial &mat, glTF2::MaterialTransmission &transmission);
+    void ExportMetadata();
+    void ExportMaterials();
+    void ExportMeshes();
+    void MergeMeshes();
+    unsigned int ExportNodeHierarchy(const aiNode *n);
+    unsigned int ExportNode(const aiNode *node, glTFCommon::Ref<glTF2::Node> &parent);
+    void ExportScene();
+    void ExportAnimations();
+
+private:
+    const char *mFilename;
+    IOSystem *mIOSystem;
+    const aiScene *mScene;
+    const ExportProperties *mProperties;
+    std::map<std::string, unsigned int> mTexturesByPath;
+    std::shared_ptr<glTF2::Asset> mAsset;
+    std::vector<unsigned char> mBodyData;
+};
+
+} // namespace Assimp
+
 #endif // ASSIMP_BUILD_NO_GLTF_IMPORTER
 
 #endif // AI_GLTF2EXPORTER_H_INC

+ 63 - 52
code/AssetLib/glTF2/glTF2Importer.cpp

@@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "AssetLib/glTF2/glTF2Importer.h"
 #include "PostProcessing/MakeVerboseFormat.h"
 #include "AssetLib/glTF2/glTF2Asset.h"
+
 #if !defined(ASSIMP_BUILD_NO_EXPORT)
 #include "AssetLib/glTF2/glTF2AssetWriter.h"
 #endif
@@ -57,6 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <assimp/DefaultLogger.hpp>
 #include <assimp/Importer.hpp>
 #include <assimp/commonMetaData.h>
+#include <assimp/DefaultIOSystem.h>
 
 #include <memory>
 #include <unordered_map>
@@ -141,19 +143,23 @@ static aiTextureMapMode ConvertWrappingMode(SamplerWrap gltfWrapMode) {
     }
 }
 
-inline void SetMaterialColorProperty(Asset & /*r*/, vec4 &prop, aiMaterial *mat, const char *pKey, unsigned int type, unsigned int idx) {
+inline void SetMaterialColorProperty(Asset & /*r*/, vec4 &prop, aiMaterial *mat,
+        const char *pKey, unsigned int type, unsigned int idx) {
     aiColor4D col;
     CopyValue(prop, col);
     mat->AddProperty(&col, 1, pKey, type, idx);
 }
 
-inline void SetMaterialColorProperty(Asset & /*r*/, vec3 &prop, aiMaterial *mat, const char *pKey, unsigned int type, unsigned int idx) {
+inline void SetMaterialColorProperty(Asset & /*r*/, vec3 &prop, aiMaterial *mat,
+        const char *pKey, unsigned int type, unsigned int idx) {
     aiColor4D col;
     glTFCommon::CopyValue(prop, col);
     mat->AddProperty(&col, 1, pKey, type, idx);
 }
 
-inline void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset & /*r*/, glTF2::TextureInfo prop, aiMaterial *mat, aiTextureType texType, unsigned int texSlot = 0) {
+inline void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset & /*r*/,
+        glTF2::TextureInfo prop, aiMaterial *mat, aiTextureType texType,
+        unsigned int texSlot = 0) {
     if (prop.texture && prop.texture->source) {
         aiString uri(prop.texture->source->uri);
 
@@ -218,7 +224,9 @@ inline void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset
     }
 }
 
-inline void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset &r, glTF2::NormalTextureInfo &prop, aiMaterial *mat, aiTextureType texType, unsigned int texSlot = 0) {
+inline void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset &r,
+        NormalTextureInfo &prop, aiMaterial *mat, aiTextureType texType,
+        unsigned int texSlot = 0) {
     SetMaterialTextureProperty(embeddedTexIdxs, r, (glTF2::TextureInfo)prop, mat, texType, texSlot);
 
     if (prop.texture && prop.texture->source) {
@@ -226,7 +234,9 @@ inline void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset
     }
 }
 
-inline void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset &r, glTF2::OcclusionTextureInfo &prop, aiMaterial *mat, aiTextureType texType, unsigned int texSlot = 0) {
+inline void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset &r,
+        OcclusionTextureInfo &prop, aiMaterial *mat, aiTextureType texType,
+        unsigned int texSlot = 0) {
     SetMaterialTextureProperty(embeddedTexIdxs, r, (glTF2::TextureInfo)prop, mat, texType, texSlot);
 
     if (prop.texture && prop.texture->source) {
@@ -338,7 +348,7 @@ static aiMaterial *ImportMaterial(std::vector<int> &embeddedTexIdxs, Asset &r, M
     }
 }
 
-void glTF2Importer::ImportMaterials(glTF2::Asset &r) {
+void glTF2Importer::ImportMaterials(Asset &r) {
     const unsigned int numImportedMaterials = unsigned(r.materials.Size());
     ASSIMP_LOG_DEBUG("Importing ", numImportedMaterials, " materials");
     Material defaultMaterial;
@@ -363,7 +373,8 @@ static inline void SetFaceAndAdvance1(aiFace*& face, unsigned int numVertices, u
     ++face;
 }
 
-static inline void SetFaceAndAdvance2(aiFace*& face, unsigned int numVertices, unsigned int a, unsigned int b) {
+static inline void SetFaceAndAdvance2(aiFace*& face, unsigned int numVertices,
+        unsigned int a, unsigned int b) {
     if ((a >= numVertices) || (b >= numVertices)) {
         return;
     }
@@ -374,7 +385,8 @@ static inline void SetFaceAndAdvance2(aiFace*& face, unsigned int numVertices, u
     ++face;
 }
 
-static inline void SetFaceAndAdvance3(aiFace*& face, unsigned int numVertices, unsigned int a, unsigned int b, unsigned int c) {
+static inline void SetFaceAndAdvance3(aiFace*& face, unsigned int numVertices, unsigned int a,
+        unsigned int b, unsigned int c) {
     if ((a >= numVertices) || (b >= numVertices) || (c >= numVertices)) {
         return;
     }
@@ -401,8 +413,8 @@ static inline bool CheckValidFacesIndices(aiFace *faces, unsigned nFaces, unsign
 #endif // ASSIMP_BUILD_DEBUG
 
 template<typename T>
-aiColor4D* GetVertexColorsForType(glTF2::Ref<glTF2::Accessor> input) {
-    float max = std::numeric_limits<T>::max();
+aiColor4D* GetVertexColorsForType(Ref<Accessor> input) {
+    constexpr float max = std::numeric_limits<T>::max();
     aiColor4t<T>* colors;
     input->ExtractData(colors);
     auto output = new aiColor4D[input->count];
@@ -463,19 +475,19 @@ void glTF2Importer::ImportMeshes(glTF2::Asset &r) {
 
             Mesh::Primitive::Attributes &attr = prim.attributes;
 
-            if (attr.position.size() > 0 && attr.position[0]) {
+            if (!attr.position.empty() && attr.position[0]) {
                 aim->mNumVertices = static_cast<unsigned int>(attr.position[0]->count);
                 attr.position[0]->ExtractData(aim->mVertices);
             }
 
-            if (attr.normal.size() > 0 && attr.normal[0]) {
+            if (!attr.normal.empty() && attr.normal[0]) {
                 if (attr.normal[0]->count != aim->mNumVertices) {
                     DefaultLogger::get()->warn("Normal count in mesh \"", mesh.name, "\" does not match the vertex count, normals ignored.");
                 } else {
                     attr.normal[0]->ExtractData(aim->mNormals);
 
                     // only extract tangents if normals are present
-                    if (attr.tangent.size() > 0 && attr.tangent[0]) {
+                    if (!attr.tangent.empty() && attr.tangent[0]) {
                         if (attr.tangent[0]->count != aim->mNumVertices) {
                             DefaultLogger::get()->warn("Tangent count in mesh \"", mesh.name, "\" does not match the vertex count, tangents ignored.");
                         } else {
@@ -538,7 +550,7 @@ void glTF2Importer::ImportMeshes(glTF2::Asset &r) {
             }
 
             std::vector<Mesh::Primitive::Target> &targets = prim.targets;
-            if (targets.size() > 0) {
+            if (!targets.empty()) {
                 aim->mNumAnimMeshes = (unsigned int)targets.size();
                 aim->mAnimMeshes = new aiAnimMesh *[aim->mNumAnimMeshes];
                 std::fill(aim->mAnimMeshes, aim->mAnimMeshes + aim->mNumAnimMeshes, nullptr);
@@ -797,7 +809,9 @@ void glTF2Importer::ImportMeshes(glTF2::Asset &r) {
 }
 
 void glTF2Importer::ImportCameras(glTF2::Asset &r) {
-    if (!r.cameras.Size()) return;
+    if (!r.cameras.Size()) {
+        return;
+    }
 
     const unsigned int numCameras = r.cameras.Size();
     ASSIMP_LOG_DEBUG("Importing ", numCameras, " cameras");
@@ -897,28 +911,29 @@ void glTF2Importer::ImportLights(glTF2::Asset &r) {
 static void GetNodeTransform(aiMatrix4x4 &matrix, const glTF2::Node &node) {
     if (node.matrix.isPresent) {
         CopyValue(node.matrix.value, matrix);
-    } else {
-        if (node.translation.isPresent) {
-            aiVector3D trans;
-            CopyValue(node.translation.value, trans);
-            aiMatrix4x4 t;
-            aiMatrix4x4::Translation(trans, t);
-            matrix = matrix * t;
-        }
+        return;
+    } 
+
+    if (node.translation.isPresent) {
+        aiVector3D trans;
+        CopyValue(node.translation.value, trans);
+        aiMatrix4x4 t;
+        aiMatrix4x4::Translation(trans, t);
+        matrix = matrix * t;
+    }
 
-        if (node.rotation.isPresent) {
-            aiQuaternion rot;
-            CopyValue(node.rotation.value, rot);
-            matrix = matrix * aiMatrix4x4(rot.GetMatrix());
-        }
+    if (node.rotation.isPresent) {
+        aiQuaternion rot;
+        CopyValue(node.rotation.value, rot);
+        matrix = matrix * aiMatrix4x4(rot.GetMatrix());
+    }
 
-        if (node.scale.isPresent) {
-            aiVector3D scal(1.f);
-            CopyValue(node.scale.value, scal);
-            aiMatrix4x4 s;
-            aiMatrix4x4::Scaling(scal, s);
-            matrix = matrix * s;
-        }
+    if (node.scale.isPresent) {
+        aiVector3D scal(1.f);
+        CopyValue(node.scale.value, scal);
+        aiMatrix4x4 s;
+        aiMatrix4x4::Scaling(scal, s);
+        matrix = matrix * s;
     }
 }
 
@@ -981,21 +996,21 @@ static std::string GetNodeName(const Node &node) {
 
 void ParseExtensions(aiMetadata *metadata, const CustomExtension &extension) {
     if (extension.mStringValue.isPresent) {
-        metadata->Add(extension.name.c_str(), aiString(extension.mStringValue.value));
+        metadata->Add(extension.name, aiString(extension.mStringValue.value));
     } else if (extension.mDoubleValue.isPresent) {
-        metadata->Add(extension.name.c_str(), extension.mDoubleValue.value);
+        metadata->Add(extension.name, extension.mDoubleValue.value);
     } else if (extension.mUint64Value.isPresent) {
-        metadata->Add(extension.name.c_str(), extension.mUint64Value.value);
+        metadata->Add(extension.name, extension.mUint64Value.value);
     } else if (extension.mInt64Value.isPresent) {
-        metadata->Add(extension.name.c_str(), static_cast<int32_t>(extension.mInt64Value.value));
+        metadata->Add(extension.name, static_cast<int32_t>(extension.mInt64Value.value));
     } else if (extension.mBoolValue.isPresent) {
-        metadata->Add(extension.name.c_str(), extension.mBoolValue.value);
+        metadata->Add(extension.name, extension.mBoolValue.value);
     } else if (extension.mValues.isPresent) {
         aiMetadata val;
         for (auto const & subExtension : extension.mValues.value) {
             ParseExtensions(&val, subExtension);
         }
-        metadata->Add(extension.name.c_str(), val);
+        metadata->Add(extension.name, val);
     }
 }
 
@@ -1041,7 +1056,9 @@ aiNode *ImportNode(aiScene *pScene, glTF2::Asset &r, std::vector<unsigned int> &
             // GLTF files contain at most 1 mesh per node.
             if (node.meshes.size() > 1)
             {
-                throw DeadlyImportError("GLTF: Invalid input, found ", node.meshes.size(), " meshes in ", getContextForErrorMessages(node.id, node.name), ", but only 1 mesh per node allowed.");
+                throw DeadlyImportError("GLTF: Invalid input, found ", node.meshes.size(),
+                    " meshes in ", getContextForErrorMessages(node.id, node.name),
+                    ", but only 1 mesh per node allowed.");
             }
             int mesh_idx = node.meshes[0].GetIndex();
             int count = meshOffsets[mesh_idx + 1] - meshOffsets[mesh_idx];
@@ -1284,7 +1301,7 @@ aiNodeAnim *CreateNodeAnim(glTF2::Asset&, Node &node, AnimationSamplers &sampler
 }
 
 aiMeshMorphAnim *CreateMeshMorphAnim(glTF2::Asset&, Node &node, AnimationSamplers &samplers) {
-    aiMeshMorphAnim *anim = new aiMeshMorphAnim();
+    auto *anim = new aiMeshMorphAnim();
 
     try {
         anim->mName = GetNodeName(node);
@@ -1432,7 +1449,7 @@ void glTF2Importer::ImportAnimations(glTF2::Asset &r) {
             }
         }
 
-        // Use the latest keyframe for the duration of the animation
+        // Use the latest key-frame for the duration of the animation
         double maxDuration = 0;
         unsigned int maxNumberOfKeys = 0;
         for (unsigned int j = 0; j < ai_anim->mNumChannels; ++j) {
@@ -1521,11 +1538,9 @@ void glTF2Importer::ImportEmbeddedTextures(glTF2::Asset &r) {
             if (ext) {
                 if (strcmp(ext, "jpeg") == 0) {
                     ext = "jpg";
-                }
-                else if(strcmp(ext, "ktx2") == 0) { //basisu: ktx remains
+                } else if(strcmp(ext, "ktx2") == 0) { //basisu: ktx remains
                     ext = "kx2";
-                }
-                else if(strcmp(ext, "basis") == 0) { //basisu
+                } else if(strcmp(ext, "basis") == 0) { //basisu
                     ext = "bu";
                 }
 
@@ -1563,7 +1578,6 @@ void glTF2Importer::ImportCommonMetadata(glTF2::Asset& a) {
 }
 
 void glTF2Importer::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) {
-
     ASSIMP_LOG_DEBUG("Reading GLTF2 file");
 
     // clean all member arrays
@@ -1579,10 +1593,7 @@ void glTF2Importer::InternReadFile(const std::string &pFile, aiScene *pScene, IO
         pScene->mName = asset.scene->name;
     }
 
-    //
     // Copy the data out
-    //
-
     ImportEmbeddedTextures(asset);
     ImportMaterials(asset);
 

+ 17 - 23
code/AssetLib/glTF2/glTF2Importer.h

@@ -43,13 +43,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define AI_GLTF2IMPORTER_H_INC
 
 #include <assimp/BaseImporter.h>
-#include <assimp/DefaultIOSystem.h>
 
 struct aiNode;
 
-
-namespace glTF2
-{
+namespace glTF2 {
     class Asset;
 }
 
@@ -59,35 +56,32 @@ namespace Assimp {
  * Load the glTF2 format.
  * https://github.com/KhronosGroup/glTF/tree/master/specification
  */
-class glTF2Importer : public BaseImporter{
+class glTF2Importer : public BaseImporter {
 public:
     glTF2Importer();
-    virtual ~glTF2Importer();
-    virtual bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig ) const;
+    ~glTF2Importer() override;
+    bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override;
 
 protected:
-    virtual const aiImporterDesc* GetInfo() const;
-    virtual void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler );
+    const aiImporterDesc *GetInfo() const override;
+    void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
 
 private:
+    void ImportEmbeddedTextures(glTF2::Asset &a);
+    void ImportMaterials(glTF2::Asset &a);
+    void ImportMeshes(glTF2::Asset &a);
+    void ImportCameras(glTF2::Asset &a);
+    void ImportLights(glTF2::Asset &a);
+    void ImportNodes(glTF2::Asset &a);
+    void ImportAnimations(glTF2::Asset &a);
+    void ImportCommonMetadata(glTF2::Asset &a);
 
+private:
     std::vector<unsigned int> meshOffsets;
-
     std::vector<int> embeddedTexIdxs;
-
-    aiScene* mScene;
-
-    void ImportEmbeddedTextures(glTF2::Asset& a);
-    void ImportMaterials(glTF2::Asset& a);
-    void ImportMeshes(glTF2::Asset& a);
-    void ImportCameras(glTF2::Asset& a);
-    void ImportLights(glTF2::Asset& a);
-    void ImportNodes(glTF2::Asset& a);
-    void ImportAnimations(glTF2::Asset& a);
-    void ImportCommonMetadata(glTF2::Asset& a);
+    aiScene *mScene;
 };
 
-} // Namespace assimp
+} // namespace Assimp
 
 #endif // AI_GLTF2IMPORTER_H_INC
-

+ 0 - 1
code/CApi/CInterfaceIOWrapper.cpp

@@ -51,7 +51,6 @@ CIOStreamWrapper::~CIOStreamWrapper() {
     /* Various places depend on this destructor to close the file */
     if (mFile) {
         mIO->mFileSystem->CloseProc(mIO->mFileSystem, mFile);
-        mFile = nullptr;
     }
 }
 

+ 0 - 1
code/CMakeLists.txt

@@ -69,7 +69,6 @@ SET( PUBLIC_HEADERS
   ${HEADER_PATH}/ColladaMetaData.h
   ${HEADER_PATH}/commonMetaData.h
   ${HEADER_PATH}/defs.h
-  ${HEADER_PATH}/Defines.h
   ${HEADER_PATH}/cfileio.h
   ${HEADER_PATH}/light.h
   ${HEADER_PATH}/material.h

+ 29 - 28
code/Common/Bitmap.cpp

@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -54,33 +52,36 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 namespace Assimp {
 
-void Bitmap::Save(aiTexture *texture, IOStream *file) {
-    if (file != nullptr) {
-        Header header;
-        DIB dib;
-
-        dib.size = DIB::dib_size;
-        dib.width = texture->mWidth;
-        dib.height = texture->mHeight;
-        dib.planes = 1;
-        dib.bits_per_pixel = 8 * mBytesPerPixel;
-        dib.compression = 0;
-        dib.image_size = (((dib.width * mBytesPerPixel) + 3) & 0x0000FFFC) * dib.height;
-        dib.x_resolution = 0;
-        dib.y_resolution = 0;
-        dib.nb_colors = 0;
-        dib.nb_important_colors = 0;
-
-        header.type = 0x4D42; // 'BM'
-        header.offset = Header::header_size + DIB::dib_size;
-        header.size = header.offset + dib.image_size;
-        header.reserved1 = 0;
-        header.reserved2 = 0;
-
-        WriteHeader(header, file);
-        WriteDIB(dib, file);
-        WriteData(texture, file);
+bool Bitmap::Save(aiTexture *texture, IOStream *file) {
+    if (file == nullptr) {
+        return false;
     }
+
+    Header header;
+    DIB dib;
+    dib.size = DIB::dib_size;
+    dib.width = texture->mWidth;
+    dib.height = texture->mHeight;
+    dib.planes = 1;
+    dib.bits_per_pixel = 8 * mBytesPerPixel;
+    dib.compression = 0;
+    dib.image_size = (((dib.width * mBytesPerPixel) + 3) & 0x0000FFFC) * dib.height;
+    dib.x_resolution = 0;
+    dib.y_resolution = 0;
+    dib.nb_colors = 0;
+    dib.nb_important_colors = 0;
+
+    header.type = 0x4D42; // 'BM'
+    header.offset = Header::header_size + DIB::dib_size;
+    header.size = header.offset + dib.image_size;
+    header.reserved1 = 0;
+    header.reserved2 = 0;
+
+    WriteHeader(header, file);
+    WriteDIB(dib, file);
+    WriteData(texture, file);
+
+    return true;
 }
 
 template <typename T>

+ 0 - 1
code/Common/DefaultIOStream.cpp

@@ -82,7 +82,6 @@ inline int select_fseek<8>(FILE *file, int64_t offset, int origin) {
 DefaultIOStream::~DefaultIOStream() {
     if (mFile) {
         ::fclose(mFile);
-        mFile = nullptr;
     }
 }
 

+ 0 - 1
code/Common/StandardShapes.cpp

@@ -47,7 +47,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include <assimp/StandardShapes.h>
-#include <assimp/Defines.h>
 #include <assimp/StringComparison.h>
 #include <assimp/mesh.h>
 

+ 0 - 1
code/Common/ZipArchiveIOSystem.cpp

@@ -352,7 +352,6 @@ ZipArchiveIOSystem::Implement::Implement(IOSystem *pIOHandler, const char *pFile
 ZipArchiveIOSystem::Implement::~Implement() {
     if (m_ZipFileHandle != nullptr) {
         unzClose(m_ZipFileHandle);
-        m_ZipFileHandle = nullptr;
     }
 }
 

+ 10 - 4
include/assimp/Bitmap.h

@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -55,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #endif
 
 #include "defs.h"
-#include <stdint.h>
+#include <cstdint>
 #include <cstddef>
 
 struct aiTexture;
@@ -64,6 +62,10 @@ namespace Assimp {
 
 class IOStream;
 
+// ---------------------------------------------------------------------------
+/** 
+ *  This class is used to store and write bitmap information.
+ */
 class ASSIMP_API Bitmap {
 protected:
 
@@ -114,7 +116,11 @@ protected:
     static constexpr std::size_t mBytesPerPixel = 4;
 
 public:
-    static void Save(aiTexture* texture, IOStream* file);
+    /// @brief  Will save an aiTexture instance as a bitmap.
+    /// @param texture  The pointer to the texture instance
+    /// @param file     The filename to save into.
+    /// @return true if successfully saved, false if not.
+    static bool Save(aiTexture* texture, IOStream* file);
 
 protected:
     static void WriteHeader(Header& header, IOStream* file);

+ 44 - 35
include/assimp/BlobIOSystem.h

@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2021, assimp team
 
-
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -44,14 +42,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file Provides cheat implementations for IOSystem and IOStream to
  *  redirect exporter output to a blob chain.*/
 
+#pragma once
 #ifndef AI_BLOBIOSYSTEM_H_INCLUDED
 #define AI_BLOBIOSYSTEM_H_INCLUDED
 
+#ifdef __GNUC__
+#pragma GCC system_header
+#endif
+
 #include <assimp/cexport.h>
-#include <stdint.h>
 #include <assimp/DefaultLogger.hpp>
 #include <assimp/IOStream.hpp>
 #include <assimp/IOSystem.hpp>
+#include <cstdint>
 #include <set>
 #include <vector>
 
@@ -63,6 +66,10 @@ class BlobIOSystem;
 // --------------------------------------------------------------------------------------------
 class BlobIOStream : public IOStream {
 public:
+    /// @brief The class constructor with all needed parameters
+    /// @param creator  Pointer to the creator instance
+    /// @param file     The filename
+    /// @param initial  The initial size
     BlobIOStream(BlobIOSystem *creator, const std::string &file, size_t initial = 4096) :
             buffer(),
             cur_size(),
@@ -74,7 +81,8 @@ public:
         // empty
     }
 
-    virtual ~BlobIOStream();
+    ///	@brief  The class destructor.
+    ~BlobIOStream() override;
 
 public:
     // -------------------------------------------------------------------
@@ -89,16 +97,12 @@ public:
     }
 
     // -------------------------------------------------------------------
-    virtual size_t Read(void *,
-            size_t,
-            size_t) {
+    size_t Read(void *, size_t, size_t) override {
         return 0;
     }
 
     // -------------------------------------------------------------------
-    virtual size_t Write(const void *pvBuffer,
-            size_t pSize,
-            size_t pCount) {
+    size_t Write(const void *pvBuffer, size_t pSize, size_t pCount) override {
         pSize *= pCount;
         if (cursor + pSize > cur_size) {
             Grow(cursor + pSize);
@@ -112,23 +116,22 @@ public:
     }
 
     // -------------------------------------------------------------------
-    virtual aiReturn Seek(size_t pOffset,
-            aiOrigin pOrigin) {
+    aiReturn Seek(size_t pOffset, aiOrigin pOrigin) override {
         switch (pOrigin) {
-        case aiOrigin_CUR:
-            cursor += pOffset;
-            break;
+            case aiOrigin_CUR:
+                cursor += pOffset;
+                break;
 
-        case aiOrigin_END:
-            cursor = file_size - pOffset;
-            break;
+            case aiOrigin_END:
+                cursor = file_size - pOffset;
+                break;
 
-        case aiOrigin_SET:
-            cursor = pOffset;
-            break;
+            case aiOrigin_SET:
+                cursor = pOffset;
+                break;
 
-        default:
-            return AI_FAILURE;
+            default:
+                return AI_FAILURE;
         }
 
         if (cursor > file_size) {
@@ -136,21 +139,22 @@ public:
         }
 
         file_size = std::max(cursor, file_size);
+
         return AI_SUCCESS;
     }
 
     // -------------------------------------------------------------------
-    virtual size_t Tell() const {
+    size_t Tell() const override {
         return cursor;
     }
 
     // -------------------------------------------------------------------
-    virtual size_t FileSize() const {
+    size_t FileSize() const override {
         return file_size;
     }
 
     // -------------------------------------------------------------------
-    virtual void Flush() {
+    void Flush() override {
         // ignore
     }
 
@@ -196,15 +200,19 @@ class BlobIOSystem : public IOSystem {
 
 
 public:
+    /// @brief The default class constructor.
     BlobIOSystem() :
             baseName{AI_BLOBIO_MAGIC} {
     }
 
+    ///	@brief  The class constructor with the base name.
+    /// @param baseName     The base name.
     BlobIOSystem(const std::string &baseName) :
             baseName(baseName) {
+        // empty
     }
 
-    virtual ~BlobIOSystem() {
+    ~BlobIOSystem() override {
         for (BlobEntry &blobby : blobs) {
             delete blobby.second;
         }
@@ -263,18 +271,17 @@ public:
 
 public:
     // -------------------------------------------------------------------
-    virtual bool Exists(const char *pFile) const {
+    bool Exists(const char *pFile) const override {
         return created.find(std::string(pFile)) != created.end();
     }
 
     // -------------------------------------------------------------------
-    virtual char getOsSeparator() const {
+    char getOsSeparator() const override {
         return '/';
     }
 
     // -------------------------------------------------------------------
-    virtual IOStream *Open(const char *pFile,
-            const char *pMode) {
+    IOStream *Open(const char *pFile, const char *pMode) override {
         if (pMode[0] != 'w') {
             return nullptr;
         }
@@ -284,7 +291,7 @@ public:
     }
 
     // -------------------------------------------------------------------
-    virtual void Close(IOStream *pFile) {
+    void Close(IOStream *pFile) override {
         delete pFile;
     }
 
@@ -294,7 +301,7 @@ private:
         // we don't know in which the files are closed, so we
         // can't reliably say that the first must be the master
         // file ...
-        blobs.push_back(BlobEntry(filename, child->GetBlob()));
+        blobs.emplace_back(filename, child->GetBlob());
     }
 
 private:
@@ -304,8 +311,10 @@ private:
 };
 
 // --------------------------------------------------------------------------------------------
-BlobIOStream ::~BlobIOStream() {
-    creator->OnDestruct(file, this);
+BlobIOStream::~BlobIOStream() {
+    if (nullptr != creator) {
+        creator->OnDestruct(file, this);
+    }
     delete[] buffer;
 }
 

Some files were not shown because too many files changed in this diff