Revision 176,
1.5 KB
checked in by bittner, 19 years ago
(diff) |
cosine sampling bug fixed
|
Line | |
---|
1 | #include "SceneGraph.h" |
---|
2 | #include "Exporter.h" |
---|
3 | #include "UnigraphicsParser.h" |
---|
4 | #include "X3dParser.h" |
---|
5 | #include "Preprocessor.h" |
---|
6 | |
---|
7 | |
---|
8 | |
---|
9 | |
---|
10 | bool |
---|
11 | Preprocessor::LoadViewcells(const string filename) |
---|
12 | { |
---|
13 | |
---|
14 | return true; |
---|
15 | } |
---|
16 | |
---|
17 | bool |
---|
18 | Preprocessor::GenerateViewcells() |
---|
19 | { |
---|
20 | |
---|
21 | return true; |
---|
22 | } |
---|
23 | |
---|
24 | bool |
---|
25 | Preprocessor::LoadScene(const string filename) |
---|
26 | { |
---|
27 | // use leaf nodes of the original spatial hiearrchy as occludees |
---|
28 | |
---|
29 | mSceneGraph = new SceneGraph; |
---|
30 | |
---|
31 | |
---|
32 | Parser *parser; |
---|
33 | |
---|
34 | if (strstr(filename.c_str(), ".x3d")) |
---|
35 | parser = new X3dParser; |
---|
36 | else |
---|
37 | parser = new UnigraphicsParser; |
---|
38 | |
---|
39 | bool result = parser->ParseFile(filename, &mSceneGraph->mRoot); |
---|
40 | |
---|
41 | return result; |
---|
42 | } |
---|
43 | |
---|
44 | bool |
---|
45 | Preprocessor::ExportPreprocessedData(const string filename) |
---|
46 | { |
---|
47 | return false; |
---|
48 | } |
---|
49 | |
---|
50 | bool |
---|
51 | Preprocessor::BuildKdTree() |
---|
52 | { |
---|
53 | mKdTree = new KdTree; |
---|
54 | // add mesh instances of the scene graph to the root of the tree |
---|
55 | KdLeaf *root = (KdLeaf *)mKdTree->GetRoot(); |
---|
56 | mSceneGraph->CollectObjects(&root->mObjects); |
---|
57 | |
---|
58 | mKdTree->Construct(); |
---|
59 | return true; |
---|
60 | } |
---|
61 | |
---|
62 | |
---|
63 | void |
---|
64 | Preprocessor::KdTreeStatistics(ostream &s) |
---|
65 | { |
---|
66 | s<<mKdTree->GetStatistics(); |
---|
67 | } |
---|
68 | |
---|
69 | |
---|
70 | bool |
---|
71 | Preprocessor::Export( const string filename, |
---|
72 | const bool scene, |
---|
73 | const bool kdtree |
---|
74 | ) |
---|
75 | { |
---|
76 | Exporter *exporter = Exporter::GetExporter(filename); |
---|
77 | |
---|
78 | if (exporter) { |
---|
79 | if (scene) |
---|
80 | exporter->ExportScene(mSceneGraph->mRoot); |
---|
81 | |
---|
82 | if (kdtree) { |
---|
83 | exporter->SetWireframe(); |
---|
84 | exporter->ExportKdTree(*mKdTree); |
---|
85 | } |
---|
86 | |
---|
87 | delete exporter; |
---|
88 | return true; |
---|
89 | } |
---|
90 | |
---|
91 | return false; |
---|
92 | } |
---|
93 | |
---|
94 | |
---|
95 | |
---|
Note: See
TracBrowser
for help on using the repository browser.