summaryrefslogtreecommitdiff
path: root/src/PolySetCGALRenderer.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2010-11-03 18:26:06 (GMT)
committerMarius Kintel <marius@kintel.net>2010-11-03 18:26:06 (GMT)
commit264608981cfcd65de8e64af8d97648a315d52bc1 (patch)
tree486fed9c5c750d0e0b8c75290d315632db22c578 /src/PolySetCGALRenderer.cc
parent4423c010301b8a94addee0ab0b3561023bba7290 (diff)
Fixed some issues with PolySetRenderer, causing e.g. extrusions to fail in OpenCSG mode
Diffstat (limited to 'src/PolySetCGALRenderer.cc')
-rw-r--r--src/PolySetCGALRenderer.cc29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/PolySetCGALRenderer.cc b/src/PolySetCGALRenderer.cc
index 38cc1cc..b91098d 100644
--- a/src/PolySetCGALRenderer.cc
+++ b/src/PolySetCGALRenderer.cc
@@ -14,8 +14,7 @@
PolySet *PolySetCGALRenderer::renderPolySet(const ProjectionNode &node, AbstractPolyNode::render_mode_e)
{
- // FIXME: create cacheid from node
- QString cacheid;
+ const string &cacheid = this->cgalrenderer.getTree().getString(node);
if (this->cache.contains(cacheid)) return this->cache[cacheid]->ps->link();
CGAL_Nef_polyhedron N = this->cgalrenderer.renderCGALMesh(node);
@@ -237,15 +236,22 @@ static void add_slice(PolySet *ps, DxfData::Path *pt, double rot1, double rot2,
PolySet *PolySetCGALRenderer::renderPolySet(const DxfLinearExtrudeNode &node, AbstractPolyNode::render_mode_e)
{
- // FIXME: create cacheid from node
- QString cacheid;
+ const string &cacheid = this->cgalrenderer.getTree().getString(node);
if (this->cache.contains(cacheid)) return this->cache[cacheid]->ps->link();
DxfData *dxf;
if (node.filename.isEmpty())
{
- CGAL_Nef_polyhedron N = this->cgalrenderer.renderCGALMesh(node);
+ // Before extruding, union all (2D) children nodes
+ // to a single DxfData, then tesselate this into a PolySet
+ CGAL_Nef_polyhedron N;
+ N.dim = 2;
+ foreach (AbstractNode * v, node.getChildren()) {
+ if (v->modinst->tag_background) continue;
+ N.p2 += this->cgalrenderer.renderCGALMesh(*v).p2;
+ }
+
dxf = new DxfData(N);
} else {
dxf = new DxfData(node.fn, node.fs, node.fa, node.filename, node.layername, node.origin_x, node.origin_y, node.scale);
@@ -320,15 +326,22 @@ PolySet *PolySetCGALRenderer::renderPolySet(const DxfLinearExtrudeNode &node, Ab
PolySet *PolySetCGALRenderer::renderPolySet(const DxfRotateExtrudeNode &node, AbstractPolyNode::render_mode_e)
{
- // FIXME: create cacheid from node
- QString cacheid;
+ const string &cacheid = this->cgalrenderer.getTree().getString(node);
if (this->cache.contains(cacheid)) return this->cache[cacheid]->ps->link();
DxfData *dxf;
if (node.filename.isEmpty())
{
- CGAL_Nef_polyhedron N = this->cgalrenderer.renderCGALMesh(node);
+ // Before extruding, union all (2D) children nodes
+ // to a single DxfData, then tesselate this into a PolySet
+ CGAL_Nef_polyhedron N;
+ N.dim = 2;
+ foreach (AbstractNode * v, node.getChildren()) {
+ if (v->modinst->tag_background) continue;
+ N.p2 += this->cgalrenderer.renderCGALMesh(*v).p2;
+ }
+
dxf = new DxfData(N);
} else {
dxf = new DxfData(node.fn, node.fs, node.fa, node.filename, node.layername, node.origin_x, node.origin_y, node.scale);
contact: Jan Huwald // Impressum