#ifndef _PlatformHierarchyInterface_H__ #define _PlatformHierarchyInterface_H__ #include #include #include #include //#include "OgreSolidHalfBoundingBox.h" #include "OgreSolidBoundingBox.h" #include "HierarchyInterface.h" #include "OgrePlatformOcclusionQuery.h" /** This namespace contains the Ogre dependent classes. */ namespace Ogre { /** Class which implements a hierarchy interface for a specific type of hierarchy. @remark also provides methods for using occlusion queries on the hierarchy nodes */ class PlatformHierarchyInterface: public GtpVisibility::HierarchyInterface { public: /** Construction taking the current scene manager and the current rendersystem as argument @param sm current scene manager @param rsys current render system */ PlatformHierarchyInterface(SceneManager *sm, RenderSystem *rsys); ~PlatformHierarchyInterface(); /** Returns next available occlusion query or creates new one. @return the next occlusion query */ GtpVisibility::OcclusionQuery *GetNextOcclusionQuery(); /** Sets the current camera used for the rendering. @param cam the current camera */ void SetCamera(Camera *cam); /** Sets the current camera used for culling. @param cam the current camera @remark the default is the camera used for rendering */ void SetCullCamera(Camera *cullCam); /** Initialises this scene traverser for the current frame. @param root root of the hierarchy @param cam current camera @param cullCam the camera used for culling. If null, the current camera is used @remark convenience method wich calls VisibilitySceneTraverser::initFrame, sets the current camera, and initialises the distance queue. */ void InitFrame(GtpVisibility::HierarchyNode *root, Camera *cam, Camera *cullCam = NULL); /** Checks if the node is visible from the current view frustum. @param node the current node @param intersects returns true if the current node intersects the near plane */ bool CheckFrustumVisible(GtpVisibility::HierarchyNode *node, bool &intersects); /** Sets pointer to the current scene manager. @param sm the scene manager */ void SetSceneManager(SceneManager *sm); /** Sets pointer to the current render system @param rsys the rendersystem */ void SetRenderSystem(RenderSystem *rsys); /** Returns pointer to bounding box of node. @param node current hierarchy node @returns bounding box of current node */ virtual AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node) = 0; /** Issue a occlusion query for this node. @param node the current hierarchy node @param wasVisible if the node was visible in the last frame @returns occlusion query for this node */ GtpVisibility::OcclusionQuery *IssueOcclusionQuery( GtpVisibility::HierarchyNode *node, const bool wasVisible); protected: /** Deletes all occlusion queries. */ void DeleteQueries(); /** Renders bounding box of specified node. @param box the bounding box of the scene node to be rendered */ void RenderBoundingBox(AxisAlignedBox *box); /** Returns pointer to current renderable half bounding box geometry */ //SolidHalfBoundingBox *GetSolidHalfBoundingBox(); /** Returns pointer to current renderable bounding box geometry */ SolidBoundingBox *GetSolidBoundingBox(); /** one renderable half of an aabb. */ SolidBoundingBox *mSolidBoundingBox; SceneManager *mSceneManager; RenderSystem *mRenderSystem; Camera *mCamera; Camera *mCullCamera; AxisAlignedBox mBox; std::vector mOcclusionQueries; }; } // namespace Ogre #endif // PlatformHierarchyInterface_H