diff options
author | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2009-06-26 13:29:48 (GMT) |
---|---|---|
committer | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2009-06-26 13:29:48 (GMT) |
commit | cc913b4d8f8b62800223b1a86170077cf799dced (patch) | |
tree | 6516b214ef77a5da91d52772f535a0a24579693e /polyset.cc | |
parent | cdc62b4f286ae24d162d940e09faafc75628c7e4 (diff) |
Clifford Wolf:
Added shader for pseudo-edges in opencsg mode
git-svn-id: http://svn.clifford.at/openscad/trunk@24 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'polyset.cc')
-rw-r--r-- | polyset.cc | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -53,7 +53,28 @@ static void set_opengl_normal(double x1, double y1, double z1, double x2, double glNormal3d(-nx, -ny, -nz); } -void PolySet::render_surface(colormode_e colormode) const +static void set_triangle_point_data(GLint e1, GLint e2, GLint e3) +{ + static int state = 0; + if (state == 0) { + glVertexAttrib1d(e1, 1.0); + glVertexAttrib1d(e2, 1.0); + glVertexAttrib1d(e3, 0.0); + } + if (state == 1) { + glVertexAttrib1d(e1, 0.0); + glVertexAttrib1d(e2, 1.0); + glVertexAttrib1d(e3, 1.0); + } + if (state == 2) { + glVertexAttrib1d(e1, 1.0); + glVertexAttrib1d(e2, 0.0); + glVertexAttrib1d(e3, 1.0); + } + state = (state + 1) % 3; +} + +void PolySet::render_surface(colormode_e colormode, GLint e1, GLint e2, GLint e3) const { if (colormode == COLOR_MATERIAL) glColor3ub(249, 215, 44); @@ -67,6 +88,8 @@ void PolySet::render_surface(colormode_e colormode) const poly->at(2).x, poly->at(2).y, poly->at(2).z); for (int j = 0; j < poly->size(); j++) { const Point *p = &poly->at(j); + if (e1 && e2 && e3) + set_triangle_point_data(e1, e2, e3); glVertex3d(p->x, p->y, p->z); } glEnd(); |