mirror of https://github.com/vitalif/openscad
81 lines
2.6 KiB
Diff
81 lines
2.6 KiB
Diff
--- 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(" ");
|