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

Revision 450, 2.3 KB checked in by bittner, 19 years ago (diff)

functional merge

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
16#define USE_EXE_PATH false
17
18
19int
20main(int argc, const char **argv)
21{
22  Debug.open("debug.log");
23  environment = new Environment;
24  environment->Parse(argc, argv, USE_EXE_PATH);
25  MeshKdTree::ParseEnvironment();
26   
27  char buff[128];
28 
29  environment->GetStringValue("Preprocessor.type", buff);
30  string preprocessorType(buff);
31       
32  Preprocessor *p;
33
34        if (preprocessorType == "vss")
35                p = new VssPreprocessor();
36        else
37          if (preprocessorType == "rss")
38                p = new RssPreprocessor();
39          else
40                if (preprocessorType == "exact")
41                  p = new ExactPreprocessor();
42                else
43                  if (preprocessorType == "sampling")
44                                p = new SamplingPreprocessor();
45                  else {
46                        cerr<<"Unknown preprocessor type"<<endl;
47                        Debug<<"Unknown preprocessor type"<<endl;
48                        exit(1);
49                  }
50       
51       
52        environment->GetStringValue("Scene.filename", buff);
53        string filename(buff);
54       
55        p->LoadScene(filename);
56       
57        p->BuildKdTree();
58        p->KdTreeStatistics(cout);
59       
60 
61        // parse view cells related options
62        p->PrepareViewCells();
63
64
65  //  p->mSceneGraph->Export("soda.x3d");
66  if (0) {
67    p->Export(filename + "-out.x3d", true, false, false);
68    p->Export(filename + "-kdtree.x3d", false, true, false);   
69  }
70 
71   
72  if (1) {
73    p->ComputeVisibility();
74    p->ExportPreprocessedData("scene.vis");
75  }
76
77        Camera camera;
78  if (0) {
79    //camera.LookAtBox(p->mKdTree->GetBox());
80                camera.LookInBox(p->mKdTree->GetBox());
81                camera.SetPosition(camera.mPosition + Vector3(0,300,0));
82    camera.SnapImage("camera.jpg", p->mKdTree);
83        }
84        if (0) {
85    camera.LookInBox(p->mKdTree->GetBox());
86    camera.SetPosition(camera.mPosition - Vector3(0,100,0));
87    camera.SnapImage("camera2.jpg", p->mKdTree);
88  }
89
90        if (0) {
91    camera.SetPosition( p->mKdTree->GetBox().Center() - Vector3(0,-100,0) );
92                camera.SetDirection(Vector3(1, 0, 0));
93                camera.SnapImage("camera3.jpg", p->mKdTree);
94  }
95
96  // clean up
97  DEL_PTR(p);
98  DEL_PTR(environment);
99
100  return 0;
101}
102
Note: See TracBrowser for help on using the repository browser.