From 0ff187745a2645848b994535de458741e05d3640 Mon Sep 17 00:00:00 2001 From: Jeremy HU Date: Thu, 20 Oct 2022 20:41:33 +1100 Subject: [PATCH] Prepare for UV mapping generating --- dust3d/mesh/tube_mesh_builder.cc | 6 ++++++ dust3d/mesh/tube_mesh_builder.h | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dust3d/mesh/tube_mesh_builder.cc b/dust3d/mesh/tube_mesh_builder.cc index 3ff2caa4..597137e3 100644 --- a/dust3d/mesh/tube_mesh_builder.cc +++ b/dust3d/mesh/tube_mesh_builder.cc @@ -48,6 +48,11 @@ const std::vector>& TubeMeshBuilder::generatedFaces() return m_generatedFaces; } +const std::vector>& TubeMeshBuilder::generatedFaceUvs() +{ + return m_generatedFaceUvs; +} + void TubeMeshBuilder::applyRoundEnd() { if (m_isCircle) @@ -227,6 +232,7 @@ void TubeMeshBuilder::build() cutFaceIndices[i].resize(cutFaceVertices.size()); for (size_t k = 0; k < cutFaceVertices.size(); ++k) { cutFaceIndices[i][k] = m_generatedVertices.size(); + m_generatedVertexUvs.emplace_back(cutFaceVertexUvs[i][k]); m_generatedVertices.emplace_back(cutFaceVertices[k]); } } diff --git a/dust3d/mesh/tube_mesh_builder.h b/dust3d/mesh/tube_mesh_builder.h index 596e1300..13901917 100644 --- a/dust3d/mesh/tube_mesh_builder.h +++ b/dust3d/mesh/tube_mesh_builder.h @@ -48,6 +48,7 @@ public: const Vector3& generatedBaseNormal(); const std::vector& generatedVertices(); const std::vector>& generatedFaces(); + const std::vector>& generatedFaceUvs(); private: BuildParameters m_buildParameters; @@ -57,7 +58,8 @@ private: std::vector m_nodeForwardDistances; std::vector m_generatedVertices; std::vector> m_generatedFaces; - std::vector> m_generatedUvs; + std::vector m_generatedVertexUvs; + std::vector> m_generatedFaceUvs; Vector3 m_generatedBaseNormal; bool m_isCircle = false; double m_maxNodeRadius = 0.0;