source: trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp @ 162

Revision 162, 1.4 KB checked in by bittner, 19 years ago (diff)

functional raycasting version

Line 
1#include "SceneGraph.h"
2#include "Exporter.h"
3#include "UnigraphicsParser.h"
4#include "Preprocessor.h"
5
6
7
8 
9bool
10Preprocessor::LoadViewcells(const string filename)
11{
12 
13  return true;
14}
15
16bool
17Preprocessor::GenerateViewcells()
18{
19 
20  return true;
21}
22
23bool
24Preprocessor::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
35bool
36Preprocessor::ExportPreprocessedData(const string filename)
37{
38  return false;
39}
40
41bool
42Preprocessor::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
54void
55Preprocessor::KdTreeStatistics(ostream &s)
56{
57  s<<mKdTree->GetStatistics();
58}
59
60
61bool
62Preprocessor::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.