2018-09-18 03:17:35 +00:00
|
|
|
#include <QGuiApplication>
|
|
|
|
#include "posemeshcreator.h"
|
|
|
|
#include "skinnedmeshcreator.h"
|
|
|
|
|
2018-10-02 04:59:30 +00:00
|
|
|
PoseMeshCreator::PoseMeshCreator(const std::vector<JointNode> &resultNodes,
|
2018-10-25 00:19:38 +00:00
|
|
|
const Outcome &outcome,
|
2018-09-18 03:17:35 +00:00
|
|
|
const std::map<int, AutoRiggerVertexWeights> &resultWeights) :
|
2018-10-02 04:59:30 +00:00
|
|
|
m_resultNodes(resultNodes),
|
2018-10-25 00:19:38 +00:00
|
|
|
m_outcome(outcome),
|
2018-09-18 03:17:35 +00:00
|
|
|
m_resultWeights(resultWeights)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
PoseMeshCreator::~PoseMeshCreator()
|
|
|
|
{
|
|
|
|
delete m_resultMesh;
|
|
|
|
}
|
|
|
|
|
|
|
|
MeshLoader *PoseMeshCreator::takeResultMesh()
|
|
|
|
{
|
|
|
|
MeshLoader *resultMesh = m_resultMesh;
|
|
|
|
m_resultMesh = nullptr;
|
|
|
|
return resultMesh;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PoseMeshCreator::createMesh()
|
|
|
|
{
|
2018-10-25 00:19:38 +00:00
|
|
|
SkinnedMeshCreator skinnedMeshCreator(m_outcome, m_resultWeights);
|
2018-09-18 03:17:35 +00:00
|
|
|
|
|
|
|
std::vector<QMatrix4x4> matricies;
|
|
|
|
matricies.resize(m_resultNodes.size());
|
|
|
|
for (decltype(m_resultNodes.size()) i = 0; i < m_resultNodes.size(); i++) {
|
|
|
|
const auto &node = m_resultNodes[i];
|
|
|
|
matricies[i] = node.transformMatrix;
|
|
|
|
}
|
|
|
|
|
|
|
|
delete m_resultMesh;
|
|
|
|
m_resultMesh = skinnedMeshCreator.createMeshFromTransform(matricies);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PoseMeshCreator::process()
|
|
|
|
{
|
|
|
|
createMesh();
|
|
|
|
|
|
|
|
this->moveToThread(QGuiApplication::instance()->thread());
|
|
|
|
emit finished();
|
|
|
|
}
|