summaryrefslogtreecommitdiff
path: root/dxfrotextrude.cc
diff options
context:
space:
mode:
authorclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2009-07-28 12:53:52 (GMT)
committerclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2009-07-28 12:53:52 (GMT)
commit7b4cc84cdab040d92b4b98a2ce1fcfaea829bb5a (patch)
treead1b64122844847e2727cdc377356db5dbe63198 /dxfrotextrude.cc
parentb7cb05dbbd8d9d249c21178bc0adc747c2f5fc17 (diff)
Clifford Wolf:
Added dxf polyset caching git-svn-id: http://svn.clifford.at/openscad/trunk@83 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'dxfrotextrude.cc')
-rw-r--r--dxfrotextrude.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/dxfrotextrude.cc b/dxfrotextrude.cc
index a622b91..955dbc8 100644
--- a/dxfrotextrude.cc
+++ b/dxfrotextrude.cc
@@ -89,8 +89,15 @@ void register_builtin_dxf_rotate_extrude()
builtin_modules["dxf_rotate_extrude"] = new DxfRotateExtrudeModule();
}
+static QCache<QString,PolySetPtr> ps_cache(100);
+
PolySet *DxfRotateExtrudeNode::render_polyset(render_mode_e) const
{
+ QString key = mk_cache_id();
+
+ if (ps_cache.contains(key))
+ return ps_cache[key]->ps->link();
+
DxfData dxf(fn, fs, fa, filename, layername, origin_x, origin_y, scale);
PolySet *ps = new PolySet();
@@ -151,6 +158,7 @@ PolySet *DxfRotateExtrudeNode::render_polyset(render_mode_e) const
}
}
+ ps_cache.insert(key, new PolySetPtr(ps->link()));
return ps;
}
@@ -162,9 +170,11 @@ QString DxfRotateExtrudeNode::dump(QString indent) const
memset(&st, 0, sizeof(struct stat));
stat(filename.toAscii().data(), &st);
text.sprintf("dxf_rotate_extrude(file = \"%s\", cache = \"%x.%x\", layer = \"%s\", "
- "origin = [ %f %f ], scale = %f, $fn = %f, $fa = %f, $fs = %f);\n",
+ "origin = [ %f %f ], scale = %f, convexity = %d, "
+ "$fn = %f, $fa = %f, $fs = %f);\n",
filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size,
- layername.toAscii().data(), origin_x, origin_y, scale, fn, fs, fa);
+ layername.toAscii().data(), origin_x, origin_y, scale, convexity,
+ fn, fs, fa);
((AbstractNode*)this)->dump_cache = indent + QString("n%1: ").arg(idx) + text;
}
return dump_cache;
contact: Jan Huwald // Impressum