#include "SamplingPreprocessor.h" #include "VssPreprocessor.h" #include "RssPreprocessor.h" #include "ExactPreprocessor.h" #include "Parser.h" #include "UnigraphicsParser.h" #include "X3dParser.h" #include "Environment.h" #include "Camera.h" #include "MeshKdTree.h" #include "Exporter.h" #include "X3dExporter.h" // delete later #include "ViewCell.h" #include "SceneGraph.h" #define USE_EXE_PATH false int main(int argc, const char **argv) { Debug.open("debug.log"); environment = new Environment; environment->Parse(argc, argv, USE_EXE_PATH); MeshKdTree::ParseEnvironment(); char buff[128]; environment->GetStringValue("Preprocessor.type", buff); string preprocessorType(buff); Preprocessor *p; if (preprocessorType == "vss") p = new VssPreprocessor(); else if (preprocessorType == "rss") p = new RssPreprocessor(); else if (preprocessorType == "exact") p = new ExactPreprocessor(); else if (preprocessorType == "sampling") p = new SamplingPreprocessor(); else { cerr<<"Unknown preprocessor type"<GetStringValue("Scene.filename", buff); string filename(buff); p->LoadScene(filename); p->BuildKdTree(); p->KdTreeStatistics(cout); // parse view cells related options p->PrepareViewCells(); // p->mSceneGraph->Export("soda.x3d"); if (0) { p->Export(filename + "-out.x3d", true, false, false); p->Export(filename + "-kdtree.x3d", false, true, false); } if (1) { p->ComputeVisibility(); p->ExportPreprocessedData("scene.vis"); } Camera camera; if (0) { //camera.LookAtBox(p->mKdTree->GetBox()); camera.LookInBox(p->mKdTree->GetBox()); camera.SetPosition(camera.mPosition + Vector3(0,300,0)); camera.SnapImage("camera.jpg", p->mKdTree); } if (0) { camera.LookInBox(p->mKdTree->GetBox()); camera.SetPosition(camera.mPosition - Vector3(0,100,0)); camera.SnapImage("camera2.jpg", p->mKdTree); } if (0) { camera.SetPosition( p->mKdTree->GetBox().Center() - Vector3(0,-100,0) ); camera.SetDirection(Vector3(1, 0, 0)); camera.SnapImage("camera3.jpg", p->mKdTree); } // clean up DEL_PTR(p); DEL_PTR(environment); return 0; }