Changeset 162 for trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp
- Timestamp:
- 07/11/05 00:02:07 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp
r65 r162 1 #include "SceneGraph.h" 2 #include "Exporter.h" 3 #include "UnigraphicsParser.h" 1 4 #include "Preprocessor.h" 2 #include "SamplingPreprocessor.h"3 #include "ExactPreprocessor.h"4 5 5 namespace GtpVisibilityPreprocessor {6 6 7 bool8 Preprocessor::LoadViewcells(const string filename)9 {10 7 8 9 bool 10 Preprocessor::LoadViewcells(const string filename) 11 { 12 13 return true; 14 } 15 16 bool 17 Preprocessor::GenerateViewcells() 18 { 19 20 return true; 21 } 22 23 bool 24 Preprocessor::LoadScene(const string filename) 25 { 26 // use leaf nodes of the original spatial hiearrchy as occludees 27 28 mSceneGraph = new SceneGraph; 29 Parser *parser = new UnigraphicsParser; 30 bool result = parser->ParseFile(filename, &mSceneGraph->mRoot); 31 32 return result; 33 } 34 35 bool 36 Preprocessor::ExportPreprocessedData(const string filename) 37 { 38 return false; 39 } 40 41 bool 42 Preprocessor::BuildKdTree() 43 { 44 mKdTree = new KdTree; 45 // add mesh instances of the scene graph to the root of the tree 46 KdLeaf *root = (KdLeaf *)mKdTree->GetRoot(); 47 mSceneGraph->CollectMeshInstaces(&root->mObjects); 48 49 mKdTree->Construct(); 50 return true; 51 } 52 53 54 void 55 Preprocessor::KdTreeStatistics(ostream &s) 56 { 57 s<<mKdTree->GetStatistics(); 58 } 59 60 61 bool 62 Preprocessor::Export( const string filename, 63 const bool scene, 64 const bool kdtree 65 ) 66 { 67 Exporter *exporter = Exporter::GetExporter(filename); 68 69 if (exporter) { 70 if (scene) 71 exporter->ExportScene(mSceneGraph->mRoot); 72 73 if (kdtree) { 74 exporter->SetWireframe(); 75 exporter->ExportKdTree(*mKdTree); 76 } 77 78 delete exporter; 11 79 return true; 12 80 } 13 81 14 bool 15 Preprocessor::GenerateViewcells() 16 { 17 18 return true; 19 } 20 21 bool 22 Preprocessor::LoadScene(const string filename) 23 { 24 // use leaf nodes of the original spatial hiearrchy as occludees 25 26 return true; 27 } 82 return false; 83 } 28 84 29 bool30 Preprocessor::ExportPreprocessedData(const string filename)31 {32 return false;33 }34 35 bool36 Preprocessor::BuildKdTree()37 {38 mKdTree = new KdTree;39 mKdTree->Subdivide(mKdTree->GetRoot());40 return true;41 }42 43 };44 85 45 int 46 main(int argc, char **argv) 47 { 48 GtpVisibilityPreprocessor::Preprocessor *p = new GtpVisibilityPreprocessor::SamplingPreprocessor(); 49 p->LoadScene("scene.wrl"); 50 p->LoadViewcells("viewcells.wrl"); 51 p->ComputeVisibility(); 52 p->ExportPreprocessedData("scene.vis"); 53 return 0; 54 } 86
Note: See TracChangeset
for help on using the changeset viewer.