mod_geo-tp/src/main.cpp

42 lines
1.1 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "main_window.h"
#include "mesh_processor.h"
#include <iostream>
#include <QSurfaceFormat>
#include <QApplication>
int main(int argc, char *argv[]) {
using namespace std;
QSurfaceFormat format;
format.setRenderableType(QSurfaceFormat::OpenGL);
#ifndef QT_DEBUG
qDebug("Debug build");
format.setOption(QSurfaceFormat::DebugContext);
#endif
QSurfaceFormat::setDefaultFormat(format);
QApplication app(argc, argv);
MeshProcessor *mesh_processor = nullptr;
MainWindow main_window;
MeshViewer *mesh_viewer = &main_window.mesh_viewer;
QObject::connect(mesh_viewer, &MeshViewer::initialized,
[&]() {
if (mesh_processor) {
mesh_viewer->addMesh(mesh_processor->mesh);
}
});
if (argc > 2) {
qWarning("Utilisation: %s [MAILLAGE]", argv[0]);
return 1;
} else if (argc == 2) {
mesh_processor = new MeshProcessor(argv[1]);
}
// QObject::connect(&main_window, &MainWindow::open,
// [&](const QString &path) {
// if (mesh_processor) delete mesh_processor;
// mesh_processor = new MeshProcessor(path);
// });
main_window.show();
return app.exec();
}