Made obj and mtl files command line inputs
This commit is contained in:
parent
26336815b4
commit
1ad927f8d1
1 changed files with 15 additions and 3 deletions
18
src/main.cpp
18
src/main.cpp
|
@ -2,15 +2,27 @@
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include "include/ui_mainwindow.h"
|
#include "include/ui_mainwindow.h"
|
||||||
|
#include <QCommandLineParser>
|
||||||
|
#include <QCommandLineOption>
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
QCommandLineParser parser;
|
||||||
|
QCommandLineOption mtl_filepath_opt({"m", "material"}, "Material file path", "path");
|
||||||
|
QCommandLineOption obj_filepath_opt({"o", "object"}, "Object file path", "path");
|
||||||
|
parser.addOption(mtl_filepath_opt);
|
||||||
|
parser.addOption(obj_filepath_opt);
|
||||||
|
parser.process(app);
|
||||||
|
QString mtl_filepath = parser.value(mtl_filepath_opt);
|
||||||
|
QString obj_filepath = parser.value(obj_filepath_opt);
|
||||||
|
if (mtl_filepath.isEmpty() || obj_filepath.isEmpty()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
QMainWindow w;
|
QMainWindow w;
|
||||||
Ui::MainWindow ui;
|
Ui::MainWindow ui;
|
||||||
ui.setupUi(&w);
|
ui.setupUi(&w);
|
||||||
|
ui.openGLWidget->obj.load_mtl(mtl_filepath.toStdString());
|
||||||
ui.openGLWidget->obj.load_mtl("untitled.mtl");
|
ui.openGLWidget->obj.load_obj(obj_filepath.toStdString());
|
||||||
ui.openGLWidget->obj.load_obj("untitled.obj");
|
|
||||||
|
|
||||||
QTimer timer_draw;
|
QTimer timer_draw;
|
||||||
QTimer timer_cam;
|
QTimer timer_cam;
|
||||||
|
|
Loading…
Reference in a new issue