Implemented render()

stl_dim
Marius Kintel 2011-09-06 18:31:22 +02:00
parent 3b16fdafd2
commit 0e7c6473fa
4 changed files with 21 additions and 2 deletions

View File

@ -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;

View File

@ -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)
{

View File

@ -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);

View File

@ -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();