Add single node mesh
parent
57b1a802f3
commit
7c9626bcab
|
@ -38,6 +38,7 @@
|
|||
#include <dust3d/mesh/trim_vertices.h>
|
||||
#include <dust3d/mesh/tube_mesh_builder.h>
|
||||
#include <dust3d/mesh/weld_vertices.h>
|
||||
#include <dust3d/mesh/box_mesh.h>
|
||||
#include <functional>
|
||||
|
||||
namespace dust3d {
|
||||
|
@ -663,23 +664,28 @@ std::unique_ptr<MeshCombiner::Mesh> MeshGenerator::combinePartMesh(const std::st
|
|||
partCache.joined = (target == PartTarget::Model && !isDisabled);
|
||||
|
||||
if (PartTarget::Model == target) {
|
||||
std::unique_ptr<TubeMeshBuilder> tubeMeshBuilder;
|
||||
TubeMeshBuilder::BuildParameters buildParameters;
|
||||
buildParameters.deformThickness = deformThickness;
|
||||
buildParameters.deformWidth = deformWidth;
|
||||
buildParameters.deformUnified = deformUnified;
|
||||
buildParameters.baseNormalRotation = cutRotation * Math::Pi;
|
||||
buildParameters.cutFace = cutTemplate;
|
||||
buildParameters.frontEndRounded = buildParameters.backEndRounded = rounded;
|
||||
tubeMeshBuilder = std::make_unique<TubeMeshBuilder>(buildParameters, std::move(meshNodes), isCircle);
|
||||
tubeMeshBuilder->build();
|
||||
partCache.vertices = tubeMeshBuilder->generatedVertices();
|
||||
partCache.faces = tubeMeshBuilder->generatedFaces();
|
||||
if (!__mirrorFromPartId.empty()) {
|
||||
for (auto& it : partCache.vertices)
|
||||
it.setX(-it.x());
|
||||
for (auto& it : partCache.faces)
|
||||
std::reverse(it.begin(), it.end());
|
||||
if (1 == meshNodes.size()) {
|
||||
size_t subdivideTimes = subdived ? 1 : 0;
|
||||
buildBoxMesh(meshNodes[0].origin, meshNodes[0].radius, subdivideTimes, partCache.vertices, partCache.faces);
|
||||
} else {
|
||||
std::unique_ptr<TubeMeshBuilder> tubeMeshBuilder;
|
||||
TubeMeshBuilder::BuildParameters buildParameters;
|
||||
buildParameters.deformThickness = deformThickness;
|
||||
buildParameters.deformWidth = deformWidth;
|
||||
buildParameters.deformUnified = deformUnified;
|
||||
buildParameters.baseNormalRotation = cutRotation * Math::Pi;
|
||||
buildParameters.cutFace = cutTemplate;
|
||||
buildParameters.frontEndRounded = buildParameters.backEndRounded = rounded;
|
||||
tubeMeshBuilder = std::make_unique<TubeMeshBuilder>(buildParameters, std::move(meshNodes), isCircle);
|
||||
tubeMeshBuilder->build();
|
||||
partCache.vertices = tubeMeshBuilder->generatedVertices();
|
||||
partCache.faces = tubeMeshBuilder->generatedFaces();
|
||||
if (!__mirrorFromPartId.empty()) {
|
||||
for (auto& it : partCache.vertices)
|
||||
it.setX(-it.x());
|
||||
for (auto& it : partCache.faces)
|
||||
std::reverse(it.begin(), it.end());
|
||||
}
|
||||
}
|
||||
} else if (PartTarget::CutFace == target) {
|
||||
std::unique_ptr<SectionPreviewMeshBuilder> sectionPreviewMeshBuilder;
|
||||
|
|
Loading…
Reference in New Issue