Save nodes cut faces
parent
713935adb5
commit
ad244c4659
|
@ -28,6 +28,7 @@ MeshGenerator::~MeshGenerator()
|
|||
delete m_snapshot;
|
||||
delete m_outcome;
|
||||
delete m_cutFaceTransforms;
|
||||
delete m_nodesCutFaces;
|
||||
}
|
||||
|
||||
bool MeshGenerator::isSucceed()
|
||||
|
@ -68,6 +69,13 @@ std::map<QUuid, nodemesh::Builder::CutFaceTransform> *MeshGenerator::takeCutFace
|
|||
return cutFaceTransforms;
|
||||
}
|
||||
|
||||
std::map<QUuid, std::map<QString, std::tuple<float, float, float>>> *MeshGenerator::takeNodesCutFaces()
|
||||
{
|
||||
auto nodesCutFaces = m_nodesCutFaces;
|
||||
m_nodesCutFaces = nullptr;
|
||||
return nodesCutFaces;
|
||||
}
|
||||
|
||||
void MeshGenerator::collectParts()
|
||||
{
|
||||
for (const auto &node: m_snapshot->nodes) {
|
||||
|
@ -182,6 +190,7 @@ nodemesh::Combiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdSt
|
|||
auto target = PartTargetFromString(valueOfKeyInMapOrEmpty(part, "target").toUtf8().constData());
|
||||
auto base = PartBaseFromString(valueOfKeyInMapOrEmpty(part, "base").toUtf8().constData());
|
||||
|
||||
std::map<QString, std::tuple<float, float, float>> cutFaceNodeMap;
|
||||
std::vector<QVector2D> cutTemplate;
|
||||
QString cutFaceString = valueOfKeyInMapOrEmpty(part, "cutFace");
|
||||
QUuid cutFaceLinkedPartId = QUuid(cutFaceString);
|
||||
|
@ -191,7 +200,6 @@ nodemesh::Combiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdSt
|
|||
qDebug() << "Find cut face linked part failed:" << cutFaceString;
|
||||
} else {
|
||||
// Build node info map
|
||||
std::map<QString, std::tuple<float, float, float>> cutFaceNodeMap;
|
||||
for (const auto &nodeIdString: m_partNodeIds[cutFaceString]) {
|
||||
auto findNode = m_snapshot->nodes.find(nodeIdString);
|
||||
if (findNode == m_snapshot->nodes.end()) {
|
||||
|
@ -486,8 +494,11 @@ nodemesh::Combiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdSt
|
|||
continue;
|
||||
const QString &nodeIdString = nodeIndexToIdStringMap[node.originNodeIndex];
|
||||
const nodemesh::Builder::CutFaceTransform *cutFaceTransform = builder->nodeAdjustableCutFaceTransform(builderNodeIndices[i]);
|
||||
if (nullptr != cutFaceTransform)
|
||||
m_cutFaceTransforms->insert({QUuid(nodeIdString), *cutFaceTransform});
|
||||
if (nullptr != cutFaceTransform) {
|
||||
QUuid nodeId = QUuid(nodeIdString);
|
||||
m_cutFaceTransforms->insert({nodeId, *cutFaceTransform});
|
||||
m_nodesCutFaces->insert({nodeId, cutFaceNodeMap});
|
||||
}
|
||||
}
|
||||
|
||||
partCache.vertices = builder->generatedVertices();
|
||||
|
@ -982,6 +993,7 @@ void MeshGenerator::generate()
|
|||
|
||||
m_outcome = new Outcome;
|
||||
m_cutFaceTransforms = new std::map<QUuid, nodemesh::Builder::CutFaceTransform>;
|
||||
m_nodesCutFaces = new std::map<QUuid, std::map<QString, std::tuple<float, float, float>>>;
|
||||
|
||||
bool needDeleteCacheContext = false;
|
||||
if (nullptr == m_cacheContext) {
|
||||
|
|
|
@ -61,6 +61,7 @@ public:
|
|||
const std::set<QUuid> &generatedPreviewPartIds();
|
||||
Outcome *takeOutcome();
|
||||
std::map<QUuid, nodemesh::Builder::CutFaceTransform> *takeCutFaceTransforms();
|
||||
std::map<QUuid, std::map<QString, std::tuple<float, float, float>>> *takeNodesCutFaces();
|
||||
void generate();
|
||||
void setGeneratedCacheContext(GeneratedCacheContext *cacheContext);
|
||||
void setSmoothShadingThresholdAngleDegrees(float degrees);
|
||||
|
@ -89,6 +90,7 @@ private:
|
|||
bool m_cacheEnabled = false;
|
||||
float m_smoothShadingThresholdAngleDegrees = 60;
|
||||
std::map<QUuid, nodemesh::Builder::CutFaceTransform> *m_cutFaceTransforms = nullptr;
|
||||
std::map<QUuid, std::map<QString, std::tuple<float, float, float>>> *m_nodesCutFaces = nullptr;
|
||||
|
||||
void collectParts();
|
||||
bool checkIsComponentDirty(const QString &componentIdString);
|
||||
|
|
Loading…
Reference in New Issue