break everything

This commit is contained in:
2021-10-02 20:47:02 +02:00
parent 63074306c2
commit d74f80530b
16 changed files with 338 additions and 169 deletions

View File

@ -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();
}