summaryrefslogtreecommitdiff
path: root/module.cc
diff options
context:
space:
mode:
authorclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2009-06-24 10:59:15 (GMT)
committerclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2009-06-24 10:59:15 (GMT)
commitba42e6c30be19004f0c4351f51005bc5e5dabdca (patch)
tree718836294c363f8b31e806954f252933a9871795 /module.cc
parent12e8d77bc0e4a059feb0ead66de0a04a71fb8d67 (diff)
Clifford Wolf:
Preps for OpenCSG interface Invented AbstractPolyNode git-svn-id: http://svn.clifford.at/openscad/trunk@15 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'module.cc')
-rw-r--r--module.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/module.cc b/module.cc
index 9f9a21b..0d275a6 100644
--- a/module.cc
+++ b/module.cc
@@ -192,6 +192,13 @@ void destroy_builtin_modules()
builtin_modules.clear();
}
+int AbstractNode::idx_counter;
+
+AbstractNode::AbstractNode()
+{
+ idx = idx_counter++;
+}
+
AbstractNode::~AbstractNode()
{
foreach (AbstractNode *v, children)
@@ -211,9 +218,27 @@ CGAL_Nef_polyhedron AbstractNode::render_cgal_nef_polyhedron() const
#endif /* ENABLE_CGAL */
+#ifdef ENABLE_OPENCSG
+
+CSGTerm *AbstractNode::render_csg_term(double m[16]) const
+{
+ CSGTerm *t1 = NULL;
+ foreach(AbstractNode * v, children) {
+ CSGTerm *t2 = v->render_csg_term(m);
+ if (t2 && !t1) {
+ t1 = t2;
+ } else if (t2 && t1) {
+ t1 = new CSGTerm(CSGTerm::UNION, t1, t2);
+ }
+ }
+ return t1;
+}
+
+#endif /* ENABLE_OPENCSG */
+
QString AbstractNode::dump(QString indent) const
{
- QString text = indent + "group() {\n";
+ QString text = indent + QString("n%1: group() {\n").arg(idx);
foreach (AbstractNode *v, children)
text += v->dump(indent + QString("\t"));
return text + indent + "}\n";
contact: Jan Huwald // Impressum