43# pragma warning(disable: 4267 4311)
49#include <QApplication>
54#if QT_VERSION_MAJOR > 5
55#include <QOpenGLContext>
58#include "MeshViewerWidget.hh"
61void create_menu(QMainWindow &w);
62void usage_and_exit(
int xcode);
64int main(
int argc,
char **argv)
67 QApplication app(argc,argv);
69#if QT_VERSION_MAJOR < 6
70 if ( !QGLFormat::hasOpenGL() ) {
72 if ( QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL ) {
74 QString msg =
"System has no OpenGL support!";
75 QMessageBox::critical(
nullptr, QString(
"OpenGL"), msg + QString(argv[1]) );
82 while ( (c=getopt(argc,argv,
"hbs"))!=-1 )
108 mainWin.setCentralWidget(&w);
110 create_menu(mainWin);
115 mainWin.resize(640, 480);
121 w.open_mesh_gui(argv[optind]);
124 if ( ++optind < argc )
126 w.open_texture_gui(argv[optind]);
132void create_menu(QMainWindow &w)
135 QMenu *fileMenu = w.menuBar()->addMenu(w.tr(
"&File"));
137 QAction* openAct =
new QAction(w.tr(
"&Open mesh..."), &w);
138 openAct->setShortcut(w.tr(
"Ctrl+O"));
139 openAct->setStatusTip(w.tr(
"Open a mesh file"));
140 QObject::connect(openAct, SIGNAL(triggered()), w.centralWidget(), SLOT(query_open_mesh_file()));
141 fileMenu->addAction(openAct);
143 QAction* texAct =
new QAction(w.tr(
"Open &texture..."), &w);
144 texAct->setShortcut(w.tr(
"Ctrl+T"));
145 texAct->setStatusTip(w.tr(
"Open a texture file"));
146 QObject::connect(texAct, SIGNAL(triggered()), w.centralWidget(), SLOT(query_open_texture_file()));
147 fileMenu->addAction(texAct);
150void usage_and_exit(
int xcode)
152 std::cout <<
"Usage: meshviewer [-s] [mesh] [texture]\n" << std::endl;
153 std::cout <<
"Options:\n"
155 <<
" Assume input to be binary.\n\n"
157 <<
" Reverse byte order, when reading binary files.\n"
Set options for reader/writer modules.
@ FaceNormal
Has (r) / store (w) face normals.
@ Swap
Swap byte order in binary mode.
@ FaceColor
Has (r) / store (w) face colors.
@ FaceTexCoord
Has (r) / store (w) face texture coordinates.
@ Binary
Set binary mode for r/w.
@ VertexNormal
Has (r) / store (w) vertex normals.
@ VertexTexCoord
Has (r) / store (w) texture coordinates.
@ VertexColor
Has (r) / store (w) vertex colors.