From 4389c3d80ce687a243be49b640a83e19b350b0c4 Mon Sep 17 00:00:00 2001 From: tangxin Date: Wed, 23 Aug 2023 14:54:40 +0800 Subject: [PATCH 1/2] The texture strength attribute in aiMaterial set when importing and exporting gltf files is inconsistent --- code/AssetLib/glTF2/glTF2Importer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/AssetLib/glTF2/glTF2Importer.cpp b/code/AssetLib/glTF2/glTF2Importer.cpp index 86fd0ab7e..0fed11cef 100644 --- a/code/AssetLib/glTF2/glTF2Importer.cpp +++ b/code/AssetLib/glTF2/glTF2Importer.cpp @@ -234,7 +234,8 @@ inline void SetMaterialTextureProperty(std::vector &embeddedTexIdxs, Asset SetMaterialTextureProperty(embeddedTexIdxs, r, (glTF2::TextureInfo)prop, mat, texType, texSlot); if (prop.texture && prop.texture->source) { - mat->AddProperty(&prop.strength, 1, AI_MATKEY_GLTF_TEXTURE_STRENGTH(texType, texSlot)); + std::string textureStrengthKey = std::string(_AI_MATKEY_TEXTURE_BASE) + "." + "strength"; + mat->AddProperty(&prop.strength, 1, textureStrengthKey.c_str(), texType, texSlot); } } From e50233b2c1e0eccaad8ace908c66dc7425d5d500 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Wed, 23 Aug 2023 17:19:01 +0100 Subject: [PATCH 2/2] Use correct PDB paths The previously-specified paths were only correct for a static library build. I therefore fenced off that code to be specific to static library builds. For shared library builds, I added a generator-expression-based alternative. Annoyingly, this won't work with static library builds, so we don't get the concise, reliable version in all circumstances. I've avoided modifying any of the paths anything ends up at to avoid breaking changes. Resolves https://github.com/assimp/assimp/issues/4269 --- code/CMakeLists.txt | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index f7aa847bc..08a79ef19 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -1418,25 +1418,29 @@ if(MSVC AND ASSIMP_INSTALL_PDB) COMPILE_PDB_NAME assimp${LIBRARY_SUFFIX} COMPILE_PDB_NAME_DEBUG assimp${LIBRARY_SUFFIX}${CMAKE_DEBUG_POSTFIX} ) - ENDIF() - IF(CMAKE_GENERATOR MATCHES "^Visual Studio") - install(FILES ${Assimp_BINARY_DIR}/code/Debug/assimp${LIBRARY_SUFFIX}${CMAKE_DEBUG_POSTFIX}.pdb - DESTINATION ${ASSIMP_LIB_INSTALL_DIR} - CONFIGURATIONS Debug - ) - install(FILES ${Assimp_BINARY_DIR}/code/RelWithDebInfo/assimp${LIBRARY_SUFFIX}.pdb - DESTINATION ${ASSIMP_LIB_INSTALL_DIR} - CONFIGURATIONS RelWithDebInfo - ) + IF(GENERATOR_IS_MULTI_CONFIG) + install(FILES ${Assimp_BINARY_DIR}/code/Debug/assimp${LIBRARY_SUFFIX}${CMAKE_DEBUG_POSTFIX}.pdb + DESTINATION ${ASSIMP_LIB_INSTALL_DIR} + CONFIGURATIONS Debug + ) + install(FILES ${Assimp_BINARY_DIR}/code/RelWithDebInfo/assimp${LIBRARY_SUFFIX}.pdb + DESTINATION ${ASSIMP_LIB_INSTALL_DIR} + CONFIGURATIONS RelWithDebInfo + ) + ELSE() + install(FILES ${Assimp_BINARY_DIR}/code/assimp${LIBRARY_SUFFIX}${CMAKE_DEBUG_POSTFIX}.pdb + DESTINATION ${ASSIMP_LIB_INSTALL_DIR} + CONFIGURATIONS Debug + ) + install(FILES ${Assimp_BINARY_DIR}/code/assimp${LIBRARY_SUFFIX}.pdb + DESTINATION ${ASSIMP_LIB_INSTALL_DIR} + CONFIGURATIONS RelWithDebInfo + ) + ENDIF() ELSE() - install(FILES ${Assimp_BINARY_DIR}/code/assimp${LIBRARY_SUFFIX}${CMAKE_DEBUG_POSTFIX}.pdb + install(FILES $ DESTINATION ${ASSIMP_LIB_INSTALL_DIR} - CONFIGURATIONS Debug - ) - install(FILES ${Assimp_BINARY_DIR}/code/assimp${LIBRARY_SUFFIX}.pdb - DESTINATION ${ASSIMP_LIB_INSTALL_DIR} - CONFIGURATIONS RelWithDebInfo ) ENDIF() ENDIF ()