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