50 # pragma warning(disable: 4267 4311)
55 #include <QApplication>
56 #include <QMessageBox>
57 #include <QMainWindow>
59 #include <QFileDialog>
67 #include "MeshViewerWidget.hh"
70 void create_menu(QMainWindow &w);
71 void usage_and_exit(
int xcode);
73 int main(
int argc,
char **argv)
76 QApplication::setColorSpec( QApplication::CustomColor );
77 QApplication app(argc,argv);
78 #if !defined(__APPLE__)
82 if ( !QGLFormat::hasOpenGL() ) {
83 QString msg =
"System has no OpenGL support!";
84 QMessageBox::critical( 0, QString(
"OpenGL"), msg + QString(argv[1]) );
91 while ( (c=getopt(argc,argv,
"hbs"))!=-1 )
116 mainWin.setCentralWidget(&w);
118 create_menu(mainWin);
123 mainWin.resize(640, 480);
129 w.open_mesh_gui(argv[optind]);
132 if ( ++optind < argc )
134 w.open_texture_gui(argv[optind]);
140 void create_menu(QMainWindow &w)
143 QMenu *fileMenu = w.menuBar()->addMenu(w.tr(
"&File"));
145 QAction* openAct =
new QAction(w.tr(
"&Open mesh..."), &w);
146 openAct->setShortcut(w.tr(
"Ctrl+O"));
147 openAct->setStatusTip(w.tr(
"Open a mesh file"));
148 QObject::connect(openAct, SIGNAL(triggered()), w.centralWidget(), SLOT(query_open_mesh_file()));
149 fileMenu->addAction(openAct);
151 QAction* texAct =
new QAction(w.tr(
"Open &texture..."), &w);
152 texAct->setShortcut(w.tr(
"Ctrl+T"));
153 texAct->setStatusTip(w.tr(
"Open a texture file"));
154 QObject::connect(texAct, SIGNAL(triggered()), w.centralWidget(), SLOT(query_open_texture_file()));
155 fileMenu->addAction(texAct);
158 void usage_and_exit(
int xcode)
160 std::cout <<
"Usage: meshviewer [-s] [mesh] [texture]\n" << std::endl;
161 std::cout <<
"Options:\n"
163 <<
" Assume input to be binary.\n\n"
165 <<
" Reverse byte order, when reading binary files.\n"
Has (r) / store (w) vertex normals.
Has (r) / store (w) face normals.
Has (r) / store (w) face colors.
Has (r) / store (w) texture coordinates.
Set options for reader/writer modules.
Has (r) / store (w) face texture coordinates.
Swap byte order in binary mode.
Has (r) / store (w) vertex colors.