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

Revision 263, 1.9 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
10#define USE_EXE_PATH false
11
12
13int
14main(int argc, const char **argv)
15{
16  Debug.open("debug.log");
17  environment = new Environment;
18  environment->Parse(argc, argv, USE_EXE_PATH);
19  MeshKdTree::ParseEnvironment();
20  BspTree::ParseEnvironment();
21
22  Preprocessor *p =
23    new SamplingPreprocessor();
24
25  char buff[128];
26  environment->GetStringValue("Scene.filename", buff);
27  string filename(buff);
28
29  p->LoadScene(filename);
30
31  p->BuildKdTree();
32  p->KdTreeStatistics(cout);
33
34#ifdef TEST_BSP_VIEWCELLS
35  environment->GetStringValue("Scene.viewcells", buff);
36
37  string vcFileName(buff);
38
39  // if BSP tree construction method needs predefined view cells
40  if (BspTree::sConstructionMethod == BspTree::VIEW_CELLS)
41  {
42          if (vcFileName != "")
43          p->LoadViewCells(vcFileName);
44          else
45                  p->GenerateViewCells();
46  }
47
48  p->BuildBspTree();
49  p->BspTreeStatistics(Debug);
50  p->Export(filename + "-bsptree.x3d", false, false, true);
51
52#endif
53
54  //  p->mSceneGraph->Export("soda.x3d");
55  if (0) {
56    p->Export(filename + "-out.x3d", true, false, false);
57    p->Export(filename + "-kdtree.x3d", false, true, false);   
58  }
59 
60   
61  if (1) {
62    p->ComputeVisibility();
63    p->ExportPreprocessedData("scene.vis");
64  }
65
66  if (1) {
67    Camera camera;
68    //camera.LookAtBox(p->mKdTree->GetBox());
69        camera.LookInBox(p->mKdTree->GetBox());
70        camera.SetPosition(camera.mPosition + Vector3(0,300,0));
71    camera.SnapImage("camera.jpg", p->mKdTree);
72
73   
74    camera.LookInBox(p->mKdTree->GetBox());
75    camera.SetPosition(camera.mPosition - Vector3(0,100,0));
76    camera.SnapImage("camera2.png", p->mKdTree);
77  }
78
79  // clean up
80  DEL_PTR(p);
81  DEL_PTR(environment);
82
83  return 0;
84}
85
Note: See TracBrowser for help on using the repository browser.