Changeset 2556 for GTP/trunk/Lib/Vis
- Timestamp:
- 10/08/07 13:57:35 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformHierarchyInterface.cpp
r2555 r2556 240 240 //////// 241 241 //-- the actual query test 242 242 243 query->BeginQuery(); 243 244 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreSolidBoundingBox.cpp
r2532 r2556 84 84 void SolidBoundingBox::SetupBoundingBoxVertices(const AxisAlignedBox& aab) 85 85 { 86 const Vector3& min = aab.getMinimum();87 const Vector3& max = aab.getMaximum();86 const Vector3& minV = aab.getMinimum(); 87 const Vector3& maxV = aab.getMaximum(); 88 88 89 89 // fill the vertex buffer: 12 lines with 2 endpoints each make up a box … … 93 93 float* pPos = static_cast<float*>(vbuf->lock(HardwareBuffer::HBL_DISCARD)); 94 94 95 *pPos++ = min.x; *pPos++ = max.y; *pPos++ = min.z;96 *pPos++ = max.x; *pPos++ = max.y; *pPos++ = min.z;97 *pPos++ = max.x; *pPos++ = min.y; *pPos++ = min.z;98 *pPos++ = min.x; *pPos++ = min.y; *pPos++ = min.z;95 pPos[0] = minV.x; pPos[1] = maxV.y; pPos[2] = minV.z; 96 pPos[3] = maxV.x; pPos[4] = maxV.y; pPos[5] = minV.z; 97 pPos[6] = maxV.x; pPos[7] = minV.y; pPos[8] = minV.z; 98 pPos[9] = minV.x; pPos[10] = minV.y; pPos[11] = minV.z; 99 99 100 *pPos++ = min.x; *pPos++ = max.y; *pPos++ = max.z;101 *pPos++ = max.x; *pPos++ = max.y; *pPos++ = max.z;102 *pPos++ = max.x; *pPos++ = min.y; *pPos++ = max.z;103 *pPos++ = min.x; *pPos++ = min.y; *pPos++ = max.z;100 pPos[12] = minV.x; pPos[13] = maxV.y; pPos[14] = maxV.z; 101 pPos[15] = maxV.x; pPos[16] = maxV.y; pPos[17] = maxV.z; 102 pPos[18] = maxV.x; pPos[19] = minV.y; pPos[20] = maxV.z; 103 pPos[21] = minV.x; pPos[22] = minV.y; pPos[23] = maxV.z; 104 104 105 105 vbuf->unlock(); -
GTP/trunk/Lib/Vis/OnlineCullingCHC/src/CoherentHierarchicalCullingManager.cpp
r2555 r2556 191 191 { 192 192 // parent was tested invisible in this frame 193 return(193 const bool nodeInvalid = ( 194 194 mHierarchyInterface->GetParent(node) && 195 195 (mHierarchyInterface->LastVisited(node) == mHierarchyInterface->GetFrameId()) && 196 196 !mHierarchyInterface->IsNodeVisible(mHierarchyInterface->GetParent(node)) 197 197 ); 198 199 200 if (nodeInvalid) 201 { 202 CullingLogManager::GetSingleton()->LogMessage("node invalid"); 203 } 204 205 return nodeInvalid; 198 206 } 199 207 //----------------------------------------------------------------------- -
GTP/trunk/Lib/Vis/OnlineCullingCHC/src/CoherentHierarchicalCullingPlusPlusManager.cpp
r2555 r2556 10 10 11 11 12 static const bool CULL_INVALID_NODES = false; 12 static const bool CULL_INVALID_NODES = true; 13 //static const bool CULL_INVALID_NODES = false; 14 static const int MAX_INVISIBLE_NODES_SIZE = 20; 13 15 14 16 //----------------------------------------------------------------------- 15 17 CoherentHierarchicalCullingPlusPlusManager::CoherentHierarchicalCullingPlusPlusManager(): 16 mAssumedVisibility(0), mMaxInvisibleNodesSize( 50)18 mAssumedVisibility(0), mMaxInvisibleNodesSize(MAX_INVISIBLE_NODES_SIZE) 17 19 { 18 20 } … … 20 22 CoherentHierarchicalCullingPlusPlusManager::CoherentHierarchicalCullingPlusPlusManager( 21 23 const unsigned int assumedVisibility): 22 mAssumedVisibility(assumedVisibility), mMaxInvisibleNodesSize( 50)24 mAssumedVisibility(assumedVisibility), mMaxInvisibleNodesSize(MAX_INVISIBLE_NODES_SIZE) 23 25 { 24 26 } … … 43 45 //-- PART 1: process finished occlusion queries 44 46 45 while (!mHierarchyInterface->GetQueue()->empty() || !mQueryQueue.empty() || 46 !mInvisibleNodes.empty() || !mVisibleNodes.empty()) 47 while (!mHierarchyInterface->GetQueue()->empty() || !mQueryQueue.empty() 48 || !mInvisibleNodes.empty() 49 //|| !mVisibleNodes.empty() 50 ) 47 51 { 48 52 ////////// 49 53 //-- only wait for result if there are no nodes to process 50 54 #if 0 55 bool resultAvailable = true; 56 while (!mQueryQueue.empty() && 57 (NodeInvalid(mQueryQueue.front().first) || 58 mQueryQueue.front().second->GetQueryResult( 59 visiblePixels, mHierarchyInterface->GetQueue()->empty()))) 60 #else 51 61 bool resultAvailable = false; 62 52 63 while ( 53 64 !mQueryQueue.empty() && … … 56 67 (resultAvailable = mQueryQueue.front().second->GetQueryResult(visiblePixels, false))) 57 68 ) 69 #endif 58 70 { 59 71 HierarchyNode *node = mQueryQueue.front().first; … … 64 76 65 77 // during the wait time issue nodes from visible queue 66 while ( !mVisibleNodes.empty() && !resultAvailable)78 while (1 && !mVisibleNodes.empty() && !resultAvailable) 67 79 { 68 80 HierarchyNode *vn = mVisibleNodes.front(); … … 175 187 else 176 188 { 177 mVisibleNodes.push(node);178 //IssueQuery(node, false);189 // mVisibleNodes.push(node); 190 IssueQuery(node, false); 179 191 } 180 192 } … … 194 206 } 195 207 196 208 // issue rest of nodes from nodes from invisible queue 197 209 if (mHierarchyInterface->GetQueue()->empty() && !mInvisibleNodes.empty()) 198 210 { … … 209 221 210 222 // issue rest of nodes from nodes from visible queue 211 if (mHierarchyInterface->GetQueue()->empty() && mQueryQueue.empty() && !mVisibleNodes.empty()) 212 { 213 if (0) 214 { 215 std::stringstream d; 216 d << "vis nodes: " << (int)mVisibleNodes.size(); 217 CullingLogManager::GetSingleton()->LogMessage(d.str()); 218 } 219 223 if (0 && mHierarchyInterface->GetQueue()->empty() && mQueryQueue.empty() && !mVisibleNodes.empty()) 224 { 220 225 while (!mVisibleNodes.empty()) 221 226 { … … 227 232 228 233 229 if (0 )234 if (0 && !mVisibleNodes.empty()) 230 235 { 231 236 std::stringstream d; … … 234 239 } 235 240 236 241 // render rest 237 242 mHierarchyInterface->RenderQueue(); 243 244 // issue rest of nodes from nodes from visible queue 245 while (!mVisibleNodes.empty()) 246 { 247 IssueQuery(mVisibleNodes.front(), false); 248 mVisibleNodes.pop(); 249 } 250 251 int i = 0; 252 253 while (!mQueryQueue.empty() && 254 mQueryQueue.front().second->GetQueryResult(visiblePixels, true)) 255 { 256 ++ i; 257 258 HierarchyNode *node = mQueryQueue.front().first; 259 mQueryQueue.pop(); 260 261 // tested visible 262 if (visiblePixels > mVisibilityThreshold) 263 { 264 // assing the #frames the node is assumed to stay visible 265 AssignAssumedVisibility(node); 266 mHierarchyInterface->PullUpVisibility(node); 267 } 268 else 269 { 270 mHierarchyInterface->SetNodeVisible(node, false); 271 272 ++ mNumQueryCulledNodes; 273 274 if (mVisualizeCulledNodes) 275 mHierarchyInterface->VisualizeCulledNode(node, QUERY_CULLED); 276 } 277 278 // update node's visited flag 279 mHierarchyInterface->SetLastVisited(node, mHierarchyInterface->GetFrameId()); 280 } 281 282 if (0) 283 { 284 std::stringstream d; 285 d << "tested: " << i << " nodes"; 286 CullingLogManager::GetSingleton()->LogMessage(d.str()); 287 } 238 288 } 239 289 //----------------------------------------------------------------------- … … 265 315 266 316 // parent was tested invisible in this frame 267 return ( 268 mHierarchyInterface->GetParent(node) && 269 (mHierarchyInterface->LastVisited(node) == mHierarchyInterface->GetFrameId()) && 270 !mHierarchyInterface->IsNodeVisible(mHierarchyInterface->GetParent(node)) 271 ); 317 const bool nodeInvalid = ( 318 mHierarchyInterface->GetParent(node) && 319 (mHierarchyInterface->LastVisited(node) == mHierarchyInterface->GetFrameId()) && 320 !mHierarchyInterface->IsNodeVisible(mHierarchyInterface->GetParent(node)) 321 ); 322 323 /*if (nodeInvalid) 324 CullingLogManager::GetSingleton()->LogMessage("node invalid"); 325 */ 326 327 return nodeInvalid; 272 328 } 273 329 //----------------------------------------------------------------------- … … 296 352 IssueQuery(*nit, false); 297 353 354 //for (int i = (int)nodes.size() - 1; i >= 0; -- i) 355 // IssueQuery(nodes[i], false); 356 298 357 nodes.clear(); 299 358 }
Note: See TracChangeset
for help on using the changeset viewer.