diff options
author | Marius Kintel <marius@kintel.net> | 2011-09-11 05:33:18 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2011-09-11 05:33:18 (GMT) |
commit | c0641d6916775309d64944ca121cc736f0c8d7a1 (patch) | |
tree | 801e0b5d67d13ff4773c5906c9cb68d271a2be02 /src/csgterm.cc | |
parent | 09cc0496f7ce61e2bcbce80e067e0fac8054599a (diff) |
Reenabled PolySet caching. Pass shared_ptrs to polysets around to better manage memory
Diffstat (limited to 'src/csgterm.cc')
-rw-r--r-- | src/csgterm.cc | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/csgterm.cc b/src/csgterm.cc index 91497b4..8306aaf 100644 --- a/src/csgterm.cc +++ b/src/csgterm.cc @@ -47,24 +47,17 @@ */ -CSGTerm::CSGTerm(PolySet *polyset, const double matrix[16], const double color[4], const std::string &label) +CSGTerm::CSGTerm(const shared_ptr<PolySet> &polyset, const double matrix[16], const double color[4], const std::string &label) + : type(TYPE_PRIMITIVE), polyset(polyset), label(label), left(NULL), right(NULL) { - this->type = TYPE_PRIMITIVE; - this->polyset = polyset; - this->label = label; - this->left = NULL; - this->right = NULL; for (int i = 0; i < 16; i++) this->m[i] = matrix[i]; for (int i = 0; i < 4; i++) this->color[i] = color[i]; refcounter = 1; } CSGTerm::CSGTerm(type_e type, CSGTerm *left, CSGTerm *right) + : type(type), left(left), right(right) { - this->type = type; - this->polyset = NULL; - this->left = left; - this->right = right; refcounter = 1; } @@ -195,7 +188,7 @@ CSGChain::CSGChain() { } -void CSGChain::add(PolySet *polyset, double *m, double *color, CSGTerm::type_e type, std::string label) +void CSGChain::add(const shared_ptr<PolySet> &polyset, double *m, double *color, CSGTerm::type_e type, std::string label) { polysets.push_back(polyset); matrices.push_back(m); |