diff options
Diffstat (limited to 'polyset.cc')
-rw-r--r-- | polyset.cc | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -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; } |