summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CSGTermEvaluator.cc13
-rw-r--r--src/PolySetCGALEvaluator.cc8
-rw-r--r--src/PolySetCGALEvaluator.h1
-rw-r--r--src/PolySetEvaluator.h1
4 files changed, 21 insertions, 2 deletions
diff --git a/src/CSGTermEvaluator.cc b/src/CSGTermEvaluator.cc
index b59f4db..f280b2b 100644
--- a/src/CSGTermEvaluator.cc
+++ b/src/CSGTermEvaluator.cc
@@ -178,9 +178,18 @@ Response CSGTermEvaluator::visit(State &state, const ColorNode &node)
// FIXME: If we've got CGAL support, render this node as a CGAL union into a PolySet
Response CSGTermEvaluator::visit(State &state, const RenderNode &node)
{
- PRINT("WARNING: render() statement not implemented");
if (state.isPostfix()) {
- applyToChildren(node, CSGT_UNION);
+ CSGTerm *t1 = NULL;
+ // FIXME: Calling evaluator directly since we're not a PolyNode. Generalize this.
+ PolySet *ps = NULL;
+ if (this->psevaluator) {
+ ps = this->psevaluator->evaluatePolySet(node, AbstractPolyNode::RENDER_OPENCSG);
+ }
+ if (ps) {
+ t1 = evaluate_csg_term_from_ps(state, this->highlights, this->background,
+ ps, node.modinst, node);
+ }
+ this->stored_term[node.index()] = t1;
addToParent(state, node);
}
return ContinueTraversal;
diff --git a/src/PolySetCGALEvaluator.cc b/src/PolySetCGALEvaluator.cc
index c42d806..c7ce979 100644
--- a/src/PolySetCGALEvaluator.cc
+++ b/src/PolySetCGALEvaluator.cc
@@ -6,6 +6,7 @@
#include "dxflinextrudenode.h"
#include "dxfrotextrudenode.h"
#include "cgaladvnode.h"
+#include "rendernode.h"
#include "dxfdata.h"
#include "dxftess.h"
#include "module.h"
@@ -376,6 +377,13 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const CgaladvNode &node, Abstract
return ps;
}
+PolySet *PolySetCGALEvaluator::evaluatePolySet(const RenderNode &node, AbstractPolyNode::render_mode_e)
+{
+ CGAL_Nef_polyhedron N = this->cgalevaluator.evaluateCGALMesh(node);
+ PolySet *ps = NULL;
+ if (!N.empty()) ps = N.convertToPolyset();
+ return ps;
+}
PolySet *PolySetCGALEvaluator::rotateDxfData(const DxfRotateExtrudeNode &node, DxfData &dxf)
{
diff --git a/src/PolySetCGALEvaluator.h b/src/PolySetCGALEvaluator.h
index cf3c5b2..f5b8665 100644
--- a/src/PolySetCGALEvaluator.h
+++ b/src/PolySetCGALEvaluator.h
@@ -17,6 +17,7 @@ public:
virtual PolySet *evaluatePolySet(const DxfLinearExtrudeNode &node, AbstractPolyNode::render_mode_e);
virtual PolySet *evaluatePolySet(const DxfRotateExtrudeNode &node, AbstractPolyNode::render_mode_e);
virtual PolySet *evaluatePolySet(const CgaladvNode &node, AbstractPolyNode::render_mode_e);
+ virtual PolySet *evaluatePolySet(const RenderNode &node, AbstractPolyNode::render_mode_e);
protected:
PolySet *extrudeDxfData(const DxfLinearExtrudeNode &node, class DxfData &dxf);
diff --git a/src/PolySetEvaluator.h b/src/PolySetEvaluator.h
index 9a72ff7..70ec7ed 100644
--- a/src/PolySetEvaluator.h
+++ b/src/PolySetEvaluator.h
@@ -17,6 +17,7 @@ public:
virtual PolySet *evaluatePolySet(const class DxfLinearExtrudeNode &, AbstractPolyNode::render_mode_e) = 0;
virtual PolySet *evaluatePolySet(const class DxfRotateExtrudeNode &, AbstractPolyNode::render_mode_e) = 0;
virtual PolySet *evaluatePolySet(const class CgaladvNode &, AbstractPolyNode::render_mode_e) = 0;
+ virtual PolySet *evaluatePolySet(const class RenderNode &, AbstractPolyNode::render_mode_e) = 0;
void clearCache() {
this->cache.clear();
contact: Jan Huwald // Impressum