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