43 # pragma warning(disable: 4267 4311) 48 #include <QApplication> 49 #include <QMessageBox> 50 #include <QMainWindow> 52 #include <QFileDialog> 54 #include "MeshViewerWidget.hh" 57 void create_menu(QMainWindow &w);
58 void usage_and_exit(
int xcode);
60 int main(
int argc,
char **argv)
63 QApplication::setColorSpec( QApplication::CustomColor );
64 QApplication app(argc,argv);
66 if ( !QGLFormat::hasOpenGL() ) {
67 QString msg =
"System has no OpenGL support!";
68 QMessageBox::critical( 0, QString(
"OpenGL"), msg + QString(argv[1]) );
75 while ( (c=getopt(argc,argv,
"hbs"))!=-1 )
101 mainWin.setCentralWidget(&w);
103 create_menu(mainWin);
108 mainWin.resize(640, 480);
114 w.open_mesh_gui(argv[optind]);
117 if ( ++optind < argc )
119 w.open_texture_gui(argv[optind]);
125 void create_menu(QMainWindow &w)
128 QMenu *fileMenu = w.menuBar()->addMenu(w.tr(
"&File"));
130 QAction* openAct =
new QAction(w.tr(
"&Open mesh..."), &w);
131 openAct->setShortcut(w.tr(
"Ctrl+O"));
132 openAct->setStatusTip(w.tr(
"Open a mesh file"));
133 QObject::connect(openAct, SIGNAL(triggered()), w.centralWidget(), SLOT(query_open_mesh_file()));
134 fileMenu->addAction(openAct);
136 QAction* texAct =
new QAction(w.tr(
"Open &texture..."), &w);
137 texAct->setShortcut(w.tr(
"Ctrl+T"));
138 texAct->setStatusTip(w.tr(
"Open a texture file"));
139 QObject::connect(texAct, SIGNAL(triggered()), w.centralWidget(), SLOT(query_open_texture_file()));
140 fileMenu->addAction(texAct);
143 void usage_and_exit(
int xcode)
145 std::cout <<
"Usage: meshviewer [-s] [mesh] [texture]\n" << std::endl;
146 std::cout <<
"Options:\n" 148 <<
" Assume input to be binary.\n\n" 150 <<
" Reverse byte order, when reading binary files.\n" Has (r) / store (w) vertex colors.
Swap byte order in binary mode.
Has (r) / store (w) face colors.
Has (r) / store (w) face normals.
Has (r) / store (w) texture coordinates.
Has (r) / store (w) face texture coordinates.
Set options for reader/writer modules.
Has (r) / store (w) vertex normals.