summaryrefslogtreecommitdiff
path: root/src/csgterm.h
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2013-05-24 22:40:09 (GMT)
committerMarius Kintel <marius@kintel.net>2013-05-24 22:40:09 (GMT)
commite1766faeeda4218a453121ec81f8007cc1a1734d (patch)
tree409e8ae7f7fb2065499cf44b038497b6a5daf689 /src/csgterm.h
parentef9d8a853be1a6d6ca48239fcc79106ba374ee21 (diff)
Initial implementation of improved operator handling. Provides the bulk of work for #304
Diffstat (limited to 'src/csgterm.h')
-rw-r--r--src/csgterm.h38
1 files changed, 30 insertions, 8 deletions
diff --git a/src/csgterm.h b/src/csgterm.h
index 566ebc3..94878e5 100644
--- a/src/csgterm.h
+++ b/src/csgterm.h
@@ -18,6 +18,12 @@ public:
TYPE_DIFFERENCE
};
+ enum Flag {
+ FLAG_NONE = 0x00,
+ FLAG_BACKGROUND = 0x01,
+ FLAG_HIGHLIGHT = 0x03
+ };
+
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);
@@ -27,6 +33,7 @@ public:
shared_ptr<CSGTerm> left;
shared_ptr<CSGTerm> right;
BoundingBox bbox;
+ Flag flag;
CSGTerm(const shared_ptr<PolySet> &polyset, const Transform3d &matrix, const Color4f &color, const std::string &label);
~CSGTerm();
@@ -46,19 +53,34 @@ private:
friend class CSGChain;
};
+class CSGChainObject
+{
+public:
+ CSGChainObject(shared_ptr<PolySet> polyset,
+ const Transform3d &matrix,
+ const Color4f &color,
+ CSGTerm::type_e type,
+ const std::string &label,
+ CSGTerm::Flag flag = CSGTerm::FLAG_NONE)
+ : polyset(polyset), matrix(matrix), color(color), type(type), label(label), flag(flag) {}
+
+ shared_ptr<PolySet> polyset;
+ Transform3d matrix;
+ Color4f color;
+ CSGTerm::type_e type;
+ std::string label;
+ CSGTerm::Flag flag;
+};
+
class CSGChain
{
public:
- std::vector<shared_ptr<PolySet> > polysets;
- std::vector<Transform3d> matrices;
- std::vector<Color4f> colors;
- std::vector<CSGTerm::type_e> types;
- std::vector<std::string> labels;
+ std::vector<CSGChainObject> objects;
- CSGChain();
+ CSGChain() {};
- void add(const shared_ptr<PolySet> &polyset, const Transform3d &m, const Color4f &color, CSGTerm::type_e type, std::string label);
- void import(shared_ptr<CSGTerm> term, CSGTerm::type_e type = CSGTerm::TYPE_UNION);
+ void import(shared_ptr<CSGTerm> term, CSGTerm::type_e type = CSGTerm::TYPE_UNION,
+ CSGTerm::Flag flag = CSGTerm::FLAG_NONE);
std::string dump(bool full = false);
BoundingBox getBoundingBox() const;
contact: Jan Huwald // Impressum