setup a singleshot for the planes

This commit is contained in:
Maxime Gimeno 2020-06-08 11:00:38 +02:00
parent 1d4d3efcc9
commit 2395583fd7
2 changed files with 11 additions and 13 deletions

View File

@ -45,7 +45,7 @@ Scene::Scene()
m_blue_ramp.build_blue(); m_blue_ramp.build_blue();
m_max_distance_function = (FT)0.0; m_max_distance_function = (FT)0.0;
texture = new Texture(m_grid_size,m_grid_size); texture = new Texture(m_grid_size,m_grid_size);
ready_to_cut = false; ready_to_cut = true;
are_buffers_initialized = false; are_buffers_initialized = false;
gl_init = false; gl_init = false;
@ -518,6 +518,7 @@ void Scene::changed()
compute_elements(_UNSIGNED); compute_elements(_UNSIGNED);
else else
compute_elements(_SIGNED); compute_elements(_SIGNED);
ready_to_cut=false;
are_buffers_initialized = false; are_buffers_initialized = false;
} }
@ -1225,12 +1226,16 @@ void Scene::cut_segment_plane()
m_cut_plane = CUT_SEGMENTS; m_cut_plane = CUT_SEGMENTS;
changed(); changed();
} }
void Scene::updateCutPlane()
{
ready_to_cut = true;
QTimer::singleShot(0,this,SLOT(cutting_plane()));
}
void Scene::cutting_plane(bool override) void Scene::cutting_plane(bool override)
{ {
if(ready_to_cut || override) if(ready_to_cut || override)
{ {
ready_to_cut = false;
switch( m_cut_plane ) switch( m_cut_plane )
{ {
case UNSIGNED_FACETS: case UNSIGNED_FACETS:
@ -1303,13 +1308,13 @@ void Scene::refine_loop()
void Scene::activate_cutting_plane() void Scene::activate_cutting_plane()
{ {
connect(m_frame, SIGNAL(modified()), this, SLOT(cutting_plane())); connect(m_frame, SIGNAL(modified()), this, SLOT(updateCutPlane()));
m_view_plane = true; m_view_plane = true;
} }
void Scene::deactivate_cutting_plane() void Scene::deactivate_cutting_plane()
{ {
disconnect(m_frame, SIGNAL(modified()), this, SLOT(cutting_plane())); disconnect(m_frame, SIGNAL(modified()), this, SLOT(updateCutPlane()));
m_view_plane = false; m_view_plane = false;
} }
void Scene::initGL() void Scene::initGL()
@ -1325,10 +1330,3 @@ void Scene::initGL()
compile_shaders(); compile_shaders();
gl_init = true; gl_init = true;
} }
void Scene::timerEvent(QTimerEvent *)
{
if(manipulatedFrame()->isSpinning())
set_fast_distance(true);
ready_to_cut = true;
}

View File

@ -173,6 +173,8 @@ private:
void attrib_buffers(CGAL::QGLViewer*); void attrib_buffers(CGAL::QGLViewer*);
void compile_shaders(); void compile_shaders();
void compute_texture(int, int, Color_ramp, Color_ramp); void compute_texture(int, int, Color_ramp, Color_ramp);
private slots:
void updateCutPlane();
public: public:
// file menu // file menu
@ -251,8 +253,6 @@ public:
void activate_cutting_plane(); void activate_cutting_plane();
void deactivate_cutting_plane(); void deactivate_cutting_plane();
//timer sends a top when all the events are finished
void timerEvent(QTimerEvent *);
public slots: public slots: