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

Revision 439, 2.2 KB checked in by mattausch, 19 years ago (diff)

added vview cell manager functionality

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