Prepare for stitching line preview generating

master
Jeremy HU 2022-10-06 23:03:51 +11:00
parent 12197bdb44
commit 19748816fe
1 changed files with 11 additions and 1 deletions

View File

@ -997,9 +997,19 @@ std::unique_ptr<MeshCombiner::Mesh> MeshGenerator::combineComponentMesh(const st
} }
if (!stitchingParts.empty()) { if (!stitchingParts.empty()) {
auto stitchingMesh = combineStitchingMesh(stitchingParts, componentCache); auto stitchingMesh = combineStitchingMesh(stitchingParts, componentCache);
if (stitchingMesh && !stitchingMesh->isNull()) if (stitchingMesh && !stitchingMesh->isNull()) {
// Generate preview for each stitching line
ComponentPreview stitchingLinePreview;
if (stitchingMesh)
stitchingMesh->fetch(stitchingLinePreview.vertices, stitchingLinePreview.triangles);
stitchingLinePreview.color = Color(1.0, 1.0, 1.0, 0.2);
for (const auto &it: stitchingComponents)
addComponentPreview(it, ComponentPreview(stitchingLinePreview));
groupMeshes.emplace_back(std::make_tuple(std::move(stitchingMesh), CombineMode::Normal, String::join(stitchingComponents, ":"))); groupMeshes.emplace_back(std::make_tuple(std::move(stitchingMesh), CombineMode::Normal, String::join(stitchingComponents, ":")));
} }
}
mesh = combineMultipleMeshes(std::move(groupMeshes), true); mesh = combineMultipleMeshes(std::move(groupMeshes), true);
ComponentPreview preview; ComponentPreview preview;
if (mesh) if (mesh)