Makes the facets color editable.

This commit is contained in:
Maxime Gimeno 2016-02-16 12:16:53 +01:00
parent dd9a666fd4
commit 1adc45b2fc
3 changed files with 4 additions and 2 deletions

View File

@ -181,7 +181,7 @@ void Scene_polyhedron_selection_item::draw(CGAL::Three::Viewer_interface* viewer
program = getShaderProgram(PROGRAM_WITH_LIGHT); program = getShaderProgram(PROGRAM_WITH_LIGHT);
attrib_buffers(viewer,PROGRAM_WITH_LIGHT); attrib_buffers(viewer,PROGRAM_WITH_LIGHT);
program->bind(); program->bind();
program->setAttributeValue("colors",facet_color); program->setAttributeValue("colors",this->color());
viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(nb_facets/3)); viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(nb_facets/3));
program->release(); program->release();
vaos[0]->release(); vaos[0]->release();

View File

@ -187,6 +187,7 @@ public:
nb_facets = 0; nb_facets = 0;
nb_points = 0; nb_points = 0;
nb_lines = 0; nb_lines = 0;
this->setColor(facet_color);
} }
Scene_polyhedron_selection_item(Scene_polyhedron_item* poly_item, QMainWindow* mw) Scene_polyhedron_selection_item(Scene_polyhedron_item* poly_item, QMainWindow* mw)
@ -207,6 +208,7 @@ public:
buffers[i].create(); buffers[i].create();
} }
init(poly_item, mw); init(poly_item, mw);
this->setColor(facet_color);
invalidateOpenGLBuffers(); invalidateOpenGLBuffers();
} }

View File

@ -298,7 +298,7 @@ public Q_SLOTS:
//!Must be overloaded. //!Must be overloaded.
virtual void invalidateOpenGLBuffers(); virtual void invalidateOpenGLBuffers();
//!Setter for the color of the item. Calls invalidateOpenGLBuffers() so the new color is applied. //!Setter for the color of the item. Calls invalidateOpenGLBuffers() so the new color is applied.
virtual void setColor(QColor c) { color_ = c; invalidateOpenGLBuffers(); } virtual void setColor(QColor c) { color_ = c; if(!is_monochrome)invalidateOpenGLBuffers(); }
//!Setter for the RGB color of the item. Calls setColor(QColor). //!Setter for the RGB color of the item. Calls setColor(QColor).
//!@see setColor(QColor c) //!@see setColor(QColor c)
void setRbgColor(int r, int g, int b) { setColor(QColor(r, g, b)); } void setRbgColor(int r, int g, int b) { setColor(QColor(r, g, b)); }