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

Revision 439, 2.2 KB checked in by mattausch, 19 years ago (diff)

added vview cell manager functionality

RevLine 
[162]1#include "SamplingPreprocessor.h"
[374]2#include "VssPreprocessor.h"
[162]3#include "ExactPreprocessor.h"
4#include "Parser.h"
5#include "UnigraphicsParser.h"
[170]6#include "X3dParser.h"
[162]7#include "Environment.h"
8#include "Camera.h"
[170]9#include "MeshKdTree.h"
[264]10#include "Exporter.h"
[292]11#include "X3dExporter.h" // delete later
[310]12#include "ViewCell.h"
[321]13#include "SceneGraph.h"
[162]14
15#define USE_EXE_PATH false
16
[372]17
[162]18int
19main(int argc, const char **argv)
20{
21  Debug.open("debug.log");
22  environment = new Environment;
23  environment->Parse(argc, argv, USE_EXE_PATH);
[170]24  MeshKdTree::ParseEnvironment();
[422]25   
[409]26  char buff[128];
27 
28  environment->GetStringValue("Preprocessor.type", buff);
29  string preprocessorType(buff);
[374]30       
31  Preprocessor *p;
32
33        if (preprocessorType == "vss")
34                p = new VssPreprocessor();
35        else
36                if (preprocessorType == "exact")
37                        p = new ExactPreprocessor();
38                else
39                        if (preprocessorType == "sampling")
40                                p = new SamplingPreprocessor();
41                        else {
42                                cerr<<"Unknown preprocessor type"<<endl;
43                                Debug<<"Unknown preprocessor type"<<endl;
44                                exit(1);
45                        }
46       
47
[170]48  environment->GetStringValue("Scene.filename", buff);
49  string filename(buff);
50
51  p->LoadScene(filename);
[387]52       
[162]53  p->BuildKdTree();
54  p->KdTreeStatistics(cout);
[310]55 
[439]56  // parse view cells related options
57  p->PrepareViewCells();
[260]58
[422]59
[162]60  //  p->mSceneGraph->Export("soda.x3d");
[176]61  if (0) {
[242]62    p->Export(filename + "-out.x3d", true, false, false);
[263]63    p->Export(filename + "-kdtree.x3d", false, true, false);   
[170]64  }
65 
[261]66   
[335]67  if (1) {
[176]68    p->ComputeVisibility();
69    p->ExportPreprocessedData("scene.vis");
70  }
[235]71
[386]72        Camera camera;
[344]73  if (0) {
[237]74    //camera.LookAtBox(p->mKdTree->GetBox());
[333]75                camera.LookInBox(p->mKdTree->GetBox());
76                camera.SetPosition(camera.mPosition + Vector3(0,300,0));
[191]77    camera.SnapImage("camera.jpg", p->mKdTree);
[386]78        }
79        if (0) {
[170]80    camera.LookInBox(p->mKdTree->GetBox());
81    camera.SetPosition(camera.mPosition - Vector3(0,100,0));
[333]82    camera.SnapImage("camera2.jpg", p->mKdTree);
[170]83  }
[162]84
[386]85        if (0) {
86    camera.SetPosition( p->mKdTree->GetBox().Center() - Vector3(0,-100,0) );
87                camera.SetDirection(Vector3(1, 0, 0));
88                camera.SnapImage("camera3.jpg", p->mKdTree);
89  }
90
[261]91  // clean up
92  DEL_PTR(p);
93  DEL_PTR(environment);
94
[162]95  return 0;
96}
97
Note: See TracBrowser for help on using the repository browser.