diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Polyhedron/demo/Polyhedron/Scene.cpp index b8fc8164686..c9b2fbfdd73 100644 --- a/Polyhedron/demo/Polyhedron/Scene.cpp +++ b/Polyhedron/demo/Polyhedron/Scene.cpp @@ -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(); } diff --git a/Polyhedron/demo/Polyhedron/Scene_implicit_function_item.cpp b/Polyhedron/demo/Polyhedron/Scene_implicit_function_item.cpp index b9f7c257003..6a6f1392e4b 100644 --- a/Polyhedron/demo/Polyhedron/Scene_implicit_function_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_implicit_function_item.cpp @@ -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()) { - if(need_update_) { - compute_function_grid(); - compute_vertices_and_texmap(); - need_update_ = false; - } - } + +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; + } } - - diff --git a/Polyhedron/demo/Polyhedron/Scene_implicit_function_item.h b/Polyhedron/demo/Polyhedron/Scene_implicit_function_item.h index b3f2f2b2282..7c1109d2594 100644 --- a/Polyhedron/demo/Polyhedron/Scene_implicit_function_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_implicit_function_item.h @@ -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; diff --git a/Polyhedron/demo/Polyhedron/Scene_textured_polyhedron_item.cpp b/Polyhedron/demo/Polyhedron/Scene_textured_polyhedron_item.cpp index bb2272f99c5..794f89eb92a 100644 --- a/Polyhedron/demo/Polyhedron/Scene_textured_polyhedron_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_textured_polyhedron_item.cpp @@ -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) diff --git a/Polyhedron/demo/Polyhedron/Scene_textured_polyhedron_item.h b/Polyhedron/demo/Polyhedron/Scene_textured_polyhedron_item.h index 19d0b7eb1fb..c98da7864f1 100644 --- a/Polyhedron/demo/Polyhedron/Scene_textured_polyhedron_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_textured_polyhedron_item.h @@ -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 positions_lines; diff --git a/Three/include/CGAL/Three/Scene_item.h b/Three/include/CGAL/Three/Scene_item.h index 87120d70f0a..7e0b33803d8 100644 --- a/Three/include/CGAL/Three/Scene_item.h +++ b/Three/include/CGAL/Three/Scene_item.h @@ -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;