Prepare for UV mapping generating

master
Jeremy HU 2022-10-20 20:41:33 +11:00
parent a8cc1c0b58
commit 0ff187745a
2 changed files with 9 additions and 1 deletions

View File

@ -48,6 +48,11 @@ const std::vector<std::vector<size_t>>& TubeMeshBuilder::generatedFaces()
return m_generatedFaces; return m_generatedFaces;
} }
const std::vector<std::vector<Vector2>>& TubeMeshBuilder::generatedFaceUvs()
{
return m_generatedFaceUvs;
}
void TubeMeshBuilder::applyRoundEnd() void TubeMeshBuilder::applyRoundEnd()
{ {
if (m_isCircle) if (m_isCircle)
@ -227,6 +232,7 @@ void TubeMeshBuilder::build()
cutFaceIndices[i].resize(cutFaceVertices.size()); cutFaceIndices[i].resize(cutFaceVertices.size());
for (size_t k = 0; k < cutFaceVertices.size(); ++k) { for (size_t k = 0; k < cutFaceVertices.size(); ++k) {
cutFaceIndices[i][k] = m_generatedVertices.size(); cutFaceIndices[i][k] = m_generatedVertices.size();
m_generatedVertexUvs.emplace_back(cutFaceVertexUvs[i][k]);
m_generatedVertices.emplace_back(cutFaceVertices[k]); m_generatedVertices.emplace_back(cutFaceVertices[k]);
} }
} }

View File

@ -48,6 +48,7 @@ public:
const Vector3& generatedBaseNormal(); const Vector3& generatedBaseNormal();
const std::vector<Vector3>& generatedVertices(); const std::vector<Vector3>& generatedVertices();
const std::vector<std::vector<size_t>>& generatedFaces(); const std::vector<std::vector<size_t>>& generatedFaces();
const std::vector<std::vector<Vector2>>& generatedFaceUvs();
private: private:
BuildParameters m_buildParameters; BuildParameters m_buildParameters;
@ -57,7 +58,8 @@ private:
std::vector<double> m_nodeForwardDistances; std::vector<double> m_nodeForwardDistances;
std::vector<Vector3> m_generatedVertices; std::vector<Vector3> m_generatedVertices;
std::vector<std::vector<size_t>> m_generatedFaces; std::vector<std::vector<size_t>> m_generatedFaces;
std::vector<std::vector<Vector2>> m_generatedUvs; std::vector<Vector2> m_generatedVertexUvs;
std::vector<std::vector<Vector2>> m_generatedFaceUvs;
Vector3 m_generatedBaseNormal; Vector3 m_generatedBaseNormal;
bool m_isCircle = false; bool m_isCircle = false;
double m_maxNodeRadius = 0.0; double m_maxNodeRadius = 0.0;