Changeset 87 for trunk/VUT/GtpVisibility
- Timestamp:
- 05/09/05 01:24:02 (20 years ago)
- Location:
- trunk/VUT/GtpVisibility
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibility/include/CullingManager.h
r74 r87 38 38 */ 39 39 unsigned int GetNumQueryCulledNodes(); 40 /** Returns number of issued occlusion queries. 41 */ 42 unsigned int GetNumQueriesIssued(); 43 /** basic initializations on beginning of each frame, e.g., 44 resets statistics. 45 */ 46 void InitFrame(); 40 47 41 48 protected: 42 49 43 50 unsigned int mNumQueryCulledNodes; 44 51 unsigned int mNumFrustumCulledNodes; 45 52 unsigned int mVisibilityThreshold; 53 unsigned int mNumQueriesIssued; 46 54 47 55 HierarchyInterface *mHierarchyInterface; -
trunk/VUT/GtpVisibility/include/DistanceQueue.h
r59 r87 25 25 bool operator() (T v1, T v2) const 26 26 { 27 return mHierarchyInterface-> HasGreaterDistance(v1,v2);27 return mHierarchyInterface->GetSquaredDistance(v1) > mHierarchyInterface->GetSquaredDistance(v2); 28 28 } 29 29 -
trunk/VUT/GtpVisibility/include/HierarchyInterface.h
r86 r87 59 59 */ 60 60 DistanceQueue *GetQueue(); 61 /** Returns true if node 1 has greater distance to the view 62 plane than node 2. 63 @param node1 the first node to be compared 64 @param node2 the second node to be compared 61 /** Returns distance of the node to the view plane. 62 @param node1 the hierarchy node 65 63 */ 66 virtual bool HasGreaterDistance(HierarchyNode *node1, HierarchyNode *node2) const = 0;64 virtual float GetSquaredDistance(HierarchyNode *node) const = 0; 67 65 /** Checks if the node is visible from the current view frustum. 68 66 @param node the current node -
trunk/VUT/GtpVisibility/include/OcclusionQuery.h
r86 r87 20 20 @remark the query counts the number of visible pixels between it's begin and end 21 21 */ 22 virtual void BeginQuery() const= 0;22 virtual void BeginQuery() = 0; 23 23 /** Ends occlusion query. 24 24 */ 25 virtual void EndQuery() const= 0;25 virtual void EndQuery() = 0; 26 26 }; 27 27 -
trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp
r86 r87 7 7 void CoherentHierarchicalCullingManager::RenderScene() 8 8 { 9 mNumFrustumCulledNodes = mNumQueryCulledNodes = 0; 10 // OutputDebugString("Coherent Culling\n"); 9 InitFrame(); 11 10 12 11 QueryQueue queryQueue; 13 12 unsigned int visiblePixels = 0; 14 13 bool isAvailable = false; 15 14 16 15 //-- PART 1: process finished occlusion queries 17 16 while (!mHierarchyInterface->GetQueue()->empty() || !queryQueue.empty()) … … 21 20 mHierarchyInterface->GetQueue()->empty())) 22 21 { 22 //if (mHierarchyInterface->GetQueue()->empty())OutputDebugString("empty\n"); 23 23 24 HierarchyNode *node = queryQueue.front().first; 24 25 … … 35 36 } 36 37 } 37 38 38 39 //-- PART 2: hierarchical traversal 39 40 if (!mHierarchyInterface->GetQueue()->empty()) … … 67 68 68 69 // identify nodes that we cannot skip queries for 69 bool mustQuery = !wasVisible || mHierarchyInterface->HasGeometry(node) || 70 mHierarchyInterface->IsLeaf(node); 70 // geometry not only in leaves => test for renderable geometry 71 bool issueQuery = !wasVisible || mHierarchyInterface->HasGeometry(node); 72 //mHierarchyInterface->IsLeaf(node); 71 73 72 74 // reset node's visibility classification … … 76 78 mHierarchyInterface->SetLastVisited(node, mHierarchyInterface->GetFrameId()); 77 79 78 // skip testing previously visible interior nodes79 if ( mustQuery)80 // skip testing previously visible nodes without geometry 81 if (issueQuery) 80 82 { 81 queryQueue.push(QueryPair(node, 82 mHierarchyInterface->IssueOcclusionQuery(node, wasVisible))); 83 mNumQueriesIssued ++; 84 85 queryQueue.push(QueryPair(node, mHierarchyInterface-> 86 IssueOcclusionQuery(node, wasVisible))); 83 87 } 84 88 -
trunk/VUT/GtpVisibility/src/CullingManager.cpp
r74 r87 6 6 CullingManager::CullingManager(): 7 7 mHierarchyInterface(NULL), mVisibilityThreshold(0), mNumQueryCulledNodes(0), 8 mNumFrustumCulledNodes(0) 8 mNumFrustumCulledNodes(0), mNumQueriesIssued(0) 9 9 { 10 10 } … … 29 29 return mNumQueryCulledNodes; 30 30 } 31 //----------------------------------------------------------------------- 32 unsigned int CullingManager::GetNumQueriesIssued() 33 { 34 return mNumQueriesIssued; 35 } 36 //----------------------------------------------------------------------- 37 void CullingManager::InitFrame() 38 { 39 mNumFrustumCulledNodes = mNumQueryCulledNodes = mNumQueriesIssued = 0; 40 } 31 41 } // namespace GtpVisibility -
trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp
r86 r87 7 7 void FrustumCullingManager::RenderScene() 8 8 { 9 mNumFrustumCulledNodes = mNumQueryCulledNodes = 0; 10 //OutputDebugString("Frustum Culling\n"); 9 InitFrame(); 11 10 12 11 while (!mHierarchyInterface->GetQueue()->empty()) -
trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp
r86 r87 7 7 void StopAndWaitCullingManager::RenderScene() 8 8 { 9 mNumFrustumCulledNodes = mNumQueryCulledNodes = 0; 10 //OutputDebugString("Stop and Wait Culling\n"); 11 9 InitFrame(); 10 12 11 while (!mHierarchyInterface->GetQueue()->empty()) 13 12 { 14 13 HierarchyNode *node = mHierarchyInterface->GetQueue()->top(); 15 14 mHierarchyInterface->GetQueue()->pop(); 16 15 17 16 // interesting for visualization purpose 18 17 mHierarchyInterface->SetNodeVisible(node, false); … … 35 34 } 36 35 36 mNumQueriesIssued ++; 37 37 38 unsigned int visiblePixels = 0; 38 39
Note: See TracChangeset
for help on using the changeset viewer.