#include "SamplingPreprocessor.h" #include "VssPreprocessor.h" #include "RssPreprocessor.h" #include "ExactPreprocessor.h" #include "Parser.h" #include "UnigraphicsParser.h" #include "X3dParser.h" #include "Environment.h" #include "Camera.h" #include "MeshKdTree.h" #include "Exporter.h" #include "X3dExporter.h" // delete later #include "ViewCell.h" #include "SceneGraph.h" #include "PreprocessorThread.h" #include #include #include "GlRenderer.h" #define USE_EXE_PATH false int main(int argc, char **argv) { Debug.open("debug.log"); environment = new Environment; environment->Parse(argc, argv, USE_EXE_PATH); MeshKdTree::ParseEnvironment(); char buff[128]; environment->GetStringValue("Preprocessor.type", buff); string preprocessorType(buff); Preprocessor *p; if (preprocessorType == "vss") p = new VssPreprocessor(); else if (preprocessorType == "rss") p = new RssPreprocessor(); else if (preprocessorType == "exact") p = new ExactPreprocessor(); else if (preprocessorType == "sampling") p = new SamplingPreprocessor(); else { cerr<<"Unknown preprocessor type"<mUseGlRenderer) { // create a qt application first (must be created before any opengl widget... app = new QApplication(argc, argv); if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) { QMessageBox::information(0, "OpenGL pbuffers", "This system does not support OpenGL/pbuffers.", QMessageBox::Ok); return -1; } } preprocessor = p; environment->GetStringValue("Scene.filename", buff); string filename(buff); p->LoadScene(filename); p->BuildKdTree(); p->KdTreeStatistics(cout); // parse view cells related options p->PrepareViewCells(); // create a preprocessor thread PreprocessorThread *pt = new PreprocessorThread(p); // p->mSceneGraph->Export("soda.x3d"); if (0) { p->Export(filename + "-out.x3d", true, false, false); p->Export(filename + "-kdtree.x3d", false, true, false); } if (p->mUseGlRenderer) { rendererWidget = new GlRendererWidget(p->mSceneGraph, p->mViewCellsManager); // renderer->resize(640, 480); rendererWidget->resize(640, 480); rendererWidget->show(); pt->start(QThread::LowPriority); } else { // just call the mail method -> will be executed in the main thread pt->Main(); } // clean up // DEL_PTR(p); // DEL_PTR(environment); if (app) return app->exec(); return 0; }