diff --git a/include/qVoxFallDialog.h b/include/qVoxFallDialog.h index 525e9d2..02c0c75 100644 --- a/include/qVoxFallDialog.h +++ b/include/qVoxFallDialog.h @@ -53,10 +53,10 @@ public: //! Returns the max number of threads to use int getMaxThreadCount() const; - void qVoxFallDialog::loadParamsFromPersistentSettings(); - void qVoxFallDialog::loadParamsFrom(const QSettings& settings); - void qVoxFallDialog::saveParamsToPersistentSettings(); - void qVoxFallDialog::saveParamsTo(QSettings& settings); + void loadParamsFromPersistentSettings(); + void loadParamsFrom(const QSettings& settings); + void saveParamsToPersistentSettings(); + void saveParamsTo(QSettings& settings); protected: diff --git a/include/qVoxFallTools.h b/include/qVoxFallTools.h index d55d23e..ee7e486 100644 --- a/include/qVoxFallTools.h +++ b/include/qVoxFallTools.h @@ -29,6 +29,8 @@ #include #include #include +#include + #include @@ -50,13 +52,13 @@ public: const Vector3Tpl Y(-std::sin(zRot), std::cos(zRot), 0); const Vector3Tpl Z(0, 0, 1); const Vector3Tpl Tr(0, 0, 0); - matrix = &ccGLMatrix::ccGLMatrix(X, Y, Z, Tr); + matrix = new ccGLMatrix(X, Y, Z, Tr); const Vector3Tpl rX(std::cos(-zRot), std::sin(-zRot), 0); const Vector3Tpl rY(-std::sin(-zRot), std::cos(-zRot), 0); const Vector3Tpl rZ(0, 0, 1); const Vector3Tpl rTr(0, 0, 0); - inverse = &ccGLMatrix::ccGLMatrix(rX, rY, rZ, rTr); + inverse = new ccGLMatrix(rX, rY, rZ, rTr); } static ccBox* CreateVoxelMesh(CCVector3 V, float voxelSize, int voxelIdx); diff --git a/src/qVoxFallProcess.cpp b/src/qVoxFallProcess.cpp index fc27902..36e4cb6 100644 --- a/src/qVoxFallProcess.cpp +++ b/src/qVoxFallProcess.cpp @@ -18,6 +18,7 @@ #include "qVoxFallProcess.h" //system +#include #include //local @@ -287,7 +288,7 @@ bool ClusterEmptySpace(int maxThreads, int voxelCount, GenericProgressCallback* bool ComputeClusterVolume(int maxThreads, int clusterCount, ccHObject* clusterGroup = nullptr) { - bool error = false; + std::atomic error(false); CCVector3 minBound = s_VoxFallParams.maxBound; CCVector3 maxBound = s_VoxFallParams.minBound; int count = 0; @@ -303,6 +304,10 @@ bool ComputeClusterVolume(int maxThreads, int clusterCount, ccHObject* clusterGr { int index = s_VoxFallParams.clusterIndices[i]; + if(error) { + continue; + } + std::unordered_set nbs_next(s_VoxFallParams.nbs[index].begin(), s_VoxFallParams.nbs[index].end()); while (!nbs_next.empty()) { @@ -346,9 +351,7 @@ bool ComputeClusterVolume(int maxThreads, int clusterCount, ccHObject* clusterGr if (!s_VoxFallParams.nProgress->oneStep()) { error = true; - break; } - if (error) break; } if (s_VoxFallParams.exportLossGain) @@ -439,7 +442,7 @@ bool qVoxFallProcess::Compute(const qVoxFallDialog& dlg, QString& errorMessage, s_VoxFallParams.isEmptyBefore.resize(voxelGrid.innerCellCount(), true); if (s_VoxFallParams.exportBlocksAsMeshes) { - s_VoxFallParams.clusters.resize(voxelGrid.innerCellCount(), NULL); + s_VoxFallParams.clusters.resize(voxelGrid.innerCellCount(), 0); } //allocate cluster ID SF diff --git a/src/qVoxFallTools.cpp b/src/qVoxFallTools.cpp index 49c3497..f296a60 100644 --- a/src/qVoxFallTools.cpp +++ b/src/qVoxFallTools.cpp @@ -67,7 +67,7 @@ ccBox* qVoxFallTransform::CreateVoxelMesh(CCVector3 V, float voxelSize, int voxe const Vector3Tpl X(1, 0, 0); const Vector3Tpl Y(0, 1, 0); const Vector3Tpl Z(0, 0, 1); - ccGLMatrix* matrix = &ccGLMatrix::ccGLMatrix(X, Y, Z, V); + ccGLMatrix* matrix = new ccGLMatrix(X, Y, Z, V); ccBox* voxel = new ccBox(dims, matrix, name); voxel->computePerTriangleNormals();