source: GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.h @ 2610

Revision 2610, 1.9 KB checked in by bittner, 16 years ago (diff)

pixel error computation revival

Line 
1#ifndef _SceneGraph_H__
2#define _SceneGraph_H__
3
4#include <string>
5#include "Containers.h"
6#include "AxisAlignedBox3.h"
7#include "Matrix4x4.h"
8
9namespace GtpVisibilityPreprocessor {
10
11
12/** Basic scene graph node, we are interested only in bounding boxes and topology
13    of the scene graph
14*/
15class SceneGraphNode
16{
17public:
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*/
33class SceneGraphInterior: public SceneGraphNode
34{
35public:
36        virtual bool IsLeaf() const { return false; }
37        virtual void UpdateBox();
38
39        ~SceneGraphInterior();
40
41//protected:
42
43        SceneGraphNodeContainer mChildren;
44};
45
46
47/** Scene graph leaf node.
48*/
49class SceneGraphLeaf: public SceneGraphNode
50{
51public:
52
53        SceneGraphLeaf(bool isDynamic = false):
54          mIsDynamic(isDynamic){}
55        ~SceneGraphLeaf();
56
57        virtual void Transform(const Matrix4x4 &trafo);
58        virtual bool IsDynamic() const { return mIsDynamic;}
59        virtual bool IsLeaf() const { return true; }
60        virtual void UpdateBox();
61
62        ObjectContainer mGeometry;
63
64protected:
65
66        bool mIsDynamic;
67        Matrix4x4 mTrafo;
68};
69
70
71
72/** Scene graph class
73*/
74class SceneGraph
75{
76
77public:
78
79        SceneGraph();
80        ~SceneGraph();
81       
82        bool Export(const std::string filename);
83 
84        int CollectObjects(ObjectContainer &instances);
85 
86        int AssignObjectIds();
87 
88        void GetStatistics(int &intersectables, int &faces) const;
89
90        AxisAlignedBox3 GetBox() const { return mRoot->mBox; }
91        /** Exports binary version of the scene.
92        */
93        void ExportScene(const std::string filename);
94        /** Loads binary version of the scene.
95        */
96        void LoadScene(const std::string filename);
97
98        SceneGraphInterior *GetRoot();
99
100        //void SetRoot(SceneGraphNode *sgNnode);
101        void SetRoot(SceneGraphInterior *sgNnode);
102
103        void AddChild(SceneGraphNode *node);
104
105        int GetSize() const;
106
107protected:
108
109         SceneGraphInterior *mRoot;
110};
111
112
113}
114
115#endif
Note: See TracBrowser for help on using the repository browser.