source: trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp @ 59

Revision 59, 1.2 KB checked in by mattausch, 20 years ago (diff)

completely changed file structure plus software design

Line 
1#include "FrustumCullingManager.h"
2
3namespace GtpVisibility {
4
5//-----------------------------------------------------------------------
6FrustumCullingManager::FrustumCullingManager(HierarchyInterface *hierarchyInterface):
7CullingManager(hierarchyInterface)
8{
9}
10//-----------------------------------------------------------------------
11void FrustumCullingManager::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                mHierarchyInterface->TraverseNode(node);
41        }
42}
43
44} // namespace GtpVisibility
Note: See TracBrowser for help on using the repository browser.