From 9a3bde0e6db91c24f3a6bbf795364aeb3fb97505 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Jul 2022 11:41:23 +0000 Subject: [PATCH 1/3] Bump actions/upload-artifact from 2 to 3 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ccpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 603cbf99b..4dc2a959c 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -122,7 +122,7 @@ jobs: run: cd build/bin && ./unit ${{ steps.hunter_extra_test_args.outputs.args }} shell: bash - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 if: matrix.name == 'windows-msvc' with: name: 'assimp-bins-${{ matrix.name }}-${{ github.sha }}' From 0db8b3daae0bf40eb83d9766a5907748e70e0ee3 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 6 Jul 2022 20:59:17 +0200 Subject: [PATCH 2/3] Use default destructor. --- include/assimp/XmlParser.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/assimp/XmlParser.h b/include/assimp/XmlParser.h index 67dfdeebe..a625f82fb 100644 --- a/include/assimp/XmlParser.h +++ b/include/assimp/XmlParser.h @@ -501,10 +501,8 @@ public: } } - /// @brief The class destructor. - ~XmlNodeIterator() { - // empty - } + /// @brief The class destructor, default implementation. + ~XmlNodeIterator() = default; /// @brief Will iterate through all children in pre-order iteration. /// @param node [in] The nod to iterate through. From 77a2cdee76d5ef3c7b863c6b3810a70ee7a761a8 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 6 Jul 2022 20:59:42 +0200 Subject: [PATCH 3/3] Fix texture fetch for embedded textures in 3mf-files. --- code/AssetLib/3MF/XmlSerializer.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/code/AssetLib/3MF/XmlSerializer.cpp b/code/AssetLib/3MF/XmlSerializer.cpp index 9d7a1800f..043ac84cc 100644 --- a/code/AssetLib/3MF/XmlSerializer.cpp +++ b/code/AssetLib/3MF/XmlSerializer.cpp @@ -64,7 +64,7 @@ bool validateColorString(const char *color) { return true; } -aiFace ReadTriangle(XmlNode &node, unsigned int &texId0, unsigned int &texId1, unsigned int &texId2) { +aiFace ReadTriangle(XmlNode &node, int &texId0, int &texId1, int &texId2) { aiFace face; face.mNumIndices = 3; @@ -73,9 +73,10 @@ aiFace ReadTriangle(XmlNode &node, unsigned int &texId0, unsigned int &texId1, u face.mIndices[1] = static_cast(std::atoi(node.attribute(XmlTag::v2).as_string())); face.mIndices[2] = static_cast(std::atoi(node.attribute(XmlTag::v3).as_string())); - texId0 = static_cast(std::atoi(node.attribute(XmlTag::p1).as_string())); - texId1 = static_cast(std::atoi(node.attribute(XmlTag::p2).as_string())); - texId2 = static_cast(std::atoi(node.attribute(XmlTag::p3).as_string())); + texId0 = texId1 = texId2 = -1; + XmlParser::getIntAttribute(node, XmlTag::p1, texId0); + XmlParser::getIntAttribute(node, XmlTag::p2, texId1); + XmlParser::getIntAttribute(node, XmlTag::p3, texId2); return face; } @@ -416,7 +417,8 @@ void XmlSerializer::ImportTriangles(XmlNode &node, aiMesh *mesh) { bool hasPid = getNodeAttribute(currentNode, D3MF::XmlTag::pid, pid); bool hasP1 = getNodeAttribute(currentNode, D3MF::XmlTag::p1, p1); - unsigned int texId[3]; + int texId[3]; + Texture2DGroup *group = nullptr; aiFace face = ReadTriangle(currentNode, texId[0], texId[1], texId[2]); if (hasPid && hasP1) { auto it = mResourcesDictionnary.find(pid); @@ -431,7 +433,7 @@ void XmlSerializer::ImportTriangles(XmlNode &node, aiMesh *mesh) { mesh->mNumUVComponents[i] = 0; } - Texture2DGroup *group = static_cast(it->second); + group = static_cast(it->second); const std::string name = ai_to_string(group->mTexId); for (size_t i = 0; i < mMaterials.size(); ++i) { if (name == mMaterials[i]->GetName().C_Str()) { @@ -439,15 +441,21 @@ void XmlSerializer::ImportTriangles(XmlNode &node, aiMesh *mesh) { } } mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices]; - for (unsigned int i = 0; i < mesh->mNumVertices; ++i) { - - mesh->mTextureCoords[0][i] = aiVector3D(group->mTex2dCoords[i].x, group->mTex2dCoords[i].y, 0); - } } } } } + // Load texture coordinates into mesh, when any + if (group != nullptr) { + size_t i0 = face.mIndices[0]; + size_t i1 = face.mIndices[1]; + size_t i2 = face.mIndices[2]; + mesh->mTextureCoords[0][i0] = aiVector3D(group->mTex2dCoords[texId[0]].x, group->mTex2dCoords[texId[0]].y, 0.0f); + mesh->mTextureCoords[0][i1] = aiVector3D(group->mTex2dCoords[texId[1]].x, group->mTex2dCoords[texId[1]].y, 0.0f); + mesh->mTextureCoords[0][i2] = aiVector3D(group->mTex2dCoords[texId[2]].x, group->mTex2dCoords[texId[2]].y, 0.0f); + } + faces.push_back(face); } }