summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Preferences.cc8
-rw-r--r--src/mainwin.cc17
-rw-r--r--src/svg.cc3
3 files changed, 26 insertions, 2 deletions
diff --git a/src/Preferences.cc b/src/Preferences.cc
index e70a2a1..ec66094 100644
--- a/src/Preferences.cc
+++ b/src/Preferences.cc
@@ -30,7 +30,9 @@
#include <QKeyEvent>
#include <QSettings>
#include "PolySetCache.h"
+#ifdef ENABLE_CGAL
#include "CGALCache.h"
+#endif
Preferences *Preferences::instance = NULL;
@@ -75,7 +77,9 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent)
this->defaultmap["advanced/opencsg_show_warning"] = true;
this->defaultmap["advanced/enable_opencsg_opengl1x"] = true;
this->defaultmap["advanced/polysetCacheSize"] = uint(PolySetCache::instance()->maxSize());
+#ifdef ENABLE_CGAL
this->defaultmap["advanced/cgalCacheSize"] = uint(CGALCache::instance()->maxSize());
+#endif
this->defaultmap["advanced/openCSGLimit"] = 2000;
this->defaultmap["advanced/forceGoldfeather"] = false;
@@ -126,7 +130,9 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent)
// Advanced pane
QValidator *validator = new QIntValidator(this);
+#ifdef ENABLE_CGAL
this->cgalCacheSizeEdit->setValidator(validator);
+#endif
this->polysetCacheSizeEdit->setValidator(validator);
this->opencsgLimitEdit->setValidator(validator);
@@ -198,7 +204,9 @@ void Preferences::on_cgalCacheSizeEdit_textChanged(const QString &text)
{
QSettings settings;
settings.setValue("advanced/cgalCacheSize", text);
+#ifdef ENABLE_CGAL
CGALCache::instance()->setMaxSize(text.toULong());
+#endif
}
void Preferences::on_polysetCacheSizeEdit_textChanged(const QString &text)
diff --git a/src/mainwin.cc b/src/mainwin.cc
index 251c6e1..17b9ef7 100644
--- a/src/mainwin.cc
+++ b/src/mainwin.cc
@@ -89,6 +89,10 @@
#include "cgal.h"
#include "cgalworker.h"
+#else
+
+#include "PolySetEvaluator.h"
+
#endif // ENABLE_CGAL
#ifndef OPENCSG_VERSION_STRING
@@ -153,9 +157,11 @@ MainWindow::MainWindow(const QString &filename)
{
setupUi(this);
+#ifdef ENABLE_CGAL
this->cgalworker = new CGALWorker();
connect(this->cgalworker, SIGNAL(done(CGAL_Nef_polyhedron *)),
this, SLOT(actionRenderCGALDone(CGAL_Nef_polyhedron *)));
+#endif
register_builtin(root_ctx);
@@ -410,8 +416,10 @@ MainWindow::loadDesignSettings()
}
uint polySetCacheSize = Preferences::inst()->getValue("advanced/polysetCacheSize").toUInt();
PolySetCache::instance()->setMaxSize(polySetCacheSize);
+#ifdef ENABLE_CGAL
uint cgalCacheSize = Preferences::inst()->getValue("advanced/cgalCacheSize").toUInt();
CGALCache::instance()->setMaxSize(cgalCacheSize);
+#endif
}
MainWindow::~MainWindow()
@@ -677,8 +685,12 @@ void MainWindow::compileCSG(bool procevents)
progress_report_prep(this->root_node, report_func, this);
try {
+#ifdef ENABLE_CGAL
CGALEvaluator cgalevaluator(this->tree);
PolySetCGALEvaluator psevaluator(cgalevaluator);
+#else
+ PolySetEvaluator psevaluator(this->tree);
+#endif
CSGTermEvaluator csgrenderer(this->tree, &psevaluator);
this->root_raw_term = csgrenderer.evaluateCSGTerm(*root_node, highlight_terms, background_terms);
if (!root_raw_term) {
@@ -687,7 +699,9 @@ void MainWindow::compileCSG(bool procevents)
QApplication::processEvents();
}
PolySetCache::instance()->print();
+#ifdef ENABLE_CGAL
CGALCache::instance()->print();
+#endif
}
catch (const ProgressCancelException &e) {
PRINT("CSG generation cancelled.");
@@ -1196,8 +1210,9 @@ void MainWindow::actionRenderCGALDone(CGAL_Nef_polyhedron *root_N)
if (root_N) {
PolySetCache::instance()->print();
+#ifdef ENABLE_CGAL
CGALCache::instance()->print();
-
+#endif
if (!root_N->isNull()) {
if (root_N->dim == 2) {
PRINT(" Top level object is a 2D object:");
diff --git a/src/svg.cc b/src/svg.cc
index e5130b0..66e5797 100644
--- a/src/svg.cc
+++ b/src/svg.cc
@@ -1,3 +1,4 @@
+#ifdef ENABLE_CGAL
#include "cgalutils.h"
#include "svg.h"
#include <boost/algorithm/string.hpp>
@@ -246,4 +247,4 @@ std::string dump_svg( const CGAL_Nef_polyhedron3 &N )
} // namespace
-
+#endif // ENABLE_CGAL
contact: Jan Huwald // Impressum