summaryrefslogtreecommitdiff
path: root/polyset.cc
diff options
context:
space:
mode:
authorclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2009-07-01 11:09:19 (GMT)
committerclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2009-07-01 11:09:19 (GMT)
commit13888cfe9294d1649dff5ea84d5fd76a77182458 (patch)
treea759ce0590a6645d60189aa1664045be2e892956 /polyset.cc
parent82fad98cb63d6e27e7c156d4c5e4c9a9847abfd1 (diff)
Clifford Wolf:
Support for hightlights git-svn-id: http://svn.clifford.at/openscad/trunk@45 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'polyset.cc')
-rw-r--r--polyset.cc21
1 files changed, 19 insertions, 2 deletions
diff --git a/polyset.cc b/polyset.cc
index 290fb6d..a6b90b4 100644
--- a/polyset.cc
+++ b/polyset.cc
@@ -117,6 +117,18 @@ void PolySet::render_surface(colormode_e colormode, GLint *shaderinfo) const
}
#endif /* ENABLE_OPENCSG */
}
+ if (colormode == COLOR_HIGHLIGHT) {
+ glColor3ub(255, 157, 81);
+ GLfloat light_diffuse[] = {255 / 255.0, 171 / 255.0, 86 / 255.0, 0.5};
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
+ glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse);
+#ifdef ENABLE_OPENCSG
+ if (shaderinfo) {
+ glUniform4f(shaderinfo[1], 255 / 255.0, 157 / 255.0, 81 / 255.0, 0.5);
+ glUniform4f(shaderinfo[2], 255 / 255.0, 171 / 255.0, 86 / 255.0, 0.5);
+ }
+#endif /* ENABLE_OPENCSG */
+ }
#ifdef ENABLE_OPENCSG
if (shaderinfo) {
glUniform1f(shaderinfo[7], shaderinfo[9]);
@@ -160,6 +172,8 @@ void PolySet::render_edges(colormode_e colormode) const
glColor3ub(255, 236, 94);
if (colormode == COLOR_CUTOUT)
glColor3ub(171, 216, 86);
+ if (colormode == COLOR_HIGHLIGHT)
+ glColor3ub(255, 171, 86);
for (int i = 0; i < polygons.size(); i++) {
const Polygon *poly = &polygons[i];
glBegin(GL_LINE_STRIP);
@@ -260,10 +274,13 @@ CGAL_Nef_polyhedron AbstractPolyNode::render_cgal_nef_polyhedron() const
#endif /* ENABLE_CGAL */
-CSGTerm *AbstractPolyNode::render_csg_term(double m[16]) const
+CSGTerm *AbstractPolyNode::render_csg_term(double m[16], QVector<CSGTerm*> *highlights) const
{
PolySet *ps = render_polyset(RENDER_OPENCSG);
ps->setmatrix(m);
- return new CSGTerm(ps, QString("n%1").arg(idx));
+ CSGTerm *t = new CSGTerm(ps, QString("n%1").arg(idx));
+ if (modinst->tag_highlight && highlights)
+ highlights->append(t->link());
+ return t;
}
contact: Jan Huwald // Impressum