summaryrefslogtreecommitdiff
path: root/src/polyset.h
diff options
context:
space:
mode:
authorkintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c>2010-01-30 04:26:05 (GMT)
committerkintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c>2010-01-30 04:26:05 (GMT)
commit191dc4857c852f1867e80cd9d03a6d1c0921dcb1 (patch)
tree4a6421d50eb6cf70924fc0ba06afccf10df00650 /src/polyset.h
parent6940d171812565209efe679a5d923417c3f47d4a (diff)
header file reorg
git-svn-id: http://svn.clifford.at/openscad/trunk@365 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'src/polyset.h')
-rw-r--r--src/polyset.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/src/polyset.h b/src/polyset.h
new file mode 100644
index 0000000..2196d1b
--- /dev/null
+++ b/src/polyset.h
@@ -0,0 +1,89 @@
+#ifndef POLYSET_H_
+#define POLYSET_H_
+
+#ifdef ENABLE_OPENCSG
+// this must be included before the GL headers
+# include <GL/glew.h>
+#endif
+#include <qgl.h>
+
+#include "grid.h"
+#ifdef ENABLE_OPENCSG
+# include <opencsg.h>
+#endif
+#ifdef ENABLE_CGAL
+# include "cgal.h"
+#endif
+
+#include <QCache.h>
+
+class PolySet
+{
+public:
+ struct Point {
+ double x, y, z;
+ Point() : x(0), y(0), z(0) { }
+ Point(double x, double y, double z) : x(x), y(y), z(z) { }
+ };
+ typedef QList<Point> Polygon;
+ QVector<Polygon> polygons;
+ QVector<Polygon> borders;
+ Grid3d<void*> grid;
+
+ bool is2d;
+ int convexity;
+
+ PolySet();
+ ~PolySet();
+
+ void append_poly();
+ void append_vertex(double x, double y, double z);
+ void insert_vertex(double x, double y, double z);
+
+ void append_vertex(double x, double y) {
+ append_vertex(x, y, 0.0);
+ }
+ void insert_vertex(double x, double y) {
+ insert_vertex(x, y, 0.0);
+ }
+
+ enum colormode_e {
+ COLORMODE_NONE,
+ COLORMODE_MATERIAL,
+ COLORMODE_CUTOUT,
+ COLORMODE_HIGHLIGHT,
+ COLORMODE_BACKGROUND
+ };
+
+ enum csgmode_e {
+ CSGMODE_NONE,
+ CSGMODE_NORMAL = 1,
+ CSGMODE_DIFFERENCE = 2,
+ CSGMODE_BACKGROUND = 11,
+ CSGMODE_BACKGROUND_DIFFERENCE = 12,
+ CSGMODE_HIGHLIGHT = 21,
+ CSGMODE_HIGHLIGHT_DIFFERENCE = 22
+ };
+
+ struct ps_cache_entry {
+ PolySet *ps;
+ QString msg;
+ ps_cache_entry(PolySet *ps);
+ ~ps_cache_entry();
+ };
+
+ static QCache<QString,ps_cache_entry> ps_cache;
+
+ void render_surface(colormode_e colormode, csgmode_e csgmode, double *m, GLint *shaderinfo = NULL) const;
+ void render_edges(colormode_e colormode, csgmode_e csgmode) const;
+
+#ifdef ENABLE_CGAL
+ CGAL_Nef_polyhedron render_cgal_nef_polyhedron() const;
+#endif
+
+ int refcount;
+ PolySet *link();
+ void unlink();
+};
+
+#endif
contact: Jan Huwald // Impressum