Changeset 2542 for GTP/trunk/Lib/Vis/OnlineCullingCHC/src
- Timestamp:
- 08/20/07 12:51:12 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/src/GtpVisibility.vcproj
r2532 r2542 268 268 </File> 269 269 <File 270 RelativePath=".\FlexibleHeap.h">271 </File>272 <File273 270 RelativePath="..\src\FrustumCullingManager.cpp"> 274 271 </File> -
GTP/trunk/Lib/Vis/OnlineCullingCHC/src/RandomUpdateCullingManager.cpp
r2539 r2542 106 106 int nodesTested = 0; 107 107 108 #if 1 109 // test a certain ratio of random candidates 110 HierarchyNodeContainer mynodes; 111 mHierarchyInterface->CollectLeaves(node, mynodes); 112 113 const int p = mRandomCandidates * RAND_MAX / (int)mynodes.size(); 114 115 HierarchyNodeContainer::const_iterator nit, nit_end = mynodes.end(); 116 117 for (nit = mynodes.begin(); nit != nit_end; ++ nit) 108 if(1) 118 109 { 119 HierarchyNode *leaf = *nit; 120 121 if (rand() > p) 122 continue; 110 // test a certain ratio of random candidates 111 HierarchyNodeContainer mynodes; 112 mHierarchyInterface->CollectLeaves(node, mynodes); 113 114 const int p = mRandomCandidates * RAND_MAX / (int)mynodes.size(); 115 116 HierarchyNodeContainer::const_iterator nit, nit_end = mynodes.end(); 117 118 for (nit = mynodes.begin(); nit != nit_end; ++ nit) 119 { 120 HierarchyNode *leaf = *nit; 121 122 if (rand() > p) 123 continue; 124 125 bool intersects = false; 126 const bool frustumCulled = !mHierarchyInterface->CheckFrustumVisible(leaf, intersects); 127 128 // don't test in these cases ... 129 if (frustumCulled || intersects) 130 continue; 131 132 ++ nodesTested; 133 134 mHierarchyInterface->SetNodeVisible(leaf, false); 135 136 // update node's visited flag: this is important as we are not testing 137 // all nodes in the hierarchy in this mode 138 mHierarchyInterface->PullUpLastVisited(leaf, mHierarchyInterface->GetFrameId()); 139 // issue the query 140 mHierarchyInterface->IssueNodeOcclusionQuery(node, mTestGeometryForVisibleLeaves); 141 } 142 143 //std::stringstream d; d << "rc: " << mRandomCandidates << " tested: " << nodesTested << " of " << (int)mynodes.size(); 144 //CullingLogManager::GetSingleton()->LogMessage(d.str()); 145 } 146 else 147 { 148 // always test one random candidate 149 HierarchyNode *leaf = mHierarchyInterface->GetRandomLeaf(node); 123 150 124 151 bool intersects = false; 125 152 const bool frustumCulled = !mHierarchyInterface->CheckFrustumVisible(leaf, intersects); 126 153 127 // don't test in these cases ... 128 if (frustumCulled || intersects) 154 if (frustumCulled || intersects) // don't test in these cases ... 129 155 continue; 130 156 131 157 ++ nodesTested; 132 158 133 159 mHierarchyInterface->SetNodeVisible(leaf, false); 134 160 … … 137 163 mHierarchyInterface->PullUpLastVisited(leaf, mHierarchyInterface->GetFrameId()); 138 164 // issue the query 139 mHierarchyInterface->IssueNodeOcclusionQuery( node, mTestGeometryForVisibleLeaves);165 mHierarchyInterface->IssueNodeOcclusionQuery(leaf, mTestGeometryForVisibleLeaves); 140 166 } 141 167 142 //std::stringstream d; d << "rc: " << mRandomCandidates << " tested: " << nodesTested << " of " << (int)mynodes.size(); 143 //CullingLogManager::GetSingleton()->LogMessage(d.str()); 144 145 #else 146 // always test one random candidate 147 HierarchyNode *leaf = mHierarchyInterface->GetRandomLeaf(node); 148 149 bool intersects = false; 150 const bool frustumCulled = !mHierarchyInterface->CheckFrustumVisible(leaf, intersects); 151 152 if (frustumCulled || intersects) // don't test in these cases ... 153 continue; 154 155 ++ nodesTested; 156 157 mHierarchyInterface->SetNodeVisible(leaf, false); 158 159 // update node's visited flag: this is important as we are not testing 160 // all nodes in the hierarchy in this mode 161 mHierarchyInterface->PullUpLastVisited(leaf, mHierarchyInterface->GetFrameId()); 162 // issue the query 163 mHierarchyInterface->IssueNodeOcclusionQuery(leaf, mTestGeometryForVisibleLeaves); 164 165 #endif 166 168 // render the whole subtree 167 169 mHierarchyInterface->RenderNodeRecursive(node); 168 170
Note: See TracChangeset
for help on using the changeset viewer.