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

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

friendly culling debug version with timers, no materials

RevLine 
[2755]1#ifndef __CHCPLUSPLUSTRAVERSER_H
2#define __CHCPLUSPLUSTRAVERSER_H
3
4#include "RenderTraverser.h"
5
6
[2776]7namespace CHCDemoEngine
[2755]8{
9
[2773]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
[2767]28/** Class implementing traversal using the CHC++ algorithm.
[2755]29*/
30class CHCPlusPlusTraverser: public RenderTraverser
31{
32public:
[2767]33       
[2755]34        CHCPlusPlusTraverser();
35
[2800]36        virtual int GetType() const { return CHCPLUSPLUS;}
[2771]37
[2800]38
[2767]39protected:
40        /** Traverses and renders the scene with the specified method
[2755]41        */
[2767]42        virtual void Traverse();
[2773]43        /** Queries nodes nodes tested invisible in previous frames.
44        */
[2770]45        void QueryPreviouslyInvisibleNodes(BvhNode *node);
[2773]46        /** Computes the next multiquery.
47        */
[2800]48        OcclusionQuery *GetNextMultiQuery(BvhNodeContainer &iqueue);
[2773]49        /** Issues batched multiqueries.
50        */
[2770]51        void IssueMultiQueries();
[2772]52        /** Handles the result of an occlusion query.
53        */
54        void HandleQueryResult(OcclusionQuery *query);
[2770]55
[2771]56
[2770]57        //////////////
58
[2771]59        /// the query queue
60        QueryQueue mQueryQueue;
61
[2770]62        BvhNodeQueue mVQueue;
[2800]63        BvhNodeContainer mIQueue;
[2773]64
65        VisibilityPredictor mVisibilityPredictor;
[2755]66};
67
68}
69
70
71
[2767]72#endif // __CHCPLUSPLUSTRAVERSER_H
Note: See TracBrowser for help on using the repository browser.