summaryrefslogtreecommitdiff
path: root/src/CGALRenderer.h
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2010-04-12 00:16:36 (GMT)
committerMarius Kintel <marius@kintel.net>2010-10-31 00:42:35 (GMT)
commite8e213b3c9ce0580045ea6e7e86b00ab41d4c58b (patch)
treecb32e67b6334aa1f1dc62aa4a0686a22782e7f77 /src/CGALRenderer.h
parent53a9953b7dc4ab4a366046c91529b32fb6652551 (diff)
Another refactoring session:
o mk_cache_id() obsoleted by removing the node index from the dump o node index output removed from each node and make optional in NodeDumper o The visitors are no longer global, but associated with a tree o Added Tree class to manage node trees and the (now implicit) dump cache o Moved PolySet cache into PolySetRenderer
Diffstat (limited to 'src/CGALRenderer.h')
-rw-r--r--src/CGALRenderer.h15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/CGALRenderer.h b/src/CGALRenderer.h
index fc7e0c4..0492c86 100644
--- a/src/CGALRenderer.h
+++ b/src/CGALRenderer.h
@@ -22,8 +22,8 @@ class CGALRenderer : public Visitor
{
public:
enum CsgOp {UNION, INTERSECTION, DIFFERENCE, MINKOWSKI};
- // FIXME: If a cache is not give, we need to fix this ourselves
- CGALRenderer(const NodeCache<string> &dumpcache) : root(NULL), dumpcache(dumpcache) {}
+ // FIXME: If a cache is not given, we need to fix this ourselves
+ CGALRenderer(QHash<QString, CGAL_Nef_polyhedron> &cache, const NodeCache<string> &dumpcache) : cache(cache), dumpcache(dumpcache) {}
virtual ~CGALRenderer() {}
virtual Response visit(const State &state, const AbstractNode &node);
@@ -32,14 +32,9 @@ public:
virtual Response visit(const State &state, const TransformNode &node);
virtual Response visit(const State &state, const AbstractPolyNode &node);
- QHash<QString, CGAL_Nef_polyhedron> &getCache() { return this->cache; }
-
CGAL_Nef_polyhedron renderCGALMesh(const AbstractNode &node);
CGAL_Nef_polyhedron renderCGALMesh(const PolySet &polyset);
- // FIXME: Questionable design...
- static CGALRenderer *renderer() { return global_renderer; }
- static void setRenderer(CGALRenderer *r) { global_renderer = r; }
private:
void addToParent(const State &state, const AbstractNode &node);
bool isCached(const AbstractNode &node) const;
@@ -48,15 +43,11 @@ private:
void applyToChildren(const AbstractNode &node, CGALRenderer::CsgOp op);
string currindent;
- const AbstractNode *root;
typedef list<pair<const AbstractNode *, QString> > ChildList;
map<int, ChildList> visitedchildren;
- // FIXME: enforce some maximum cache size (old version had 100K vertices as limit)
- QHash<QString, CGAL_Nef_polyhedron> cache;
+ QHash<QString, CGAL_Nef_polyhedron> &cache;
const NodeCache<string> &dumpcache;
-
- static CGALRenderer *global_renderer;
};
#endif
contact: Jan Huwald // Impressum