Update LCC demo

This commit is contained in:
Guillaume Damiand 2018-11-27 09:10:03 +01:00
parent 9c3faed5c5
commit 5d7723af4a
6 changed files with 14 additions and 14 deletions

View File

@ -64,7 +64,7 @@ add_executable(Linear_cell_complex_3_demo
add_to_cached_list(CGAL_EXECUTABLE_TARGETS Linear_cell_complex_3_demo)
target_link_libraries(Linear_cell_complex_3_demo PRIVATE
target_link_libraries(Linear_cell_complex_3_demo PUBLIC
CGAL::CGAL CGAL::CGAL_Qt5 Qt5::Gui Qt5::OpenGL)
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)

View File

@ -39,7 +39,7 @@ int main(int argc, char** argv)
application.setApplicationName("3D Linear Cell Complex");
//for windows
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
application.setAttribute(Qt::AA_UseDesktopOpenGL);
// application.setAttribute(Qt::AA_UseDesktopOpenGL);
#endif
// Import resources from libCGALQt5

View File

@ -78,7 +78,7 @@ MainWindow::MainWindow (QWidget * parent) : CGAL::Qt::DemosMainWindow (parent),
QObject::connect(&dialogmesh, SIGNAL(accepted()),
this, SLOT(onCreateMeshOk()));
this->viewer->setScene(&scene);
this->viewer->setScene(&scene, false);
connect_actions ();
this->addAboutDemo (":/cgal/help/about_Linear_cell_complex_3.html");

View File

@ -37,8 +37,8 @@ Viewer::Viewer(QWidget* parent) :
inverse_normal(false),
size_points(7.),
size_edges(3.1),
ambient(0.6f, 0.5f, 0.5f, 0.5f),
m_previous_scene_empty(true)
// ambient(0.6f, 0.5f, 0.5f, 0.5f),
{}
Viewer::~Viewer()
@ -53,10 +53,9 @@ void Viewer::sceneChanged()
CGAL::qglviewer::Vec(m_bounding_box.xmax(),
m_bounding_box.ymax(),
m_bounding_box.zmax()));
Base::redraw();
if (m_previous_scene_empty)
this->showEntireScene();
else
this->update();
m_previous_scene_empty = scene->lcc->is_empty(); // for the next call to sceneChanged
}
@ -132,7 +131,7 @@ void Viewer::keyPressEvent(QKeyEvent *e)
displayMessage(QString("Size of points=%1.").arg(size_points));
update();
}
else if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::NoButton))
/* else if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::NoButton))
{
ambient.setX(ambient.x()+.1);
if (ambient.x()>1.) ambient.setX(1.);
@ -203,9 +202,9 @@ void Viewer::keyPressEvent(QKeyEvent *e)
displayMessage(QString("Light color=(%1 %2 %3).").
arg(ambient.x()).arg(ambient.y()).arg(ambient.z()));
update();
}
}*/
else
CGAL::QGLViewer::keyPressEvent(e);
Base::keyPressEvent(e);
}
QString Viewer::helpString() const

View File

@ -51,10 +51,10 @@ public:
Viewer(QWidget* parent);
~Viewer();
void setScene(Scene* scene_)
void setScene(Scene* scene_, bool doredraw=true)
{
scene = scene_;
set_lcc(scene->lcc);
set_lcc(scene->lcc, doredraw);
}
public:
@ -92,10 +92,10 @@ private:
double size_points;
double size_edges;
QVector4D ambient;
// QVector4D ambient;
bool m_previous_scene_empty;
bool are_buffers_initialized;
// bool are_buffers_initialized;
//Shaders elements
// int vertexLocation[3];

View File

@ -103,10 +103,11 @@ public:
}
protected:
void set_lcc(const LCC* alcc)
void set_lcc(const LCC* alcc, bool doredraw=true)
{
lcc=alcc;
compute_elements();
if (doredraw) { redraw(); }
}
void compute_face(Dart_const_handle dh)