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

Revision 286, 2.2 KB checked in by mattausch, 19 years ago (diff)
Line 
1#include "SamplingPreprocessor.h"
2#include "ExactPreprocessor.h"
3#include "Parser.h"
4#include "UnigraphicsParser.h"
5#include "X3dParser.h"
6#include "Environment.h"
7#include "Camera.h"
8#include "MeshKdTree.h"
9#include "Exporter.h"
10
11#define USE_EXE_PATH false
12
13
14int
15main(int argc, const char **argv)
16{
17  Debug.open("debug.log");
18  environment = new Environment;
19  environment->Parse(argc, argv, USE_EXE_PATH);
20  MeshKdTree::ParseEnvironment();
21  BspTree::ParseEnvironment();
22
23  Preprocessor *p =
24    new SamplingPreprocessor();
25
26  char buff[128];
27  environment->GetStringValue("Scene.filename", buff);
28  string filename(buff);
29
30  p->LoadScene(filename);
31
32  p->BuildKdTree();
33  p->KdTreeStatistics(cout);
34
35#ifdef TEST_BSP_VIEWCELLS
36  environment->GetStringValue("Scene.viewcells", buff);
37
38  string vcFilename(buff);
39
40  // if BSP tree construction method needs predefined view cells
41  if (BspTree::sConstructionMethod == BspTree::VIEW_CELLS)
42  {
43          if (vcFilename != "")
44          {
45          p->LoadViewCells(vcFilename);
46                 
47                  Exporter *exporter = Exporter::GetExporter("viewcells.x3d");
48                  if (exporter)
49                  {       exporter->ExportViewCells(&p->mViewCells);
50                          delete exporter; 
51                  }
52          }
53          else
54                  p->GenerateViewCells();
55  }
56
57  p->BuildBspTree();
58  p->BspTreeStatistics(Debug);
59  Debug << "Number of view cells: " << p->mViewCells.size() << endl;
60  p->Export(filename + "-bsptree.x3d", false, false, true);
61
62#endif
63
64  //  p->mSceneGraph->Export("soda.x3d");
65  if (0) {
66    p->Export(filename + "-out.x3d", true, false, false);
67    p->Export(filename + "-kdtree.x3d", false, true, false);   
68  }
69 
70   
71  if (1) {
72    p->ComputeVisibility();
73    p->ExportPreprocessedData("scene.vis");
74  }
75
76  if (1) {
77    Camera camera;
78    //camera.LookAtBox(p->mKdTree->GetBox());
79        camera.LookInBox(p->mKdTree->GetBox());
80        camera.SetPosition(camera.mPosition + Vector3(0,300,0));
81    camera.SnapImage("camera.jpg", p->mKdTree);
82
83   
84    camera.LookInBox(p->mKdTree->GetBox());
85    camera.SetPosition(camera.mPosition - Vector3(0,100,0));
86    camera.SnapImage("camera2.png", p->mKdTree);
87  }
88
89  // clean up
90  DEL_PTR(p);
91  DEL_PTR(environment);
92
93  return 0;
94}
95
Note: See TracBrowser for help on using the repository browser.