goat3d

view goatview/src/main.cc @ 94:21319e71117f

[libs] fixed a few warnings in openctm [goatview] starting animation loading
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 18 May 2014 19:58:47 +0300
parents 70b7c41a4f17
children
line source
1 #include <QtWidgets/QtWidgets>
2 #include <QtCore/QtCore>
3 #include "goatview.h"
5 int main(int argc, char **argv)
6 {
7 QApplication app(argc, argv);
8 app.setOrganizationName("Mutant Stargoat");
9 app.setOrganizationDomain("mutantstargoat.com");
10 app.setApplicationName("GoatView");
12 GoatView gview;
14 QCommandLineParser argparse;
15 argparse.addHelpOption();
17 argparse.addPositionalArgument("scene", "scene file to open");
18 argparse.addOption(QCommandLineOption("a", "add animation file"));
19 argparse.parse(app.arguments());
21 const QStringList &args = argparse.positionalArguments();
22 if(!args.isEmpty()) {
23 if(args.count() > 1) {
24 fprintf(stderr, "please specify at most one scene file to open\n");
25 return 1;
26 }
27 std::string fname = args.at(0).toStdString();
28 printf("loading scene file: %s ...\n", fname.c_str());
29 if(!gview.load_scene(fname.c_str())) {
30 fprintf(stderr, "failed to load scene: %s\n", fname.c_str());
31 return 1;
32 }
33 }
35 const QStringList &anims = argparse.values("a");
36 QStringList::const_iterator it = anims.begin();
37 while(it != anims.end()) {
38 std::string fname = it++->toStdString();
39 printf("loading animation file: %s ...\n", fname.c_str());
41 if(goat3d_load_anim(scene, fname.c_str()) == -1) {
42 fprintf(stderr, "failed to load animation: %s\n", fname.c_str());
43 return 1;
44 }
45 }
47 gview.show();
49 return app.exec();
50 }