diff --git a/Build.md b/Build.md index b4d1bdad0..d6abe7b67 100644 --- a/Build.md +++ b/Build.md @@ -84,23 +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_ERROR_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). diff --git a/CMakeLists.txt b/CMakeLists.txt index ab4d45e88..2aa66421c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,9 +108,9 @@ OPTION( ASSIMP_INSTALL "Disable this if you want to use assimp as a submodule." ON ) -OPTION ( ASSIMP_ERROR_MAX - "Enable all warnings." - OFF +OPTION ( ASSIMP_WARNINGS_AS_ERRORS + "Treat all warnings as errors." + ON ) OPTION ( ASSIMP_ASAN "Enable AddressSanitizer." @@ -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/ @@ -337,16 +324,6 @@ IF (ASSIMP_COVERALLS) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") ENDIF() -IF (ASSIMP_ERROR_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") - ENDIF() -ENDIF() - IF (ASSIMP_ASAN) MESSAGE(STATUS "AddressSanitizer enabled") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") @@ -707,10 +684,12 @@ ENDIF() # Main assimp code 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 +714,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/README b/README deleted file mode 100644 index 24619ab94..000000000 --- a/README +++ /dev/null @@ -1 +0,0 @@ -See Readme.md diff --git a/Readme.md b/Readme.md index f4167c9f2..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/)
@@ -58,6 +60,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. 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/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/ASE/ASEParser.cpp b/code/AssetLib/ASE/ASEParser.cpp index 14eb720f4..0d526147c 100644 --- a/code/AssetLib/ASE/ASEParser.cpp +++ b/code/AssetLib/ASE/ASEParser.cpp @@ -646,10 +646,13 @@ 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); + } - // parse the material block - ParseLV2MaterialBlock(sMat); continue; } } 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/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/FBX/FBXConverter.cpp b/code/AssetLib/FBX/FBXConverter.cpp index d446fd2e9..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)); @@ -1553,14 +1540,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 // 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, 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); } 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/Ogre/OgreXmlSerializer.cpp b/code/AssetLib/Ogre/OgreXmlSerializer.cpp index 545107ea3..f6164c64f 100644 --- a/code/AssetLib/Ogre/OgreXmlSerializer.cpp +++ b/code/AssetLib/Ogre/OgreXmlSerializer.cpp @@ -248,6 +248,7 @@ void OgreXmlSerializer::ReadMesh(MeshXml *mesh) { } else if (currentName == nnBoneAssignments) { ReadBoneAssignments(currentNode, mesh->sharedVertexData); } else if (currentName == nnSkeletonLink) { + mesh->skeletonRef = currentNode.attribute("name").as_string(); } } @@ -488,6 +489,15 @@ bool OgreXmlSerializer::ImportSkeleton(Assimp::IOSystem *pIOHandler, MeshXml *me Skeleton *skeleton = new Skeleton(); OgreXmlSerializer serializer(xmlParser.get()); XmlNode root = xmlParser->getRootNode(); + if (std::string(root.name()) != nnSkeleton) { + printf("\nSkeleton is not a valid root: %s\n", root.name()); + for (auto &a : root.children()) { + if (std::string(a.name()) == nnSkeleton) { + root = a; + break; + } + } + } serializer.ReadSkeleton(root, skeleton); mesh->skeleton = skeleton; return true; @@ -537,7 +547,7 @@ XmlParserPtr OgreXmlSerializer::OpenXmlParser(Assimp::IOSystem *pIOHandler, cons } void OgreXmlSerializer::ReadSkeleton(XmlNode &node, Skeleton *skeleton) { - if (node.name() != nnSkeleton) { + if (std::string(node.name()) != nnSkeleton) { throw DeadlyImportError("Root node is <" + std::string(node.name()) + "> expecting "); } @@ -574,14 +584,14 @@ void OgreXmlSerializer::ReadAnimations(XmlNode &node, Skeleton *skeleton) { anim->name = ReadAttribute(currentNode, "name"); anim->length = ReadAttribute(currentNode, "length"); for (XmlNode ¤tChildNode : currentNode.children()) { - const std::string currentChildName = currentNode.name(); + const std::string currentChildName = currentChildNode.name(); if (currentChildName == nnTracks) { ReadAnimationTracks(currentChildNode, anim); - skeleton->animations.push_back(anim); } else { throw DeadlyImportError("No found in ", anim->name); } } + skeleton->animations.push_back(anim); } } } @@ -594,14 +604,14 @@ void OgreXmlSerializer::ReadAnimationTracks(XmlNode &node, Animation *dest) { track.type = VertexAnimationTrack::VAT_TRANSFORM; track.boneName = ReadAttribute(currentNode, "bone"); for (XmlNode ¤tChildNode : currentNode.children()) { - const std::string currentChildName = currentNode.name(); + const std::string currentChildName = currentChildNode.name(); if (currentChildName == nnKeyFrames) { ReadAnimationKeyFrames(currentChildNode, dest, &track); - dest->tracks.push_back(track); } else { throw DeadlyImportError("No found in ", dest->name); } } + dest->tracks.push_back(track); } } } @@ -614,15 +624,15 @@ void OgreXmlSerializer::ReadAnimationKeyFrames(XmlNode &node, Animation *anim, V if (currentName == nnKeyFrame) { keyframe.timePos = ReadAttribute(currentNode, "time"); for (XmlNode ¤tChildNode : currentNode.children()) { - const std::string currentChildName = currentNode.name(); + const std::string currentChildName = currentChildNode.name(); if (currentChildName == nnTranslate) { keyframe.position.x = ReadAttribute(currentChildNode, anX); keyframe.position.y = ReadAttribute(currentChildNode, anY); keyframe.position.z = ReadAttribute(currentChildNode, anZ); } else if (currentChildName == nnRotate) { float angle = ReadAttribute(currentChildNode, "angle"); - for (XmlNode ¤tChildChildNode : currentNode.children()) { - const std::string currentChildChildName = currentNode.name(); + for (XmlNode ¤tChildChildNode : currentChildNode.children()) { + const std::string currentChildChildName = currentChildChildNode.name(); if (currentChildChildName == nnAxis) { aiVector3D axis; axis.x = ReadAttribute(currentChildChildNode, anX); @@ -695,12 +705,12 @@ void OgreXmlSerializer::ReadBones(XmlNode &node, Skeleton *skeleton) { bone->id = ReadAttribute(currentNode, "id"); bone->name = ReadAttribute(currentNode, "name"); for (XmlNode ¤tChildNode : currentNode.children()) { - const std::string currentChildName = currentNode.name(); - if (currentChildName == nnRotation) { + const std::string currentChildName = currentChildNode.name(); + if (currentChildName == nnPosition) { bone->position.x = ReadAttribute(currentChildNode, anX); bone->position.y = ReadAttribute(currentChildNode, anY); bone->position.z = ReadAttribute(currentChildNode, anZ); - } else if (currentChildName == nnScale) { + } else if (currentChildName == nnRotation) { float angle = ReadAttribute(currentChildNode, "angle"); for (XmlNode currentChildChildNode : currentChildNode.children()) { const std::string ¤tChildChildName = currentChildChildNode.name(); 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; } diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 5b08c0f37..d2488d6f2 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -1054,7 +1054,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 ) @@ -1177,11 +1179,13 @@ 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) +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 @@ -1264,6 +1268,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) @@ -1275,12 +1289,6 @@ 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}" - ) -endif() - if (APPLE) if (ASSIMP_BUILD_FRAMEWORK) SET_TARGET_PROPERTIES( assimp PROPERTIES 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/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/contrib/draco/CMakeLists.txt b/contrib/draco/CMakeLists.txt index 5526e7f60..6ea9b21fd 100644 --- a/contrib/draco/CMakeLists.txt +++ b/contrib/draco/CMakeLists.txt @@ -10,7 +10,7 @@ endif() set(draco_root "${CMAKE_CURRENT_SOURCE_DIR}") set(draco_src_root "${draco_root}/src/draco") -set(draco_build "${CMAKE_BINARY_DIR}") +set(draco_build "${Assimp_BINARY_DIR}") if("${draco_root}" STREQUAL "${draco_build}") message( 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 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/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_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) { diff --git a/tools/assimp_view/CMakeLists.txt b/tools/assimp_view/CMakeLists.txt index 13c4c139a..25304f407 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 @@ -98,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..aea65a8d5 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","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)) { - 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..8575df1ff 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) ///////////////////////////////////////////////////////////////////////////// @@ -43,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 "\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 "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 @@ -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