Revision 162,
1.4 KB
checked in by bittner, 19 years ago
(diff) |
functional raycasting version
|
Rev | Line | |
---|
[162] | 1 | #include "SceneGraph.h" |
---|
| 2 | #include "Exporter.h" |
---|
| 3 | #include "UnigraphicsParser.h" |
---|
[65] | 4 | #include "Preprocessor.h" |
---|
| 5 | |
---|
| 6 | |
---|
| 7 | |
---|
[162] | 8 | |
---|
| 9 | bool |
---|
| 10 | Preprocessor::LoadViewcells(const string filename) |
---|
| 11 | { |
---|
| 12 | |
---|
| 13 | return true; |
---|
| 14 | } |
---|
[65] | 15 | |
---|
[162] | 16 | bool |
---|
| 17 | Preprocessor::GenerateViewcells() |
---|
| 18 | { |
---|
| 19 | |
---|
| 20 | return true; |
---|
| 21 | } |
---|
[65] | 22 | |
---|
[162] | 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); |
---|
[65] | 31 | |
---|
[162] | 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); |
---|
[65] | 48 | |
---|
[162] | 49 | mKdTree->Construct(); |
---|
| 50 | return true; |
---|
| 51 | } |
---|
[65] | 52 | |
---|
[162] | 53 | |
---|
| 54 | void |
---|
| 55 | Preprocessor::KdTreeStatistics(ostream &s) |
---|
[65] | 56 | { |
---|
[162] | 57 | s<<mKdTree->GetStatistics(); |
---|
[65] | 58 | } |
---|
[162] | 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; |
---|
| 79 | return true; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | return false; |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | |
---|
| 86 | |
---|
Note: See
TracBrowser
for help on using the repository browser.