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

Line 
1#include "SamplingPreprocessor.h"
2#include "VssPreprocessor.h"
3#include "RssPreprocessor.h"
4#include "ExactPreprocessor.h"
5#include "Parser.h"
6#include "UnigraphicsParser.h"
7#include "X3dParser.h"
8#include "Environment.h"
9#include "Camera.h"
10#include "MeshKdTree.h"
11#include "Exporter.h"
12#include "X3dExporter.h" // delete later
13#include "ViewCell.h"
14#include "SceneGraph.h"
15#include "PreprocessorThread.h"
16
17#include <QApplication>
18#include <QtOpenGL>
19#include "GlRenderer.h"
20
21#define USE_EXE_PATH false
22
23
24
25
26
27int
28main(int argc, char **argv)
29{
30  Debug.open("debug.log");
31  environment = new Environment;
32  environment->Parse(argc, argv, USE_EXE_PATH);
33  MeshKdTree::ParseEnvironment();
34 
35  char buff[128];
36  environment->GetStringValue("Preprocessor.type", buff);
37  string preprocessorType(buff);
38       
39  Preprocessor *p;
40
41  if (preprocessorType == "vss")
42        p = new VssPreprocessor();
43  else
44        if (preprocessorType == "rss")
45          p = new RssPreprocessor();
46        else
47          if (preprocessorType == "exact")
48                p = new ExactPreprocessor();
49          else
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 
58  preprocessor = p;
59 
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 
70
71  // create a preprocessor thread
72  PreprocessorThread *pt = new PreprocessorThread(p);
73
74  //  p->mSceneGraph->Export("soda.x3d");
75  if (0) {
76    p->Export(filename + "-out.x3d", true, false, false);
77    p->Export(filename + "-kdtree.x3d", false, true, false);   
78  }
79
80  if (p->mUseGlRenderer) {
81        QApplication a(argc, argv);
82       
83        if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) {
84          QMessageBox::information(0, "OpenGL pbuffers",
85                                                           "This system does not support OpenGL/pbuffers.",
86                                                           QMessageBox::Ok);
87          return -1;
88        }
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();
102  }
103 
104  // clean up
105  //  DEL_PTR(p);
106  //  DEL_PTR(environment);
107
108  return 0;
109}
110
Note: See TracBrowser for help on using the repository browser.