contextual_changed removal + textured_polyhedron fix

This commit is contained in:
Maxime Gimeno 2016-01-20 11:03:14 +01:00 committed by Sébastien Loriot
parent a28afa4c31
commit 271cc81413
6 changed files with 18 additions and 42 deletions

View File

@ -355,8 +355,6 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer)
viewer->glShadeModel(GL_SMOOTH); viewer->glShadeModel(GL_SMOOTH);
else else
viewer->glShadeModel(GL_FLAT); viewer->glShadeModel(GL_FLAT);
item.contextual_changed();
if(viewer) if(viewer)
item.draw(viewer); item.draw(viewer);
else else
@ -422,7 +420,6 @@ glDepthFunc(GL_LEQUAL);
} }
} }
} }
item.contextual_changed();
if(with_names) { if(with_names) {
viewer->glPopName(); viewer->glPopName();
} }
@ -451,7 +448,6 @@ glDepthFunc(GL_LEQUAL);
item.draw_points(); item.draw_points();
} }
} }
item.contextual_changed();
if(with_names) { if(with_names) {
viewer->glPopName(); viewer->glPopName();
} }

View File

@ -353,9 +353,8 @@ Scene_implicit_function_item(Implicit_function_interface* f)
texture = new Texture(grid_size_-1,grid_size_-1); texture = new Texture(grid_size_-1,grid_size_-1);
blue_color_ramp_.build_blue(); blue_color_ramp_.build_blue();
red_color_ramp_.build_red(); red_color_ramp_.build_red();
// startTimer(0);
//Generates an integer which will be used as ID for each buffer //Generates an integer which will be used as ID for each buffer
compute_min_max(); compute_min_max();
compute_function_grid(); compute_function_grid();
double offset_x = (bbox().xmin + bbox().xmax) / 2; double offset_x = (bbox().xmin + bbox().xmax) / 2;
@ -583,15 +582,12 @@ Scene_implicit_function_item::invalidate_buffers()
are_buffers_filled = false; are_buffers_filled = false;
} }
void Scene_implicit_function_item::contextual_changed()
{ void Scene_implicit_function_item::timerEvent(QTimerEvent* /*event*/)
if(!frame_->isManipulated()) { { // just handle deformation - paint like selection is handled in eventFilter()
if(need_update_) { if(need_update_) {
compute_function_grid(); compute_function_grid();
compute_vertices_and_texmap(); compute_vertices_and_texmap();
need_update_ = false; need_update_= false;
} }
}
} }

View File

@ -69,11 +69,11 @@ public:
virtual void draw_edges(CGAL::Three::Viewer_interface*) const; virtual void draw_edges(CGAL::Three::Viewer_interface*) const;
virtual QString toolTip() const; virtual QString toolTip() const;
virtual void contextual_changed();
virtual void invalidate_buffers(); virtual void invalidate_buffers();
public Q_SLOTS: public Q_SLOTS:
void plane_was_moved() { need_update_ = true; } void plane_was_moved() { need_update_ = true; }
void compute_function_grid() const; void compute_function_grid() const;
void timerEvent(QTimerEvent*);
private: private:
typedef qglviewer::Vec Point; typedef qglviewer::Vec Point;

View File

@ -352,17 +352,6 @@ Scene_textured_polyhedron_item::invalidate_buffers()
compute_bbox(); compute_bbox();
} }
void void
Scene_textured_polyhedron_item::
contextual_changed()
{
prev_shading = cur_shading;
cur_shading = renderingMode();
if(prev_shading != cur_shading)
{
invalidate_buffers();
}
}
void
Scene_textured_polyhedron_item::selection_changed(bool p_is_selected) Scene_textured_polyhedron_item::selection_changed(bool p_is_selected)
{ {
if(p_is_selected != is_selected) if(p_is_selected != is_selected)

View File

@ -28,7 +28,7 @@ public:
virtual QString toolTip() const; virtual QString toolTip() const;
// Indicate if rendering mode is supported // Indicate if rendering mode is supported
virtual bool supportsRenderingMode(RenderingMode m) const { return m != Splatting; } virtual bool supportsRenderingMode(RenderingMode m) const { return (m != Splatting && m != PointsPlusNormals && m != Points && m != Gouraud ); }
// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list // Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
void draw() const {} void draw() const {}
virtual void draw(CGAL::Three::Viewer_interface*) const; virtual void draw(CGAL::Three::Viewer_interface*) const;
@ -45,7 +45,6 @@ public:
void compute_bbox() const; void compute_bbox() const;
virtual void invalidate_buffers(); virtual void invalidate_buffers();
virtual void contextual_changed();
virtual void selection_changed(bool); virtual void selection_changed(bool);
private: private:
@ -55,15 +54,15 @@ private:
enum VAOs { enum VAOs {
Facets=0, Facets=0,
Edges, Edges,
NbOfVaos = Edges+1 NbOfVaos
}; };
enum VBOs { enum VBOs {
Facets_Vertices, Facets_Vertices=0,
Facets_Normals, Facets_Normals,
Facets_Texmap, Facets_Texmap,
Edges_Vertices = 0, Edges_Vertices,
Edges_Texmap= 0, Edges_Texmap,
NbOfVbos = Edges_Texmap+1 NbOfVbos
}; };
mutable std::vector<float> positions_lines; mutable std::vector<float> positions_lines;

View File

@ -291,8 +291,6 @@ public Q_SLOTS:
virtual void invalidate_buffers(); virtual void invalidate_buffers();
//!Setter for the color of the item. Calls invalidate_buffers() so the new color is applied. //!Setter for the color of the item. Calls invalidate_buffers() so the new color is applied.
virtual void setColor(QColor c) { color_ = c; invalidate_buffers(); } virtual void setColor(QColor c) { color_ = c; invalidate_buffers(); }
//!When invalidate_buffers() is not enough.
virtual void contextual_changed(){}
//!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)); }
@ -396,16 +394,14 @@ protected:
/*! Contains the previous RenderingMode. /*! Contains the previous RenderingMode.
* This is used to determine if invalidate_buffers should be called or not * This is used to determine if invalidate_buffers should be called or not
* in certain cases. * in certain cases.
* @see invalidate_buffers() * @see invalidate_buffers()*/
* @see contextual_changed()*/
RenderingMode prev_shading; RenderingMode prev_shading;
/*! \todo replace it by RenderingMode(). /*! \todo replace it by RenderingMode().
* \brief * \brief
* Contains the current RenderingMode. * Contains the current RenderingMode.
* This is used to determine if invalidate_buffers should be called or not * This is used to determine if invalidate_buffers should be called or not
* in certain cases. * in certain cases.
* @see invalidate_buffers() * @see invalidate_buffers()*/
* @see contextual_changed()*/
RenderingMode cur_shading; RenderingMode cur_shading;
//!Contains the size of the vector of VBOs //!Contains the size of the vector of VBOs
int buffersSize; int buffersSize;