source: trunk/VUT/GtpVisibility/include/HierarchyInterface.h @ 74

Revision 74, 4.0 KB checked in by mattausch, 19 years ago (diff)

added support for release mode

Line 
1#ifndef _GtpVisibilityHierarchyInterface_H__
2#define _GtpVisibilityHierarchyInterface_H__
3
4#include "DistanceQueue.h"
5
6namespace GtpVisibility {
7
8/**     Class which implements a hierarchy interface for a scene hierarchy.
9*/
10class HierarchyInterface
11{
12public:
13        /** Default constructor.
14        */
15        HierarchyInterface();
16        virtual ~HierarchyInterface();
17        /** Returns true if current node is leaf of the hierarchy.
18                @param node hierarchy node
19                @returns true if node is leaf
20        */
21    virtual bool IsLeaf(HierarchyNode *node) const = 0;
22        /** Traverses the given node.
23                @param node the hierarchy node
24        */
25        virtual void TraverseNode(HierarchyNode *node) = 0;
26        /** Renders current scene node .
27                @param node current scene node to be rendered
28        */
29        virtual void RenderNode(HierarchyNode *node) = 0;
30        /** Pulls up the visibility from the current node recursively to the parent nodes.
31                @param node the current node
32        */
33        virtual void PullUpVisibility(HierarchyNode *node) = 0;
34        /** Issue a occlusion query for this node.
35                @param node the current hierarchy node
36                @returns occlusion query for this node
37        */
38        virtual OcclusionQuery *IssueOcclusionQuery(HierarchyNode *node) = 0;
39        /** Sets the root of the scene hierarchy.
40                @param root the hierarchy root
41        */
42        void SetSceneRoot(HierarchyNode *root);
43    /** Get the root of the scene hierarchy.
44                @return the hierarchy root
45        */
46        HierarchyNode *GetSceneRoot() const;
47        /** Sets the scene root and initialises this scene traverser for a traversal.
48                @param root current scene root
49                @remark initialises some parameters, and also the statistics.
50        */
51        void InitFrame(HierarchyNode *root);
52        /** Returns current frame id.
53                @returns frame id
54        */
55        unsigned int GetFrameId() const;
56        /** Returns the current distance queue.
57                @returns current distance queue
58        */
59        DistanceQueue *GetQueue();
60        /** Returns true if node 1 has greater distance to the view
61                plane than node 2.
62                @param node1 the first node to be compared
63                @param node2 the second node to be compared
64        */                     
65        virtual bool HasGreaterDistance(HierarchyNode *node1, HierarchyNode *node2) const = 0;
66        /** Checks if the node is visible from the current view frustum.
67                @param node the current node
68                @param intersects returns true if the current node intersects the near plane
69        */
70        virtual bool CheckFrustumVisible(HierarchyNode *node, bool &intersects) = 0;
71        /** Checks if the node is visible from the current view frustum.
72                @param node the current node
73        */
74        bool CheckFrustumVisible(HierarchyNode *node);
75        /** Returns next available occlusion query or creates new one.
76                @return the next occlusion query
77        */
78        virtual OcclusionQuery *GetNextOcclusionQuery() = 0;
79        /** Returns true if there is renderable geometry attached to this node
80                @param node the current node
81                @returns if the node has renderable geometry
82        */
83    virtual bool HasGeometry(HierarchyNode *node) const = 0;
84        /** Sets the visible flag for this node.
85                @param node the current node
86                @param visible the visible flag
87        */
88        virtual void SetNodeVisible(HierarchyNode *node, const bool visible) = 0;
89        /** Returns true if node has the visible flag set. See set
90        */
91        virtual bool IsNodeVisible(HierarchyNode *node) const = 0;
92        /** Sets the last visited frame id for this node.
93                @param node the current node
94                @param frameId the current frame id
95        */
96        virtual void SetLastVisited(HierarchyNode *node,
97                                                                const unsigned int frameId) = 0;
98        /** Returns frame id when this node was last visited by the traverser. See set
99        */
100        virtual unsigned int LastVisited(HierarchyNode *node) const = 0;
101        /** Returns number of traversed nodes.
102        */
103        unsigned int GetNumTraversedNodes();
104        /** Returns number of rendered nodes.
105        */
106        unsigned int GetNumRenderedNodes();
107
108protected:
109       
110        unsigned int mFrameId;
111
112        int mCurrentTestIdx;
113       
114        //--- statistics
115        unsigned int mNumTraversedNodes;
116        unsigned int mNumRenderedNodes;
117
118        DistanceQueue *mDistanceQueue;
119        HierarchyNode *mSceneRoot;
120        //HierarchyNode *mCurrentNode;
121};
122} // namespace GtpVisibility
123#endif // GtpVisisibilityHierarchyInterface_H
Note: See TracBrowser for help on using the repository browser.