Revision 2600,
1.5 KB
checked in by mattausch, 16 years ago
(diff) |
preparing for moving objects (contains compile errors!)
|
Line | |
---|
1 | #ifndef _SceneGraph_H__
|
---|
2 | #define _SceneGraph_H__
|
---|
3 |
|
---|
4 | #include <string>
|
---|
5 | #include "Containers.h"
|
---|
6 | #include "AxisAlignedBox3.h"
|
---|
7 |
|
---|
8 |
|
---|
9 | namespace GtpVisibilityPreprocessor {
|
---|
10 |
|
---|
11 | |
---|
12 | /** Basic scene graph node, we are interested only in bounding boxes and topology |
---|
13 | of the scene graph |
---|
14 | */ |
---|
15 | class SceneGraphNode |
---|
16 | { |
---|
17 | public:
|
---|
18 |
|
---|
19 | virtual ~SceneGraphNode();
|
---|
20 | virtual bool IsLeaf() const = 0; |
---|
21 | |
---|
22 | virtual void UpdateBox() = 0;
|
---|
23 | |
---|
24 | //protected: |
---|
25 | |
---|
26 | AxisAlignedBox3 mBox; |
---|
27 | }; |
---|
28 | |
---|
29 | |
---|
30 | |
---|
31 | /** Scene graph interior node. |
---|
32 | */ |
---|
33 | class SceneGraphInterior: public SceneGraphNode |
---|
34 | { |
---|
35 | public: |
---|
36 | virtual bool IsLeaf() const { return false; } |
---|
37 | virtual void UpdateBox();
|
---|
38 | |
---|
39 | //protected: |
---|
40 | |
---|
41 | NodeContainer mChildren; |
---|
42 | }; |
---|
43 | |
---|
44 | |
---|
45 | /** Scene graph leaf node. |
---|
46 | */ |
---|
47 | class SceneGraphLeaf: public SceneGraphNode |
---|
48 | { |
---|
49 | public: |
---|
50 | |
---|
51 | virtual bool IsLeaf() const { return true; } |
---|
52 | virtual void UpdateBox();
|
---|
53 | |
---|
54 | //protected: |
---|
55 | |
---|
56 | MeshContainer mGeometry; |
---|
57 | }; |
---|
58 |
|
---|
59 |
|
---|
60 |
|
---|
61 | /** Scene graph class */
|
---|
62 | class SceneGraph {
|
---|
63 |
|
---|
64 | public:
|
---|
65 |
|
---|
66 | SceneGraph();
|
---|
67 | ~SceneGraph();
|
---|
68 |
|
---|
69 | bool Export(const std::string filename);
|
---|
70 |
|
---|
71 | int CollectObjects(ObjectContainer *instances);
|
---|
72 |
|
---|
73 | int AssignObjectIds();
|
---|
74 |
|
---|
75 | void GetStatistics(int &intersectables, int &faces) const;
|
---|
76 |
|
---|
77 | AxisAlignedBox3 GetBox() const { return mRoot->mBox; }
|
---|
78 |
|
---|
79 | /** Exports binary version of the scene.
|
---|
80 | */
|
---|
81 | void ExportScene(const std::string filename);
|
---|
82 |
|
---|
83 | /** Loads binary version of the scene.
|
---|
84 | */
|
---|
85 | void LoadScene(const std::string filename);
|
---|
86 |
|
---|
87 | SceneGraphNode *GetRoot();
|
---|
88 |
|
---|
89 | void SetRoot(SceneGraphNode *sgNnode);
|
---|
90 |
|
---|
91 |
|
---|
92 | protected:
|
---|
93 |
|
---|
94 | SceneGraphNode *mRoot;
|
---|
95 | };
|
---|
96 |
|
---|
97 |
|
---|
98 | }
|
---|
99 |
|
---|
100 | #endif
|
---|
Note: See
TracBrowser
for help on using the repository browser.