#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 "RenderSampler.h" #include #include #include "GlRenderer.h" #define USE_EXE_PATH false #include using namespace GtpVisibilityPreprocessor; int main(int argc, char **argv) {QApplication *app = new QApplication(argc, argv); cout << "here222237" << endl; //Now just call this function at the start of your program and if you're //compiling in debug mode (F5), any leaks will be displayed in the Output //window when the program shuts down. If you're not in debug mode this will //be ignored. Use it as you will! //note: from GDNet Direct [3.8.04 - 3.14.04] void detectMemoryLeaks() { _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF); _CrtSetReportMode(_CRT_ASSERT,_CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_ASSERT,_CRTDBG_FILE_STDERR); cout << "here3" << endl; Debug.open("debug.log");cout << "here2" << endl; environment = new Environment; cout << "here122223" << endl; cout.flush(); environment->Parse(argc, argv, USE_EXE_PATH); MeshKdTree::ParseEnvironment(); cout << "here222283" << endl; char buff[128]; environment->GetStringValue("Preprocessor.type", buff); string preprocessorType(buff); Preprocessor *p; cout << "here22223" << endl; if (preprocessorType == "vss") {cout << "here223" << endl; 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 if (preprocessorType == "render") { cout << "here23" << endl; p = new RenderSampler(); } else { cerr<<"Unknown preprocessor type"<mUseGlRenderer || p->mUseGlDebugger) { cout << "here1111" << endl; // create a qt application first (must be created before any opengl widget... //app = new QApplication(argc, argv); cout << "here1112" << endl; if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) { cout << "here1133" << endl;cout.flush(); QMessageBox::information(0, "OpenGL pbuffers", "This system does not support OpenGL/pbuffers.", QMessageBox::Ok); return -1; } cout << "here1119" << endl; } cout << "here1123" << endl; preprocessor = p; environment->GetStringValue("Scene.filename", buff); string filename(buff); p->LoadScene(filename); p->BuildKdTree(); p->KdTreeStatistics(cout); cout << "here1199" << endl; // parse view cells related options p->PrepareViewCells(); cout << "here1117" << endl; // create a preprocessor thread PreprocessorThread *pt = new PreprocessorThread(p, app); // p->mSceneGraph->Export("soda.x3d"); if (0) { p->Export(filename + "-out.x3d", true, false, false); p->Export(filename + "-kdtree.x3d", false, true, false); } cout << "here1118" << endl; if (p->mUseGlRenderer) { cout << "here1114" << endl; rendererWidget = new GlRendererWidget(p->mSceneGraph, p->mViewCellsManager, p->mKdTree); // renderer->resize(640, 480); cout << "here1115" << endl; rendererWidget->resize(640, 480); rendererWidget->show(); cout << "here1113" << endl; if (p->GetRenderer()) { cout<<"CONNECTING"<GetRenderer(), SIGNAL(UpdatePvsErrorItem(int i, GlRendererBuffer::PvsErrorEntry &)), rendererWidget->mControlWidget, SLOT(UpdatePvsErrorItem(int i, GlRendererBuffer::PvsErrorEntry &))); cout<<"CONNECTED"<start(QThread::LowPriority); } else{ // just call the mail method -> will be executed in the main thread pt->Main(); } if (app) return app->exec(); // clean up DEL_PTR(p); DEL_PTR(environment); return 0; }