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