[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 | environment->GetStringValue("Preprocessor.type", buff);
|
---|
| 29 | string preprocessorType(buff);
|
---|
[374] | 30 |
|
---|
| 31 | Preprocessor *p;
|
---|
| 32 |
|
---|
[464] | 33 | if (preprocessorType == "vss")
|
---|
| 34 | p = new VssPreprocessor();
|
---|
| 35 | else
|
---|
| 36 | if (preprocessorType == "rss")
|
---|
| 37 | p = new RssPreprocessor();
|
---|
[374] | 38 | else
|
---|
[464] | 39 | if (preprocessorType == "exact")
|
---|
| 40 | p = new ExactPreprocessor();
|
---|
[446] | 41 | else
|
---|
[464] | 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 |
|
---|
[446] | 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 | // parse view cells related options
|
---|
| 60 | p->PrepareViewCells();
|
---|
[260] | 61 |
|
---|
[162] | 62 | // p->mSceneGraph->Export("soda.x3d");
|
---|
[176] | 63 | if (0) {
|
---|
[242] | 64 | p->Export(filename + "-out.x3d", true, false, false);
|
---|
[263] | 65 | p->Export(filename + "-kdtree.x3d", false, true, false);
|
---|
[170] | 66 | }
|
---|
| 67 |
|
---|
[261] | 68 |
|
---|
[335] | 69 | if (1) {
|
---|
[176] | 70 | p->ComputeVisibility();
|
---|
| 71 | p->ExportPreprocessedData("scene.vis");
|
---|
| 72 | }
|
---|
[235] | 73 |
|
---|
[386] | 74 | Camera camera;
|
---|
[344] | 75 | if (0) {
|
---|
[237] | 76 | //camera.LookAtBox(p->mKdTree->GetBox());
|
---|
[333] | 77 | camera.LookInBox(p->mKdTree->GetBox());
|
---|
| 78 | camera.SetPosition(camera.mPosition + Vector3(0,300,0));
|
---|
[191] | 79 | camera.SnapImage("camera.jpg", p->mKdTree);
|
---|
[386] | 80 | }
|
---|
| 81 | if (0) {
|
---|
[170] | 82 | camera.LookInBox(p->mKdTree->GetBox());
|
---|
| 83 | camera.SetPosition(camera.mPosition - Vector3(0,100,0));
|
---|
[333] | 84 | camera.SnapImage("camera2.jpg", p->mKdTree);
|
---|
[170] | 85 | }
|
---|
[162] | 86 |
|
---|
[386] | 87 | if (0) {
|
---|
| 88 | camera.SetPosition( p->mKdTree->GetBox().Center() - Vector3(0,-100,0) );
|
---|
| 89 | camera.SetDirection(Vector3(1, 0, 0));
|
---|
| 90 | camera.SnapImage("camera3.jpg", p->mKdTree);
|
---|
| 91 | }
|
---|
| 92 |
|
---|
[261] | 93 | // clean up
|
---|
| 94 | DEL_PTR(p);
|
---|
| 95 | DEL_PTR(environment);
|
---|
| 96 |
|
---|
[162] | 97 | return 0;
|
---|
| 98 | }
|
---|
| 99 |
|
---|