From 9d12dd6df37ba718817206bedf6f5cdb1ef8ecca Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 21 Sep 2023 21:01:50 +0200 Subject: [PATCH 01/20] Doc: Add wiki link - closes https://github.com/assimp/assimp/issues/5240 --- test/models-nonbsd/IFC/linklist.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/models-nonbsd/IFC/linklist.txt b/test/models-nonbsd/IFC/linklist.txt index 6971b7a45..91bd70d9e 100644 --- a/test/models-nonbsd/IFC/linklist.txt +++ b/test/models-nonbsd/IFC/linklist.txt @@ -1,4 +1,4 @@ Good IFC test cases =================== -http://www.iai.fzk.de/www-extern/index.php?id=1135 +https://www.ifcwiki.org/index.php/Examples From 0c5138cb392202285ec3e4e63e718407de100544 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 31 Jan 2023 21:23:12 +0100 Subject: [PATCH 02/20] Update: Set new versions --- packaging/windows-innosetup/script_vieweronly.iss | 8 ++++---- packaging/windows-innosetup/script_x64.iss | 8 ++++---- packaging/windows-innosetup/script_x86.iss | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packaging/windows-innosetup/script_vieweronly.iss b/packaging/windows-innosetup/script_vieweronly.iss index 1a91fb9d2..5f7161c7c 100644 --- a/packaging/windows-innosetup/script_vieweronly.iss +++ b/packaging/windows-innosetup/script_vieweronly.iss @@ -2,7 +2,7 @@ [Setup] AppName=Open Asset Import Library - Viewer -AppVerName=Open Asset Import Library - Viewer (v2.0) +AppVerName=Open Asset Import Library - Viewer (v5.2.6) DefaultDirName={pf}\AssimpView DefaultGroupName=AssimpView UninstallDisplayIcon={app}\bin\x86\assimp.exe @@ -12,9 +12,9 @@ SetupIconFile=..\..\tools\shared\assimp_tools_icon.ico WizardImageFile=compiler:WizModernImage-IS.BMP WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP LicenseFile=License.rtf -OutputBaseFileName=assimp-view-2.0-setup -VersionInfoVersion=2.0.0.0 -VersionInfoTextVersion=2.0 +OutputBaseFileName=assimp-view-5.0-setup +VersionInfoVersion=5.2.6.0 +VersionInfoTextVersion=5.2.6 VersionInfoCompany=Assimp Development Team ArchitecturesInstallIn64BitMode=x64 diff --git a/packaging/windows-innosetup/script_x64.iss b/packaging/windows-innosetup/script_x64.iss index 2711b1bdf..7ef212f89 100644 --- a/packaging/windows-innosetup/script_x64.iss +++ b/packaging/windows-innosetup/script_x64.iss @@ -2,7 +2,7 @@ [Setup] AppName=Open Asset Import Library - SDK -AppVerName=Open Asset Import Library - SDK (v5.1.0) +AppVerName=Open Asset Import Library - SDK (v5.2.6) DefaultDirName={pf}\Assimp DefaultGroupName=Assimp UninstallDisplayIcon={app}\bin\x64\assimp.exe @@ -12,9 +12,9 @@ SetupIconFile=..\..\tools\shared\assimp_tools_icon.ico WizardImageFile=compiler:WizModernImage-IS.BMP WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP LicenseFile=License.rtf -OutputBaseFileName=assimp-sdk-5.1.0-setup -VersionInfoVersion=5.1.0.0 -VersionInfoTextVersion=5.1.0 +OutputBaseFileName=assimp-sdk-5.2.6-setup +VersionInfoVersion=5.2.6.0 +VersionInfoTextVersion=5.2.6 VersionInfoCompany=Assimp Development Team ArchitecturesInstallIn64BitMode=x64 diff --git a/packaging/windows-innosetup/script_x86.iss b/packaging/windows-innosetup/script_x86.iss index deacb726e..d405d02cf 100644 --- a/packaging/windows-innosetup/script_x86.iss +++ b/packaging/windows-innosetup/script_x86.iss @@ -2,7 +2,7 @@ [Setup] AppName=Open Asset Import Library - SDK -AppVerName=Open Asset Import Library - SDK (v5.1.0) +AppVerName=Open Asset Import Library - SDK (v5.2.6) DefaultDirName={pf}\Assimp DefaultGroupName=Assimp UninstallDisplayIcon={app}\bin\x86\assimp.exe @@ -12,9 +12,9 @@ SetupIconFile=..\..\tools\shared\assimp_tools_icon.ico WizardImageFile=compiler:WizModernImage-IS.BMP WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP LicenseFile=License.rtf -OutputBaseFileName=assimp-sdk-5.1.0-setup -VersionInfoVersion=5.1.0.0 -VersionInfoTextVersion=5.1.0 +OutputBaseFileName=assimp-sdk-5.2.6-setup +VersionInfoVersion=5.2.5.6 +VersionInfoTextVersion=5.2.6 VersionInfoCompany=Assimp Development Team ;ArchitecturesInstallIn64BitMode=x64 From fb23ef7c02a8b3b33176b5789939cca387fc9ab8 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 31 Jan 2023 21:25:26 +0100 Subject: [PATCH 03/20] Update: Update code version --- CMakeLists.txt | 2 +- include/assimp/version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0619879de..a95c67a0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,7 +55,7 @@ IF(ASSIMP_HUNTER_ENABLED) add_definitions(-DASSIMP_USE_HUNTER) ENDIF() -PROJECT(Assimp VERSION 5.2.5) +PROJECT(Assimp VERSION 5.2.6) # All supported options ############################################### diff --git a/include/assimp/version.h b/include/assimp/version.h index b83110a04..812be551c 100644 --- a/include/assimp/version.h +++ b/include/assimp/version.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2022, assimp team +Copyright (c) 2006-2023, assimp team All rights reserved. From bad725ec86f1e0e411b6c5e33d93432ae7c3a40e Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 31 Jan 2023 21:55:43 +0100 Subject: [PATCH 04/20] Fix: Fix versions --- revision.h.in | 2 +- test/unit/utVersion.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/revision.h.in b/revision.h.in index 25cb3949f..939d2940f 100644 --- a/revision.h.in +++ b/revision.h.in @@ -18,7 +18,7 @@ #else #define VER_FILEVERSION_STR STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD) " (Commit @GIT_COMMIT_HASH@)" #endif -#define VER_COPYRIGHT_STR "\xA9 2006-2022" +#define VER_COPYRIGHT_STR "\xA9 2006-2023" #ifdef NDEBUG #define VER_ORIGINAL_FILENAME_STR "@CMAKE_SHARED_LIBRARY_PREFIX@assimp@LIBRARY_SUFFIX@.dll" diff --git a/test/unit/utVersion.cpp b/test/unit/utVersion.cpp index 06f07c943..da4240c07 100644 --- a/test/unit/utVersion.cpp +++ b/test/unit/utVersion.cpp @@ -48,7 +48,7 @@ TEST_F( utVersion, aiGetLegalStringTest ) { EXPECT_NE( lv, nullptr ); std::string text( lv ); - size_t pos = text.find(std::string("2022")); + size_t pos = text.find(std::string("2023")); EXPECT_NE(pos, std::string::npos); } @@ -61,7 +61,7 @@ TEST_F( utVersion, aiGetVersionMajorTest ) { } TEST_F( utVersion, aiGetVersionPatchTest ) { - EXPECT_EQ(aiGetVersionPatch(), 5U ); + EXPECT_EQ(aiGetVersionPatch(), 6U ); } TEST_F( utVersion, aiGetCompileFlagsTest ) { From e5e3e07b84c62c5065477c97f54d19254160cd2e Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 1 Feb 2023 11:28:11 +0100 Subject: [PATCH 05/20] Fix copyrights. --- code/Common/Version.cpp | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/code/Common/Version.cpp b/code/Common/Version.cpp index 9c3d0250c..1699b99d6 100644 --- a/code/Common/Version.cpp +++ b/code/Common/Version.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2022, assimp team +Copyright (c) 2006-2023, assimp team All rights reserved. @@ -49,10 +49,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -------------------------------------------------------------------------------- // Legal information string - don't remove this. -static const char *LEGAL_INFORMATION = +static constexpr char LEGAL_INFORMATION[] = "Open Asset Import Library (Assimp).\n" "A free C/C++ library to import various 3D file formats into applications\n\n" - "(c) 2006-2022, Assimp team\n" + "(c) 2006-2023, Assimp team\n" "License under the terms and conditions of the 3-clause BSD license\n" "https://www.assimp.org\n"; @@ -150,9 +150,11 @@ ASSIMP_API aiScene::~aiScene() { // To make sure we won't crash if the data is invalid it's // much better to check whether both mNumXXX and mXXX are // valid instead of relying on just one of them. - if (mNumMeshes && mMeshes) - for (unsigned int a = 0; a < mNumMeshes; a++) + if (mNumMeshes && mMeshes) { + for (unsigned int a = 0; a < mNumMeshes; ++a) { delete mMeshes[a]; + } + } delete[] mMeshes; if (mNumMaterials && mMaterials) { @@ -162,24 +164,32 @@ ASSIMP_API aiScene::~aiScene() { } delete[] mMaterials; - if (mNumAnimations && mAnimations) - for (unsigned int a = 0; a < mNumAnimations; a++) + if (mNumAnimations && mAnimations) { + for (unsigned int a = 0; a < mNumAnimations; ++a) { delete mAnimations[a]; + } + } delete[] mAnimations; - if (mNumTextures && mTextures) - for (unsigned int a = 0; a < mNumTextures; a++) + if (mNumTextures && mTextures) { + for (unsigned int a = 0; a < mNumTextures; ++a) { delete mTextures[a]; + } + } delete[] mTextures; - if (mNumLights && mLights) - for (unsigned int a = 0; a < mNumLights; a++) + if (mNumLights && mLights) { + for (unsigned int a = 0; a < mNumLights; ++a) { delete mLights[a]; + } + } delete[] mLights; - if (mNumCameras && mCameras) - for (unsigned int a = 0; a < mNumCameras; a++) + if (mNumCameras && mCameras) { + for (unsigned int a = 0; a < mNumCameras; ++a) { delete mCameras[a]; + } + } delete[] mCameras; aiMetadata::Dealloc(mMetaData); From 13945a5c5bb3deffe2a4224b888373a5437d52e9 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 27 Apr 2023 21:45:41 +0200 Subject: [PATCH 06/20] Update CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a95c67a0f..e5d3be2dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,7 +55,7 @@ IF(ASSIMP_HUNTER_ENABLED) add_definitions(-DASSIMP_USE_HUNTER) ENDIF() -PROJECT(Assimp VERSION 5.2.6) +PROJECT(Assimp VERSION 5.3.0) # All supported options ############################################### From 997d380c3ad156eef72019fa2236bc4b78837d4e Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 27 Apr 2023 21:47:28 +0200 Subject: [PATCH 07/20] Update script_vieweronly.iss --- packaging/windows-innosetup/script_vieweronly.iss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/windows-innosetup/script_vieweronly.iss b/packaging/windows-innosetup/script_vieweronly.iss index 5f7161c7c..b6795ae4d 100644 --- a/packaging/windows-innosetup/script_vieweronly.iss +++ b/packaging/windows-innosetup/script_vieweronly.iss @@ -2,7 +2,7 @@ [Setup] AppName=Open Asset Import Library - Viewer -AppVerName=Open Asset Import Library - Viewer (v5.2.6) +AppVerName=Open Asset Import Library - Viewer (v5.3.0) DefaultDirName={pf}\AssimpView DefaultGroupName=AssimpView UninstallDisplayIcon={app}\bin\x86\assimp.exe @@ -13,8 +13,8 @@ WizardImageFile=compiler:WizModernImage-IS.BMP WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP LicenseFile=License.rtf OutputBaseFileName=assimp-view-5.0-setup -VersionInfoVersion=5.2.6.0 -VersionInfoTextVersion=5.2.6 +VersionInfoVersion=5.3.0.0 +VersionInfoTextVersion=5.3.0 VersionInfoCompany=Assimp Development Team ArchitecturesInstallIn64BitMode=x64 From 967d61edc5c05403d04b6dab47da9dbed0e557de Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 27 Apr 2023 21:47:50 +0200 Subject: [PATCH 08/20] Update script_x64.iss --- packaging/windows-innosetup/script_x64.iss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/windows-innosetup/script_x64.iss b/packaging/windows-innosetup/script_x64.iss index 7ef212f89..3ac5600b5 100644 --- a/packaging/windows-innosetup/script_x64.iss +++ b/packaging/windows-innosetup/script_x64.iss @@ -2,7 +2,7 @@ [Setup] AppName=Open Asset Import Library - SDK -AppVerName=Open Asset Import Library - SDK (v5.2.6) +AppVerName=Open Asset Import Library - SDK (v5.3.0) DefaultDirName={pf}\Assimp DefaultGroupName=Assimp UninstallDisplayIcon={app}\bin\x64\assimp.exe @@ -13,8 +13,8 @@ WizardImageFile=compiler:WizModernImage-IS.BMP WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP LicenseFile=License.rtf OutputBaseFileName=assimp-sdk-5.2.6-setup -VersionInfoVersion=5.2.6.0 -VersionInfoTextVersion=5.2.6 +VersionInfoVersion=5.3.0.0 +VersionInfoTextVersion=5.3.0 VersionInfoCompany=Assimp Development Team ArchitecturesInstallIn64BitMode=x64 From cebb06280d2a4cc1a2d155761b3d2085cbb01cd2 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 27 Apr 2023 21:48:23 +0200 Subject: [PATCH 09/20] Update script_x86.iss --- packaging/windows-innosetup/script_x86.iss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/windows-innosetup/script_x86.iss b/packaging/windows-innosetup/script_x86.iss index d405d02cf..9bfe371cc 100644 --- a/packaging/windows-innosetup/script_x86.iss +++ b/packaging/windows-innosetup/script_x86.iss @@ -2,7 +2,7 @@ [Setup] AppName=Open Asset Import Library - SDK -AppVerName=Open Asset Import Library - SDK (v5.2.6) +AppVerName=Open Asset Import Library - SDK (v5.3.0) DefaultDirName={pf}\Assimp DefaultGroupName=Assimp UninstallDisplayIcon={app}\bin\x86\assimp.exe @@ -13,8 +13,8 @@ WizardImageFile=compiler:WizModernImage-IS.BMP WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP LicenseFile=License.rtf OutputBaseFileName=assimp-sdk-5.2.6-setup -VersionInfoVersion=5.2.5.6 -VersionInfoTextVersion=5.2.6 +VersionInfoVersion=5.3.0. +VersionInfoTextVersion=5.3.0 VersionInfoCompany=Assimp Development Team ;ArchitecturesInstallIn64BitMode=x64 From c421247be983eac0beccad6bfdd2d92fc11980bd Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 27 Apr 2023 21:50:54 +0200 Subject: [PATCH 10/20] Update utVersion.cpp --- test/unit/utVersion.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/unit/utVersion.cpp b/test/unit/utVersion.cpp index da4240c07..e4378e9f6 100644 --- a/test/unit/utVersion.cpp +++ b/test/unit/utVersion.cpp @@ -2,7 +2,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2022, assimp team +Copyright (c) 2006-2023, assimp team All rights reserved. @@ -53,7 +53,7 @@ TEST_F( utVersion, aiGetLegalStringTest ) { } TEST_F( utVersion, aiGetVersionMinorTest ) { - EXPECT_EQ(aiGetVersionMinor(), 2U); + EXPECT_EQ(aiGetVersionMinor(), 3U); } TEST_F( utVersion, aiGetVersionMajorTest ) { @@ -61,7 +61,7 @@ TEST_F( utVersion, aiGetVersionMajorTest ) { } TEST_F( utVersion, aiGetVersionPatchTest ) { - EXPECT_EQ(aiGetVersionPatch(), 6U ); + EXPECT_EQ(aiGetVersionPatch(), 0U ); } TEST_F( utVersion, aiGetCompileFlagsTest ) { From f1b8df01d5ce24efbc0fc43a2c9c73d21fe948e2 Mon Sep 17 00:00:00 2001 From: mosfet80 Date: Sun, 24 Sep 2023 08:56:00 +0200 Subject: [PATCH 11/20] fix variable name --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e5d3be2dc..753d05928 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -777,7 +777,7 @@ IF ( ASSIMP_INSTALL ) SET(CPACK_DEBIAN_PACKAGE_SECTION "libs" ) SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_COMPONENTS_ALL}") SET(CPACK_DEBIAN_PACKAGE_SUGGESTS) - SET(cPACK_DEBIAN_PACKAGE_NAME "assimp") + SET(CPACK_DEBIAN_PACKAGE_NAME "assimp") SET(CPACK_DEBIAN_PACKAGE_REMOVE_SOURCE_FILES contrib/gtest contrib/zlib workspaces test doc obj samples packaging) SET(CPACK_DEBIAN_PACKAGE_SOURCE_COPY svn export --force) SET(CPACK_DEBIAN_CHANGELOG) From f9d3e7015b0b709b3da5e4bc11651a484a52ac2b Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 25 Sep 2023 13:32:45 +0200 Subject: [PATCH 12/20] Update types.h - closes https://github.com/assimp/assimp/issues/5247 --- include/assimp/types.h | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/include/assimp/types.h b/include/assimp/types.h index 605dc590f..42aa0f9eb 100644 --- a/include/assimp/types.h +++ b/include/assimp/types.h @@ -73,14 +73,8 @@ typedef uint32_t ai_uint32; #ifdef __cplusplus -#ifdef ASSIMP_USE_HUNTER -# include -#else -# include "../contrib/utf8cpp/source/utf8.h" -#endif - #include -#include // for std::nothrow_t +#include // for std::nothrow_t #include // for aiString::Set(const std::string&) namespace Assimp { @@ -88,16 +82,16 @@ namespace Assimp { namespace Intern { // -------------------------------------------------------------------- /** @brief Internal helper class to utilize our internal new/delete - * routines for allocating object of this and derived classes. - * - * By doing this you can safely share class objects between Assimp - * and the application - it works even over DLL boundaries. A good - * example is the #IOSystem where the application allocates its custom - * #IOSystem, then calls #Importer::SetIOSystem(). When the Importer - * destructs, Assimp calls operator delete on the stored #IOSystem. - * If it lies on a different heap than Assimp is working with, - * the application is determined to crash. - */ + * routines for allocating object of this and derived classes. + * + * By doing this you can safely share class objects between Assimp + * and the application - it works even over DLL boundaries. A good + * example is the #IOSystem where the application allocates its custom + * #IOSystem, then calls #Importer::SetIOSystem(). When the Importer + * destructs, Assimp calls operator delete on the stored #IOSystem. + * If it lies on a different heap than Assimp is working with, + * the application is determined to crash. + */ // -------------------------------------------------------------------- #ifndef SWIG struct ASSIMP_API AllocateFromAssimpHeap { From 4b193dbee30b1044492d2650525f43c475fc7dfc Mon Sep 17 00:00:00 2001 From: Stephen Gold Date: Sat, 23 Sep 2023 18:33:37 -0700 Subject: [PATCH 13/20] contrib/zip/src/zip.h: correct 2 spelling errors --- contrib/zip/src/zip.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/zip/src/zip.h b/contrib/zip/src/zip.h index 70ab2cee6..5c47f1f1f 100644 --- a/contrib/zip/src/zip.h +++ b/contrib/zip/src/zip.h @@ -83,9 +83,9 @@ typedef long ssize_t; /* byte count or error */ #define ZIP_EFWRITE -29 // fwrite error /** - * Looks up the error message string coresponding to an error number. + * Looks up the error message string corresponding to an error number. * @param errnum error number - * @return error message string coresponding to errnum or NULL if error is not + * @return error message string corresponding to errnum or NULL if error is not * found. */ extern const char *zip_strerror(int errnum); From 6a08c39e3a91ef385e76515cfad86aca4bfd57ff Mon Sep 17 00:00:00 2001 From: mosfet80 Date: Wed, 20 Sep 2023 18:00:44 +0200 Subject: [PATCH 14/20] Update CMakeLists.txt updated cpp-pm/hunter to last version --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 753d05928..75b160c6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,8 +49,8 @@ option(ASSIMP_HUNTER_ENABLED "Enable Hunter package manager support" OFF) IF(ASSIMP_HUNTER_ENABLED) include("cmake-modules/HunterGate.cmake") HunterGate( - URL "https://github.com/cpp-pm/hunter/archive/v0.24.17.tar.gz" - SHA1 "e6396699e414120e32557fe92db097b7655b760b" + URL "https://github.com/cpp-pm/hunter/archive/v0.24.18.tar.gz" + SHA1 "1292e4d661e1770d6d6ca08c12c07cf34a0bf718" ) add_definitions(-DASSIMP_USE_HUNTER) ENDIF() From 7a26433846e72693dd3d5638b84c969d251fc231 Mon Sep 17 00:00:00 2001 From: Begasus Date: Wed, 27 Sep 2023 14:44:05 +0200 Subject: [PATCH 15/20] Fix building on Haiku --- CMakeLists.txt | 2 +- contrib/unzip/ioapi.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 75b160c6f..88f69174a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -258,7 +258,7 @@ IF( UNIX ) ENDIF() # Grouped compiler settings ######################################## -IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT MINGW) +IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT MINGW AND NOT HAIKU) IF(NOT ASSIMP_HUNTER_ENABLED) SET(CMAKE_POSITION_INDEPENDENT_CODE ON) ENDIF() diff --git a/contrib/unzip/ioapi.h b/contrib/unzip/ioapi.h index ae9ca7e83..548dafb5e 100644 --- a/contrib/unzip/ioapi.h +++ b/contrib/unzip/ioapi.h @@ -50,7 +50,7 @@ #define ftello64 ftell #define fseeko64 fseek #else -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) #define fopen64 fopen #define ftello64 ftello #define fseeko64 fseeko From 7a4d8ec4125d9f5c8e662474ea152b7c2f01fe3e Mon Sep 17 00:00:00 2001 From: ockeymm <88309682+ockeymm@users.noreply.github.com> Date: Tue, 26 Sep 2023 13:20:13 +0800 Subject: [PATCH 16/20] Reduce memory consumption in JoinVerticesProcess::ProcessMesh() significantly --- code/PostProcessing/JoinVerticesProcess.cpp | 58 ++++++++++----------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/code/PostProcessing/JoinVerticesProcess.cpp b/code/PostProcessing/JoinVerticesProcess.cpp index d36915e0c..650336040 100644 --- a/code/PostProcessing/JoinVerticesProcess.cpp +++ b/code/PostProcessing/JoinVerticesProcess.cpp @@ -145,7 +145,7 @@ bool areVerticesEqual( } template -void updateXMeshVertices(XMesh *pMesh, std::vector &uniqueVertices) { +void updateXMeshVertices(XMesh *pMesh, std::vector &uniqueVertices) { // replace vertex data with the unique data sets pMesh->mNumVertices = (unsigned int)uniqueVertices.size(); @@ -157,52 +157,52 @@ void updateXMeshVertices(XMesh *pMesh, std::vector &uniqueVertices) { // Position, if present (check made for aiAnimMesh) if (pMesh->mVertices) { - delete [] pMesh->mVertices; + aiVector3D *oldVertices = pMesh->mVertices; pMesh->mVertices = new aiVector3D[pMesh->mNumVertices]; - for (unsigned int a = 0; a < pMesh->mNumVertices; a++) { - pMesh->mVertices[a] = uniqueVertices[a].position; - } + for (unsigned int a = 0; a < pMesh->mNumVertices; a++) + pMesh->mVertices[a] = oldVertices[uniqueVertices[a]]; + delete [] oldVertices; } // Normals, if present if (pMesh->mNormals) { - delete [] pMesh->mNormals; + aiVector3D *oldNormals = pMesh->mNormals; pMesh->mNormals = new aiVector3D[pMesh->mNumVertices]; - for( unsigned int a = 0; a < pMesh->mNumVertices; a++) { - pMesh->mNormals[a] = uniqueVertices[a].normal; - } + for (unsigned int a = 0; a < pMesh->mNumVertices; a++) + pMesh->mNormals[a] = oldNormals[uniqueVertices[a]]; + delete oldNormals; } // Tangents, if present if (pMesh->mTangents) { - delete [] pMesh->mTangents; + aiVector3D *oldTangents = pMesh->mTangents; pMesh->mTangents = new aiVector3D[pMesh->mNumVertices]; - for (unsigned int a = 0; a < pMesh->mNumVertices; a++) { - pMesh->mTangents[a] = uniqueVertices[a].tangent; - } + for (unsigned int a = 0; a < pMesh->mNumVertices; a++) + pMesh->mTangents[a] = oldTangents[uniqueVertices[a]]; + delete oldTangents; } // Bitangents as well if (pMesh->mBitangents) { - delete [] pMesh->mBitangents; + aiVector3D *oldBitangents = pMesh->mBitangents; pMesh->mBitangents = new aiVector3D[pMesh->mNumVertices]; - for (unsigned int a = 0; a < pMesh->mNumVertices; a++) { - pMesh->mBitangents[a] = uniqueVertices[a].bitangent; - } + for (unsigned int a = 0; a < pMesh->mNumVertices; a++) + pMesh->mBitangents[a] = oldBitangents[uniqueVertices[a]]; + delete oldBitangents; } // Vertex colors for (unsigned int a = 0; pMesh->HasVertexColors(a); a++) { - delete [] pMesh->mColors[a]; + aiColor4D *oldColors = pMesh->mColors[a]; pMesh->mColors[a] = new aiColor4D[pMesh->mNumVertices]; - for( unsigned int b = 0; b < pMesh->mNumVertices; b++) { - pMesh->mColors[a][b] = uniqueVertices[b].colors[a]; - } + for (unsigned int b = 0; b < pMesh->mNumVertices; b++) + pMesh->mColors[a][b] = oldColors[uniqueVertices[b]]; + delete [] oldColors; } // Texture coords for (unsigned int a = 0; pMesh->HasTextureCoords(a); a++) { - delete [] pMesh->mTextureCoords[a]; + aiVector3D *oldTextureCoords = pMesh->mTextureCoords[a]; pMesh->mTextureCoords[a] = new aiVector3D[pMesh->mNumVertices]; - for (unsigned int b = 0; b < pMesh->mNumVertices; b++) { - pMesh->mTextureCoords[a][b] = uniqueVertices[b].texcoords[a]; - } + for (unsigned int b = 0; b < pMesh->mNumVertices; b++) + pMesh->mTextureCoords[a][b] = oldTextureCoords[uniqueVertices[b]]; + delete [] oldTextureCoords; } } @@ -270,7 +270,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) { } // We'll never have more vertices afterwards. - std::vector uniqueVertices; + std::vector uniqueVertices; uniqueVertices.reserve( pMesh->mNumVertices); // For each vertex the index of the vertex it was replaced by. @@ -311,7 +311,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) { const bool hasAnimMeshes = pMesh->mNumAnimMeshes > 0; // We'll never have more vertices afterwards. - std::vector> uniqueAnimatedVertices; + std::vector> uniqueAnimatedVertices; if (hasAnimMeshes) { uniqueAnimatedVertices.resize(pMesh->mNumAnimMeshes); for (unsigned int animMeshIndex = 0; animMeshIndex < pMesh->mNumAnimMeshes; animMeshIndex++) { @@ -345,10 +345,10 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) { //keep track of its index and increment 1 replaceIndex[a] = newIndex++; // add the vertex to the unique vertices - uniqueVertices.push_back(v); + uniqueVertices.push_back(a); if (hasAnimMeshes) { for (unsigned int animMeshIndex = 0; animMeshIndex < pMesh->mNumAnimMeshes; animMeshIndex++) { - uniqueAnimatedVertices[animMeshIndex].emplace_back(pMesh->mAnimMeshes[animMeshIndex], a); + uniqueAnimatedVertices[animMeshIndex].emplace_back(a); } } } else{ From b2bfe6d253d3a0b5c8c244e9b60f641a0ad00734 Mon Sep 17 00:00:00 2001 From: ockeymm <88309682+ockeymm@users.noreply.github.com> Date: Wed, 27 Sep 2023 11:29:10 +0800 Subject: [PATCH 17/20] Use unique_ptr to release old vertices data. --- code/PostProcessing/JoinVerticesProcess.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/code/PostProcessing/JoinVerticesProcess.cpp b/code/PostProcessing/JoinVerticesProcess.cpp index 650336040..5b6eaeda7 100644 --- a/code/PostProcessing/JoinVerticesProcess.cpp +++ b/code/PostProcessing/JoinVerticesProcess.cpp @@ -156,53 +156,47 @@ void updateXMeshVertices(XMesh *pMesh, std::vector &uniqueVertices) { // ---------------------------------------------------------------------------- // Position, if present (check made for aiAnimMesh) - if (pMesh->mVertices) { - aiVector3D *oldVertices = pMesh->mVertices; + if (pMesh->mVertices) { + std::unique_ptr oldVertices(pMesh->mVertices); pMesh->mVertices = new aiVector3D[pMesh->mNumVertices]; for (unsigned int a = 0; a < pMesh->mNumVertices; a++) pMesh->mVertices[a] = oldVertices[uniqueVertices[a]]; - delete [] oldVertices; } // Normals, if present if (pMesh->mNormals) { - aiVector3D *oldNormals = pMesh->mNormals; + std::unique_ptr oldNormals(pMesh->mNormals); pMesh->mNormals = new aiVector3D[pMesh->mNumVertices]; for (unsigned int a = 0; a < pMesh->mNumVertices; a++) pMesh->mNormals[a] = oldNormals[uniqueVertices[a]]; - delete oldNormals; } // Tangents, if present if (pMesh->mTangents) { - aiVector3D *oldTangents = pMesh->mTangents; + std::unique_ptr oldTangents(pMesh->mTangents); pMesh->mTangents = new aiVector3D[pMesh->mNumVertices]; for (unsigned int a = 0; a < pMesh->mNumVertices; a++) pMesh->mTangents[a] = oldTangents[uniqueVertices[a]]; - delete oldTangents; } // Bitangents as well if (pMesh->mBitangents) { - aiVector3D *oldBitangents = pMesh->mBitangents; + std::unique_ptr oldBitangents(pMesh->mBitangents); pMesh->mBitangents = new aiVector3D[pMesh->mNumVertices]; for (unsigned int a = 0; a < pMesh->mNumVertices; a++) pMesh->mBitangents[a] = oldBitangents[uniqueVertices[a]]; - delete oldBitangents; } // Vertex colors for (unsigned int a = 0; pMesh->HasVertexColors(a); a++) { - aiColor4D *oldColors = pMesh->mColors[a]; + std::unique_ptr oldColors(pMesh->mColors[a]); pMesh->mColors[a] = new aiColor4D[pMesh->mNumVertices]; for (unsigned int b = 0; b < pMesh->mNumVertices; b++) pMesh->mColors[a][b] = oldColors[uniqueVertices[b]]; - delete [] oldColors; } // Texture coords for (unsigned int a = 0; pMesh->HasTextureCoords(a); a++) { - aiVector3D *oldTextureCoords = pMesh->mTextureCoords[a]; + std::unique_ptr oldTextureCoords(pMesh->mTextureCoords[a]); pMesh->mTextureCoords[a] = new aiVector3D[pMesh->mNumVertices]; for (unsigned int b = 0; b < pMesh->mNumVertices; b++) pMesh->mTextureCoords[a][b] = oldTextureCoords[uniqueVertices[b]]; - delete [] oldTextureCoords; } } From 7b6bf139cfc674838d30b8fec5beac0425324d3a Mon Sep 17 00:00:00 2001 From: ockeymm <88309682+ockeymm@users.noreply.github.com> Date: Wed, 27 Sep 2023 16:20:56 +0800 Subject: [PATCH 18/20] include memory.h to fix compile error --- code/PostProcessing/JoinVerticesProcess.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/code/PostProcessing/JoinVerticesProcess.cpp b/code/PostProcessing/JoinVerticesProcess.cpp index 5b6eaeda7..4de6c3e1b 100644 --- a/code/PostProcessing/JoinVerticesProcess.cpp +++ b/code/PostProcessing/JoinVerticesProcess.cpp @@ -53,6 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include using namespace Assimp; From d7cde433679a6e21e0a5f22e54ea0951783503fe Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 2 Oct 2023 10:24:43 +0200 Subject: [PATCH 19/20] Fix: Add check for invalid input argument --- code/AssetLib/MD5/MD5Parser.cpp | 10 +++--- code/AssetLib/MD5/MD5Parser.h | 62 ++++++++++++++++++--------------- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/code/AssetLib/MD5/MD5Parser.cpp b/code/AssetLib/MD5/MD5Parser.cpp index 7d0b41c24..8da30e28f 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-2022, assimp team +Copyright (c) 2006-2023, assimp team All rights reserved. @@ -87,7 +87,7 @@ MD5Parser::MD5Parser(char *_buffer, unsigned int _fileSize) : buffer(_buffer), b // ------------------------------------------------------------------------------------------------ // Report error to the log stream -/*static*/ AI_WONT_RETURN void MD5Parser::ReportError(const char *error, unsigned int line) { +AI_WONT_RETURN void MD5Parser::ReportError(const char *error, unsigned int line) { char szBuffer[1024]; ::ai_snprintf(szBuffer, 1024, "[MD5] Line %u: %s", line, error); throw DeadlyImportError(szBuffer); @@ -95,7 +95,7 @@ MD5Parser::MD5Parser(char *_buffer, unsigned int _fileSize) : buffer(_buffer), b // ------------------------------------------------------------------------------------------------ // Report warning to the log stream -/*static*/ void MD5Parser::ReportWarning(const char *warn, unsigned int line) { +void MD5Parser::ReportWarning(const char *warn, unsigned int line) { char szBuffer[1024]; ::snprintf(szBuffer, sizeof(szBuffer), "[MD5] Line %u: %s", line, warn); ASSIMP_LOG_WARN(szBuffer); @@ -122,8 +122,8 @@ void MD5Parser::ParseHeader() { // print the command line options to the console // FIX: can break the log length limit, so we need to be careful char *sz = buffer; - while (!IsLineEnd(*buffer++)) - ; + while (!IsLineEnd(*buffer++)); + ASSIMP_LOG_INFO(std::string(sz, std::min((uintptr_t)MAX_LOG_MESSAGE_LENGTH, (uintptr_t)(buffer - sz)))); SkipSpacesAndLineEnd(); } diff --git a/code/AssetLib/MD5/MD5Parser.h b/code/AssetLib/MD5/MD5Parser.h index ad7367e2a..9b29fbe85 100644 --- a/code/AssetLib/MD5/MD5Parser.h +++ b/code/AssetLib/MD5/MD5Parser.h @@ -2,8 +2,7 @@ Open Asset Import Library (assimp) ---------------------------------------------------------------------- -Copyright (c) 2006-2022, assimp team - +Copyright (c) 2006-2023, assimp team All rights reserved. @@ -93,7 +92,7 @@ struct Section { std::string mName; //! For global elements: the value of the element as string - //! Iif !length() the section is not a global element + //! if !length() the section is not a global element std::string mGlobalValue; }; @@ -185,7 +184,7 @@ using FrameList = std::vector; */ struct VertexDesc { VertexDesc() AI_NO_EXCEPT - : mFirstWeight(0), mNumWeights(0) { + : mFirstWeight(0), mNumWeights(0) { // empty } @@ -349,62 +348,61 @@ public: */ MD5Parser(char* buffer, unsigned int fileSize); - // ------------------------------------------------------------------- /** Report a specific error message and throw an exception * @param error Error message to be reported * @param line Index of the line where the error occurred */ - AI_WONT_RETURN static void ReportError (const char* error, unsigned int line) AI_WONT_RETURN_SUFFIX; + AI_WONT_RETURN static void ReportError(const char* error, unsigned int line) AI_WONT_RETURN_SUFFIX; // ------------------------------------------------------------------- /** Report a specific warning * @param warn Warn message to be reported * @param line Index of the line where the error occurred */ - static void ReportWarning (const char* warn, unsigned int line); - + static void ReportWarning(const char* warn, unsigned int line); + // ------------------------------------------------------------------- + /** Report a specific error + * @param error Error message to be reported + */ AI_WONT_RETURN void ReportError (const char* error) AI_WONT_RETURN_SUFFIX; - void ReportWarning (const char* warn) { - return ReportWarning(warn, lineNumber); - } + // ------------------------------------------------------------------- + /** Report a specific warning + * @param error Warn message to be reported + */ + void ReportWarning (const char* warn); //! List of all sections which have been read SectionList mSections; private: - // ------------------------------------------------------------------- - /** Parses a file section. The current file pointer must be outside - * of a section. - * @param out Receives the section data - * @return true if the end of the file has been reached - * @throws ImportErrorException if an error occurs - */ bool ParseSection(Section& out); - - // ------------------------------------------------------------------- - /** Parses the file header - * @throws ImportErrorException if an error occurs - */ void ParseHeader(); - bool SkipLine(const char* in, const char** out); bool SkipLine( ); bool SkipSpacesAndLineEnd( const char* in, const char** out); bool SkipSpacesAndLineEnd(); bool SkipSpaces(); +private: char* buffer; char* bufferEnd; unsigned int fileSize; unsigned int lineNumber; }; +// ------------------------------------------------------------------- +inline void MD5Parser::ReportWarning (const char* warn) { + return ReportWarning(warn, lineNumber); +} + +// ------------------------------------------------------------------- inline void MD5Parser::ReportError(const char* error) { ReportError(error, lineNumber); } + // ------------------------------------------------------------------- inline bool MD5Parser::SkipLine(const char* in, const char** out) { ++lineNumber; @@ -418,18 +416,24 @@ inline bool MD5Parser::SkipLine( ) { // ------------------------------------------------------------------- inline bool MD5Parser::SkipSpacesAndLineEnd( const char* in, const char** out) { - bool bHad = false; - bool running = true; + if (in == bufferEnd) { + *out = in; + return false; + } + + bool bHad = false, running = true; while (running) { if( *in == '\r' || *in == '\n') { - // we open files in binary mode, so there could be \r\n sequences ... + // we open files in binary mode, so there could be \r\n sequences ... if (!bHad) { bHad = true; ++lineNumber; } + } else if (*in == '\t' || *in == ' ') { + bHad = false; + } else { + break; } - else if (*in == '\t' || *in == ' ')bHad = false; - else break; ++in; if (in == bufferEnd) { break; From 5b8cfa920b2655db612c047c8269c876ab66f519 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 2 Oct 2023 11:14:34 +0200 Subject: [PATCH 20/20] Replace an assert by a error log. --- code/PostProcessing/FindInvalidDataProcess.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/PostProcessing/FindInvalidDataProcess.cpp b/code/PostProcessing/FindInvalidDataProcess.cpp index aa91139bc..64abf7589 100644 --- a/code/PostProcessing/FindInvalidDataProcess.cpp +++ b/code/PostProcessing/FindInvalidDataProcess.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2022, assimp team +Copyright (c) 2006-2023, assimp team All rights reserved. @@ -273,7 +273,8 @@ void FindInvalidDataProcess::ProcessAnimation(aiAnimation *anim) { void FindInvalidDataProcess::ProcessAnimationChannel(aiNodeAnim *anim) { ai_assert(nullptr != anim); if (anim->mNumPositionKeys == 0 && anim->mNumRotationKeys == 0 && anim->mNumScalingKeys == 0) { - ai_assert_entry(); + ASSIMP_LOG_ERROR("Invalid node anuimation instance detected."); + return; }