From 518d50d2e6636534a08c852a070cf7f0b433f306 Mon Sep 17 00:00:00 2001 From: hgdagon Date: Thu, 7 Apr 2022 03:07:57 -0700 Subject: [PATCH 01/29] Fixes for Windows/MSYS2 --- CMakeLists.txt | 30 ++++++++++++++---------------- cmake-modules/FindDirectX.cmake | 2 +- code/CMakeLists.txt | 19 ++++++++++++++----- code/Common/DefaultIOStream.cpp | 4 ++-- revision.h.in | 5 +++-- tools/assimp_view/CMakeLists.txt | 2 -- 6 files changed, 34 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab4d45e88..072803fda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,10 +139,6 @@ IF (WIN32) ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN ) IF(MSVC) - OPTION (ASSIMP_BUILD_ASSIMP_VIEW - "If the Assimp view tool is built. (requires DirectX)" - OFF ) - OPTION( ASSIMP_INSTALL_PDB "Install MSVC debug files." ON ) @@ -184,6 +180,7 @@ ENDIF() IF(NOT BUILD_SHARED_LIBS) MESSAGE(STATUS "Shared libraries disabled") SET(LINK_SEARCH_START_STATIC TRUE) + SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES}) ELSE() MESSAGE(STATUS "Shared libraries enabled") ENDIF() @@ -231,16 +228,6 @@ IF(ASSIMP_DOUBLE_PRECISION) ADD_DEFINITIONS(-DASSIMP_DOUBLE_PRECISION) ENDIF() -CONFIGURE_FILE( - ${CMAKE_CURRENT_LIST_DIR}/revision.h.in - ${CMAKE_CURRENT_BINARY_DIR}/revision.h -) - -CONFIGURE_FILE( - ${CMAKE_CURRENT_LIST_DIR}/include/assimp/config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/include/assimp/config.h -) - INCLUDE_DIRECTORIES( BEFORE ./ code/ @@ -710,7 +697,8 @@ ADD_SUBDIRECTORY( code/ ) IF ( ASSIMP_BUILD_ASSIMP_TOOLS ) # The viewer for windows only IF (WIN32) - OPTION ( ASSIMP_BUILD_ASSIMP_VIEW "If the Assimp view tool is built. (requires DirectX)" OFF ) + FIND_PACKAGE(DirectX) + OPTION ( ASSIMP_BUILD_ASSIMP_VIEW "If the Assimp view tool is built. (requires DirectX)" ${DirectX_FOUND} ) IF ( ASSIMP_BUILD_ASSIMP_VIEW ) ADD_SUBDIRECTORY( tools/assimp_view/ ) ENDIF () @@ -735,12 +723,22 @@ IF ( ASSIMP_BUILD_TESTS ) ADD_SUBDIRECTORY( test/ ) ENDIF () -# Generate a pkg-config .pc for the Assimp library. +# Generate a pkg-config .pc, revision.h, and config.h for the Assimp library. CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/assimp.pc.in" "${PROJECT_BINARY_DIR}/assimp.pc" @ONLY ) IF ( ASSIMP_INSTALL ) INSTALL( FILES "${PROJECT_BINARY_DIR}/assimp.pc" DESTINATION ${ASSIMP_LIB_INSTALL_DIR}/pkgconfig/ COMPONENT ${LIBASSIMP-DEV_COMPONENT}) ENDIF() +CONFIGURE_FILE( + ${CMAKE_CURRENT_LIST_DIR}/revision.h.in + ${CMAKE_CURRENT_BINARY_DIR}/revision.h +) + +CONFIGURE_FILE( + ${CMAKE_CURRENT_LIST_DIR}/include/assimp/config.h.in + ${CMAKE_CURRENT_BINARY_DIR}/include/assimp/config.h +) + IF ( ASSIMP_INSTALL ) IF(CMAKE_CPACK_COMMAND AND UNIX AND ASSIMP_OPT_BUILD_PACKAGES) # Packing information diff --git a/cmake-modules/FindDirectX.cmake b/cmake-modules/FindDirectX.cmake index 707043142..b37bc12a3 100644 --- a/cmake-modules/FindDirectX.cmake +++ b/cmake-modules/FindDirectX.cmake @@ -55,7 +55,7 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK endif(CMAKE_CL_64) find_library(DirectX_LIBRARY NAMES d3d9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX_D3DX9_LIBRARY NAMES d3dx9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) - find_library(DirectX_DXERR_LIBRARY NAMES DxErr HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) + find_library(DirectX_DXERR_LIBRARY NAMES DxErr DxErr9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 2eff6117f..a32edc656 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -1053,7 +1053,9 @@ ENDIF() # Check dependencies for glTF importer with Open3DGC-compression. # RT-extensions is used in "contrib/Open3DGC/o3dgcTimer.h" for collecting statistics. Pointed file # has implementation for different platforms: WIN32, __MACH__ and other ("else" block). -FIND_PACKAGE(RT QUIET) +IF (NOT WIN32) + FIND_PACKAGE(RT QUIET) +ENDIF () IF (NOT ASSIMP_HUNTER_ENABLED AND (RT_FOUND OR WIN32)) SET( ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC 1 ) ADD_DEFINITIONS( -DASSIMP_IMPORTER_GLTF_USE_OPEN3DGC=1 ) @@ -1274,10 +1276,17 @@ SET_TARGET_PROPERTIES( assimp PROPERTIES OUTPUT_NAME assimp${LIBRARY_SUFFIX} ) -if (WIN32 AND CMAKE_COMPILER_IS_GNUCXX AND BUILD_SHARED_LIBS) - set_target_properties(assimp PROPERTIES - SUFFIX "-${ASSIMP_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) +if (MINGW) + if (BUILD_SHARED_LIBS) + set_target_properties(assimp PROPERTIES + SUFFIX "-${ASSIMP_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) + if (NOT DEFINED ${LIBRARY_SUFFIX}) #Added as a guard for subsequent runs, but seems to not work when cache is outdated + set(LIBRARY_SUFFIX "-${ASSIMP_SOVERSION}" CACHE STRING "the suffix for the assimp MinGW shared library") + endif() + else () + TARGET_LINK_LIBRARIES ( assimp -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lwinpthread ) # winpthread is for libminizip. + endif () endif() if (APPLE) diff --git a/code/Common/DefaultIOStream.cpp b/code/Common/DefaultIOStream.cpp index e30f26acd..17fc44f9a 100644 --- a/code/Common/DefaultIOStream.cpp +++ b/code/Common/DefaultIOStream.cpp @@ -63,7 +63,7 @@ inline int select_fseek(FILE *file, int64_t offset, int origin) { -#if defined _WIN32 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601) +#if defined _WIN64 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601) template <> inline size_t select_ftell<8>(FILE *file) { return (size_t)::_ftelli64(file); @@ -149,7 +149,7 @@ size_t DefaultIOStream::FileSize() const { // // See here for details: // https://www.securecoding.cert.org/confluence/display/seccode/FIO19-C.+Do+not+use+fseek()+and+ftell()+to+compute+the+size+of+a+regular+file -#if defined _WIN32 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601) +#if defined _WIN64 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601) struct __stat64 fileStat; //using fileno + fstat avoids having to handle the filename int err = _fstat64(_fileno(mFile), &fileStat); diff --git a/revision.h.in b/revision.h.in index 6d09afbc6..25cb3949f 100644 --- a/revision.h.in +++ b/revision.h.in @@ -18,11 +18,12 @@ #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" #ifdef NDEBUG -#define VER_ORIGINAL_FILENAME_STR "assimp@LIBRARY_SUFFIX@.dll" +#define VER_ORIGINAL_FILENAME_STR "@CMAKE_SHARED_LIBRARY_PREFIX@assimp@LIBRARY_SUFFIX@.dll" #else -#define VER_ORIGINAL_FILENAME_STR "assimp@LIBRARY_SUFFIX@@CMAKE_DEBUG_POSTFIX@.dll" +#define VER_ORIGINAL_FILENAME_STR "@CMAKE_SHARED_LIBRARY_PREFIX@assimp@LIBRARY_SUFFIX@@CMAKE_DEBUG_POSTFIX@.dll" #endif // NDEBUG #endif // ASSIMP_REVISION_H_INC diff --git a/tools/assimp_view/CMakeLists.txt b/tools/assimp_view/CMakeLists.txt index 13c4c139a..925c87848 100644 --- a/tools/assimp_view/CMakeLists.txt +++ b/tools/assimp_view/CMakeLists.txt @@ -39,8 +39,6 @@ #---------------------------------------------------------------------- cmake_minimum_required( VERSION 3.10 ) -FIND_PACKAGE(DirectX REQUIRED) - INCLUDE_DIRECTORIES ( ${Assimp_SOURCE_DIR}/include ${Assimp_SOURCE_DIR}/code From b38c25fe091552b200936f8bfcfe361d4a372f3c Mon Sep 17 00:00:00 2001 From: RedSkittleFox Date: Wed, 13 Apr 2022 02:50:31 +0200 Subject: [PATCH 02/29] Reuploaded (fixed) mmd model --- test/models-nonbsd/MMD/Alicia_blade.pmx | Bin 319677 -> 319682 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/test/models-nonbsd/MMD/Alicia_blade.pmx b/test/models-nonbsd/MMD/Alicia_blade.pmx index 14cd4902414bd710659b7dd6e3a35fc7241556e7..cdd7709cc9427a0be6bf01b096a29e93a6533981 100644 GIT binary patch delta 50 zcmdmcQ25Y6;f5B*7N!>FEi7-;7FEi7-;roUBVvE8n%&ceya$hF;EgC#|A`y5Xewdnv-_YMsJ From f26dc74f21202a1d83634b68cb281798a3a21374 Mon Sep 17 00:00:00 2001 From: RedSkittleFox Date: Wed, 13 Apr 2022 02:51:12 +0200 Subject: [PATCH 03/29] Fixed MMD Importer not loading files from buffer and enabled unit test --- code/AssetLib/MMD/MMDImporter.cpp | 33 +++++++++++++++++++------------ test/unit/utPMXImporter.cpp | 6 +++--- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/code/AssetLib/MMD/MMDImporter.cpp b/code/AssetLib/MMD/MMDImporter.cpp index e0e68f7c5..4468cb775 100644 --- a/code/AssetLib/MMD/MMDImporter.cpp +++ b/code/AssetLib/MMD/MMDImporter.cpp @@ -55,6 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include static const aiImporterDesc desc = { "MMD Importer", "", @@ -102,26 +103,32 @@ const aiImporterDesc *MMDImporter::GetInfo() const { // ------------------------------------------------------------------------------------------------ // MMD import implementation void MMDImporter::InternReadFile(const std::string &file, aiScene *pScene, - IOSystem * /*pIOHandler*/) { - // Read file by istream - std::filebuf fb; - if (!fb.open(file, std::ios::in | std::ios::binary)) { + IOSystem* pIOHandler) { + + auto streamCloser = [&](IOStream *pStream) { + pIOHandler->Close(pStream); + }; + + static const std::string mode = "rb"; + const std::unique_ptr fileStream(pIOHandler->Open(file, mode), streamCloser); + + if (fileStream == nullptr) { throw DeadlyImportError("Failed to open file ", file, "."); } - std::istream fileStream(&fb); - - // Get the file-size and validate it, throwing an exception when fails - fileStream.seekg(0, fileStream.end); - size_t fileSize = static_cast(fileStream.tellg()); - fileStream.seekg(0, fileStream.beg); - - if (fileSize < sizeof(pmx::PmxModel)) { + const size_t fileSize = fileStream->FileSize(); + if (fileSize < sizeof(pmx::PmxModel)) + { throw DeadlyImportError(file, " is too small."); } + std::vector contents(fileStream->FileSize()); + fileStream->Read(std::data(contents), 1, std::size(contents)); + + std::istrstream is(static_cast(std::data(contents)), std::size(contents)); + pmx::PmxModel model; - model.Read(&fileStream); + model.Read(&is); CreateDataFromImport(&model, pScene); } diff --git a/test/unit/utPMXImporter.cpp b/test/unit/utPMXImporter.cpp index a0d663d29..167fb234a 100644 --- a/test/unit/utPMXImporter.cpp +++ b/test/unit/utPMXImporter.cpp @@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "UnitTestPCH.h" #include "AbstractImportExportBase.h" #include "AssetLib/MMD/MMDImporter.h" +#include "assimp/postprocess.h" #include @@ -51,9 +52,8 @@ class utPMXImporter : public AbstractImportExportBase { public: virtual bool importerTest() { Assimp::Importer importer; - /*const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/../models-nonbsd/MMD/Alicia_blade.pmx", aiProcess_ValidateDataStructure ); - return nullptr != scene;*/ - return true; + const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/../models-nonbsd/MMD/Alicia_blade.pmx", aiProcess_ValidateDataStructure ); + return nullptr != scene; } }; From 5ab1be8d04da9ec3729e617fc002c634242c4c01 Mon Sep 17 00:00:00 2001 From: RedSkittleFox Date: Wed, 13 Apr 2022 11:38:57 +0200 Subject: [PATCH 04/29] Fixed deprecated class usage; removed unsupported C++17 feature --- code/AssetLib/MMD/MMDImporter.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/AssetLib/MMD/MMDImporter.cpp b/code/AssetLib/MMD/MMDImporter.cpp index 4468cb775..4445c2993 100644 --- a/code/AssetLib/MMD/MMDImporter.cpp +++ b/code/AssetLib/MMD/MMDImporter.cpp @@ -52,10 +52,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include + #include #include -#include +#include static const aiImporterDesc desc = { "MMD Importer", "", @@ -123,12 +123,12 @@ void MMDImporter::InternReadFile(const std::string &file, aiScene *pScene, } std::vector contents(fileStream->FileSize()); - fileStream->Read(std::data(contents), 1, std::size(contents)); + fileStream->Read(contents.data(), 1, contents.size()); - std::istrstream is(static_cast(std::data(contents)), std::size(contents)); + std::istringstream iss(std::string(contents.begin(), contents.end())); pmx::PmxModel model; - model.Read(&is); + model.Read(&iss); CreateDataFromImport(&model, pScene); } From 863e3e0ccbd9266fd6f87282a6832cdde578641e Mon Sep 17 00:00:00 2001 From: Mykhailo418 Date: Mon, 18 Apr 2022 16:02:12 +0300 Subject: [PATCH 05/29] FbxConverter, bone mOffsetMatrix update --- code/AssetLib/FBX/FBXConverter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/AssetLib/FBX/FBXConverter.cpp b/code/AssetLib/FBX/FBXConverter.cpp index d446fd2e9..bea449f81 100644 --- a/code/AssetLib/FBX/FBXConverter.cpp +++ b/code/AssetLib/FBX/FBXConverter.cpp @@ -1553,14 +1553,16 @@ void FBXConverter::ConvertCluster(std::vector &local_mesh_bones, const bone = new aiBone(); bone->mName = bone_name; + bone->mOffsetMatrix = cl->Transform(); // store local transform link for post processing + /* bone->mOffsetMatrix = cl->TransformLink(); bone->mOffsetMatrix.Inverse(); aiMatrix4x4 matrix = (aiMatrix4x4)absolute_transform; bone->mOffsetMatrix = bone->mOffsetMatrix * matrix; // * mesh_offset - + */ // // Now calculate the aiVertexWeights // From e3def37f42bd1cd13b025673d5c9ddc03b46cc60 Mon Sep 17 00:00:00 2001 From: Mykhailo418 Date: Mon, 18 Apr 2022 17:26:37 +0300 Subject: [PATCH 06/29] assing absolute_transform to matrix --- code/AssetLib/FBX/FBXConverter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/code/AssetLib/FBX/FBXConverter.cpp b/code/AssetLib/FBX/FBXConverter.cpp index bea449f81..b9e923238 100644 --- a/code/AssetLib/FBX/FBXConverter.cpp +++ b/code/AssetLib/FBX/FBXConverter.cpp @@ -1554,6 +1554,7 @@ void FBXConverter::ConvertCluster(std::vector &local_mesh_bones, const bone->mName = bone_name; bone->mOffsetMatrix = cl->Transform(); + aiMatrix4x4 matrix = (aiMatrix4x4)absolute_transform; // store local transform link for post processing /* bone->mOffsetMatrix = cl->TransformLink(); From 8a1dc87b4ca5903733d7b7e679a61be784a0c986 Mon Sep 17 00:00:00 2001 From: Mykhailo418 Date: Mon, 18 Apr 2022 18:10:59 +0300 Subject: [PATCH 07/29] remove absolute_transform in FBXConverter --- code/AssetLib/FBX/FBXConverter.cpp | 42 ++++++++++-------------------- code/AssetLib/FBX/FBXConverter.h | 21 ++++++--------- 2 files changed, 22 insertions(+), 41 deletions(-) diff --git a/code/AssetLib/FBX/FBXConverter.cpp b/code/AssetLib/FBX/FBXConverter.cpp index b9e923238..4de142075 100644 --- a/code/AssetLib/FBX/FBXConverter.cpp +++ b/code/AssetLib/FBX/FBXConverter.cpp @@ -232,7 +232,6 @@ void FBXConverter::ConvertNodes(uint64_t id, aiNode *parent, aiNode *root_node) nodes_chain.clear(); post_nodes_chain.clear(); - aiMatrix4x4 new_abs_transform = parent->mTransformation; std::string node_name = FixNodeName(model->Name()); // even though there is only a single input node, the design of // assimp (or rather: the complicated transformation chain that @@ -266,12 +265,10 @@ void FBXConverter::ConvertNodes(uint64_t id, aiNode *parent, aiNode *root_node) child->mParent = last_parent; last_parent = child.mNode; - - new_abs_transform *= child->mTransformation; } // attach geometry - ConvertModel(*model, nodes_chain.back().mNode, root_node, new_abs_transform); + ConvertModel(*model, nodes_chain.back().mNode, root_node); // check if there will be any child nodes const std::vector &child_conns = doc.GetConnectionsByDestinationSequenced(model->ID(), "Model"); @@ -290,8 +287,6 @@ void FBXConverter::ConvertNodes(uint64_t id, aiNode *parent, aiNode *root_node) postnode->mParent = last_parent; last_parent = postnode.mNode; - - new_abs_transform *= postnode->mTransformation; } } else { // free the nodes we allocated as we don't need them @@ -899,8 +894,7 @@ void FBXConverter::SetupNodeMetadata(const Model &model, aiNode &nd) { } } -void FBXConverter::ConvertModel(const Model &model, aiNode *parent, aiNode *root_node, - const aiMatrix4x4 &absolute_transform) { +void FBXConverter::ConvertModel(const Model &model, aiNode *parent, aiNode *root_node) { const std::vector &geos = model.GetGeometry(); std::vector meshes; @@ -911,8 +905,7 @@ void FBXConverter::ConvertModel(const Model &model, aiNode *parent, aiNode *root const MeshGeometry *const mesh = dynamic_cast(geo); const LineGeometry *const line = dynamic_cast(geo); if (mesh) { - const std::vector &indices = ConvertMesh(*mesh, model, parent, root_node, - absolute_transform); + const std::vector &indices = ConvertMesh(*mesh, model, parent, root_node); std::copy(indices.begin(), indices.end(), std::back_inserter(meshes)); } else if (line) { const std::vector &indices = ConvertLine(*line, root_node); @@ -933,8 +926,7 @@ void FBXConverter::ConvertModel(const Model &model, aiNode *parent, aiNode *root } std::vector -FBXConverter::ConvertMesh(const MeshGeometry &mesh, const Model &model, aiNode *parent, aiNode *root_node, - const aiMatrix4x4 &absolute_transform) { +FBXConverter::ConvertMesh(const MeshGeometry &mesh, const Model &model, aiNode *parent, aiNode *root_node) { std::vector temp; MeshMap::const_iterator it = meshes_converted.find(&mesh); @@ -957,13 +949,13 @@ FBXConverter::ConvertMesh(const MeshGeometry &mesh, const Model &model, aiNode * const MatIndexArray::value_type base = mindices[0]; for (MatIndexArray::value_type index : mindices) { if (index != base) { - return ConvertMeshMultiMaterial(mesh, model, parent, root_node, absolute_transform); + return ConvertMeshMultiMaterial(mesh, model, parent, root_node); } } } // faster code-path, just copy the data - temp.push_back(ConvertMeshSingleMaterial(mesh, model, absolute_transform, parent, root_node)); + temp.push_back(ConvertMeshSingleMaterial(mesh, model, parent, root_node)); return temp; } @@ -1032,8 +1024,7 @@ aiMesh *FBXConverter::SetupEmptyMesh(const Geometry &mesh, aiNode *parent) { } unsigned int FBXConverter::ConvertMeshSingleMaterial(const MeshGeometry &mesh, const Model &model, - const aiMatrix4x4 &absolute_transform, aiNode *parent, - aiNode *) { + aiNode *parent, aiNode *) { const MatIndexArray &mindices = mesh.GetMaterialIndices(); aiMesh *const out_mesh = SetupEmptyMesh(mesh, parent); @@ -1152,7 +1143,7 @@ unsigned int FBXConverter::ConvertMeshSingleMaterial(const MeshGeometry &mesh, c } if (doc.Settings().readWeights && mesh.DeformerSkin() != nullptr) { - ConvertWeights(out_mesh, mesh, absolute_transform, parent, NO_MATERIAL_SEPARATION, nullptr); + ConvertWeights(out_mesh, mesh, parent, NO_MATERIAL_SEPARATION, nullptr); } std::vector animMeshes; @@ -1200,8 +1191,7 @@ unsigned int FBXConverter::ConvertMeshSingleMaterial(const MeshGeometry &mesh, c std::vector FBXConverter::ConvertMeshMultiMaterial(const MeshGeometry &mesh, const Model &model, aiNode *parent, - aiNode *root_node, - const aiMatrix4x4 &absolute_transform) { + aiNode *root_node) { const MatIndexArray &mindices = mesh.GetMaterialIndices(); ai_assert(mindices.size()); @@ -1211,7 +1201,7 @@ FBXConverter::ConvertMeshMultiMaterial(const MeshGeometry &mesh, const Model &mo for (MatIndexArray::value_type index : mindices) { if (had.find(index) == had.end()) { - indices.push_back(ConvertMeshMultiMaterial(mesh, model, index, parent, root_node, absolute_transform)); + indices.push_back(ConvertMeshMultiMaterial(mesh, model, index, parent, root_node)); had.insert(index); } } @@ -1221,8 +1211,7 @@ FBXConverter::ConvertMeshMultiMaterial(const MeshGeometry &mesh, const Model &mo unsigned int FBXConverter::ConvertMeshMultiMaterial(const MeshGeometry &mesh, const Model &model, MatIndexArray::value_type index, - aiNode *parent, aiNode *, - const aiMatrix4x4 &absolute_transform) { + aiNode *parent, aiNode *) { aiMesh *const out_mesh = SetupEmptyMesh(mesh, parent); const MatIndexArray &mindices = mesh.GetMaterialIndices(); @@ -1385,7 +1374,7 @@ unsigned int FBXConverter::ConvertMeshMultiMaterial(const MeshGeometry &mesh, co ConvertMaterialForMesh(out_mesh, model, mesh, index); if (process_weights) { - ConvertWeights(out_mesh, mesh, absolute_transform, parent, index, &reverseMapping); + ConvertWeights(out_mesh, mesh, parent, index, &reverseMapping); } std::vector animMeshes; @@ -1436,7 +1425,6 @@ unsigned int FBXConverter::ConvertMeshMultiMaterial(const MeshGeometry &mesh, co } void FBXConverter::ConvertWeights(aiMesh *out, const MeshGeometry &geo, - const aiMatrix4x4 &absolute_transform, aiNode *parent, unsigned int materialIndex, std::vector *outputVertStartIndices) { ai_assert(geo.DeformerSkin()); @@ -1508,7 +1496,7 @@ void FBXConverter::ConvertWeights(aiMesh *out, const MeshGeometry &geo, // XXX this could be heavily simplified by collecting the bone // data in a single step. ConvertCluster(bones, cluster, out_indices, index_out_indices, - count_out_indices, absolute_transform, parent); + count_out_indices, parent); } bone_map.clear(); @@ -1537,8 +1525,7 @@ const aiNode *GetNodeByName(aiNode *current_node) { void FBXConverter::ConvertCluster(std::vector &local_mesh_bones, const Cluster *cl, std::vector &out_indices, std::vector &index_out_indices, - std::vector &count_out_indices, const aiMatrix4x4 &absolute_transform, - aiNode *) { + std::vector &count_out_indices, aiNode *) { ai_assert(cl); // make sure cluster valid std::string deformer_name = cl->TargetNode()->Name(); aiString bone_name = aiString(FixNodeName(deformer_name)); @@ -1554,7 +1541,6 @@ void FBXConverter::ConvertCluster(std::vector &local_mesh_bones, const bone->mName = bone_name; bone->mOffsetMatrix = cl->Transform(); - aiMatrix4x4 matrix = (aiMatrix4x4)absolute_transform; // store local transform link for post processing /* bone->mOffsetMatrix = cl->TransformLink(); diff --git a/code/AssetLib/FBX/FBXConverter.h b/code/AssetLib/FBX/FBXConverter.h index becfdb3e8..5559f0b7c 100644 --- a/code/AssetLib/FBX/FBXConverter.h +++ b/code/AssetLib/FBX/FBXConverter.h @@ -180,14 +180,12 @@ private: void SetupNodeMetadata(const Model& model, aiNode& nd); // ------------------------------------------------------------------------------------------------ - void ConvertModel(const Model &model, aiNode *parent, aiNode *root_node, - const aiMatrix4x4 &absolute_transform); + void ConvertModel(const Model &model, aiNode *parent, aiNode *root_node); // ------------------------------------------------------------------------------------------------ // MeshGeometry -> aiMesh, return mesh index + 1 or 0 if the conversion failed std::vector - ConvertMesh(const MeshGeometry &mesh, const Model &model, aiNode *parent, aiNode *root_node, - const aiMatrix4x4 &absolute_transform); + ConvertMesh(const MeshGeometry &mesh, const Model &model, aiNode *parent, aiNode *root_node); // ------------------------------------------------------------------------------------------------ std::vector ConvertLine(const LineGeometry& line, aiNode *root_node); @@ -197,17 +195,15 @@ private: // ------------------------------------------------------------------------------------------------ unsigned int ConvertMeshSingleMaterial(const MeshGeometry &mesh, const Model &model, - const aiMatrix4x4 &absolute_transform, aiNode *parent, - aiNode *root_node); + aiNode *parent, aiNode *root_node); // ------------------------------------------------------------------------------------------------ std::vector - ConvertMeshMultiMaterial(const MeshGeometry &mesh, const Model &model, aiNode *parent, aiNode *root_node, - const aiMatrix4x4 &absolute_transform); + ConvertMeshMultiMaterial(const MeshGeometry &mesh, const Model &model, aiNode *parent, aiNode *root_node); // ------------------------------------------------------------------------------------------------ unsigned int ConvertMeshMultiMaterial(const MeshGeometry &mesh, const Model &model, MatIndexArray::value_type index, - aiNode *parent, aiNode *root_node, const aiMatrix4x4 &absolute_transform); + aiNode *parent, aiNode *root_node); // ------------------------------------------------------------------------------------------------ static const unsigned int NO_MATERIAL_SEPARATION = /* std::numeric_limits::max() */ @@ -220,15 +216,14 @@ private: * - outputVertStartIndices is only used when a material index is specified, it gives for * each output vertex the DOM index it maps to. */ - void ConvertWeights(aiMesh *out, const MeshGeometry &geo, const aiMatrix4x4 &absolute_transform, - aiNode *parent = nullptr, unsigned int materialIndex = NO_MATERIAL_SEPARATION, + void ConvertWeights(aiMesh *out, const MeshGeometry &geo, aiNode *parent = nullptr, + unsigned int materialIndex = NO_MATERIAL_SEPARATION, std::vector *outputVertStartIndices = nullptr); // ------------------------------------------------------------------------------------------------ void ConvertCluster(std::vector &local_mesh_bones, const Cluster *cl, std::vector &out_indices, std::vector &index_out_indices, - std::vector &count_out_indices, const aiMatrix4x4 &absolute_transform, - aiNode *parent ); + std::vector &count_out_indices, aiNode *parent ); // ------------------------------------------------------------------------------------------------ void ConvertMaterialForMesh(aiMesh* out, const Model& model, const MeshGeometry& geo, From 6c2f1378e3b5fbea1987a27392634202d0ddfc22 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 27 Apr 2022 15:09:30 +0200 Subject: [PATCH 08/29] Document fuzz folder - closes https://github.com/assimp/assimp/issues/4497 --- Readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Readme.md b/Readme.md index f4167c9f2..cd08c6a66 100644 --- a/Readme.md +++ b/Readme.md @@ -58,6 +58,7 @@ Open Asset Import Library is implemented in C++. The directory structure looks l /code Source code /contrib Third-party libraries /doc Documentation (doxysource and pre-compiled docs) + /fuzz Contains the test-code for the Google-Fuzzer project /include Public header C and C++ header files /scripts Scripts used to generate the loading code for some formats /port Ports to other languages and scripts to maintain those. From 37ec378b60b3db5810e6f4de2f9f509acdacdca6 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 27 Apr 2022 19:52:23 +0200 Subject: [PATCH 09/29] Fixx out-of-range access in ASE-Parser - closes https://github.com/assimp/assimp/issues/4495 --- code/AssetLib/ASE/ASEParser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/AssetLib/ASE/ASEParser.cpp b/code/AssetLib/ASE/ASEParser.cpp index 14eb720f4..9e2d301e8 100644 --- a/code/AssetLib/ASE/ASEParser.cpp +++ b/code/AssetLib/ASE/ASEParser.cpp @@ -646,7 +646,9 @@ void Parser::ParseLV2MaterialBlock(ASE::Material &mat) { } // get a reference to the material - Material &sMat = mat.avSubMaterials[iIndex]; + if (iIndex < mat.avSubMaterials.size()) { + Material &sMat = mat.avSubMaterials[iIndex]; + } // parse the material block ParseLV2MaterialBlock(sMat); From 174b2fcf595a22af1ac6dcfa009ca5e7fcb8435e Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 27 Apr 2022 20:21:30 +0200 Subject: [PATCH 10/29] Fix invalid use of material reference. --- code/AssetLib/ASE/ASEParser.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/AssetLib/ASE/ASEParser.cpp b/code/AssetLib/ASE/ASEParser.cpp index 9e2d301e8..0d526147c 100644 --- a/code/AssetLib/ASE/ASEParser.cpp +++ b/code/AssetLib/ASE/ASEParser.cpp @@ -648,10 +648,11 @@ void Parser::ParseLV2MaterialBlock(ASE::Material &mat) { // get a reference to the material if (iIndex < mat.avSubMaterials.size()) { Material &sMat = mat.avSubMaterials[iIndex]; + + // parse the material block + ParseLV2MaterialBlock(sMat); } - // parse the material block - ParseLV2MaterialBlock(sMat); continue; } } From 0b3232ce10d8f0636f64fa111ad0a86117461bd7 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 28 Apr 2022 09:22:02 +0200 Subject: [PATCH 11/29] Delete README - closes https://github.com/assimp/assimp/issues/4505 --- README | 1 - 1 file changed, 1 deletion(-) delete mode 100644 README diff --git a/README b/README deleted file mode 100644 index 24619ab94..000000000 --- a/README +++ /dev/null @@ -1 +0,0 @@ -See Readme.md From 1ac9173e8c967677afa398148d42b9ef85238777 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 28 Apr 2022 10:08:01 +0200 Subject: [PATCH 12/29] Disable assertion tests floating point against inf for Intel oneAPI - closes https://github.com/assimp/assimp/issues/4450 --- code/AssetLib/IFC/IFCCurve.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/AssetLib/IFC/IFCCurve.cpp b/code/AssetLib/IFC/IFCCurve.cpp index 19732ef25..ff84bb59b 100644 --- a/code/AssetLib/IFC/IFCCurve.cpp +++ b/code/AssetLib/IFC/IFCCurve.cpp @@ -4,7 +4,6 @@ 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, @@ -51,7 +50,6 @@ namespace Assimp { namespace IFC { namespace { - // -------------------------------------------------------------------------------- // Conic is the base class for Circle and Ellipse // -------------------------------------------------------------------------------- @@ -546,8 +544,10 @@ IfcFloat RecursiveSearch(const Curve* cv, const IfcVector3& val, IfcFloat a, Ifc } } +#ifndef __INTEL_LLVM_COMPILER ai_assert( min_diff[ 0 ] != inf ); ai_assert( min_diff[ 1 ] != inf ); +#endif // __INTEL_LLVM_COMPILER if ( std::fabs(a-min_point[0]) < threshold || recurse >= max_recurse) { return min_point[0]; } @@ -606,8 +606,10 @@ bool BoundedCurve::IsClosed() const { // ------------------------------------------------------------------------------------------------ void BoundedCurve::SampleDiscrete(TempMesh& out) const { const ParamRange& range = GetParametricRange(); +#ifndef __INTEL_LLVM_COMPILER ai_assert( range.first != std::numeric_limits::infinity() ); ai_assert( range.second != std::numeric_limits::infinity() ); +#endif // __INTEL_LLVM_COMPILER return SampleDiscrete(out,range.first,range.second); } From 94ebe71969a2d8b3012238b4067296be143ac244 Mon Sep 17 00:00:00 2001 From: "U-DESKTOP-0R560PH\\George" Date: Sat, 30 Apr 2022 08:01:15 -0700 Subject: [PATCH 13/29] Resource script updates --- code/CMakeLists.txt | 2 +- code/res/assimp.rc | 67 +++++---------------------- code/res/resource.h | 14 ------ tools/assimp_cmd/CMakeLists.txt | 7 ++- tools/assimp_cmd/assimp_cmd.rc | 80 ++++++++++++++------------------- tools/assimp_cmd/resource.h | 21 --------- 6 files changed, 52 insertions(+), 139 deletions(-) delete mode 100644 code/res/resource.h delete mode 100644 tools/assimp_cmd/resource.h diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index cff4d2457..a7c1cb3fb 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -150,7 +150,7 @@ SET( Core_SRCS Common/Assimp.cpp ) -IF(MSVC) +IF(MSVC OR (MINGW AND BUILD_SHARED_LIBS)) list(APPEND Core_SRCS "res/assimp.rc") ENDIF() diff --git a/code/res/assimp.rc b/code/res/assimp.rc index 9ae821b4b..c36d812f8 100644 --- a/code/res/assimp.rc +++ b/code/res/assimp.rc @@ -1,80 +1,37 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" #include "revision.h" +#include "winres.h" -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#define APSTUDIO_HIDDEN_SYMBOLS -#include "windows.h" -#undef APSTUDIO_HIDDEN_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Deutsch (Deutschland) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) -#ifdef _WIN32 -LANGUAGE LANG_GERMAN, SUBLANG_GERMAN +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #pragma code_page(1252) -#endif //_WIN32 - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// VS_VERSION_INFO VERSIONINFO FILEVERSION VER_FILEVERSION PRODUCTVERSION VER_FILEVERSION - FILEFLAGSMASK 0x17L + FILEFLAGSMASK VS_FF_DEBUG #ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L + FILEFLAGS VS_FF_DEBUG #endif - FILEOS 0x4L - FILETYPE 0x7L - FILESUBTYPE 0x0L + FILEOS VOS_NT + FILETYPE VFT_DLL BEGIN BLOCK "StringFileInfo" BEGIN - BLOCK "040704b0" + BLOCK "000004B0" BEGIN VALUE "Comments", "Licensed under a 3-clause BSD license" - VALUE "CompanyName", "assimp team" + VALUE "CompanyName", "ASSIMP Team" VALUE "FileDescription", "Open Asset Import Library" - VALUE "FileVersion", VER_FILEVERSION - VALUE "InternalName", "assimp " - VALUE "LegalCopyright", "Copyright (C) 2006-2020" + VALUE "FileVersion", VER_FILEVERSION_STR + VALUE "InternalName", "assimp" + VALUE "LegalCopyright", VER_COPYRIGHT_STR VALUE "OriginalFilename", VER_ORIGINAL_FILENAME_STR VALUE "ProductName", "Open Asset Import Library" VALUE "ProductVersion", VER_FILEVERSION_STR - ,0 END END BLOCK "VarFileInfo" BEGIN - VALUE "Translation", 0x407, 1200 + VALUE "Translation", 0x0, 65001 END END -#endif // Deutsch (Deutschland) resources -///////////////////////////////////////////////////////////////////////////// - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/code/res/resource.h b/code/res/resource.h deleted file mode 100644 index c28c05073..000000000 --- a/code/res/resource.h +++ /dev/null @@ -1,14 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by assimp.rc - -// Next standard values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/tools/assimp_cmd/CMakeLists.txt b/tools/assimp_cmd/CMakeLists.txt index 6f4b61387..e66a5694d 100644 --- a/tools/assimp_cmd/CMakeLists.txt +++ b/tools/assimp_cmd/CMakeLists.txt @@ -47,16 +47,19 @@ INCLUDE_DIRECTORIES( LINK_DIRECTORIES( ${Assimp_BINARY_DIR} ${Assimp_BINARY_DIR}/lib ) +if(WIN32) + set ( ASSIMP_CMD_RC assimp_cmd.rc) +endif() + ADD_EXECUTABLE( assimp_cmd - assimp_cmd.rc CompareDump.cpp ImageExtractor.cpp Main.cpp Main.h - resource.h WriteDump.cpp Info.cpp Export.cpp + ${ASSIMP_CMD_RC} ) TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp_cmd) diff --git a/tools/assimp_cmd/assimp_cmd.rc b/tools/assimp_cmd/assimp_cmd.rc index e67100698..94572b7e0 100644 --- a/tools/assimp_cmd/assimp_cmd.rc +++ b/tools/assimp_cmd/assimp_cmd.rc @@ -1,51 +1,39 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" -#include "../../revision.h" +#include "revision.h" +#include "winres.h" -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#define APSTUDIO_HIDDEN_SYMBOLS -#include "windows.h" -#undef APSTUDIO_HIDDEN_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Deutsch (Deutschland) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) -#ifdef _WIN32 -LANGUAGE LANG_GERMAN, SUBLANG_GERMAN +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) -#endif //_WIN32 -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// +IDI_ASSIMP_CMD ICON "../shared/assimp_tools_icon.ico" -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_ASSIMP_VIEW ICON "../shared/assimp_tools_icon.ico" - - - - - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED +VS_VERSION_INFO VERSIONINFO + FILEVERSION VER_FILEVERSION + PRODUCTVERSION VER_FILEVERSION + FILEFLAGSMASK VS_FF_DEBUG +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG #endif + FILEOS VOS_NT + FILETYPE VFT_APP +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "Comments", "Licensed under a 3-clause BSD license" + VALUE "CompanyName", "ASSIMP Team" + VALUE "FileDescription", "ASSIMP CMD Application" + VALUE "FileVersion", VER_FILEVERSION_STR + VALUE "InternalName", "assimp" + VALUE "LegalCopyright", VER_COPYRIGHT_STR + VALUE "OriginalFilename", "assimp.exe" + VALUE "ProductName", "ASSIMP CMD Application" + VALUE "ProductVersion", VER_FILEVERSION_STR + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 65001 + END +END + diff --git a/tools/assimp_cmd/resource.h b/tools/assimp_cmd/resource.h deleted file mode 100644 index caf3a0a69..000000000 --- a/tools/assimp_cmd/resource.h +++ /dev/null @@ -1,21 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by assimp_view.rc -// -#define IDC_MYICON 2 -#define IDD_ASSIMP_VIEW_DIALOG 102 -#define IDD_ABOUTBOX 103 -#define IDI_ASSIMP_VIEW 107 - - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 159 -#define _APS_NEXT_COMMAND_VALUE 32831 -#define _APS_NEXT_CONTROL_VALUE 1052 -#define _APS_NEXT_SYMED_VALUE 110 -#endif -#endif From 694dc8a0c3fe42d20d9503c516b97a2a80148a28 Mon Sep 17 00:00:00 2001 From: "U-DESKTOP-0R560PH\\George" Date: Sat, 30 Apr 2022 08:08:34 -0700 Subject: [PATCH 14/29] Add an option to treat warnings as errors --- Build.md | 3 ++- CMakeLists.txt | 28 ++++++++++++++++++++++------ code/CMakeLists.txt | 7 ------- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/Build.md b/Build.md index b4d1bdad0..7445e1bce 100644 --- a/Build.md +++ b/Build.md @@ -95,7 +95,8 @@ The cmake-build-environment provides options to configure the build. The followi - **ASSIMP_BUILD_SAMPLES ( default OFF )**: If the official samples are built as well (needs Glut). - **ASSIMP_BUILD_TESTS ( default ON )**: If the test suite for Assimp is built in addition to the library. - **ASSIMP_COVERALLS ( default OFF )**: Enable this to measure test coverage. -- **ASSIMP_ERROR_MAX( default OFF)**: Enable all warnings. +- **ASSIMP_WARNINGS_AS_ERRORS( default OFF)**: Treat all warnings as errors. +- **ASSIMP_WARNINGS_MAX( default OFF)**: Enable all warnings. - **ASSIMP_WERROR( default OFF )**: Treat warnings as errors. - **ASSIMP_ASAN ( default OFF )**: Enable AddressSanitizer. - **ASSIMP_UBSAN ( default OFF )**: Enable Undefined Behavior sanitizer. diff --git a/CMakeLists.txt b/CMakeLists.txt index 072803fda..711a05b2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,7 +108,11 @@ OPTION( ASSIMP_INSTALL "Disable this if you want to use assimp as a submodule." ON ) -OPTION ( ASSIMP_ERROR_MAX +OPTION ( ASSIMP_WARNINGS_AS_ERRORS + "Treat all warnings as errors." + OFF +) +OPTION ( ASSIMP_WARNINGS_MAX "Enable all warnings." OFF ) @@ -146,12 +150,10 @@ IF (WIN32) # Multibyte character set is deprecated since at least MSVC2015 (possibly earlier) ADD_DEFINITIONS( -DUNICODE -D_UNICODE ) ENDIF() - # Link statically against c/c++ lib to avoid missing redistriburable such as # "VCRUNTIME140.dll not found. Try reinstalling the app.", but give users # a choice to opt for the shared runtime if they want. option(USE_STATIC_CRT "Link against the static runtime libraries." OFF) - # The CMAKE_CXX_FLAGS vars can be overriden by some Visual Studio generators, so we use an alternative # global method here: if (${USE_STATIC_CRT}) @@ -324,13 +326,26 @@ IF (ASSIMP_COVERALLS) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") ENDIF() -IF (ASSIMP_ERROR_MAX) +IF (ASSIMP_WARNINGS_AS_ERRORS) + MESSAGE(STATUS "Treating all warnings as errors (for assimp library only)") + set(ASSIMP_ERROR_MAX ON) + IF (MSVC) + # TARGET_COMPILE_OPTIONS(assimp PRIVATE /WX) + # TARGET_COMPILE_OPTIONS(assimp_cmd PRIVATE /WX) + ADD_COMPILE_OPTIONS(/WX) + ELSE() + # TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror) + # TARGET_COMPILE_OPTIONS(assimp_cmd PRIVATE -Werror) + ADD_COMPILE_OPTIONS(-Werror) + ENDIF() +ENDIF() + +IF (ASSIMP_WARNINGS_MAX) MESSAGE(STATUS "Turning on all warnings") IF (MSVC) ADD_COMPILE_OPTIONS(/W4) # NB: there is a /Wall option, pedantic mode ELSE() - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") + ADD_COMPILE_OPTIONS(-Wall) ENDIF() ENDIF() @@ -694,6 +709,7 @@ ENDIF() # Main assimp code ADD_SUBDIRECTORY( code/ ) + IF ( ASSIMP_BUILD_ASSIMP_TOOLS ) # The viewer for windows only IF (WIN32) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index cff4d2457..5336392cc 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -1179,13 +1179,6 @@ ADD_LIBRARY(assimp::assimp ALIAS assimp) TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp) -# enable warnings as errors ######################################## -IF (MSVC) - TARGET_COMPILE_OPTIONS(assimp PRIVATE /WX) -ELSE() - TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror) -ENDIF() - # adds C_FLAGS required to compile zip.c on old GCC 4.x compiler TARGET_COMPILE_FEATURES(assimp PRIVATE c_std_99) From 63183a048ce761248c25aec33675cce5d4077b7b Mon Sep 17 00:00:00 2001 From: "U-DESKTOP-0R560PH\\George" Date: Sat, 30 Apr 2022 08:10:47 -0700 Subject: [PATCH 15/29] Minor updates to ASSIMP Viewer --- tools/assimp_view/CMakeLists.txt | 2 +- tools/assimp_view/MessageProc.cpp | 10 +++---- tools/assimp_view/assimp_view.rc | 45 +++++++++++++++---------------- tools/assimp_view/resource.h | 2 +- 4 files changed, 29 insertions(+), 30 deletions(-) diff --git a/tools/assimp_view/CMakeLists.txt b/tools/assimp_view/CMakeLists.txt index 925c87848..25304f407 100644 --- a/tools/assimp_view/CMakeLists.txt +++ b/tools/assimp_view/CMakeLists.txt @@ -96,7 +96,7 @@ IF ( MSVC ) ENDIF () # Link the executable to the assimp + dx libs. -TARGET_LINK_LIBRARIES ( assimp_viewer assimp ${DirectX_LIBRARY} ${DirectX_D3DX9_LIBRARY} comctl32.lib winmm.lib ) +TARGET_LINK_LIBRARIES ( assimp_viewer assimp ${DirectX_LIBRARY} ${DirectX_D3DX9_LIBRARY} comctl32 winmm ) INSTALL( TARGETS assimp_viewer DESTINATION "${ASSIMP_BIN_INSTALL_DIR}" COMPONENT assimp-dev diff --git a/tools/assimp_view/MessageProc.cpp b/tools/assimp_view/MessageProc.cpp index e51c8292c..3107d42f6 100644 --- a/tools/assimp_view/MessageProc.cpp +++ b/tools/assimp_view/MessageProc.cpp @@ -1710,13 +1710,13 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg, WPARAM wParam,LPARAM lParam } else if (ID_TOOLS_LOGWINDOW == LOWORD(wParam)) { CLogWindow::Instance().Show(); } else if (ID__WEBSITE == LOWORD(wParam)) { - ShellExecute(nullptr,"open","http://assimp.sourceforge.net","","",SW_SHOW); - } else if (ID__WEBSITESF == LOWORD(wParam)) { - ShellExecute(nullptr,"open","https://sourceforge.net/projects/assimp","","",SW_SHOW); + ShellExecute(nullptr,"open","http://assimp.org","","",SW_SHOW); + } else if (ID__WEBSITEGH == LOWORD(wParam)) { + ShellExecute(nullptr,"open","https://github.com/assimp/assimp","","",SW_SHOW); } else if (ID_REPORTBUG == LOWORD(wParam)) { - ShellExecute(nullptr,"open","https://sourceforge.net/tracker/?func=add&group_id=226462&atid=1067632","","",SW_SHOW); + ShellExecute(nullptr,"open","https://github.com/assimp/assimp/issues/new?assignees=&labels=Bug&template=bug_report.md&title=Bug%3A","","",SW_SHOW); } else if (ID_FR == LOWORD(wParam)) { - ShellExecute(nullptr,"open","https://sourceforge.net/forum/forum.php?forum_id=817653","","",SW_SHOW); + ShellExecute(nullptr,"open","https://github.com/assimp/assimp/issues/new?assignees=&labels=Feature-Request&template=feature_request.md","","",SW_SHOW); } else if (ID_TOOLS_CLEARLOG == LOWORD(wParam)) { CLogWindow::Instance().Clear(); } else if (ID_TOOLS_SAVELOGTOFILE == LOWORD(wParam)) { diff --git a/tools/assimp_view/assimp_view.rc b/tools/assimp_view/assimp_view.rc index 48d7c3697..f1327130c 100644 --- a/tools/assimp_view/assimp_view.rc +++ b/tools/assimp_view/assimp_view.rc @@ -1,6 +1,7 @@ // Microsoft Visual C++ generated resource script. // #include "resource.h" +#include "revision.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// @@ -15,10 +16,10 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// Deutsch (Deutschland) resources +// English (U.S.) resources -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) -LANGUAGE LANG_GERMAN, SUBLANG_GERMAN +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) ///////////////////////////////////////////////////////////////////////////// @@ -187,35 +188,33 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,1,700,0 - PRODUCTVERSION 1,1,700,1 - FILEFLAGSMASK 0x17L + FILEVERSION VER_FILEVERSION + PRODUCTVERSION VER_FILEVERSION + FILEFLAGSMASK VS_FF_DEBUG #ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L + FILEFLAGS VS_FF_DEBUG #endif - FILEOS 0x4L - FILETYPE 0x0L - FILESUBTYPE 0x0L + FILEOS VOS_NT + FILETYPE VFT_APP BEGIN BLOCK "StringFileInfo" BEGIN - BLOCK "040704b0" + BLOCK "040904B0" BEGIN - VALUE "CompanyName", "assimp team" + VALUE "Comments", "Licensed under a 3-clause BSD license" + VALUE "CompanyName", "ASSIMP Team" VALUE "FileDescription", "ASSIMP Viewer Application" - VALUE "FileVersion", "1, 1, SVNRevision, 0" + VALUE "FileVersion", VER_FILEVERSION_STR VALUE "InternalName", "assimp_view" - VALUE "LegalCopyright", "Licensed under the LGPL" - VALUE "OriginalFilename", "assimpview32.exe" + VALUE "LegalCopyright", VER_COPYRIGHT_STR + VALUE "OriginalFilename", "assimp_viewer.exe" VALUE "ProductName", "ASSIMP Viewer Application" - VALUE "ProductVersion", "1, 1, SVNRevision, 0" + VALUE "ProductVersion", VER_FILEVERSION_STR END END BLOCK "VarFileInfo" BEGIN - VALUE "Translation", 0x407, 1200 + VALUE "Translation", 0x409, 65001 END END @@ -380,15 +379,15 @@ BEGIN BEGIN POPUP "Feedback" BEGIN - MENUITEM "Report bug", ID_REPORTBUG - MENUITEM "Feature request/discuss", ID_FR + MENUITEM "Report bug", ID_REPORTBUG + MENUITEM "Feature request", ID_FR END MENUITEM "Help", ID__HELP MENUITEM SEPARATOR MENUITEM "About", ID__ABOUT MENUITEM SEPARATOR MENUITEM "Website", ID__WEBSITE - MENUITEM "SF.net Project Page", ID__WEBSITESF + MENUITEM "GitHub Repository", ID__WEBSITEGH END END @@ -451,7 +450,7 @@ IDR_HUD RCDATA "HUD.png" IDR_HUDMASK RCDATA "HUDMask.png" -#endif // Deutsch (Deutschland) resources +#endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/tools/assimp_view/resource.h b/tools/assimp_view/resource.h index 754eb69bd..ab8ebc8ed 100644 --- a/tools/assimp_view/resource.h +++ b/tools/assimp_view/resource.h @@ -209,7 +209,7 @@ #define ID__WEBSITE 32867 #define ID__SF 32868 #define ID__ 32869 -#define ID__WEBSITESF 32870 +#define ID__WEBSITEGH 32870 #define ID_IMPORTSETTINGS_CALCULATETANGENTSPACE 32871 #define ID_VIEWER_CTS 32872 #define ID_VIEWER_PP_CTS 32873 From a7e2b3ad30f60ac9186a1b65db6f7dc2603deeec Mon Sep 17 00:00:00 2001 From: "U-DESKTOP-0R560PH\\George" Date: Sat, 30 Apr 2022 08:14:16 -0700 Subject: [PATCH 16/29] Fixed library names for MinGW/MSYS2 --- code/CMakeLists.txt | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index cff4d2457..16b5ece4d 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -1266,6 +1266,16 @@ if( MSVC ) set(LIBRARY_SUFFIX "${ASSIMP_LIBRARY_SUFFIX}-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library") endif() +if (MINGW) + set(LIBRARY_SUFFIX "-${ASSIMP_SOVERSION}" CACHE STRING "the suffix for the assimp MinGW shared library") + SET_TARGET_PROPERTIES( assimp PROPERTIES + ARCHIVE_OUTPUT_NAME assimp + ) + if (NOT BUILD_SHARED_LIBS) + TARGET_LINK_LIBRARIES ( assimp -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lwinpthread ) # winpthread is for libminizip. + endif () +endif() + if (${CMAKE_SYSTEM_NAME} MATCHES "WindowsStore") target_compile_definitions(assimp PUBLIC WindowsStore) TARGET_LINK_LIBRARIES(assimp advapi32) @@ -1277,19 +1287,6 @@ SET_TARGET_PROPERTIES( assimp PROPERTIES OUTPUT_NAME assimp${LIBRARY_SUFFIX} ) -if (MINGW) - if (BUILD_SHARED_LIBS) - set_target_properties(assimp PROPERTIES - SUFFIX "-${ASSIMP_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - if (NOT DEFINED ${LIBRARY_SUFFIX}) #Added as a guard for subsequent runs, but seems to not work when cache is outdated - set(LIBRARY_SUFFIX "-${ASSIMP_SOVERSION}" CACHE STRING "the suffix for the assimp MinGW shared library") - endif() - else () - TARGET_LINK_LIBRARIES ( assimp -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lwinpthread ) # winpthread is for libminizip. - endif () -endif() - if (APPLE) if (ASSIMP_BUILD_FRAMEWORK) SET_TARGET_PROPERTIES( assimp PROPERTIES From bf32c4c40844a648ed0bbd3de618ca64a5d428d1 Mon Sep 17 00:00:00 2001 From: hgdagon Date: Sat, 30 Apr 2022 08:40:48 -0700 Subject: [PATCH 17/29] Fixed `ASSIMP_WARNINGS_MAX` reference --- CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 711a05b2b..4ebf53d38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,10 +150,12 @@ IF (WIN32) # Multibyte character set is deprecated since at least MSVC2015 (possibly earlier) ADD_DEFINITIONS( -DUNICODE -D_UNICODE ) ENDIF() + # Link statically against c/c++ lib to avoid missing redistriburable such as # "VCRUNTIME140.dll not found. Try reinstalling the app.", but give users # a choice to opt for the shared runtime if they want. option(USE_STATIC_CRT "Link against the static runtime libraries." OFF) + # The CMAKE_CXX_FLAGS vars can be overriden by some Visual Studio generators, so we use an alternative # global method here: if (${USE_STATIC_CRT}) @@ -328,15 +330,13 @@ ENDIF() IF (ASSIMP_WARNINGS_AS_ERRORS) MESSAGE(STATUS "Treating all warnings as errors (for assimp library only)") - set(ASSIMP_ERROR_MAX ON) + set(ASSIMP_WARNINGS_MAX ON) IF (MSVC) - # TARGET_COMPILE_OPTIONS(assimp PRIVATE /WX) - # TARGET_COMPILE_OPTIONS(assimp_cmd PRIVATE /WX) - ADD_COMPILE_OPTIONS(/WX) + TARGET_COMPILE_OPTIONS(assimp PRIVATE /WX) + # ADD_COMPILE_OPTIONS(/WX) ELSE() - # TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror) - # TARGET_COMPILE_OPTIONS(assimp_cmd PRIVATE -Werror) - ADD_COMPILE_OPTIONS(-Werror) + TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror) + # ADD_COMPILE_OPTIONS(-Werror) ENDIF() ENDIF() From 1d3d5c4bb6d855a6847d218ec151eb08889e0386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Sun, 1 May 2022 13:27:42 +0200 Subject: [PATCH 18/29] Rename TextureTypeToString() to aiTextureTypeToString() Closes: https://github.com/assimp/assimp/issues/4493 --- code/AssetLib/Assxml/AssxmlFileWriter.cpp | 2 +- code/Common/material.cpp | 2 +- code/Pbrt/PbrtExporter.cpp | 2 +- code/PostProcessing/ComputeUVMappingProcess.cpp | 2 +- code/PostProcessing/ValidateDataStructure.cpp | 2 +- include/assimp/material.h | 2 +- tools/assimp_cmd/Info.cpp | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/code/AssetLib/Assxml/AssxmlFileWriter.cpp b/code/AssetLib/Assxml/AssxmlFileWriter.cpp index 640890ea1..a443e3fe9 100644 --- a/code/AssetLib/Assxml/AssxmlFileWriter.cpp +++ b/code/AssetLib/Assxml/AssxmlFileWriter.cpp @@ -365,7 +365,7 @@ static void WriteDump(const char *pFile, const char *cmd, const aiScene *scene, ioprintf(io, "\t\t\tmKey.data, sz, - ::TextureTypeToString((aiTextureType)prop->mSemantic), prop->mIndex); + ::aiTextureTypeToString((aiTextureType)prop->mSemantic), prop->mIndex); if (prop->mType == aiPTI_Float) { ioprintf(io, " size=\"%i\">\n\t\t\t\t", diff --git a/code/Common/material.cpp b/code/Common/material.cpp index a7541d4f1..ffc2f415b 100644 --- a/code/Common/material.cpp +++ b/code/Common/material.cpp @@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include // ------------------------------------------------------------------------------- -const char *TextureTypeToString(aiTextureType in) { +const char *aiTextureTypeToString(aiTextureType in) { switch (in) { case aiTextureType_NONE: return "n/a"; diff --git a/code/Pbrt/PbrtExporter.cpp b/code/Pbrt/PbrtExporter.cpp index 25061f517..9590c4954 100644 --- a/code/Pbrt/PbrtExporter.cpp +++ b/code/Pbrt/PbrtExporter.cpp @@ -590,7 +590,7 @@ void PbrtExporter::WriteMaterial(int m) { for (int i = 1; i <= aiTextureType_UNKNOWN; i++) { int count = material->GetTextureCount(aiTextureType(i)); if (count > 0) - mOutput << TextureTypeToString(aiTextureType(i)) << ": " << count << " "; + mOutput << aiTextureTypeToString(aiTextureType(i)) << ": " << count << " "; } mOutput << "\n"; diff --git a/code/PostProcessing/ComputeUVMappingProcess.cpp b/code/PostProcessing/ComputeUVMappingProcess.cpp index c7456cc9d..ec8783041 100644 --- a/code/PostProcessing/ComputeUVMappingProcess.cpp +++ b/code/PostProcessing/ComputeUVMappingProcess.cpp @@ -415,7 +415,7 @@ void ComputeUVMappingProcess::Execute( aiScene* pScene) if (!DefaultLogger::isNullLogger()) { ai_snprintf(buffer, 1024, "Found non-UV mapped texture (%s,%u). Mapping type: %s", - TextureTypeToString((aiTextureType)prop->mSemantic),prop->mIndex, + aiTextureTypeToString((aiTextureType)prop->mSemantic),prop->mIndex, MappingTypeToString(mapping)); ASSIMP_LOG_INFO(buffer); diff --git a/code/PostProcessing/ValidateDataStructure.cpp b/code/PostProcessing/ValidateDataStructure.cpp index e99f6a6e3..ebcfbbf5a 100644 --- a/code/PostProcessing/ValidateDataStructure.cpp +++ b/code/PostProcessing/ValidateDataStructure.cpp @@ -521,7 +521,7 @@ void ValidateDSProcess::Validate(const aiAnimation *pAnimation) { // ------------------------------------------------------------------------------------------------ void ValidateDSProcess::SearchForInvalidTextures(const aiMaterial *pMaterial, aiTextureType type) { - const char *szType = TextureTypeToString(type); + const char *szType = aiTextureTypeToString(type); // **************************************************************************** // Search all keys of the material ... diff --git a/include/assimp/material.h b/include/assimp/material.h index 2ccd83763..0052888d1 100644 --- a/include/assimp/material.h +++ b/include/assimp/material.h @@ -335,7 +335,7 @@ enum aiTextureType { // ------------------------------------------------------------------------------- // Get a string for a given aiTextureType -ASSIMP_API const char *TextureTypeToString(enum aiTextureType in); +ASSIMP_API const char *aiTextureTypeToString(enum aiTextureType in); // --------------------------------------------------------------------------- /** @brief Defines all shading models supported by the library diff --git a/tools/assimp_cmd/Info.cpp b/tools/assimp_cmd/Info.cpp index 3e83b88bb..4703713c8 100644 --- a/tools/assimp_cmd/Info.cpp +++ b/tools/assimp_cmd/Info.cpp @@ -441,7 +441,7 @@ int Assimp_Info(const char *const *params, unsigned int num) { prop->mKey.data, prop->mIndex, prop->mDataLength, - TextureTypeToString(textype)); + aiTextureTypeToString(textype)); } } if (scene->mNumMaterials) { From bfb46ca5ef0d4467143031e8c8bcec558d50faaf Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 3 May 2022 17:16:25 +0200 Subject: [PATCH 19/29] Fix protocol type. --- tools/assimp_view/MessageProc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/assimp_view/MessageProc.cpp b/tools/assimp_view/MessageProc.cpp index 3107d42f6..aea65a8d5 100644 --- a/tools/assimp_view/MessageProc.cpp +++ b/tools/assimp_view/MessageProc.cpp @@ -1710,7 +1710,7 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg, WPARAM wParam,LPARAM lParam } else if (ID_TOOLS_LOGWINDOW == LOWORD(wParam)) { CLogWindow::Instance().Show(); } else if (ID__WEBSITE == LOWORD(wParam)) { - ShellExecute(nullptr,"open","http://assimp.org","","",SW_SHOW); + ShellExecute(nullptr,"open","https://assimp.org","","",SW_SHOW); } else if (ID__WEBSITEGH == LOWORD(wParam)) { ShellExecute(nullptr,"open","https://github.com/assimp/assimp","","",SW_SHOW); } else if (ID_REPORTBUG == LOWORD(wParam)) { From 209c302f560cdc9be01d9d73446104035ea46e7a Mon Sep 17 00:00:00 2001 From: hgdagon Date: Tue, 3 May 2022 12:23:33 -0700 Subject: [PATCH 20/29] Merged `ASSIMP_WARNINGS_AS_ERRORS` and `ASSIMP_WARNINGS_MAX` And set it ON by default. --- CMakeLists.txt | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ebf53d38..cc8bfe3f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,10 +112,6 @@ OPTION ( ASSIMP_WARNINGS_AS_ERRORS "Treat all warnings as errors." OFF ) -OPTION ( ASSIMP_WARNINGS_MAX - "Enable all warnings." - OFF -) OPTION ( ASSIMP_ASAN "Enable AddressSanitizer." OFF @@ -330,22 +326,12 @@ ENDIF() IF (ASSIMP_WARNINGS_AS_ERRORS) MESSAGE(STATUS "Treating all warnings as errors (for assimp library only)") - set(ASSIMP_WARNINGS_MAX ON) IF (MSVC) - TARGET_COMPILE_OPTIONS(assimp PRIVATE /WX) - # ADD_COMPILE_OPTIONS(/WX) + TARGET_COMPILE_OPTIONS(assimp PRIVATE /W4 /WX) + # ADD_COMPILE_OPTIONS(/W4 /WX) ELSE() - TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror) - # ADD_COMPILE_OPTIONS(-Werror) - ENDIF() -ENDIF() - -IF (ASSIMP_WARNINGS_MAX) - MESSAGE(STATUS "Turning on all warnings") - IF (MSVC) - ADD_COMPILE_OPTIONS(/W4) # NB: there is a /Wall option, pedantic mode - ELSE() - ADD_COMPILE_OPTIONS(-Wall) + TARGET_COMPILE_OPTIONS(assimp PRIVATE -Wall -Werror) + # ADD_COMPILE_OPTIONS(-Wall -Werror) ENDIF() ENDIF() From 4faae3d0e9ec8c9195f1d18475cf746b89164eb8 Mon Sep 17 00:00:00 2001 From: hgdagon Date: Tue, 3 May 2022 12:24:34 -0700 Subject: [PATCH 21/29] Updated build options in Build.md --- Build.md | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/Build.md b/Build.md index 7445e1bce..d6abe7b67 100644 --- a/Build.md +++ b/Build.md @@ -84,24 +84,28 @@ Besides the toolchain, compilation should be the same as for Linux / Unix. ### CMake build options The cmake-build-environment provides options to configure the build. The following options can be used: -- **BUILD_SHARED_LIBS ( default ON )**: Generation of shared libs ( dll for windows, so for Linux ). Set this to OFF to get a static lib. -- **BUILD_FRAMEWORK ( default OFF, MacOnly)**: Build package as Mac OS X Framework bundle -- **ASSIMP_DOUBLE_PRECISION( default OFF )**: All data will be stored as double values. -- **ASSIMP_OPT_BUILD_PACKAGES ( default OFF)**: Set to ON to generate CPack configuration files and packaging targets -- **ASSIMP_ANDROID_JNIIOSYSTEM ( default OFF )**: Android JNI IOSystem support is active -- **ASSIMP_NO_EXPORT ( default OFF )**: Disable Assimp's export functionality -- **ASSIMP_BUILD_ZLIB ( default OFF )**: Build your own zlib -- **ASSIMP_BUILD_ASSIMP_TOOLS ( default ON )**: If the supplementary tools for Assimp are built in addition to the library. -- **ASSIMP_BUILD_SAMPLES ( default OFF )**: If the official samples are built as well (needs Glut). -- **ASSIMP_BUILD_TESTS ( default ON )**: If the test suite for Assimp is built in addition to the library. -- **ASSIMP_COVERALLS ( default OFF )**: Enable this to measure test coverage. -- **ASSIMP_WARNINGS_AS_ERRORS( default OFF)**: Treat all warnings as errors. -- **ASSIMP_WARNINGS_MAX( default OFF)**: Enable all warnings. -- **ASSIMP_WERROR( default OFF )**: Treat warnings as errors. -- **ASSIMP_ASAN ( default OFF )**: Enable AddressSanitizer. -- **ASSIMP_UBSAN ( default OFF )**: Enable Undefined Behavior sanitizer. -- **SYSTEM_IRRXML ( default OFF )**: Use system installed Irrlicht/IrrXML library. -- **BUILD_DOCS ( default OFF )**: Build documentation using Doxygen. -- **INJECT_DEBUG_POSTFIX( default ON )**: Inject debug postfix in .a/.so lib names -- **IGNORE_GIT_HASH ( default OFF )**: Don't call git to get the hash. -- **ASSIMP_INSTALL_PDB ( default ON )**: Install MSVC debug files. +- **ASSIMP_HUNTER_ENABLED (default OFF)**: Enable Hunter package manager support. +- **BUILD_SHARED_LIBS (default ON)**: Generation of shared libs (dll for windows, so for Linux). Set this to OFF to get a static lib. +- **ASSIMP_BUILD_FRAMEWORK (default OFF, MacOnly)**: Build package as Mac OS X Framework bundle. +- **ASSIMP_DOUBLE_PRECISION (default OFF)**: All data will be stored as double values. +- **ASSIMP_OPT_BUILD_PACKAGES (default OFF)**: Set to ON to generate CPack configuration files and packaging targets. +- **ASSIMP_ANDROID_JNIIOSYSTEM (default OFF)**: Android JNI IOSystem support is active. +- **ASSIMP_NO_EXPORT (default OFF)**: Disable Assimp's export functionality. +- **ASSIMP_BUILD_ZLIB (default OFF)**: Build our own zlib. +- **ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT (default ON)**: Build Assimp with all exporter senabled. +- **ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT (default ON)**: Build Assimp with all importer senabled. +- **ASSIMP_BUILD_ASSIMP_TOOLS (default ON)**: If the supplementary tools for Assimp are built in addition to the library. +- **ASSIMP_BUILD_SAMPLES (default OFF)**: If the official samples are built as well (needs Glut). +- **ASSIMP_BUILD_TESTS (default ON)**: If the test suite for Assimp is built in addition to the library. +- **ASSIMP_COVERALLS (default OFF)**: Enable this to measure test coverage. +- **ASSIMP_INSTALL (default ON)**: Install Assimp library. Disable this if you want to use Assimp as a submodule. +- **ASSIMP_WARNINGS_AS_ERRORS (default ON)**: Treat all warnings as errors. +- **ASSIMP_ASAN (default OFF)**: Enable AddressSanitizer. +- **ASSIMP_UBSAN (default OFF)**: Enable Undefined Behavior sanitizer. +- **ASSIMP_BUILD_DOCS (default OFF)**: Build documentation using Doxygen. OBSOLETE, see https://github.com/assimp/assimp-docs +- **ASSIMP_INJECT_DEBUG_POSTFIX (default ON)**: Inject debug postfix in .a/.so/.lib/.dll lib names +- **ASSIMP_IGNORE_GIT_HASH (default OFF)**: Don't call git to get the hash. +- **ASSIMP_INSTALL_PDB (default ON)**: Install MSVC debug files. +- **USE_STATIC_CRT (default OFF)**: Link against the static MSVC runtime libraries. +- **ASSIMP_BUILD_DRACO (default OFF)**: Build Draco libraries. Primarily for glTF. +- **ASSIMP_BUILD_ASSIMP_VIEW (default ON, if DirectX found, OFF otherwise)**: Build Assimp view tool (requires DirectX). From 18bfbaeee12660ee2d3377f1fa18aacd7221c4b0 Mon Sep 17 00:00:00 2001 From: hgdagon Date: Tue, 3 May 2022 12:31:09 -0700 Subject: [PATCH 22/29] Actually set `ASSIMP_WARNINGS_AS_ERRORS` to ON by default Whoops.... --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc8bfe3f1..8800820c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,7 +110,7 @@ OPTION( ASSIMP_INSTALL ) OPTION ( ASSIMP_WARNINGS_AS_ERRORS "Treat all warnings as errors." - OFF + ON ) OPTION ( ASSIMP_ASAN "Enable AddressSanitizer." From e1f0f5001050c34f6f495f2dc97e531a44d8065b Mon Sep 17 00:00:00 2001 From: hgdagon Date: Tue, 3 May 2022 12:57:45 -0700 Subject: [PATCH 23/29] Update CMakeLists.txt --- CMakeLists.txt | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8800820c5..2aa66421c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -324,17 +324,6 @@ IF (ASSIMP_COVERALLS) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") ENDIF() -IF (ASSIMP_WARNINGS_AS_ERRORS) - MESSAGE(STATUS "Treating all warnings as errors (for assimp library only)") - IF (MSVC) - TARGET_COMPILE_OPTIONS(assimp PRIVATE /W4 /WX) - # ADD_COMPILE_OPTIONS(/W4 /WX) - ELSE() - TARGET_COMPILE_OPTIONS(assimp PRIVATE -Wall -Werror) - # ADD_COMPILE_OPTIONS(-Wall -Werror) - ENDIF() -ENDIF() - IF (ASSIMP_ASAN) MESSAGE(STATUS "AddressSanitizer enabled") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") From 936cc791f2cd7b4f88dda36d8b6365277a9e718d Mon Sep 17 00:00:00 2001 From: hgdagon Date: Tue, 3 May 2022 13:01:20 -0700 Subject: [PATCH 24/29] Move `ASSIMP_WARNINGS_AS_ERRORS` check --- code/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index e30a2cd0a..d2488d6f2 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -1179,6 +1179,15 @@ ADD_LIBRARY(assimp::assimp ALIAS assimp) TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp) +IF (ASSIMP_WARNINGS_AS_ERRORS) + MESSAGE(STATUS "Treating all warnings as errors (for assimp library only)") + IF (MSVC) + TARGET_COMPILE_OPTIONS(assimp PRIVATE /W4 /WX) + ELSE() + TARGET_COMPILE_OPTIONS(assimp PRIVATE -Wall -Werror) + ENDIF() +ENDIF() + # adds C_FLAGS required to compile zip.c on old GCC 4.x compiler TARGET_COMPILE_FEATURES(assimp PRIVATE c_std_99) From 26ab3ce480854eafb431c2d500fd524b35b930d2 Mon Sep 17 00:00:00 2001 From: hgdagon Date: Tue, 3 May 2022 14:16:51 -0700 Subject: [PATCH 25/29] Update assimp_view.rc Removed dead link and updated copyright string in the About dialog. --- tools/assimp_view/assimp_view.rc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/assimp_view/assimp_view.rc b/tools/assimp_view/assimp_view.rc index f1327130c..3bcf66582 100644 --- a/tools/assimp_view/assimp_view.rc +++ b/tools/assimp_view/assimp_view.rc @@ -44,9 +44,9 @@ FONT 9, "Courier New", 400, 0, 0x0 BEGIN LTEXT "Open Asset Import Library (Assimp)",IDC_STATIC,30,14,144,9 LTEXT "A free C/C++ library to read various well-known 3D model formats into a straightforward in-memory format for easy processing by applications. Licensed under a 3-clause BSD license and totally awesome.",IDC_STATIC,31,34,204,24 - LTEXT "(c) 2008-2020. Assimp Development Team. See the CREDITS file for a list of all contributors.",IDC_STATIC,30,65,204,23 + LTEXT VER_COPYRIGHT_STR ". Assimp Development Team. See the CREDITS file for a list of all contributors.",IDC_STATIC,30,65,204,23 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,27,282,1 - LTEXT "http://assimp.sourceforge.net http://www.zfx.info",IDC_STATIC,31,101,127,22 + LTEXT "https://assimp.org",IDC_STATIC,31,101,127,22 DEFPUSHBUTTON "Love this library",IDOK,186,110,84,14 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,148,283,1 CONTROL IDB_BITMAP1,IDC_STATIC,"Static",SS_BITMAP,0,129,514,20 From 1c2caec2bdfd07df1be0efe071785149908f3cb6 Mon Sep 17 00:00:00 2001 From: hgdagon Date: Tue, 3 May 2022 14:45:24 -0700 Subject: [PATCH 26/29] Reverted copyright text back to static text Windres handles it just fine, with the intended result, but RC doesn't seem to like it. --- tools/assimp_view/assimp_view.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/assimp_view/assimp_view.rc b/tools/assimp_view/assimp_view.rc index 3bcf66582..8575df1ff 100644 --- a/tools/assimp_view/assimp_view.rc +++ b/tools/assimp_view/assimp_view.rc @@ -44,7 +44,7 @@ FONT 9, "Courier New", 400, 0, 0x0 BEGIN LTEXT "Open Asset Import Library (Assimp)",IDC_STATIC,30,14,144,9 LTEXT "A free C/C++ library to read various well-known 3D model formats into a straightforward in-memory format for easy processing by applications. Licensed under a 3-clause BSD license and totally awesome.",IDC_STATIC,31,34,204,24 - LTEXT VER_COPYRIGHT_STR ". Assimp Development Team. See the CREDITS file for a list of all contributors.",IDC_STATIC,30,65,204,23 + LTEXT "\xA9 2008-2022. Assimp Development Team. See the CREDITS file for a list of all contributors.",IDC_STATIC,30,65,204,23 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,27,282,1 LTEXT "https://assimp.org",IDC_STATIC,31,101,127,22 DEFPUSHBUTTON "Love this library",IDOK,186,110,84,14 From 7bda8b7a7702ac14779e0e720fdc312ff9da7ec5 Mon Sep 17 00:00:00 2001 From: ALittleStardust Date: Fri, 6 May 2022 13:39:05 +0700 Subject: [PATCH 27/29] Updated pugixml to version 1.12.1 --- contrib/pugixml/contrib/foreach.hpp | 63 ----------------------------- contrib/pugixml/readme.txt | 6 +-- contrib/pugixml/src/pugiconfig.hpp | 6 +-- contrib/pugixml/src/pugixml.cpp | 45 ++++++++++++--------- contrib/pugixml/src/pugixml.hpp | 24 ++++++----- 5 files changed, 46 insertions(+), 98 deletions(-) delete mode 100644 contrib/pugixml/contrib/foreach.hpp diff --git a/contrib/pugixml/contrib/foreach.hpp b/contrib/pugixml/contrib/foreach.hpp deleted file mode 100644 index c42315194..000000000 --- a/contrib/pugixml/contrib/foreach.hpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Boost.Foreach support for pugixml classes. - * This file is provided to the public domain. - * Written by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) - */ - -#ifndef HEADER_PUGIXML_FOREACH_HPP -#define HEADER_PUGIXML_FOREACH_HPP - -#include - -#include "pugixml.hpp" - -/* - * These types add support for BOOST_FOREACH macro to xml_node and xml_document classes (child iteration only). - * Example usage: - * BOOST_FOREACH(xml_node n, doc) {} - */ - -namespace boost -{ - template<> struct range_mutable_iterator - { - typedef pugi::xml_node::iterator type; - }; - - template<> struct range_const_iterator - { - typedef pugi::xml_node::iterator type; - }; - - template<> struct range_mutable_iterator - { - typedef pugi::xml_document::iterator type; - }; - - template<> struct range_const_iterator - { - typedef pugi::xml_document::iterator type; - }; -} - -/* - * These types add support for BOOST_FOREACH macro to xml_node and xml_document classes (child/attribute iteration). - * Example usage: - * BOOST_FOREACH(xml_node n, children(doc)) {} - * BOOST_FOREACH(xml_node n, attributes(doc)) {} - */ - -namespace pugi -{ - inline xml_object_range children(const pugi::xml_node& node) - { - return node.children(); - } - - inline xml_object_range attributes(const pugi::xml_node& node) - { - return node.attributes(); - } -} - -#endif diff --git a/contrib/pugixml/readme.txt b/contrib/pugixml/readme.txt index bfb1875cb..747fc0b7e 100644 --- a/contrib/pugixml/readme.txt +++ b/contrib/pugixml/readme.txt @@ -1,6 +1,6 @@ -pugixml 1.11 - an XML processing library +pugixml 1.12 - an XML processing library -Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) +Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) Report bugs and download new versions at https://pugixml.org/ This is the distribution of pugixml, which is a C++ XML processing library, @@ -26,7 +26,7 @@ The distribution contains the following folders: This library is distributed under the MIT License: -Copyright (c) 2006-2019 Arseny Kapoulkine +Copyright (c) 2006-2022 Arseny Kapoulkine Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/contrib/pugixml/src/pugiconfig.hpp b/contrib/pugixml/src/pugiconfig.hpp index 03f854bf1..e07060c4d 100644 --- a/contrib/pugixml/src/pugiconfig.hpp +++ b/contrib/pugixml/src/pugiconfig.hpp @@ -1,7 +1,7 @@ /** - * pugixml parser - version 1.11 + * pugixml parser - version 1.12 * -------------------------------------------------------- - * Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) + * Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) * Report bugs and download new versions at https://pugixml.org/ * * This library is distributed under the MIT License. See notice at the end @@ -52,7 +52,7 @@ #endif /** - * Copyright (c) 2006-2020 Arseny Kapoulkine + * Copyright (c) 2006-2022 Arseny Kapoulkine * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation diff --git a/contrib/pugixml/src/pugixml.cpp b/contrib/pugixml/src/pugixml.cpp index efdcdf699..60b55da3a 100644 --- a/contrib/pugixml/src/pugixml.cpp +++ b/contrib/pugixml/src/pugixml.cpp @@ -1,7 +1,7 @@ /** - * pugixml parser - version 1.11 + * pugixml parser - version 1.12 * -------------------------------------------------------- - * Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) + * Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) * Report bugs and download new versions at https://pugixml.org/ * * This library is distributed under the MIT License. See notice at the end @@ -132,8 +132,10 @@ using std::memset; #endif // In some environments MSVC is a compiler but the CRT lacks certain MSVC-specific features -#if defined(_MSC_VER) && !defined(__S3E__) +#if defined(_MSC_VER) && !defined(__S3E__) && !defined(_WIN32_WCE) # define PUGI__MSVC_CRT_VERSION _MSC_VER +#elif defined(_WIN32_WCE) +# define PUGI__MSVC_CRT_VERSION 1310 // MSVC7.1 #endif // Not all platforms have snprintf; we define a wrapper that uses snprintf if possible. This only works with buffers with a known size. @@ -526,7 +528,8 @@ PUGI__NS_BEGIN xml_memory_page* page = xml_memory_page::construct(memory); assert(page); - page->allocator = _root->allocator; + assert(this == _root->allocator); + page->allocator = this; return page; } @@ -4732,7 +4735,7 @@ PUGI__NS_BEGIN // we need to get length of entire file to load it in memory; the only (relatively) sane way to do it is via seek/tell trick PUGI__FN xml_parse_status get_file_size(FILE* file, size_t& out_result) { - #if defined(PUGI__MSVC_CRT_VERSION) && PUGI__MSVC_CRT_VERSION >= 1400 && !defined(_WIN32_WCE) + #if defined(PUGI__MSVC_CRT_VERSION) && PUGI__MSVC_CRT_VERSION >= 1400 // there are 64-bit versions of fseek/ftell, let's use them typedef __int64 length_type; @@ -6735,7 +6738,7 @@ namespace pugi return const_cast(&_wrap); // BCC5 workaround } - PUGI__FN const xml_node_iterator& xml_node_iterator::operator++() + PUGI__FN xml_node_iterator& xml_node_iterator::operator++() { assert(_wrap._root); _wrap._root = _wrap._root->next_sibling; @@ -6749,7 +6752,7 @@ namespace pugi return temp; } - PUGI__FN const xml_node_iterator& xml_node_iterator::operator--() + PUGI__FN xml_node_iterator& xml_node_iterator::operator--() { _wrap = _wrap._root ? _wrap.previous_sibling() : _parent.last_child(); return *this; @@ -6796,7 +6799,7 @@ namespace pugi return const_cast(&_wrap); // BCC5 workaround } - PUGI__FN const xml_attribute_iterator& xml_attribute_iterator::operator++() + PUGI__FN xml_attribute_iterator& xml_attribute_iterator::operator++() { assert(_wrap._attr); _wrap._attr = _wrap._attr->next_attribute; @@ -6810,7 +6813,7 @@ namespace pugi return temp; } - PUGI__FN const xml_attribute_iterator& xml_attribute_iterator::operator--() + PUGI__FN xml_attribute_iterator& xml_attribute_iterator::operator--() { _wrap = _wrap._attr ? _wrap.previous_attribute() : _parent.last_attribute(); return *this; @@ -6857,7 +6860,7 @@ namespace pugi return const_cast(&_wrap); // BCC5 workaround } - PUGI__FN const xml_named_node_iterator& xml_named_node_iterator::operator++() + PUGI__FN xml_named_node_iterator& xml_named_node_iterator::operator++() { assert(_wrap._root); _wrap = _wrap.next_sibling(_name); @@ -6871,7 +6874,7 @@ namespace pugi return temp; } - PUGI__FN const xml_named_node_iterator& xml_named_node_iterator::operator--() + PUGI__FN xml_named_node_iterator& xml_named_node_iterator::operator--() { if (_wrap._root) _wrap = _wrap.previous_sibling(_name); @@ -7091,8 +7094,12 @@ namespace pugi #endif // move allocation state - doc->_root = other->_root; - doc->_busy_size = other->_busy_size; + // note that other->_root may point to the embedded document page, in which case we should keep original (empty) state + if (other->_root != PUGI__GETPAGE(other)) + { + doc->_root = other->_root; + doc->_busy_size = other->_busy_size; + } // move buffer state doc->buffer = other->buffer; @@ -8265,7 +8272,7 @@ PUGI__NS_BEGIN } // gets mantissa digits in the form of 0.xxxxx with 0. implied and the exponent -#if defined(PUGI__MSVC_CRT_VERSION) && PUGI__MSVC_CRT_VERSION >= 1400 && !defined(_WIN32_WCE) +#if defined(PUGI__MSVC_CRT_VERSION) && PUGI__MSVC_CRT_VERSION >= 1400 PUGI__FN void convert_number_to_mantissa_exponent(double value, char (&buffer)[32], char** out_mantissa, int* out_exponent) { // get base values @@ -11822,15 +11829,17 @@ PUGI__NS_BEGIN lexeme_t l = _lexer.current(); _lexer.next(); - if (++_depth > xpath_ast_depth_limit) - return error_rec(); - if (l == lex_double_slash) { n = alloc_node(ast_step, n, axis_descendant_or_self, nodetest_type_node, 0); if (!n) return 0; + + ++_depth; } + if (++_depth > xpath_ast_depth_limit) + return error_rec(); + n = parse_step(n); if (!n) return 0; } @@ -12995,7 +13004,7 @@ namespace pugi #endif /** - * Copyright (c) 2006-2020 Arseny Kapoulkine + * Copyright (c) 2006-2022 Arseny Kapoulkine * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation diff --git a/contrib/pugixml/src/pugixml.hpp b/contrib/pugixml/src/pugixml.hpp index 7e2ce7776..579f14399 100644 --- a/contrib/pugixml/src/pugixml.hpp +++ b/contrib/pugixml/src/pugixml.hpp @@ -1,7 +1,7 @@ /** - * pugixml parser - version 1.11 + * pugixml parser - version 1.12 * -------------------------------------------------------- - * Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) + * Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) * Report bugs and download new versions at https://pugixml.org/ * * This library is distributed under the MIT License. See notice at the end @@ -11,10 +11,10 @@ * Copyright (C) 2003, by Kristen Wegner (kristen@tima.net) */ -#ifndef PUGIXML_VERSION // Define version macro; evaluates to major * 1000 + minor * 10 + patch so that it's safe to use in less-than comparisons // Note: pugixml used major * 100 + minor * 10 + patch format up until 1.9 (which had version identifier 190); starting from pugixml 1.10, the minor version number is two digits -# define PUGIXML_VERSION 1110 +#ifndef PUGIXML_VERSION +# define PUGIXML_VERSION 1120 // 1.12 #endif // Include user configuration file (this can define various configuration macros) @@ -312,6 +312,8 @@ namespace pugi It begin() const { return _begin; } It end() const { return _end; } + bool empty() const { return _begin == _end; } + private: It _begin, _end; }; @@ -851,10 +853,10 @@ namespace pugi xml_node& operator*() const; xml_node* operator->() const; - const xml_node_iterator& operator++(); + xml_node_iterator& operator++(); xml_node_iterator operator++(int); - const xml_node_iterator& operator--(); + xml_node_iterator& operator--(); xml_node_iterator operator--(int); }; @@ -893,10 +895,10 @@ namespace pugi xml_attribute& operator*() const; xml_attribute* operator->() const; - const xml_attribute_iterator& operator++(); + xml_attribute_iterator& operator++(); xml_attribute_iterator operator++(int); - const xml_attribute_iterator& operator--(); + xml_attribute_iterator& operator--(); xml_attribute_iterator operator--(int); }; @@ -929,10 +931,10 @@ namespace pugi xml_node& operator*() const; xml_node* operator->() const; - const xml_named_node_iterator& operator++(); + xml_named_node_iterator& operator++(); xml_named_node_iterator operator++(int); - const xml_named_node_iterator& operator--(); + xml_named_node_iterator& operator--(); xml_named_node_iterator operator--(int); private: @@ -1474,7 +1476,7 @@ namespace std #endif /** - * Copyright (c) 2006-2020 Arseny Kapoulkine + * Copyright (c) 2006-2022 Arseny Kapoulkine * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation From 31c9a8b0edc3bfbc375821d0d69545c2477241d2 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 10 May 2022 09:15:57 +0200 Subject: [PATCH 28/29] Add badge to show open issue in percentage --- Readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Readme.md b/Readme.md index cd08c6a66..0a04da999 100644 --- a/Readme.md +++ b/Readme.md @@ -9,9 +9,11 @@ A library to import and export various 3d-model-formats including scene-post-pro src="https://scan.coverity.com/projects/5607/badge.svg"/> [![Codacy Badge](https://app.codacy.com/project/badge/Grade/9973693b7bdd4543b07084d5d9cf4745)](https://www.codacy.com/gh/assimp/assimp/dashboard?utm_source=github.com&utm_medium=referral&utm_content=assimp/assimp&utm_campaign=Badge_Grade) + [![Coverage Status](https://coveralls.io/repos/github/assimp/assimp/badge.svg?branch=master)](https://coveralls.io/github/assimp/assimp?branch=master) [![Join the chat at https://gitter.im/assimp/assimp](https://badges.gitter.im/assimp/assimp.svg)](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/assimp/assimp.svg)](http://isitmaintained.com/project/assimp/assimp "Average time to resolve an issue") +[![Percentage of issues still open](http://isitmaintained.com/badge/open/assimp/assimp.svg)](http://isitmaintained.com/project/assimp/assimp "Percentage of issues still open") [![Total alerts](https://img.shields.io/lgtm/alerts/g/assimp/assimp.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/assimp/assimp/alerts/)
From 787fcc160a9a417aeac8a69047a7148afb52dc77 Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Wed, 11 May 2022 14:03:45 -0400 Subject: [PATCH 29/29] Clang-Tidy performance fixes --- code/AssetLib/3MF/XmlSerializer.cpp | 2 +- code/AssetLib/Blender/BlenderLoader.cpp | 2 +- code/AssetLib/Blender/BlenderLoader.h | 2 +- code/AssetLib/IFC/IFCOpenings.cpp | 8 ++++---- code/AssetLib/X3D/X3DImporter.cpp | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/code/AssetLib/3MF/XmlSerializer.cpp b/code/AssetLib/3MF/XmlSerializer.cpp index 9bd1c5bb0..740bc5658 100644 --- a/code/AssetLib/3MF/XmlSerializer.cpp +++ b/code/AssetLib/3MF/XmlSerializer.cpp @@ -106,7 +106,7 @@ bool getNodeAttribute(const XmlNode &node, const std::string &attribute, int &va return false; } -aiMatrix4x4 parseTransformMatrix(std::string matrixStr) { +aiMatrix4x4 parseTransformMatrix(const std::string& matrixStr) { // split the string std::vector numbers; std::string currentNumber; diff --git a/code/AssetLib/Blender/BlenderLoader.cpp b/code/AssetLib/Blender/BlenderLoader.cpp index b3591b4f1..2ed0d6b8a 100644 --- a/code/AssetLib/Blender/BlenderLoader.cpp +++ b/code/AssetLib/Blender/BlenderLoader.cpp @@ -281,7 +281,7 @@ void BlenderImporter::ExtractScene(Scene &out, const FileDatabase &file) { } // ------------------------------------------------------------------------------------------------ -void BlenderImporter::ParseSubCollection(const Blender::Scene &in, aiNode *root, std::shared_ptr collection, ConversionData &conv_data) { +void BlenderImporter::ParseSubCollection(const Blender::Scene &in, aiNode *root, const std::shared_ptr& collection, ConversionData &conv_data) { std::deque root_objects; // Count number of objects diff --git a/code/AssetLib/Blender/BlenderLoader.h b/code/AssetLib/Blender/BlenderLoader.h index 0299ae393..b29ee5941 100644 --- a/code/AssetLib/Blender/BlenderLoader.h +++ b/code/AssetLib/Blender/BlenderLoader.h @@ -117,7 +117,7 @@ protected: void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override; void ParseBlendFile(Blender::FileDatabase &out, std::shared_ptr stream); void ExtractScene(Blender::Scene &out, const Blender::FileDatabase &file); - void ParseSubCollection(const Blender::Scene &in, aiNode *root, std::shared_ptr collection, Blender::ConversionData &conv_data); + void ParseSubCollection(const Blender::Scene &in, aiNode *root, const std::shared_ptr& collection, Blender::ConversionData &conv_data); void ConvertBlendFile(aiScene *out, const Blender::Scene &in, const Blender::FileDatabase &file); private: diff --git a/code/AssetLib/IFC/IFCOpenings.cpp b/code/AssetLib/IFC/IFCOpenings.cpp index 6b8b565c2..3c4a0b3cd 100644 --- a/code/AssetLib/IFC/IFCOpenings.cpp +++ b/code/AssetLib/IFC/IFCOpenings.cpp @@ -1428,7 +1428,7 @@ bool GenerateOpenings(std::vector& openings, return true; } -std::vector GetContourInPlane2D(std::shared_ptr mesh,IfcMatrix3 planeSpace, +std::vector GetContourInPlane2D(const std::shared_ptr& mesh,IfcMatrix3 planeSpace, IfcVector3 planeNor,IfcFloat planeOffset, IfcVector3 extrusionDir,IfcVector3& wall_extrusion,bool& first,bool& ok) { std::vector contour; @@ -1491,7 +1491,7 @@ static void logSegment(std::pair segment) { IFCImporter::LogInfo(msg2.str().c_str()); } -std::vector> GetContoursInPlane3D(std::shared_ptr mesh,IfcMatrix3 planeSpace, +std::vector> GetContoursInPlane3D(const std::shared_ptr& mesh,IfcMatrix3 planeSpace, IfcFloat planeOffset) { { @@ -1676,7 +1676,7 @@ std::vector> GetContoursInPlane3D(std::shared_ptr> GetContoursInPlane3D(std::shared_ptr> GetContoursInPlane(std::shared_ptr mesh,IfcMatrix3 planeSpace, +std::vector> GetContoursInPlane(const std::shared_ptr& mesh,IfcMatrix3 planeSpace, IfcVector3 planeNor,IfcFloat planeOffset, IfcVector3 extrusionDir,IfcVector3& wall_extrusion,bool& first) { diff --git a/code/AssetLib/X3D/X3DImporter.cpp b/code/AssetLib/X3D/X3DImporter.cpp index b34f361ae..01c97eb4c 100644 --- a/code/AssetLib/X3D/X3DImporter.cpp +++ b/code/AssetLib/X3D/X3DImporter.cpp @@ -333,7 +333,7 @@ void X3DImporter::readHead(XmlNode &node) { } mScene->mMetaData = aiMetadata::Alloc(static_cast(metaArray.size())); unsigned int i = 0; - for (auto currentMeta : metaArray) { + for (const auto& currentMeta : metaArray) { mScene->mMetaData->Set(i, currentMeta.name, aiString(currentMeta.value)); ++i; }