Line | |
---|
1 | #include "StopAndWaitTraverser.h"
|
---|
2 | #include "SceneEntity.h"
|
---|
3 |
|
---|
4 |
|
---|
5 | namespace CHCDemoEngine
|
---|
6 | {
|
---|
7 |
|
---|
8 | using namespace std;
|
---|
9 |
|
---|
10 |
|
---|
11 |
|
---|
12 | StopAndWaitTraverser::StopAndWaitTraverser()
|
---|
13 | {
|
---|
14 | }
|
---|
15 |
|
---|
16 |
|
---|
17 | void StopAndWaitTraverser::Traverse()
|
---|
18 | {
|
---|
19 | while (!mDistanceQueue.empty())
|
---|
20 | {
|
---|
21 | BvhNode *node = mDistanceQueue.top();
|
---|
22 | mDistanceQueue.pop();
|
---|
23 |
|
---|
24 | // interesting for the visualization
|
---|
25 | node->SetVisible(false);
|
---|
26 |
|
---|
27 |
|
---|
28 | if (mBvh->IsWithinViewFrustum(node))
|
---|
29 | {
|
---|
30 | // if intersects near plane assume visible and don't issue test
|
---|
31 | if (IntersectsNearPlane(node))
|
---|
32 | {
|
---|
33 | TraverseNode(node);
|
---|
34 | }
|
---|
35 | else
|
---|
36 | {
|
---|
37 | OcclusionQuery *query = IssueOcclusionQuery(node, false);
|
---|
38 |
|
---|
39 | int visiblePixels = query->GetQueryResult();
|
---|
40 |
|
---|
41 | if (visiblePixels > mVisibilityThreshold)
|
---|
42 | {
|
---|
43 | //cout<< "visible: " << visiblePixels << endl;
|
---|
44 | // update node's visited flag => needed for rendering
|
---|
45 | // so set it also here
|
---|
46 | //node->SetLastVisited(mFrameID);
|
---|
47 | //node->SetVisible(true);
|
---|
48 |
|
---|
49 | TraverseNode(node);
|
---|
50 | }
|
---|
51 | else
|
---|
52 | {
|
---|
53 | ++ mStats.mNumQueryCulledNodes;
|
---|
54 | }
|
---|
55 | }
|
---|
56 | }
|
---|
57 | else
|
---|
58 | {
|
---|
59 | ++ mStats.mNumFrustumCulledNodes;
|
---|
60 | }
|
---|
61 | }
|
---|
62 | }
|
---|
63 |
|
---|
64 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.