source: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCPlusPlusTraverser.h @ 2800

Revision 2800, 1.4 KB checked in by mattausch, 17 years ago (diff)

friendly culling debug version with timers, no materials

Line 
1#ifndef __CHCPLUSPLUSTRAVERSER_H
2#define __CHCPLUSPLUSTRAVERSER_H
3
4#include "RenderTraverser.h"
5
6
7namespace CHCDemoEngine
8{
9
10class OcclusionQuery;
11
12
13/** Class predicting the visiblity of nodes.
14*/
15class VisibilityPredictor
16{
17public:
18        /** Predicts the probability of a node to stay visible / invisible.
19            The probability could be taken from a measured or analytic function.
20        */
21        float GetProbability(BvhNode *node) const
22        {
23                return 0.98f - 0.68f * exp(-(float)node->GetTimesTestedInvisible());
24        }
25};
26
27
28/** Class implementing traversal using the CHC++ algorithm.
29*/
30class CHCPlusPlusTraverser: public RenderTraverser
31{
32public:
33       
34        CHCPlusPlusTraverser();
35
36        virtual int GetType() const { return CHCPLUSPLUS;}
37
38
39protected:
40        /** Traverses and renders the scene with the specified method
41        */
42        virtual void Traverse();
43        /** Queries nodes nodes tested invisible in previous frames.
44        */
45        void QueryPreviouslyInvisibleNodes(BvhNode *node);
46        /** Computes the next multiquery.
47        */
48        OcclusionQuery *GetNextMultiQuery(BvhNodeContainer &iqueue);
49        /** Issues batched multiqueries.
50        */
51        void IssueMultiQueries();
52        /** Handles the result of an occlusion query.
53        */
54        void HandleQueryResult(OcclusionQuery *query);
55
56
57        //////////////
58
59        /// the query queue
60        QueryQueue mQueryQueue;
61
62        BvhNodeQueue mVQueue;
63        BvhNodeContainer mIQueue;
64
65        VisibilityPredictor mVisibilityPredictor;
66};
67
68}
69
70
71
72#endif // __CHCPLUSPLUSTRAVERSER_H
Note: See TracBrowser for help on using the repository browser.