summaryrefslogtreecommitdiff
path: root/src/CSGTermRenderer.h
blob: 1905faff67d3b6a0c343010da57768902f08d054 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef CSGTERMRENDERER_H_
#define CSGTERMRENDERER_H_

#include <string>
#include <map>
#include <list>
#include <vector>
#include "visitor.h"
#include "node.h"

using std::string;
using std::map;
using std::list;
using std::vector;

class CSGTermRenderer : public Visitor
{
public:
	CSGTermRenderer() {}
  virtual ~CSGTermRenderer() {}

  virtual Response visit(const State &state, const AbstractNode &node);
 	virtual Response visit(const State &state, const AbstractIntersectionNode &node);
 	virtual Response visit(const State &state, const AbstractPolyNode &node);
 	virtual Response visit(const State &state, const CsgNode &node);
 	virtual Response visit(const State &state, const TransformNode &node);
 	virtual Response visit(const State &state, const RenderNode &node);

private:
	enum CsgOp {UNION, INTERSECTION, DIFFERENCE, MINKOWSKI};
  void addToParent(const State &state, const AbstractNode &node);
	void applyToChildren(const AbstractNode &node, CSGTermRenderer::CsgOp op);

  const AbstractNode *root;
  typedef list<const AbstractNode *> ChildList;
  map<int, ChildList> visitedchildren;
  map<int, class CSGTerm*> stored_term;

	vector<CSGTerm*> *highlights;
	vector<CSGTerm*> *background;
};

#endif
contact: Jan Huwald // Impressum