break everything
This commit is contained in:
29
src/main.cpp
29
src/main.cpp
@ -1,16 +1,39 @@
|
||||
#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::RenderableType::OpenGL);
|
||||
format.setMajorVersion(2);
|
||||
format.setMinorVersion(1);
|
||||
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) {
|
||||
cerr << "Utilisation : " << argv[0] << " [fichier OBJ]" << endl;
|
||||
qWarning("Utilisation : %s [MAILLAGE]", argv[0]);
|
||||
return 1;
|
||||
} else if (argc == 2) {
|
||||
mesh_processor = new MeshProcessor(argv[1]);
|
||||
}
|
||||
MainWindow mw;
|
||||
mw.show();
|
||||
// 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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user