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

Revision 2615, 2.3 KB checked in by mattausch, 17 years ago (diff)

did some stuff for the visualization

RevLine 
[372]1#ifndef _SceneGraph_H__
2#define _SceneGraph_H__
3
4#include <string>
5#include "Containers.h"
6#include "AxisAlignedBox3.h"
[2609]7#include "Matrix4x4.h"
[372]8
[860]9namespace GtpVisibilityPreprocessor {
[2600]10
[2615]11class SceneGraphLeafIntersectable;
[2600]12
13/** Basic scene graph node, we are interested only in bounding boxes and topology
14    of the scene graph
15*/
16class SceneGraphNode
17{
[372]18public:
19
[2600]20        virtual ~SceneGraphNode();
21        virtual bool IsLeaf() const = 0;
22
23        virtual void UpdateBox() = 0;
24
[2615]25        virtual AxisAlignedBox3 GetBox() const { return mBox; }
[2600]26
[2615]27protected:
28
[2600]29        AxisAlignedBox3 mBox;
30};
31 
32
33
34/** Scene graph interior node.
35*/
36class SceneGraphInterior: public SceneGraphNode
37{
38public:
39        virtual bool IsLeaf() const { return false; }
40        virtual void UpdateBox();
41
[2610]42        ~SceneGraphInterior();
43
[2600]44//protected:
45
[2601]46        SceneGraphNodeContainer mChildren;
[2600]47};
48
49
50/** Scene graph leaf node.
51*/
52class SceneGraphLeaf: public SceneGraphNode
53{
54public:
55
[2615]56        SceneGraphLeaf();
57        SceneGraphLeaf(bool isDynamic);
[2609]58        ~SceneGraphLeaf();
[2615]59       
60        void LoadTransform(const Matrix4x4 &m);
61
62        void GetTransform(Matrix4x4 &m) const;
63
64        virtual AxisAlignedBox3 GetBox() const;
[2609]65
[2615]66        virtual void ApplyTransform(const Matrix4x4 &trafo);
[2609]67        virtual bool IsDynamic() const { return mIsDynamic;}
[2600]68        virtual bool IsLeaf() const { return true; }
69        virtual void UpdateBox();
[2615]70#if DYNAMIC_OBJECT_HACK
71        SceneGraphLeafIntersectable *GetIntersectable() { return mIntersectable;}
72#endif
73        /// used as actual pvs entry
[2609]74        ObjectContainer mGeometry;
[2606]75
[2609]76protected:
[2615]77#if DYNAMIC_OBJECT_HACK
78        SceneGraphLeafIntersectable *mIntersectable;
79#endif
[2609]80        bool mIsDynamic;
81        Matrix4x4 mTrafo;
[2600]82};
[372]83
[2600]84
85
[2609]86/** Scene graph class
87*/
88class SceneGraph
89{
[372]90
91public:
[1002]92
[1328]93        SceneGraph();
[1002]94        ~SceneGraph();
[1328]95       
[2176]96        bool Export(const std::string filename);
[372]97 
[2601]98        int CollectObjects(ObjectContainer &instances);
[492]99 
[1328]100        int AssignObjectIds();
[492]101 
[1328]102        void GetStatistics(int &intersectables, int &faces) const;
[372]103
[2615]104        AxisAlignedBox3 GetBox() const { return mRoot->GetBox(); }
[1328]105        /** Exports binary version of the scene.
106        */
[2176]107        void ExportScene(const std::string filename);
[1328]108        /** Loads binary version of the scene.
109        */
[2176]110        void LoadScene(const std::string filename);
[1166]111
[2601]112        SceneGraphInterior *GetRoot();
[1328]113
[2601]114        //void SetRoot(SceneGraphNode *sgNnode);
115        void SetRoot(SceneGraphInterior *sgNnode);
[1328]116
[2601]117        void AddChild(SceneGraphNode *node);
[1958]118
[2601]119        int GetSize() const;
120
[372]121protected:
[1328]122
[2601]123         SceneGraphInterior *mRoot;
[372]124};
125
126
[860]127}
[372]128
129#endif
Note: See TracBrowser for help on using the repository browser.