source:
GTP/trunk/App/Demos/Vis/CHC_revisited/src/FrustumCullingTraverser.cpp
@
2782
Revision 2782, 856 bytes checked in by mattausch, 16 years ago (diff) |
---|
Rev | Line | |
---|---|---|
[2757] | 1 | #include "FrustumCullingTraverser.h" |
[2760] | 2 | #include "SceneEntity.h" |
[2757] | 3 | |
[2762] | 4 | using namespace std; |
[2760] | 5 | |
[2762] | 6 | |
[2776] | 7 | namespace CHCDemoEngine |
[2757] | 8 | { |
9 | ||
10 | FrustumCullingTraverser::FrustumCullingTraverser(): RenderTraverser() | |
11 | { | |
12 | } | |
13 | ||
14 | ||
[2767] | 15 | void FrustumCullingTraverser::Traverse() |
[2757] | 16 | { |
17 | while (!mDistanceQueue.empty()) | |
18 | { | |
19 | BvhNode *node = mDistanceQueue.top(); | |
20 | mDistanceQueue.pop(); | |
21 | ||
22 | // interesting for the visualization, so rest and set | |
23 | node->SetVisible(false); | |
24 | ||
[2763] | 25 | if (mBvh->IsWithinViewFrustum(node)) |
[2757] | 26 | { |
27 | // update node's visited flag => needed for rendering | |
28 | // so set it also here | |
29 | //node->SetLastVisited(mFrameID); | |
[2764] | 30 | node->SetVisible(true); |
[2757] | 31 | TraverseNode(node); |
32 | } | |
33 | else | |
[2763] | 34 | { |
[2764] | 35 | mStats.mNumFrustumCulledNodes ++; |
[2757] | 36 | } |
37 | } | |
[2771] | 38 | |
39 | // render the rest of the objects | |
40 | if (mUseRenderQueue) | |
41 | { | |
42 | mRenderQueue.Render(); | |
43 | mRenderQueue.Clear(); | |
44 | } | |
[2757] | 45 | } |
46 | ||
[2767] | 47 | |
[2757] | 48 | } |
Note: See TracBrowser
for help on using the repository browser.