#include "SceneGraph.h" #include "Exporter.h" #include "UnigraphicsParser.h" #include "Preprocessor.h" bool Preprocessor::LoadViewcells(const string filename) { return true; } bool Preprocessor::GenerateViewcells() { return true; } bool Preprocessor::LoadScene(const string filename) { // use leaf nodes of the original spatial hiearrchy as occludees mSceneGraph = new SceneGraph; Parser *parser = new UnigraphicsParser; bool result = parser->ParseFile(filename, &mSceneGraph->mRoot); return result; } bool Preprocessor::ExportPreprocessedData(const string filename) { return false; } bool Preprocessor::BuildKdTree() { mKdTree = new KdTree; // add mesh instances of the scene graph to the root of the tree KdLeaf *root = (KdLeaf *)mKdTree->GetRoot(); mSceneGraph->CollectMeshInstaces(&root->mObjects); mKdTree->Construct(); return true; } void Preprocessor::KdTreeStatistics(ostream &s) { s<GetStatistics(); } bool Preprocessor::Export( const string filename, const bool scene, const bool kdtree ) { Exporter *exporter = Exporter::GetExporter(filename); if (exporter) { if (scene) exporter->ExportScene(mSceneGraph->mRoot); if (kdtree) { exporter->SetWireframe(); exporter->ExportKdTree(*mKdTree); } delete exporter; return true; } return false; }