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

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

cosine sampling bug fixed

Line 
1//#include <boost/algorithm/string.hpp>
2
3#include <stack>
4#include "SceneGraph.h"
5#include "X3dExporter.h"
6
7
8
9bool
10SceneGraph::Export( const string filename )
11{
12  if (strstr(filename.c_str(), ".x3d")) {
13    X3dExporter exporter(filename);
14    exporter.ExportScene(mRoot);
15    return true;
16  } else {
17    cerr<<"Error: Currently unsuported export format, filename "<<filename<<endl;
18   
19  }
20 
21 
22    return false;
23 
24}
25
26
27int
28SceneGraph::CollectObjects(ObjectContainer *instances)
29{
30  int number = 0;
31  stack<SceneGraphNode *> nodeStack;
32 
33  nodeStack.push(mRoot);
34 
35  while (!nodeStack.empty()) {
36    SceneGraphNode *node = nodeStack.top();
37    nodeStack.pop();
38
39    ObjectContainer::const_iterator mi = node->mGeometry.begin();
40    for (; mi != node->mGeometry.end(); mi++)
41      instances->push_back(*mi);
42   
43    SceneGraphNodeContainer::iterator ni = node->mChildren.begin();
44    for (; ni != node->mChildren.end(); ni++) {
45      nodeStack.push(*ni);
46      number++;
47    }
48   
49  }
50  return number;
51}
52
53
Note: See TracBrowser for help on using the repository browser.