dust3d/src/meshresultpostprocessor.cpp

53 lines
1.3 KiB
C++
Raw Normal View History

#include <QGuiApplication>
#include "meshresultpostprocessor.h"
#include "uvunwrap.h"
#include "triangletangentresolve.h"
MeshResultPostProcessor::MeshResultPostProcessor(const Outcome &outcome)
{
m_outcome = new Outcome;
*m_outcome = outcome;
}
MeshResultPostProcessor::~MeshResultPostProcessor()
{
delete m_outcome;
}
Outcome *MeshResultPostProcessor::takePostProcessedOutcome()
{
Outcome *outcome = m_outcome;
m_outcome = nullptr;
return outcome;
}
void MeshResultPostProcessor::poseProcess()
{
#ifndef NDEBUG
return;
#endif
2018-10-25 15:28:10 +00:00
if (!m_outcome->nodes.empty()) {
{
std::vector<std::vector<QVector2D>> triangleVertexUvs;
std::set<int> seamVertices;
2019-05-12 08:15:07 +00:00
std::map<QUuid, std::vector<QRectF>> partUvRects;
uvUnwrap(*m_outcome, triangleVertexUvs, seamVertices, partUvRects);
m_outcome->setTriangleVertexUvs(triangleVertexUvs);
2019-05-12 08:15:07 +00:00
m_outcome->setPartUvRects(partUvRects);
}
{
std::vector<QVector3D> triangleTangents;
triangleTangentResolve(*m_outcome, triangleTangents);
m_outcome->setTriangleTangents(triangleTangents);
}
}
}
void MeshResultPostProcessor::process()
{
poseProcess();
emit finished();
}