From c9efa79ddbb06b83202f0a645b5f855e9c46ad17 Mon Sep 17 00:00:00 2001 From: Jeremy Hu Date: Wed, 11 Apr 2018 17:37:28 +0800 Subject: [PATCH] Fix union mesh, add missing files. --- src/meshgenerator.cpp | 19 +++++++++++++------ src/version.h | 10 ++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 src/version.h diff --git a/src/meshgenerator.cpp b/src/meshgenerator.cpp index 59e29feb..43e3d1a8 100644 --- a/src/meshgenerator.cpp +++ b/src/meshgenerator.cpp @@ -225,6 +225,8 @@ void MeshGenerator::process() bmeshNodeMap[nodeIt.first] = bmeshNodeId; } + bool broken = false; + std::vector meshIds; std::vector subdivMeshIds; for (const auto &partIdIt: m_snapshot->partIdList) { @@ -237,6 +239,8 @@ void MeshGenerator::process() continue; int bmeshId = partBmeshMap[partIdIt]; int meshId = meshlite_bmesh_generate_mesh(meshliteContext, bmeshId); + if (meshlite_bmesh_error_count(meshliteContext, bmeshId) != 0) + broken = true; bool subdived = isTrueValueString(part->second["subdived"]); if (m_requirePartPreviewMap.find(partIdIt) != m_requirePartPreviewMap.end()) { ModelOfflineRender *render = m_partPreviewRenderMap[partIdIt]; @@ -257,14 +261,17 @@ void MeshGenerator::process() meshIds.push_back(meshId); } - bool broken = false; if (!subdivMeshIds.empty()) { int mergedMeshId = 0; - int errorCount = 0; - mergedMeshId = unionMeshs(meshliteContext, subdivMeshIds, &errorCount); - if (errorCount) - broken = true; - else if (mergedMeshId > 0) + if (subdivMeshIds.size() > 1) { + int errorCount = 0; + mergedMeshId = unionMeshs(meshliteContext, subdivMeshIds, &errorCount); + if (errorCount) + broken = true; + } else { + mergedMeshId = subdivMeshIds[0]; + } + if (mergedMeshId > 0) mergedMeshId = meshlite_combine_coplanar_faces(meshliteContext, mergedMeshId); if (mergedMeshId > 0) { int subdivedMeshId = subdivMesh(meshliteContext, mergedMeshId); diff --git a/src/version.h b/src/version.h new file mode 100644 index 00000000..6149f537 --- /dev/null +++ b/src/version.h @@ -0,0 +1,10 @@ +#ifndef VERSION_H +#define VERSION_H + +#define APP_NAME PROJECT_DEFINED_APP_NAME +#define APP_VER PROJECT_DEFINED_APP_VER +#define APP_HUMAN_VER PROJECT_DEFINED_APP_HUMAN_VER +#define APP_REPOSITORY_URL PROJECT_DEFINED_APP_REPOSITORY_URL +#define APP_ISSUES_URL PROJECT_DEFINED_APP_ISSUES_URL + +#endif