Merge pull request #553 from lrineau/Polyhedron_demo-fix_Scene_c3t3_item_display_of_spheres-GF

Polyhedron demo: fix the display of protecting balls in Scene_c3t3_item
This commit is contained in:
Sebastien Loriot 2015-12-21 10:52:07 +01:00
commit e44adafd60
1 changed files with 153 additions and 151 deletions

View File

@ -130,6 +130,7 @@ Scene_c3t3_item::Scene_c3t3_item(const C3t3& c3t3)
need_changed = false; need_changed = false;
startTimer(0); startTimer(0);
connect(frame, SIGNAL(modified()), this, SLOT(changed())); connect(frame, SIGNAL(modified()), this, SLOT(changed()));
reset_cut_plane();
c3t3_changed(); c3t3_changed();
setRenderingMode(FlatPlusEdges); setRenderingMode(FlatPlusEdges);
compile_shaders(); compile_shaders();
@ -857,7 +858,7 @@ void Scene_c3t3_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer)c
buffers[Sphere_radius].allocate(s_radius.data(), buffers[Sphere_radius].allocate(s_radius.data(),
static_cast<int>(s_radius.size()*sizeof(float))); static_cast<int>(s_radius.size()*sizeof(float)));
program_sphere->enableAttributeArray("radius"); program_sphere->enableAttributeArray("radius");
program_sphere->setAttributeBuffer("radius", GL_FLOAT, 0, 3); program_sphere->setAttributeBuffer("radius", GL_FLOAT, 0, 1);
buffers[Sphere_radius].release(); buffers[Sphere_radius].release();
buffers[Sphere_center].bind(); buffers[Sphere_center].bind();
@ -898,7 +899,7 @@ void Scene_c3t3_item::initialize_buffers(CGAL::Three::Viewer_interface *viewer)c
buffers[Sphere_radius].bind(); buffers[Sphere_radius].bind();
program_sphere->enableAttributeArray("radius"); program_sphere->enableAttributeArray("radius");
program_sphere->setAttributeBuffer("radius", GL_FLOAT, 0, 3); program_sphere->setAttributeBuffer("radius", GL_FLOAT, 0, 1);
buffers[Sphere_radius].release(); buffers[Sphere_radius].release();
buffers[Sphere_center].bind(); buffers[Sphere_center].bind();
@ -1075,12 +1076,13 @@ void Scene_c3t3_item::compute_elements() const
} }
//The Spheres //The Spheres
{ {
for(Tr::Finite_vertices_iterator for(Tr::Finite_vertices_iterator
vit = d->c3t3.triangulation().finite_vertices_begin(), vit = d->c3t3.triangulation().finite_vertices_begin(),
end = d->c3t3.triangulation().finite_vertices_end(); end = d->c3t3.triangulation().finite_vertices_end();
vit != end; ++vit) vit != end; ++vit)
{ {
if(vit->point().weight()==0) continue;
typedef Tr::Vertex_handle Vertex_handle; typedef Tr::Vertex_handle Vertex_handle;
std::vector<Vertex_handle> incident_vertices; std::vector<Vertex_handle> incident_vertices;
d->c3t3.triangulation().incident_vertices(vit, std::back_inserter(incident_vertices)); d->c3t3.triangulation().incident_vertices(vit, std::back_inserter(incident_vertices));