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);
else
viewer->glShadeModel(GL_FLAT);
item.contextual_changed();
if(viewer)
item.draw(viewer);
else
@ -422,7 +420,6 @@ glDepthFunc(GL_LEQUAL);
}
}
}
item.contextual_changed();
if(with_names) {
viewer->glPopName();
}
@ -451,7 +448,6 @@ glDepthFunc(GL_LEQUAL);
item.draw_points();
}
}
item.contextual_changed();
if(with_names) {
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);
blue_color_ramp_.build_blue();
red_color_ramp_.build_red();
//
startTimer(0);
//Generates an integer which will be used as ID for each buffer
compute_min_max();
compute_function_grid();
double offset_x = (bbox().xmin + bbox().xmax) / 2;
@ -583,15 +582,12 @@ Scene_implicit_function_item::invalidate_buffers()
are_buffers_filled = false;
}
void Scene_implicit_function_item::contextual_changed()
{
if(!frame_->isManipulated()) {
void Scene_implicit_function_item::timerEvent(QTimerEvent* /*event*/)
{ // just handle deformation - paint like selection is handled in eventFilter()
if(need_update_) {
compute_function_grid();
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 QString toolTip() const;
virtual void contextual_changed();
virtual void invalidate_buffers();
public Q_SLOTS:
void plane_was_moved() { need_update_ = true; }
void compute_function_grid() const;
void timerEvent(QTimerEvent*);
private:
typedef qglviewer::Vec Point;

View File

@ -352,17 +352,6 @@ Scene_textured_polyhedron_item::invalidate_buffers()
compute_bbox();
}
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)
{
if(p_is_selected != is_selected)

View File

@ -28,7 +28,7 @@ public:
virtual QString toolTip() const;
// 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
void draw() const {}
virtual void draw(CGAL::Three::Viewer_interface*) const;
@ -45,7 +45,6 @@ public:
void compute_bbox() const;
virtual void invalidate_buffers();
virtual void contextual_changed();
virtual void selection_changed(bool);
private:
@ -55,15 +54,15 @@ private:
enum VAOs {
Facets=0,
Edges,
NbOfVaos = Edges+1
NbOfVaos
};
enum VBOs {
Facets_Vertices,
Facets_Vertices=0,
Facets_Normals,
Facets_Texmap,
Edges_Vertices = 0,
Edges_Texmap= 0,
NbOfVbos = Edges_Texmap+1
Edges_Vertices,
Edges_Texmap,
NbOfVbos
};
mutable std::vector<float> positions_lines;

View File

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