diff --git a/CMakeLists.txt b/CMakeLists.txt index 34bcb9663..cd12d3a9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # Open Asset Import Library (assimp) # ---------------------------------------------------------------------- -# Copyright (c) 2006-2021, assimp team +# Copyright (c) 2006-2022, assimp team # # All rights reserved. # @@ -56,7 +56,7 @@ IF(ASSIMP_HUNTER_ENABLED) add_definitions(-DASSIMP_USE_HUNTER) ENDIF() -PROJECT(Assimp VERSION 5.1.3) +PROJECT(Assimp VERSION 5.1.6) # All supported options ############################################### @@ -183,7 +183,9 @@ SET (ASSIMP_SOVERSION 5) SET( ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used for uploading the sources" ) if(NOT ASSIMP_HUNTER_ENABLED) # Enable C++11 support globally - set_property( GLOBAL PROPERTY CXX_STANDARD 11 ) + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_C_STANDARD 99) endif() IF(NOT ASSIMP_IGNORE_GIT_HASH) @@ -244,7 +246,7 @@ IF( UNIX ) ENDIF() # Grouped compiler settings ######################################## -IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW) +IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT MINGW) IF(NOT ASSIMP_HUNTER_ENABLED) SET(CMAKE_CXX_STANDARD 11) SET(CMAKE_POSITION_INDEPENDENT_CODE ON) @@ -281,7 +283,7 @@ ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) ENDIF() SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long ${CMAKE_CXX_FLAGS}" ) SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}") -ELSEIF( CMAKE_COMPILER_IS_MINGW ) +ELSEIF( MINGW ) IF (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) message(FATAL_ERROR "MinGW is too old to be supported. Please update MinGW and try again.") ELSEIF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3) @@ -762,7 +764,7 @@ if(WIN32) IF(MSVC_TOOLSET_VERSION) SET(MSVC_PREFIX "vc${MSVC_TOOLSET_VERSION}") - SET(ASSIMP_MSVC_VERSION ${MCVS_PREFIX}) + SET(ASSIMP_MSVC_VERSION ${MSVC_PREFIX}) ELSE() IF(MSVC12) SET(ASSIMP_MSVC_VERSION "vc120") diff --git a/code/AssetLib/3DS/3DSConverter.cpp b/code/AssetLib/3DS/3DSConverter.cpp index add1553bc..5a01429e4 100644 --- a/code/AssetLib/3DS/3DSConverter.cpp +++ b/code/AssetLib/3DS/3DSConverter.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/3DS/3DSExporter.cpp b/code/AssetLib/3DS/3DSExporter.cpp index ea92fa12c..71588f935 100644 --- a/code/AssetLib/3DS/3DSExporter.cpp +++ b/code/AssetLib/3DS/3DSExporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/3DS/3DSExporter.h b/code/AssetLib/3DS/3DSExporter.h index 8ac3da98c..82ec3512f 100644 --- a/code/AssetLib/3DS/3DSExporter.h +++ b/code/AssetLib/3DS/3DSExporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/3DS/3DSHelper.h b/code/AssetLib/3DS/3DSHelper.h index 3a5479de2..dc1098035 100644 --- a/code/AssetLib/3DS/3DSHelper.h +++ b/code/AssetLib/3DS/3DSHelper.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/3DS/3DSLoader.cpp b/code/AssetLib/3DS/3DSLoader.cpp index 05b5117ba..0ec8b872a 100644 --- a/code/AssetLib/3DS/3DSLoader.cpp +++ b/code/AssetLib/3DS/3DSLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -111,20 +111,9 @@ Discreet3DSImporter::~Discreet3DSImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool Discreet3DSImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - std::string extension = GetExtension(pFile); - if (extension == "3ds" || extension == "prj") { - return true; - } - - if (!extension.length() || checkSig) { - uint16_t token[3]; - token[0] = 0x4d4d; - token[1] = 0x3dc2; - //token[2] = 0x3daa; - return CheckMagicToken(pIOHandler, pFile, token, 2, 0, 2); - } - return false; +bool Discreet3DSImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const uint16_t token[] = { 0x4d4d, 0x3dc2 /*, 0x3daa */ }; + return CheckMagicToken(pIOHandler, pFile, token, AI_COUNT_OF(token), 0, sizeof token[0]); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/3DS/3DSLoader.h b/code/AssetLib/3DS/3DSLoader.h index bd167872f..f47fcfef9 100644 --- a/code/AssetLib/3DS/3DSLoader.h +++ b/code/AssetLib/3DS/3DSLoader.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/3MF/3MFTypes.h b/code/AssetLib/3MF/3MFTypes.h index c4e9e4243..987cdf613 100644 --- a/code/AssetLib/3MF/3MFTypes.h +++ b/code/AssetLib/3MF/3MFTypes.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/3MF/3MFXmlTags.h b/code/AssetLib/3MF/3MFXmlTags.h index a6e9758c1..63f18b455 100644 --- a/code/AssetLib/3MF/3MFXmlTags.h +++ b/code/AssetLib/3MF/3MFXmlTags.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/3MF/D3MFExporter.cpp b/code/AssetLib/3MF/D3MFExporter.cpp index 76a601cbe..42cd991e6 100644 --- a/code/AssetLib/3MF/D3MFExporter.cpp +++ b/code/AssetLib/3MF/D3MFExporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/3MF/D3MFExporter.h b/code/AssetLib/3MF/D3MFExporter.h index df25e305e..680d54f91 100644 --- a/code/AssetLib/3MF/D3MFExporter.h +++ b/code/AssetLib/3MF/D3MFExporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/3MF/D3MFImporter.cpp b/code/AssetLib/3MF/D3MFImporter.cpp index 58dde9738..5b0f34c3a 100644 --- a/code/AssetLib/3MF/D3MFImporter.cpp +++ b/code/AssetLib/3MF/D3MFImporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -90,24 +90,12 @@ D3MFImporter::~D3MFImporter() { // empty } -bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool checkSig) const { - const std::string extension(GetExtension(filename)); - if (extension == desc.mFileExtensions) { - return true; - } - - if (!extension.length() || checkSig) { - if (nullptr == pIOHandler) { - return false; - } - if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) { - return false; - } - D3MFOpcPackage opcPackage(pIOHandler, filename); - return opcPackage.validate(); +bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool /*checkSig*/) const { + if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) { + return false; } - - return false; + D3MF::D3MFOpcPackage opcPackage(pIOHandler, filename); + return opcPackage.validate(); } void D3MFImporter::SetupProperties(const Importer*) { diff --git a/code/AssetLib/3MF/D3MFImporter.h b/code/AssetLib/3MF/D3MFImporter.h index 7219fa39d..a39ae790f 100644 --- a/code/AssetLib/3MF/D3MFImporter.h +++ b/code/AssetLib/3MF/D3MFImporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/3MF/D3MFOpcPackage.cpp b/code/AssetLib/3MF/D3MFOpcPackage.cpp index 8d51a7417..f88039ae8 100644 --- a/code/AssetLib/3MF/D3MFOpcPackage.cpp +++ b/code/AssetLib/3MF/D3MFOpcPackage.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/3MF/D3MFOpcPackage.h b/code/AssetLib/3MF/D3MFOpcPackage.h index 27bf44ff2..f6803a0ef 100644 --- a/code/AssetLib/3MF/D3MFOpcPackage.h +++ b/code/AssetLib/3MF/D3MFOpcPackage.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/3MF/XmlSerializer.cpp b/code/AssetLib/3MF/XmlSerializer.cpp index 985286fa7..9bd1c5bb0 100644 --- a/code/AssetLib/3MF/XmlSerializer.cpp +++ b/code/AssetLib/3MF/XmlSerializer.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/3MF/XmlSerializer.h b/code/AssetLib/3MF/XmlSerializer.h index 14da82e99..6cf6a70a9 100644 --- a/code/AssetLib/3MF/XmlSerializer.h +++ b/code/AssetLib/3MF/XmlSerializer.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/AC/ACLoader.cpp b/code/AssetLib/AC/ACLoader.cpp index 078c96e32..e93624b3e 100644 --- a/code/AssetLib/AC/ACLoader.cpp +++ b/code/AssetLib/AC/ACLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -152,18 +152,9 @@ AC3DImporter::~AC3DImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool AC3DImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - std::string extension = GetExtension(pFile); - - // fixme: are acc and ac3d *really* used? Some sources say they are - if (extension == "ac" || extension == "ac3d" || extension == "acc") { - return true; - } - if (!extension.length() || checkSig) { - uint32_t token = AI_MAKE_MAGIC("AC3D"); - return CheckMagicToken(pIOHandler, pFile, &token, 1, 0); - } - return false; +bool AC3DImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const uint32_t tokens[] = { AI_MAKE_MAGIC("AC3D") }; + return CheckMagicToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/AC/ACLoader.h b/code/AssetLib/AC/ACLoader.h index 5b706a4a0..aabc114e3 100644 --- a/code/AssetLib/AC/ACLoader.h +++ b/code/AssetLib/AC/ACLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/AMF/AMFImporter.cpp b/code/AssetLib/AMF/AMFImporter.cpp index 9a9ab94ca..4103dcdf4 100644 --- a/code/AssetLib/AMF/AMFImporter.cpp +++ b/code/AssetLib/AMF/AMFImporter.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -503,19 +503,9 @@ void AMFImporter::ParseNode_Metadata(XmlNode &node) { mNodeElement_List.push_back(ne); // and to node element list because its a new object in graph. } -bool AMFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool pCheckSig) const { - const std::string extension = GetExtension(pFile); - - if (extension == "amf") { - return true; - } - - if (extension.empty() || pCheckSig) { - static const char * const tokens[] = { "= iMaterialCount) { - LogWarning("Out of range: material index is too large"); + LogError("Out of range: material index is too large"); iIndex = iMaterialCount - 1; + return; } // get a reference to the material diff --git a/code/AssetLib/ASE/ASEParser.h b/code/AssetLib/ASE/ASEParser.h index f49cfc36f..5c24fffd1 100644 --- a/code/AssetLib/ASE/ASEParser.h +++ b/code/AssetLib/ASE/ASEParser.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Assbin/AssbinExporter.cpp b/code/AssetLib/Assbin/AssbinExporter.cpp index 7f58e2cf4..149b3c5f3 100644 --- a/code/AssetLib/Assbin/AssbinExporter.cpp +++ b/code/AssetLib/Assbin/AssbinExporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Assbin/AssbinExporter.h b/code/AssetLib/Assbin/AssbinExporter.h index b6f2acd3d..1801c1680 100644 --- a/code/AssetLib/Assbin/AssbinExporter.h +++ b/code/AssetLib/Assbin/AssbinExporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Assbin/AssbinFileWriter.cpp b/code/AssetLib/Assbin/AssbinFileWriter.cpp index 21bfd8512..72fbfdcb1 100644 --- a/code/AssetLib/Assbin/AssbinFileWriter.cpp +++ b/code/AssetLib/Assbin/AssbinFileWriter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Assbin/AssbinFileWriter.h b/code/AssetLib/Assbin/AssbinFileWriter.h index 7b1d1e304..cfed3b400 100644 --- a/code/AssetLib/Assbin/AssbinFileWriter.h +++ b/code/AssetLib/Assbin/AssbinFileWriter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Assbin/AssbinLoader.cpp b/code/AssetLib/Assbin/AssbinLoader.cpp index 5ca4b3e11..060ce4377 100644 --- a/code/AssetLib/Assbin/AssbinLoader.cpp +++ b/code/AssetLib/Assbin/AssbinLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Assbin/AssbinLoader.h b/code/AssetLib/Assbin/AssbinLoader.h index 47f38db2a..f922b91fd 100644 --- a/code/AssetLib/Assbin/AssbinLoader.h +++ b/code/AssetLib/Assbin/AssbinLoader.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Assxml/AssxmlExporter.cpp b/code/AssetLib/Assxml/AssxmlExporter.cpp index d244813b1..731916a25 100644 --- a/code/AssetLib/Assxml/AssxmlExporter.cpp +++ b/code/AssetLib/Assxml/AssxmlExporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Assxml/AssxmlExporter.h b/code/AssetLib/Assxml/AssxmlExporter.h index 9a3d1f9d5..6fcdebfab 100644 --- a/code/AssetLib/Assxml/AssxmlExporter.h +++ b/code/AssetLib/Assxml/AssxmlExporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Assxml/AssxmlFileWriter.cpp b/code/AssetLib/Assxml/AssxmlFileWriter.cpp index 80c2db908..640890ea1 100644 --- a/code/AssetLib/Assxml/AssxmlFileWriter.cpp +++ b/code/AssetLib/Assxml/AssxmlFileWriter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Assxml/AssxmlFileWriter.h b/code/AssetLib/Assxml/AssxmlFileWriter.h index 125869d1a..0620c9db7 100644 --- a/code/AssetLib/Assxml/AssxmlFileWriter.h +++ b/code/AssetLib/Assxml/AssxmlFileWriter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/B3D/B3DImporter.cpp b/code/AssetLib/B3D/B3DImporter.cpp index 11f7bcd14..c4ef75be3 100644 --- a/code/AssetLib/B3D/B3DImporter.cpp +++ b/code/AssetLib/B3D/B3DImporter.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -81,7 +81,7 @@ static const aiImporterDesc desc = { //#define DEBUG_B3D -template +template void DeleteAllBarePointers(std::vector &x) { for (auto p : x) { delete p; @@ -89,11 +89,11 @@ void DeleteAllBarePointers(std::vector &x) { } B3DImporter::~B3DImporter() { + // empty } // ------------------------------------------------------------------------------------------------ bool B3DImporter::CanRead(const std::string &pFile, IOSystem * /*pIOHandler*/, bool /*checkSig*/) const { - size_t pos = pFile.find_last_of('.'); if (pos == string::npos) { return false; diff --git a/code/AssetLib/B3D/B3DImporter.h b/code/AssetLib/B3D/B3DImporter.h index bb535afd1..e47d9078b 100644 --- a/code/AssetLib/B3D/B3DImporter.h +++ b/code/AssetLib/B3D/B3DImporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/BVH/BVHLoader.cpp b/code/AssetLib/BVH/BVHLoader.cpp index 6dc824e2f..174836847 100644 --- a/code/AssetLib/BVH/BVHLoader.cpp +++ b/code/AssetLib/BVH/BVHLoader.cpp @@ -4,7 +4,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team @@ -92,18 +92,9 @@ BVHLoader::~BVHLoader() {} // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool BVHLoader::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool cs) const { - // check file extension - const std::string extension = GetExtension(pFile); - - if (extension == "bvh") - return true; - - if ((!extension.length() || cs) && pIOHandler) { - static const char * const tokens[] = { "HIERARCHY" }; - return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1); - } - return false; +bool BVHLoader::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const char *tokens[] = { "HIERARCHY" }; + return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/BVH/BVHLoader.h b/code/AssetLib/BVH/BVHLoader.h index 70511483d..56c32bd99 100644 --- a/code/AssetLib/BVH/BVHLoader.h +++ b/code/AssetLib/BVH/BVHLoader.h @@ -4,7 +4,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Blender/BlenderBMesh.cpp b/code/AssetLib/Blender/BlenderBMesh.cpp index ecacd1c7d..be536ebdb 100644 --- a/code/AssetLib/Blender/BlenderBMesh.cpp +++ b/code/AssetLib/Blender/BlenderBMesh.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. Redistribution and use of this software in source and binary forms, diff --git a/code/AssetLib/Blender/BlenderBMesh.h b/code/AssetLib/Blender/BlenderBMesh.h index df695cbbf..45ca2c806 100644 --- a/code/AssetLib/Blender/BlenderBMesh.h +++ b/code/AssetLib/Blender/BlenderBMesh.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. Redistribution and use of this software in source and binary forms, diff --git a/code/AssetLib/Blender/BlenderDNA.cpp b/code/AssetLib/Blender/BlenderDNA.cpp index 3da0dce31..2910904ba 100644 --- a/code/AssetLib/Blender/BlenderDNA.cpp +++ b/code/AssetLib/Blender/BlenderDNA.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Blender/BlenderDNA.h b/code/AssetLib/Blender/BlenderDNA.h index 871ee71a1..b2158f283 100644 --- a/code/AssetLib/Blender/BlenderDNA.h +++ b/code/AssetLib/Blender/BlenderDNA.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Blender/BlenderDNA.inl b/code/AssetLib/Blender/BlenderDNA.inl index a46532057..4f64987a5 100644 --- a/code/AssetLib/Blender/BlenderDNA.inl +++ b/code/AssetLib/Blender/BlenderDNA.inl @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Blender/BlenderIntermediate.h b/code/AssetLib/Blender/BlenderIntermediate.h index 68c42f5d6..0651f7117 100644 --- a/code/AssetLib/Blender/BlenderIntermediate.h +++ b/code/AssetLib/Blender/BlenderIntermediate.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Blender/BlenderLoader.cpp b/code/AssetLib/Blender/BlenderLoader.cpp index 04c911757..3d9e8017b 100644 --- a/code/AssetLib/Blender/BlenderLoader.cpp +++ b/code/AssetLib/Blender/BlenderLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -114,22 +114,14 @@ BlenderImporter::~BlenderImporter() { } static const char * const Tokens[] = { "BLENDER" }; -static const char * const TokensForSearch[] = { "blender" }; // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool BlenderImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - const std::string &extension = GetExtension(pFile); - if (extension == "blend") { - return true; - } +bool BlenderImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + // note: this won't catch compressed files + static const char *tokens[] = { " @@ -885,4 +885,7 @@ void DNA::RegisterConverters() { converters["CollectionObject"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); } +} // namespace Blender +} //namespace Assimp + #endif // ASSIMP_BUILD_NO_BLEND_IMPORTER diff --git a/code/AssetLib/Blender/BlenderScene.h b/code/AssetLib/Blender/BlenderScene.h index ebc6a27e6..c153d3c22 100644 --- a/code/AssetLib/Blender/BlenderScene.h +++ b/code/AssetLib/Blender/BlenderScene.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Blender/BlenderTessellator.cpp b/code/AssetLib/Blender/BlenderTessellator.cpp index acf26e1b2..d3d463ece 100644 --- a/code/AssetLib/Blender/BlenderTessellator.cpp +++ b/code/AssetLib/Blender/BlenderTessellator.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Blender/BlenderTessellator.h b/code/AssetLib/Blender/BlenderTessellator.h index 115bb9bcb..0d0ba320e 100644 --- a/code/AssetLib/Blender/BlenderTessellator.h +++ b/code/AssetLib/Blender/BlenderTessellator.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/C4D/C4DImporter.cpp b/code/AssetLib/C4D/C4DImporter.cpp index 14a94958b..06d7a3412 100644 --- a/code/AssetLib/C4D/C4DImporter.cpp +++ b/code/AssetLib/C4D/C4DImporter.cpp @@ -106,14 +106,25 @@ static const aiImporterDesc desc = { // ------------------------------------------------------------------------------------------------ -bool C4DImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const { +C4DImporter::C4DImporter() +: BaseImporter() { + // empty +} + +// ------------------------------------------------------------------------------------------------ +C4DImporter::~C4DImporter() { + // empty +} + +// ------------------------------------------------------------------------------------------------ +bool C4DImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, bool /*checkSig*/) const { const std::string& extension = GetExtension(pFile); if (extension == "c4d") { return true; } else if ((!extension.length() || checkSig) && pIOHandler) { // TODO } - + return false; } diff --git a/code/AssetLib/COB/COBLoader.cpp b/code/AssetLib/COB/COBLoader.cpp index 647f49052..1c8310061 100644 --- a/code/AssetLib/COB/COBLoader.cpp +++ b/code/AssetLib/COB/COBLoader.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -103,17 +103,9 @@ COBImporter::~COBImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool COBImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - const std::string &extension = GetExtension(pFile); - if (extension == "cob" || extension == "scn" || extension == "COB" || extension == "SCN") { - return true; - } - - else if ((!extension.length() || checkSig) && pIOHandler) { - static const char * const tokens[] = { "Caligary" }; - return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1); - } - return false; +bool COBImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const char *tokens[] = { "Caligary" }; + return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/COB/COBLoader.h b/code/AssetLib/COB/COBLoader.h index 3b6f67070..e6eb96dc1 100644 --- a/code/AssetLib/COB/COBLoader.h +++ b/code/AssetLib/COB/COBLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/COB/COBScene.h b/code/AssetLib/COB/COBScene.h index d2ce11dd5..57620ca51 100644 --- a/code/AssetLib/COB/COBScene.h +++ b/code/AssetLib/COB/COBScene.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/CSM/CSMLoader.cpp b/code/AssetLib/CSM/CSMLoader.cpp index 1c2de33d3..681f8602d 100644 --- a/code/AssetLib/CSM/CSMLoader.cpp +++ b/code/AssetLib/CSM/CSMLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team @@ -90,19 +90,10 @@ CSMImporter::~CSMImporter() // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool CSMImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const +bool CSMImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool /*checkSig*/) const { - // check file extension - const std::string extension = GetExtension(pFile); - - if( extension == "csm") - return true; - - if ((checkSig || !extension.length()) && pIOHandler) { - static const char * const tokens[] = {"$Filename"}; - return SearchFileHeaderForToken(pIOHandler,pFile,tokens,1); - } - return false; + static const char* tokens[] = {"$Filename"}; + return SearchFileHeaderForToken(pIOHandler,pFile,tokens,AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/CSM/CSMLoader.h b/code/AssetLib/CSM/CSMLoader.h index e30d8fc5b..e9c4cd5ee 100644 --- a/code/AssetLib/CSM/CSMLoader.h +++ b/code/AssetLib/CSM/CSMLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Collada/ColladaExporter.cpp b/code/AssetLib/Collada/ColladaExporter.cpp index 2b2064ef5..5c91daa1a 100644 --- a/code/AssetLib/Collada/ColladaExporter.cpp +++ b/code/AssetLib/Collada/ColladaExporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Collada/ColladaExporter.h b/code/AssetLib/Collada/ColladaExporter.h index b046e966e..56415fba7 100644 --- a/code/AssetLib/Collada/ColladaExporter.h +++ b/code/AssetLib/Collada/ColladaExporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Collada/ColladaHelper.cpp b/code/AssetLib/Collada/ColladaHelper.cpp index 0677a41f7..0fb172fbb 100644 --- a/code/AssetLib/Collada/ColladaHelper.cpp +++ b/code/AssetLib/Collada/ColladaHelper.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Collada/ColladaHelper.h b/code/AssetLib/Collada/ColladaHelper.h index c95a13d2f..31d7b5ae5 100644 --- a/code/AssetLib/Collada/ColladaHelper.h +++ b/code/AssetLib/Collada/ColladaHelper.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Collada/ColladaLoader.cpp b/code/AssetLib/Collada/ColladaLoader.cpp index 6f40c1a78..447055082 100644 --- a/code/AssetLib/Collada/ColladaLoader.cpp +++ b/code/AssetLib/Collada/ColladaLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -116,37 +116,15 @@ ColladaLoader::~ColladaLoader() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool ColladaLoader::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - // check file extension - const std::string extension = GetExtension(pFile); - const bool readSig = checkSig && (pIOHandler != nullptr); - if (!readSig) { - if (extension == "dae" || extension == "zae") { - return true; - } - } else { - // Look for a DAE file inside, but don't extract it - ZipArchiveIOSystem zip_archive(pIOHandler, pFile); - if (zip_archive.isOpen()) { - return !ColladaParser::ReadZaeManifest(zip_archive).empty(); - } +bool ColladaLoader::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + // Look for a DAE file inside, but don't extract it + ZipArchiveIOSystem zip_archive(pIOHandler, pFile); + if (zip_archive.isOpen()) { + return !ColladaParser::ReadZaeManifest(zip_archive).empty(); } - // XML - too generic, we need to open the file and search for typical keywords - if (extension == "xml" || !extension.length() || checkSig) { - // If CanRead() is called in order to check whether we - // support a specific file extension in general pIOHandler - // might be nullptr and it's our duty to return true here. - if (nullptr == pIOHandler) { - return true; - } - static const char * const tokens[] = { - "(tUnitSizeString.data(), mUnitSize); + } catch (const DeadlyImportError& die) { + std::string warning("Collada: Failed to parse meter parameter to real number. Exception:\n"); + warning.append(die.what()); + ASSIMP_LOG_WARN(warning.data()); + } + } } else if (currentName == "up_axis") { std::string v; if (!XmlParser::getValueAsString(currentNode, v)) { @@ -2242,20 +2251,26 @@ void ColladaParser::ReadNodeGeometry(XmlNode &node, Node *pNode) { if (currentName == "bind_material") { XmlNode techNode = currentNode.child("technique_common"); if (techNode) { - XmlNode instanceMatNode = techNode.child("instance_material"); - // read ID of the geometry subgroup and the target material - std::string group; - XmlParser::getStdStrAttribute(instanceMatNode, "symbol", group); - XmlParser::getStdStrAttribute(instanceMatNode, "target", url); - const char *urlMat = url.c_str(); - Collada::SemanticMappingTable s; - if (urlMat[0] == '#') - urlMat++; + for (XmlNode instanceMatNode = techNode.child("instance_material"); instanceMatNode; instanceMatNode = instanceMatNode.next_sibling()) + { + const std::string &instance_name = instanceMatNode.name(); + if (instance_name == "instance_material") + { + // read ID of the geometry subgroup and the target material + std::string group; + XmlParser::getStdStrAttribute(instanceMatNode, "symbol", group); + XmlParser::getStdStrAttribute(instanceMatNode, "target", url); + const char *urlMat = url.c_str(); + Collada::SemanticMappingTable s; + if (urlMat[0] == '#') + urlMat++; - s.mMatName = urlMat; - // store the association - instance.mMaterials[group] = s; - ReadMaterialVertexInputBinding(instanceMatNode, s); + s.mMatName = urlMat; + // store the association + instance.mMaterials[group] = s; + ReadMaterialVertexInputBinding(instanceMatNode, s); + } + } } } } diff --git a/code/AssetLib/Collada/ColladaParser.h b/code/AssetLib/Collada/ColladaParser.h index 73e836b32..15982934f 100644 --- a/code/AssetLib/Collada/ColladaParser.h +++ b/code/AssetLib/Collada/ColladaParser.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- - Copyright (c) 2006-2021, assimp team + Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/DXF/DXFHelper.h b/code/AssetLib/DXF/DXFHelper.h index c7e75c3b1..e50c471d2 100644 --- a/code/AssetLib/DXF/DXFHelper.h +++ b/code/AssetLib/DXF/DXFHelper.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/DXF/DXFLoader.cpp b/code/AssetLib/DXF/DXFLoader.cpp index 3b20678ad..6b2dbbe82 100644 --- a/code/AssetLib/DXF/DXFLoader.cpp +++ b/code/AssetLib/DXF/DXFLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -123,18 +123,9 @@ DXFImporter::~DXFImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool DXFImporter::CanRead( const std::string& filename, IOSystem* pIOHandler, bool checkSig ) const { - const std::string& extension = GetExtension( filename ); - if ( extension == desc.mFileExtensions ) { - return true; - } - - if ( extension.empty() || checkSig ) { - static const char * const pTokens[] = { "SECTION", "HEADER", "ENDSEC", "BLOCKS" }; - return SearchFileHeaderForToken(pIOHandler, filename, pTokens, 4, 32 ); - } - - return false; +bool DXFImporter::CanRead( const std::string& filename, IOSystem* pIOHandler, bool /*checkSig*/ ) const { + static const char *tokens[] = { "SECTION", "HEADER", "ENDSEC", "BLOCKS" }; + return SearchFileHeaderForToken(pIOHandler, filename, tokens, AI_COUNT_OF(tokens), 32); } // ------------------------------------------------------------------------------------------------ @@ -378,6 +369,11 @@ void DXFImporter::ExpandBlockReferences(DXF::Block& bl,const DXF::BlockMap& bloc const DXF::Block& bl_src = *(*it).second; for (std::shared_ptr pl_in : bl_src.lines) { + if (!pl_in) { + ASSIMP_LOG_ERROR("DXF: PolyLine instance is nullptr, skipping."); + continue; + } + std::shared_ptr pl_out = std::shared_ptr(new DXF::PolyLine(*pl_in)); if (bl_src.base.Length() || insert.scale.x!=1.f || insert.scale.y!=1.f || insert.scale.z!=1.f || insert.angle || insert.pos.Length()) { diff --git a/code/AssetLib/DXF/DXFLoader.h b/code/AssetLib/DXF/DXFLoader.h index 2aace91b2..b32ae106f 100644 --- a/code/AssetLib/DXF/DXFLoader.h +++ b/code/AssetLib/DXF/DXFLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXAnimation.cpp b/code/AssetLib/FBX/FBXAnimation.cpp index 0fdc3517a..2fa3b7b05 100644 --- a/code/AssetLib/FBX/FBXAnimation.cpp +++ b/code/AssetLib/FBX/FBXAnimation.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXBinaryTokenizer.cpp b/code/AssetLib/FBX/FBXBinaryTokenizer.cpp index 348812054..1a4d11856 100644 --- a/code/AssetLib/FBX/FBXBinaryTokenizer.cpp +++ b/code/AssetLib/FBX/FBXBinaryTokenizer.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXCommon.h b/code/AssetLib/FBX/FBXCommon.h index 5ce6a7d15..54e2e9e50 100644 --- a/code/AssetLib/FBX/FBXCommon.h +++ b/code/AssetLib/FBX/FBXCommon.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXCompileConfig.h b/code/AssetLib/FBX/FBXCompileConfig.h index 49860b844..75787d303 100644 --- a/code/AssetLib/FBX/FBXCompileConfig.h +++ b/code/AssetLib/FBX/FBXCompileConfig.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXConverter.cpp b/code/AssetLib/FBX/FBXConverter.cpp index 098ba58e2..3cefed023 100644 --- a/code/AssetLib/FBX/FBXConverter.cpp +++ b/code/AssetLib/FBX/FBXConverter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -79,7 +79,7 @@ using namespace Util; #define MAGIC_NODE_TAG "_$AssimpFbx$" -#define CONVERT_FBX_TIME(time) (static_cast(time) * 1000.0 / 46186158000LL) +#define CONVERT_FBX_TIME(time) static_cast(time) / 46186158000LL FBXConverter::FBXConverter(aiScene *out, const Document &doc, bool removeEmptyBones) : defaultMaterialIndex(), @@ -2070,6 +2070,7 @@ void FBXConverter::SetTextureProperties(aiMaterial *out_mat, const LayeredTextur TrySetTextureProperties(out_mat, layeredTextures, "ShininessExponent", aiTextureType_SHININESS, mesh); TrySetTextureProperties(out_mat, layeredTextures, "EmissiveFactor", aiTextureType_EMISSIVE, mesh); TrySetTextureProperties(out_mat, layeredTextures, "TransparencyFactor", aiTextureType_OPACITY, mesh); + TrySetTextureProperties(out_mat, layeredTextures, "ReflectionFactor", aiTextureType_METALNESS, mesh); } aiColor3D FBXConverter::GetColorPropertyFactored(const PropertyTable &props, const std::string &colorName, @@ -2618,7 +2619,7 @@ void FBXConverter::ConvertAnimationStack(const AnimationStack &st) { meshMorphAnim->mKeys[j].mNumValuesAndWeights = numValuesAndWeights; meshMorphAnim->mKeys[j].mValues = new unsigned int[numValuesAndWeights]; meshMorphAnim->mKeys[j].mWeights = new double[numValuesAndWeights]; - meshMorphAnim->mKeys[j].mTime = CONVERT_FBX_TIME(animIt.first); + meshMorphAnim->mKeys[j].mTime = CONVERT_FBX_TIME(animIt.first) * anim_fps; for (unsigned int k = 0; k < numValuesAndWeights; k++) { meshMorphAnim->mKeys[j].mValues[k] = keyData->values.at(k); meshMorphAnim->mKeys[j].mWeights[k] = keyData->weights.at(k); @@ -2636,8 +2637,8 @@ void FBXConverter::ConvertAnimationStack(const AnimationStack &st) { return; } - double start_time_fps = has_local_startstop ? CONVERT_FBX_TIME(start_time) : min_time; - double stop_time_fps = has_local_startstop ? CONVERT_FBX_TIME(stop_time) : max_time; + double start_time_fps = has_local_startstop ? (CONVERT_FBX_TIME(start_time) * anim_fps) : min_time; + double stop_time_fps = has_local_startstop ? (CONVERT_FBX_TIME(stop_time) * anim_fps) : max_time; // adjust relative timing for animation for (unsigned int c = 0; c < anim->mNumChannels; c++) { @@ -3162,7 +3163,7 @@ aiNodeAnim* FBXConverter::GenerateSimpleNodeAnim(const std::string& name, InterpolateKeys(outTranslations, keytimes, keyframeLists[TransformationComp_Translation], defTranslate, maxTime, minTime); } else { for (size_t i = 0; i < keyCount; ++i) { - outTranslations[i].mTime = CONVERT_FBX_TIME(keytimes[i]); + outTranslations[i].mTime = CONVERT_FBX_TIME(keytimes[i]) * anim_fps; outTranslations[i].mValue = defTranslate; } } @@ -3171,7 +3172,7 @@ aiNodeAnim* FBXConverter::GenerateSimpleNodeAnim(const std::string& name, InterpolateKeys(outRotations, keytimes, keyframeLists[TransformationComp_Rotation], defRotation, maxTime, minTime, rotOrder); } else { for (size_t i = 0; i < keyCount; ++i) { - outRotations[i].mTime = CONVERT_FBX_TIME(keytimes[i]); + outRotations[i].mTime = CONVERT_FBX_TIME(keytimes[i]) * anim_fps; outRotations[i].mValue = defQuat; } } @@ -3180,7 +3181,7 @@ aiNodeAnim* FBXConverter::GenerateSimpleNodeAnim(const std::string& name, InterpolateKeys(outScales, keytimes, keyframeLists[TransformationComp_Scaling], defScale, maxTime, minTime); } else { for (size_t i = 0; i < keyCount; ++i) { - outScales[i].mTime = CONVERT_FBX_TIME(keytimes[i]); + outScales[i].mTime = CONVERT_FBX_TIME(keytimes[i]) * anim_fps; outScales[i].mValue = defScale; } } @@ -3442,7 +3443,7 @@ void FBXConverter::InterpolateKeys(aiVectorKey *valOut, const KeyTimeList &keys, } // magic value to convert fbx times to seconds - valOut->mTime = CONVERT_FBX_TIME(time); + valOut->mTime = CONVERT_FBX_TIME(time) * anim_fps; min_time = std::min(min_time, valOut->mTime); max_time = std::max(max_time, valOut->mTime); diff --git a/code/AssetLib/FBX/FBXConverter.h b/code/AssetLib/FBX/FBXConverter.h index 20aaa4435..becfdb3e8 100644 --- a/code/AssetLib/FBX/FBXConverter.h +++ b/code/AssetLib/FBX/FBXConverter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXDeformer.cpp b/code/AssetLib/FBX/FBXDeformer.cpp index d26807184..ba245ed6d 100644 --- a/code/AssetLib/FBX/FBXDeformer.cpp +++ b/code/AssetLib/FBX/FBXDeformer.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXDocument.cpp b/code/AssetLib/FBX/FBXDocument.cpp index 8e0439e18..f228b1749 100644 --- a/code/AssetLib/FBX/FBXDocument.cpp +++ b/code/AssetLib/FBX/FBXDocument.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXDocument.h b/code/AssetLib/FBX/FBXDocument.h index eeb173cd0..bac7e7769 100644 --- a/code/AssetLib/FBX/FBXDocument.h +++ b/code/AssetLib/FBX/FBXDocument.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXDocumentUtil.cpp b/code/AssetLib/FBX/FBXDocumentUtil.cpp index ab15298a8..68185e564 100644 --- a/code/AssetLib/FBX/FBXDocumentUtil.cpp +++ b/code/AssetLib/FBX/FBXDocumentUtil.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXExportNode.cpp b/code/AssetLib/FBX/FBXExportNode.cpp index 817308ec8..21c61b257 100644 --- a/code/AssetLib/FBX/FBXExportNode.cpp +++ b/code/AssetLib/FBX/FBXExportNode.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXExportNode.h b/code/AssetLib/FBX/FBXExportNode.h index 3aca98939..c6c4549d5 100644 --- a/code/AssetLib/FBX/FBXExportNode.h +++ b/code/AssetLib/FBX/FBXExportNode.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXExportProperty.cpp b/code/AssetLib/FBX/FBXExportProperty.cpp index 1e88042c6..3216d7d85 100644 --- a/code/AssetLib/FBX/FBXExportProperty.cpp +++ b/code/AssetLib/FBX/FBXExportProperty.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXExportProperty.h b/code/AssetLib/FBX/FBXExportProperty.h index 16fb0f144..26d0cf223 100644 --- a/code/AssetLib/FBX/FBXExportProperty.h +++ b/code/AssetLib/FBX/FBXExportProperty.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXExporter.cpp b/code/AssetLib/FBX/FBXExporter.cpp index 66e14c75c..695672883 100644 --- a/code/AssetLib/FBX/FBXExporter.cpp +++ b/code/AssetLib/FBX/FBXExporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXExporter.h b/code/AssetLib/FBX/FBXExporter.h index d249b7bee..659f9368a 100644 --- a/code/AssetLib/FBX/FBXExporter.h +++ b/code/AssetLib/FBX/FBXExporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXImportSettings.h b/code/AssetLib/FBX/FBXImportSettings.h index bd1c8bddc..90e64bf04 100644 --- a/code/AssetLib/FBX/FBXImportSettings.h +++ b/code/AssetLib/FBX/FBXImportSettings.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXImporter.cpp b/code/AssetLib/FBX/FBXImporter.cpp index 2416b9a2f..0f63acc8f 100644 --- a/code/AssetLib/FBX/FBXImporter.cpp +++ b/code/AssetLib/FBX/FBXImporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -100,18 +100,10 @@ FBXImporter::~FBXImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool FBXImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - const std::string &extension = GetExtension(pFile); - if (extension == std::string(desc.mFileExtensions)) { - return true; - } - - else if ((!extension.length() || checkSig) && pIOHandler) { - // at least ASCII-FBX files usually have a 'FBX' somewhere in their head - static const char * const tokens[] = { "fbx" }; - return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1); - } - return false; +bool FBXImporter::CanRead(const std::string & pFile, IOSystem * pIOHandler, bool /*checkSig*/) const { + // at least ASCII-FBX files usually have a 'FBX' somewhere in their head + static const char *tokens[] = { "fbx" }; + return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/FBX/FBXImporter.h b/code/AssetLib/FBX/FBXImporter.h index 2d01f5434..a212efe11 100644 --- a/code/AssetLib/FBX/FBXImporter.h +++ b/code/AssetLib/FBX/FBXImporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXMaterial.cpp b/code/AssetLib/FBX/FBXMaterial.cpp index 7eb047177..8849179f3 100644 --- a/code/AssetLib/FBX/FBXMaterial.cpp +++ b/code/AssetLib/FBX/FBXMaterial.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXMeshGeometry.cpp b/code/AssetLib/FBX/FBXMeshGeometry.cpp index 6aeebcbe3..1f92fa1a7 100644 --- a/code/AssetLib/FBX/FBXMeshGeometry.cpp +++ b/code/AssetLib/FBX/FBXMeshGeometry.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXMeshGeometry.h b/code/AssetLib/FBX/FBXMeshGeometry.h index 862693b4b..3cca38aa5 100644 --- a/code/AssetLib/FBX/FBXMeshGeometry.h +++ b/code/AssetLib/FBX/FBXMeshGeometry.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXModel.cpp b/code/AssetLib/FBX/FBXModel.cpp index 7d08ff312..9fe4cd5f8 100644 --- a/code/AssetLib/FBX/FBXModel.cpp +++ b/code/AssetLib/FBX/FBXModel.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXNodeAttribute.cpp b/code/AssetLib/FBX/FBXNodeAttribute.cpp index 6f6869d6a..a144f417a 100644 --- a/code/AssetLib/FBX/FBXNodeAttribute.cpp +++ b/code/AssetLib/FBX/FBXNodeAttribute.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXParser.cpp b/code/AssetLib/FBX/FBXParser.cpp index 582940363..ef26f5322 100644 --- a/code/AssetLib/FBX/FBXParser.cpp +++ b/code/AssetLib/FBX/FBXParser.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXParser.h b/code/AssetLib/FBX/FBXParser.h index db1e41f3d..314481e42 100644 --- a/code/AssetLib/FBX/FBXParser.h +++ b/code/AssetLib/FBX/FBXParser.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXProperties.cpp b/code/AssetLib/FBX/FBXProperties.cpp index c3f4de260..7803c27ff 100644 --- a/code/AssetLib/FBX/FBXProperties.cpp +++ b/code/AssetLib/FBX/FBXProperties.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXProperties.h b/code/AssetLib/FBX/FBXProperties.h index d1d6b87ab..18816117a 100644 --- a/code/AssetLib/FBX/FBXProperties.h +++ b/code/AssetLib/FBX/FBXProperties.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXTokenizer.cpp b/code/AssetLib/FBX/FBXTokenizer.cpp index 24971d18c..8698abac6 100644 --- a/code/AssetLib/FBX/FBXTokenizer.cpp +++ b/code/AssetLib/FBX/FBXTokenizer.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXTokenizer.h b/code/AssetLib/FBX/FBXTokenizer.h index 6d528970a..877950945 100644 --- a/code/AssetLib/FBX/FBXTokenizer.h +++ b/code/AssetLib/FBX/FBXTokenizer.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXUtil.cpp b/code/AssetLib/FBX/FBXUtil.cpp index 3fe791b97..ac465d6e9 100644 --- a/code/AssetLib/FBX/FBXUtil.cpp +++ b/code/AssetLib/FBX/FBXUtil.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/FBX/FBXUtil.h b/code/AssetLib/FBX/FBXUtil.h index a4a1a9ec2..0e0bb75be 100644 --- a/code/AssetLib/FBX/FBXUtil.h +++ b/code/AssetLib/FBX/FBXUtil.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/HMP/HMPFileData.h b/code/AssetLib/HMP/HMPFileData.h index 48b01e782..b297136ba 100644 --- a/code/AssetLib/HMP/HMPFileData.h +++ b/code/AssetLib/HMP/HMPFileData.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/HMP/HMPLoader.cpp b/code/AssetLib/HMP/HMPLoader.cpp index 661e4d1b2..93d69dbcd 100644 --- a/code/AssetLib/HMP/HMPLoader.cpp +++ b/code/AssetLib/HMP/HMPLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -84,20 +84,13 @@ HMPImporter::~HMPImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool HMPImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool cs) const { - const std::string extension = GetExtension(pFile); - if (extension == "hmp") - return true; - - // if check for extension is not enough, check for the magic tokens - if (!extension.length() || cs) { - uint32_t tokens[3]; - tokens[0] = AI_HMP_MAGIC_NUMBER_LE_4; - tokens[1] = AI_HMP_MAGIC_NUMBER_LE_5; - tokens[2] = AI_HMP_MAGIC_NUMBER_LE_7; - return CheckMagicToken(pIOHandler, pFile, tokens, 3, 0); - } - return false; +bool HMPImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const uint32_t tokens[] = { + AI_HMP_MAGIC_NUMBER_LE_4, + AI_HMP_MAGIC_NUMBER_LE_5, + AI_HMP_MAGIC_NUMBER_LE_7 + }; + return CheckMagicToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ @@ -473,16 +466,22 @@ void HMPImporter::ReadFirstSkin(unsigned int iNumSkins, const unsigned char *szC // ------------------------------------------------------------------------------------------------ // Generate proepr texture coords -void HMPImporter::GenerateTextureCoords( - const unsigned int width, const unsigned int height) { +void HMPImporter::GenerateTextureCoords(const unsigned int width, const unsigned int height) { ai_assert(nullptr != pScene->mMeshes); ai_assert(nullptr != pScene->mMeshes[0]); ai_assert(nullptr != pScene->mMeshes[0]->mTextureCoords[0]); aiVector3D *uv = pScene->mMeshes[0]->mTextureCoords[0]; - - const float fY = (1.0f / height) + (1.0f / height) / (height - 1); - const float fX = (1.0f / width) + (1.0f / width) / (width - 1); + if (uv == nullptr) { + return; + } + + if (height == 0.0f || width == 0.0) { + return; + } + + const float fY = (1.0f / height) + (1.0f / height) / height; + const float fX = (1.0f / width) + (1.0f / width) / width; for (unsigned int y = 0; y < height; ++y) { for (unsigned int x = 0; x < width; ++x, ++uv) { diff --git a/code/AssetLib/HMP/HMPLoader.h b/code/AssetLib/HMP/HMPLoader.h index c78f7ea5a..95ce0a9eb 100644 --- a/code/AssetLib/HMP/HMPLoader.h +++ b/code/AssetLib/HMP/HMPLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/HMP/HalfLifeFileData.h b/code/AssetLib/HMP/HalfLifeFileData.h index 125195646..f47862b7a 100644 --- a/code/AssetLib/HMP/HalfLifeFileData.h +++ b/code/AssetLib/HMP/HalfLifeFileData.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/IFC/IFCBoolean.cpp b/code/AssetLib/IFC/IFCBoolean.cpp index 08173472d..ee255e612 100644 --- a/code/AssetLib/IFC/IFCBoolean.cpp +++ b/code/AssetLib/IFC/IFCBoolean.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. Redistribution and use of this software in source and binary forms, @@ -699,7 +699,7 @@ void ProcessBooleanExtrudedAreaSolidDifference(const Schema_2x3::IfcExtrudedArea continue; } - GenerateOpenings(openings, std::vector(1, IfcVector3(1, 0, 0)), temp, false, true); + GenerateOpenings(openings, temp, false, true); result.Append(temp); vit += pcount; diff --git a/code/AssetLib/IFC/IFCCurve.cpp b/code/AssetLib/IFC/IFCCurve.cpp index 3ded43bc0..19732ef25 100644 --- a/code/AssetLib/IFC/IFCCurve.cpp +++ b/code/AssetLib/IFC/IFCCurve.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/IFC/IFCGeometry.cpp b/code/AssetLib/IFC/IFCGeometry.cpp index e70c760d8..4c088955f 100644 --- a/code/AssetLib/IFC/IFCGeometry.cpp +++ b/code/AssetLib/IFC/IFCGeometry.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. Redistribution and use of this software in source and binary forms, @@ -190,7 +190,7 @@ void ProcessPolygonBoundaries(TempMesh& result, const TempMesh& inmesh, size_t m std::copy(outer_vit, outer_vit+outer_polygon_size, std::back_inserter(temp.mVerts)); - GenerateOpenings(fake_openings, normals, temp, false, false); + GenerateOpenings(fake_openings, temp, false, false); result.Append(temp); } @@ -529,6 +529,31 @@ IfcMatrix3 DerivePlaneCoordinateSpace(const TempMesh& curmesh, bool& ok, IfcVect return m; } +const auto closeDistance = 1e-6; + +bool areClose(Schema_2x3::IfcCartesianPoint pt1,Schema_2x3::IfcCartesianPoint pt2) { + if(pt1.Coordinates.size() != pt2.Coordinates.size()) + { + IFCImporter::LogWarn("unable to compare differently-dimensioned points"); + return false; + } + auto coord1 = pt1.Coordinates.begin(); + auto coord2 = pt2.Coordinates.begin(); + // we're just testing each dimension separately rather than doing euclidean distance, as we're + // looking for very close coordinates + for(; coord1 != pt1.Coordinates.end(); coord1++,coord2++) + { + if(std::fabs(*coord1 - *coord2) > closeDistance) + return false; + } + return true; +} + +bool areClose(IfcVector3 pt1,IfcVector3 pt2) { + return (std::fabs(pt1.x - pt2.x) < closeDistance && + std::fabs(pt1.y - pt2.y) < closeDistance && + std::fabs(pt1.z - pt2.z) < closeDistance); +} // Extrudes the given polygon along the direction, converts it into an opening or applies all openings as necessary. void ProcessExtrudedArea(const Schema_2x3::IfcExtrudedAreaSolid& solid, const TempMesh& curve, const IfcVector3& extrusionDir, TempMesh& result, ConversionData &conv, bool collect_openings) @@ -592,7 +617,21 @@ void ProcessExtrudedArea(const Schema_2x3::IfcExtrudedAreaSolid& solid, const Te nors.push_back(IfcVector3()); continue; } - nors.push_back(((bounds.mVerts[2] - bounds.mVerts[0]) ^ (bounds.mVerts[1] - bounds.mVerts[0])).Normalize()); + auto nor = ((bounds.mVerts[2] - bounds.mVerts[0]) ^ (bounds.mVerts[1] - bounds.mVerts[0])).Normalize(); + auto vI0 = bounds.mVertcnt[0]; + for(size_t faceI = 0; faceI < bounds.mVertcnt.size(); faceI++) + { + if(bounds.mVertcnt[faceI] >= 3) { + // do a check that this is at least parallel to the base plane + auto nor2 = ((bounds.mVerts[vI0 + 2] - bounds.mVerts[vI0]) ^ (bounds.mVerts[vI0 + 1] - bounds.mVerts[vI0])).Normalize(); + if(!areClose(nor,nor2)) { + std::stringstream msg; + msg << "Face " << faceI << " is not parallel with face 0 - opening on entity " << solid.GetID(); + IFCImporter::LogWarn(msg.str().c_str()); + } + } + } + nors.push_back(nor); } } @@ -613,7 +652,7 @@ void ProcessExtrudedArea(const Schema_2x3::IfcExtrudedAreaSolid& solid, const Te out.push_back(in[i] + dir); if( openings ) { - if( (in[i] - in[next]).Length() > diag * 0.1 && GenerateOpenings(*conv.apply_openings, nors, temp, true, true, dir) ) { + if( (in[i] - in[next]).Length() > diag * 0.1 && GenerateOpenings(*conv.apply_openings, temp, true, true, dir) ) { ++sides_with_openings; } @@ -622,31 +661,33 @@ void ProcessExtrudedArea(const Schema_2x3::IfcExtrudedAreaSolid& solid, const Te } } - if( openings ) { + if(openings) { for(TempOpening& opening : *conv.apply_openings) { - if( !opening.wallPoints.empty() ) { - IFCImporter::LogError("failed to generate all window caps"); + if(!opening.wallPoints.empty()) { + std::stringstream msg; + msg << "failed to generate all window caps on ID " << (int)solid.GetID(); + IFCImporter::LogError(msg.str().c_str()); } opening.wallPoints.clear(); } } size_t sides_with_v_openings = 0; - if( has_area ) { + if(has_area) { - for( size_t n = 0; n < 2; ++n ) { - if( n > 0 ) { - for( size_t i = 0; i < in.size(); ++i ) + for(size_t n = 0; n < 2; ++n) { + if(n > 0) { + for(size_t i = 0; i < in.size(); ++i) out.push_back(in[i] + dir); } else { - for( size_t i = in.size(); i--; ) + for(size_t i = in.size(); i--; ) out.push_back(in[i]); } curmesh.mVertcnt.push_back(static_cast(in.size())); - if( openings && in.size() > 2 ) { - if( GenerateOpenings(*conv.apply_openings, nors, temp, true, true, dir) ) { + if(openings && in.size() > 2) { + if(GenerateOpenings(*conv.apply_openings,temp,true,true,dir)) { ++sides_with_v_openings; } @@ -656,8 +697,10 @@ void ProcessExtrudedArea(const Schema_2x3::IfcExtrudedAreaSolid& solid, const Te } } - if( openings && (sides_with_openings == 1 || sides_with_v_openings == 2 ) ) { - IFCImporter::LogWarn("failed to resolve all openings, presumably their topology is not supported by Assimp"); + if (openings && (sides_with_openings == 1 || sides_with_v_openings == 2)) { + std::stringstream msg; + msg << "failed to resolve all openings, presumably their topology is not supported by Assimp - ID " << solid.GetID() << " sides_with_openings " << sides_with_openings << " sides_with_v_openings " << sides_with_v_openings; + IFCImporter::LogWarn(msg.str().c_str()); } IFCImporter::LogVerboseDebug("generate mesh procedurally by extrusion (IfcExtrudedAreaSolid)"); @@ -781,7 +824,9 @@ bool ProcessGeometricItem(const Schema_2x3::IfcRepresentationItem& geo, unsigned return false; } else { - IFCImporter::LogWarn("skipping unknown IfcGeometricRepresentationItem entity, type is ", geo.GetClassName()); + std::stringstream toLog; + toLog << "skipping unknown IfcGeometricRepresentationItem entity, type is " << geo.GetClassName() << " id is " << geo.GetID(); + IFCImporter::LogWarn(toLog.str().c_str()); return false; } diff --git a/code/AssetLib/IFC/IFCLoader.cpp b/code/AssetLib/IFC/IFCLoader.cpp index 220a1be06..0c20686f4 100644 --- a/code/AssetLib/IFC/IFCLoader.cpp +++ b/code/AssetLib/IFC/IFCLoader.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -129,18 +129,12 @@ IFCImporter::~IFCImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool IFCImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - const std::string &extension = GetExtension(pFile); - if (extension == "ifc" || extension == "ifczip") { - return true; - } else if ((!extension.length() || checkSig) && pIOHandler) { - // note: this is the common identification for STEP-encoded files, so - // it is only unambiguous as long as we don't support any further - // file formats with STEP as their encoding. - static const char * const tokens[] = { "ISO-10303-21" }; - return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1); - } - return false; +bool IFCImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + // note: this is the common identification for STEP-encoded files, so + // it is only unambiguous as long as we don't support any further + // file formats with STEP as their encoding. + static const char *tokens[] = { "ISO-10303-21" }; + return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/IFC/IFCLoader.h b/code/AssetLib/IFC/IFCLoader.h index a5c22387e..7b2c3aae6 100644 --- a/code/AssetLib/IFC/IFCLoader.h +++ b/code/AssetLib/IFC/IFCLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/IFC/IFCMaterial.cpp b/code/AssetLib/IFC/IFCMaterial.cpp index c26a3aa0a..6cd0e5910 100644 --- a/code/AssetLib/IFC/IFCMaterial.cpp +++ b/code/AssetLib/IFC/IFCMaterial.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/IFC/IFCOpenings.cpp b/code/AssetLib/IFC/IFCOpenings.cpp index d6671b885..c261a24b0 100644 --- a/code/AssetLib/IFC/IFCOpenings.cpp +++ b/code/AssetLib/IFC/IFCOpenings.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. Redistribution and use of this software in source and binary forms, @@ -58,6 +58,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif #include +#include +#include namespace Assimp { namespace IFC { @@ -73,7 +75,7 @@ namespace Assimp { // fallback method to generate wall openings - bool TryAddOpenings_Poly2Tri(const std::vector& openings,const std::vector& nors, + bool TryAddOpenings_Poly2Tri(const std::vector& openings, TempMesh& curmesh); @@ -1140,7 +1142,6 @@ IfcMatrix4 ProjectOntoPlane(std::vector& out_contour, const TempMesh // ------------------------------------------------------------------------------------------------ bool GenerateOpenings(std::vector& openings, - const std::vector& nors, TempMesh& curmesh, bool check_intersection, bool generate_connection_geometry, @@ -1340,7 +1341,7 @@ bool GenerateOpenings(std::vector& openings, MergeWindowContours(temp_contour, other, poly); if (poly.size() > 1) { - return TryAddOpenings_Poly2Tri(openings, nors, curmesh); + return TryAddOpenings_Poly2Tri(openings, curmesh); } else if (poly.size() == 0) { IFCImporter::LogWarn("ignoring duplicate opening"); @@ -1427,8 +1428,289 @@ bool GenerateOpenings(std::vector& openings, return true; } +std::vector GetContourInPlane2D(std::shared_ptr mesh,IfcMatrix3 planeSpace, + IfcVector3 planeNor,IfcFloat planeOffset, + IfcVector3 extrusionDir,IfcVector3& wall_extrusion,bool& first,bool& ok) { + std::vector contour; + + const auto outernor = ((mesh->mVerts[2] - mesh->mVerts[0]) ^ (mesh->mVerts[1] - mesh->mVerts[0])).Normalize(); + const IfcFloat dot = planeNor * outernor; + if(std::fabs(dot) < 1.f - 1e-6f) { + std::stringstream msg; + msg << "Skipping: Unaligned opening (" << planeNor.x << ", " << planeNor.y << ", " << planeNor.z << ")"; + msg << " . ( " << outernor.x << ", " << outernor.y << ", " << outernor.z << ") = " << dot; + IFCImporter::LogDebug(msg.str().c_str()); + ok = false; + return contour; + } + + const std::vector& va = mesh->mVerts; + if(va.size() <= 2) { + std::stringstream msg; + msg << "Skipping: Only " << va.size() << " verticies in opening mesh."; + IFCImporter::LogDebug(msg.str().c_str()); + ok = false; + return contour; + } + + for(const IfcVector3& xx : mesh->mVerts) { + IfcVector3 vv = planeSpace * xx,vv_extr = planeSpace * (xx + extrusionDir); + + const bool is_extruded_side = std::fabs(vv.z - planeOffset) > std::fabs(vv_extr.z - planeOffset); + if(first) { + first = false; + if(dot > 0.f) { + wall_extrusion = extrusionDir; + if(is_extruded_side) { + wall_extrusion = -wall_extrusion; + } + } + } + + // XXX should not be necessary - but it is. Why? For precision reasons? + vv = is_extruded_side ? vv_extr : vv; + contour.push_back(IfcVector2(vv.x,vv.y)); + } + ok = true; + + return contour; +} + +const float close { 1e-6f }; + +static bool isClose(IfcVector2 first,IfcVector2 second) { + auto diff = (second - first); + return (std::fabs(diff.x) < close && std::fabs(diff.y) < close); +} + +static void logSegment(std::pair segment) { + std::stringstream msg2; + msg2 << " Segment: \n"; + msg2 << " " << segment.first.x << " " << segment.first.y << " \n"; + msg2 << " " << segment.second.x << " " << segment.second.y << " \n"; + IFCImporter::LogInfo(msg2.str().c_str()); +} + +std::vector> GetContoursInPlane3D(std::shared_ptr mesh,IfcMatrix3 planeSpace, + IfcFloat planeOffset) { + + { + std::stringstream msg; + msg << "GetContoursInPlane3D: planeSpace is \n"; + msg << planeSpace.a1 << " " << planeSpace.a2 << " " << planeSpace.a3 << " " << "\n"; + msg << planeSpace.b1 << " " << planeSpace.b2 << " " << planeSpace.b3 << " " << "\n"; + msg << planeSpace.c1 << " " << planeSpace.c2 << " " << planeSpace.c3 << " " << "\n"; + msg << "\n planeOffset is " << planeOffset; + IFCImporter::LogInfo(msg.str().c_str()); + } + + // we'll put our line segments in here, and then merge them together into contours later + std::deque> lineSegments; + + // find the lines giving the intersection of the faces with the plane - we'll work in planeSpace throughout. + size_t vI0{ 0 }; // vertex index for first vertex in plane + for(auto nVertices : mesh->mVertcnt) { // iterate over faces + { + std::stringstream msg; + msg << "GetContoursInPlane3D: face (transformed) is \n"; + for(auto vI = vI0; vI < vI0 + nVertices; vI++) { + auto v = planeSpace * mesh->mVerts[vI]; + msg << " " << v.x << " " << v.y << " " << v.z << " " << "\n"; + } + IFCImporter::LogInfo(msg.str().c_str()); + } + + if(nVertices <= 2) // not a plane, a point or line + { + std::stringstream msg; + msg << "GetContoursInPlane3D: found point or line when expecting plane (only " << nVertices << " vertices)"; + IFCImporter::LogWarn(msg.str().c_str()); + vI0 += nVertices; + continue; + } + + auto v0 = planeSpace * mesh->mVerts[vI0]; + + // now calculate intersections between face and plane + IfcVector2 firstPoint; + bool gotFirstPoint(false); + + if(std::fabs(v0.z - planeOffset) < close) { + // first point is on the plane + firstPoint.x = v0.x; + firstPoint.y = v0.y; + gotFirstPoint = true; + } + + auto vn = v0; + for(auto vI = vI0 + 1; vI < vI0 + nVertices; vI++) { + auto vp = vn; + vn = planeSpace * mesh->mVerts[vI]; + IfcVector3 intersection; + + if(std::fabs(vn.z - planeOffset) < close) { + // on the plane + intersection = vn; + } + else if((vn.z > planeOffset) != (vp.z > planeOffset)) + { + // passes through the plane + auto vdir = vn - vp; + auto scale = (planeOffset - vp.z) / vdir.z; + intersection = vp + scale * vdir; + } + else { + // nowhere near - move on + continue; + } + + if(!gotFirstPoint) { + if(std::fabs(vp.z - planeOffset) < close) { + // just had a second line along the plane + firstPoint.x = vp.x; + firstPoint.y = vp.y; + IfcVector2 secondPoint(intersection.x,intersection.y); + auto s = std::pair(firstPoint,secondPoint); + logSegment(s); + lineSegments.push_back(s); + // next firstpoint should be this one + } + else { + // store the first intersection point + firstPoint.x = intersection.x; + firstPoint.y = intersection.y; + gotFirstPoint = true; + } + } + else { + // now got the second point, so store the pair + IfcVector2 secondPoint(intersection.x,intersection.y); + auto s = std::pair(firstPoint,secondPoint); + logSegment(s); + lineSegments.push_back(s); + + // - note that we don't move onto the next face as a non-convex face can create two or more intersections with a plane + gotFirstPoint = false; + } + } + if(gotFirstPoint) { + IFCImporter::LogWarn("GetContoursInPlane3D: odd number of intersections with plane"); + } + vI0 += nVertices; + } + + { + std::stringstream msg; + msg << "GetContoursInPlane3D: found " << lineSegments.size() << " line segments:\n"; + IFCImporter::LogInfo(msg.str().c_str()); + + for(auto& s : lineSegments) { + logSegment(s); + } + + } + + // now merge contours until we have the best-looking polygons we can + std::vector contours; + while(!lineSegments.empty()) { + // start with a polygon and make the best closed contour we can + const auto& firstSeg = lineSegments.front(); + std::deque contour{ firstSeg.first, firstSeg.second }; + lineSegments.pop_front(); + bool foundNextPoint{ true }; + bool closedContour{ false }; + while(foundNextPoint) { + foundNextPoint = false; + for(auto nextSeg = lineSegments.begin(); nextSeg != lineSegments.end(); nextSeg++) { + // see if we can match up both ends - in which case we've closed the contour + if((isClose(contour.front(),nextSeg->first) && isClose(contour.back(),nextSeg->second)) || + (isClose(contour.back(),nextSeg->first) && isClose(contour.front(),nextSeg->second)) + ) { + lineSegments.erase(nextSeg); + closedContour = true; + break; + } + + // otherwise, see if we can match up either end + foundNextPoint = true; + if(isClose(contour.front(),nextSeg->first)) { + contour.push_front(nextSeg->second); + } + else if(isClose(contour.front(),nextSeg->second)) { + contour.push_front(nextSeg->first); + } + else if(isClose(contour.back(),nextSeg->first)) { + contour.push_back(nextSeg->second); + } + else if(isClose(contour.back(),nextSeg->second)) { + contour.push_back(nextSeg->first); + } + else { + foundNextPoint = false; + } + if(foundNextPoint) { + lineSegments.erase(nextSeg); + break; + } + } + } + + if(!closedContour) { + IFCImporter::LogWarn("GetContoursInPlane3D: did not close contour"); + } + + // now add the contour if we can + if(contour.size() <= 2) { + IFCImporter::LogWarn("GetContoursInPlane3D: discarding line/point contour"); + continue; + } + Contour c{}; + for(auto p : contour) + { + c.push_back(p); + } + contours.push_back(c); + } + + { + std::stringstream msg; + msg << "GetContoursInPlane3D: found " << contours.size() << " contours:\n"; + + for(auto c : contours) { + msg << " Contour: \n"; + for(auto p : c) { + msg << " " << p.x << " " << p.y << " \n"; + } + } + + IFCImporter::LogInfo(msg.str().c_str()); + } + + + return contours; +} + +std::vector> GetContoursInPlane(std::shared_ptr mesh,IfcMatrix3 planeSpace, + IfcVector3 planeNor,IfcFloat planeOffset, + IfcVector3 extrusionDir,IfcVector3& wall_extrusion,bool& first) { + + if(mesh->mVertcnt.size() == 1) + { + bool ok; + auto contour = GetContourInPlane2D(mesh,planeSpace,planeNor,planeOffset,extrusionDir,wall_extrusion,first,ok); + if(ok) + return std::vector> {contour}; + else + return std::vector> {}; + } + else + { + return GetContoursInPlane3D(mesh,planeSpace,planeOffset); + } +} + // ------------------------------------------------------------------------------------------------ -bool TryAddOpenings_Poly2Tri(const std::vector& openings,const std::vector& nors, +bool TryAddOpenings_Poly2Tri(const std::vector& openings, TempMesh& curmesh) { IFCImporter::LogWarn("forced to use poly2tri fallback method to generate wall openings"); @@ -1498,61 +1780,41 @@ bool TryAddOpenings_Poly2Tri(const std::vector& openings,const std: try { ClipperLib::Clipper clipper_holes; - size_t c = 0; - for(const TempOpening& t :openings) { - const IfcVector3& outernor = nors[c++]; - const IfcFloat dot = nor * outernor; - if (std::fabs(dot)<1.f-1e-6f) { - continue; - } + for(const TempOpening& t : openings) { + auto contours = GetContoursInPlane(t.profileMesh,m,nor,coord,t.extrusionDir,wall_extrusion,first); - const std::vector& va = t.profileMesh->mVerts; - if(va.size() <= 2) { - continue; - } + for(auto& contour : contours) { + // scale to clipping space + ClipperLib::Polygon hole; + for(IfcVector2& pip : contour) { + pip.x = (pip.x - vmin.x) / vmax.x; + pip.y = (pip.y - vmin.y) / vmax.y; - std::vector contour; - - for(const IfcVector3& xx : t.profileMesh->mVerts) { - IfcVector3 vv = m * xx, vv_extr = m * (xx + t.extrusionDir); - - const bool is_extruded_side = std::fabs(vv.z - coord) > std::fabs(vv_extr.z - coord); - if (first) { - first = false; - if (dot > 0.f) { - wall_extrusion = t.extrusionDir; - if (is_extruded_side) { - wall_extrusion = - wall_extrusion; - } - } + hole.push_back(ClipperLib::IntPoint(to_int64(pip.x),to_int64(pip.y))); } - // XXX should not be necessary - but it is. Why? For precision reasons? - vv = is_extruded_side ? vv_extr : vv; - contour.push_back(IfcVector2(vv.x,vv.y)); + if(!ClipperLib::Orientation(hole)) { + std::reverse(hole.begin(),hole.end()); + // assert(ClipperLib::Orientation(hole)); + } + + /*ClipperLib::Polygons pol_temp(1), pol_temp2(1); + pol_temp[0] = hole; + + ClipperLib::OffsetPolygons(pol_temp,pol_temp2,5.0); + hole = pol_temp2[0];*/ + + clipper_holes.AddPolygon(hole,ClipperLib::ptSubject); + { + std::stringstream msg; + msg << "- added polygon "; + for(auto elem : hole) { + msg << " (" << elem.X << ", " << elem.Y << ")"; + } + IFCImporter::LogDebug(msg.str().c_str()); + } } - - ClipperLib::Polygon hole; - for(IfcVector2& pip : contour) { - pip.x = (pip.x - vmin.x) / vmax.x; - pip.y = (pip.y - vmin.y) / vmax.y; - - hole.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) )); - } - - if (!ClipperLib::Orientation(hole)) { - std::reverse(hole.begin(), hole.end()); - // assert(ClipperLib::Orientation(hole)); - } - - /*ClipperLib::Polygons pol_temp(1), pol_temp2(1); - pol_temp[0] = hole; - - ClipperLib::OffsetPolygons(pol_temp,pol_temp2,5.0); - hole = pol_temp2[0];*/ - - clipper_holes.AddPolygon(hole,ClipperLib::ptSubject); } clipper_holes.Execute(ClipperLib::ctUnion,holes_union, diff --git a/code/AssetLib/IFC/IFCProfile.cpp b/code/AssetLib/IFC/IFCProfile.cpp index 4235be181..aa31124ed 100644 --- a/code/AssetLib/IFC/IFCProfile.cpp +++ b/code/AssetLib/IFC/IFCProfile.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/IFC/IFCUtil.cpp b/code/AssetLib/IFC/IFCUtil.cpp index b3b7b0382..2ff0d6a58 100644 --- a/code/AssetLib/IFC/IFCUtil.cpp +++ b/code/AssetLib/IFC/IFCUtil.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/IFC/IFCUtil.h b/code/AssetLib/IFC/IFCUtil.h index b18f35052..b5f72a56d 100644 --- a/code/AssetLib/IFC/IFCUtil.h +++ b/code/AssetLib/IFC/IFCUtil.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -307,7 +307,6 @@ void ProcessBooleanExtrudedAreaSolidDifference(const Schema_2x3::IfcExtrudedArea // IFCOpenings.cpp bool GenerateOpenings(std::vector& openings, - const std::vector& nors, TempMesh& curmesh, bool check_intersection, bool generate_connection_geometry, diff --git a/code/AssetLib/IQM/IQMImporter.cpp b/code/AssetLib/IQM/IQMImporter.cpp new file mode 100644 index 000000000..2bea66c6b --- /dev/null +++ b/code/AssetLib/IQM/IQMImporter.cpp @@ -0,0 +1,322 @@ +/* +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, +with or without modification, are permitted provided that the +following conditions are met: + +* Redistributions of source code must retain the above +copyright notice, this list of conditions and the +following disclaimer. + +* Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the +following disclaimer in the documentation and/or other +materials provided with the distribution. + +* Neither the name of the assimp team, nor the names of its +contributors may be used to endorse or promote products +derived from this software without specific prior +written permission of the assimp team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +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. + +---------------------------------------------------------------------- +*/ + +#ifndef ASSIMP_BUILD_NO_IQM_IMPORTER + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "IQMImporter.h" +#include "iqm.h" + +// RESOURCES: +// http://sauerbraten.org/iqm/ +// https://github.com/lsalzman/iqm + + +inline void swap_block( uint32_t *block, size_t size ){ + (void)block; // suppress 'unreferenced formal parameter' MSVC warning + size >>= 2; + for ( size_t i = 0; i < size; ++i ) + AI_SWAP4( block[ i ] ); +} + +static const aiImporterDesc desc = { + "Inter-Quake Model Importer", + "", + "", + "", + aiImporterFlags_SupportBinaryFlavour, + 0, + 0, + 0, + 0, + "iqm" +}; + +namespace Assimp { + +// ------------------------------------------------------------------------------------------------ +// Default constructor +IQMImporter::IQMImporter() : + mScene(nullptr) { + // empty +} + +// ------------------------------------------------------------------------------------------------ +// Returns true, if file is a binary Inter-Quake Model file. +bool IQMImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { + const std::string extension = GetExtension(pFile); + + if (extension == "iqm") + return true; + else if (!extension.length() || checkSig) { + if (!pIOHandler) { + return true; + } + /* + * don't use CheckMagicToken because that checks with swapped bytes too, leading to false + * positives. This magic is not uint32_t, but char[4], so memcmp is the best way + + const char* tokens[] = {"3DMO", "3dmo"}; + return CheckMagicToken(pIOHandler,pFile,tokens,2,0,4); + */ + std::unique_ptr pStream(pIOHandler->Open(pFile, "rb")); + unsigned char data[15]; + if (!pStream || 15 != pStream->Read(data, 1, 15)) { + return false; + } + return !memcmp(data, "INTERQUAKEMODEL", 15); + } + return false; +} + +// ------------------------------------------------------------------------------------------------ +const aiImporterDesc *IQMImporter::GetInfo() const { + return &desc; +} + +// ------------------------------------------------------------------------------------------------ +// Model 3D import implementation +void IQMImporter::InternReadFile(const std::string &file, aiScene *pScene, IOSystem *pIOHandler) { + // Read file into memory + std::unique_ptr pStream(pIOHandler->Open(file, "rb")); + if (!pStream.get()) { + throw DeadlyImportError("Failed to open file ", file, "."); + } + + // Get the file-size and validate it, throwing an exception when fails + const size_t fileSize = pStream->FileSize(); + if (fileSize < sizeof( iqmheader )) { + throw DeadlyImportError("IQM-file ", file, " is too small."); + } + std::vector buffer(fileSize); + unsigned char *data = buffer.data(); + if (fileSize != pStream->Read(data, 1, fileSize)) { + throw DeadlyImportError("Failed to read the file ", file, "."); + } + + // get header + iqmheader &hdr = reinterpret_cast( *data ); + swap_block( &hdr.version, sizeof( iqmheader ) - sizeof( iqmheader::magic ) ); + + // extra check for header + if (memcmp(data, IQM_MAGIC, sizeof( IQM_MAGIC ) ) + || hdr.version != IQM_VERSION + || hdr.filesize != fileSize) { + throw DeadlyImportError("Bad binary header in file ", file, "."); + } + + ASSIMP_LOG_DEBUG("IQM: loading ", file); + + // create the root node + pScene->mRootNode = new aiNode( "" ); + // Now rotate the whole scene 90 degrees around the x axis to convert to internal coordinate system + pScene->mRootNode->mTransformation = aiMatrix4x4( + 1.f, 0.f, 0.f, 0.f, + 0.f, 0.f, 1.f, 0.f, + 0.f, -1.f, 0.f, 0.f, + 0.f, 0.f, 0.f, 1.f); + pScene->mRootNode->mNumMeshes = hdr.num_meshes; + pScene->mRootNode->mMeshes = new unsigned int[hdr.num_meshes]; + std::iota( pScene->mRootNode->mMeshes, pScene->mRootNode->mMeshes + pScene->mRootNode->mNumMeshes, 0 ); + + mScene = pScene; + + // Allocate output storage + pScene->mNumMeshes = 0; + pScene->mMeshes = new aiMesh *[hdr.num_meshes](); // Set arrays to zero to ensue proper destruction if an exception is raised + + pScene->mNumMaterials = 0; + pScene->mMaterials = new aiMaterial *[hdr.num_meshes](); + + // swap vertex arrays beforehand... + for( auto array = reinterpret_cast( data + hdr.ofs_vertexarrays ), end = array + hdr.num_vertexarrays; array != end; ++array ) + { + swap_block( &array->type, sizeof( iqmvertexarray ) ); + } + + // Read all surfaces from the file + for( auto imesh = reinterpret_cast( data + hdr.ofs_meshes ), end_ = imesh + hdr.num_meshes; imesh != end_; ++imesh ) + { + swap_block( &imesh->name, sizeof( iqmmesh ) ); + // Allocate output mesh & material + auto mesh = pScene->mMeshes[pScene->mNumMeshes++] = new aiMesh(); + mesh->mMaterialIndex = pScene->mNumMaterials; + auto mat = pScene->mMaterials[pScene->mNumMaterials++] = new aiMaterial(); + + { + auto text = reinterpret_cast( data + hdr.ofs_text ); + aiString name( text + imesh->material ); + mat->AddProperty( &name, AI_MATKEY_NAME ); + mat->AddProperty( &name, AI_MATKEY_TEXTURE_DIFFUSE(0) ); + } + + // Fill mesh information + mesh->mPrimitiveTypes = aiPrimitiveType_TRIANGLE; + mesh->mNumFaces = 0; + mesh->mFaces = new aiFace[imesh->num_triangles]; + + // Fill in all triangles + for( auto tri = reinterpret_cast( data + hdr.ofs_triangles ) + imesh->first_triangle, end = tri + imesh->num_triangles; tri != end; ++tri ) + { + swap_block( tri->vertex, sizeof( tri->vertex ) ); + auto& face = mesh->mFaces[mesh->mNumFaces++]; + face.mNumIndices = 3; + face.mIndices = new unsigned int[3]{ tri->vertex[0] - imesh->first_vertex, + tri->vertex[2] - imesh->first_vertex, + tri->vertex[1] - imesh->first_vertex }; + } + + // Fill in all vertices + for( auto array = reinterpret_cast( data + hdr.ofs_vertexarrays ), end__ = array + hdr.num_vertexarrays; array != end__; ++array ) + { + const unsigned int nVerts = imesh->num_vertexes; + const unsigned int step = array->size; + + switch ( array->type ) + { + case IQM_POSITION: + if( array->format == IQM_FLOAT && step >= 3 ){ + mesh->mNumVertices = nVerts; + auto v = mesh->mVertices = new aiVector3D[nVerts]; + for( auto f = reinterpret_cast( data + array->offset ) + imesh->first_vertex * step, + end = f + nVerts * step; f != end; f += step, ++v ) + { + *v = { AI_BE( f[0] ), + AI_BE( f[1] ), + AI_BE( f[2] ) }; + } + } + break; + case IQM_TEXCOORD: + if( array->format == IQM_FLOAT && step >= 2) + { + auto v = mesh->mTextureCoords[0] = new aiVector3D[nVerts]; + mesh->mNumUVComponents[0] = 2; + for( auto f = reinterpret_cast( data + array->offset ) + imesh->first_vertex * step, + end = f + nVerts * step; f != end; f += step, ++v ) + { + *v = { AI_BE( f[0] ), + 1 - AI_BE( f[1] ), 0 }; + } + } + break; + case IQM_NORMAL: + if (array->format == IQM_FLOAT && step >= 3) + { + auto v = mesh->mNormals = new aiVector3D[nVerts]; + for( auto f = reinterpret_cast( data + array->offset ) + imesh->first_vertex * step, + end = f + nVerts * step; f != end; f += step, ++v ) + { + *v = { AI_BE( f[0] ), + AI_BE( f[1] ), + AI_BE( f[2] ) }; + } + } + break; + case IQM_COLOR: + if (array->format == IQM_UBYTE && step >= 3) + { + auto v = mesh->mColors[0] = new aiColor4D[nVerts]; + for( auto f = ( data + array->offset ) + imesh->first_vertex * step, + end = f + nVerts * step; f != end; f += step, ++v ) + { + *v = { ( f[0] ) / 255.f, + ( f[1] ) / 255.f, + ( f[2] ) / 255.f, + step == 3? 1 : ( f[3] ) / 255.f }; + } + } + else if (array->format == IQM_FLOAT && step >= 3) + { + auto v = mesh->mColors[0] = new aiColor4D[nVerts]; + for( auto f = reinterpret_cast( data + array->offset ) + imesh->first_vertex * step, + end = f + nVerts * step; f != end; f += step, ++v ) + { + *v = { AI_BE( f[0] ), + AI_BE( f[1] ), + AI_BE( f[2] ), + step == 3? 1 : AI_BE( f[3] ) }; + } + } + break; + case IQM_TANGENT: +#if 0 + if (array->format == IQM_FLOAT && step >= 3) + { + auto v = mesh->mTangents = new aiVector3D[nVerts]; + for( auto f = reinterpret_cast( data + array->offset ) + imesh->first_vertex * step, + end = f + nVerts * step; f != end; f += step, ++v ) + { + *v = { AI_BE( f[0] ), + AI_BE( f[1] ), + AI_BE( f[2] ) }; + } + } +#endif + break; + case IQM_BLENDINDEXES: + case IQM_BLENDWEIGHTS: + case IQM_CUSTOM: + break; // these attributes are not relevant. + + default: + break; + } + } + } +} + + +// ------------------------------------------------------------------------------------------------ + +} // Namespace Assimp + +#endif // !! ASSIMP_BUILD_NO_IQM_IMPORTER diff --git a/code/AssetLib/IQM/IQMImporter.h b/code/AssetLib/IQM/IQMImporter.h new file mode 100644 index 000000000..fbeaff8c3 --- /dev/null +++ b/code/AssetLib/IQM/IQMImporter.h @@ -0,0 +1,78 @@ +/* +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, +with or without modification, are permitted provided that the +following conditions are met: + +* Redistributions of source code must retain the above +copyright notice, this list of conditions and the +following disclaimer. + +* Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the +following disclaimer in the documentation and/or other +materials provided with the distribution. + +* Neither the name of the assimp team, nor the names of its +contributors may be used to endorse or promote products +derived from this software without specific prior +written permission of the assimp team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +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 IQMImporter.h +* @brief Declares the importer class to read a scene from an Inter-Quake Model file +*/ + +#pragma once + +#ifndef ASSIMP_BUILD_NO_IQM_IMPORTER + +#include +#include + +namespace Assimp { + +class IQMImporter : public BaseImporter { +public: + /// \brief Default constructor + IQMImporter(); + ~IQMImporter() 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 override; + +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) override; + +private: + aiScene *mScene = nullptr; // the scene to import to +}; + +} // Namespace Assimp + +#endif // ASSIMP_BUILD_NO_IQM_IMPORTER diff --git a/code/AssetLib/IQM/iqm.h b/code/AssetLib/IQM/iqm.h new file mode 100644 index 000000000..a450504f9 --- /dev/null +++ b/code/AssetLib/IQM/iqm.h @@ -0,0 +1,134 @@ +#ifndef __IQM_H__ +#define __IQM_H__ + +#define IQM_MAGIC "INTERQUAKEMODEL" +#define IQM_VERSION 2 + +struct iqmheader +{ + char magic[16]; + unsigned int version; + unsigned int filesize; + unsigned int flags; + unsigned int num_text, ofs_text; + unsigned int num_meshes, ofs_meshes; + unsigned int num_vertexarrays, num_vertexes, ofs_vertexarrays; + unsigned int num_triangles, ofs_triangles, ofs_adjacency; + unsigned int num_joints, ofs_joints; + unsigned int num_poses, ofs_poses; + unsigned int num_anims, ofs_anims; + unsigned int num_frames, num_framechannels, ofs_frames, ofs_bounds; + unsigned int num_comment, ofs_comment; + unsigned int num_extensions, ofs_extensions; +}; + +struct iqmmesh +{ + unsigned int name; + unsigned int material; + unsigned int first_vertex, num_vertexes; + unsigned int first_triangle, num_triangles; +}; + +enum +{ + IQM_POSITION = 0, + IQM_TEXCOORD = 1, + IQM_NORMAL = 2, + IQM_TANGENT = 3, + IQM_BLENDINDEXES = 4, + IQM_BLENDWEIGHTS = 5, + IQM_COLOR = 6, + IQM_CUSTOM = 0x10 +}; + +enum +{ + IQM_BYTE = 0, + IQM_UBYTE = 1, + IQM_SHORT = 2, + IQM_USHORT = 3, + IQM_INT = 4, + IQM_UINT = 5, + IQM_HALF = 6, + IQM_FLOAT = 7, + IQM_DOUBLE = 8 +}; + +struct iqmtriangle +{ + unsigned int vertex[3]; +}; + +struct iqmadjacency +{ + unsigned int triangle[3]; +}; + +struct iqmjointv1 +{ + unsigned int name; + int parent; + float translate[3], rotate[3], scale[3]; +}; + +struct iqmjoint +{ + unsigned int name; + int parent; + float translate[3], rotate[4], scale[3]; +}; + +struct iqmposev1 +{ + int parent; + unsigned int mask; + float channeloffset[9]; + float channelscale[9]; +}; + +struct iqmpose +{ + int parent; + unsigned int mask; + float channeloffset[10]; + float channelscale[10]; +}; + +struct iqmanim +{ + unsigned int name; + unsigned int first_frame, num_frames; + float framerate; + unsigned int flags; +}; + +enum +{ + IQM_LOOP = 1<<0 +}; + +struct iqmvertexarray +{ + unsigned int type; + unsigned int flags; + unsigned int format; + unsigned int size; + unsigned int offset; +}; + +struct iqmbounds +{ + float bbmin[3], bbmax[3]; + float xyradius, radius; +}; + +struct iqmextension +{ + unsigned int name; + unsigned int num_data, ofs_data; + unsigned int ofs_extensions; // pointer to next extension +}; + +#endif + diff --git a/code/AssetLib/Irr/IRRLoader.cpp b/code/AssetLib/Irr/IRRLoader.cpp index b68671e0d..0061634a6 100644 --- a/code/AssetLib/Irr/IRRLoader.cpp +++ b/code/AssetLib/Irr/IRRLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -94,23 +94,9 @@ IRRImporter::~IRRImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool IRRImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - const std::string extension = GetExtension(pFile); - if (extension == "irr") { - return true; - } else if (extension == "xml" || checkSig) { - /* If CanRead() is called in order to check whether we - * support a specific file extension in general pIOHandler - * might be nullptr and it's our duty to return true here. - */ - if (nullptr == pIOHandler) { - return true; - } - static const char * const tokens[] = { "irr_scene" }; - return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1); - } - - return false; +bool IRRImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const char *tokens[] = { "irr_scene" }; + return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/Irr/IRRLoader.h b/code/AssetLib/Irr/IRRLoader.h index 147b94414..d56c4ca2d 100644 --- a/code/AssetLib/Irr/IRRLoader.h +++ b/code/AssetLib/Irr/IRRLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Irr/IRRMeshLoader.cpp b/code/AssetLib/Irr/IRRMeshLoader.cpp index c89eb3bc6..90b4d85af 100644 --- a/code/AssetLib/Irr/IRRMeshLoader.cpp +++ b/code/AssetLib/Irr/IRRMeshLoader.cpp @@ -3,9 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team - - +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -85,26 +83,14 @@ IRRMeshImporter::~IRRMeshImporter() {} // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool IRRMeshImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { +bool IRRMeshImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { /* NOTE: A simple check for the file extension is not enough - * here. Irrmesh and irr are easy, but xml is too generic - * and could be collada, too. So we need to open the file and - * search for typical tokens. - */ - const std::string extension = GetExtension(pFile); - - if (extension == "irrmesh") - return true; - else if (extension == "xml" || checkSig) { - /* If CanRead() is called to check whether the loader - * supports a specific file extension in general we - * must return true here. - */ - if (!pIOHandler) return true; - static const char * const tokens[] = { "irrmesh" }; - return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1); - } - return false; + * here. Irrmesh and irr are easy, but xml is too generic + * and could be collada, too. So we need to open the file and + * search for typical tokens. + */ + static const char *tokens[] = { "irrmesh" }; + return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/Irr/IRRMeshLoader.h b/code/AssetLib/Irr/IRRMeshLoader.h index 2a253bf20..79c1e486b 100644 --- a/code/AssetLib/Irr/IRRMeshLoader.h +++ b/code/AssetLib/Irr/IRRMeshLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Irr/IRRShared.cpp b/code/AssetLib/Irr/IRRShared.cpp index b42f34b65..8763b63ae 100644 --- a/code/AssetLib/Irr/IRRShared.cpp +++ b/code/AssetLib/Irr/IRRShared.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/LWO/LWOAnimation.cpp b/code/AssetLib/LWO/LWOAnimation.cpp index d9208616d..49fa45746 100644 --- a/code/AssetLib/LWO/LWOAnimation.cpp +++ b/code/AssetLib/LWO/LWOAnimation.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/LWO/LWOAnimation.h b/code/AssetLib/LWO/LWOAnimation.h index 64aa5980a..1e419d461 100644 --- a/code/AssetLib/LWO/LWOAnimation.h +++ b/code/AssetLib/LWO/LWOAnimation.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/LWO/LWOBLoader.cpp b/code/AssetLib/LWO/LWOBLoader.cpp index 8ef40fc21..1fbd9b9df 100644 --- a/code/AssetLib/LWO/LWOBLoader.cpp +++ b/code/AssetLib/LWO/LWOBLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/AssetLib/LWO/LWOFileData.h b/code/AssetLib/LWO/LWOFileData.h index 93ac1a236..f477f582f 100644 --- a/code/AssetLib/LWO/LWOFileData.h +++ b/code/AssetLib/LWO/LWOFileData.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/LWO/LWOLoader.cpp b/code/AssetLib/LWO/LWOLoader.cpp index bc62152c5..7410fb6cf 100644 --- a/code/AssetLib/LWO/LWOLoader.cpp +++ b/code/AssetLib/LWO/LWOLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team @@ -105,21 +105,13 @@ LWOImporter::~LWOImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool LWOImporter::CanRead(const std::string &file, IOSystem *pIOHandler, bool checkSig) const { - const std::string extension = GetExtension(file); - if (extension == "lwo" || extension == "lxo") { - return true; - } - - // if check for extension is not enough, check for the magic tokens - if (!extension.length() || checkSig) { - uint32_t tokens[3]; - tokens[0] = AI_LWO_FOURCC_LWOB; - tokens[1] = AI_LWO_FOURCC_LWO2; - tokens[2] = AI_LWO_FOURCC_LXOB; - return CheckMagicToken(pIOHandler, file, tokens, 3, 8); - } - return false; +bool LWOImporter::CanRead(const std::string &file, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const uint32_t tokens[] = { + AI_LWO_FOURCC_LWOB, + AI_LWO_FOURCC_LWO2, + AI_LWO_FOURCC_LXOB + }; + return CheckMagicToken(pIOHandler, file, tokens, AI_COUNT_OF(tokens), 8); } // ------------------------------------------------------------------------------------------------ @@ -393,7 +385,7 @@ void LWOImporter::InternReadFile(const std::string &pFile, // If a RGB color map is explicitly requested delete the // alpha channel - it could theoretically be != 1. - if (_mSurfaces[i].mVCMapType == AI_LWO_RGB) + if (_mSurfaces[j].mVCMapType == AI_LWO_RGB) pvVC[w]->a = 1.f; pvVC[w]++; diff --git a/code/AssetLib/LWO/LWOLoader.h b/code/AssetLib/LWO/LWOLoader.h index 0999071d6..f3add5323 100644 --- a/code/AssetLib/LWO/LWOLoader.h +++ b/code/AssetLib/LWO/LWOLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/LWO/LWOMaterial.cpp b/code/AssetLib/LWO/LWOMaterial.cpp index 178f24265..b6f0bcce9 100644 --- a/code/AssetLib/LWO/LWOMaterial.cpp +++ b/code/AssetLib/LWO/LWOMaterial.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/AssetLib/LWS/LWSLoader.cpp b/code/AssetLib/LWS/LWSLoader.cpp index cb07787fa..951dbe180 100644 --- a/code/AssetLib/LWS/LWSLoader.cpp +++ b/code/AssetLib/LWS/LWSLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -147,20 +147,12 @@ LWSImporter::~LWSImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool LWSImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - const std::string extension = GetExtension(pFile); - if (extension == "lws" || extension == "mot") { - return true; - } - - // if check for extension is not enough, check for the magic tokens LWSC and LWMO - if (!extension.length() || checkSig) { - uint32_t tokens[2]; - tokens[0] = AI_MAKE_MAGIC("LWSC"); - tokens[1] = AI_MAKE_MAGIC("LWMO"); - return CheckMagicToken(pIOHandler, pFile, tokens, 2); - } - return false; +bool LWSImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const uint32_t tokens[] = { + AI_MAKE_MAGIC("LWSC"), + AI_MAKE_MAGIC("LWMO") + }; + return CheckMagicToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ @@ -537,6 +529,11 @@ void LWSImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy // get file format version and print to log ++it; + + if (it == root.children.end() || (*it).tokens[0].empty()) { + ASSIMP_LOG_ERROR("Invalid LWS file detectedm abort import."); + return; + } unsigned int version = strtoul10((*it).tokens[0].c_str()); ASSIMP_LOG_INFO("LWS file format version is ", (*it).tokens[0]); first = 0.; diff --git a/code/AssetLib/LWS/LWSLoader.h b/code/AssetLib/LWS/LWSLoader.h index 820bc8156..225186f5c 100644 --- a/code/AssetLib/LWS/LWSLoader.h +++ b/code/AssetLib/LWS/LWSLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/M3D/M3DExporter.cpp b/code/AssetLib/M3D/M3DExporter.cpp index 22cfd5906..cf87b6221 100644 --- a/code/AssetLib/M3D/M3DExporter.cpp +++ b/code/AssetLib/M3D/M3DExporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team Copyright (c) 2019 bzt All rights reserved. diff --git a/code/AssetLib/M3D/M3DExporter.h b/code/AssetLib/M3D/M3DExporter.h index 1247114bb..d77743f56 100644 --- a/code/AssetLib/M3D/M3DExporter.h +++ b/code/AssetLib/M3D/M3DExporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team Copyright (c) 2019 bzt All rights reserved. diff --git a/code/AssetLib/M3D/M3DImporter.cpp b/code/AssetLib/M3D/M3DImporter.cpp index d87944456..895b2bf70 100644 --- a/code/AssetLib/M3D/M3DImporter.cpp +++ b/code/AssetLib/M3D/M3DImporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team Copyright (c) 2019 bzt All rights reserved. @@ -111,34 +111,19 @@ M3DImporter::M3DImporter() : // ------------------------------------------------------------------------------------------------ // Returns true, if file is a binary or ASCII Model 3D file. -bool M3DImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - const std::string extension = GetExtension(pFile); - - if (extension == "m3d" - || extension == "a3d" - ) - return true; - else if (!extension.length() || checkSig) { - if (!pIOHandler) { - return true; - } - /* - * don't use CheckMagicToken because that checks with swapped bytes too, leading to false - * positives. This magic is not uint32_t, but char[4], so memcmp is the best way - - const char* tokens[] = {"3DMO", "3dmo"}; - return CheckMagicToken(pIOHandler,pFile,tokens,2,0,4); - */ - std::unique_ptr pStream(pIOHandler->Open(pFile, "rb")); - unsigned char data[4]; - if (!pStream || 4 != pStream->Read(data, 1, 4)) { - return false; - } - return !memcmp(data, "3DMO", 4) /* bin */ - || !memcmp(data, "3dmo", 4) /* ASCII */ - ; +bool M3DImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + // don't use CheckMagicToken because that checks with swapped bytes too, leading to false + // positives. This magic is not uint32_t, but char[4], so memcmp is the best way + std::unique_ptr pStream(pIOHandler->Open(pFile, "rb")); + unsigned char data[4]; + if (4 != pStream->Read(data, 1, 4)) { + return false; } - return false; + return !memcmp(data, "3DMO", 4) /* bin */ +#ifdef M3D_ASCII + || !memcmp(data, "3dmo", 4) /* ASCII */ +#endif + ; } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/M3D/M3DImporter.h b/code/AssetLib/M3D/M3DImporter.h index 34af117a3..5d3fcaa7b 100644 --- a/code/AssetLib/M3D/M3DImporter.h +++ b/code/AssetLib/M3D/M3DImporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team Copyright (c) 2019 bzt All rights reserved. diff --git a/code/AssetLib/M3D/M3DMaterials.h b/code/AssetLib/M3D/M3DMaterials.h index 13b76825b..a1b0fd742 100644 --- a/code/AssetLib/M3D/M3DMaterials.h +++ b/code/AssetLib/M3D/M3DMaterials.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team Copyright (c) 2019 bzt All rights reserved. diff --git a/code/AssetLib/M3D/M3DWrapper.cpp b/code/AssetLib/M3D/M3DWrapper.cpp index f26912892..30452c776 100644 --- a/code/AssetLib/M3D/M3DWrapper.cpp +++ b/code/AssetLib/M3D/M3DWrapper.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team Copyright (c) 2019 bzt All rights reserved. diff --git a/code/AssetLib/M3D/M3DWrapper.h b/code/AssetLib/M3D/M3DWrapper.h index bd2b3b6c6..7cc2d0eef 100644 --- a/code/AssetLib/M3D/M3DWrapper.h +++ b/code/AssetLib/M3D/M3DWrapper.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team Copyright (c) 2019 bzt All rights reserved. diff --git a/code/AssetLib/MD2/MD2FileData.h b/code/AssetLib/MD2/MD2FileData.h index 8eb602e50..3bce8feee 100644 --- a/code/AssetLib/MD2/MD2FileData.h +++ b/code/AssetLib/MD2/MD2FileData.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MD2/MD2Loader.cpp b/code/AssetLib/MD2/MD2Loader.cpp index b7bf24ef7..99ab3f521 100644 --- a/code/AssetLib/MD2/MD2Loader.cpp +++ b/code/AssetLib/MD2/MD2Loader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team @@ -107,19 +107,10 @@ MD2Importer::~MD2Importer() // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool MD2Importer::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const +bool MD2Importer::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool /*checkSig*/) const { - const std::string extension = GetExtension(pFile); - if (extension == "md2") - return true; - - // if check for extension is not enough, check for the magic tokens - if (!extension.length() || checkSig) { - uint32_t tokens[1]; - tokens[0] = AI_MD2_MAGIC_NUMBER_LE; - return CheckMagicToken(pIOHandler,pFile,tokens,1); - } - return false; + static const uint32_t tokens[] = { AI_MD2_MAGIC_NUMBER_LE }; + return CheckMagicToken(pIOHandler,pFile,tokens,AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/MD2/MD2Loader.h b/code/AssetLib/MD2/MD2Loader.h index c473fe35b..a49ccb2fd 100644 --- a/code/AssetLib/MD2/MD2Loader.h +++ b/code/AssetLib/MD2/MD2Loader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MD2/MD2NormalTable.h b/code/AssetLib/MD2/MD2NormalTable.h index b2330d862..1837939e8 100644 --- a/code/AssetLib/MD2/MD2NormalTable.h +++ b/code/AssetLib/MD2/MD2NormalTable.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MD3/MD3FileData.h b/code/AssetLib/MD3/MD3FileData.h index 62b5fb706..01475e679 100644 --- a/code/AssetLib/MD3/MD3FileData.h +++ b/code/AssetLib/MD3/MD3FileData.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MD3/MD3Loader.cpp b/code/AssetLib/MD3/MD3Loader.cpp index abaabe47f..6120bd8cb 100644 --- a/code/AssetLib/MD3/MD3Loader.cpp +++ b/code/AssetLib/MD3/MD3Loader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team @@ -349,18 +349,9 @@ MD3Importer::~MD3Importer() {} // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool MD3Importer::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - const std::string extension = GetExtension(pFile); - if (extension == "md3") - return true; - - // if check for extension is not enough, check for the magic tokens - if (!extension.length() || checkSig) { - uint32_t tokens[1]; - tokens[0] = AI_MD3_MAGIC_NUMBER_LE; - return CheckMagicToken(pIOHandler, pFile, tokens, 1); - } - return false; +bool MD3Importer::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const uint32_t tokens[] = { AI_MD3_MAGIC_NUMBER_LE }; + return CheckMagicToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/MD3/MD3Loader.h b/code/AssetLib/MD3/MD3Loader.h index b334dac1e..d911bb1da 100644 --- a/code/AssetLib/MD3/MD3Loader.h +++ b/code/AssetLib/MD3/MD3Loader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MD5/MD5Loader.cpp b/code/AssetLib/MD5/MD5Loader.cpp index a04b32e14..2d5da4d92 100644 --- a/code/AssetLib/MD5/MD5Loader.cpp +++ b/code/AssetLib/MD5/MD5Loader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -100,20 +100,9 @@ MD5Importer::~MD5Importer() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool MD5Importer::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - const std::string extension = GetExtension(pFile); - - if (extension == "md5anim" || extension == "md5mesh" || extension == "md5camera") - return true; - else if (!extension.length() || checkSig) { - if (!pIOHandler) { - return true; - } - static const char * const tokens[] = { "MD5Version" }; - return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1); - } - - return false; +bool MD5Importer::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const char *tokens[] = { "MD5Version" }; + return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/MD5/MD5Loader.h b/code/AssetLib/MD5/MD5Loader.h index 9486ffd84..63fb1c36b 100644 --- a/code/AssetLib/MD5/MD5Loader.h +++ b/code/AssetLib/MD5/MD5Loader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MD5/MD5Parser.cpp b/code/AssetLib/MD5/MD5Parser.cpp index 802c9becd..7ed23cb82 100644 --- a/code/AssetLib/MD5/MD5Parser.cpp +++ b/code/AssetLib/MD5/MD5Parser.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/AssetLib/MD5/MD5Parser.h b/code/AssetLib/MD5/MD5Parser.h index d36114b6d..3108655f1 100644 --- a/code/AssetLib/MD5/MD5Parser.h +++ b/code/AssetLib/MD5/MD5Parser.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MDC/MDCFileData.h b/code/AssetLib/MDC/MDCFileData.h index a8f3aea43..36c589e91 100644 --- a/code/AssetLib/MDC/MDCFileData.h +++ b/code/AssetLib/MDC/MDCFileData.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MDC/MDCLoader.cpp b/code/AssetLib/MDC/MDCLoader.cpp index 8f089bbd8..7810800de 100644 --- a/code/AssetLib/MDC/MDCLoader.cpp +++ b/code/AssetLib/MDC/MDCLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -111,19 +111,9 @@ MDCImporter::~MDCImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool MDCImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - const std::string extension = GetExtension(pFile); - if (extension == "mdc") { - return true; - } - - // if check for extension is not enough, check for the magic tokens - if (!extension.length() || checkSig) { - uint32_t tokens[1]; - tokens[0] = AI_MDC_MAGIC_NUMBER_LE; - return CheckMagicToken(pIOHandler, pFile, tokens, 1); - } - return false; +bool MDCImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const uint32_t tokens[] = { AI_MDC_MAGIC_NUMBER_LE }; + return CheckMagicToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/MDC/MDCLoader.h b/code/AssetLib/MDC/MDCLoader.h index 1d0243593..6e67cd12f 100644 --- a/code/AssetLib/MDC/MDCLoader.h +++ b/code/AssetLib/MDC/MDCLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MDL/HalfLife/HL1FileData.h b/code/AssetLib/MDL/HalfLife/HL1FileData.h index 30dca0d0a..28b1b2822 100644 --- a/code/AssetLib/MDL/HalfLife/HL1FileData.h +++ b/code/AssetLib/MDL/HalfLife/HL1FileData.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MDL/HalfLife/HL1ImportDefinitions.h b/code/AssetLib/MDL/HalfLife/HL1ImportDefinitions.h index 47b4fbb31..d412aeede 100644 --- a/code/AssetLib/MDL/HalfLife/HL1ImportDefinitions.h +++ b/code/AssetLib/MDL/HalfLife/HL1ImportDefinitions.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MDL/HalfLife/HL1ImportSettings.h b/code/AssetLib/MDL/HalfLife/HL1ImportSettings.h index d52305e44..340ba2da5 100644 --- a/code/AssetLib/MDL/HalfLife/HL1ImportSettings.h +++ b/code/AssetLib/MDL/HalfLife/HL1ImportSettings.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MDL/HalfLife/HL1MDLLoader.cpp b/code/AssetLib/MDL/HalfLife/HL1MDLLoader.cpp index 1ff86fe27..93d37536c 100644 --- a/code/AssetLib/MDL/HalfLife/HL1MDLLoader.cpp +++ b/code/AssetLib/MDL/HalfLife/HL1MDLLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MDL/HalfLife/HL1MDLLoader.h b/code/AssetLib/MDL/HalfLife/HL1MDLLoader.h index 74bff7362..d87d6d3e8 100644 --- a/code/AssetLib/MDL/HalfLife/HL1MDLLoader.h +++ b/code/AssetLib/MDL/HalfLife/HL1MDLLoader.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MDL/HalfLife/HL1MeshTrivert.h b/code/AssetLib/MDL/HalfLife/HL1MeshTrivert.h index 1eedf8edd..4ef8a13ce 100644 --- a/code/AssetLib/MDL/HalfLife/HL1MeshTrivert.h +++ b/code/AssetLib/MDL/HalfLife/HL1MeshTrivert.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MDL/HalfLife/HalfLifeMDLBaseHeader.h b/code/AssetLib/MDL/HalfLife/HalfLifeMDLBaseHeader.h index 868b0d592..c7808c401 100644 --- a/code/AssetLib/MDL/HalfLife/HalfLifeMDLBaseHeader.h +++ b/code/AssetLib/MDL/HalfLife/HalfLifeMDLBaseHeader.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MDL/HalfLife/LogFunctions.h b/code/AssetLib/MDL/HalfLife/LogFunctions.h index f73c68356..003774dc1 100644 --- a/code/AssetLib/MDL/HalfLife/LogFunctions.h +++ b/code/AssetLib/MDL/HalfLife/LogFunctions.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MDL/HalfLife/UniqueNameGenerator.cpp b/code/AssetLib/MDL/HalfLife/UniqueNameGenerator.cpp index dde81454b..6fc8b118e 100644 --- a/code/AssetLib/MDL/HalfLife/UniqueNameGenerator.cpp +++ b/code/AssetLib/MDL/HalfLife/UniqueNameGenerator.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MDL/HalfLife/UniqueNameGenerator.h b/code/AssetLib/MDL/HalfLife/UniqueNameGenerator.h index 02242a7bd..73b6f9e74 100644 --- a/code/AssetLib/MDL/HalfLife/UniqueNameGenerator.h +++ b/code/AssetLib/MDL/HalfLife/UniqueNameGenerator.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MDL/MDLDefaultColorMap.h b/code/AssetLib/MDL/MDLDefaultColorMap.h index aad0af352..2eecac2dc 100644 --- a/code/AssetLib/MDL/MDLDefaultColorMap.h +++ b/code/AssetLib/MDL/MDLDefaultColorMap.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MDL/MDLFileData.h b/code/AssetLib/MDL/MDLFileData.h index 473a06989..7ec2afe9a 100644 --- a/code/AssetLib/MDL/MDLFileData.h +++ b/code/AssetLib/MDL/MDLFileData.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MDL/MDLLoader.cpp b/code/AssetLib/MDL/MDLLoader.cpp index c59375da0..1e90c8e71 100644 --- a/code/AssetLib/MDL/MDLLoader.cpp +++ b/code/AssetLib/MDL/MDLLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -104,23 +104,18 @@ MDLImporter::~MDLImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool MDLImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - const std::string extension = GetExtension(pFile); - - // if check for extension is not enough, check for the magic tokens - if (extension == "mdl" || !extension.length() || checkSig) { - uint32_t tokens[8]; - tokens[0] = AI_MDL_MAGIC_NUMBER_LE_HL2a; - tokens[1] = AI_MDL_MAGIC_NUMBER_LE_HL2b; - tokens[2] = AI_MDL_MAGIC_NUMBER_LE_GS7; - tokens[3] = AI_MDL_MAGIC_NUMBER_LE_GS5b; - tokens[4] = AI_MDL_MAGIC_NUMBER_LE_GS5a; - tokens[5] = AI_MDL_MAGIC_NUMBER_LE_GS4; - tokens[6] = AI_MDL_MAGIC_NUMBER_LE_GS3; - tokens[7] = AI_MDL_MAGIC_NUMBER_LE; - return CheckMagicToken(pIOHandler, pFile, tokens, 8, 0); - } - return false; +bool MDLImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const uint32_t tokens[] = { + AI_MDL_MAGIC_NUMBER_LE_HL2a, + AI_MDL_MAGIC_NUMBER_LE_HL2b, + AI_MDL_MAGIC_NUMBER_LE_GS7, + AI_MDL_MAGIC_NUMBER_LE_GS5b, + AI_MDL_MAGIC_NUMBER_LE_GS5a, + AI_MDL_MAGIC_NUMBER_LE_GS4, + AI_MDL_MAGIC_NUMBER_LE_GS3, + AI_MDL_MAGIC_NUMBER_LE + }; + return CheckMagicToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/MDL/MDLLoader.h b/code/AssetLib/MDL/MDLLoader.h index e81fe0b4f..b7d87e88d 100644 --- a/code/AssetLib/MDL/MDLLoader.h +++ b/code/AssetLib/MDL/MDLLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MDL/MDLMaterialLoader.cpp b/code/AssetLib/MDL/MDLMaterialLoader.cpp index 62320814a..eebb9d15e 100644 --- a/code/AssetLib/MDL/MDLMaterialLoader.cpp +++ b/code/AssetLib/MDL/MDLMaterialLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -463,8 +463,12 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7( ASSIMP_LOG_WARN("Found a reference to an embedded DDS texture, " "but texture height is not equal to 1, which is not supported by MED"); } - - pcNew.reset(new aiTexture()); + if (iWidth == 0) { + ASSIMP_LOG_ERROR("Found a reference to an embedded DDS texture, but texture width is zero, aborting import."); + return; + } + + pcNew.reset(new aiTexture); pcNew->mHeight = 0; pcNew->mWidth = iWidth; diff --git a/code/AssetLib/MMD/MMDCpp14.h b/code/AssetLib/MMD/MMDCpp14.h index 29e966b8a..10d376829 100644 --- a/code/AssetLib/MMD/MMDCpp14.h +++ b/code/AssetLib/MMD/MMDCpp14.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MMD/MMDImporter.cpp b/code/AssetLib/MMD/MMDImporter.cpp index 84d320e41..e0e68f7c5 100644 --- a/code/AssetLib/MMD/MMDImporter.cpp +++ b/code/AssetLib/MMD/MMDImporter.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -89,14 +89,9 @@ MMDImporter::~MMDImporter() { // ------------------------------------------------------------------------------------------------ // Returns true, if file is an pmx file. bool MMDImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, - bool checkSig) const { - if (!checkSig) { - return SimpleExtensionCheck(pFile, "pmx"); - } else { - // Check file Header - static const char * const pTokens[] = { "PMX " }; - return SearchFileHeaderForToken(pIOHandler, pFile, pTokens, 1); - } + bool /*checkSig*/) const { + static const char *tokens[] = { "PMX " }; + return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/MMD/MMDImporter.h b/code/AssetLib/MMD/MMDImporter.h index cfd903eee..36f384829 100644 --- a/code/AssetLib/MMD/MMDImporter.h +++ b/code/AssetLib/MMD/MMDImporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. Redistribution and use of this software in source and binary forms, diff --git a/code/AssetLib/MMD/MMDPmdParser.h b/code/AssetLib/MMD/MMDPmdParser.h index f9f555c6a..35e4f09d1 100644 --- a/code/AssetLib/MMD/MMDPmdParser.h +++ b/code/AssetLib/MMD/MMDPmdParser.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MMD/MMDPmxParser.cpp b/code/AssetLib/MMD/MMDPmxParser.cpp index be3b10248..ca37ba199 100644 --- a/code/AssetLib/MMD/MMDPmxParser.cpp +++ b/code/AssetLib/MMD/MMDPmxParser.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MMD/MMDPmxParser.h b/code/AssetLib/MMD/MMDPmxParser.h index 696e40889..08f57f6f0 100644 --- a/code/AssetLib/MMD/MMDPmxParser.h +++ b/code/AssetLib/MMD/MMDPmxParser.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MMD/MMDVmdParser.h b/code/AssetLib/MMD/MMDVmdParser.h index 0ce24a48f..d5c7dedff 100644 --- a/code/AssetLib/MMD/MMDVmdParser.h +++ b/code/AssetLib/MMD/MMDVmdParser.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/MS3D/MS3DLoader.cpp b/code/AssetLib/MS3D/MS3DLoader.cpp index 4b0269b7b..fc2ed042b 100644 --- a/code/AssetLib/MS3D/MS3DLoader.cpp +++ b/code/AssetLib/MS3D/MS3DLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team @@ -88,26 +88,12 @@ MS3DImporter::MS3DImporter() // Destructor, private as well MS3DImporter::~MS3DImporter() {} - // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool MS3DImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const +bool MS3DImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool /*checkSig*/) const { - // first call - simple extension check - const std::string extension = GetExtension(pFile); - if (extension == "ms3d") { - return true; - } - - // second call - check for magic identifiers - else if (!extension.length() || checkSig) { - if (!pIOHandler) { - return true; - } - static const char * const tokens[] = {"MS3D000000"}; - return SearchFileHeaderForToken(pIOHandler,pFile,tokens,1); - } - return false; + static const char* tokens[] = { "MS3D000000" }; + return SearchFileHeaderForToken(pIOHandler,pFile,tokens,AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/MS3D/MS3DLoader.h b/code/AssetLib/MS3D/MS3DLoader.h index 4e42156f9..4bd417566 100644 --- a/code/AssetLib/MS3D/MS3DLoader.h +++ b/code/AssetLib/MS3D/MS3DLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/NDO/NDOLoader.cpp b/code/AssetLib/NDO/NDOLoader.cpp index 0ccbe8a61..37c543692 100644 --- a/code/AssetLib/NDO/NDOLoader.cpp +++ b/code/AssetLib/NDO/NDOLoader.cpp @@ -3,9 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team - - +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -82,19 +80,10 @@ NDOImporter::~NDOImporter() // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool NDOImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const +bool NDOImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool /*checkSig*/) const { - // check file extension - const std::string extension = GetExtension(pFile); - - if( extension == "ndo") - return true; - - if ((checkSig || !extension.length()) && pIOHandler) { - static const char * const tokens[] = {"nendo"}; - return SearchFileHeaderForToken(pIOHandler,pFile,tokens,1,5); - } - return false; + static const char* tokens[] = {"nendo"}; + return SearchFileHeaderForToken(pIOHandler,pFile,tokens,AI_COUNT_OF(tokens),5); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/NDO/NDOLoader.h b/code/AssetLib/NDO/NDOLoader.h index fb619b8cb..61dd93981 100644 --- a/code/AssetLib/NDO/NDOLoader.h +++ b/code/AssetLib/NDO/NDOLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. Redistribution and use of this software in source and binary forms, diff --git a/code/AssetLib/NFF/NFFLoader.cpp b/code/AssetLib/NFF/NFFLoader.cpp index 15f46b5e6..48271d137 100644 --- a/code/AssetLib/NFF/NFFLoader.cpp +++ b/code/AssetLib/NFF/NFFLoader.cpp @@ -3,9 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team - - +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -83,7 +81,7 @@ NFFImporter::~NFFImporter() {} // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool NFFImporter::CanRead(const std::string &pFile, IOSystem * /*pIOHandler*/, bool /*checkSig*/) const { +bool NFFImporter::CanRead(const std::string & pFile, IOSystem * /*pIOHandler*/, bool /*checkSig*/) const { return SimpleExtensionCheck(pFile, "nff", "enff"); } diff --git a/code/AssetLib/NFF/NFFLoader.h b/code/AssetLib/NFF/NFFLoader.h index 514476c12..0fa615b19 100644 --- a/code/AssetLib/NFF/NFFLoader.h +++ b/code/AssetLib/NFF/NFFLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/OFF/OFFLoader.cpp b/code/AssetLib/OFF/OFFLoader.cpp index 644579bce..640e79249 100644 --- a/code/AssetLib/OFF/OFFLoader.cpp +++ b/code/AssetLib/OFF/OFFLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -83,19 +83,10 @@ OFFImporter::~OFFImporter() // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool OFFImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const +bool OFFImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool /*checkSig*/) const { - const std::string extension = GetExtension(pFile); - - if (extension == "off") - return true; - else if (!extension.length() || checkSig) - { - if (!pIOHandler)return true; - static const char * const tokens[] = {"off"}; - return SearchFileHeaderForToken(pIOHandler,pFile,tokens,1,3); - } - return false; + static const char* tokens[] = { "off" }; + return SearchFileHeaderForToken(pIOHandler,pFile,tokens,AI_COUNT_OF(tokens),3); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/OFF/OFFLoader.h b/code/AssetLib/OFF/OFFLoader.h index 9d1136b6c..04bb7f481 100644 --- a/code/AssetLib/OFF/OFFLoader.h +++ b/code/AssetLib/OFF/OFFLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Obj/ObjFileData.h b/code/AssetLib/Obj/ObjFileData.h index b14250020..bc65058ac 100644 --- a/code/AssetLib/Obj/ObjFileData.h +++ b/code/AssetLib/Obj/ObjFileData.h @@ -133,6 +133,10 @@ struct Material { aiString textureSpecularity; aiString textureOpacity; aiString textureDisp; + aiString textureRoughness; + aiString textureMetallic; + aiString textureSheen; + aiString textureRMA; enum TextureType { TextureDiffuseType = 0, @@ -151,6 +155,10 @@ struct Material { TextureSpecularityType, TextureOpacityType, TextureDispType, + TextureRoughnessType, + TextureMetallicType, + TextureSheenType, + TextureRMAType, TextureTypeCount }; bool clamp[TextureTypeCount]; @@ -174,6 +182,19 @@ struct Material { //! Transparency color aiColor3D transparent; + //! PBR Roughness + ai_real roughness; + //! PBR Metallic + ai_real metallic; + //! PBR Metallic + aiColor3D sheen; + //! PBR Clearcoat Thickness + ai_real clearcoat_thickness; + //! PBR Clearcoat Rougness + ai_real clearcoat_roughness; + //! PBR Anisotropy + ai_real anisotropy; + //! Constructor Material() : diffuse(ai_real(0.6), ai_real(0.6), ai_real(0.6)), @@ -181,7 +202,13 @@ struct Material { shineness(ai_real(0.0)), illumination_model(1), ior(ai_real(1.0)), - transparent(ai_real(1.0), ai_real(1.0), ai_real(1.0)) { + transparent(ai_real(1.0), ai_real(1.0), ai_real(1.0)), + roughness(ai_real(1.0)), + metallic(ai_real(0.0)), + sheen(ai_real(1.0), ai_real(1.0), ai_real(1.0)), + clearcoat_thickness(ai_real(0.0)), + clearcoat_roughness(ai_real(0.0)), + anisotropy(ai_real(0.0)) { std::fill_n(clamp, static_cast(TextureTypeCount), false); } diff --git a/code/AssetLib/Obj/ObjFileImporter.cpp b/code/AssetLib/Obj/ObjFileImporter.cpp index 4e943fb5f..fd062552f 100644 --- a/code/AssetLib/Obj/ObjFileImporter.cpp +++ b/code/AssetLib/Obj/ObjFileImporter.cpp @@ -87,16 +87,10 @@ ObjFileImporter::~ObjFileImporter() { } // ------------------------------------------------------------------------------------------------ -// Returns true, if file is an obj file. -bool ObjFileImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - if (!checkSig) { - //Check File Extension - return SimpleExtensionCheck(pFile, "obj"); - } else { - // Check file Header - static const char *pTokens[] = { "mtllib", "usemtl", "v ", "vt ", "vn ", "o ", "g ", "s ", "f " }; - return BaseImporter::SearchFileHeaderForToken(pIOHandler, pFile, pTokens, 9, 200, false, true); - } +// Returns true if file is an obj file. +bool ObjFileImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const char *tokens[] = { "mtllib", "usemtl", "v ", "vt ", "vn ", "o ", "g ", "s ", "f " }; + return BaseImporter::SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens), 200, false, true); } // ------------------------------------------------------------------------------------------------ @@ -618,6 +612,12 @@ void ObjFileImporter::createMaterials(const ObjFile::Model *pModel, aiScene *pSc mat->AddProperty(&pCurrentMaterial->shineness, 1, AI_MATKEY_SHININESS); mat->AddProperty(&pCurrentMaterial->alpha, 1, AI_MATKEY_OPACITY); mat->AddProperty(&pCurrentMaterial->transparent, 1, AI_MATKEY_COLOR_TRANSPARENT); + mat->AddProperty(&pCurrentMaterial->roughness, 1, AI_MATKEY_ROUGHNESS_FACTOR); + mat->AddProperty(&pCurrentMaterial->metallic, 1, AI_MATKEY_METALLIC_FACTOR); + mat->AddProperty(&pCurrentMaterial->sheen, 1, AI_MATKEY_SHEEN_COLOR_FACTOR); + mat->AddProperty(&pCurrentMaterial->clearcoat_thickness, 1, AI_MATKEY_CLEARCOAT_FACTOR); + mat->AddProperty(&pCurrentMaterial->clearcoat_roughness, 1, AI_MATKEY_CLEARCOAT_ROUGHNESS_FACTOR); + mat->AddProperty(&pCurrentMaterial->anisotropy, 1, AI_MATKEY_ANISOTROPY_FACTOR); // Adding refraction index mat->AddProperty(&pCurrentMaterial->ior, 1, AI_MATKEY_REFRACTI); @@ -709,6 +709,39 @@ void ObjFileImporter::createMaterials(const ObjFile::Model *pModel, aiScene *pSc } } + if (0 != pCurrentMaterial->textureRoughness.length) { + mat->AddProperty(&pCurrentMaterial->textureRoughness, _AI_MATKEY_TEXTURE_BASE, aiTextureType_DIFFUSE_ROUGHNESS, 0); + mat->AddProperty(&uvwIndex, 1, _AI_MATKEY_UVWSRC_BASE, aiTextureType_DIFFUSE_ROUGHNESS, 0 ); + if (pCurrentMaterial->clamp[ObjFile::Material::TextureRoughnessType]) { + addTextureMappingModeProperty(mat, aiTextureType_DIFFUSE_ROUGHNESS); + } + } + + if (0 != pCurrentMaterial->textureMetallic.length) { + mat->AddProperty(&pCurrentMaterial->textureMetallic, _AI_MATKEY_TEXTURE_BASE, aiTextureType_METALNESS, 0); + mat->AddProperty(&uvwIndex, 1, _AI_MATKEY_UVWSRC_BASE, aiTextureType_METALNESS, 0 ); + if (pCurrentMaterial->clamp[ObjFile::Material::TextureMetallicType]) { + addTextureMappingModeProperty(mat, aiTextureType_METALNESS); + } + } + + if (0 != pCurrentMaterial->textureSheen.length) { + mat->AddProperty(&pCurrentMaterial->textureSheen, _AI_MATKEY_TEXTURE_BASE, aiTextureType_SHEEN, 0); + mat->AddProperty(&uvwIndex, 1, _AI_MATKEY_UVWSRC_BASE, aiTextureType_SHEEN, 0 ); + if (pCurrentMaterial->clamp[ObjFile::Material::TextureSheenType]) { + addTextureMappingModeProperty(mat, aiTextureType_SHEEN); + } + } + + if (0 != pCurrentMaterial->textureRMA.length) { + // NOTE: glTF importer places Rough/Metal/AO texture in Unknown so doing the same here for consistency. + mat->AddProperty(&pCurrentMaterial->textureRMA, _AI_MATKEY_TEXTURE_BASE, aiTextureType_UNKNOWN, 0); + mat->AddProperty(&uvwIndex, 1, _AI_MATKEY_UVWSRC_BASE, aiTextureType_UNKNOWN, 0 ); + if (pCurrentMaterial->clamp[ObjFile::Material::TextureRMAType]) { + addTextureMappingModeProperty(mat, aiTextureType_UNKNOWN); + } + } + // Store material property info in material array in scene pScene->mMaterials[pScene->mNumMaterials] = mat; pScene->mNumMaterials++; diff --git a/code/AssetLib/Obj/ObjFileMtlImporter.cpp b/code/AssetLib/Obj/ObjFileMtlImporter.cpp index 548401d01..7d5930594 100644 --- a/code/AssetLib/Obj/ObjFileMtlImporter.cpp +++ b/code/AssetLib/Obj/ObjFileMtlImporter.cpp @@ -67,6 +67,10 @@ static const std::string ReflectionTexture = "refl"; static const std::string DisplacementTexture1 = "map_disp"; static const std::string DisplacementTexture2 = "disp"; static const std::string SpecularityTexture = "map_ns"; +static const std::string RoughnessTexture = "map_Pr"; +static const std::string MetallicTexture = "map_Pm"; +static const std::string SheenTexture = "map_Ps"; +static const std::string RMATexture = "map_Ps"; // texture option specific token static const std::string BlendUOption = "-blendu"; @@ -178,10 +182,45 @@ void ObjFileMtlImporter::load() { case 'e': // New material createMaterial(); break; + case 'o': // Norm texture + --m_DataIt; + getTexture(); + break; } m_DataIt = skipLine(m_DataIt, m_DataItEnd, m_uiLine); } break; + case 'P': + { + ++m_DataIt; + switch(*m_DataIt) + { + case 'r': + ++m_DataIt; + getFloatValue(m_pModel->m_pCurrentMaterial->roughness); + break; + case 'm': + ++m_DataIt; + getFloatValue(m_pModel->m_pCurrentMaterial->metallic); + break; + case 's': + ++m_DataIt; + getColorRGBA(&m_pModel->m_pCurrentMaterial->sheen); + break; + case 'c': + ++m_DataIt; + if (*m_DataIt == 'r') { + ++m_DataIt; + getFloatValue(m_pModel->m_pCurrentMaterial->clearcoat_roughness); + } else { + getFloatValue(m_pModel->m_pCurrentMaterial->clearcoat_thickness); + } + break; + } + m_DataIt = skipLine(m_DataIt, m_DataItEnd, m_uiLine); + } + break; + case 'm': // Texture case 'b': // quick'n'dirty - for 'bump' sections case 'r': // quick'n'dirty - for 'refl' sections @@ -197,6 +236,12 @@ void ObjFileMtlImporter::load() { m_DataIt = skipLine(m_DataIt, m_DataItEnd, m_uiLine); } break; + case 'a': // Anisotropy + { + getFloatValue(m_pModel->m_pCurrentMaterial->anisotropy); + m_DataIt = skipLine(m_DataIt, m_DataItEnd, m_uiLine); + } break; + default: { m_DataIt = skipLine(m_DataIt, m_DataItEnd, m_uiLine); } break; @@ -334,6 +379,22 @@ void ObjFileMtlImporter::getTexture() { // Specularity scaling (glossiness) out = &m_pModel->m_pCurrentMaterial->textureSpecularity; clampIndex = ObjFile::Material::TextureSpecularityType; + } else if ( !ASSIMP_strincmp( pPtr, RoughnessTexture.c_str(), static_cast(RoughnessTexture.size()))) { + // PBR Roughness texture + out = & m_pModel->m_pCurrentMaterial->textureRoughness; + clampIndex = ObjFile::Material::TextureRoughnessType; + } else if ( !ASSIMP_strincmp( pPtr, MetallicTexture.c_str(), static_cast(MetallicTexture.size()))) { + // PBR Metallic texture + out = & m_pModel->m_pCurrentMaterial->textureMetallic; + clampIndex = ObjFile::Material::TextureMetallicType; + } else if (!ASSIMP_strincmp( pPtr, SheenTexture.c_str(), static_cast(SheenTexture.size()))) { + // PBR Sheen (reflectance) texture + out = & m_pModel->m_pCurrentMaterial->textureSheen; + clampIndex = ObjFile::Material::TextureSheenType; + } else if (!ASSIMP_strincmp( pPtr, RMATexture.c_str(), static_cast(RMATexture.size()))) { + // PBR Rough/Metal/AO texture + out = & m_pModel->m_pCurrentMaterial->textureRMA; + clampIndex = ObjFile::Material::TextureRMAType; } else { ASSIMP_LOG_ERROR("OBJ/MTL: Encountered unknown texture type"); return; diff --git a/code/AssetLib/Ogre/OgreBinarySerializer.cpp b/code/AssetLib/Ogre/OgreBinarySerializer.cpp index fc975a5cc..738e1181e 100644 --- a/code/AssetLib/Ogre/OgreBinarySerializer.cpp +++ b/code/AssetLib/Ogre/OgreBinarySerializer.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Ogre/OgreBinarySerializer.h b/code/AssetLib/Ogre/OgreBinarySerializer.h index 0cf45bbcd..eb026ea70 100644 --- a/code/AssetLib/Ogre/OgreBinarySerializer.h +++ b/code/AssetLib/Ogre/OgreBinarySerializer.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Ogre/OgreImporter.cpp b/code/AssetLib/Ogre/OgreImporter.cpp index 5250dbe5e..860aed727 100644 --- a/code/AssetLib/Ogre/OgreImporter.cpp +++ b/code/AssetLib/Ogre/OgreImporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -73,14 +73,10 @@ void OgreImporter::SetupProperties(const Importer *pImp) { m_detectTextureTypeFromFilename = pImp->GetPropertyBool(AI_CONFIG_IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME, false); } -bool OgreImporter::CanRead(const std::string &pFile, Assimp::IOSystem *pIOHandler, bool checkSig) const { - if (!checkSig) { - return EndsWith(pFile, ".mesh.xml", false) || EndsWith(pFile, ".mesh", false); - } - +bool OgreImporter::CanRead(const std::string &pFile, Assimp::IOSystem *pIOHandler, bool /*checkSig*/) const { if (EndsWith(pFile, ".mesh.xml", false)) { - static const char * const tokens[] = { "" }; - return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1); + static const char *tokens[] = { "" }; + return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } /// @todo Read and validate first header chunk? diff --git a/code/AssetLib/Ogre/OgreImporter.h b/code/AssetLib/Ogre/OgreImporter.h index b1a07d4f0..dc8b09051 100644 --- a/code/AssetLib/Ogre/OgreImporter.h +++ b/code/AssetLib/Ogre/OgreImporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Ogre/OgreMaterial.cpp b/code/AssetLib/Ogre/OgreMaterial.cpp index 6da82f89c..7478a80a9 100644 --- a/code/AssetLib/Ogre/OgreMaterial.cpp +++ b/code/AssetLib/Ogre/OgreMaterial.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Ogre/OgreParsingUtils.h b/code/AssetLib/Ogre/OgreParsingUtils.h index 0925c0305..60dd5cf76 100644 --- a/code/AssetLib/Ogre/OgreParsingUtils.h +++ b/code/AssetLib/Ogre/OgreParsingUtils.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Ogre/OgreStructs.cpp b/code/AssetLib/Ogre/OgreStructs.cpp index a2d861172..d63dd934a 100644 --- a/code/AssetLib/Ogre/OgreStructs.cpp +++ b/code/AssetLib/Ogre/OgreStructs.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Ogre/OgreStructs.h b/code/AssetLib/Ogre/OgreStructs.h index 1d43b09e9..be9ffa02d 100644 --- a/code/AssetLib/Ogre/OgreStructs.h +++ b/code/AssetLib/Ogre/OgreStructs.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Ogre/OgreXmlSerializer.cpp b/code/AssetLib/Ogre/OgreXmlSerializer.cpp index 70671f251..545107ea3 100644 --- a/code/AssetLib/Ogre/OgreXmlSerializer.cpp +++ b/code/AssetLib/Ogre/OgreXmlSerializer.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Ogre/OgreXmlSerializer.h b/code/AssetLib/Ogre/OgreXmlSerializer.h index 1bd47e771..406681f55 100644 --- a/code/AssetLib/Ogre/OgreXmlSerializer.h +++ b/code/AssetLib/Ogre/OgreXmlSerializer.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/OpenGEX/OpenGEXExporter.cpp b/code/AssetLib/OpenGEX/OpenGEXExporter.cpp index 9f6994734..328c3c460 100644 --- a/code/AssetLib/OpenGEX/OpenGEXExporter.cpp +++ b/code/AssetLib/OpenGEX/OpenGEXExporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/OpenGEX/OpenGEXExporter.h b/code/AssetLib/OpenGEX/OpenGEXExporter.h index dc24fdc16..cc22c7d21 100644 --- a/code/AssetLib/OpenGEX/OpenGEXExporter.h +++ b/code/AssetLib/OpenGEX/OpenGEXExporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/OpenGEX/OpenGEXImporter.cpp b/code/AssetLib/OpenGEX/OpenGEXImporter.cpp index 94cf47e73..c8e47933d 100644 --- a/code/AssetLib/OpenGEX/OpenGEXImporter.cpp +++ b/code/AssetLib/OpenGEX/OpenGEXImporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -66,135 +66,135 @@ static const aiImporterDesc desc = { }; namespace Grammar { -static const std::string MetricType = "Metric"; -static const std::string Metric_DistanceType = "distance"; -static const std::string Metric_AngleType = "angle"; -static const std::string Metric_TimeType = "time"; -static const std::string Metric_UpType = "up"; -static const std::string NameType = "Name"; -static const std::string ObjectRefType = "ObjectRef"; -static const std::string MaterialRefType = "MaterialRef"; -static const std::string MetricKeyType = "key"; -static const std::string GeometryNodeType = "GeometryNode"; -static const std::string CameraNodeType = "CameraNode"; -static const std::string LightNodeType = "LightNode"; -static const std::string GeometryObjectType = "GeometryObject"; -static const std::string CameraObjectType = "CameraObject"; -static const std::string LightObjectType = "LightObject"; -static const std::string TransformType = "Transform"; -static const std::string MeshType = "Mesh"; -static const std::string VertexArrayType = "VertexArray"; -static const std::string IndexArrayType = "IndexArray"; -static const std::string MaterialType = "Material"; -static const std::string ColorType = "Color"; -static const std::string ParamType = "Param"; -static const std::string TextureType = "Texture"; -static const std::string AttenType = "Atten"; + static const char* MetricType = "Metric"; + static const char *Metric_DistanceType = "distance"; + static const char *Metric_AngleType = "angle"; + static const char *Metric_TimeType = "time"; + static const char *Metric_UpType = "up"; + static const char *NameType = "Name"; + static const char *ObjectRefType = "ObjectRef"; + static const char *MaterialRefType = "MaterialRef"; + static const char *MetricKeyType = "key"; + static const char *GeometryNodeType = "GeometryNode"; + static const char *CameraNodeType = "CameraNode"; + static const char *LightNodeType = "LightNode"; + static const char *GeometryObjectType = "GeometryObject"; + static const char *CameraObjectType = "CameraObject"; + static const char *LightObjectType = "LightObject"; + static const char *TransformType = "Transform"; + static const char *MeshType = "Mesh"; + static const char *VertexArrayType = "VertexArray"; + static const char *IndexArrayType = "IndexArray"; + static const char *MaterialType = "Material"; + static const char *ColorType = "Color"; + static const char *ParamType = "Param"; + static const char *TextureType = "Texture"; + static const char *AttenType = "Atten"; -static const std::string DiffuseColorToken = "diffuse"; -static const std::string SpecularColorToken = "specular"; -static const std::string EmissionColorToken = "emission"; + static const char *DiffuseColorToken = "diffuse"; + static const char *SpecularColorToken = "specular"; + static const char *EmissionColorToken = "emission"; -static const std::string DiffuseTextureToken = "diffuse"; -static const std::string DiffuseSpecularTextureToken = "specular"; -static const std::string SpecularPowerTextureToken = "specular_power"; -static const std::string EmissionTextureToken = "emission"; -static const std::string OpacyTextureToken = "opacity"; -static const std::string TransparencyTextureToken = "transparency"; -static const std::string NormalTextureToken = "normal"; + static const char *DiffuseTextureToken = "diffuse"; + static const char *DiffuseSpecularTextureToken = "specular"; + static const char *SpecularPowerTextureToken = "specular_power"; + static const char *EmissionTextureToken = "emission"; + static const char *OpacyTextureToken = "opacity"; + static const char *TransparencyTextureToken = "transparency"; + static const char *NormalTextureToken = "normal"; -enum TokenType { - NoneType = -1, - MetricToken, - NameToken, - ObjectRefToken, - MaterialRefToken, - MetricKeyToken, - GeometryNodeToken, - CameraNodeToken, - LightNodeToken, - GeometryObjectToken, - CameraObjectToken, - LightObjectToken, - TransformToken, - MeshToken, - VertexArrayToken, - IndexArrayToken, - MaterialToken, - ColorToken, - ParamToken, - TextureToken, - AttenToken -}; + enum TokenType { + NoneType = -1, + MetricToken, + NameToken, + ObjectRefToken, + MaterialRefToken, + MetricKeyToken, + GeometryNodeToken, + CameraNodeToken, + LightNodeToken, + GeometryObjectToken, + CameraObjectToken, + LightObjectToken, + TransformToken, + MeshToken, + VertexArrayToken, + IndexArrayToken, + MaterialToken, + ColorToken, + ParamToken, + TextureToken, + AttenToken + }; -static const std::string ValidMetricToken[4] = { - Metric_DistanceType, - Metric_AngleType, - Metric_TimeType, - Metric_UpType -}; + static const std::string ValidMetricToken[4] = { + Metric_DistanceType, + Metric_AngleType, + Metric_TimeType, + Metric_UpType + }; -static int isValidMetricType(const char *token) { - if (nullptr == token) { - return false; - } - - int idx(-1); - for (size_t i = 0; i < 4; i++) { - if (ValidMetricToken[i] == token) { - idx = (int)i; - break; + static int isValidMetricType(const char *token) { + if (nullptr == token) { + return false; } + + int idx(-1); + for (size_t i = 0; i < 4; i++) { + if (ValidMetricToken[i] == token) { + idx = (int)i; + break; + } + } + + return idx; } - return idx; -} + static TokenType matchTokenType(const char *tokenType) { + if (MetricType == tokenType) { + return MetricToken; + } else if (NameType == tokenType) { + return NameToken; + } else if (ObjectRefType == tokenType) { + return ObjectRefToken; + } else if (MaterialRefType == tokenType) { + return MaterialRefToken; + } else if (MetricKeyType == tokenType) { + return MetricKeyToken; + } else if (GeometryNodeType == tokenType) { + return GeometryNodeToken; + } else if (CameraNodeType == tokenType) { + return CameraNodeToken; + } else if (LightNodeType == tokenType) { + return LightNodeToken; + } else if (GeometryObjectType == tokenType) { + return GeometryObjectToken; + } else if (CameraObjectType == tokenType) { + return CameraObjectToken; + } else if (LightObjectType == tokenType) { + return LightObjectToken; + } else if (TransformType == tokenType) { + return TransformToken; + } else if (MeshType == tokenType) { + return MeshToken; + } else if (VertexArrayType == tokenType) { + return VertexArrayToken; + } else if (IndexArrayType == tokenType) { + return IndexArrayToken; + } else if (MaterialType == tokenType) { + return MaterialToken; + } else if (ColorType == tokenType) { + return ColorToken; + } else if (ParamType == tokenType) { + return ParamToken; + } else if (TextureType == tokenType) { + return TextureToken; + } else if (AttenType == tokenType) { + return AttenToken; + } -static TokenType matchTokenType(const char *tokenType) { - if (MetricType == tokenType) { - return MetricToken; - } else if (NameType == tokenType) { - return NameToken; - } else if (ObjectRefType == tokenType) { - return ObjectRefToken; - } else if (MaterialRefType == tokenType) { - return MaterialRefToken; - } else if (MetricKeyType == tokenType) { - return MetricKeyToken; - } else if (GeometryNodeType == tokenType) { - return GeometryNodeToken; - } else if (CameraNodeType == tokenType) { - return CameraNodeToken; - } else if (LightNodeType == tokenType) { - return LightNodeToken; - } else if (GeometryObjectType == tokenType) { - return GeometryObjectToken; - } else if (CameraObjectType == tokenType) { - return CameraObjectToken; - } else if (LightObjectType == tokenType) { - return LightObjectToken; - } else if (TransformType == tokenType) { - return TransformToken; - } else if (MeshType == tokenType) { - return MeshToken; - } else if (VertexArrayType == tokenType) { - return VertexArrayToken; - } else if (IndexArrayType == tokenType) { - return IndexArrayToken; - } else if (MaterialType == tokenType) { - return MaterialToken; - } else if (ColorType == tokenType) { - return ColorToken; - } else if (ParamType == tokenType) { - return ParamToken; - } else if (TextureType == tokenType) { - return TextureToken; - } else if (AttenType == tokenType) { - return AttenToken; + return NoneType; } - - return NoneType; -} } // Namespace Grammar namespace Assimp { @@ -290,16 +290,9 @@ OpenGEXImporter::~OpenGEXImporter() { } //------------------------------------------------------------------------------------------------ -bool OpenGEXImporter::CanRead(const std::string &file, IOSystem *pIOHandler, bool checkSig) const { - bool canRead(false); - if (!checkSig) { - canRead = SimpleExtensionCheck(file, "ogex"); - } else { - static const char * const token[] = { "Metric", "GeometryNode", "VertexArray (attrib", "IndexArray" }; - canRead = SearchFileHeaderForToken(pIOHandler, file, token, 4); - } - - return canRead; +bool OpenGEXImporter::CanRead(const std::string &file, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const char *tokens[] = { "Metric", "GeometryNode", "VertexArray (attrib", "IndexArray" }; + return SearchFileHeaderForToken(pIOHandler, file, tokens, AI_COUNT_OF(tokens)); } //------------------------------------------------------------------------------------------------ @@ -854,7 +847,7 @@ void OpenGEXImporter::handleVertexArrayNode(ODDLParser::DDLNode *node, aiScene * return; } - Property *prop(node->getProperties()); + Property *prop = node->getProperties(); if (nullptr != prop) { std::string propName, propKey; propId2StdString(prop, propName, propKey); @@ -1085,6 +1078,8 @@ void OpenGEXImporter::handleTextureNode(ODDLParser::DDLNode *node, aiScene * /*p tex.Set(val->getString()); if (prop->m_value->getString() == Grammar::DiffuseTextureToken) { m_currentMaterial->AddProperty(&tex, AI_MATKEY_TEXTURE_DIFFUSE(0)); + } else if (prop->m_value->getString() == Grammar::DiffuseSpecularTextureToken) { + m_currentMaterial->AddProperty(&tex, AI_MATKEY_TEXTURE_SPECULAR(0)); } else if (prop->m_value->getString() == Grammar::SpecularPowerTextureToken) { m_currentMaterial->AddProperty(&tex, AI_MATKEY_TEXTURE_SPECULAR(0)); } else if (prop->m_value->getString() == Grammar::EmissionTextureToken) { diff --git a/code/AssetLib/OpenGEX/OpenGEXImporter.h b/code/AssetLib/OpenGEX/OpenGEXImporter.h index 92841b5d3..fca3eb1d5 100644 --- a/code/AssetLib/OpenGEX/OpenGEXImporter.h +++ b/code/AssetLib/OpenGEX/OpenGEXImporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/OpenGEX/OpenGEXStructs.h b/code/AssetLib/OpenGEX/OpenGEXStructs.h index a6d7514aa..5f845483d 100644 --- a/code/AssetLib/OpenGEX/OpenGEXStructs.h +++ b/code/AssetLib/OpenGEX/OpenGEXStructs.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Ply/PlyExporter.cpp b/code/AssetLib/Ply/PlyExporter.cpp index ccd9bde99..a98b83f67 100644 --- a/code/AssetLib/Ply/PlyExporter.cpp +++ b/code/AssetLib/Ply/PlyExporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Ply/PlyExporter.h b/code/AssetLib/Ply/PlyExporter.h index 1d2acd6b0..ff3a54cb6 100644 --- a/code/AssetLib/Ply/PlyExporter.h +++ b/code/AssetLib/Ply/PlyExporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Ply/PlyLoader.cpp b/code/AssetLib/Ply/PlyLoader.cpp index b58ef1ef2..6cf1a1c74 100644 --- a/code/AssetLib/Ply/PlyLoader.cpp +++ b/code/AssetLib/Ply/PlyLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -100,24 +100,9 @@ PLYImporter::~PLYImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool PLYImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - const std::string extension = GetExtension(pFile); - - if (extension == "ply") { - return true; - } - - if (!extension.length() || checkSig) { - if (!pIOHandler) { - return true; - } - static const char * const tokens[] = { - "ply" - }; - return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1); - } - - return false; +bool PLYImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const char *tokens[] = { "ply" }; + return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/Ply/PlyLoader.h b/code/AssetLib/Ply/PlyLoader.h index 4f50400dd..e29da1db6 100644 --- a/code/AssetLib/Ply/PlyLoader.h +++ b/code/AssetLib/Ply/PlyLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Ply/PlyParser.cpp b/code/AssetLib/Ply/PlyParser.cpp index 8af0edfdc..df93d5a57 100644 --- a/code/AssetLib/Ply/PlyParser.cpp +++ b/code/AssetLib/Ply/PlyParser.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Ply/PlyParser.h b/code/AssetLib/Ply/PlyParser.h index dd1ce900a..86349294e 100644 --- a/code/AssetLib/Ply/PlyParser.h +++ b/code/AssetLib/Ply/PlyParser.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Q3BSP/Q3BSPFileData.h b/code/AssetLib/Q3BSP/Q3BSPFileData.h index c288af2fc..8ccee0b0a 100644 --- a/code/AssetLib/Q3BSP/Q3BSPFileData.h +++ b/code/AssetLib/Q3BSP/Q3BSPFileData.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp b/code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp index 897bcb994..db9a4a02f 100644 --- a/code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp +++ b/code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -156,12 +156,11 @@ Q3BSPFileImporter::~Q3BSPFileImporter() { } // ------------------------------------------------------------------------------------------------ -// Returns true, if the loader can read this. -bool Q3BSPFileImporter::CanRead(const std::string &rFile, IOSystem * /*pIOHandler*/, bool checkSig) const { +// Returns true if the loader can read this. +bool Q3BSPFileImporter::CanRead(const std::string &filename, IOSystem * /*pIOHandler*/, bool checkSig) const { if (!checkSig) { - return SimpleExtensionCheck(rFile, "pk3", "bsp"); + return SimpleExtensionCheck(filename, "pk3", "bsp"); } - return false; } diff --git a/code/AssetLib/Q3BSP/Q3BSPFileImporter.h b/code/AssetLib/Q3BSP/Q3BSPFileImporter.h index d1f420770..fdcfff876 100644 --- a/code/AssetLib/Q3BSP/Q3BSPFileImporter.h +++ b/code/AssetLib/Q3BSP/Q3BSPFileImporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Q3BSP/Q3BSPFileParser.cpp b/code/AssetLib/Q3BSP/Q3BSPFileParser.cpp index 45b2effb3..910da5b36 100644 --- a/code/AssetLib/Q3BSP/Q3BSPFileParser.cpp +++ b/code/AssetLib/Q3BSP/Q3BSPFileParser.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Q3BSP/Q3BSPFileParser.h b/code/AssetLib/Q3BSP/Q3BSPFileParser.h index 6a6f0e326..15cc751cc 100644 --- a/code/AssetLib/Q3BSP/Q3BSPFileParser.h +++ b/code/AssetLib/Q3BSP/Q3BSPFileParser.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Q3D/Q3DLoader.cpp b/code/AssetLib/Q3D/Q3DLoader.cpp index fe8541a5d..c773bbfcd 100644 --- a/code/AssetLib/Q3D/Q3DLoader.cpp +++ b/code/AssetLib/Q3D/Q3DLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -84,18 +84,9 @@ Q3DImporter::~Q3DImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool Q3DImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - const std::string extension = GetExtension(pFile); - - if (extension == "q3s" || extension == "q3o") - return true; - else if (!extension.length() || checkSig) { - if (!pIOHandler) - return true; - static const char * const tokens[] = { "quick3Do", "quick3Ds" }; - return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 2); - } - return false; +bool Q3DImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const char *tokens[] = { "quick3Do", "quick3Ds" }; + return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/Q3D/Q3DLoader.h b/code/AssetLib/Q3D/Q3DLoader.h index c48427098..54af86dc2 100644 --- a/code/AssetLib/Q3D/Q3DLoader.h +++ b/code/AssetLib/Q3D/Q3DLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Raw/RawLoader.cpp b/code/AssetLib/Raw/RawLoader.cpp index 8e57912f5..bfd2e6d6e 100644 --- a/code/AssetLib/Raw/RawLoader.cpp +++ b/code/AssetLib/Raw/RawLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -84,8 +84,8 @@ RAWImporter::~RAWImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool RAWImporter::CanRead(const std::string &pFile, IOSystem * /*pIOHandler*/, bool /*checkSig*/) const { - return SimpleExtensionCheck(pFile, "raw"); +bool RAWImporter::CanRead(const std::string &filename, IOSystem * /*pIOHandler*/, bool /*checkSig*/) const { + return SimpleExtensionCheck(filename, "raw"); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/Raw/RawLoader.h b/code/AssetLib/Raw/RawLoader.h index 8941a2d19..6e4c4d110 100644 --- a/code/AssetLib/Raw/RawLoader.h +++ b/code/AssetLib/Raw/RawLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/SIB/SIBImporter.cpp b/code/AssetLib/SIB/SIBImporter.cpp index 0321e7064..7b66afa44 100644 --- a/code/AssetLib/SIB/SIBImporter.cpp +++ b/code/AssetLib/SIB/SIBImporter.cpp @@ -3,9 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team - - +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -61,7 +59,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifdef ASSIMP_USE_HUNTER #include #else -//# include "../contrib/ConvertUTF/ConvertUTF.h" #include "../contrib/utf8cpp/source/utf8.h" #endif #include @@ -217,8 +214,8 @@ SIBImporter::~SIBImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool SIBImporter::CanRead(const std::string &pFile, IOSystem * /*pIOHandler*/, bool /*checkSig*/) const { - return SimpleExtensionCheck(pFile, "sib"); +bool SIBImporter::CanRead(const std::string &filename, IOSystem * /*pIOHandler*/, bool /*checkSig*/) const { + return SimpleExtensionCheck(filename, "sib"); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/SIB/SIBImporter.h b/code/AssetLib/SIB/SIBImporter.h index 30c188a6c..2b197ddca 100644 --- a/code/AssetLib/SIB/SIBImporter.h +++ b/code/AssetLib/SIB/SIBImporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/SMD/SMDLoader.cpp b/code/AssetLib/SMD/SMDLoader.cpp index 8d9c745b1..46fd968c8 100644 --- a/code/AssetLib/SMD/SMDLoader.cpp +++ b/code/AssetLib/SMD/SMDLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -81,15 +81,15 @@ static const aiImporterDesc desc = { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer -SMDImporter::SMDImporter() -: configFrameID() -, mBuffer() -, pScene( nullptr ) -, iFileSize( 0 ) -, iSmallestFrame( INT_MAX ) -, dLengthOfAnim( 0.0 ) -, bHasUVs(false ) -, iLineNumber((unsigned int)-1) { +SMDImporter::SMDImporter() : + configFrameID(), + mBuffer(), + pScene( nullptr ), + iFileSize( 0 ), + iSmallestFrame( INT_MAX ), + dLengthOfAnim( 0.0 ), + bHasUVs(false ), + iLineNumber((unsigned int)-1) { // empty } @@ -101,9 +101,8 @@ SMDImporter::~SMDImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool SMDImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, bool) const { - // fixme: auto format detection - return SimpleExtensionCheck(pFile,"smd","vta"); +bool SMDImporter::CanRead( const std::string& filename, IOSystem* /*pIOHandler*/, bool) const { + return SimpleExtensionCheck(filename, "smd", "vta"); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/SMD/SMDLoader.h b/code/AssetLib/SMD/SMDLoader.h index b905fcc87..db882a241 100644 --- a/code/AssetLib/SMD/SMDLoader.h +++ b/code/AssetLib/SMD/SMDLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/STEPParser/STEPFileEncoding.cpp b/code/AssetLib/STEPParser/STEPFileEncoding.cpp index 6329e3b26..d4456e674 100644 --- a/code/AssetLib/STEPParser/STEPFileEncoding.cpp +++ b/code/AssetLib/STEPParser/STEPFileEncoding.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/STEPParser/STEPFileEncoding.h b/code/AssetLib/STEPParser/STEPFileEncoding.h index b57f61769..950c9b3e2 100644 --- a/code/AssetLib/STEPParser/STEPFileEncoding.h +++ b/code/AssetLib/STEPParser/STEPFileEncoding.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/STEPParser/STEPFileReader.cpp b/code/AssetLib/STEPParser/STEPFileReader.cpp index 09a596aa4..2bcfa1755 100644 --- a/code/AssetLib/STEPParser/STEPFileReader.cpp +++ b/code/AssetLib/STEPParser/STEPFileReader.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/STEPParser/STEPFileReader.h b/code/AssetLib/STEPParser/STEPFileReader.h index 0c70e78d3..8a57937c0 100644 --- a/code/AssetLib/STEPParser/STEPFileReader.h +++ b/code/AssetLib/STEPParser/STEPFileReader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/STL/STLExporter.cpp b/code/AssetLib/STL/STLExporter.cpp index 59c6148ee..9bbc2063f 100644 --- a/code/AssetLib/STL/STLExporter.cpp +++ b/code/AssetLib/STL/STLExporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/STL/STLExporter.h b/code/AssetLib/STL/STLExporter.h index a6b8bf2bd..066dcfefd 100644 --- a/code/AssetLib/STL/STLExporter.h +++ b/code/AssetLib/STL/STLExporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/STL/STLLoader.cpp b/code/AssetLib/STL/STLLoader.cpp index 602e07106..8de57f1ee 100644 --- a/code/AssetLib/STL/STLLoader.cpp +++ b/code/AssetLib/STL/STLLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -140,22 +140,9 @@ STLImporter::~STLImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool STLImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - const std::string extension = GetExtension(pFile); - - if (extension == "stl") { - return true; - } - - if (!extension.length() || checkSig) { - if (!pIOHandler) { - return true; - } - static const char * const tokens[] = { "STL", "solid" }; - return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 2); - } - - return false; +bool STLImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const char *tokens[] = { "STL", "solid" }; + return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/STL/STLLoader.h b/code/AssetLib/STL/STLLoader.h index 4fac1f697..a340abe6b 100644 --- a/code/AssetLib/STL/STLLoader.h +++ b/code/AssetLib/STL/STLLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Step/StepExporter.cpp b/code/AssetLib/Step/StepExporter.cpp index 1228c72ea..e13c9edab 100644 --- a/code/AssetLib/Step/StepExporter.cpp +++ b/code/AssetLib/Step/StepExporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Step/StepExporter.h b/code/AssetLib/Step/StepExporter.h index c7e4cab38..a02262659 100644 --- a/code/AssetLib/Step/StepExporter.h +++ b/code/AssetLib/Step/StepExporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Terragen/TerragenLoader.cpp b/code/AssetLib/Terragen/TerragenLoader.cpp index a4d8590d5..c9c91db8f 100644 --- a/code/AssetLib/Terragen/TerragenLoader.cpp +++ b/code/AssetLib/Terragen/TerragenLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -81,27 +81,9 @@ TerragenImporter::~TerragenImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool TerragenImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - // check file extension - std::string extension = GetExtension(pFile); - - if (extension == "ter") - return true; - - if (!extension.length() || checkSig) { - /* If CanRead() is called in order to check whether we - * support a specific file extension in general pIOHandler - * might be nullptr and it's our duty to return true here. - */ - if (!pIOHandler) { - return true; - } - - static const char * const tokens[] = { "terragen" }; - return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1); - } - - return false; +bool TerragenImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const char *tokens[] = { "terragen" }; + return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/Terragen/TerragenLoader.h b/code/AssetLib/Terragen/TerragenLoader.h index 126cf64ad..cb9ff9166 100644 --- a/code/AssetLib/Terragen/TerragenLoader.h +++ b/code/AssetLib/Terragen/TerragenLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/Unreal/UnrealLoader.cpp b/code/AssetLib/Unreal/UnrealLoader.cpp index d9d3454e4..661952b3d 100644 --- a/code/AssetLib/Unreal/UnrealLoader.cpp +++ b/code/AssetLib/Unreal/UnrealLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -74,7 +74,7 @@ namespace Unreal { 3 = Masked two-sided 4 = Modulation blended two-sided 8 = Placeholder triangle for weapon positioning (invisible) - */ +*/ enum MeshFlags { MF_NORMAL_OS = 0, MF_NORMAL_TS = 1, @@ -168,16 +168,20 @@ static const aiImporterDesc desc = { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer UnrealImporter::UnrealImporter() : - mConfigFrameID(0), mConfigHandleFlags(true) {} + mConfigFrameID(0), mConfigHandleFlags(true) { + // empty +} // ------------------------------------------------------------------------------------------------ // Destructor, private as well -UnrealImporter::~UnrealImporter() {} +UnrealImporter::~UnrealImporter() { + // empty +} // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool UnrealImporter::CanRead(const std::string &pFile, IOSystem * /*pIOHandler*/, bool /*checkSig*/) const { - return SimpleExtensionCheck(pFile, "3d", "uc"); +bool UnrealImporter::CanRead(const std::string & filename, IOSystem * /*pIOHandler*/, bool /*checkSig*/) const { + return SimpleExtensionCheck(filename, "3d", "uc"); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/Unreal/UnrealLoader.h b/code/AssetLib/Unreal/UnrealLoader.h index d6c121460..a931a86dd 100644 --- a/code/AssetLib/Unreal/UnrealLoader.h +++ b/code/AssetLib/Unreal/UnrealLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/X/XFileExporter.cpp b/code/AssetLib/X/XFileExporter.cpp index b95cb7abf..f0b1608c1 100644 --- a/code/AssetLib/X/XFileExporter.cpp +++ b/code/AssetLib/X/XFileExporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/X/XFileExporter.h b/code/AssetLib/X/XFileExporter.h index 620d282b6..1d9a5ae77 100644 --- a/code/AssetLib/X/XFileExporter.h +++ b/code/AssetLib/X/XFileExporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/X/XFileHelper.h b/code/AssetLib/X/XFileHelper.h index ad17cd951..3830eb483 100644 --- a/code/AssetLib/X/XFileHelper.h +++ b/code/AssetLib/X/XFileHelper.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/X/XFileImporter.cpp b/code/AssetLib/X/XFileImporter.cpp index 8a3047915..d23eb576c 100644 --- a/code/AssetLib/X/XFileImporter.cpp +++ b/code/AssetLib/X/XFileImporter.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -88,17 +88,9 @@ XFileImporter::~XFileImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool XFileImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const { - std::string extension = GetExtension(pFile); - if(extension == "x") { - return true; - } - if (!extension.length() || checkSig) { - uint32_t token[1]; - token[0] = AI_MAKE_MAGIC("xof "); - return CheckMagicToken(pIOHandler,pFile,token,1,0); - } - return false; +bool XFileImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool /*checkSig*/) const { + static const uint32_t token[] = { AI_MAKE_MAGIC("xof ") }; + return CheckMagicToken(pIOHandler,pFile,token,AI_COUNT_OF(token)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/X/XFileImporter.h b/code/AssetLib/X/XFileImporter.h index 1dc1b140e..648139002 100644 --- a/code/AssetLib/X/XFileImporter.h +++ b/code/AssetLib/X/XFileImporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/X/XFileParser.cpp b/code/AssetLib/X/XFileParser.cpp index 494ef5b2b..adcb7c8f4 100644 --- a/code/AssetLib/X/XFileParser.cpp +++ b/code/AssetLib/X/XFileParser.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/AssetLib/X/XFileParser.h b/code/AssetLib/X/XFileParser.h index 175fbb06c..36eac2ada 100644 --- a/code/AssetLib/X/XFileParser.h +++ b/code/AssetLib/X/XFileParser.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/X3D/X3DImporter.cpp b/code/AssetLib/X3D/X3DImporter.cpp index b8b9d250e..b34f361ae 100644 --- a/code/AssetLib/X3D/X3DImporter.cpp +++ b/code/AssetLib/X3D/X3DImporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -264,6 +264,9 @@ void X3DImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy //search for root node element mNodeElementCur = NodeElement_List.front(); + if (mNodeElementCur == nullptr) { + return; + } while (mNodeElementCur->Parent != nullptr) { mNodeElementCur = mNodeElementCur->Parent; } @@ -480,6 +483,6 @@ void X3DImporter::ParseHelper_Node_Exit() { } } -#endif // !ASSIMP_BUILD_NO_X3D_IMPORTER - } // namespace Assimp + +#endif // !ASSIMP_BUILD_NO_X3D_IMPORTER diff --git a/code/AssetLib/X3D/X3DImporter.hpp b/code/AssetLib/X3D/X3DImporter.hpp index adb73e6f8..d9aed70d8 100644 --- a/code/AssetLib/X3D/X3DImporter.hpp +++ b/code/AssetLib/X3D/X3DImporter.hpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/X3D/X3DImporter_Geometry3D.cpp b/code/AssetLib/X3D/X3DImporter_Geometry3D.cpp index 2db62dc64..b9fc2a4d8 100644 --- a/code/AssetLib/X3D/X3DImporter_Geometry3D.cpp +++ b/code/AssetLib/X3D/X3DImporter_Geometry3D.cpp @@ -879,7 +879,7 @@ void X3DImporter::readSphere(XmlNode &node) { X3DNodeElementBase *ne(nullptr); MACRO_ATTRREAD_CHECKUSEDEF_RET(node, def, use); - XmlParser::getFloatAttribute(node, "radius", radius); + XmlParser::getRealAttribute(node, "radius", radius); XmlParser::getBoolAttribute(node, "solid", solid); // if "USE" defined then find already defined element. diff --git a/code/AssetLib/XGL/XGLLoader.cpp b/code/AssetLib/XGL/XGLLoader.cpp index a4d9835c5..b003f852a 100644 --- a/code/AssetLib/XGL/XGLLoader.cpp +++ b/code/AssetLib/XGL/XGLLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -104,25 +104,9 @@ XGLImporter::~XGLImporter() { // ------------------------------------------------------------------------------------------------ // Returns whether the class can handle the format of the given file. -bool XGLImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { - /* NOTE: A simple check for the file extension is not enough - * here. XGL and ZGL are ok, but xml is too generic - * and might be collada as well. So open the file and - * look for typical signal tokens. - */ - const std::string extension = GetExtension(pFile); - - if (extension == "xgl" || extension == "zgl") { - return true; - } - - if (extension == "xml" || checkSig) { - ai_assert(pIOHandler != nullptr); - static const char * const tokens[] = { "", "", "" }; - return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 3); - } - - return false; +bool XGLImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const { + static const char *tokens[] = { "", "", "" }; + return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens)); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/XGL/XGLLoader.h b/code/AssetLib/XGL/XGLLoader.h index 93265f6f1..903f114cf 100644 --- a/code/AssetLib/XGL/XGLLoader.h +++ b/code/AssetLib/XGL/XGLLoader.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/glTF/glTFAsset.h b/code/AssetLib/glTF/glTFAsset.h index 5f5945271..4cd11aa4f 100644 --- a/code/AssetLib/glTF/glTFAsset.h +++ b/code/AssetLib/glTF/glTFAsset.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/glTF/glTFAsset.inl b/code/AssetLib/glTF/glTFAsset.inl index 10be7c78e..2b76a30ab 100644 --- a/code/AssetLib/glTF/glTFAsset.inl +++ b/code/AssetLib/glTF/glTFAsset.inl @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Header files, Assimp #include +#include #ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC // Header files, Open3DGC. @@ -194,7 +195,7 @@ inline void Buffer::Read(Value &obj, Asset &r) { if (ParseDataURI(uri, it->GetStringLength(), dataURI)) { if (dataURI.base64) { uint8_t *data = 0; - this->byteLength = Util::DecodeBase64(dataURI.data, dataURI.dataLength, data); + this->byteLength = Base64::Decode(dataURI.data, dataURI.dataLength, data); this->mData.reset(data, std::default_delete()); if (statedLength > 0 && this->byteLength != statedLength) { @@ -513,7 +514,7 @@ inline void Image::Read(Value &obj, Asset &r) { mimeType = dataURI.mediaType; if (dataURI.base64) { uint8_t *ptr = nullptr; - mDataLength = glTFCommon::Util::DecodeBase64(dataURI.data, dataURI.dataLength, ptr); + mDataLength = Base64::Decode(dataURI.data, dataURI.dataLength, ptr); mData.reset(ptr); } } else { diff --git a/code/AssetLib/glTF/glTFAssetWriter.h b/code/AssetLib/glTF/glTFAssetWriter.h index 405ec103c..6dbc42420 100644 --- a/code/AssetLib/glTF/glTFAssetWriter.h +++ b/code/AssetLib/glTF/glTFAssetWriter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/glTF/glTFAssetWriter.inl b/code/AssetLib/glTF/glTFAssetWriter.inl index a8efdd35a..a1265fb4f 100644 --- a/code/AssetLib/glTF/glTFAssetWriter.inl +++ b/code/AssetLib/glTF/glTFAssetWriter.inl @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -39,6 +39,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------- */ +#include + #include #include #include @@ -237,7 +239,7 @@ namespace glTF { else if (img.HasData()) { uri = "data:" + (img.mimeType.empty() ? "application/octet-stream" : img.mimeType); uri += ";base64,"; - glTFCommon::Util::EncodeBase64(img.GetData(), img.GetDataLength(), uri); + Base64::Encode(img.GetData(), img.GetDataLength(), uri); } else { uri = img.uri; diff --git a/code/AssetLib/glTF/glTFCommon.cpp b/code/AssetLib/glTF/glTFCommon.cpp index 6c63c01d9..fea680cd3 100644 --- a/code/AssetLib/glTF/glTFCommon.cpp +++ b/code/AssetLib/glTF/glTFCommon.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -48,84 +48,6 @@ using namespace glTFCommon::Util; namespace Util { -size_t DecodeBase64(const char *in, size_t inLength, uint8_t *&out) { - if (inLength % 4 != 0) { - throw DeadlyImportError("Invalid base64 encoded data: \"", std::string(in, std::min(size_t(32), inLength)), "\", length:", inLength); - } - - if (inLength < 4) { - out = nullptr; - return 0; - } - - int nEquals = int(in[inLength - 1] == '=') + - int(in[inLength - 2] == '='); - - size_t outLength = (inLength * 3) / 4 - nEquals; - out = new uint8_t[outLength]; - memset(out, 0, outLength); - - size_t i, j = 0; - - for (i = 0; i + 4 < inLength; i += 4) { - uint8_t b0 = DecodeCharBase64(in[i]); - uint8_t b1 = DecodeCharBase64(in[i + 1]); - uint8_t b2 = DecodeCharBase64(in[i + 2]); - uint8_t b3 = DecodeCharBase64(in[i + 3]); - - out[j++] = (uint8_t)((b0 << 2) | (b1 >> 4)); - out[j++] = (uint8_t)((b1 << 4) | (b2 >> 2)); - out[j++] = (uint8_t)((b2 << 6) | b3); - } - - { - uint8_t b0 = DecodeCharBase64(in[i]); - uint8_t b1 = DecodeCharBase64(in[i + 1]); - uint8_t b2 = DecodeCharBase64(in[i + 2]); - uint8_t b3 = DecodeCharBase64(in[i + 3]); - - out[j++] = (uint8_t)((b0 << 2) | (b1 >> 4)); - if (b2 < 64) out[j++] = (uint8_t)((b1 << 4) | (b2 >> 2)); - if (b3 < 64) out[j++] = (uint8_t)((b2 << 6) | b3); - } - - return outLength; -} - -void EncodeBase64(const uint8_t *in, size_t inLength, std::string &out) { - size_t outLength = ((inLength + 2) / 3) * 4; - - size_t j = out.size(); - out.resize(j + outLength); - - for (size_t i = 0; i < inLength; i += 3) { - uint8_t b = (in[i] & 0xFC) >> 2; - out[j++] = EncodeCharBase64(b); - - b = (in[i] & 0x03) << 4; - if (i + 1 < inLength) { - b |= (in[i + 1] & 0xF0) >> 4; - out[j++] = EncodeCharBase64(b); - - b = (in[i + 1] & 0x0F) << 2; - if (i + 2 < inLength) { - b |= (in[i + 2] & 0xC0) >> 6; - out[j++] = EncodeCharBase64(b); - - b = in[i + 2] & 0x3F; - out[j++] = EncodeCharBase64(b); - } else { - out[j++] = EncodeCharBase64(b); - out[j++] = '='; - } - } else { - out[j++] = EncodeCharBase64(b); - out[j++] = '='; - out[j++] = '='; - } - } -} - bool ParseDataURI(const char *const_uri, size_t uriLen, DataURI &out) { if (nullptr == const_uri) { return false; diff --git a/code/AssetLib/glTF/glTFCommon.h b/code/AssetLib/glTF/glTFCommon.h index 14b82aa29..caf33009e 100644 --- a/code/AssetLib/glTF/glTFCommon.h +++ b/code/AssetLib/glTF/glTFCommon.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -232,37 +232,6 @@ struct DataURI { //! Check if a uri is a data URI bool ParseDataURI(const char *const_uri, size_t uriLen, DataURI &out); -template -struct DATA { - static const uint8_t tableDecodeBase64[128]; -}; - -template -const uint8_t DATA::tableDecodeBase64[128] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 64, 0, 0, - 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, - 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0 -}; - -inline char EncodeCharBase64(uint8_t b) { - return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="[size_t(b)]; -} - -inline uint8_t DecodeCharBase64(char c) { - if (c & 0x80) { - throw DeadlyImportError("Invalid base64 char value: ", size_t(c)); - } - return DATA::tableDecodeBase64[size_t(c & 0x7F)]; // TODO faster with lookup table or ifs? -} - -size_t DecodeBase64(const char *in, size_t inLength, uint8_t *&out); - -void EncodeBase64(const uint8_t *in, size_t inLength, std::string &out); } // namespace Util #define CHECK_EXT(EXT) \ diff --git a/code/AssetLib/glTF/glTFExporter.cpp b/code/AssetLib/glTF/glTFExporter.cpp index acc195bd9..afcfb1223 100644 --- a/code/AssetLib/glTF/glTFExporter.cpp +++ b/code/AssetLib/glTF/glTFExporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/glTF/glTFExporter.h b/code/AssetLib/glTF/glTFExporter.h index bb9d5f05d..a52695402 100644 --- a/code/AssetLib/glTF/glTFExporter.h +++ b/code/AssetLib/glTF/glTFExporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/glTF/glTFImporter.cpp b/code/AssetLib/glTF/glTFImporter.cpp index 5e072dd2a..81db12eba 100644 --- a/code/AssetLib/glTF/glTFImporter.cpp +++ b/code/AssetLib/glTF/glTFImporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -93,24 +93,14 @@ const aiImporterDesc *glTFImporter::GetInfo() const { } bool glTFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /* checkSig */) const { - const std::string &extension = GetExtension(pFile); - - if (extension != "gltf" && extension != "glb") { + glTF::Asset asset(pIOHandler); + try { + asset.Load(pFile, GetExtension(pFile) == "glb"); + std::string version = asset.asset.version; + return !version.empty() && version[0] == '1'; + } catch (...) { return false; } - - if (pIOHandler) { - glTF::Asset asset(pIOHandler); - try { - asset.Load(pFile, extension == "glb"); - std::string version = asset.asset.version; - return !version.empty() && version[0] == '1'; - } catch (...) { - return false; - } - } - - return false; } inline void SetMaterialColorProperty(std::vector &embeddedTexIdxs, Asset & /*r*/, glTF::TexProperty prop, aiMaterial *mat, diff --git a/code/AssetLib/glTF/glTFImporter.h b/code/AssetLib/glTF/glTFImporter.h index 2df60a463..529da53cc 100644 --- a/code/AssetLib/glTF/glTFImporter.h +++ b/code/AssetLib/glTF/glTFImporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/glTF2/glTF2Asset.h b/code/AssetLib/glTF2/glTF2Asset.h index a9b5d442c..e4fb2dc84 100644 --- a/code/AssetLib/glTF2/glTF2Asset.h +++ b/code/AssetLib/glTF2/glTF2Asset.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/glTF2/glTF2Asset.inl b/code/AssetLib/glTF2/glTF2Asset.inl index f35a47efa..ec481a729 100644 --- a/code/AssetLib/glTF2/glTF2Asset.inl +++ b/code/AssetLib/glTF2/glTF2Asset.inl @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include // clang-format off #ifdef ASSIMP_ENABLE_DRACO @@ -563,7 +564,7 @@ inline void Buffer::Read(Value &obj, Asset &r) { if (ParseDataURI(uri, it->GetStringLength(), dataURI)) { if (dataURI.base64) { uint8_t *data = nullptr; - this->byteLength = glTFCommon::Util::DecodeBase64(dataURI.data, dataURI.dataLength, data); + this->byteLength = Base64::Decode(dataURI.data, dataURI.dataLength, data); this->mData.reset(data, std::default_delete()); if (statedLength > 0 && this->byteLength != statedLength) { @@ -1062,7 +1063,7 @@ inline void Image::Read(Value &obj, Asset &r) { mimeType = dataURI.mediaType; if (dataURI.base64) { uint8_t *ptr = nullptr; - mDataLength = glTFCommon::Util::DecodeBase64(dataURI.data, dataURI.dataLength, ptr); + mDataLength = Base64::Decode(dataURI.data, dataURI.dataLength, ptr); mData.reset(ptr); } } else { diff --git a/code/AssetLib/glTF2/glTF2AssetWriter.h b/code/AssetLib/glTF2/glTF2AssetWriter.h index ce8b4d65e..089a15844 100644 --- a/code/AssetLib/glTF2/glTF2AssetWriter.h +++ b/code/AssetLib/glTF2/glTF2AssetWriter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/AssetLib/glTF2/glTF2AssetWriter.inl b/code/AssetLib/glTF2/glTF2AssetWriter.inl index b91553fbe..0be139595 100644 --- a/code/AssetLib/glTF2/glTF2AssetWriter.inl +++ b/code/AssetLib/glTF2/glTF2AssetWriter.inl @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -39,6 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------- */ +#include #include #include #include @@ -260,7 +261,7 @@ namespace glTF2 { if (img.HasData()) { uri = "data:" + (img.mimeType.empty() ? "application/octet-stream" : img.mimeType); uri += ";base64,"; - glTFCommon::Util::EncodeBase64(img.GetData(), img.GetDataLength(), uri); + Base64::Encode(img.GetData(), img.GetDataLength(), uri); } else { uri = img.uri; diff --git a/code/AssetLib/glTF2/glTF2Exporter.cpp b/code/AssetLib/glTF2/glTF2Exporter.cpp index e5c8b4530..e779a7be4 100644 --- a/code/AssetLib/glTF2/glTF2Exporter.cpp +++ b/code/AssetLib/glTF2/glTF2Exporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -972,7 +972,7 @@ void ExportSkin(Asset &mAsset, const aiMesh *aimesh, Ref &meshRef, Ref 3) { int boneIndexFitted = FitBoneWeight(vertexWeightData[vertexId], vertWeight); - if (boneIndexFitted) { + if (boneIndexFitted != -1) { vertexJointData[vertexId][boneIndexFitted] = static_cast(jointNamesIndex); } }else { @@ -1410,7 +1410,7 @@ void glTF2Exporter::ExportMetadata() { } } -inline Ref GetSamplerInputRef(Asset &asset, std::string &animId, Ref &buffer, std::vector ×) { +inline Ref GetSamplerInputRef(Asset &asset, std::string &animId, Ref &buffer, std::vector ×) { return ExportData(asset, animId, buffer, (unsigned int)times.size(), ×[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_FLOAT); } diff --git a/code/AssetLib/glTF2/glTF2Exporter.h b/code/AssetLib/glTF2/glTF2Exporter.h index 6d70d915e..99425228e 100644 --- a/code/AssetLib/glTF2/glTF2Exporter.h +++ b/code/AssetLib/glTF2/glTF2Exporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -66,7 +66,9 @@ class Ref; } namespace glTF2 { + class Asset; + struct TexProperty; struct TextureInfo; struct NormalTextureInfo; @@ -84,6 +86,7 @@ struct MaterialIOR; typedef float(vec2)[2]; typedef float(vec3)[3]; typedef float(vec4)[4]; + } // namespace glTF2 namespace Assimp { diff --git a/code/AssetLib/glTF2/glTF2Importer.cpp b/code/AssetLib/glTF2/glTF2Importer.cpp index 9ed68d786..1f4cafdda 100644 --- a/code/AssetLib/glTF2/glTF2Importer.cpp +++ b/code/AssetLib/glTF2/glTF2Importer.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -98,7 +98,7 @@ static const aiImporterDesc desc = { glTF2Importer::glTF2Importer() : BaseImporter(), meshOffsets(), - embeddedTexIdxs(), + mEmbeddedTexIdxs(), mScene(nullptr) { // empty } @@ -111,21 +111,21 @@ const aiImporterDesc *glTF2Importer::GetInfo() const { return &desc; } -bool glTF2Importer::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig ) const { - const std::string &extension = GetExtension(pFile); +bool glTF2Importer::CanRead(const std::string &filename, IOSystem *pIOHandler, bool checkSig ) const { + const std::string extension = GetExtension(filename); + if (!checkSig && (extension != "gltf") && (extension != "glb")) { + return false; + } - if (!checkSig && (extension != "gltf") && (extension != "glb")) - return false; - - if (pIOHandler) { - glTF2::Asset asset(pIOHandler); - return asset.CanRead(pFile, extension == "glb"); - } + if (pIOHandler) { + glTF2::Asset asset(pIOHandler); + return asset.CanRead(filename, extension == "glb"); + } return false; } -static aiTextureMapMode ConvertWrappingMode(SamplerWrap gltfWrapMode) { +static inline aiTextureMapMode ConvertWrappingMode(SamplerWrap gltfWrapMode) { switch (gltfWrapMode) { case SamplerWrap::Mirrored_Repeat: return aiTextureMapMode_Mirror; @@ -140,21 +140,21 @@ static aiTextureMapMode ConvertWrappingMode(SamplerWrap gltfWrapMode) { } } -inline void SetMaterialColorProperty(Asset & /*r*/, vec4 &prop, aiMaterial *mat, +static 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, +static 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 &embeddedTexIdxs, Asset & /*r*/, +static void SetMaterialTextureProperty(std::vector &embeddedTexIdxs, Asset & /*r*/, glTF2::TextureInfo prop, aiMaterial *mat, aiTextureType texType, unsigned int texSlot = 0) { if (prop.texture && prop.texture->source) { @@ -371,10 +371,10 @@ void glTF2Importer::ImportMaterials(Asset &r) { mScene->mNumMaterials = numImportedMaterials + 1; mScene->mMaterials = new aiMaterial *[mScene->mNumMaterials]; std::fill(mScene->mMaterials, mScene->mMaterials + mScene->mNumMaterials, nullptr); - mScene->mMaterials[numImportedMaterials] = ImportMaterial(embeddedTexIdxs, r, defaultMaterial); + mScene->mMaterials[numImportedMaterials] = ImportMaterial(mEmbeddedTexIdxs, r, defaultMaterial); for (unsigned int i = 0; i < numImportedMaterials; ++i) { - mScene->mMaterials[i] = ImportMaterial(embeddedTexIdxs, r, r.materials[i]); + mScene->mMaterials[i] = ImportMaterial(mEmbeddedTexIdxs, r, r.materials[i]); } } @@ -802,8 +802,7 @@ void glTF2Importer::ImportMeshes(glTF2::Asset &r) { if (actualNumFaces < nFaces) { ASSIMP_LOG_WARN("Some faces had out-of-range indices. Those faces were dropped."); } - if (actualNumFaces == 0) - { + if (actualNumFaces == 0) { throw DeadlyImportError("Mesh \"", aim->mName.C_Str(), "\" has no faces"); } aim->mNumFaces = actualNumFaces; @@ -843,7 +842,6 @@ void glTF2Importer::ImportCameras(glTF2::Asset &r) { aicam->mLookAt = aiVector3D(0.f, 0.f, -1.f); if (cam.type == Camera::Perspective) { - aicam->mAspect = cam.cameraProperties.perspective.aspectRatio; aicam->mHorizontalFOV = cam.cameraProperties.perspective.yfov * ((aicam->mAspect == 0.f) ? 1.f : aicam->mAspect); aicam->mClipPlaneFar = cam.cameraProperties.perspective.zfar; @@ -862,8 +860,9 @@ void glTF2Importer::ImportCameras(glTF2::Asset &r) { } void glTF2Importer::ImportLights(glTF2::Asset &r) { - if (!r.lights.Size()) + if (!r.lights.Size()) { return; + } const unsigned int numLights = r.lights.Size(); ASSIMP_LOG_DEBUG("Importing ", numLights, " lights"); @@ -1125,8 +1124,8 @@ aiNode *ImportNode(aiScene *pScene, glTF2::Asset &r, std::vector & bone->mNumWeights = static_cast(weights.size()); if (bone->mNumWeights > 0) { - bone->mWeights = new aiVertexWeight[bone->mNumWeights]; - memcpy(bone->mWeights, weights.data(), bone->mNumWeights * sizeof(aiVertexWeight)); + bone->mWeights = new aiVertexWeight[bone->mNumWeights]; + memcpy(bone->mWeights, weights.data(), bone->mNumWeights * sizeof(aiVertexWeight)); } else { // Assimp expects all bones to have at least 1 weight. bone->mWeights = new aiVertexWeight[1]; @@ -1167,8 +1166,7 @@ aiNode *ImportNode(aiScene *pScene, glTF2::Asset &r, std::vector & if (!ainode->mMetaData) { ainode->mMetaData = aiMetadata::Alloc(1); ainode->mMetaData->Set(0, "PBR_LightRange", node.light->range.value); - } - else { + } else { ainode->mMetaData->Add("PBR_LightRange", node.light->range.value); } } @@ -1509,16 +1507,20 @@ void glTF2Importer::ImportAnimations(glTF2::Asset &r) { } } -void glTF2Importer::ImportEmbeddedTextures(glTF2::Asset &r) { - embeddedTexIdxs.resize(r.images.Size(), -1); - - int numEmbeddedTexs = 0; +static unsigned int countEmbeddedTextures(glTF2::Asset &r) { + unsigned int numEmbeddedTexs = 0; for (size_t i = 0; i < r.images.Size(); ++i) { if (r.images[i].HasData()) { numEmbeddedTexs += 1; } } + return numEmbeddedTexs; +} + +void glTF2Importer::ImportEmbeddedTextures(glTF2::Asset &r) { + mEmbeddedTexIdxs.resize(r.images.Size(), -1); + const unsigned int numEmbeddedTexs = countEmbeddedTextures(r); if (numEmbeddedTexs == 0) { return; } @@ -1536,7 +1538,7 @@ void glTF2Importer::ImportEmbeddedTextures(glTF2::Asset &r) { } int idx = mScene->mNumTextures++; - embeddedTexIdxs[i] = idx; + mEmbeddedTexIdxs[i] = idx; aiTexture *tex = mScene->mTextures[idx] = new aiTexture(); @@ -1597,7 +1599,7 @@ void glTF2Importer::InternReadFile(const std::string &pFile, aiScene *pScene, IO // clean all member arrays meshOffsets.clear(); - embeddedTexIdxs.clear(); + mEmbeddedTexIdxs.clear(); this->mScene = pScene; diff --git a/code/AssetLib/glTF2/glTF2Importer.h b/code/AssetLib/glTF2/glTF2Importer.h index 23830c0eb..831bcd7d2 100644 --- a/code/AssetLib/glTF2/glTF2Importer.h +++ b/code/AssetLib/glTF2/glTF2Importer.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -79,7 +79,7 @@ private: private: std::vector meshOffsets; - std::vector embeddedTexIdxs; + std::vector mEmbeddedTexIdxs; aiScene *mScene; /// An instance of rapidjson::IRemoteSchemaDocumentProvider diff --git a/code/CApi/AssimpCExport.cpp b/code/CApi/AssimpCExport.cpp index b06c93568..5e43958d0 100644 --- a/code/CApi/AssimpCExport.cpp +++ b/code/CApi/AssimpCExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/CApi/CInterfaceIOWrapper.cpp b/code/CApi/CInterfaceIOWrapper.cpp index 245f3bc7a..579545ecc 100644 --- a/code/CApi/CInterfaceIOWrapper.cpp +++ b/code/CApi/CInterfaceIOWrapper.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/CApi/CInterfaceIOWrapper.h b/code/CApi/CInterfaceIOWrapper.h index de3dc196a..768be3746 100644 --- a/code/CApi/CInterfaceIOWrapper.h +++ b/code/CApi/CInterfaceIOWrapper.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index e45bf8a2a..7ce933585 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -1,7 +1,7 @@ # Open Asset Import Library (assimp) # ---------------------------------------------------------------------- # -# Copyright (c) 2006-2021, assimp team +# Copyright (c) 2006-2022, assimp team # # All rights reserved. # @@ -142,6 +142,7 @@ SET( PUBLIC_HEADERS ${HEADER_PATH}/MathFunctions.h ${HEADER_PATH}/Exceptional.h ${HEADER_PATH}/ByteSwapper.h + ${HEADER_PATH}/Base64.hpp ) SET( Core_SRCS @@ -174,6 +175,7 @@ SET( Common_SRCS Common/ImporterRegistry.cpp Common/DefaultProgressHandler.h Common/DefaultIOStream.cpp + Common/IOSystem.cpp Common/DefaultIOSystem.cpp Common/ZipArchiveIOSystem.cpp Common/PolyTools.h @@ -201,6 +203,7 @@ SET( Common_SRCS Common/material.cpp Common/AssertHandler.cpp Common/Exceptional.cpp + Common/Base64.cpp ) SOURCE_GROUP(Common FILES ${Common_SRCS}) @@ -373,6 +376,12 @@ ADD_ASSIMP_IMPORTER( IRRMESH AssetLib/Irr/IRRShared.h ) +ADD_ASSIMP_IMPORTER( IQM + AssetLib/IQM/IQMImporter.cpp + AssetLib/IQM/iqm.h + AssetLib/IQM/IQMImporter.h +) + ADD_ASSIMP_IMPORTER( IRR AssetLib/Irr/IRRLoader.cpp AssetLib/Irr/IRRLoader.h @@ -557,7 +566,7 @@ ADD_ASSIMP_IMPORTER( IFC if (ASSIMP_BUILD_IFC_IMPORTER) if (MSVC) set_source_files_properties(Importer/IFC/IFCReaderGen1_2x3.cpp Importer/IFC/IFCReaderGen2_2x3.cpp PROPERTIES COMPILE_FLAGS "/bigobj") - elseif(CMAKE_COMPILER_IS_MINGW) + elseif(MINGW) set_source_files_properties(Importer/IFC/IFCReaderGen1_2x3.cpp Importer/IFC/IFCReaderGen2_2x3.cpp PROPERTIES COMPILE_FLAGS "-O2 -Wa,-mbig-obj") endif() endif () @@ -862,7 +871,7 @@ ADD_ASSIMP_IMPORTER( MMD # optimizations that take up extra space. Given that the issue is a string table overflowing, -Os seemed appropriate # Also, I'm not positive if both link & compile flags are needed, but this hopefully ensures that the issue should not # recur for edge cases such as static builds. -if ((CMAKE_COMPILER_IS_MINGW) AND (CMAKE_BUILD_TYPE MATCHES Debug)) +if ((MINGW) AND (CMAKE_BUILD_TYPE MATCHES Debug)) message("-- Applying MinGW StepFileGen1.cpp Debug Workaround") SET_SOURCE_FILES_PROPERTIES(Importer/StepFile/StepFileGen1.cpp PROPERTIES COMPILE_FLAGS -Os ) SET_SOURCE_FILES_PROPERTIES(Importer/StepFile/StepFileGen1.cpp PROPERTIES LINK_FLAGS -Os ) @@ -1172,12 +1181,12 @@ ELSE() ENDIF() # adds C_FLAGS required to compile zip.c on old GCC 4.x compiler -TARGET_COMPILE_FEATURES(assimp PUBLIC c_std_99) +TARGET_COMPILE_FEATURES(assimp PRIVATE c_std_99) TARGET_INCLUDE_DIRECTORIES ( assimp PUBLIC $ $ - $ + $ ) IF(ASSIMP_HUNTER_ENABLED) @@ -1311,7 +1320,7 @@ INSTALL( TARGETS assimp RUNTIME DESTINATION ${ASSIMP_BIN_INSTALL_DIR} FRAMEWORK DESTINATION ${ASSIMP_LIB_INSTALL_DIR} COMPONENT ${LIBASSIMP_COMPONENT} - INCLUDES DESTINATION include + INCLUDES DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR} ) INSTALL( FILES ${PUBLIC_HEADERS} DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}/assimp COMPONENT assimp-dev) INSTALL( FILES ${COMPILER_HEADERS} DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}/assimp/Compiler COMPONENT assimp-dev) diff --git a/code/Common/AssertHandler.cpp b/code/Common/AssertHandler.cpp index 29fb2b313..d0bd6ccad 100644 --- a/code/Common/AssertHandler.cpp +++ b/code/Common/AssertHandler.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/Common/Assimp.cpp b/code/Common/Assimp.cpp index 3a0ec7d60..71e312cee 100644 --- a/code/Common/Assimp.cpp +++ b/code/Common/Assimp.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/Common/Base64.cpp b/code/Common/Base64.cpp new file mode 100644 index 000000000..2916cae7f --- /dev/null +++ b/code/Common/Base64.cpp @@ -0,0 +1,181 @@ +/* +--------------------------------------------------------------------------- +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, +with or without modification, are permitted provided that the following +conditions are met: + +* Redistributions of source code must retain the above + copyright notice, this list of conditions and the + following disclaimer. + +* Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other + materials provided with the distribution. + +* Neither the name of the assimp team, nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior + written permission of the assimp team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +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. +--------------------------------------------------------------------------- +*/ + +#include +#include + +namespace Assimp { + +namespace Base64 { + +static const uint8_t tableDecodeBase64[128] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 64, 0, 0, + 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, + 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0 +}; + +static const char* tableEncodeBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + +static inline char EncodeChar(uint8_t b) { + return tableEncodeBase64[size_t(b)]; +} + +inline uint8_t DecodeChar(char c) { + if (c & 0x80) { + throw DeadlyImportError("Invalid base64 char value: ", size_t(c)); + } + return tableDecodeBase64[size_t(c & 0x7F)]; // TODO faster with lookup table or ifs? +} + +void Encode(const uint8_t *in, size_t inLength, std::string &out) { + size_t outLength = ((inLength + 2) / 3) * 4; + + size_t j = out.size(); + out.resize(j + outLength); + + for (size_t i = 0; i < inLength; i += 3) { + uint8_t b = (in[i] & 0xFC) >> 2; + out[j++] = EncodeChar(b); + + b = (in[i] & 0x03) << 4; + if (i + 1 < inLength) { + b |= (in[i + 1] & 0xF0) >> 4; + out[j++] = EncodeChar(b); + + b = (in[i + 1] & 0x0F) << 2; + if (i + 2 < inLength) { + b |= (in[i + 2] & 0xC0) >> 6; + out[j++] = EncodeChar(b); + + b = in[i + 2] & 0x3F; + out[j++] = EncodeChar(b); + } else { + out[j++] = EncodeChar(b); + out[j++] = '='; + } + } else { + out[j++] = EncodeChar(b); + out[j++] = '='; + out[j++] = '='; + } + } +} + +void Encode(const std::vector& in, std::string &out) { + Encode (in.data (), in.size (), out); +} + +std::string Encode (const std::vector& in) { + std::string encoded; + Encode (in, encoded); + return encoded; +} + + +size_t Decode(const char *in, size_t inLength, uint8_t *&out) { + if (inLength % 4 != 0) { + throw DeadlyImportError("Invalid base64 encoded data: \"", std::string(in, std::min(size_t(32), inLength)), "\", length:", inLength); + } + + if (inLength < 4) { + out = nullptr; + return 0; + } + + int nEquals = int(in[inLength - 1] == '=') + + int(in[inLength - 2] == '='); + + size_t outLength = (inLength * 3) / 4 - nEquals; + out = new uint8_t[outLength]; + memset(out, 0, outLength); + + size_t i, j = 0; + + for (i = 0; i + 4 < inLength; i += 4) { + uint8_t b0 = DecodeChar(in[i]); + uint8_t b1 = DecodeChar(in[i + 1]); + uint8_t b2 = DecodeChar(in[i + 2]); + uint8_t b3 = DecodeChar(in[i + 3]); + + out[j++] = (uint8_t)((b0 << 2) | (b1 >> 4)); + out[j++] = (uint8_t)((b1 << 4) | (b2 >> 2)); + out[j++] = (uint8_t)((b2 << 6) | b3); + } + + { + uint8_t b0 = DecodeChar(in[i]); + uint8_t b1 = DecodeChar(in[i + 1]); + uint8_t b2 = DecodeChar(in[i + 2]); + uint8_t b3 = DecodeChar(in[i + 3]); + + out[j++] = (uint8_t)((b0 << 2) | (b1 >> 4)); + if (b2 < 64) out[j++] = (uint8_t)((b1 << 4) | (b2 >> 2)); + if (b3 < 64) out[j++] = (uint8_t)((b2 << 6) | b3); + } + + return outLength; +} + +size_t Decode(const std::string& in, std::vector& out) { + uint8_t* outPtr = nullptr; + size_t decodedSize = Decode (in.data (), in.size (), outPtr); + if (outPtr == nullptr) { + return 0; + } + out.assign (outPtr, outPtr + decodedSize); + delete[] outPtr; + return decodedSize; +} + +std::vector Decode (const std::string& in) { + std::vector result; + Decode (in, result); + return result; +} + +} + +} diff --git a/code/Common/BaseImporter.cpp b/code/Common/BaseImporter.cpp index d7e24afab..383300ef1 100644 --- a/code/Common/BaseImporter.cpp +++ b/code/Common/BaseImporter.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -65,6 +65,7 @@ using namespace Assimp; // Constructor to be privately used by Importer BaseImporter::BaseImporter() AI_NO_EXCEPT : m_progress() { + // empty } // ------------------------------------------------------------------------------------------------ @@ -155,8 +156,8 @@ void BaseImporter::GetExtensionList(std::set &extensions) { // ------------------------------------------------------------------------------------------------ /*static*/ bool BaseImporter::SearchFileHeaderForToken(IOSystem *pIOHandler, const std::string &pFile, - const char * const *tokens, - unsigned int numTokens, + const char **tokens, + std::size_t numTokens, unsigned int searchBytes /* = 200 */, bool tokensSol /* false */, bool noAlphaBeforeTokens /* false */) { @@ -267,10 +268,11 @@ std::string BaseImporter::GetExtension(const std::string &file) { return ret; } + // ------------------------------------------------------------------------------------------------ // Check for magic bytes at the beginning of the file. /* static */ bool BaseImporter::CheckMagicToken(IOSystem *pIOHandler, const std::string &pFile, - const void *_magic, unsigned int num, unsigned int offset, unsigned int size) { + const void *_magic, std::size_t num, unsigned int offset, unsigned int size) { ai_assert(size <= 16); ai_assert(_magic); @@ -372,7 +374,10 @@ void BaseImporter::ConvertToUTF8(std::vector &data) { // UTF 16 BE with BOM if (*((uint16_t *)&data.front()) == 0xFFFE) { - + // Check to ensure no overflow can happen + if(data.size() % 2 != 0) { + return; + } // swap the endianness .. for (uint16_t *p = (uint16_t *)&data.front(), *end = (uint16_t *)&data.back(); p <= end; ++p) { ByteSwap::Swap2(p); diff --git a/code/Common/BaseProcess.cpp b/code/Common/BaseProcess.cpp index 09ef85cc4..48895b9f3 100644 --- a/code/Common/BaseProcess.cpp +++ b/code/Common/BaseProcess.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/BaseProcess.h b/code/Common/BaseProcess.h index 7f2b2604c..64403567a 100644 --- a/code/Common/BaseProcess.h +++ b/code/Common/BaseProcess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/Bitmap.cpp b/code/Common/Bitmap.cpp index 51f31625e..65dfd1754 100644 --- a/code/Common/Bitmap.cpp +++ b/code/Common/Bitmap.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/CreateAnimMesh.cpp b/code/Common/CreateAnimMesh.cpp index b8870ff25..58f3d909d 100644 --- a/code/Common/CreateAnimMesh.cpp +++ b/code/Common/CreateAnimMesh.cpp @@ -4,7 +4,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- Copyright (C) 2016 The Qt Company Ltd. -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/DefaultIOStream.cpp b/code/Common/DefaultIOStream.cpp index e18dcd3f5..e30f26acd 100644 --- a/code/Common/DefaultIOStream.cpp +++ b/code/Common/DefaultIOStream.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/DefaultIOSystem.cpp b/code/Common/DefaultIOSystem.cpp index de93909de..b28910c70 100644 --- a/code/Common/DefaultIOSystem.cpp +++ b/code/Common/DefaultIOSystem.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/DefaultLogger.cpp b/code/Common/DefaultLogger.cpp index da43a7a7e..5cb32d38f 100644 --- a/code/Common/DefaultLogger.cpp +++ b/code/Common/DefaultLogger.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team @@ -388,15 +388,16 @@ void DefaultLogger::WriteToStreams(const char *message, ErrorSeverity ErrorSev) ai_assert(nullptr != message); // Check whether this is a repeated message - if (!::strncmp(message, lastMsg, lastLen - 1)) { + auto thisLen = ::strlen(message); + if (thisLen == lastLen - 1 && !::strncmp(message, lastMsg, lastLen - 1)) { if (!noRepeatMsg) { noRepeatMsg = true; message = "Skipping one or more lines with the same contents\n"; - } else - return; + } + return; } else { // append a new-line character to the message to be printed - lastLen = ::strlen(message); + lastLen = thisLen; ::memcpy(lastMsg, message, lastLen + 1); ::strcat(lastMsg + lastLen, "\n"); diff --git a/code/Common/DefaultProgressHandler.h b/code/Common/DefaultProgressHandler.h index 4626204af..ac1bb68db 100644 --- a/code/Common/DefaultProgressHandler.h +++ b/code/Common/DefaultProgressHandler.h @@ -2,8 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team - +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -48,18 +47,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include -namespace Assimp { +namespace Assimp { // ------------------------------------------------------------------------------------ -/** @brief Internal default implementation of the #ProgressHandler interface. */ +/** + * @brief Internal default implementation of the #ProgressHandler interface. + */ class DefaultProgressHandler : public ProgressHandler { - - virtual bool Update(float /*percentage*/) { +public: + /// @brief Ignores the update callback. + bool Update(float) override { return false; } +}; - -}; // !class DefaultProgressHandler } // Namespace Assimp -#endif +#endif // INCLUDED_AI_DEFAULTPROGRESSHANDLER_H diff --git a/code/Common/Exceptional.cpp b/code/Common/Exceptional.cpp index 89090c9d3..b25281a97 100644 --- a/code/Common/Exceptional.cpp +++ b/code/Common/Exceptional.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/Exporter.cpp b/code/Common/Exporter.cpp index 512bbf447..9a4e2cf3d 100644 --- a/code/Common/Exporter.cpp +++ b/code/Common/Exporter.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/FileLogStream.h b/code/Common/FileLogStream.h index ed508bbf7..334541485 100644 --- a/code/Common/FileLogStream.h +++ b/code/Common/FileLogStream.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/IOSystem.cpp b/code/Common/IOSystem.cpp new file mode 100644 index 000000000..77305d193 --- /dev/null +++ b/code/Common/IOSystem.cpp @@ -0,0 +1,53 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (assimp) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2019, assimp team + +All rights reserved. + +Redistribution and use of this software in source and binary forms, +with or without modification, are permitted provided that the following +conditions are met: + +* Redistributions of source code must retain the above + copyright notice, this list of conditions and the + following disclaimer. + +* Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other + materials provided with the distribution. + +* Neither the name of the assimp team, nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior + written permission of the assimp team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +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 Default implementation of IOSystem using the standard C file functions */ + +#include + +using namespace Assimp; + +const std::string &IOSystem::CurrentDirectory() const { + if ( m_pathStack.empty() ) { + static const std::string Dummy = std::string(); + return Dummy; + } + return m_pathStack[ m_pathStack.size()-1 ]; +} diff --git a/code/Common/Importer.cpp b/code/Common/Importer.cpp index 41b73fd12..52b6097e7 100644 --- a/code/Common/Importer.cpp +++ b/code/Common/Importer.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -329,7 +329,7 @@ bool Importer::IsDefaultIOHandler() const { // ------------------------------------------------------------------------------------------------ // Supplies a custom progress handler to get regular callbacks during importing -void Importer::SetProgressHandler ( ProgressHandler* pHandler ) { +void Importer::SetProgressHandler(ProgressHandler* pHandler) { ai_assert(nullptr != pimpl); ASSIMP_BEGIN_EXCEPTION_REGION(); @@ -617,29 +617,71 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags) { profiler->BeginRegion("total"); } - // Find an worker class which can handle the file - BaseImporter* imp = nullptr; + // Find an worker class which can handle the file extension. + // Multiple importers may be able to handle the same extension (.xml!); gather them all. SetPropertyInteger("importerIndex", -1); - for( unsigned int a = 0; a < pimpl->mImporter.size(); a++) { + struct ImporterAndIndex { + BaseImporter * importer; + unsigned int index; + }; + std::vector possibleImporters; + for (unsigned int a = 0; a < pimpl->mImporter.size(); a++) { + + // Every importer has a list of supported extensions. + std::set extensions; + pimpl->mImporter[a]->GetExtensionList(extensions); + + // CAUTION: Do not just search for the extension! + // GetExtension() returns the part after the *last* dot, but some extensions have dots + // inside them, e.g. ogre.mesh.xml. Compare the entire end of the string. + for (std::set::const_iterator it = extensions.cbegin(); it != extensions.cend(); ++it) { + + // Yay for C++<20 not having std::string::ends_with() + std::string extension = "." + *it; + if (extension.length() <= pFile.length()) { + // Possible optimization: Fetch the lowercase filename! + if (0 == ASSIMP_stricmp(pFile.c_str() + pFile.length() - extension.length(), extension.c_str())) { + ImporterAndIndex candidate = { pimpl->mImporter[a], a }; + possibleImporters.push_back(candidate); + break; + } + } - if( pimpl->mImporter[a]->CanRead( pFile, pimpl->mIOHandler, false)) { - imp = pimpl->mImporter[a]; - SetPropertyInteger("importerIndex", a); - break; } + + } + + // If just one importer supports this extension, pick it and close the case. + BaseImporter* imp = nullptr; + if (1 == possibleImporters.size()) { + imp = possibleImporters[0].importer; + SetPropertyInteger("importerIndex", possibleImporters[0].index); + } + // If multiple importers claim this file extension, ask them to look at the actual file data to decide. + // This can happen e.g. with XML (COLLADA vs. Irrlicht). + else { + for (std::vector::const_iterator it = possibleImporters.begin(); it < possibleImporters.end(); ++it) { + BaseImporter & importer = *it->importer; + + ASSIMP_LOG_INFO("Found a possible importer: " + std::string(importer.GetInfo()->mName) + "; trying signature-based detection"); + if (importer.CanRead( pFile, pimpl->mIOHandler, true)) { + imp = &importer; + SetPropertyInteger("importerIndex", it->index); + break; + } + + } + } if (!imp) { // not so bad yet ... try format auto detection. - const std::string::size_type s = pFile.find_last_of('.'); - if (s != std::string::npos) { - ASSIMP_LOG_INFO("File extension not known, trying signature-based detection"); - for( unsigned int a = 0; a < pimpl->mImporter.size(); a++) { - if( pimpl->mImporter[a]->CanRead( pFile, pimpl->mIOHandler, true)) { - imp = pimpl->mImporter[a]; - SetPropertyInteger("importerIndex", a); - break; - } + ASSIMP_LOG_INFO("File extension not known, trying signature-based detection"); + for( unsigned int a = 0; a < pimpl->mImporter.size(); a++) { + if( pimpl->mImporter[a]->CanRead( pFile, pimpl->mIOHandler, true)) { + imp = pimpl->mImporter[a]; + SetPropertyInteger("importerIndex", a); + break; } } // Put a proper error message if no suitable importer was found diff --git a/code/Common/Importer.h b/code/Common/Importer.h index f79b38214..ab7e3a6b3 100644 --- a/code/Common/Importer.h +++ b/code/Common/Importer.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/ImporterRegistry.cpp b/code/Common/ImporterRegistry.cpp index 644acf29c..78c02d96d 100644 --- a/code/Common/ImporterRegistry.cpp +++ b/code/Common/ImporterRegistry.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -202,6 +202,9 @@ corresponding preprocessor flag to selectively disable formats. #ifndef ASSIMP_BUILD_NO_M3D_IMPORTER #include "AssetLib/M3D/M3DImporter.h" #endif +#ifndef ASSIMP_BUILD_NO_IQM_IMPORTER +#include "AssetLib/IQM/IQMImporter.h" +#endif namespace Assimp { @@ -370,6 +373,9 @@ void GetImporterInstanceList(std::vector &out) { #endif #ifndef ASSIMP_BUILD_NO_MMD_IMPORTER out.push_back(new MMDImporter()); +#endif +#ifndef ASSIMP_BUILD_NO_IQM_IMPORTER + out.push_back(new IQMImporter()); #endif //#ifndef ASSIMP_BUILD_NO_STEP_IMPORTER // out.push_back(new StepFile::StepFileImporter()); diff --git a/code/Common/PolyTools.h b/code/Common/PolyTools.h index e660ce49b..11f627392 100644 --- a/code/Common/PolyTools.h +++ b/code/Common/PolyTools.h @@ -2,8 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team - +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -42,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** @file PolyTools.h, various utilities for our dealings with arbitrary polygons */ +#pragma once #ifndef AI_POLYTOOLS_H_INCLUDED #define AI_POLYTOOLS_H_INCLUDED @@ -55,8 +55,7 @@ namespace Assimp { * The function accepts an unconstrained template parameter for use with * both aiVector3D and aiVector2D, but generally ignores the third coordinate.*/ template -inline double GetArea2D(const T& v1, const T& v2, const T& v3) -{ +inline double GetArea2D(const T& v1, const T& v2, const T& v3) { return 0.5 * (v1.x * ((double)v3.y - v2.y) + v2.x * ((double)v1.y - v3.y) + v3.x * ((double)v2.y - v1.y)); } @@ -65,8 +64,7 @@ inline double GetArea2D(const T& v1, const T& v2, const T& v3) * The function accepts an unconstrained template parameter for use with * both aiVector3D and aiVector2D, but generally ignores the third coordinate.*/ template -inline bool OnLeftSideOfLine2D(const T& p0, const T& p1,const T& p2) -{ +inline bool OnLeftSideOfLine2D(const T& p0, const T& p1,const T& p2) { return GetArea2D(p0,p2,p1) > 0; } @@ -75,20 +73,23 @@ inline bool OnLeftSideOfLine2D(const T& p0, const T& p1,const T& p2) * The function accepts an unconstrained template parameter for use with * both aiVector3D and aiVector2D, but generally ignores the third coordinate.*/ template -inline bool PointInTriangle2D(const T& p0, const T& p1,const T& p2, const T& pp) -{ +inline bool PointInTriangle2D(const T& p0, const T& p1,const T& p2, const T& pp) { // Point in triangle test using baryzentric coordinates const aiVector2D v0 = p1 - p0; const aiVector2D v1 = p2 - p0; const aiVector2D v2 = pp - p0; double dot00 = v0 * v0; - double dot01 = v0 * v1; - double dot02 = v0 * v2; double dot11 = v1 * v1; - double dot12 = v1 * v2; - - const double invDenom = 1 / (dot00 * dot11 - dot01 * dot01); + const double dot01 = v0 * v1; + const double dot02 = v0 * v2; + const double dot12 = v1 * v2; + const double denom = dot00 * dot11 - dot01 * dot01; + if (denom == 0.0) { + return false; + } + + const double invDenom = 1.0 / denom; dot11 = (dot11 * dot02 - dot01 * dot12) * invDenom; dot00 = (dot00 * dot12 - dot01 * dot02) * invDenom; @@ -133,8 +134,7 @@ inline bool IsCCW(T* in, size_t npoints) { // in[i+2].x, in[i+2].y)) { convex_turn = AI_MATH_PI_F - theta; convex_sum += convex_turn; - } - else { + } else { convex_sum -= AI_MATH_PI_F - theta; } } @@ -161,15 +161,13 @@ inline bool IsCCW(T* in, size_t npoints) { if (OnLeftSideOfLine2D(in[npoints-2],in[1],in[0])) { convex_turn = AI_MATH_PI_F - theta; convex_sum += convex_turn; - } - else { + } else { convex_sum -= AI_MATH_PI_F - theta; } return convex_sum >= (2 * AI_MATH_PI_F); } - // ------------------------------------------------------------------------------- /** Compute the normal of an arbitrary polygon in R3. * @@ -186,8 +184,7 @@ inline bool IsCCW(T* in, size_t npoints) { * this method is much faster than the 'other' NewellNormal() */ template -inline void NewellNormal (aiVector3t& out, int num, TReal* x, TReal* y, TReal* z) -{ +inline void NewellNormal (aiVector3t& out, int num, TReal* x, TReal* y, TReal* z) { // Duplicate the first two vertices at the end x[(num+0)*ofs_x] = x[0]; x[(num+1)*ofs_x] = x[ofs_x]; @@ -224,6 +221,6 @@ inline void NewellNormal (aiVector3t& out, int num, TReal* x, TReal* y, T out = aiVector3t(sum_yz,sum_zx,sum_xy); } -} // ! Assimp +} // ! namespace Assimp -#endif +#endif // AI_POLYTOOLS_H_INCLUDED diff --git a/code/Common/PostStepRegistry.cpp b/code/Common/PostStepRegistry.cpp index a2d015cc4..de4f39083 100644 --- a/code/Common/PostStepRegistry.cpp +++ b/code/Common/PostStepRegistry.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/Common/RemoveComments.cpp b/code/Common/RemoveComments.cpp index e9e2a6ade..4fae21c95 100644 --- a/code/Common/RemoveComments.cpp +++ b/code/Common/RemoveComments.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/SGSpatialSort.cpp b/code/Common/SGSpatialSort.cpp index 78b869260..0d16d6fe8 100644 --- a/code/Common/SGSpatialSort.cpp +++ b/code/Common/SGSpatialSort.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/Common/SceneCombiner.cpp b/code/Common/SceneCombiner.cpp index 8f10d6308..2c2539e54 100644 --- a/code/Common/SceneCombiner.cpp +++ b/code/Common/SceneCombiner.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -1101,6 +1101,14 @@ void SceneCombiner::Copy(aiMesh **_dest, const aiMesh *src) { // make a deep copy of all blend shapes CopyPtrArray(dest->mAnimMeshes, dest->mAnimMeshes, dest->mNumAnimMeshes); + + // make a deep copy of all texture coordinate names + if (src->mTextureCoordsNames != nullptr) { + dest->mTextureCoordsNames = new aiString *[AI_MAX_NUMBER_OF_TEXTURECOORDS] {}; + for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) { + Copy(&dest->mTextureCoordsNames[i], src->mTextureCoordsNames[i]); + } + } } // ------------------------------------------------------------------------------------------------ @@ -1348,6 +1356,18 @@ void SceneCombiner::Copy(aiMetadata **_dest, const aiMetadata *src) { } } +// ------------------------------------------------------------------------------------------------ +void SceneCombiner::Copy(aiString **_dest, const aiString *src) { + if (nullptr == _dest || nullptr == src) { + return; + } + + aiString *dest = *_dest = new aiString(); + + // get a flat copy + *dest = *src; +} + #if (__GNUC__ >= 8 && __GNUC_MINOR__ >= 0) #pragma GCC diagnostic pop #endif diff --git a/code/Common/ScenePreprocessor.cpp b/code/Common/ScenePreprocessor.cpp index 2ea17c643..2ef291eeb 100644 --- a/code/Common/ScenePreprocessor.cpp +++ b/code/Common/ScenePreprocessor.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/ScenePreprocessor.h b/code/Common/ScenePreprocessor.h index eba7e84f8..49e06ed1c 100644 --- a/code/Common/ScenePreprocessor.h +++ b/code/Common/ScenePreprocessor.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/ScenePrivate.h b/code/Common/ScenePrivate.h index 7a6031b3c..3910db78c 100644 --- a/code/Common/ScenePrivate.h +++ b/code/Common/ScenePrivate.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/SkeletonMeshBuilder.cpp b/code/Common/SkeletonMeshBuilder.cpp index 7c98187a4..5ea30d9c7 100644 --- a/code/Common/SkeletonMeshBuilder.cpp +++ b/code/Common/SkeletonMeshBuilder.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/SpatialSort.cpp b/code/Common/SpatialSort.cpp index 9b96887ac..6103002cc 100644 --- a/code/Common/SpatialSort.cpp +++ b/code/Common/SpatialSort.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/StandardShapes.cpp b/code/Common/StandardShapes.cpp index 64ceeffc8..e94b5b9af 100644 --- a/code/Common/StandardShapes.cpp +++ b/code/Common/StandardShapes.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/StdOStreamLogStream.h b/code/Common/StdOStreamLogStream.h index 7012ab825..cc0e06263 100644 --- a/code/Common/StdOStreamLogStream.h +++ b/code/Common/StdOStreamLogStream.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/Common/Subdivision.cpp b/code/Common/Subdivision.cpp index 9e7577a04..705ea3fb3 100644 --- a/code/Common/Subdivision.cpp +++ b/code/Common/Subdivision.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/TargetAnimation.cpp b/code/Common/TargetAnimation.cpp index 6cd9c9a4d..5f6d9bad0 100644 --- a/code/Common/TargetAnimation.cpp +++ b/code/Common/TargetAnimation.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/TargetAnimation.h b/code/Common/TargetAnimation.h index f386029fb..863406b94 100644 --- a/code/Common/TargetAnimation.h +++ b/code/Common/TargetAnimation.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/Version.cpp b/code/Common/Version.cpp index 205dde52b..20533ab80 100644 --- a/code/Common/Version.cpp +++ b/code/Common/Version.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/VertexTriangleAdjacency.cpp b/code/Common/VertexTriangleAdjacency.cpp index d644f4ab9..555e3e386 100644 --- a/code/Common/VertexTriangleAdjacency.cpp +++ b/code/Common/VertexTriangleAdjacency.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/Common/VertexTriangleAdjacency.h b/code/Common/VertexTriangleAdjacency.h index 48c1a54fb..41d809450 100644 --- a/code/Common/VertexTriangleAdjacency.h +++ b/code/Common/VertexTriangleAdjacency.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/Win32DebugLogStream.h b/code/Common/Win32DebugLogStream.h index 51f1ab178..34d849e83 100644 --- a/code/Common/Win32DebugLogStream.h +++ b/code/Common/Win32DebugLogStream.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/Common/ZipArchiveIOSystem.cpp b/code/Common/ZipArchiveIOSystem.cpp index 7df51b8aa..c322b140f 100644 --- a/code/Common/ZipArchiveIOSystem.cpp +++ b/code/Common/ZipArchiveIOSystem.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -59,11 +59,38 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace Assimp { +// ---------------------------------------------------------------- +// A read-only file inside a ZIP + +class ZipFile : public IOStream { + friend class ZipFileInfo; + explicit ZipFile(std::string &filename, size_t size); + +public: + std::string m_Filename; + virtual ~ZipFile(); + + // IOStream interface + size_t Read(void *pvBuffer, size_t pSize, size_t pCount) override; + size_t Write(const void * /*pvBuffer*/, size_t /*pSize*/, size_t /*pCount*/) override { return 0; } + size_t FileSize() const override; + aiReturn Seek(size_t pOffset, aiOrigin pOrigin) override; + size_t Tell() const override; + void Flush() override {} + +private: + size_t m_Size = 0; + size_t m_SeekPtr = 0; + std::unique_ptr m_Buffer; +}; + + // ---------------------------------------------------------------- // Wraps an existing Assimp::IOSystem for unzip class IOSystem2Unzip { public: static voidpf open(voidpf opaque, const char *filename, int mode); + static voidpf opendisk(voidpf opaque, voidpf stream, uint32_t number_disk, int mode); static uLong read(voidpf opaque, voidpf stream, void *buf, uLong size); static uLong write(voidpf opaque, voidpf stream, const void *buf, uLong size); static long tell(voidpf opaque, voidpf stream); @@ -92,6 +119,28 @@ voidpf IOSystem2Unzip::open(voidpf opaque, const char *filename, int mode) { return (voidpf)io_system->Open(filename, mode_fopen); } +voidpf IOSystem2Unzip::opendisk(voidpf opaque, voidpf stream, uint32_t number_disk, int mode) { + ZipFile *io_stream = (ZipFile *)stream; + voidpf ret = NULL; + size_t i; + + char *disk_filename = (char*)malloc(io_stream->m_Filename.length() + 1); + strncpy(disk_filename, io_stream->m_Filename.c_str(), io_stream->m_Filename.length() + 1); + for (i = io_stream->m_Filename.length() - 1; i >= 0; i -= 1) + { + if (disk_filename[i] != '.') + continue; + snprintf(&disk_filename[i], io_stream->m_Filename.length() - i, ".z%02u", number_disk + 1); + break; + } + + if (i >= 0) + ret = open(opaque, disk_filename, mode); + + free(disk_filename); + return ret; +} + uLong IOSystem2Unzip::read(voidpf /*opaque*/, voidpf stream, void *buf, uLong size) { IOStream *io_stream = (IOStream *)stream; @@ -147,6 +196,7 @@ zlib_filefunc_def IOSystem2Unzip::get(IOSystem *pIOHandler) { zlib_filefunc_def mapping; mapping.zopen_file = (open_file_func)open; + mapping.zopendisk_file = (opendisk_file_func)opendisk; mapping.zread_file = (read_file_func)read; mapping.zwrite_file = (write_file_func)write; mapping.ztell_file = (tell_file_func)tell; @@ -159,30 +209,6 @@ zlib_filefunc_def IOSystem2Unzip::get(IOSystem *pIOHandler) { return mapping; } -// ---------------------------------------------------------------- -// A read-only file inside a ZIP - -class ZipFile : public IOStream { - friend class ZipFileInfo; - explicit ZipFile(size_t size); - -public: - virtual ~ZipFile(); - - // IOStream interface - size_t Read(void *pvBuffer, size_t pSize, size_t pCount) override; - size_t Write(const void * /*pvBuffer*/, size_t /*pSize*/, size_t /*pCount*/) override { return 0; } - size_t FileSize() const override; - aiReturn Seek(size_t pOffset, aiOrigin pOrigin) override; - size_t Tell() const override; - void Flush() override {} - -private: - size_t m_Size = 0; - size_t m_SeekPtr = 0; - std::unique_ptr m_Buffer; -}; - // ---------------------------------------------------------------- // Info about a read-only file inside a ZIP class ZipFileInfo { @@ -190,7 +216,7 @@ public: explicit ZipFileInfo(unzFile zip_handle, size_t size); // Allocate and Extract data from the ZIP - ZipFile *Extract(unzFile zip_handle) const; + ZipFile *Extract(std::string &filename, unzFile zip_handle) const; private: size_t m_Size = 0; @@ -206,7 +232,7 @@ ZipFileInfo::ZipFileInfo(unzFile zip_handle, size_t size) : unzGetFilePos(zip_handle, &(m_ZipFilePos)); } -ZipFile *ZipFileInfo::Extract(unzFile zip_handle) const { +ZipFile *ZipFileInfo::Extract(std::string &filename, unzFile zip_handle) const { // Find in the ZIP. This cannot fail unz_file_pos_s *filepos = const_cast(&(m_ZipFilePos)); if (unzGoToFilePos(zip_handle, filepos) != UNZ_OK) @@ -215,7 +241,7 @@ ZipFile *ZipFileInfo::Extract(unzFile zip_handle) const { if (unzOpenCurrentFile(zip_handle) != UNZ_OK) return nullptr; - ZipFile *zip_file = new ZipFile(m_Size); + ZipFile *zip_file = new ZipFile(filename, m_Size); // Unzip has a limit of UINT16_MAX bytes buffer uint16_t unzipBufferSize = zip_file->m_Size <= UINT16_MAX ? static_cast(zip_file->m_Size) : UINT16_MAX; @@ -245,8 +271,8 @@ ZipFile *ZipFileInfo::Extract(unzFile zip_handle) const { return zip_file; } -ZipFile::ZipFile(size_t size) : - m_Size(size) { +ZipFile::ZipFile(std::string &filename, size_t size) : + m_Filename(filename), m_Size(size) { ai_assert(m_Size != 0); m_Buffer = std::unique_ptr(new uint8_t[m_Size]); } @@ -372,7 +398,7 @@ void ZipArchiveIOSystem::Implement::MapArchive() { unz_file_info fileInfo; if (unzGetCurrentFileInfo(m_ZipFileHandle, &fileInfo, filename, FileNameSize, nullptr, 0, nullptr, 0) == UNZ_OK) { - if (fileInfo.uncompressed_size != 0) { + if (fileInfo.uncompressed_size != 0 && fileInfo.size_filename <= FileNameSize) { std::string filename_string(filename, fileInfo.size_filename); SimplifyFilename(filename_string); m_ArchiveMap.emplace(filename_string, ZipFileInfo(m_ZipFileHandle, fileInfo.uncompressed_size)); @@ -422,7 +448,7 @@ IOStream *ZipArchiveIOSystem::Implement::OpenFile(std::string &filename) { return nullptr; const ZipFileInfo &zip_file = (*zip_it).second; - return zip_file.Extract(m_ZipFileHandle); + return zip_file.Extract(filename, m_ZipFileHandle); } inline void ReplaceAll(std::string &data, const std::string &before, const std::string &after) { diff --git a/code/Common/material.cpp b/code/Common/material.cpp index 6c90e66f0..8f791a313 100644 --- a/code/Common/material.cpp +++ b/code/Common/material.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/scene.cpp b/code/Common/scene.cpp index b1f858c48..b0e882154 100644 --- a/code/Common/scene.cpp +++ b/code/Common/scene.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Common/simd.cpp b/code/Common/simd.cpp index 071ee3e01..9eb547f9a 100644 --- a/code/Common/simd.cpp +++ b/code/Common/simd.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/Common/simd.h b/code/Common/simd.h index ee0f62658..0a062a248 100644 --- a/code/Common/simd.h +++ b/code/Common/simd.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/Material/MaterialSystem.cpp b/code/Material/MaterialSystem.cpp index 23d198953..b2f738959 100644 --- a/code/Material/MaterialSystem.cpp +++ b/code/Material/MaterialSystem.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Material/MaterialSystem.h b/code/Material/MaterialSystem.h index 593161790..41891ad97 100644 --- a/code/Material/MaterialSystem.h +++ b/code/Material/MaterialSystem.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Pbrt/PbrtExporter.cpp b/code/Pbrt/PbrtExporter.cpp index c04ab6c19..25061f517 100644 --- a/code/Pbrt/PbrtExporter.cpp +++ b/code/Pbrt/PbrtExporter.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/Pbrt/PbrtExporter.h b/code/Pbrt/PbrtExporter.h index e8ff03ccb..4f4e1625d 100644 --- a/code/Pbrt/PbrtExporter.h +++ b/code/Pbrt/PbrtExporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/ArmaturePopulate.cpp b/code/PostProcessing/ArmaturePopulate.cpp index fdf7508d0..3fc1e12bc 100644 --- a/code/PostProcessing/ArmaturePopulate.cpp +++ b/code/PostProcessing/ArmaturePopulate.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/ArmaturePopulate.h b/code/PostProcessing/ArmaturePopulate.h index ded8b4886..530932f48 100644 --- a/code/PostProcessing/ArmaturePopulate.h +++ b/code/PostProcessing/ArmaturePopulate.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/CalcTangentsProcess.cpp b/code/PostProcessing/CalcTangentsProcess.cpp index 3e6bb0270..0ebad91df 100644 --- a/code/PostProcessing/CalcTangentsProcess.cpp +++ b/code/PostProcessing/CalcTangentsProcess.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/PostProcessing/CalcTangentsProcess.h b/code/PostProcessing/CalcTangentsProcess.h index ce08d3ef7..018789bae 100644 --- a/code/PostProcessing/CalcTangentsProcess.h +++ b/code/PostProcessing/CalcTangentsProcess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/ComputeUVMappingProcess.cpp b/code/PostProcessing/ComputeUVMappingProcess.cpp index 8ce3e41c4..c7456cc9d 100644 --- a/code/PostProcessing/ComputeUVMappingProcess.cpp +++ b/code/PostProcessing/ComputeUVMappingProcess.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/ComputeUVMappingProcess.h b/code/PostProcessing/ComputeUVMappingProcess.h index fe44b4d41..74744be7f 100644 --- a/code/PostProcessing/ComputeUVMappingProcess.h +++ b/code/PostProcessing/ComputeUVMappingProcess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/ConvertToLHProcess.cpp b/code/PostProcessing/ConvertToLHProcess.cpp index 4b949e10e..4ded0fc15 100644 --- a/code/PostProcessing/ConvertToLHProcess.cpp +++ b/code/PostProcessing/ConvertToLHProcess.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/PostProcessing/ConvertToLHProcess.h b/code/PostProcessing/ConvertToLHProcess.h index 7e92b66af..474056c3a 100644 --- a/code/PostProcessing/ConvertToLHProcess.h +++ b/code/PostProcessing/ConvertToLHProcess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/DeboneProcess.cpp b/code/PostProcessing/DeboneProcess.cpp index 3783bb65c..e8cfb16b0 100644 --- a/code/PostProcessing/DeboneProcess.cpp +++ b/code/PostProcessing/DeboneProcess.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/DeboneProcess.h b/code/PostProcessing/DeboneProcess.h index 5765bf5bf..cb072b7eb 100644 --- a/code/PostProcessing/DeboneProcess.h +++ b/code/PostProcessing/DeboneProcess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/DropFaceNormalsProcess.cpp b/code/PostProcessing/DropFaceNormalsProcess.cpp index 21abf9693..0cf17f909 100644 --- a/code/PostProcessing/DropFaceNormalsProcess.cpp +++ b/code/PostProcessing/DropFaceNormalsProcess.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/PostProcessing/DropFaceNormalsProcess.h b/code/PostProcessing/DropFaceNormalsProcess.h index 5f7917b5a..50abdc727 100644 --- a/code/PostProcessing/DropFaceNormalsProcess.h +++ b/code/PostProcessing/DropFaceNormalsProcess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/EmbedTexturesProcess.cpp b/code/PostProcessing/EmbedTexturesProcess.cpp index 0c1207cff..2f80c908e 100644 --- a/code/PostProcessing/EmbedTexturesProcess.cpp +++ b/code/PostProcessing/EmbedTexturesProcess.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/EmbedTexturesProcess.h b/code/PostProcessing/EmbedTexturesProcess.h index b33968850..c3e63612c 100644 --- a/code/PostProcessing/EmbedTexturesProcess.h +++ b/code/PostProcessing/EmbedTexturesProcess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/FindDegenerates.cpp b/code/PostProcessing/FindDegenerates.cpp index 3809abf50..de46d5630 100644 --- a/code/PostProcessing/FindDegenerates.cpp +++ b/code/PostProcessing/FindDegenerates.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/FindDegenerates.h b/code/PostProcessing/FindDegenerates.h index 9ab62b97b..6fe1e929b 100644 --- a/code/PostProcessing/FindDegenerates.h +++ b/code/PostProcessing/FindDegenerates.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/FindInstancesProcess.cpp b/code/PostProcessing/FindInstancesProcess.cpp index d46afc201..7f8c93f77 100644 --- a/code/PostProcessing/FindInstancesProcess.cpp +++ b/code/PostProcessing/FindInstancesProcess.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/PostProcessing/FindInstancesProcess.h b/code/PostProcessing/FindInstancesProcess.h index 7336f1492..b501d88d5 100644 --- a/code/PostProcessing/FindInstancesProcess.h +++ b/code/PostProcessing/FindInstancesProcess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/FindInvalidDataProcess.cpp b/code/PostProcessing/FindInvalidDataProcess.cpp index ea7d99094..b42cbe9a0 100644 --- a/code/PostProcessing/FindInvalidDataProcess.cpp +++ b/code/PostProcessing/FindInvalidDataProcess.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/FindInvalidDataProcess.h b/code/PostProcessing/FindInvalidDataProcess.h index 4d8c61d83..5ea895c59 100644 --- a/code/PostProcessing/FindInvalidDataProcess.h +++ b/code/PostProcessing/FindInvalidDataProcess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/FixNormalsStep.cpp b/code/PostProcessing/FixNormalsStep.cpp index 09b1f1908..be0104214 100644 --- a/code/PostProcessing/FixNormalsStep.cpp +++ b/code/PostProcessing/FixNormalsStep.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/PostProcessing/FixNormalsStep.h b/code/PostProcessing/FixNormalsStep.h index 86e998f0b..b7d3ba386 100644 --- a/code/PostProcessing/FixNormalsStep.h +++ b/code/PostProcessing/FixNormalsStep.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/GenBoundingBoxesProcess.cpp b/code/PostProcessing/GenBoundingBoxesProcess.cpp index 7f41d847c..1c20b6f94 100644 --- a/code/PostProcessing/GenBoundingBoxesProcess.cpp +++ b/code/PostProcessing/GenBoundingBoxesProcess.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/GenBoundingBoxesProcess.h b/code/PostProcessing/GenBoundingBoxesProcess.h index a1daaea45..0b7591b6d 100644 --- a/code/PostProcessing/GenBoundingBoxesProcess.h +++ b/code/PostProcessing/GenBoundingBoxesProcess.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/GenFaceNormalsProcess.cpp b/code/PostProcessing/GenFaceNormalsProcess.cpp index 3e8612d29..517dd3b63 100644 --- a/code/PostProcessing/GenFaceNormalsProcess.cpp +++ b/code/PostProcessing/GenFaceNormalsProcess.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/PostProcessing/GenFaceNormalsProcess.h b/code/PostProcessing/GenFaceNormalsProcess.h index eefff6c73..586c4902e 100644 --- a/code/PostProcessing/GenFaceNormalsProcess.h +++ b/code/PostProcessing/GenFaceNormalsProcess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/GenVertexNormalsProcess.cpp b/code/PostProcessing/GenVertexNormalsProcess.cpp index e82bc3e6f..1a8afc597 100644 --- a/code/PostProcessing/GenVertexNormalsProcess.cpp +++ b/code/PostProcessing/GenVertexNormalsProcess.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/PostProcessing/GenVertexNormalsProcess.h b/code/PostProcessing/GenVertexNormalsProcess.h index 8fc301ab7..0dcae793a 100644 --- a/code/PostProcessing/GenVertexNormalsProcess.h +++ b/code/PostProcessing/GenVertexNormalsProcess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/ImproveCacheLocality.cpp b/code/PostProcessing/ImproveCacheLocality.cpp index 3243c40b4..56bdfc447 100644 --- a/code/PostProcessing/ImproveCacheLocality.cpp +++ b/code/PostProcessing/ImproveCacheLocality.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/PostProcessing/ImproveCacheLocality.h b/code/PostProcessing/ImproveCacheLocality.h index 8ccd42ad3..b2074a17c 100644 --- a/code/PostProcessing/ImproveCacheLocality.h +++ b/code/PostProcessing/ImproveCacheLocality.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/JoinVerticesProcess.cpp b/code/PostProcessing/JoinVerticesProcess.cpp index 60c64f3bf..184e8d745 100644 --- a/code/PostProcessing/JoinVerticesProcess.cpp +++ b/code/PostProcessing/JoinVerticesProcess.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/PostProcessing/JoinVerticesProcess.h b/code/PostProcessing/JoinVerticesProcess.h index 66f40f93d..f95236e31 100644 --- a/code/PostProcessing/JoinVerticesProcess.h +++ b/code/PostProcessing/JoinVerticesProcess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/LimitBoneWeightsProcess.cpp b/code/PostProcessing/LimitBoneWeightsProcess.cpp index fb8b49b91..63f6bf9f3 100644 --- a/code/PostProcessing/LimitBoneWeightsProcess.cpp +++ b/code/PostProcessing/LimitBoneWeightsProcess.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/LimitBoneWeightsProcess.h b/code/PostProcessing/LimitBoneWeightsProcess.h index 29cd9f924..22d286b68 100644 --- a/code/PostProcessing/LimitBoneWeightsProcess.h +++ b/code/PostProcessing/LimitBoneWeightsProcess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/MakeVerboseFormat.cpp b/code/PostProcessing/MakeVerboseFormat.cpp index 71c1cc439..75e2a0f06 100644 --- a/code/PostProcessing/MakeVerboseFormat.cpp +++ b/code/PostProcessing/MakeVerboseFormat.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/PostProcessing/MakeVerboseFormat.h b/code/PostProcessing/MakeVerboseFormat.h index 4304a3afa..6b81da622 100644 --- a/code/PostProcessing/MakeVerboseFormat.h +++ b/code/PostProcessing/MakeVerboseFormat.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/OptimizeGraph.cpp b/code/PostProcessing/OptimizeGraph.cpp index d7bcf3fec..ea44eb3c1 100644 --- a/code/PostProcessing/OptimizeGraph.cpp +++ b/code/PostProcessing/OptimizeGraph.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/OptimizeGraph.h b/code/PostProcessing/OptimizeGraph.h index 4df565de9..f5caa139c 100644 --- a/code/PostProcessing/OptimizeGraph.h +++ b/code/PostProcessing/OptimizeGraph.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/OptimizeMeshes.cpp b/code/PostProcessing/OptimizeMeshes.cpp index 939284ee4..e624bb1cf 100644 --- a/code/PostProcessing/OptimizeMeshes.cpp +++ b/code/PostProcessing/OptimizeMeshes.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/PostProcessing/OptimizeMeshes.h b/code/PostProcessing/OptimizeMeshes.h index 4dd51554b..b80f98d5d 100644 --- a/code/PostProcessing/OptimizeMeshes.h +++ b/code/PostProcessing/OptimizeMeshes.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/PretransformVertices.cpp b/code/PostProcessing/PretransformVertices.cpp index fa95319ff..ec7b8783e 100644 --- a/code/PostProcessing/PretransformVertices.cpp +++ b/code/PostProcessing/PretransformVertices.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/PostProcessing/PretransformVertices.h b/code/PostProcessing/PretransformVertices.h index 4aa742b09..14e5139ec 100644 --- a/code/PostProcessing/PretransformVertices.h +++ b/code/PostProcessing/PretransformVertices.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/ProcessHelper.cpp b/code/PostProcessing/ProcessHelper.cpp index e46289330..6f0a79825 100644 --- a/code/PostProcessing/ProcessHelper.cpp +++ b/code/PostProcessing/ProcessHelper.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/ProcessHelper.h b/code/PostProcessing/ProcessHelper.h index 497c5237f..78df94ca1 100644 --- a/code/PostProcessing/ProcessHelper.h +++ b/code/PostProcessing/ProcessHelper.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/RemoveRedundantMaterials.cpp b/code/PostProcessing/RemoveRedundantMaterials.cpp index 36745fb1d..ac2fa9790 100644 --- a/code/PostProcessing/RemoveRedundantMaterials.cpp +++ b/code/PostProcessing/RemoveRedundantMaterials.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team @@ -50,6 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "ProcessHelper.h" #include "Material/MaterialSystem.h" +#include #include using namespace Assimp; @@ -171,6 +172,8 @@ void RemoveRedundantMatsProcess::Execute( aiScene* pScene) } // If the new material count differs from the original, // we need to rebuild the material list and remap mesh material indexes. + if(iNewNum < 1) + throw DeadlyImportError("No materials remaining"); if (iNewNum != pScene->mNumMaterials) { ai_assert(iNewNum > 0); aiMaterial** ppcMaterials = new aiMaterial*[iNewNum]; diff --git a/code/PostProcessing/RemoveRedundantMaterials.h b/code/PostProcessing/RemoveRedundantMaterials.h index 4210a7fe2..e8c1478fd 100644 --- a/code/PostProcessing/RemoveRedundantMaterials.h +++ b/code/PostProcessing/RemoveRedundantMaterials.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/RemoveVCProcess.cpp b/code/PostProcessing/RemoveVCProcess.cpp index 9ee1da15c..1107736e9 100644 --- a/code/PostProcessing/RemoveVCProcess.cpp +++ b/code/PostProcessing/RemoveVCProcess.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/PostProcessing/RemoveVCProcess.h b/code/PostProcessing/RemoveVCProcess.h index 57d9f5839..cf1086882 100644 --- a/code/PostProcessing/RemoveVCProcess.h +++ b/code/PostProcessing/RemoveVCProcess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/ScaleProcess.cpp b/code/PostProcessing/ScaleProcess.cpp index 8fb3dc903..0090f8dd7 100644 --- a/code/PostProcessing/ScaleProcess.cpp +++ b/code/PostProcessing/ScaleProcess.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/ScaleProcess.h b/code/PostProcessing/ScaleProcess.h index 4dc7e3559..b6eb75de7 100644 --- a/code/PostProcessing/ScaleProcess.h +++ b/code/PostProcessing/ScaleProcess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/SortByPTypeProcess.cpp b/code/PostProcessing/SortByPTypeProcess.cpp index 3787be51e..c9268093e 100644 --- a/code/PostProcessing/SortByPTypeProcess.cpp +++ b/code/PostProcessing/SortByPTypeProcess.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/PostProcessing/SortByPTypeProcess.h b/code/PostProcessing/SortByPTypeProcess.h index 0380235d2..e30342a86 100644 --- a/code/PostProcessing/SortByPTypeProcess.h +++ b/code/PostProcessing/SortByPTypeProcess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/SplitByBoneCountProcess.cpp b/code/PostProcessing/SplitByBoneCountProcess.cpp index ed5b9411e..ace62ae90 100644 --- a/code/PostProcessing/SplitByBoneCountProcess.cpp +++ b/code/PostProcessing/SplitByBoneCountProcess.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/SplitByBoneCountProcess.h b/code/PostProcessing/SplitByBoneCountProcess.h index 0972440fd..938b00c7f 100644 --- a/code/PostProcessing/SplitByBoneCountProcess.h +++ b/code/PostProcessing/SplitByBoneCountProcess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/SplitLargeMeshes.cpp b/code/PostProcessing/SplitLargeMeshes.cpp index b601a1331..508a82669 100644 --- a/code/PostProcessing/SplitLargeMeshes.cpp +++ b/code/PostProcessing/SplitLargeMeshes.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/SplitLargeMeshes.h b/code/PostProcessing/SplitLargeMeshes.h index 61facf7ef..e5a8d4c1b 100644 --- a/code/PostProcessing/SplitLargeMeshes.h +++ b/code/PostProcessing/SplitLargeMeshes.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/TextureTransform.cpp b/code/PostProcessing/TextureTransform.cpp index 1cb7f293e..653506ec6 100644 --- a/code/PostProcessing/TextureTransform.cpp +++ b/code/PostProcessing/TextureTransform.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/TextureTransform.h b/code/PostProcessing/TextureTransform.h index 8d2c70081..c1cccf8ef 100644 --- a/code/PostProcessing/TextureTransform.h +++ b/code/PostProcessing/TextureTransform.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/TriangulateProcess.cpp b/code/PostProcessing/TriangulateProcess.cpp index b7928ee59..a18bf1c24 100644 --- a/code/PostProcessing/TriangulateProcess.cpp +++ b/code/PostProcessing/TriangulateProcess.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/TriangulateProcess.h b/code/PostProcessing/TriangulateProcess.h index c82366662..ed5f4a587 100644 --- a/code/PostProcessing/TriangulateProcess.h +++ b/code/PostProcessing/TriangulateProcess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/code/PostProcessing/ValidateDataStructure.cpp b/code/PostProcessing/ValidateDataStructure.cpp index 6a872ef11..e99f6a6e3 100644 --- a/code/PostProcessing/ValidateDataStructure.cpp +++ b/code/PostProcessing/ValidateDataStructure.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/code/PostProcessing/ValidateDataStructure.h b/code/PostProcessing/ValidateDataStructure.h index 50ff6e317..077a47b70 100644 --- a/code/PostProcessing/ValidateDataStructure.h +++ b/code/PostProcessing/ValidateDataStructure.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/contrib/android-cmake/android.toolchain.cmake b/contrib/android-cmake/android.toolchain.cmake index ffa26126a..c2b8a0730 100644 --- a/contrib/android-cmake/android.toolchain.cmake +++ b/contrib/android-cmake/android.toolchain.cmake @@ -1616,6 +1616,7 @@ endif() if( CMAKE_GENERATOR MATCHES "Ninja" AND CMAKE_HOST_WIN32 ) # it is a bad hack after all # CMake generates Ninja makefiles with UNIX paths only if it thinks that we are going to build with MinGW + set( MINGW TRUE ) # tell CMake that we are MinGW set( CMAKE_COMPILER_IS_MINGW TRUE ) # tell CMake that we are MinGW set( CMAKE_CROSSCOMPILING TRUE ) # stop recursion enable_language( C ) diff --git a/contrib/unzip/crypt.h b/contrib/unzip/crypt.h index e627b3bee..78146eb83 100644 --- a/contrib/unzip/crypt.h +++ b/contrib/unzip/crypt.h @@ -17,8 +17,10 @@ #define _MINICRYPT_H #if ZLIB_VERNUM < 0x1270 +#if !defined(Z_U4) typedef unsigned long z_crc_t; #endif +#endif #ifdef __cplusplus extern "C" { diff --git a/include/assimp/Base64.hpp b/include/assimp/Base64.hpp new file mode 100644 index 000000000..894eb449b --- /dev/null +++ b/include/assimp/Base64.hpp @@ -0,0 +1,64 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (assimp) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2022, assimp team + +All rights reserved. + +Redistribution and use of this software in source and binary forms, +with or without modification, are permitted provided that the following +conditions are met: + +* Redistributions of source code must retain the above + copyright notice, this list of conditions and the + following disclaimer. + +* Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other + materials provided with the distribution. + +* Neither the name of the assimp team, nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior + written permission of the assimp team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +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. +--------------------------------------------------------------------------- +*/ + +#pragma once +#ifndef AI_BASE64_HPP_INC +#define AI_BASE64_HPP_INC + +#include +#include +#include + +namespace Assimp { +namespace Base64 { + +void Encode(const uint8_t *in, size_t inLength, std::string &out); +void Encode(const std::vector& in, std::string &out); +std::string Encode(const std::vector& in); + +size_t Decode(const char *in, size_t inLength, uint8_t *&out); +size_t Decode(const std::string& in, std::vector& out); +std::vector Decode(const std::string& in); + +} // namespace Base64 +} // namespace Assimp + +#endif // AI_BASE64_HPP_INC diff --git a/include/assimp/BaseImporter.h b/include/assimp/BaseImporter.h index 656e0f165..5a3c764d4 100644 --- a/include/assimp/BaseImporter.h +++ b/include/assimp/BaseImporter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -95,20 +95,15 @@ public: // ------------------------------------------------------------------- /** Returns whether the class can handle the format of the given file. * - * The implementation should be as quick as possible. A check for - * the file extension is enough. If no suitable loader is found with - * this strategy, CanRead() is called again, the 'checkSig' parameter - * set to true this time. Now the implementation is expected to - * perform a full check of the file structure, possibly searching the - * first bytes of the file for magic identifiers or keywords. + * The implementation is expected to perform a full check of the file + * structure, possibly searching the first bytes of the file for magic + * identifiers or keywords. * * @param pFile Path and file name of the file to be examined. * @param pIOHandler The IO handler to use for accessing any file. - * @param checkSig Set to true if this method is called a second time. - * This time, the implementation may take more time to examine the - * contents of the file to be loaded for magic bytes, keywords, etc - * to be able to load files with unknown/not existent file extensions. - * @return true if the class can read this file, false if not. + * @param checkSig Legacy; do not use. + * @return true if the class can read this file, false if not or if + * unsure. */ virtual bool CanRead( const std::string &pFile, @@ -259,8 +254,8 @@ public: // static utilities static bool SearchFileHeaderForToken( IOSystem *pIOSystem, const std::string &file, - const char * const *tokens, - unsigned int numTokens, + const char **tokens, + std::size_t numTokens, unsigned int searchBytes = 200, bool tokensSol = false, bool noAlphaBeforeTokens = false); @@ -305,7 +300,7 @@ public: // static utilities IOSystem *pIOHandler, const std::string &pFile, const void *magic, - unsigned int num, + std::size_t num, unsigned int offset = 0, unsigned int size = 4); diff --git a/include/assimp/Bitmap.h b/include/assimp/Bitmap.h index 228f6e9ba..6a614f7cf 100644 --- a/include/assimp/Bitmap.h +++ b/include/assimp/Bitmap.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/BlobIOSystem.h b/include/assimp/BlobIOSystem.h index da220b690..7e8d46a53 100644 --- a/include/assimp/BlobIOSystem.h +++ b/include/assimp/BlobIOSystem.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/ByteSwapper.h b/include/assimp/ByteSwapper.h index 94df04b7f..cf3a703b0 100644 --- a/include/assimp/ByteSwapper.h +++ b/include/assimp/ByteSwapper.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/ColladaMetaData.h b/include/assimp/ColladaMetaData.h index de5963b39..52eb3c508 100644 --- a/include/assimp/ColladaMetaData.h +++ b/include/assimp/ColladaMetaData.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/CreateAnimMesh.h b/include/assimp/CreateAnimMesh.h index 868a1f399..e5211f504 100644 --- a/include/assimp/CreateAnimMesh.h +++ b/include/assimp/CreateAnimMesh.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/DefaultIOStream.h b/include/assimp/DefaultIOStream.h index 9e0a48623..aa298a667 100644 --- a/include/assimp/DefaultIOStream.h +++ b/include/assimp/DefaultIOStream.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/DefaultIOSystem.h b/include/assimp/DefaultIOSystem.h index 2e5d0aac0..8545e75cf 100644 --- a/include/assimp/DefaultIOSystem.h +++ b/include/assimp/DefaultIOSystem.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/DefaultLogger.hpp b/include/assimp/DefaultLogger.hpp index a83aedbd7..723097ff2 100644 --- a/include/assimp/DefaultLogger.hpp +++ b/include/assimp/DefaultLogger.hpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/Exceptional.h b/include/assimp/Exceptional.h index 3078de9f4..e753a8ba1 100644 --- a/include/assimp/Exceptional.h +++ b/include/assimp/Exceptional.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. Redistribution and use of this software in source and binary forms, diff --git a/include/assimp/Exporter.hpp b/include/assimp/Exporter.hpp index 6ab35a8f0..09a459442 100644 --- a/include/assimp/Exporter.hpp +++ b/include/assimp/Exporter.hpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/GenericProperty.h b/include/assimp/GenericProperty.h index cac6ba964..073d53312 100644 --- a/include/assimp/GenericProperty.h +++ b/include/assimp/GenericProperty.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/GltfMaterial.h b/include/assimp/GltfMaterial.h index 85476ba0e..86ca8897c 100644 --- a/include/assimp/GltfMaterial.h +++ b/include/assimp/GltfMaterial.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/Hash.h b/include/assimp/Hash.h index 87f06450d..1f2baedac 100644 --- a/include/assimp/Hash.h +++ b/include/assimp/Hash.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/IOStream.hpp b/include/assimp/IOStream.hpp index bbf3537ba..5e19f5176 100644 --- a/include/assimp/IOStream.hpp +++ b/include/assimp/IOStream.hpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/IOStreamBuffer.h b/include/assimp/IOStreamBuffer.h index bbb5ef256..09ca1c962 100644 --- a/include/assimp/IOStreamBuffer.h +++ b/include/assimp/IOStreamBuffer.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/IOSystem.hpp b/include/assimp/IOSystem.hpp index dda0718e6..e67a07515 100644 --- a/include/assimp/IOSystem.hpp +++ b/include/assimp/IOSystem.hpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -288,15 +288,6 @@ AI_FORCE_INLINE bool IOSystem::PushDirectory( const std::string &path ) { return true; } -// ---------------------------------------------------------------------------- -AI_FORCE_INLINE const std::string &IOSystem::CurrentDirectory() const { - if ( m_pathStack.empty() ) { - static const std::string Dummy; - return Dummy; - } - return m_pathStack[ m_pathStack.size()-1 ]; -} - // ---------------------------------------------------------------------------- AI_FORCE_INLINE size_t IOSystem::StackSize() const { return m_pathStack.size(); diff --git a/include/assimp/Importer.hpp b/include/assimp/Importer.hpp index 6ce327c4f..05a15139a 100644 --- a/include/assimp/Importer.hpp +++ b/include/assimp/Importer.hpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/include/assimp/LineSplitter.h b/include/assimp/LineSplitter.h index 0a9d24437..a8aa665db 100644 --- a/include/assimp/LineSplitter.h +++ b/include/assimp/LineSplitter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/LogAux.h b/include/assimp/LogAux.h index 01a7d6375..c7b86a185 100644 --- a/include/assimp/LogAux.h +++ b/include/assimp/LogAux.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/LogStream.hpp b/include/assimp/LogStream.hpp index 64a7955fd..0ac74c609 100644 --- a/include/assimp/LogStream.hpp +++ b/include/assimp/LogStream.hpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/Logger.hpp b/include/assimp/Logger.hpp index 549b0fbc2..54fd5d03d 100644 --- a/include/assimp/Logger.hpp +++ b/include/assimp/Logger.hpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/MathFunctions.h b/include/assimp/MathFunctions.h index 2088c394c..f2a7ccdf6 100644 --- a/include/assimp/MathFunctions.h +++ b/include/assimp/MathFunctions.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/MemoryIOWrapper.h b/include/assimp/MemoryIOWrapper.h index 0e509d997..b4c37763d 100644 --- a/include/assimp/MemoryIOWrapper.h +++ b/include/assimp/MemoryIOWrapper.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/NullLogger.hpp b/include/assimp/NullLogger.hpp index 8277b014a..1b594ea28 100644 --- a/include/assimp/NullLogger.hpp +++ b/include/assimp/NullLogger.hpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/ParsingUtils.h b/include/assimp/ParsingUtils.h index b5074869e..b08f23227 100644 --- a/include/assimp/ParsingUtils.h +++ b/include/assimp/ParsingUtils.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/Profiler.h b/include/assimp/Profiler.h index 2f2c72bf2..fe0ffbb10 100644 --- a/include/assimp/Profiler.h +++ b/include/assimp/Profiler.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/ProgressHandler.hpp b/include/assimp/ProgressHandler.hpp index a42015400..1a272bb87 100644 --- a/include/assimp/ProgressHandler.hpp +++ b/include/assimp/ProgressHandler.hpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -74,6 +74,7 @@ protected: public: /// @brief Virtual destructor. virtual ~ProgressHandler () { + // empty } // ------------------------------------------------------------------- diff --git a/include/assimp/RemoveComments.h b/include/assimp/RemoveComments.h index 32f2c6722..c2defff63 100644 --- a/include/assimp/RemoveComments.h +++ b/include/assimp/RemoveComments.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/SGSpatialSort.h b/include/assimp/SGSpatialSort.h index 23a3cb53c..96feefabb 100644 --- a/include/assimp/SGSpatialSort.h +++ b/include/assimp/SGSpatialSort.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/SceneCombiner.h b/include/assimp/SceneCombiner.h index 809ac30e4..6da38cd15 100644 --- a/include/assimp/SceneCombiner.h +++ b/include/assimp/SceneCombiner.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -361,6 +361,7 @@ public: static void Copy(aiNodeAnim **dest, const aiNodeAnim *src); static void Copy(aiMeshMorphAnim **dest, const aiMeshMorphAnim *src); static void Copy(aiMetadata **dest, const aiMetadata *src); + static void Copy(aiString **dest, const aiString *src); // recursive, of course static void Copy(aiNode **dest, const aiNode *src); diff --git a/include/assimp/SkeletonMeshBuilder.h b/include/assimp/SkeletonMeshBuilder.h index 2479f4308..2929aaa61 100644 --- a/include/assimp/SkeletonMeshBuilder.h +++ b/include/assimp/SkeletonMeshBuilder.h @@ -4,8 +4,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team - +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -102,7 +101,7 @@ protected: /** Creates a dummy material and returns it. */ aiMaterial *CreateMaterial(); -protected: +private: /** space to assemble the mesh data: points */ std::vector mVertices; diff --git a/include/assimp/SmallVector.h b/include/assimp/SmallVector.h index fb78f5a97..60ad26411 100644 --- a/include/assimp/SmallVector.h +++ b/include/assimp/SmallVector.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/SmoothingGroups.h b/include/assimp/SmoothingGroups.h index 754417881..4625a2916 100644 --- a/include/assimp/SmoothingGroups.h +++ b/include/assimp/SmoothingGroups.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/SmoothingGroups.inl b/include/assimp/SmoothingGroups.inl index 08c2dfa53..d5fff5bf7 100644 --- a/include/assimp/SmoothingGroups.inl +++ b/include/assimp/SmoothingGroups.inl @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/SpatialSort.h b/include/assimp/SpatialSort.h index c0c4a0292..87b009da7 100644 --- a/include/assimp/SpatialSort.h +++ b/include/assimp/SpatialSort.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/StandardShapes.h b/include/assimp/StandardShapes.h index 7084427b5..77880cf9e 100644 --- a/include/assimp/StandardShapes.h +++ b/include/assimp/StandardShapes.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/StreamReader.h b/include/assimp/StreamReader.h index c6c17762d..44b24a33b 100644 --- a/include/assimp/StreamReader.h +++ b/include/assimp/StreamReader.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/StreamWriter.h b/include/assimp/StreamWriter.h index f787a3fa0..1bdfcc650 100644 --- a/include/assimp/StreamWriter.h +++ b/include/assimp/StreamWriter.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/include/assimp/StringComparison.h b/include/assimp/StringComparison.h index b0161664f..0518d426d 100644 --- a/include/assimp/StringComparison.h +++ b/include/assimp/StringComparison.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/StringUtils.h b/include/assimp/StringUtils.h index 025a826d2..59c6e9ead 100644 --- a/include/assimp/StringUtils.h +++ b/include/assimp/StringUtils.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/Subdivision.h b/include/assimp/Subdivision.h index 095550a19..9dfb38901 100644 --- a/include/assimp/Subdivision.h +++ b/include/assimp/Subdivision.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/TinyFormatter.h b/include/assimp/TinyFormatter.h index 112f19013..6356bbae6 100644 --- a/include/assimp/TinyFormatter.h +++ b/include/assimp/TinyFormatter.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/Vertex.h b/include/assimp/Vertex.h index f2e5572d3..fd7eb037e 100644 --- a/include/assimp/Vertex.h +++ b/include/assimp/Vertex.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/XMLTools.h b/include/assimp/XMLTools.h index e0082a365..b2766f19b 100644 --- a/include/assimp/XMLTools.h +++ b/include/assimp/XMLTools.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/XmlParser.h b/include/assimp/XmlParser.h index dfaab5169..28f2be8e8 100644 --- a/include/assimp/XmlParser.h +++ b/include/assimp/XmlParser.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/ZipArchiveIOSystem.h b/include/assimp/ZipArchiveIOSystem.h index 842a982de..dac60b501 100644 --- a/include/assimp/ZipArchiveIOSystem.h +++ b/include/assimp/ZipArchiveIOSystem.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/include/assimp/aabb.h b/include/assimp/aabb.h index a6ccdd452..51443bc20 100644 --- a/include/assimp/aabb.h +++ b/include/assimp/aabb.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/ai_assert.h b/include/assimp/ai_assert.h index b4f1ef8b2..b41c08f52 100644 --- a/include/assimp/ai_assert.h +++ b/include/assimp/ai_assert.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/anim.h b/include/assimp/anim.h index 8a73297a5..ef56c1dc2 100644 --- a/include/assimp/anim.h +++ b/include/assimp/anim.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/camera.h b/include/assimp/camera.h index 56c4dbe3f..09255fa05 100644 --- a/include/assimp/camera.h +++ b/include/assimp/camera.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/cexport.h b/include/assimp/cexport.h index 47b59a62f..a45ece39b 100644 --- a/include/assimp/cexport.h +++ b/include/assimp/cexport.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/cfileio.h b/include/assimp/cfileio.h index 48a728a2a..fc1b95ad1 100644 --- a/include/assimp/cfileio.h +++ b/include/assimp/cfileio.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/cimport.h b/include/assimp/cimport.h index d660eebb1..935ed18bd 100644 --- a/include/assimp/cimport.h +++ b/include/assimp/cimport.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/color4.h b/include/assimp/color4.h index fdd8f031e..e1e354939 100644 --- a/include/assimp/color4.h +++ b/include/assimp/color4.h @@ -3,9 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team - - +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/color4.inl b/include/assimp/color4.inl index e5bfdf356..aed3de6f1 100644 --- a/include/assimp/color4.inl +++ b/include/assimp/color4.inl @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/commonMetaData.h b/include/assimp/commonMetaData.h index 28de15909..ccded585b 100644 --- a/include/assimp/commonMetaData.h +++ b/include/assimp/commonMetaData.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/defs.h b/include/assimp/defs.h index e5f401999..9c4422584 100644 --- a/include/assimp/defs.h +++ b/include/assimp/defs.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -331,4 +331,6 @@ static const ai_real ai_epsilon = (ai_real)0.00001; #define AI_DEBUG_INVALIDATE_PTR(x) #endif +#define AI_COUNT_OF(X) (sizeof(X) / sizeof((X)[0])) + #endif // !! AI_DEFINES_H_INC diff --git a/include/assimp/importerdesc.h b/include/assimp/importerdesc.h index 037f2e7a4..d08bd1781 100644 --- a/include/assimp/importerdesc.h +++ b/include/assimp/importerdesc.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/light.h b/include/assimp/light.h index f35f51e0a..3331997a9 100644 --- a/include/assimp/light.h +++ b/include/assimp/light.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -255,5 +255,4 @@ struct aiLight { } #endif - #endif // !! AI_LIGHT_H_INC diff --git a/include/assimp/material.h b/include/assimp/material.h index 4e55e4894..416dbc4a8 100644 --- a/include/assimp/material.h +++ b/include/assimp/material.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -989,6 +989,9 @@ extern "C" { // Roughness factor. 0.0 = Perfectly Smooth, 1.0 = Completely Rough #define AI_MATKEY_ROUGHNESS_FACTOR "$mat.roughnessFactor", 0, 0 #define AI_MATKEY_ROUGHNESS_TEXTURE aiTextureType_DIFFUSE_ROUGHNESS, 0 +// Anisotropy factor. 0.0 = isotropic, 1.0 = anisotropy along tangent direction, +// -1.0 = anisotropy along bitangent direction +#define AI_MATKEY_ANISOTROPY_FACTOR "$mat.anisotropyFactor", 0, 0 // Specular/Glossiness Workflow // --------------------------- diff --git a/include/assimp/material.inl b/include/assimp/material.inl index b299892b0..0b30a6839 100644 --- a/include/assimp/material.inl +++ b/include/assimp/material.inl @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -44,21 +44,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once -#ifndef AI_MATERIAL_INL_INC -#define AI_MATERIAL_INL_INC #ifdef __GNUC__ # pragma GCC system_header #endif // --------------------------------------------------------------------------- -AI_FORCE_INLINE -aiPropertyTypeInfo ai_real_to_property_type_info(float) { +AI_FORCE_INLINE aiPropertyTypeInfo ai_real_to_property_type_info(float) { return aiPTI_Float; } -AI_FORCE_INLINE -aiPropertyTypeInfo ai_real_to_property_type_info(double) { +AI_FORCE_INLINE aiPropertyTypeInfo ai_real_to_property_type_info(double) { return aiPTI_Double; } // --------------------------------------------------------------------------- @@ -66,8 +62,7 @@ aiPropertyTypeInfo ai_real_to_property_type_info(double) { //! @cond never // --------------------------------------------------------------------------- -AI_FORCE_INLINE -aiReturn aiMaterial::GetTexture( aiTextureType type, +AI_FORCE_INLINE aiReturn aiMaterial::GetTexture( aiTextureType type, unsigned int index, C_STRUCT aiString* path, aiTextureMapping* mapping /*= NULL*/, @@ -79,15 +74,13 @@ aiReturn aiMaterial::GetTexture( aiTextureType type, } // --------------------------------------------------------------------------- -AI_FORCE_INLINE -unsigned int aiMaterial::GetTextureCount(aiTextureType type) const { +AI_FORCE_INLINE unsigned int aiMaterial::GetTextureCount(aiTextureType type) const { return ::aiGetMaterialTextureCount(this,type); } // --------------------------------------------------------------------------- template -AI_FORCE_INLINE -aiReturn aiMaterial::Get(const char* pKey,unsigned int type, +AI_FORCE_INLINE aiReturn aiMaterial::Get(const char* pKey,unsigned int type, unsigned int idx, Type* pOut, unsigned int* pMax) const { unsigned int iNum = pMax ? *pMax : 1; @@ -105,7 +98,7 @@ aiReturn aiMaterial::Get(const char* pKey,unsigned int type, return AI_FAILURE; } - iNum = std::min((size_t)iNum,prop->mDataLength / sizeof(Type)); + iNum = static_cast(std::min(static_cast(iNum),prop->mDataLength / sizeof(Type))); ::memcpy(pOut,prop->mData,iNum * sizeof(Type)); if (pMax) { *pMax = iNum; @@ -116,8 +109,7 @@ aiReturn aiMaterial::Get(const char* pKey,unsigned int type, // --------------------------------------------------------------------------- template -AI_FORCE_INLINE -aiReturn aiMaterial::Get(const char* pKey,unsigned int type, +AI_FORCE_INLINE aiReturn aiMaterial::Get(const char* pKey,unsigned int type, unsigned int idx,Type& pOut) const { const aiMaterialProperty* prop; const aiReturn ret = ::aiGetMaterialProperty(this,pKey,type,idx, @@ -191,27 +183,23 @@ aiReturn aiMaterial::Get(const char* pKey,unsigned int type, return ::aiGetMaterialFloatArray(this,pKey,type,idx,pOut,pMax); } // --------------------------------------------------------------------------- -AI_FORCE_INLINE -aiReturn aiMaterial::Get(const char* pKey,unsigned int type, +AI_FORCE_INLINE aiReturn aiMaterial::Get(const char* pKey,unsigned int type, unsigned int idx,int* pOut, unsigned int* pMax) const { return ::aiGetMaterialIntegerArray(this,pKey,type,idx,pOut,pMax); } // --------------------------------------------------------------------------- -AI_FORCE_INLINE -aiReturn aiMaterial::Get(const char* pKey,unsigned int type, +AI_FORCE_INLINE aiReturn aiMaterial::Get(const char* pKey,unsigned int type, unsigned int idx,ai_real& pOut) const { return aiGetMaterialFloat(this,pKey,type,idx,&pOut); } // --------------------------------------------------------------------------- -AI_FORCE_INLINE -aiReturn aiMaterial::Get(const char* pKey,unsigned int type, +AI_FORCE_INLINE aiReturn aiMaterial::Get(const char* pKey,unsigned int type, unsigned int idx,int& pOut) const { return aiGetMaterialInteger(this,pKey,type,idx,&pOut); } // --------------------------------------------------------------------------- -AI_FORCE_INLINE -aiReturn aiMaterial::Get(const char* pKey,unsigned int type, +AI_FORCE_INLINE aiReturn aiMaterial::Get(const char* pKey,unsigned int type, unsigned int idx,aiColor4D& pOut) const { return aiGetMaterialColor(this,pKey,type,idx,&pOut); } @@ -236,14 +224,10 @@ AI_FORCE_INLINE aiReturn aiMaterial::Get(const char* pKey,unsigned int type, // --------------------------------------------------------------------------- template -aiReturn aiMaterial::AddProperty (const TYPE* pInput, - const unsigned int pNumValues, - const char* pKey, - unsigned int type, - unsigned int index) -{ - return AddBinaryProperty((const void*)pInput, - pNumValues * sizeof(TYPE), +aiReturn aiMaterial::AddProperty (const TYPE* pInput, + const unsigned int pNumValues, const char* pKey, unsigned int type, + unsigned int index) { + return AddBinaryProperty((const void*)pInput, pNumValues * sizeof(TYPE), pKey,type,index,aiPTI_Buffer); } @@ -259,8 +243,7 @@ AI_FORCE_INLINE aiReturn aiMaterial::AddProperty(const float* pInput, } // --------------------------------------------------------------------------- -AI_FORCE_INLINE -aiReturn aiMaterial::AddProperty(const double* pInput, +AI_FORCE_INLINE aiReturn aiMaterial::AddProperty(const double* pInput, const unsigned int pNumValues, const char* pKey, unsigned int type, @@ -271,8 +254,7 @@ aiReturn aiMaterial::AddProperty(const double* pInput, } // --------------------------------------------------------------------------- -AI_FORCE_INLINE -aiReturn aiMaterial::AddProperty(const aiUVTransform* pInput, +AI_FORCE_INLINE aiReturn aiMaterial::AddProperty(const aiUVTransform* pInput, const unsigned int pNumValues, const char* pKey, unsigned int type, @@ -283,8 +265,7 @@ aiReturn aiMaterial::AddProperty(const aiUVTransform* pInput, } // --------------------------------------------------------------------------- -AI_FORCE_INLINE -aiReturn aiMaterial::AddProperty(const aiColor4D* pInput, +AI_FORCE_INLINE aiReturn aiMaterial::AddProperty(const aiColor4D* pInput, const unsigned int pNumValues, const char* pKey, unsigned int type, @@ -295,8 +276,7 @@ aiReturn aiMaterial::AddProperty(const aiColor4D* pInput, } // --------------------------------------------------------------------------- -AI_FORCE_INLINE -aiReturn aiMaterial::AddProperty(const aiColor3D* pInput, +AI_FORCE_INLINE aiReturn aiMaterial::AddProperty(const aiColor3D* pInput, const unsigned int pNumValues, const char* pKey, unsigned int type, @@ -307,8 +287,7 @@ aiReturn aiMaterial::AddProperty(const aiColor3D* pInput, } // --------------------------------------------------------------------------- -AI_FORCE_INLINE -aiReturn aiMaterial::AddProperty(const aiVector3D* pInput, +AI_FORCE_INLINE aiReturn aiMaterial::AddProperty(const aiVector3D* pInput, const unsigned int pNumValues, const char* pKey, unsigned int type, @@ -319,8 +298,7 @@ aiReturn aiMaterial::AddProperty(const aiVector3D* pInput, } // --------------------------------------------------------------------------- -AI_FORCE_INLINE -aiReturn aiMaterial::AddProperty(const int* pInput, +AI_FORCE_INLINE aiReturn aiMaterial::AddProperty(const int* pInput, const unsigned int pNumValues, const char* pKey, unsigned int type, @@ -339,8 +317,7 @@ aiReturn aiMaterial::AddProperty(const int* pInput, // --------------------------------------------------------------------------- template<> -AI_FORCE_INLINE -aiReturn aiMaterial::AddProperty(const float* pInput, +AI_FORCE_INLINE aiReturn aiMaterial::AddProperty(const float* pInput, const unsigned int pNumValues, const char* pKey, unsigned int type, @@ -352,8 +329,7 @@ aiReturn aiMaterial::AddProperty(const float* pInput, // --------------------------------------------------------------------------- template<> -AI_FORCE_INLINE -aiReturn aiMaterial::AddProperty(const double* pInput, +AI_FORCE_INLINE aiReturn aiMaterial::AddProperty(const double* pInput, const unsigned int pNumValues, const char* pKey, unsigned int type, @@ -365,8 +341,7 @@ aiReturn aiMaterial::AddProperty(const double* pInput, // --------------------------------------------------------------------------- template<> -AI_FORCE_INLINE -aiReturn aiMaterial::AddProperty(const aiUVTransform* pInput, +AI_FORCE_INLINE aiReturn aiMaterial::AddProperty(const aiUVTransform* pInput, const unsigned int pNumValues, const char* pKey, unsigned int type, @@ -378,8 +353,7 @@ aiReturn aiMaterial::AddProperty(const aiUVTransform* pInput, // --------------------------------------------------------------------------- template<> -AI_FORCE_INLINE -aiReturn aiMaterial::AddProperty(const aiColor4D* pInput, +AI_FORCE_INLINE aiReturn aiMaterial::AddProperty(const aiColor4D* pInput, const unsigned int pNumValues, const char* pKey, unsigned int type, @@ -391,8 +365,7 @@ aiReturn aiMaterial::AddProperty(const aiColor4D* pInput, // --------------------------------------------------------------------------- template<> -AI_FORCE_INLINE -aiReturn aiMaterial::AddProperty(const aiColor3D* pInput, +AI_FORCE_INLINE aiReturn aiMaterial::AddProperty(const aiColor3D* pInput, const unsigned int pNumValues, const char* pKey, unsigned int type, @@ -404,8 +377,7 @@ aiReturn aiMaterial::AddProperty(const aiColor3D* pInput, // --------------------------------------------------------------------------- template<> -AI_FORCE_INLINE -aiReturn aiMaterial::AddProperty(const aiVector3D* pInput, +AI_FORCE_INLINE aiReturn aiMaterial::AddProperty(const aiVector3D* pInput, const unsigned int pNumValues, const char* pKey, unsigned int type, @@ -417,8 +389,7 @@ aiReturn aiMaterial::AddProperty(const aiVector3D* pInput, // --------------------------------------------------------------------------- template<> -AI_FORCE_INLINE -aiReturn aiMaterial::AddProperty(const int* pInput, +AI_FORCE_INLINE aiReturn aiMaterial::AddProperty(const int* pInput, const unsigned int pNumValues, const char* pKey, unsigned int type, @@ -429,5 +400,3 @@ aiReturn aiMaterial::AddProperty(const int* pInput, } //! @endcond - -#endif //! AI_MATERIAL_INL_INC diff --git a/include/assimp/matrix3x3.h b/include/assimp/matrix3x3.h index c941d9f94..5ae31bbeb 100644 --- a/include/assimp/matrix3x3.h +++ b/include/assimp/matrix3x3.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/matrix3x3.inl b/include/assimp/matrix3x3.inl index eee6d0614..99d9197e3 100644 --- a/include/assimp/matrix3x3.inl +++ b/include/assimp/matrix3x3.inl @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/matrix4x4.h b/include/assimp/matrix4x4.h index 6caf7686c..07abf4711 100644 --- a/include/assimp/matrix4x4.h +++ b/include/assimp/matrix4x4.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/include/assimp/matrix4x4.inl b/include/assimp/matrix4x4.inl index c1dd87b65..54d176d18 100644 --- a/include/assimp/matrix4x4.inl +++ b/include/assimp/matrix4x4.inl @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/mesh.h b/include/assimp/mesh.h index 42312a2c7..5704e7ca0 100644 --- a/include/assimp/mesh.h +++ b/include/assimp/mesh.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -740,6 +740,7 @@ struct aiMesh { /** * Method of morphing when anim-meshes are specified. + * @see aiMorphingMethod to learn more about the provided morphing targets. */ unsigned int mMethod; diff --git a/include/assimp/metadata.h b/include/assimp/metadata.h index 57fedfbfc..d2ec837e9 100644 --- a/include/assimp/metadata.h +++ b/include/assimp/metadata.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/pbrmaterial.h b/include/assimp/pbrmaterial.h index 2103a31f0..3bdf151a3 100644 --- a/include/assimp/pbrmaterial.h +++ b/include/assimp/pbrmaterial.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/postprocess.h b/include/assimp/postprocess.h index 094fbf596..cdcbf0577 100644 --- a/include/assimp/postprocess.h +++ b/include/assimp/postprocess.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/qnan.h b/include/assimp/qnan.h index 0999f5e78..c64cabaad 100644 --- a/include/assimp/qnan.h +++ b/include/assimp/qnan.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/include/assimp/quaternion.h b/include/assimp/quaternion.h index 6941fbbc3..aa92ea577 100644 --- a/include/assimp/quaternion.h +++ b/include/assimp/quaternion.h @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/quaternion.inl b/include/assimp/quaternion.inl index 3f8abc682..960e91ab2 100644 --- a/include/assimp/quaternion.inl +++ b/include/assimp/quaternion.inl @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/include/assimp/scene.h b/include/assimp/scene.h index 61c2d4c6f..f4c6d7960 100644 --- a/include/assimp/scene.h +++ b/include/assimp/scene.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/texture.h b/include/assimp/texture.h index 7a9d38cc0..576fa7711 100644 --- a/include/assimp/texture.h +++ b/include/assimp/texture.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -92,22 +92,19 @@ struct aiTexel { #ifdef __cplusplus //! Comparison operator - bool operator== (const aiTexel& other) const - { + bool operator== (const aiTexel& other) const { return b == other.b && r == other.r && g == other.g && a == other.a; } //! Inverse comparison operator - bool operator!= (const aiTexel& other) const - { + bool operator!= (const aiTexel& other) const { return b != other.b || r != other.r || g != other.g || a != other.a; } //! Conversion to a floating-point 4d color - operator aiColor4D() const - { + operator aiColor4D() const { return aiColor4D(r/255.f,g/255.f,b/255.f,a/255.f); } #endif // __cplusplus @@ -202,11 +199,11 @@ struct aiTexture { } // Construction - aiTexture() AI_NO_EXCEPT - : mWidth(0) - , mHeight(0) - , pcData(nullptr) - , mFilename() { + aiTexture() AI_NO_EXCEPT : + mWidth(0), + mHeight(0), + pcData(nullptr), + mFilename() { memset(achFormatHint, 0, sizeof(achFormatHint)); } diff --git a/include/assimp/types.h b/include/assimp/types.h index 47af917ab..a41363b8a 100644 --- a/include/assimp/types.h +++ b/include/assimp/types.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/vector2.h b/include/assimp/vector2.h index 34adf894b..333c094d4 100644 --- a/include/assimp/vector2.h +++ b/include/assimp/vector2.h @@ -3,9 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team - - +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/vector2.inl b/include/assimp/vector2.inl index b51dd0ec2..245eb3190 100644 --- a/include/assimp/vector2.inl +++ b/include/assimp/vector2.inl @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/include/assimp/vector3.h b/include/assimp/vector3.h index e3ad0b680..c191e1ee7 100644 --- a/include/assimp/vector3.h +++ b/include/assimp/vector3.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/include/assimp/vector3.inl b/include/assimp/vector3.inl index 0076d2a85..28ca2be07 100644 --- a/include/assimp/vector3.inl +++ b/include/assimp/vector3.inl @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -54,8 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // ------------------------------------------------------------------------------------------------ /** Transformation of a vector by a 3x3 matrix */ template -AI_FORCE_INLINE -aiVector3t operator * (const aiMatrix3x3t& pMatrix, const aiVector3t& pVector) { +AI_FORCE_INLINE aiVector3t operator * (const aiMatrix3x3t& pMatrix, const aiVector3t& pVector) { aiVector3t res; res.x = pMatrix.a1 * pVector.x + pMatrix.a2 * pVector.y + pMatrix.a3 * pVector.z; res.y = pMatrix.b1 * pVector.x + pMatrix.b2 * pVector.y + pMatrix.b3 * pVector.z; @@ -66,8 +65,7 @@ aiVector3t operator * (const aiMatrix3x3t& pMatrix, const aiVector // ------------------------------------------------------------------------------------------------ /** Transformation of a vector by a 4x4 matrix */ template -AI_FORCE_INLINE -aiVector3t operator * (const aiMatrix4x4t& pMatrix, const aiVector3t& pVector) { +AI_FORCE_INLINE aiVector3t operator * (const aiMatrix4x4t& pMatrix, const aiVector3t& pVector) { aiVector3t res; res.x = pMatrix.a1 * pVector.x + pMatrix.a2 * pVector.y + pMatrix.a3 * pVector.z + pMatrix.a4; res.y = pMatrix.b1 * pVector.x + pMatrix.b2 * pVector.y + pMatrix.b3 * pVector.z + pMatrix.b4; @@ -82,36 +80,35 @@ aiVector3t::operator aiVector3t () const { } // ------------------------------------------------------------------------------------------------ template -AI_FORCE_INLINE -void aiVector3t::Set( TReal pX, TReal pY, TReal pZ) { +AI_FORCE_INLINE void aiVector3t::Set( TReal pX, TReal pY, TReal pZ) { x = pX; y = pY; z = pZ; } // ------------------------------------------------------------------------------------------------ template -AI_FORCE_INLINE -TReal aiVector3t::SquareLength() const { +AI_FORCE_INLINE TReal aiVector3t::SquareLength() const { return x*x + y*y + z*z; } // ------------------------------------------------------------------------------------------------ template -AI_FORCE_INLINE -TReal aiVector3t::Length() const { +AI_FORCE_INLINE TReal aiVector3t::Length() const { return std::sqrt( SquareLength()); } // ------------------------------------------------------------------------------------------------ template -AI_FORCE_INLINE -aiVector3t& aiVector3t::Normalize() { + aiVector3t& aiVector3t::Normalize() { + const TReal l = Length(); + if (l == 0) { + return *this; + } *this /= Length(); return *this; } // ------------------------------------------------------------------------------------------------ template -AI_FORCE_INLINE -aiVector3t& aiVector3t::NormalizeSafe() { +AI_FORCE_INLINE aiVector3t& aiVector3t::NormalizeSafe() { TReal len = Length(); if ( len > static_cast< TReal >( 0 ) ) { *this /= len; @@ -120,8 +117,7 @@ aiVector3t& aiVector3t::NormalizeSafe() { } // ------------------------------------------------------------------------------------------------ template -AI_FORCE_INLINE -const aiVector3t& aiVector3t::operator += (const aiVector3t& o) { +AI_FORCE_INLINE const aiVector3t& aiVector3t::operator += (const aiVector3t& o) { x += o.x; y += o.y; z += o.z; @@ -130,8 +126,7 @@ const aiVector3t& aiVector3t::operator += (const aiVector3t } // ------------------------------------------------------------------------------------------------ template -AI_FORCE_INLINE -const aiVector3t& aiVector3t::operator -= (const aiVector3t& o) { +AI_FORCE_INLINE const aiVector3t& aiVector3t::operator -= (const aiVector3t& o) { x -= o.x; y -= o.y; z -= o.z; @@ -140,8 +135,7 @@ const aiVector3t& aiVector3t::operator -= (const aiVector3t } // ------------------------------------------------------------------------------------------------ template -AI_FORCE_INLINE -const aiVector3t& aiVector3t::operator *= (TReal f) { +AI_FORCE_INLINE const aiVector3t& aiVector3t::operator *= (TReal f) { x *= f; y *= f; z *= f; @@ -150,8 +144,7 @@ const aiVector3t& aiVector3t::operator *= (TReal f) { } // ------------------------------------------------------------------------------------------------ template -AI_FORCE_INLINE -const aiVector3t& aiVector3t::operator /= (TReal f) { +AI_FORCE_INLINE const aiVector3t& aiVector3t::operator /= (TReal f) { if ( f == static_cast(0.0)) { return *this; } @@ -164,20 +157,17 @@ const aiVector3t& aiVector3t::operator /= (TReal f) { } // ------------------------------------------------------------------------------------------------ template -AI_FORCE_INLINE -aiVector3t& aiVector3t::operator *= (const aiMatrix3x3t& mat){ +AI_FORCE_INLINE aiVector3t& aiVector3t::operator *= (const aiMatrix3x3t& mat){ return (*this = mat * (*this)); } // ------------------------------------------------------------------------------------------------ template -AI_FORCE_INLINE -aiVector3t& aiVector3t::operator *= (const aiMatrix4x4t& mat){ +AI_FORCE_INLINE aiVector3t& aiVector3t::operator *= (const aiMatrix4x4t& mat){ return (*this = mat * (*this)); } // ------------------------------------------------------------------------------------------------ template -AI_FORCE_INLINE -TReal aiVector3t::operator[](unsigned int i) const { +AI_FORCE_INLINE TReal aiVector3t::operator[](unsigned int i) const { switch (i) { case 0: return x; @@ -192,9 +182,7 @@ TReal aiVector3t::operator[](unsigned int i) const { } // ------------------------------------------------------------------------------------------------ template -AI_FORCE_INLINE -TReal& aiVector3t::operator[](unsigned int i) { -// return *(&x + i); +AI_FORCE_INLINE TReal& aiVector3t::operator[](unsigned int i) { switch (i) { case 0: return x; @@ -209,20 +197,17 @@ TReal& aiVector3t::operator[](unsigned int i) { } // ------------------------------------------------------------------------------------------------ template -AI_FORCE_INLINE -bool aiVector3t::operator== (const aiVector3t& other) const { +AI_FORCE_INLINE bool aiVector3t::operator== (const aiVector3t& other) const { return x == other.x && y == other.y && z == other.z; } // ------------------------------------------------------------------------------------------------ template -AI_FORCE_INLINE -bool aiVector3t::operator!= (const aiVector3t& other) const { +AI_FORCE_INLINE bool aiVector3t::operator!= (const aiVector3t& other) const { return x != other.x || y != other.y || z != other.z; } // --------------------------------------------------------------------------- template -AI_FORCE_INLINE -bool aiVector3t::Equal(const aiVector3t& other, TReal epsilon) const { +AI_FORCE_INLINE bool aiVector3t::Equal(const aiVector3t& other, TReal epsilon) const { return std::abs(x - other.x) <= epsilon && std::abs(y - other.y) <= epsilon && @@ -230,77 +215,66 @@ bool aiVector3t::Equal(const aiVector3t& other, TReal epsilon) con } // ------------------------------------------------------------------------------------------------ template -AI_FORCE_INLINE -bool aiVector3t::operator < (const aiVector3t& other) const { +AI_FORCE_INLINE bool aiVector3t::operator < (const aiVector3t& other) const { return x != other.x ? x < other.x : y != other.y ? y < other.y : z < other.z; } // ------------------------------------------------------------------------------------------------ template -AI_FORCE_INLINE -const aiVector3t aiVector3t::SymMul(const aiVector3t& o) { +AI_FORCE_INLINE const aiVector3t aiVector3t::SymMul(const aiVector3t& o) { return aiVector3t(x*o.x,y*o.y,z*o.z); } // ------------------------------------------------------------------------------------------------ // symmetric addition template -AI_FORCE_INLINE -aiVector3t operator + (const aiVector3t& v1, const aiVector3t& v2) { +AI_FORCE_INLINE aiVector3t operator + (const aiVector3t& v1, const aiVector3t& v2) { return aiVector3t( v1.x + v2.x, v1.y + v2.y, v1.z + v2.z); } // ------------------------------------------------------------------------------------------------ // symmetric subtraction template -AI_FORCE_INLINE -aiVector3t operator - (const aiVector3t& v1, const aiVector3t& v2) { +AI_FORCE_INLINE aiVector3t operator - (const aiVector3t& v1, const aiVector3t& v2) { return aiVector3t( v1.x - v2.x, v1.y - v2.y, v1.z - v2.z); } // ------------------------------------------------------------------------------------------------ // scalar product template -AI_FORCE_INLINE -TReal operator * (const aiVector3t& v1, const aiVector3t& v2) { +AI_FORCE_INLINE TReal operator * (const aiVector3t& v1, const aiVector3t& v2) { return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z; } // ------------------------------------------------------------------------------------------------ // scalar multiplication template -AI_FORCE_INLINE -aiVector3t operator * ( TReal f, const aiVector3t& v) { +AI_FORCE_INLINE aiVector3t operator * ( TReal f, const aiVector3t& v) { return aiVector3t( f*v.x, f*v.y, f*v.z); } // ------------------------------------------------------------------------------------------------ // and the other way around template -AI_FORCE_INLINE -aiVector3t operator * ( const aiVector3t& v, TReal f) { +AI_FORCE_INLINE aiVector3t operator * ( const aiVector3t& v, TReal f) { return aiVector3t( f*v.x, f*v.y, f*v.z); } // ------------------------------------------------------------------------------------------------ // scalar division template -AI_FORCE_INLINE -aiVector3t operator / ( const aiVector3t& v, TReal f) { +AI_FORCE_INLINE aiVector3t operator / ( const aiVector3t& v, TReal f) { return v * (1/f); } // ------------------------------------------------------------------------------------------------ // vector division template -AI_FORCE_INLINE -aiVector3t operator / ( const aiVector3t& v, const aiVector3t& v2) { +AI_FORCE_INLINE aiVector3t operator / ( const aiVector3t& v, const aiVector3t& v2) { return aiVector3t(v.x / v2.x,v.y / v2.y,v.z / v2.z); } // ------------------------------------------------------------------------------------------------ // cross product template -AI_FORCE_INLINE -aiVector3t operator ^ ( const aiVector3t& v1, const aiVector3t& v2) { +AI_FORCE_INLINE aiVector3t operator ^ ( const aiVector3t& v1, const aiVector3t& v2) { return aiVector3t( v1.y*v2.z - v1.z*v2.y, v1.z*v2.x - v1.x*v2.z, v1.x*v2.y - v1.y*v2.x); } // ------------------------------------------------------------------------------------------------ // vector negation template -AI_FORCE_INLINE -aiVector3t operator - ( const aiVector3t& v) { +AI_FORCE_INLINE aiVector3t operator - ( const aiVector3t& v) { return aiVector3t( -v.x, -v.y, -v.z); } diff --git a/include/assimp/version.h b/include/assimp/version.h index 09a35dbb6..b83110a04 100644 --- a/include/assimp/version.h +++ b/include/assimp/version.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5e573ed7c..3fc1c8a84 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,7 +1,7 @@ # Open Asset Import Library (assimp) # ---------------------------------------------------------------------- # -# Copyright (c) 2006-2021, assimp team +# Copyright (c) 2006-2022, assimp team # # All rights reserved. # @@ -97,6 +97,7 @@ SET( COMMON unit/Common/utSpatialSort.cpp unit/Common/utAssertHandler.cpp unit/Common/utXmlParser.cpp + unit/Common/utBase64.cpp ) SET( IMPORTERS @@ -208,6 +209,7 @@ add_executable( unit unit/CCompilerTest.c unit/Main.cpp ../code/Common/Version.cpp + ../code/Common/Base64.cpp ${COMMON} ${IMPORTERS} ${MATERIAL} diff --git a/test/models/3DS/IMAGE1.bmp b/test/models/3DS/IMAGE1.jpg similarity index 100% rename from test/models/3DS/IMAGE1.bmp rename to test/models/3DS/IMAGE1.jpg diff --git a/test/models/3DS/test1.3ds b/test/models/3DS/test1.3ds index 17bbb47d3..5a52977b0 100644 Binary files a/test/models/3DS/test1.3ds and b/test/models/3DS/test1.3ds differ diff --git a/test/models/IQM/Body.jpg b/test/models/IQM/Body.jpg new file mode 100644 index 000000000..b394896d4 Binary files /dev/null and b/test/models/IQM/Body.jpg differ diff --git a/test/models/IQM/Head.jpg b/test/models/IQM/Head.jpg new file mode 100644 index 000000000..bfe8b9838 Binary files /dev/null and b/test/models/IQM/Head.jpg differ diff --git a/test/models/IQM/mrfixit.iqm b/test/models/IQM/mrfixit.iqm new file mode 100644 index 000000000..bb94f5afe Binary files /dev/null and b/test/models/IQM/mrfixit.iqm differ diff --git a/test/unit/AbstractImportExportBase.cpp b/test/unit/AbstractImportExportBase.cpp index f669588aa..31402f483 100644 --- a/test/unit/AbstractImportExportBase.cpp +++ b/test/unit/AbstractImportExportBase.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/AssimpAPITest.cpp b/test/unit/AssimpAPITest.cpp index 249bf1cd4..b8739b039 100644 --- a/test/unit/AssimpAPITest.cpp +++ b/test/unit/AssimpAPITest.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/AssimpAPITest_aiMatrix3x3.cpp b/test/unit/AssimpAPITest_aiMatrix3x3.cpp index 68919db97..90976ba6e 100644 --- a/test/unit/AssimpAPITest_aiMatrix3x3.cpp +++ b/test/unit/AssimpAPITest_aiMatrix3x3.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/AssimpAPITest_aiMatrix4x4.cpp b/test/unit/AssimpAPITest_aiMatrix4x4.cpp index d2f57b19d..9372bd9c4 100644 --- a/test/unit/AssimpAPITest_aiMatrix4x4.cpp +++ b/test/unit/AssimpAPITest_aiMatrix4x4.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/AssimpAPITest_aiQuaternion.cpp b/test/unit/AssimpAPITest_aiQuaternion.cpp index 79f89337e..8f57bc586 100644 --- a/test/unit/AssimpAPITest_aiQuaternion.cpp +++ b/test/unit/AssimpAPITest_aiQuaternion.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/AssimpAPITest_aiVector2D.cpp b/test/unit/AssimpAPITest_aiVector2D.cpp index d52561fa8..44bb34aec 100644 --- a/test/unit/AssimpAPITest_aiVector2D.cpp +++ b/test/unit/AssimpAPITest_aiVector2D.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/AssimpAPITest_aiVector3D.cpp b/test/unit/AssimpAPITest_aiVector3D.cpp index a30f80b60..c7521163d 100644 --- a/test/unit/AssimpAPITest_aiVector3D.cpp +++ b/test/unit/AssimpAPITest_aiVector3D.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/Common/uiScene.cpp b/test/unit/Common/uiScene.cpp index 1c531b042..87001cef4 100644 --- a/test/unit/Common/uiScene.cpp +++ b/test/unit/Common/uiScene.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "UnitTestPCH.h" #include +#include using namespace Assimp; @@ -88,5 +89,21 @@ TEST_F(utScene, getShortFilenameTest) { EXPECT_NE(nullptr, name2); } +TEST_F(utScene, deepCopyTest) { + scene->mRootNode = new aiNode(); + + scene->mNumMeshes = 1; + scene->mMeshes = new aiMesh *[scene->mNumMeshes] (); + scene->mMeshes[0] = new aiMesh (); + + scene->mMeshes[0]->SetTextureCoordsName (0, aiString ("test")); + + { + aiScene* copied = nullptr; + SceneCombiner::CopyScene(&copied,scene); + delete copied; + } +} + TEST_F(utScene, getEmbeddedTextureTest) { } diff --git a/test/unit/Common/utAssertHandler.cpp b/test/unit/Common/utAssertHandler.cpp index 5e2925945..a2585fe65 100644 --- a/test/unit/Common/utAssertHandler.cpp +++ b/test/unit/Common/utAssertHandler.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/Common/utBase64.cpp b/test/unit/Common/utBase64.cpp new file mode 100644 index 000000000..8b0a60e47 --- /dev/null +++ b/test/unit/Common/utBase64.cpp @@ -0,0 +1,72 @@ +/* +--------------------------------------------------------------------------- +Open Asset Import Library (assimp) +--------------------------------------------------------------------------- + +Copyright (c) 2006-2022, assimp team + +All rights reserved. + +Redistribution and use of this software in source and binary forms, +with or without modification, are permitted provided that the following +conditions are met: + +* Redistributions of source code must retain the above +copyright notice, this list of conditions and the +following disclaimer. + +* Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the +following disclaimer in the documentation and/or other +materials provided with the distribution. + +* Neither the name of the assimp team, nor the names of its +contributors may be used to endorse or promote products +derived from this software without specific prior +written permission of the assimp team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +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. +--------------------------------------------------------------------------- +*/ + +#include "UnitTestPCH.h" +#include "TestIOSystem.h" + +#include + +using namespace std; +using namespace Assimp; + +class Base64Test : public ::testing::Test { +public: + virtual void SetUp() { + } + + virtual void TearDown() { + } +}; + +static const std::vector assimpStringBinary = { 97, 115, 115, 105, 109, 112 }; +static const std::string assimpStringEncoded = "YXNzaW1w"; + +TEST_F( Base64Test, encodeTest ) { + EXPECT_EQ( "", Base64::Encode (std::vector{}) ); + EXPECT_EQ( "Vg==", Base64::Encode (std::vector{ 86 }) ); + EXPECT_EQ( assimpStringEncoded, Base64::Encode (assimpStringBinary) ); +} + +TEST_F( Base64Test, decodeTest ) { + EXPECT_EQ( std::vector {}, Base64::Decode ("") ); + EXPECT_EQ( std::vector { 86 }, Base64::Decode ("Vg==") ); + EXPECT_EQ( assimpStringBinary, Base64::Decode (assimpStringEncoded) ); +} diff --git a/test/unit/Common/utLineSplitter.cpp b/test/unit/Common/utLineSplitter.cpp index 770f7f826..0a97f72d9 100644 --- a/test/unit/Common/utLineSplitter.cpp +++ b/test/unit/Common/utLineSplitter.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/Common/utMesh.cpp b/test/unit/Common/utMesh.cpp index da0c1084d..edb3de3de 100644 --- a/test/unit/Common/utMesh.cpp +++ b/test/unit/Common/utMesh.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/Common/utSpatialSort.cpp b/test/unit/Common/utSpatialSort.cpp index f0b694c7d..0684e831f 100644 --- a/test/unit/Common/utSpatialSort.cpp +++ b/test/unit/Common/utSpatialSort.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/Common/utStandardShapes.cpp b/test/unit/Common/utStandardShapes.cpp index e1bb6eef9..d7e6d21d7 100644 --- a/test/unit/Common/utStandardShapes.cpp +++ b/test/unit/Common/utStandardShapes.cpp @@ -1,7 +1,7 @@ /* Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the diff --git a/test/unit/Common/utXmlParser.cpp b/test/unit/Common/utXmlParser.cpp index 7e992f9df..2db78e30d 100644 --- a/test/unit/Common/utXmlParser.cpp +++ b/test/unit/Common/utXmlParser.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ImportExport/MDL/MDLHL1TestFiles.h b/test/unit/ImportExport/MDL/MDLHL1TestFiles.h index d5210bf8b..3c0630f63 100644 --- a/test/unit/ImportExport/MDL/MDLHL1TestFiles.h +++ b/test/unit/ImportExport/MDL/MDLHL1TestFiles.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ImportExport/MDL/utMDLImporter_HL1_ImportSettings.cpp b/test/unit/ImportExport/MDL/utMDLImporter_HL1_ImportSettings.cpp index e21fd5032..02969e186 100644 --- a/test/unit/ImportExport/MDL/utMDLImporter_HL1_ImportSettings.cpp +++ b/test/unit/ImportExport/MDL/utMDLImporter_HL1_ImportSettings.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ImportExport/MDL/utMDLImporter_HL1_Materials.cpp b/test/unit/ImportExport/MDL/utMDLImporter_HL1_Materials.cpp index 4050c48ff..c47667e76 100644 --- a/test/unit/ImportExport/MDL/utMDLImporter_HL1_Materials.cpp +++ b/test/unit/ImportExport/MDL/utMDLImporter_HL1_Materials.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ImportExport/MDL/utMDLImporter_HL1_Nodes.cpp b/test/unit/ImportExport/MDL/utMDLImporter_HL1_Nodes.cpp index 1b1ed75d5..4420727e9 100644 --- a/test/unit/ImportExport/MDL/utMDLImporter_HL1_Nodes.cpp +++ b/test/unit/ImportExport/MDL/utMDLImporter_HL1_Nodes.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ImportExport/RAW/utRAWImportExport.cpp b/test/unit/ImportExport/RAW/utRAWImportExport.cpp index a04953e2c..bdd7f8533 100644 --- a/test/unit/ImportExport/RAW/utRAWImportExport.cpp +++ b/test/unit/ImportExport/RAW/utRAWImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ImportExport/Terragen/utTerragenImportExport.cpp b/test/unit/ImportExport/Terragen/utTerragenImportExport.cpp index 37c9c4ba6..6432dbf5f 100644 --- a/test/unit/ImportExport/Terragen/utTerragenImportExport.cpp +++ b/test/unit/ImportExport/Terragen/utTerragenImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ImportExport/utAssjsonImportExport.cpp b/test/unit/ImportExport/utAssjsonImportExport.cpp index 13724f755..3470874b5 100644 --- a/test/unit/ImportExport/utAssjsonImportExport.cpp +++ b/test/unit/ImportExport/utAssjsonImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ImportExport/utCOBImportExport.cpp b/test/unit/ImportExport/utCOBImportExport.cpp index 20663478b..187f16ede 100644 --- a/test/unit/ImportExport/utCOBImportExport.cpp +++ b/test/unit/ImportExport/utCOBImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ImportExport/utExporter.cpp b/test/unit/ImportExport/utExporter.cpp index e153d3e4d..9c5ca1ce6 100644 --- a/test/unit/ImportExport/utExporter.cpp +++ b/test/unit/ImportExport/utExporter.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ImportExport/utMD2Importer.cpp b/test/unit/ImportExport/utMD2Importer.cpp index 60390c6ff..0fcf76bfc 100644 --- a/test/unit/ImportExport/utMD2Importer.cpp +++ b/test/unit/ImportExport/utMD2Importer.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ImportExport/utMD5Importer.cpp b/test/unit/ImportExport/utMD5Importer.cpp index 2f582f108..082121937 100644 --- a/test/unit/ImportExport/utMD5Importer.cpp +++ b/test/unit/ImportExport/utMD5Importer.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ImportExport/utMDLImporter.cpp b/test/unit/ImportExport/utMDLImporter.cpp index 98ec9b8dc..c8960601d 100644 --- a/test/unit/ImportExport/utMDLImporter.cpp +++ b/test/unit/ImportExport/utMDLImporter.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ImportExport/utNFFImportExport.cpp b/test/unit/ImportExport/utNFFImportExport.cpp index 8a2920a82..621324a85 100644 --- a/test/unit/ImportExport/utNFFImportExport.cpp +++ b/test/unit/ImportExport/utNFFImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ImportExport/utOFFImportExport.cpp b/test/unit/ImportExport/utOFFImportExport.cpp index cc4097915..78ae4acc4 100644 --- a/test/unit/ImportExport/utOFFImportExport.cpp +++ b/test/unit/ImportExport/utOFFImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ImportExport/utOgreImportExport.cpp b/test/unit/ImportExport/utOgreImportExport.cpp index b45ba6d5c..7312d6b58 100644 --- a/test/unit/ImportExport/utOgreImportExport.cpp +++ b/test/unit/ImportExport/utOgreImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ImportExport/utQ3BSPFileImportExport.cpp b/test/unit/ImportExport/utQ3BSPFileImportExport.cpp index b2b0e93ab..f5694d2ee 100644 --- a/test/unit/ImportExport/utQ3BSPFileImportExport.cpp +++ b/test/unit/ImportExport/utQ3BSPFileImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ImportExport/utXGLImportExport.cpp b/test/unit/ImportExport/utXGLImportExport.cpp index f8b1daf6c..8199806cc 100644 --- a/test/unit/ImportExport/utXGLImportExport.cpp +++ b/test/unit/ImportExport/utXGLImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/MathTest.cpp b/test/unit/MathTest.cpp index ecc23545c..ff870ff43 100644 --- a/test/unit/MathTest.cpp +++ b/test/unit/MathTest.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/MathTest.h b/test/unit/MathTest.h index eda49f75e..08411e82f 100644 --- a/test/unit/MathTest.h +++ b/test/unit/MathTest.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/RandomNumberGeneration.h b/test/unit/RandomNumberGeneration.h index 892e78c06..95ba5b43b 100644 --- a/test/unit/RandomNumberGeneration.h +++ b/test/unit/RandomNumberGeneration.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/SceneDiffer.cpp b/test/unit/SceneDiffer.cpp index 368589bf3..0918530b7 100644 --- a/test/unit/SceneDiffer.cpp +++ b/test/unit/SceneDiffer.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/SceneDiffer.h b/test/unit/SceneDiffer.h index e0dc6005a..2ac429b76 100644 --- a/test/unit/SceneDiffer.h +++ b/test/unit/SceneDiffer.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/TestIOSystem.h b/test/unit/TestIOSystem.h index 4a42b23f0..b43e65b8f 100644 --- a/test/unit/TestIOSystem.h +++ b/test/unit/TestIOSystem.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/TestModelFactory.h b/test/unit/TestModelFactory.h index b4c1d5f4b..d0f43d760 100644 --- a/test/unit/TestModelFactory.h +++ b/test/unit/TestModelFactory.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/UTLogStream.h b/test/unit/UTLogStream.h index 964f3dc43..70cb3f801 100644 --- a/test/unit/UTLogStream.h +++ b/test/unit/UTLogStream.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ut3DImportExport.cpp b/test/unit/ut3DImportExport.cpp index 93d311ba8..5ff1d7940 100644 --- a/test/unit/ut3DImportExport.cpp +++ b/test/unit/ut3DImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/ut3DSImportExport.cpp b/test/unit/ut3DSImportExport.cpp index 5b78face3..01406362d 100644 --- a/test/unit/ut3DSImportExport.cpp +++ b/test/unit/ut3DSImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utACImportExport.cpp b/test/unit/utACImportExport.cpp index ec87edb27..9615a3a3e 100644 --- a/test/unit/utACImportExport.cpp +++ b/test/unit/utACImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utAMFImportExport.cpp b/test/unit/utAMFImportExport.cpp index 743b927e4..78309a105 100644 --- a/test/unit/utAMFImportExport.cpp +++ b/test/unit/utAMFImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utASEImportExport.cpp b/test/unit/utASEImportExport.cpp index 52416eb91..8014cbbc7 100644 --- a/test/unit/utASEImportExport.cpp +++ b/test/unit/utASEImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utAnim.cpp b/test/unit/utAnim.cpp index 67e8d3440..956810d74 100644 --- a/test/unit/utAnim.cpp +++ b/test/unit/utAnim.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utArmaturePopulate.cpp b/test/unit/utArmaturePopulate.cpp index baabae076..0acea7b50 100644 --- a/test/unit/utArmaturePopulate.cpp +++ b/test/unit/utArmaturePopulate.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utAssbinImportExport.cpp b/test/unit/utAssbinImportExport.cpp index f15897fed..437a0a5fe 100644 --- a/test/unit/utAssbinImportExport.cpp +++ b/test/unit/utAssbinImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utB3DImportExport.cpp b/test/unit/utB3DImportExport.cpp index 8a64a1f21..9672aa01b 100644 --- a/test/unit/utB3DImportExport.cpp +++ b/test/unit/utB3DImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utBVHImportExport.cpp b/test/unit/utBVHImportExport.cpp index 5d1ce5f5b..d69ac7987 100644 --- a/test/unit/utBVHImportExport.cpp +++ b/test/unit/utBVHImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utBatchLoader.cpp b/test/unit/utBatchLoader.cpp index c2722f26c..df6aa7995 100644 --- a/test/unit/utBatchLoader.cpp +++ b/test/unit/utBatchLoader.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/utBlendImportAreaLight.cpp b/test/unit/utBlendImportAreaLight.cpp index 71c096bd9..53788743e 100644 --- a/test/unit/utBlendImportAreaLight.cpp +++ b/test/unit/utBlendImportAreaLight.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utBlendImportMaterials.cpp b/test/unit/utBlendImportMaterials.cpp index 4ab6f7b92..582d47ef8 100644 --- a/test/unit/utBlendImportMaterials.cpp +++ b/test/unit/utBlendImportMaterials.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utBlenderImportExport.cpp b/test/unit/utBlenderImportExport.cpp index 9ef1fc693..297098672 100644 --- a/test/unit/utBlenderImportExport.cpp +++ b/test/unit/utBlenderImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/utBlenderIntermediate.cpp b/test/unit/utBlenderIntermediate.cpp index 118bceb2d..c2cc51e8d 100644 --- a/test/unit/utBlenderIntermediate.cpp +++ b/test/unit/utBlenderIntermediate.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/utBlenderWork.cpp b/test/unit/utBlenderWork.cpp index 28f245638..554198b08 100644 --- a/test/unit/utBlenderWork.cpp +++ b/test/unit/utBlenderWork.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utCSMImportExport.cpp b/test/unit/utCSMImportExport.cpp index 83a3e7e16..13bfd52bc 100644 --- a/test/unit/utCSMImportExport.cpp +++ b/test/unit/utCSMImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utColladaExport.cpp b/test/unit/utColladaExport.cpp index d0c22ffb8..4488f9f90 100644 --- a/test/unit/utColladaExport.cpp +++ b/test/unit/utColladaExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utColladaImportExport.cpp b/test/unit/utColladaImportExport.cpp index 44f988852..b58fa03fa 100644 --- a/test/unit/utColladaImportExport.cpp +++ b/test/unit/utColladaImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utD3MFImportExport.cpp b/test/unit/utD3MFImportExport.cpp index eb990a74a..ed290e876 100644 --- a/test/unit/utD3MFImportExport.cpp +++ b/test/unit/utD3MFImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utDXFImporterExporter.cpp b/test/unit/utDXFImporterExporter.cpp index 3a0475d74..9193946b5 100644 --- a/test/unit/utDXFImporterExporter.cpp +++ b/test/unit/utDXFImporterExporter.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utDefaultIOStream.cpp b/test/unit/utDefaultIOStream.cpp index d3e2c8a7e..803c6f6f6 100644 --- a/test/unit/utDefaultIOStream.cpp +++ b/test/unit/utDefaultIOStream.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/utFBXImporterExporter.cpp b/test/unit/utFBXImporterExporter.cpp index 4cfc9b152..679f6ded3 100644 --- a/test/unit/utFBXImporterExporter.cpp +++ b/test/unit/utFBXImporterExporter.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utFastAtof.cpp b/test/unit/utFastAtof.cpp index 189053dc1..cc25482d2 100644 --- a/test/unit/utFastAtof.cpp +++ b/test/unit/utFastAtof.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/utFindDegenerates.cpp b/test/unit/utFindDegenerates.cpp index 6f2abebfb..5eadc032c 100644 --- a/test/unit/utFindDegenerates.cpp +++ b/test/unit/utFindDegenerates.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utFindInvalidData.cpp b/test/unit/utFindInvalidData.cpp index b0c8a91d5..1fa8a3fc7 100644 --- a/test/unit/utFindInvalidData.cpp +++ b/test/unit/utFindInvalidData.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utFixInfacingNormals.cpp b/test/unit/utFixInfacingNormals.cpp index 4a52ad142..8f75dd2f0 100644 --- a/test/unit/utFixInfacingNormals.cpp +++ b/test/unit/utFixInfacingNormals.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/utGenBoundingBoxesProcess.cpp b/test/unit/utGenBoundingBoxesProcess.cpp index db878ba4c..c512e7f80 100644 --- a/test/unit/utGenBoundingBoxesProcess.cpp +++ b/test/unit/utGenBoundingBoxesProcess.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utGenNormals.cpp b/test/unit/utGenNormals.cpp index 759cb0071..83aadb52e 100644 --- a/test/unit/utGenNormals.cpp +++ b/test/unit/utGenNormals.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utHMPImportExport.cpp b/test/unit/utHMPImportExport.cpp index 0aaabeda0..83e7ba09d 100644 --- a/test/unit/utHMPImportExport.cpp +++ b/test/unit/utHMPImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utIFCImportExport.cpp b/test/unit/utIFCImportExport.cpp index 61871ad64..49c7446c7 100644 --- a/test/unit/utIFCImportExport.cpp +++ b/test/unit/utIFCImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utIOStreamBuffer.cpp b/test/unit/utIOStreamBuffer.cpp index a0e4660df..7565014c1 100644 --- a/test/unit/utIOStreamBuffer.cpp +++ b/test/unit/utIOStreamBuffer.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/utIOSystem.cpp b/test/unit/utIOSystem.cpp index 1e866515e..d69e645fe 100644 --- a/test/unit/utIOSystem.cpp +++ b/test/unit/utIOSystem.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/utImporter.cpp b/test/unit/utImporter.cpp index 9d3b971a3..768a276ee 100644 --- a/test/unit/utImporter.cpp +++ b/test/unit/utImporter.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utImproveCacheLocality.cpp b/test/unit/utImproveCacheLocality.cpp index fe92bc7e2..0e97eb0c7 100644 --- a/test/unit/utImproveCacheLocality.cpp +++ b/test/unit/utImproveCacheLocality.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utIssues.cpp b/test/unit/utIssues.cpp index 5eeed6ad8..546c36ad0 100644 --- a/test/unit/utIssues.cpp +++ b/test/unit/utIssues.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/utJoinVertices.cpp b/test/unit/utJoinVertices.cpp index a4431908a..b0700900c 100644 --- a/test/unit/utJoinVertices.cpp +++ b/test/unit/utJoinVertices.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utLWOImportExport.cpp b/test/unit/utLWOImportExport.cpp index 72c7d683b..266105030 100644 --- a/test/unit/utLWOImportExport.cpp +++ b/test/unit/utLWOImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utLWSImportExport.cpp b/test/unit/utLWSImportExport.cpp index 0fbbc8106..730911ec2 100644 --- a/test/unit/utLWSImportExport.cpp +++ b/test/unit/utLWSImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utLimitBoneWeights.cpp b/test/unit/utLimitBoneWeights.cpp index 36a8a7d3c..0c24b56c4 100644 --- a/test/unit/utLimitBoneWeights.cpp +++ b/test/unit/utLimitBoneWeights.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utMDCImportExport.cpp b/test/unit/utMDCImportExport.cpp index a42a1f88e..29b9ed56c 100644 --- a/test/unit/utMDCImportExport.cpp +++ b/test/unit/utMDCImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utMaterialSystem.cpp b/test/unit/utMaterialSystem.cpp index 363a4b193..39ef60679 100644 --- a/test/unit/utMaterialSystem.cpp +++ b/test/unit/utMaterialSystem.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -73,7 +73,7 @@ TEST_F(MaterialSystemTest, testFloatArrayProperty) { pf[0] = pf[1] = pf[2] = pf[3] = 12.0f; EXPECT_EQ(AI_SUCCESS, pcMat->Get("testKey2", 0, 0, pf, &pMax)); - EXPECT_EQ(sizeof(pf) / sizeof(float), pMax); + EXPECT_EQ(sizeof(pf) / sizeof(float), static_cast(pMax)); EXPECT_TRUE(!pf[0] && 1.0f == pf[1] && 2.0f == pf[2] && 3.0f == pf[3]); } diff --git a/test/unit/utMatrix3x3.cpp b/test/unit/utMatrix3x3.cpp index dbc9a04c8..ae722a811 100644 --- a/test/unit/utMatrix3x3.cpp +++ b/test/unit/utMatrix3x3.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utMatrix4x4.cpp b/test/unit/utMatrix4x4.cpp index a06833006..0b85a8fcc 100644 --- a/test/unit/utMatrix4x4.cpp +++ b/test/unit/utMatrix4x4.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utMetadata.cpp b/test/unit/utMetadata.cpp index 88a30d38c..6bd536d6c 100644 --- a/test/unit/utMetadata.cpp +++ b/test/unit/utMetadata.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/utObjImportExport.cpp b/test/unit/utObjImportExport.cpp index 72c29d8bc..58eace075 100644 --- a/test/unit/utObjImportExport.cpp +++ b/test/unit/utObjImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utObjTools.cpp b/test/unit/utObjTools.cpp index f83639013..744e22630 100644 --- a/test/unit/utObjTools.cpp +++ b/test/unit/utObjTools.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utOpenGEXImportExport.cpp b/test/unit/utOpenGEXImportExport.cpp index 024eb2d87..a7b682063 100644 --- a/test/unit/utOpenGEXImportExport.cpp +++ b/test/unit/utOpenGEXImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utPLYImportExport.cpp b/test/unit/utPLYImportExport.cpp index 385ff49f6..2edbdd71f 100644 --- a/test/unit/utPLYImportExport.cpp +++ b/test/unit/utPLYImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utPMXImporter.cpp b/test/unit/utPMXImporter.cpp index bb6a77ad8..a0d663d29 100644 --- a/test/unit/utPMXImporter.cpp +++ b/test/unit/utPMXImporter.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utPretransformVertices.cpp b/test/unit/utPretransformVertices.cpp index fd1c27147..b22fdf71f 100644 --- a/test/unit/utPretransformVertices.cpp +++ b/test/unit/utPretransformVertices.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utProfiler.cpp b/test/unit/utProfiler.cpp index cf99412fd..6738d568e 100644 --- a/test/unit/utProfiler.cpp +++ b/test/unit/utProfiler.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/utQ3DImportExport.cpp b/test/unit/utQ3DImportExport.cpp index e4c10629d..e5396a680 100644 --- a/test/unit/utQ3DImportExport.cpp +++ b/test/unit/utQ3DImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utRemoveComments.cpp b/test/unit/utRemoveComments.cpp index 2aed8f408..44fb56ef8 100644 --- a/test/unit/utRemoveComments.cpp +++ b/test/unit/utRemoveComments.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utRemoveComponent.cpp b/test/unit/utRemoveComponent.cpp index c0b7ba0b9..42fb85f73 100644 --- a/test/unit/utRemoveComponent.cpp +++ b/test/unit/utRemoveComponent.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utRemoveRedundantMaterials.cpp b/test/unit/utRemoveRedundantMaterials.cpp index 7d0adaaae..cec4501bd 100644 --- a/test/unit/utRemoveRedundantMaterials.cpp +++ b/test/unit/utRemoveRedundantMaterials.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utRemoveVCProcess.cpp b/test/unit/utRemoveVCProcess.cpp index 16cb337b6..b555b0c86 100644 --- a/test/unit/utRemoveVCProcess.cpp +++ b/test/unit/utRemoveVCProcess.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utSIBImporter.cpp b/test/unit/utSIBImporter.cpp index cfb604d21..b36e0883f 100644 --- a/test/unit/utSIBImporter.cpp +++ b/test/unit/utSIBImporter.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utSMDImportExport.cpp b/test/unit/utSMDImportExport.cpp index 3418853e7..08683d554 100644 --- a/test/unit/utSMDImportExport.cpp +++ b/test/unit/utSMDImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utSTLImportExport.cpp b/test/unit/utSTLImportExport.cpp index 42e95db34..4bf374a1b 100644 --- a/test/unit/utSTLImportExport.cpp +++ b/test/unit/utSTLImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utScaleProcess.cpp b/test/unit/utScaleProcess.cpp index bad616599..baa13ab52 100644 --- a/test/unit/utScaleProcess.cpp +++ b/test/unit/utScaleProcess.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utSceneCombiner.cpp b/test/unit/utSceneCombiner.cpp index d7c25c547..d837e4dce 100644 --- a/test/unit/utSceneCombiner.cpp +++ b/test/unit/utSceneCombiner.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utScenePreprocessor.cpp b/test/unit/utScenePreprocessor.cpp index fb903c46a..45d8a36ee 100644 --- a/test/unit/utScenePreprocessor.cpp +++ b/test/unit/utScenePreprocessor.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utSharedPPData.cpp b/test/unit/utSharedPPData.cpp index 01a0929e7..e4be169dd 100644 --- a/test/unit/utSharedPPData.cpp +++ b/test/unit/utSharedPPData.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/utSimd.cpp b/test/unit/utSimd.cpp index b3ed6327c..720d657b6 100644 --- a/test/unit/utSimd.cpp +++ b/test/unit/utSimd.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utSortByPType.cpp b/test/unit/utSortByPType.cpp index 26e09ea64..4dc034205 100644 --- a/test/unit/utSortByPType.cpp +++ b/test/unit/utSortByPType.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utSplitLargeMeshes.cpp b/test/unit/utSplitLargeMeshes.cpp index 52b0d9c43..c8a697de6 100644 --- a/test/unit/utSplitLargeMeshes.cpp +++ b/test/unit/utSplitLargeMeshes.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utStringUtils.cpp b/test/unit/utStringUtils.cpp index 08be82e9a..9c5ab31f5 100644 --- a/test/unit/utStringUtils.cpp +++ b/test/unit/utStringUtils.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utTargetAnimation.cpp b/test/unit/utTargetAnimation.cpp index 4b7c158d2..9cbb45309 100644 --- a/test/unit/utTargetAnimation.cpp +++ b/test/unit/utTargetAnimation.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utTextureTransform.cpp b/test/unit/utTextureTransform.cpp index 4b7c158d2..9cbb45309 100644 --- a/test/unit/utTextureTransform.cpp +++ b/test/unit/utTextureTransform.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utTriangulate.cpp b/test/unit/utTriangulate.cpp index 4f3e5cdc3..874e55c6a 100644 --- a/test/unit/utTriangulate.cpp +++ b/test/unit/utTriangulate.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utTypes.cpp b/test/unit/utTypes.cpp index 1ac9a1d5e..33d2b4f76 100644 --- a/test/unit/utTypes.cpp +++ b/test/unit/utTypes.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/test/unit/utVector3.cpp b/test/unit/utVector3.cpp index 4702ea65f..2602c287c 100644 --- a/test/unit/utVector3.cpp +++ b/test/unit/utVector3.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utVersion.cpp b/test/unit/utVersion.cpp index 6577c7758..0fc338f02 100644 --- a/test/unit/utVersion.cpp +++ b/test/unit/utVersion.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -49,17 +49,21 @@ TEST_F( utVersion, aiGetLegalStringTest ) { std::string text( lv ); size_t pos = text.find(std::string("2021")); - EXPECT_NE( pos, std::string::npos ); + EXPECT_NE(pos, std::string::npos); } TEST_F( utVersion, aiGetVersionMinorTest ) { - EXPECT_EQ( aiGetVersionMinor(), 1U ); + EXPECT_EQ(aiGetVersionMinor(), 1U); } TEST_F( utVersion, aiGetVersionMajorTest ) { EXPECT_EQ( aiGetVersionMajor(), 5U ); } +TEST_F( utVersion, aiGetVersionPatchTest ) { + EXPECT_EQ(aiGetVersionPatch(), 6U ); +} + TEST_F( utVersion, aiGetCompileFlagsTest ) { EXPECT_NE( aiGetCompileFlags(), 0U ); } @@ -71,5 +75,3 @@ TEST_F( utVersion, aiGetVersionRevisionTest ) { TEST_F( utVersion, aiGetBranchNameTest ) { EXPECT_NE( nullptr, aiGetBranchName() ); } - - diff --git a/test/unit/utVertexTriangleAdjacency.cpp b/test/unit/utVertexTriangleAdjacency.cpp index 6a8fea094..bda6304e0 100644 --- a/test/unit/utVertexTriangleAdjacency.cpp +++ b/test/unit/utVertexTriangleAdjacency.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utX3DImportExport.cpp b/test/unit/utX3DImportExport.cpp index a6ad618ab..f2df81ac2 100644 --- a/test/unit/utX3DImportExport.cpp +++ b/test/unit/utX3DImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utXImporterExporter.cpp b/test/unit/utXImporterExporter.cpp index 26221ce8b..4d247cc6f 100644 --- a/test/unit/utXImporterExporter.cpp +++ b/test/unit/utXImporterExporter.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utglTF2ImportExport.cpp b/test/unit/utglTF2ImportExport.cpp index 51c57b2da..84f940c66 100644 --- a/test/unit/utglTF2ImportExport.cpp +++ b/test/unit/utglTF2ImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/test/unit/utglTFImportExport.cpp b/test/unit/utglTFImportExport.cpp index 38bde9879..cb20c1519 100644 --- a/test/unit/utglTFImportExport.cpp +++ b/test/unit/utglTFImportExport.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_cmd/CMakeLists.txt b/tools/assimp_cmd/CMakeLists.txt index 5aeac0f7b..6f4b61387 100644 --- a/tools/assimp_cmd/CMakeLists.txt +++ b/tools/assimp_cmd/CMakeLists.txt @@ -1,7 +1,7 @@ # Open Asset Import Library (assimp) # ---------------------------------------------------------------------- # -# Copyright (c) 2006-2021, assimp team +# Copyright (c) 2006-2022, assimp team # All rights reserved. diff --git a/tools/assimp_cmd/CompareDump.cpp b/tools/assimp_cmd/CompareDump.cpp index 0179cb677..49f680c24 100644 --- a/tools/assimp_cmd/CompareDump.cpp +++ b/tools/assimp_cmd/CompareDump.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/tools/assimp_cmd/Export.cpp b/tools/assimp_cmd/Export.cpp index 6c3c41de9..fd9fc7652 100644 --- a/tools/assimp_cmd/Export.cpp +++ b/tools/assimp_cmd/Export.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_cmd/ImageExtractor.cpp b/tools/assimp_cmd/ImageExtractor.cpp index 23aa9c249..49edf9790 100644 --- a/tools/assimp_cmd/ImageExtractor.cpp +++ b/tools/assimp_cmd/ImageExtractor.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_cmd/Info.cpp b/tools/assimp_cmd/Info.cpp index 6e52fc981..c43a7834e 100644 --- a/tools/assimp_cmd/Info.cpp +++ b/tools/assimp_cmd/Info.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team diff --git a/tools/assimp_cmd/Main.cpp b/tools/assimp_cmd/Main.cpp index 8d76e1f5e..31b92b0f0 100644 --- a/tools/assimp_cmd/Main.cpp +++ b/tools/assimp_cmd/Main.cpp @@ -3,9 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team - - +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -47,6 +45,25 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "Main.h" +#include +#include + +class ConsoleProgressHandler : public ProgressHandler { +public: + ConsoleProgressHandler() : + ProgressHandler() { + // empty + } + + ~ConsoleProgressHandler() override { + // empty + } + + bool Update(float percentage) override { + std::cout << percentage * 100.0f << " %\n"; + return true; + } +}; const char* AICMD_MSG_ABOUT = "------------------------------------------------------ \n" "Open Asset Import Library (\"Assimp\", https://github.com/assimp/assimp) \n" @@ -73,10 +90,10 @@ const char* AICMD_MSG_HELP = "\n Use \'assimp --help\' for detailed help on a command.\n" ; -/*extern*/ Assimp::Importer* globalImporter = NULL; +/*extern*/ Assimp::Importer* globalImporter = nullptr; #ifndef ASSIMP_BUILD_NO_EXPORT -/*extern*/ Assimp::Exporter* globalExporter = NULL; +/*extern*/ Assimp::Exporter* globalExporter = nullptr; #endif // ------------------------------------------------------------------------------ @@ -286,6 +303,9 @@ const aiScene* ImportModel( // do the actual import, measure time const clock_t first = clock(); + ConsoleProgressHandler *ph = new ConsoleProgressHandler; + globalImporter->SetProgressHandler(ph); + const aiScene* scene = globalImporter->ReadFile(path,imp.ppFlags); if (imp.showLog) { @@ -305,6 +325,9 @@ const aiScene* ImportModel( if (imp.log) { FreeLogStreams(); } + globalImporter->SetProgressHandler(nullptr); + delete ph; + return scene; } diff --git a/tools/assimp_cmd/Main.h b/tools/assimp_cmd/Main.h index 5ac306abd..1d3dd8fb2 100644 --- a/tools/assimp_cmd/Main.h +++ b/tools/assimp_cmd/Main.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_cmd/WriteDump.cpp b/tools/assimp_cmd/WriteDump.cpp index f35630568..4ada408fd 100644 --- a/tools/assimp_cmd/WriteDump.cpp +++ b/tools/assimp_cmd/WriteDump.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_view/AnimEvaluator.cpp b/tools/assimp_view/AnimEvaluator.cpp index 5a2ddc182..ad8e7f5b2 100644 --- a/tools/assimp_view/AnimEvaluator.cpp +++ b/tools/assimp_view/AnimEvaluator.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_view/AnimEvaluator.h b/tools/assimp_view/AnimEvaluator.h index 394ebef4a..76b22ea8a 100644 --- a/tools/assimp_view/AnimEvaluator.h +++ b/tools/assimp_view/AnimEvaluator.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_view/AssetHelper.h b/tools/assimp_view/AssetHelper.h index 95c7cb109..1ae469f85 100644 --- a/tools/assimp_view/AssetHelper.h +++ b/tools/assimp_view/AssetHelper.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_view/Background.cpp b/tools/assimp_view/Background.cpp index 6e8091f49..e49630204 100644 --- a/tools/assimp_view/Background.cpp +++ b/tools/assimp_view/Background.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_view/CMakeLists.txt b/tools/assimp_view/CMakeLists.txt index 0199392fe..13c4c139a 100644 --- a/tools/assimp_view/CMakeLists.txt +++ b/tools/assimp_view/CMakeLists.txt @@ -1,7 +1,7 @@ # Open Asset Import Library (assimp) # ---------------------------------------------------------------------- # -# Copyright (c) 2006-2021, assimp team +# Copyright (c) 2006-2022, assimp team # All rights reserved. diff --git a/tools/assimp_view/Display.cpp b/tools/assimp_view/Display.cpp index c0770e7f2..95ed41615 100644 --- a/tools/assimp_view/Display.cpp +++ b/tools/assimp_view/Display.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_view/HelpDialog.cpp b/tools/assimp_view/HelpDialog.cpp index af8df0755..fde4e1caf 100644 --- a/tools/assimp_view/HelpDialog.cpp +++ b/tools/assimp_view/HelpDialog.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_view/Input.cpp b/tools/assimp_view/Input.cpp index 25238d6b2..b8572d792 100644 --- a/tools/assimp_view/Input.cpp +++ b/tools/assimp_view/Input.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_view/LogDisplay.cpp b/tools/assimp_view/LogDisplay.cpp index 2d2646b06..1bd650c08 100644 --- a/tools/assimp_view/LogDisplay.cpp +++ b/tools/assimp_view/LogDisplay.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_view/LogWindow.cpp b/tools/assimp_view/LogWindow.cpp index 8a47b259f..8e80bf564 100644 --- a/tools/assimp_view/LogWindow.cpp +++ b/tools/assimp_view/LogWindow.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. @@ -128,16 +128,14 @@ void CMyLogStream::write(const char *message) { //------------------------------------------------------------------------------- void CLogWindow::Clear() { this->szText = AI_VIEW_RTF_LOG_HEADER; - ; this->szPlainText = ""; - this->Update(); } //------------------------------------------------------------------------------- void CLogWindow::Update() { if (this->bIsVisible) { - SETTEXTEX sInfo; + SETTEXTEX sInfo = {}; sInfo.flags = ST_DEFAULT; sInfo.codepage = CP_ACP; @@ -148,7 +146,7 @@ void CLogWindow::Update() { //------------------------------------------------------------------------------- void CLogWindow::Save() { - char szFileName[MAX_PATH]; + char szFileName[MAX_PATH] = {}; DWORD dwTemp = MAX_PATH; if (ERROR_SUCCESS != RegQueryValueEx(g_hRegistry, "LogDestination", nullptr, nullptr, (BYTE *)szFileName, &dwTemp)) { @@ -228,7 +226,7 @@ void CLogWindow::WriteLine(const char *message) { this->szText.append("\\par}}"); if (this->bIsVisible && this->bUpdate) { - SETTEXTEX sInfo; + SETTEXTEX sInfo = {}; sInfo.flags = ST_DEFAULT; sInfo.codepage = CP_ACP; diff --git a/tools/assimp_view/Material.cpp b/tools/assimp_view/Material.cpp index 002e4f522..e3c023bd9 100644 --- a/tools/assimp_view/Material.cpp +++ b/tools/assimp_view/Material.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_view/MaterialManager.h b/tools/assimp_view/MaterialManager.h index 9aeb5e992..625cae27e 100644 --- a/tools/assimp_view/MaterialManager.h +++ b/tools/assimp_view/MaterialManager.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_view/MeshRenderer.cpp b/tools/assimp_view/MeshRenderer.cpp index bc1a5236f..655e99d0b 100644 --- a/tools/assimp_view/MeshRenderer.cpp +++ b/tools/assimp_view/MeshRenderer.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_view/MessageProc.cpp b/tools/assimp_view/MessageProc.cpp index 18424d78e..e51c8292c 100644 --- a/tools/assimp_view/MessageProc.cpp +++ b/tools/assimp_view/MessageProc.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_view/Normals.cpp b/tools/assimp_view/Normals.cpp index 817a22926..b76408939 100644 --- a/tools/assimp_view/Normals.cpp +++ b/tools/assimp_view/Normals.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_view/SceneAnimator.cpp b/tools/assimp_view/SceneAnimator.cpp index 2318001c0..c8b20229e 100644 --- a/tools/assimp_view/SceneAnimator.cpp +++ b/tools/assimp_view/SceneAnimator.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_view/SceneAnimator.h b/tools/assimp_view/SceneAnimator.h index 43c8d8eb7..454357f30 100644 --- a/tools/assimp_view/SceneAnimator.h +++ b/tools/assimp_view/SceneAnimator.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_view/Shaders.cpp b/tools/assimp_view/Shaders.cpp index b8ee8dbf8..9fd05ca8d 100644 --- a/tools/assimp_view/Shaders.cpp +++ b/tools/assimp_view/Shaders.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_view/assimp_view.cpp b/tools/assimp_view/assimp_view.cpp index 37e5f5429..c5c48fd93 100644 --- a/tools/assimp_view/assimp_view.cpp +++ b/tools/assimp_view/assimp_view.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved. diff --git a/tools/assimp_view/assimp_view.h b/tools/assimp_view/assimp_view.h index 7349c3513..cbcee3cac 100644 --- a/tools/assimp_view/assimp_view.h +++ b/tools/assimp_view/assimp_view.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2021, assimp team +Copyright (c) 2006-2022, assimp team All rights reserved.