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

Revision 289, 2.2 KB checked in by mattausch, 19 years ago (diff)
RevLine 
[162]1#include "SamplingPreprocessor.h"
2#include "ExactPreprocessor.h"
3#include "Parser.h"
4#include "UnigraphicsParser.h"
[170]5#include "X3dParser.h"
[162]6#include "Environment.h"
7#include "Camera.h"
[170]8#include "MeshKdTree.h"
[264]9#include "Exporter.h"
[162]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);
[170]20  MeshKdTree::ParseEnvironment();
[235]21  BspTree::ParseEnvironment();
22
[162]23  Preprocessor *p =
24    new SamplingPreprocessor();
25
[170]26  char buff[128];
27  environment->GetStringValue("Scene.filename", buff);
28  string filename(buff);
29
30  p->LoadScene(filename);
[235]31
[162]32  p->BuildKdTree();
33  p->KdTreeStatistics(cout);
[260]34
[235]35#ifdef TEST_BSP_VIEWCELLS
[260]36  environment->GetStringValue("Scene.viewcells", buff);
37
[264]38  string vcFilename(buff);
[261]39
[263]40  // if BSP tree construction method needs predefined view cells
41  if (BspTree::sConstructionMethod == BspTree::VIEW_CELLS)
42  {
[264]43          if (vcFilename != "")
44          p->LoadViewCells(vcFilename);
[263]45          else
46                  p->GenerateViewCells();
[289]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;
[263]55  }
56
57  p->BuildBspTree();
[235]58  p->BspTreeStatistics(Debug);
[289]59  p->Export("vc_bsptree.x3d", false, false, true);
[263]60
[234]61#endif
62
[162]63  //  p->mSceneGraph->Export("soda.x3d");
[176]64  if (0) {
[242]65    p->Export(filename + "-out.x3d", true, false, false);
[263]66    p->Export(filename + "-kdtree.x3d", false, true, false);   
[170]67  }
68 
[261]69   
[176]70  if (1) {
71    p->ComputeVisibility();
72    p->ExportPreprocessedData("scene.vis");
73  }
[235]74
[237]75  if (1) {
[170]76    Camera camera;
[237]77    //camera.LookAtBox(p->mKdTree->GetBox());
78        camera.LookInBox(p->mKdTree->GetBox());
79        camera.SetPosition(camera.mPosition + Vector3(0,300,0));
[191]80    camera.SnapImage("camera.jpg", p->mKdTree);
81
[170]82   
83    camera.LookInBox(p->mKdTree->GetBox());
84    camera.SetPosition(camera.mPosition - Vector3(0,100,0));
85    camera.SnapImage("camera2.png", p->mKdTree);
86  }
[162]87
[261]88  // clean up
89  DEL_PTR(p);
90  DEL_PTR(environment);
91
[162]92  return 0;
93}
94
Note: See TracBrowser for help on using the repository browser.