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

Revision 176, 1.5 KB checked in by bittner, 19 years ago (diff)

cosine sampling bug fixed

RevLine 
[162]1#include "SceneGraph.h"
2#include "Exporter.h"
3#include "UnigraphicsParser.h"
[170]4#include "X3dParser.h"
[65]5#include "Preprocessor.h"
6
7
8
[162]9 
10bool
11Preprocessor::LoadViewcells(const string filename)
12{
13 
14  return true;
15}
[65]16
[162]17bool
18Preprocessor::GenerateViewcells()
19{
20 
21  return true;
22}
[65]23
[162]24bool
25Preprocessor::LoadScene(const string filename)
26{
27  // use leaf nodes of the original spatial hiearrchy as occludees
28
29  mSceneGraph = new SceneGraph;
[170]30
31 
32  Parser *parser;
33
34  if (strstr(filename.c_str(), ".x3d"))
35    parser = new X3dParser;
36  else
37    parser = new UnigraphicsParser;
38
[162]39  bool result = parser->ParseFile(filename, &mSceneGraph->mRoot);
[65]40 
[162]41  return result;
42}
43
44bool
45Preprocessor::ExportPreprocessedData(const string filename)
46{
47  return false;
48}
49
50bool
51Preprocessor::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();
[176]56  mSceneGraph->CollectObjects(&root->mObjects);
[65]57 
[162]58  mKdTree->Construct();
59  return true;
60}
[65]61
[162]62
63void
64Preprocessor::KdTreeStatistics(ostream &s)
[65]65{
[162]66  s<<mKdTree->GetStatistics();
[65]67}
[162]68
69
70bool
71Preprocessor::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.