[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"
|
---|
[162] | 9 |
|
---|
| 10 | #define USE_EXE_PATH false
|
---|
| 11 |
|
---|
| 12 |
|
---|
| 13 | int
|
---|
| 14 | main(int argc, const char **argv)
|
---|
| 15 | {
|
---|
| 16 | Debug.open("debug.log");
|
---|
| 17 | environment = new Environment;
|
---|
| 18 | environment->Parse(argc, argv, USE_EXE_PATH);
|
---|
[170] | 19 | MeshKdTree::ParseEnvironment();
|
---|
[235] | 20 | BspTree::ParseEnvironment();
|
---|
| 21 |
|
---|
[162] | 22 | Preprocessor *p =
|
---|
| 23 | new SamplingPreprocessor();
|
---|
| 24 |
|
---|
[170] | 25 | char buff[128];
|
---|
| 26 | environment->GetStringValue("Scene.filename", buff);
|
---|
| 27 | string filename(buff);
|
---|
| 28 |
|
---|
| 29 | p->LoadScene(filename);
|
---|
[235] | 30 |
|
---|
[162] | 31 | p->BuildKdTree();
|
---|
| 32 | p->KdTreeStatistics(cout);
|
---|
[260] | 33 |
|
---|
[235] | 34 | #ifdef TEST_BSP_VIEWCELLS
|
---|
[260] | 35 | environment->GetStringValue("Scene.viewcells", buff);
|
---|
| 36 |
|
---|
[261] | 37 | string viewCellsFile(buff);
|
---|
| 38 | p->LoadViewCells(viewCellsFile);
|
---|
| 39 |
|
---|
[235] | 40 | p->BspTreeStatistics(Debug);
|
---|
[234] | 41 | #endif
|
---|
| 42 |
|
---|
[162] | 43 | // p->mSceneGraph->Export("soda.x3d");
|
---|
[176] | 44 | if (0) {
|
---|
[242] | 45 | p->Export(filename + "-out.x3d", true, false, false);
|
---|
| 46 | p->Export(filename + "-kdtree.x3d", false, true, false);
|
---|
[170] | 47 | }
|
---|
| 48 |
|
---|
[261] | 49 |
|
---|
[176] | 50 | if (1) {
|
---|
| 51 | p->ComputeVisibility();
|
---|
| 52 | p->ExportPreprocessedData("scene.vis");
|
---|
| 53 | }
|
---|
[235] | 54 |
|
---|
[237] | 55 | if (1) {
|
---|
[170] | 56 | Camera camera;
|
---|
[237] | 57 | //camera.LookAtBox(p->mKdTree->GetBox());
|
---|
| 58 | camera.LookInBox(p->mKdTree->GetBox());
|
---|
| 59 | camera.SetPosition(camera.mPosition + Vector3(0,300,0));
|
---|
[191] | 60 | camera.SnapImage("camera.jpg", p->mKdTree);
|
---|
| 61 |
|
---|
[170] | 62 |
|
---|
| 63 | camera.LookInBox(p->mKdTree->GetBox());
|
---|
| 64 | camera.SetPosition(camera.mPosition - Vector3(0,100,0));
|
---|
| 65 | camera.SnapImage("camera2.png", p->mKdTree);
|
---|
| 66 | }
|
---|
[162] | 67 |
|
---|
[261] | 68 | // clean up
|
---|
| 69 | DEL_PTR(p);
|
---|
| 70 | DEL_PTR(environment);
|
---|
| 71 |
|
---|
[162] | 72 | return 0;
|
---|
| 73 | }
|
---|
| 74 |
|
---|