summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOskar Linde <oskar.linde@gmail.com>2014-02-03 14:10:46 (GMT)
committerMarius Kintel <marius@kintel.net>2014-02-06 05:49:41 (GMT)
commit6a1d91dc76ec819e85b180b8cdaf40ddd639a538 (patch)
treea91b502ae5ea6031b9f428b472e7104c847fa3fa
parent86d25f04b7da2c520b963f041542b88fd644d1a0 (diff)
Remove automatic validity check at end of render
In more complex cases, the final Nef_Polyhedron is_valid check() took up to 30 % of the total rendering time just to be able to say Valid: YES. In the case of cached geometry, the validity check was totally dominating the execution time when doing a render. This patch removes the automatic validity check, instead adding a menu command "Check Validity". Conflicts: src/mainwin.cc
-rw-r--r--src/MainWindow.h1
-rw-r--r--src/MainWindow.ui6
-rw-r--r--src/mainwin.cc29
3 files changed, 35 insertions, 1 deletions
diff --git a/src/MainWindow.h b/src/MainWindow.h
index e16f5b4..f04a6f1 100644
--- a/src/MainWindow.h
+++ b/src/MainWindow.h
@@ -137,6 +137,7 @@ private slots:
void actionRenderCGALDone(class CGAL_Nef_polyhedron *);
void cgalRender();
#endif
+ void actionCheckValidity();
void actionDisplayAST();
void actionDisplayCSGTree();
void actionDisplayCSGProducts();
diff --git a/src/MainWindow.ui b/src/MainWindow.ui
index ddd69ee..a79d054 100644
--- a/src/MainWindow.ui
+++ b/src/MainWindow.ui
@@ -316,6 +316,7 @@
<addaction name="designActionCompile"/>
<addaction name="designActionCompileAndRender"/>
<addaction name="separator"/>
+ <addaction name="designCheckValidity"/>
<addaction name="designActionDisplayAST"/>
<addaction name="designActionDisplayCSGTree"/>
<addaction name="designActionDisplayCSGProducts"/>
@@ -557,6 +558,11 @@
<string>F6</string>
</property>
</action>
+ <action name="designCheckValidity">
+ <property name="text">
+ <string>Check Validity</string>
+ </property>
+ </action>
<action name="designActionDisplayAST">
<property name="text">
<string>Display &amp;AST...</string>
diff --git a/src/mainwin.cc b/src/mainwin.cc
index 742b380..a64caa2 100644
--- a/src/mainwin.cc
+++ b/src/mainwin.cc
@@ -301,6 +301,7 @@ MainWindow::MainWindow(const QString &filename)
#else
this->designActionCompileAndRender->setVisible(false);
#endif
+ connect(this->designCheckValidity, SIGNAL(triggered()), this, SLOT(actionCheckValidity()));
connect(this->designActionDisplayAST, SIGNAL(triggered()), this, SLOT(actionDisplayAST()));
connect(this->designActionDisplayCSGTree, SIGNAL(triggered()), this, SLOT(actionDisplayCSGTree()));
connect(this->designActionDisplayCSGProducts, SIGNAL(triggered()), this, SLOT(actionDisplayCSGProducts()));
@@ -1446,7 +1447,6 @@ void MainWindow::actionRenderCGALDone(CGAL_Nef_polyhedron *root_N)
if (root_N->dim == 3) {
PRINT(" Top level object is a 3D object:");
PRINTB(" Simple: %6s", (root_N->p3->is_simple() ? "yes" : "no"));
- PRINTB(" Valid: %6s", (root_N->p3->is_valid() ? "yes" : "no"));
PRINTB(" Vertices: %6d", root_N->p3->number_of_vertices());
PRINTB(" Halfedges: %6d", root_N->p3->number_of_halfedges());
PRINTB(" Edges: %6d", root_N->p3->number_of_edges());
@@ -1540,6 +1540,33 @@ void MainWindow::actionDisplayCSGProducts()
clearCurrentOutput();
}
+void MainWindow::actionCheckValidity() {
+ if (GuiLocker::isLocked()) return;
+ GuiLocker lock;
+#ifdef ENABLE_CGAL
+ setCurrentOutput();
+
+ if (!this->root_geom) {
+ PRINT("Nothing to validate! Try building first (press F6).");
+ clearCurrentOutput();
+ return;
+ }
+
+ if (this->root_geom->getDimension() != 3) {
+ PRINT("Current top level object is not a 3D object.");
+ clearCurrentOutput();
+ return;
+ }
+
+ bool valid = false;
+ if (const CGAL_Nef_polyhedron *N = dynamic_cast<const CGAL_Nef_polyhedron *>(this->root_geom.get()))
+ valid = N->p3->is_valid();
+
+ PRINTB(" Valid: %6s", (valid ? "yes" : "no"));
+ clearCurrentOutput();
+#endif /* ENABLE_CGAL */
+}
+
#ifdef ENABLE_CGAL
void MainWindow::actionExportSTLorOFF(bool stl_mode)
#else
contact: Jan Huwald // Impressum