Line | |
---|
1 | #include "FrustumCullingTraverser.h"
|
---|
2 | #include "SceneEntity.h"
|
---|
3 |
|
---|
4 | using namespace std;
|
---|
5 |
|
---|
6 |
|
---|
7 | namespace CHCDemoEngine
|
---|
8 | {
|
---|
9 |
|
---|
10 | FrustumCullingTraverser::FrustumCullingTraverser(): RenderTraverser()
|
---|
11 | {
|
---|
12 | }
|
---|
13 |
|
---|
14 |
|
---|
15 | void FrustumCullingTraverser::Traverse()
|
---|
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 |
|
---|
25 | if (mBvh->IsWithinViewFrustum(node))
|
---|
26 | {
|
---|
27 | // update node's visited flag => needed for rendering
|
---|
28 | // so set it also here
|
---|
29 | //node->SetLastVisited(mFrameID);
|
---|
30 | node->SetVisible(true);
|
---|
31 | TraverseNode(node);
|
---|
32 | }
|
---|
33 | else
|
---|
34 | {
|
---|
35 | mStats.mNumFrustumCulledNodes ++;
|
---|
36 | }
|
---|
37 | }
|
---|
38 |
|
---|
39 | // render the rest of the objects
|
---|
40 | if (mUseRenderQueue)
|
---|
41 | {
|
---|
42 | mRenderQueue.Render();
|
---|
43 | mRenderQueue.Clear();
|
---|
44 | }
|
---|
45 | }
|
---|
46 |
|
---|
47 |
|
---|
48 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.