Improve mesh generation
1. All components recombined regardless of color groups 2. Contour main view contribute to x-coord only when width and height is different (Offset greater than radius) 3. Fix generating indicatormaster
parent
f2093bd42a
commit
ee53e3ed4f
|
@ -219,11 +219,18 @@ void ContourToPartConverter::convert()
|
|||
if (!sideSkeleton.empty()) {
|
||||
alignSkeleton(sideSkeleton, mainSkeleton);
|
||||
float defaultX = mainBoundingBox.center().x() / m_canvasSize.height();
|
||||
float area = mainBoundingBox.width() * mainBoundingBox.height();
|
||||
float mainBoundingBoxWidthHeightOffset = std::abs(mainBoundingBox.width() - mainBoundingBox.height());
|
||||
float rectRadius = std::sqrt(area) * 0.5;
|
||||
bool useCalculatedX = mainBoundingBoxWidthHeightOffset >= rectRadius;
|
||||
m_nodes.reserve(sideSkeleton.size());
|
||||
for (size_t i = 0; i < sideSkeleton.size(); ++i) {
|
||||
const auto &it = sideSkeleton[i];
|
||||
float x = defaultX;
|
||||
if (useCalculatedX) {
|
||||
size_t j = ((float)i / sideSkeleton.size()) * mainSkeleton.size();
|
||||
float x = j < mainSkeleton.size() ? mainSkeleton[j].first.x() : defaultX;
|
||||
x = j < mainSkeleton.size() ? mainSkeleton[j].first.x() : defaultX;
|
||||
}
|
||||
m_nodes.push_back(std::make_pair(QVector3D(x, it.first.y(), it.first.x()),
|
||||
it.second));
|
||||
}
|
||||
|
@ -243,6 +250,7 @@ void ContourToPartConverter::nodesToSnapshot()
|
|||
snapshotPart["id"] = partIdString;
|
||||
snapshotPart["subdived"] = "true";
|
||||
snapshotPart["rounded"] = "true";
|
||||
snapshotPart["base"] = "YZ";
|
||||
m_snapshot.parts[partIdString] = snapshotPart;
|
||||
|
||||
auto componentId = QUuid::createUuid();
|
||||
|
|
|
@ -2037,6 +2037,8 @@ void Document::generateMesh()
|
|||
return;
|
||||
}
|
||||
|
||||
emit meshGenerating();
|
||||
|
||||
qDebug() << "Mesh generating..";
|
||||
|
||||
settleOrigin();
|
||||
|
@ -2060,7 +2062,6 @@ void Document::generateMesh()
|
|||
connect(m_meshGenerator, &MeshGenerator::finished, this, &Document::meshReady);
|
||||
connect(m_meshGenerator, &MeshGenerator::finished, thread, &QThread::quit);
|
||||
connect(thread, &QThread::finished, thread, &QThread::deleteLater);
|
||||
emit meshGenerating();
|
||||
thread->start();
|
||||
}
|
||||
|
||||
|
@ -2072,6 +2073,7 @@ void Document::generateTexture()
|
|||
}
|
||||
|
||||
qDebug() << "Texture guide generating..";
|
||||
emit textureGenerating();
|
||||
|
||||
m_isTextureObsolete = false;
|
||||
|
||||
|
@ -2085,7 +2087,6 @@ void Document::generateTexture()
|
|||
connect(m_textureGenerator, &TextureGenerator::finished, this, &Document::textureReady);
|
||||
connect(m_textureGenerator, &TextureGenerator::finished, thread, &QThread::quit);
|
||||
connect(thread, &QThread::finished, thread, &QThread::deleteLater);
|
||||
emit textureGenerating();
|
||||
thread->start();
|
||||
}
|
||||
|
||||
|
@ -2154,6 +2155,7 @@ void Document::postProcess()
|
|||
}
|
||||
|
||||
qDebug() << "Post processing..";
|
||||
emit postProcessing();
|
||||
|
||||
QThread *thread = new QThread;
|
||||
m_postProcessor = new MeshResultPostProcessor(*m_currentOutcome);
|
||||
|
@ -2162,7 +2164,6 @@ void Document::postProcess()
|
|||
connect(m_postProcessor, &MeshResultPostProcessor::finished, this, &Document::postProcessedMeshResultReady);
|
||||
connect(m_postProcessor, &MeshResultPostProcessor::finished, thread, &QThread::quit);
|
||||
connect(thread, &QThread::finished, thread, &QThread::deleteLater);
|
||||
emit postProcessing();
|
||||
thread->start();
|
||||
}
|
||||
|
||||
|
@ -3782,6 +3783,16 @@ bool Document::isMeshGenerating() const
|
|||
return nullptr != m_meshGenerator;
|
||||
}
|
||||
|
||||
bool Document::isPostProcessing() const
|
||||
{
|
||||
return nullptr != m_postProcessor;
|
||||
}
|
||||
|
||||
bool Document::isTextureGenerating() const
|
||||
{
|
||||
return nullptr != m_textureGenerator;
|
||||
}
|
||||
|
||||
void Document::copyNodes(std::set<QUuid> nodeIdSet) const
|
||||
{
|
||||
Snapshot snapshot;
|
||||
|
|
|
@ -558,6 +558,8 @@ public:
|
|||
const Outcome ¤tRiggedOutcome() const;
|
||||
bool currentRigSucceed() const;
|
||||
bool isMeshGenerating() const;
|
||||
bool isPostProcessing() const;
|
||||
bool isTextureGenerating() const;
|
||||
const QString &script() const;
|
||||
const std::map<QString, std::map<QString, QString>> &variables() const;
|
||||
const QString &scriptError() const;
|
||||
|
|
|
@ -238,7 +238,11 @@ DocumentWindow::DocumentWindow() :
|
|||
regenerateButton->showSpinner(true);
|
||||
});
|
||||
connect(m_document, &Document::resultTextureChanged, this, [=]() {
|
||||
if (!m_document->isMeshGenerating() &&
|
||||
!m_document->isPostProcessing() &&
|
||||
!m_document->isTextureGenerating()) {
|
||||
regenerateButton->showSpinner(false);
|
||||
}
|
||||
});
|
||||
connect(regenerateButton->button(), &QPushButton::clicked, m_document, &Document::regenerateMesh);
|
||||
|
||||
|
|
|
@ -1010,12 +1010,12 @@ MeshCombiner::Mesh *MeshGenerator::combineComponentMesh(const QString &component
|
|||
subGroupMeshIdStringList += componentChildGroupIdStringListString;
|
||||
multipleMeshes.push_back(std::make_tuple(childMesh, CombineMode::Normal, componentChildGroupIdStringListString));
|
||||
}
|
||||
MeshCombiner::Mesh *subGroupMesh = combineMultipleMeshes(multipleMeshes, foundColorSolubilitySetting);
|
||||
MeshCombiner::Mesh *subGroupMesh = combineMultipleMeshes(multipleMeshes, true/*foundColorSolubilitySetting*/);
|
||||
if (nullptr == subGroupMesh)
|
||||
continue;
|
||||
groupMeshes.push_back(std::make_tuple(subGroupMesh, group.first, subGroupMeshIdStringList.join("&")));
|
||||
}
|
||||
mesh = combineMultipleMeshes(groupMeshes, false);
|
||||
mesh = combineMultipleMeshes(groupMeshes, true);
|
||||
}
|
||||
|
||||
if (nullptr != mesh)
|
||||
|
|
Loading…
Reference in New Issue