summaryrefslogtreecommitdiff
path: root/patches/CGAL-OGL_helper-colors.patch
blob: 4c2f8c0cf494f539e9fbf1373e57e4c26fee53a6 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
--- OGL_helper.h	2011-09-29 23:02:04.000000000 +0200
+++ ../src/OGL_helper.h	2011-09-29 23:01:27.000000000 +0200
@@ -263,7 +263,7 @@
  enum { SNC_BOUNDARY, SNC_SKELETON };
 
  class Polyhedron : public OGL_base_object {
-
+ protected:
     std::list<DPoint>    vertices_;
     std::list<DSegment>  edges_;
     std::list<DFacet>    halffacets_;
@@ -356,11 +356,17 @@
     Bbox_3  bbox() const { return bbox_; }
     Bbox_3& bbox()       { return bbox_; }
 
+    virtual CGAL::Color getVertexColor(Vertex_iterator v) const
+    {
+	CGAL::Color cf(CGAL_NEF3_MARKED_VERTEX_COLOR),
+	  ct(CGAL_NEF3_UNMARKED_VERTEX_COLOR); // more blue-ish
+	CGAL::Color c = v->mark() ? ct : cf;
+	return c;
+    }
+
     void draw(Vertex_iterator v) const { 
       //      CGAL_NEF_TRACEN("drawing vertex "<<*v);
-      CGAL::Color cf(CGAL_NEF3_MARKED_VERTEX_COLOR), 
-	ct(CGAL_NEF3_UNMARKED_VERTEX_COLOR); // more blue-ish
-      CGAL::Color c = v->mark() ? ct : cf;
+      CGAL::Color c = getVertexColor(v);
       glPointSize(10);
       glColor3ub(c.red(), c.green(), c.blue());
       glBegin(GL_POINTS);
@@ -372,12 +378,18 @@
       glEnd();
     }
 
+    virtual CGAL::Color getEdgeColor(Edge_iterator e) const
+    {
+	CGAL::Color cf(CGAL_NEF3_MARKED_EDGE_COLOR),
+	  ct(CGAL_NEF3_UNMARKED_EDGE_COLOR); // more blue-ish
+	CGAL::Color c = e->mark() ? ct : cf;
+	return c;
+    }
+
     void draw(Edge_iterator e) const { 
       //      CGAL_NEF_TRACEN("drawing edge "<<*e);
       Double_point p = e->source(), q = e->target();
-      CGAL::Color cf(CGAL_NEF3_MARKED_EDGE_COLOR), 
-	ct(CGAL_NEF3_UNMARKED_EDGE_COLOR); // more blue-ish
-      CGAL::Color c = e->mark() ? ct : cf;
+      CGAL::Color c = getEdgeColor(e);
       glLineWidth(5);
       glColor3ub(c.red(),c.green(),c.blue());
       glBegin(GL_LINE_STRIP);
@@ -386,6 +398,14 @@
       glEnd();
     }
 
+    virtual CGAL::Color getFacetColor(Halffacet_iterator f) const
+    {
+	CGAL::Color cf(CGAL_NEF3_MARKED_FACET_COLOR),
+	  ct(CGAL_NEF3_UNMARKED_FACET_COLOR); // more blue-ish
+	CGAL::Color c = (f->mark() ? ct : cf);
+	return c;
+    }
+
     void draw(Halffacet_iterator f) const { 
       //      CGAL_NEF_TRACEN("drawing facet "<<(f->debug(),""));
       GLUtesselator* tess_ = gluNewTess();
@@ -403,9 +423,7 @@
 		      GLU_TESS_WINDING_POSITIVE);
 
       DFacet::Coord_const_iterator cit;
-      CGAL::Color cf(CGAL_NEF3_MARKED_FACET_COLOR),
-	ct(CGAL_NEF3_UNMARKED_FACET_COLOR); // more blue-ish
-      CGAL::Color c = (f->mark() ? ct : cf);
+      CGAL::Color c = getFacetColor(f);
       glColor3ub(c.red(),c.green(),c.blue());
       gluTessBeginPolygon(tess_,f->normal());
       //      CGAL_NEF_TRACEN(" ");
contact: Jan Huwald // Impressum