#ifndef _SceneGraph_H__ #define _SceneGraph_H__ #include #include "Containers.h" #include "AxisAlignedBox3.h" namespace GtpVisibilityPreprocessor { /** Basic scene graph node, we are interested only in bounding boxes and topology of the scene graph */ class SceneGraphNode { public: virtual ~SceneGraphNode(); virtual bool IsLeaf() const = 0; virtual void UpdateBox() = 0; //protected: AxisAlignedBox3 mBox; }; /** Scene graph interior node. */ class SceneGraphInterior: public SceneGraphNode { public: virtual bool IsLeaf() const { return false; } virtual void UpdateBox(); //protected: NodeContainer mChildren; }; /** Scene graph leaf node. */ class SceneGraphLeaf: public SceneGraphNode { public: virtual bool IsLeaf() const { return true; } virtual void UpdateBox(); //protected: MeshContainer mGeometry; }; /** Scene graph class */ class SceneGraph { public: SceneGraph(); ~SceneGraph(); bool Export(const std::string filename); int CollectObjects(ObjectContainer *instances); int AssignObjectIds(); void GetStatistics(int &intersectables, int &faces) const; AxisAlignedBox3 GetBox() const { return mRoot->mBox; } /** Exports binary version of the scene. */ void ExportScene(const std::string filename); /** Loads binary version of the scene. */ void LoadScene(const std::string filename); SceneGraphNode *GetRoot(); void SetRoot(SceneGraphNode *sgNnode); protected: SceneGraphNode *mRoot; }; } #endif