diff options
author | Marius Kintel <marius@kintel.net> | 2011-12-22 03:12:15 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2011-12-22 03:12:15 (GMT) |
commit | 8d5be2c5247f806fb3ec9c9a197ae97b5d565dc7 (patch) | |
tree | 154a4c2a15a52e99cdd82e181db3b6298a7ad44b /src/csgterm.h | |
parent | d7ca192077f127a2d05bed73d1814a8045823335 (diff) |
Implemented CSG tree pruning - this should significantly improve performance of difficult models in OpenCSG preview mode
Diffstat (limited to 'src/csgterm.h')
-rw-r--r-- | src/csgterm.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/csgterm.h b/src/csgterm.h index 1583c62..4930349 100644 --- a/src/csgterm.h +++ b/src/csgterm.h @@ -18,23 +18,35 @@ public: TYPE_DIFFERENCE }; + static shared_ptr<CSGTerm> createCSGTerm(type_e type, shared_ptr<CSGTerm> left, shared_ptr<CSGTerm> right); + static shared_ptr<CSGTerm> createCSGTerm(type_e type, CSGTerm *left, CSGTerm *right); + type_e type; shared_ptr<PolySet> polyset; std::string label; shared_ptr<CSGTerm> left; shared_ptr<CSGTerm> right; - Transform3d m; - double color[4]; + BoundingBox bbox; CSGTerm(const shared_ptr<PolySet> &polyset, const Transform3d &matrix, const double color[4], const std::string &label); - CSGTerm(type_e type, shared_ptr<CSGTerm> left, shared_ptr<CSGTerm> right); - CSGTerm(type_e type, CSGTerm *left, CSGTerm *right); ~CSGTerm(); - static shared_ptr<CSGTerm> normalize(shared_ptr<CSGTerm> &term); + const BoundingBox &getBoundingBox() const { return this->bbox; } + + static shared_ptr<CSGTerm> normalize(shared_ptr<CSGTerm> term); static bool normalize_tail(shared_ptr<CSGTerm> &term); std::string dump(); +private: + CSGTerm(type_e type, shared_ptr<CSGTerm> left, shared_ptr<CSGTerm> right); + CSGTerm(type_e type, CSGTerm *left, CSGTerm *right); + + void initBoundingBox(); + + Transform3d m; + double color[4]; + + friend class CSGChain; }; class CSGChain |