remove an automatic invalidate_buffers and replace them by manually placed ones

This commit is contained in:
Sébastien Loriot 2015-09-11 21:29:33 +02:00
parent 30831d27ac
commit f1aa5e15f2
7 changed files with 10 additions and 6 deletions

View File

@ -72,6 +72,7 @@ void Polyhedron_demo_self_intersection_plugin::on_actionSelfIntersection_trigger
selection_item->selected_facets.insert(fb->first);
selection_item->selected_facets.insert(fb->second);
}
selection_item->invalidate_buffers();
selection_item->setName(tr("%1 (selection) (intersecting triangles)").arg(item->name()));
scene->addItem(selection_item);
item->setRenderingMode(Wireframe);

View File

@ -652,7 +652,6 @@ void Scene::itemChanged(Item_id i)
if(i < 0 || i >= m_entries.size())
return;
m_entries[i]->invalidate_buffers();
Q_EMIT dataChanged(this->createIndex(i, 0),
this->createIndex(i, LastColumn));
}

View File

@ -443,6 +443,7 @@ void Scene_edit_polyhedron_item::timerEvent(QTimerEvent* /*event*/)
{ // just handle deformation - paint like selection is handled in eventFilter()
if(state.ctrl_pressing && (state.left_button_pressing || state.right_button_pressing)) {
if(!ui_widget->ActivatePivotingCheckBox->isChecked()) {
invalidate_buffers();
deform();
}
else {

View File

@ -93,6 +93,7 @@ Scene_points_with_normal_item::~Scene_points_with_normal_item()
void Scene_points_with_normal_item::initialize_buffers(Viewer_interface *viewer) const
{
compute_normals_and_vertices();
//vao for the edges
{
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
@ -150,10 +151,9 @@ void Scene_points_with_normal_item::initialize_buffers(Viewer_interface *viewer)
program->release();
}
are_buffers_filled = true;
}
void Scene_points_with_normal_item::compute_normals_and_vertices(void)
void Scene_points_with_normal_item::compute_normals_and_vertices() const
{
positions_points.resize(0);
positions_lines.resize(0);
@ -579,7 +579,6 @@ void Scene_points_with_normal_item::set_has_normals(bool b) {
void Scene_points_with_normal_item::invalidate_buffers()
{
compute_normals_and_vertices();
are_buffers_filled = false;
}

View File

@ -105,7 +105,7 @@ private:
using Scene_item::initialize_buffers;
void initialize_buffers(Viewer_interface *viewer) const;
void compute_normals_and_vertices(void);
void compute_normals_and_vertices() const;
}; // end class Scene_points_with_normal_item

View File

@ -604,6 +604,7 @@ public:
polyhedron()->erase_facet((*fb)->halfedge());
}
selected_facets.clear();
invalidate_buffers();
changed_with_poly_item();
}
@ -670,6 +671,7 @@ public:
void changed_with_poly_item() {
// no need to update indices
poly_item->invalidate_buffers();
Q_EMIT poly_item->itemChanged();
Q_EMIT itemChanged();
}

View File

@ -177,6 +177,8 @@ void Scene_polyhedron_shortest_path_item::ensure_shortest_paths_tree()
void Scene_polyhedron_shortest_path_item::poly_item_changed()
{
recreate_shortest_path_object();
invalidate_buffers();
Q_EMIT itemChanged();
}
void Scene_polyhedron_shortest_path_item::invalidate_buffers()