source: trunk/VUT/GtpVisibilityPreprocessor/src/main.cpp @ 494

Revision 494, 2.5 KB checked in by bittner, 19 years ago (diff)

changes for qt 4.1.0

RevLine 
[162]1#include "SamplingPreprocessor.h"
[374]2#include "VssPreprocessor.h"
[446]3#include "RssPreprocessor.h"
[162]4#include "ExactPreprocessor.h"
5#include "Parser.h"
6#include "UnigraphicsParser.h"
[170]7#include "X3dParser.h"
[162]8#include "Environment.h"
9#include "Camera.h"
[170]10#include "MeshKdTree.h"
[264]11#include "Exporter.h"
[292]12#include "X3dExporter.h" // delete later
[310]13#include "ViewCell.h"
[321]14#include "SceneGraph.h"
[492]15#include "PreprocessorThread.h"
[162]16
[492]17#include <QApplication>
18#include <QtOpenGL>
19#include "GlRenderer.h"
20
[162]21#define USE_EXE_PATH false
22
[372]23
[492]24
25
26
[162]27int
[492]28main(int argc, char **argv)
[162]29{
30  Debug.open("debug.log");
31  environment = new Environment;
32  environment->Parse(argc, argv, USE_EXE_PATH);
[170]33  MeshKdTree::ParseEnvironment();
[492]34 
[409]35  char buff[128];
36  environment->GetStringValue("Preprocessor.type", buff);
37  string preprocessorType(buff);
[374]38       
39  Preprocessor *p;
40
[464]41  if (preprocessorType == "vss")
42        p = new VssPreprocessor();
43  else
44        if (preprocessorType == "rss")
45          p = new RssPreprocessor();
[374]46        else
[464]47          if (preprocessorType == "exact")
48                p = new ExactPreprocessor();
[446]49          else
[464]50                if (preprocessorType == "sampling")
51                  p = new SamplingPreprocessor();
52                else {
53                  cerr<<"Unknown preprocessor type"<<endl;
54                  Debug<<"Unknown preprocessor type"<<endl;
55                  exit(1);
56                }
57 
[492]58  preprocessor = p;
[464]59 
[492]60  environment->GetStringValue("Scene.filename", buff);
61  string filename(buff);
62  p->LoadScene(filename);
63 
64  p->BuildKdTree();
65  p->KdTreeStatistics(cout);
66 
67  // parse view cells related options
68  p->PrepareViewCells();
69 
[260]70
[492]71  // create a preprocessor thread
72  PreprocessorThread *pt = new PreprocessorThread(p);
73
[162]74  //  p->mSceneGraph->Export("soda.x3d");
[176]75  if (0) {
[242]76    p->Export(filename + "-out.x3d", true, false, false);
[263]77    p->Export(filename + "-kdtree.x3d", false, true, false);   
[170]78  }
[235]79
[492]80  if (p->mUseGlRenderer) {
81        QApplication a(argc, argv);
82       
[494]83        if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) {
[492]84          QMessageBox::information(0, "OpenGL pbuffers",
85                                                           "This system does not support OpenGL/pbuffers.",
86                                                           QMessageBox::Ok);
87          return -1;
[386]88        }
[492]89       
90        renderer = new GlRenderer(p->mSceneGraph, p->mViewCellsManager);
91        //  renderer->resize(640, 480);
92        renderer->resize(1024, 768);
93        renderer->show();
94       
95       
96        pt->start(QThread::LowPriority);
97       
98        return a.exec();
99  } else {
100        // just call the mail method -> will be executed in the main thread
101        pt->Main();
[170]102  }
[492]103 
[261]104  // clean up
[492]105  //  DEL_PTR(p);
106  //  DEL_PTR(environment);
[261]107
[162]108  return 0;
109}
110
Note: See TracBrowser for help on using the repository browser.