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