Changeset 2332 for GTP/trunk/Lib/Vis/OnlineCullingCHC/src
- Timestamp:
- 04/23/07 16:19:30 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/src/CoherentHierarchicalCullingManager.cpp
r2306 r2332 33 33 while (!mHierarchyInterface->GetQueue()->empty() || !queryQueue.empty()) 34 34 { 35 bool resultAvailable = false; 36 35 ////////// 37 36 //-- only wait for result if there are no nodes to process 38 37 while (!queryQueue.empty() && 39 queryQueue.front().second->GetQueryResult(visiblePixels, 40 mHierarchyInterface->GetQueue()->empty())) 38 (NodeInvalid(queryQueue.front().first) || 39 queryQueue.front().second->GetQueryResult( 40 visiblePixels, mHierarchyInterface->GetQueue()->empty()))) 41 41 { 42 42 HierarchyNode *node = queryQueue.front().first; 43 44 43 queryQueue.pop(); 45 44 45 // parent was tested invisible => remove children from queue 46 if (NodeInvalid(node)) 47 { 48 //CullingLogManager::GetSingleton()->LogMessage("skipping this node"); 49 continue; 50 } 51 // tested visible 46 52 if (visiblePixels > mVisibilityThreshold) 47 53 { 48 // in case geometry is in omterior node: ensure that we only traverse once54 // in case geometry is in interior node: ensure that we only traverse once 49 55 if (!mHierarchyInterface->IsNodeVisible(node)) 50 56 { … … 58 64 mHierarchyInterface->SetNodeVisible(node, false); 59 65 60 66 ++ mNumQueryCulledNodes; 61 67 62 68 if (mVisualizeCulledNodes) … … 65 71 } 66 72 } 73 74 // update node's visited flag 75 mHierarchyInterface->SetLastVisited(node, mHierarchyInterface->GetFrameId()); 67 76 } 68 77 … … 73 82 mHierarchyInterface->GetQueue()->pop(); 74 83 84 // parent was tested invisible => remove children from queue 85 if (NodeInvalid(node)) 86 { 87 //CullingLogManager::GetSingleton()->LogMessage("skipping this node"); 88 continue; 89 } 90 75 91 bool intersects = false; 76 92 … … 96 112 97 113 // if we assume node to be visible in this frame => skip query 98 bool skipQuery = wasVisible && (mAssumedVisibility > 0) && 99 DecideVisible(node) && mHierarchyInterface->HasGeometry(node); 114 const bool skipQuery = wasVisible && 115 (mAssumedVisibility > 0) && 116 DecideVisible(node) && 117 mHierarchyInterface->HasGeometry(node); 100 118 101 119 if (skipQuery) … … 113 131 mHierarchyInterface->SetNodeVisible(node, wasVisible && issueQuery); 114 132 115 // update node's visited flag116 mHierarchyInterface->SetLastVisited(node, mHierarchyInterface->GetFrameId());117 118 133 // skip testing previously visible nodes without geometry 119 134 if (issueQuery) … … 124 139 IssueNodeOcclusionQuery(node, wasVisible))); 125 140 } 126 141 else 142 { 143 // update node's visited flag 144 mHierarchyInterface->SetLastVisited(node, mHierarchyInterface->GetFrameId()); 145 } 146 127 147 // always traverse a node if it was visible 128 148 if (wasVisible) … … 164 184 mHierarchyInterface->TraverseNode(node); 165 185 } 166 186 //----------------------------------------------------------------------- 187 bool CoherentHierarchicalCullingManager::NodeInvalid(HierarchyNode *node) const 188 { 189 // parent was tested invisible in this frame 190 HierarchyNode *parent = mHierarchyInterface->GetParent(node); 191 return 192 parent && 193 (mHierarchyInterface->LastVisited(node) == mHierarchyInterface->GetFrameId()) && 194 !mHierarchyInterface->IsNodeVisible(parent); 195 } 167 196 } // namespace GtpVisibility -
GTP/trunk/Lib/Vis/OnlineCullingCHC/src/RandomUpdateCullingManager.cpp
r2306 r2332 105 105 else 106 106 { 107 // identify previously visible nodes 108 const bool wasVisible = mHierarchyInterface->IsNodeVisible(node) && 109 (mHierarchyInterface->LastVisited(node) == mHierarchyInterface->GetFrameId() - 1); 110 111 // if we assume node to be visible in this frame => skip query 112 const bool skipQuery = wasVisible && (mAssumedVisibility > 0) && 113 DecideVisible(node) && mHierarchyInterface->HasGeometry(node); 114 115 if (skipQuery) 116 { 117 SkipQuery(node); 118 continue; 119 } 120 107 121 108 if (mHierarchyInterface->IsNodeFullyVisible(node)) 122 109 { … … 162 149 } 163 150 151 // identify previously visible nodes 152 const bool wasVisible = mHierarchyInterface->IsNodeVisible(node) && 153 (mHierarchyInterface->LastVisited(node) == mHierarchyInterface->GetFrameId() - 1); 154 155 156 // if we assume node to be visible in this frame => skip query 157 const bool skipQuery = wasVisible && (mAssumedVisibility > 0) && 158 DecideVisible(node) && mHierarchyInterface->HasGeometry(node); 159 160 if (skipQuery) 161 { 162 SkipQuery(node); 163 continue; 164 } 165 164 166 // identify nodes that we cannot skip queries for 165 167 // geometry not only in leaves => test for renderable geometry
Note: See TracChangeset
for help on using the changeset viewer.