1 | #include "StopAndWaitCullingManager.h" |
---|
2 | |
---|
3 | namespace GtpVisibility { |
---|
4 | |
---|
5 | //----------------------------------------------------------------------- |
---|
6 | StopAndWaitCullingManager::StopAndWaitCullingManager(HierarchyInterface *HierarchyInterface): |
---|
7 | CullingManager(HierarchyInterface) |
---|
8 | { |
---|
9 | } |
---|
10 | //----------------------------------------------------------------------- |
---|
11 | void StopAndWaitCullingManager::RenderScene() |
---|
12 | { |
---|
13 | mNumFrustumCulledNodes = mNumQueryCulledNodes = 0; |
---|
14 | |
---|
15 | while (!mHierarchyInterface->GetQueue()->empty()) |
---|
16 | { |
---|
17 | HierarchyNode *node = mHierarchyInterface->GetQueue()->top(); |
---|
18 | mHierarchyInterface->GetQueue()->pop(); |
---|
19 | |
---|
20 | // interesting for visualization purpose |
---|
21 | mHierarchyInterface->SetNodeVisible(node, false); |
---|
22 | mHierarchyInterface->SetLastVisited(node, mHierarchyInterface->GetFrameId()); |
---|
23 | |
---|
24 | bool intersects = false; |
---|
25 | |
---|
26 | if (mHierarchyInterface->CheckFrustumVisible(node, intersects)) |
---|
27 | { |
---|
28 | mNumFrustumCulledNodes ++; |
---|
29 | continue; |
---|
30 | } |
---|
31 | |
---|
32 | //if intersects near plane => skip occlusion query because wrong results possible |
---|
33 | if (intersects) |
---|
34 | { |
---|
35 | mHierarchyInterface->SetNodeVisible(node, true); |
---|
36 | mHierarchyInterface->TraverseNode(node); |
---|
37 | continue; |
---|
38 | } |
---|
39 | |
---|
40 | // node visible |
---|
41 | if (mHierarchyInterface->IssueOcclusionQuery(node)->GetQueryResult() > |
---|
42 | mVisibilityThreshold) |
---|
43 | { |
---|
44 | mHierarchyInterface->TraverseNode(node); |
---|
45 | } |
---|
46 | else |
---|
47 | { |
---|
48 | mNumQueryCulledNodes ++; |
---|
49 | } |
---|
50 | } |
---|
51 | } |
---|
52 | } // namespace GtpVisibility |
---|