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

Revision 261, 1.6 KB checked in by mattausch, 19 years ago (diff)

added viewcell loader

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 viewCellsFile(buff);
38  p->LoadViewCells(viewCellsFile);
39
40  p->BspTreeStatistics(Debug);
41#endif
42
43  //  p->mSceneGraph->Export("soda.x3d");
44  if (0) {
45    p->Export(filename + "-out.x3d", true, false, false);
46    p->Export(filename + "-kdtree.x3d", false, true, false);
47  }
48 
49   
50  if (1) {
51    p->ComputeVisibility();
52    p->ExportPreprocessedData("scene.vis");
53  }
54
55  if (1) {
56    Camera camera;
57    //camera.LookAtBox(p->mKdTree->GetBox());
58        camera.LookInBox(p->mKdTree->GetBox());
59        camera.SetPosition(camera.mPosition + Vector3(0,300,0));
60    camera.SnapImage("camera.jpg", p->mKdTree);
61
62   
63    camera.LookInBox(p->mKdTree->GetBox());
64    camera.SetPosition(camera.mPosition - Vector3(0,100,0));
65    camera.SnapImage("camera2.png", p->mKdTree);
66  }
67
68  // clean up
69  DEL_PTR(p);
70  DEL_PTR(environment);
71
72  return 0;
73}
74
Note: See TracBrowser for help on using the repository browser.