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

Revision 289, 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          p->LoadViewCells(vcFilename);
45          else
46                  p->GenerateViewCells();
47
48          Exporter *exporter = Exporter::GetExporter("viewcells.x3d");
49          if (exporter)
50          {     
51          exporter->ExportViewCells(&p->mViewCells); // export view cells
52                  delete exporter;
53          }
54          Debug << "Viewcells loaded / generated. Number of view cells: " << p->mViewCells.size() << endl;
55  }
56
57  p->BuildBspTree();
58  p->BspTreeStatistics(Debug);
59  p->Export("vc_bsptree.x3d", false, false, true);
60
61#endif
62
63  //  p->mSceneGraph->Export("soda.x3d");
64  if (0) {
65    p->Export(filename + "-out.x3d", true, false, false);
66    p->Export(filename + "-kdtree.x3d", false, true, false);   
67  }
68 
69   
70  if (1) {
71    p->ComputeVisibility();
72    p->ExportPreprocessedData("scene.vis");
73  }
74
75  if (1) {
76    Camera camera;
77    //camera.LookAtBox(p->mKdTree->GetBox());
78        camera.LookInBox(p->mKdTree->GetBox());
79        camera.SetPosition(camera.mPosition + Vector3(0,300,0));
80    camera.SnapImage("camera.jpg", p->mKdTree);
81
82   
83    camera.LookInBox(p->mKdTree->GetBox());
84    camera.SetPosition(camera.mPosition - Vector3(0,100,0));
85    camera.SnapImage("camera2.png", p->mKdTree);
86  }
87
88  // clean up
89  DEL_PTR(p);
90  DEL_PTR(environment);
91
92  return 0;
93}
94
Note: See TracBrowser for help on using the repository browser.