#ifndef _GtpVisibilityHierarchyInterface_H__ #define _GtpVisibilityHierarchyInterface_H__ #include "DistanceQueue.h" namespace GtpVisibility { /** Class which implements a hierarchy interface for a scene hierarchy. */ class HierarchyInterface { public: /** Default constructor. */ HierarchyInterface(); virtual ~HierarchyInterface(); /** Returns true if current node is leaf of the hierarchy. @param node hierarchy node @returns true if node is leaf */ virtual bool IsLeaf(HierarchyNode *node) const = 0; /** Traverses the given node. @param node the hierarchy node */ virtual void TraverseNode(HierarchyNode *node) = 0; /** Renders current scene node . @param node current scene node to be rendered */ virtual void RenderNode(HierarchyNode *node) = 0; /** Pulls up the visibility from the current node recursively to the parent nodes. @param node the current node */ virtual void PullUpVisibility(HierarchyNode *node) = 0; /** Issue a occlusion query for this node. @param node the current hierarchy node @returns occlusion query for this node */ virtual OcclusionQuery *IssueOcclusionQuery(HierarchyNode *node) = 0; /** Sets the root of the scene hierarchy. @param root the hierarchy root */ void SetSceneRoot(HierarchyNode *root); /** Get the root of the scene hierarchy. @return the hierarchy root */ HierarchyNode *GetSceneRoot() const; /** Sets the scene root and initialises this scene traverser for a traversal. @param root current scene root @remark initialises some parameters, and also the statistics. */ void InitFrame(HierarchyNode *root); /** Returns current frame id. @returns frame id */ unsigned int GetFrameId() const; /** Returns the current distance queue. @returns current distance queue */ DistanceQueue *GetQueue(); /** Returns true if node 1 has greater distance to the view plane than node 2. @param node1 the first node to be compared @param node2 the second node to be compared */ virtual bool HasGreaterDistance(HierarchyNode *node1, HierarchyNode *node2) const = 0; /** 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 */ virtual bool CheckFrustumVisible(HierarchyNode *node, bool &intersects) = 0; /** Checks if the node is visible from the current view frustum. @param node the current node */ bool CheckFrustumVisible(HierarchyNode *node); /** Returns next available occlusion query or creates new one. @return the next occlusion query */ virtual OcclusionQuery *GetNextOcclusionQuery() = 0; /** Returns true if there is renderable geometry attached to this node @param node the current node @returns if the node has renderable geometry */ virtual bool HasGeometry(HierarchyNode *node) const = 0; /** Sets the visible flag for this node. @param node the current node @param visible the visible flag */ virtual void SetNodeVisible(HierarchyNode *node, const bool visible) = 0; /** Returns true if node has the visible flag set. See set */ virtual bool IsNodeVisible(HierarchyNode *node) const = 0; /** Sets the last visited frame id for this node. @param node the current node @param frameId the current frame id */ virtual void SetLastVisited(HierarchyNode *node, const unsigned int frameId) = 0; /** Returns frame id when this node was last visited by the traverser. See set */ virtual unsigned int LastVisited(HierarchyNode *node) const = 0; /** Returns number of traversed nodes. */ unsigned int GetNumTraversedNodes(); /** Returns number of rendered nodes. */ unsigned int GetNumRenderedNodes(); protected: unsigned int mFrameId; int mCurrentTestIdx; //--- statistics unsigned int mNumTraversedNodes; unsigned int mNumRenderedNodes; DistanceQueue *mDistanceQueue; HierarchyNode *mSceneRoot; //HierarchyNode *mCurrentNode; }; } // namespace GtpVisibility #endif // GtpVisisibilityHierarchyInterface_H