2022-10-18 09:35:04 +00:00
|
|
|
#include "mesh_result_post_processor.h"
|
2021-11-18 14:58:01 +00:00
|
|
|
#include <QGuiApplication>
|
|
|
|
#include <dust3d/mesh/resolve_triangle_tangent.h>
|
|
|
|
|
2022-10-18 09:35:04 +00:00
|
|
|
MeshResultPostProcessor::MeshResultPostProcessor(const dust3d::Object& object)
|
2021-11-18 14:58:01 +00:00
|
|
|
{
|
|
|
|
m_object = new dust3d::Object;
|
|
|
|
*m_object = object;
|
|
|
|
}
|
|
|
|
|
|
|
|
MeshResultPostProcessor::~MeshResultPostProcessor()
|
|
|
|
{
|
|
|
|
delete m_object;
|
|
|
|
}
|
|
|
|
|
2022-10-18 09:35:04 +00:00
|
|
|
dust3d::Object* MeshResultPostProcessor::takePostProcessedObject()
|
2021-11-18 14:58:01 +00:00
|
|
|
{
|
2022-10-18 09:35:04 +00:00
|
|
|
dust3d::Object* object = m_object;
|
2021-11-18 14:58:01 +00:00
|
|
|
m_object = nullptr;
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MeshResultPostProcessor::poseProcess()
|
|
|
|
{
|
2022-11-13 07:02:53 +00:00
|
|
|
//if (!m_object->nodes.empty()) {
|
|
|
|
/*
|
2021-11-18 14:58:01 +00:00
|
|
|
{
|
|
|
|
std::vector<std::vector<dust3d::Vector2>> triangleVertexUvs;
|
|
|
|
std::set<int> seamVertices;
|
|
|
|
std::map<dust3d::Uuid, std::vector<dust3d::Rectangle>> partUvRects;
|
|
|
|
dust3d::unwrapUv(*m_object, triangleVertexUvs, seamVertices, partUvRects);
|
|
|
|
m_object->setTriangleVertexUvs(triangleVertexUvs);
|
|
|
|
m_object->setPartUvRects(partUvRects);
|
|
|
|
}
|
2022-10-18 09:35:04 +00:00
|
|
|
|
2021-11-18 14:58:01 +00:00
|
|
|
{
|
|
|
|
std::vector<dust3d::Vector3> triangleTangents;
|
|
|
|
dust3d::resolveTriangleTangent(*m_object, triangleTangents);
|
|
|
|
m_object->setTriangleTangents(triangleTangents);
|
|
|
|
}
|
2022-10-29 23:05:55 +00:00
|
|
|
*/
|
2022-11-13 07:02:53 +00:00
|
|
|
//}
|
2021-11-18 14:58:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MeshResultPostProcessor::process()
|
|
|
|
{
|
|
|
|
poseProcess();
|
|
|
|
|
|
|
|
emit finished();
|
|
|
|
}
|