Line | |
---|
1 | #ifndef __CHCPLUSPLUSTRAVERSER_H
|
---|
2 | #define __CHCPLUSPLUSTRAVERSER_H
|
---|
3 |
|
---|
4 | #include "RenderTraverser.h"
|
---|
5 |
|
---|
6 |
|
---|
7 | namespace CHCDemoEngine
|
---|
8 | {
|
---|
9 |
|
---|
10 | class OcclusionQuery;
|
---|
11 |
|
---|
12 |
|
---|
13 | /** Class predicting the visiblity of nodes.
|
---|
14 | */
|
---|
15 | class VisibilityPredictor
|
---|
16 | {
|
---|
17 | public:
|
---|
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 | */
|
---|
30 | class CHCPlusPlusTraverser: public RenderTraverser
|
---|
31 | {
|
---|
32 | public:
|
---|
33 |
|
---|
34 | CHCPlusPlusTraverser();
|
---|
35 | //~CHCPlusPlusTraverser();
|
---|
36 |
|
---|
37 |
|
---|
38 | protected:
|
---|
39 | /** Traverses and renders the scene with the specified method
|
---|
40 | */
|
---|
41 | virtual void Traverse();
|
---|
42 | /** Queries nodes nodes tested invisible in previous frames.
|
---|
43 | */
|
---|
44 | void QueryPreviouslyInvisibleNodes(BvhNode *node);
|
---|
45 | /** Computes the next multiquery.
|
---|
46 | */
|
---|
47 | OcclusionQuery *GetNextMultiQuery(BvhNodeQueue &iqueue);
|
---|
48 | /** Issues batched multiqueries.
|
---|
49 | */
|
---|
50 | void IssueMultiQueries();
|
---|
51 | /** Handles the result of an occlusion query.
|
---|
52 | */
|
---|
53 | void HandleQueryResult(OcclusionQuery *query);
|
---|
54 |
|
---|
55 |
|
---|
56 | //////////////
|
---|
57 |
|
---|
58 | /// the query queue
|
---|
59 | QueryQueue mQueryQueue;
|
---|
60 |
|
---|
61 | BvhNodeQueue mIQueue;
|
---|
62 | BvhNodeQueue mVQueue;
|
---|
63 |
|
---|
64 | VisibilityPredictor mVisibilityPredictor;
|
---|
65 | };
|
---|
66 |
|
---|
67 | }
|
---|
68 |
|
---|
69 |
|
---|
70 |
|
---|
71 | #endif // __CHCPLUSPLUSTRAVERSER_H |
---|
Note: See
TracBrowser
for help on using the repository browser.