Changeset 2255 for GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
- Timestamp:
- 03/16/07 17:20:26 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOcclusionCullingSceneManager.h
r2254 r2255 191 191 void _renderScene(Camera* camera, Viewport* vp, bool includeOverlays); 192 192 193 int FindExactVisibleObjects(Camera *camera,194 Viewport* vp,195 const bool fromPoint,196 const bool nodeVisibility);193 int QueryVisibleObjectsExact(Camera *camera, 194 Viewport* vp, 195 const bool fromPoint, 196 const bool nodeVisibility); 197 197 198 198 void AddVisibleMeshGeometryToQueue(const GtpVisibility::MeshInfoContainer &visibleGeometry, … … 299 299 int mCurrentFrame; 300 300 301 int mQueryMode; 302 303 enum {EXACT_QUERIES, NODE_QUERIES, APPROXIMATE_QUERIES}; 304 301 305 ObjReader *mObjReader; 302 306 … … 305 309 bool mUseFromPointQueries; 306 310 307 bool mUseExactQueries; 308 309 bool mUseDepthPassForQueries; 311 bool mResetMaterialForQueries; 310 312 }; 311 313 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOcclusionQueriesQueryManager.h
r2171 r2255 15 15 on different hierarchy types, while reusing the implementation of the query methods. 16 16 */ 17 OcclusionQueriesQueryManager(GtpVisibility::HierarchyInterface *hierarchyInterface, Viewport *vp, 18 int queryModes, int itemBufferMode); 17 OcclusionQueriesQueryManager(GtpVisibility::HierarchyInterface *hierarchyInterface, 18 Viewport *vp, 19 int queryModes, 20 int itemBufferMode); 19 21 20 22 void ComputeCameraVisibility(const Camera &camera, … … 22 24 GtpVisibility::MeshInfoContainer *visibleGeometry, 23 25 GtpVisibility::PatchInfoContainer *visiblePatches, 24 bool relativeVisibility = false); 26 const bool relativeVisibility, 27 const bool approximateVisibility); 25 28 26 29 /** … … 32 35 GtpVisibility::MeshInfoContainer *visibleGeometry, 33 36 GtpVisibility::PatchInfoContainer *visiblePatches, 34 bool relativeVisibility = false); 37 const bool relativeVisibility, 38 const bool approximateVisibility); 35 39 36 40 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgrePlatformQueryManager.h
r925 r2255 18 18 */ 19 19 PlatformQueryManager(GtpVisibility::HierarchyInterface *hierarchyInterface, 20 Viewport *vp, int queryModes); 20 Viewport *vp, 21 int queryModes); 21 22 22 23 /** … … 25 26 */ 26 27 void ComputeFromPointVisibility(const Vector3 &point, 27 GtpVisibility::NodeInfoContainer *visibleNodes, 28 GtpVisibility::MeshInfoContainer *visibleGeometry, 29 GtpVisibility::PatchInfoContainer *visiblePatches, 30 bool relativeVisibility = false); 28 GtpVisibility::NodeInfoContainer *visibleNodes, 29 GtpVisibility::MeshInfoContainer *visibleGeometry, 30 GtpVisibility::PatchInfoContainer *visiblePatches, 31 const bool relativeVisibility, 32 const bool approximateVisibility); 31 33 32 34 void ComputeCameraVisibility(const Camera &camera, 33 GtpVisibility::NodeInfoContainer *visibleNodes, 34 GtpVisibility::MeshInfoContainer *visibleGeometry, 35 GtpVisibility::PatchInfoContainer *visiblePatches, 36 bool relativeVisibility = false); 35 GtpVisibility::NodeInfoContainer *visibleNodes, 36 GtpVisibility::MeshInfoContainer *visibleGeometry, 37 GtpVisibility::PatchInfoContainer *visiblePatches, 38 const bool relativeVisibility, 39 const bool approximateVisibility); 37 40 38 41 bool ShootRay(const Ray &ray, std::vector<Mesh *> *visibleMeshes, bool isGlobalLine = false); -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
r2254 r2255 67 67 mFlushRate(10), 68 68 mCurrentFrame(0), 69 mUseVisibilityQueries( false),69 mUseVisibilityQueries(true), 70 70 mUseFromPointQueries(false), 71 m UseExactQueries(false),72 m UseDepthPassForQueries(false)71 mQueryMode(NODE_QUERIES), 72 mResetMaterialForQueries(false) 73 73 { 74 74 Ogre::LogManager::getSingleton(). … … 245 245 } 246 246 247 val = config.getSetting(" UseExactQueries");247 val = config.getSetting("QueryObjectsMode"); 248 248 249 249 if (!val.empty()) 250 250 { 251 if (val == "EXACT") 252 mQueryMode = EXACT_QUERIES; 253 else if (val == "NODE") 254 mQueryMode = NODE_QUERIES; 255 else 256 mQueryMode = APPROXIMATE_QUERIES; 257 } 258 259 val = config.getSetting("ResetMaterialForQueries"); 260 261 if (!val.empty()) 262 { 251 263 if (val == "yes") 252 m UseExactQueries = true;264 mResetMaterialForQueries = true; 253 265 else 254 mUseExactQueries = false; 255 } 256 257 val = config.getSetting("UseDepthPassForQueries"); 258 259 if (!val.empty()) 260 { 261 if (val == "yes") 262 mUseDepthPassForQueries = true; 263 else 264 mUseDepthPassForQueries = false; 266 mResetMaterialForQueries = false; 265 267 } 266 268 … … 314 316 algorithm = 315 317 GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING; 318 LogManager::getSingleton().logMessage("Using chc algorithm"); 316 319 } 317 320 else if (val == "SWC") … … 319 322 algorithm = 320 323 GtpVisibility::VisibilityEnvironment::STOP_AND_WAIT_CULLING; 324 325 LogManager::getSingleton().logMessage("Using stop and wait algorithm"); 321 326 } 322 327 else if (val == "VFC") … … 324 329 algorithm = 325 330 GtpVisibility::VisibilityEnvironment::FRUSTUM_CULLING; 331 332 LogManager::getSingleton().logMessage("Using frustum culling algorithm"); 326 333 } 327 334 else // default rendering … … 331 338 332 339 mNormalExecution = true; 340 LogManager::getSingleton().logMessage("Using default octree scene manager rendering"); 333 341 } 334 342 335 343 mVisibilityManager->SetCullingManager(algorithm); 336 337 stringstream d;338 d << "setting algorithm to: " << algorithm;339 LogManager::getSingleton().logMessage(d.str());340 344 } 341 345 342 346 ///////////// 343 347 // terrain options 348 349 if (mUseDepthPass) 350 LogManager::getSingleton().logMessage("using depth pass"); 351 else 352 LogManager::getSingleton().logMessage("not using depth pass"); 353 354 if (mExecuteVertexProgramForAllPasses) 355 LogManager::getSingleton().logMessage("executing vertex program for passes"); 356 else 357 LogManager::getSingleton().logMessage("not executing vertex program for passes"); 358 359 if (mUseVisibilityQueries) 360 LogManager::getSingleton().logMessage("using visibility queries"); 361 else 362 LogManager::getSingleton().logMessage("not using visibility queries"); 363 364 if (mUseFromPointQueries) 365 LogManager::getSingleton().logMessage("using from point queries"); 366 else 367 LogManager::getSingleton().logMessage("not using from point queries"); 368 369 if (mQueryMode == EXACT_QUERIES) 370 LogManager::getSingleton().logMessage("using exact queries"); 371 else if (mQueryMode == NODE_QUERIES) 372 LogManager::getSingleton().logMessage("using node queries"); 373 else if (mQueryMode == APPROXIMATE_QUERIES) 374 LogManager::getSingleton().logMessage("using approximate queries"); 375 376 if (mResetMaterialForQueries) 377 LogManager::getSingleton().logMessage("resetting material for queries"); 378 else 379 LogManager::getSingleton().logMessage("resetting material for queries"); 380 381 if (mDeleteQueueAfterRendering) 382 LogManager::getSingleton().logMessage("flushing queue after some frames"); 383 else 384 LogManager::getSingleton().logMessage("not flushing queue after some frames"); 344 385 345 386 if (!mShowTerrain) … … 449 490 selectPageSource(pageSourceName, optlist); 450 491 451 if (mUseDepthPass) 452 LogManager::getSingleton().logMessage("using depth"); 453 else 454 LogManager::getSingleton().logMessage("not using depth"); 455 456 if (mExecuteVertexProgramForAllPasses) 457 LogManager::getSingleton().logMessage("executing vertex program for passes"); 458 else 459 LogManager::getSingleton().logMessage("not executing vertex program for passes"); 460 461 if (mUseVisibilityQueries) 462 LogManager::getSingleton().logMessage("using visibility queries"); 463 else 464 LogManager::getSingleton().logMessage("not using visibility queries"); 465 466 if (mUseFromPointQueries) 467 LogManager::getSingleton().logMessage("using from point queries"); 468 else 469 LogManager::getSingleton().logMessage("not using from point queries"); 470 471 if (mUseExactQueries) 472 LogManager::getSingleton().logMessage("using exact queries"); 473 else 474 LogManager::getSingleton().logMessage("not using exact queries"); 475 476 if (mUseDepthPassForQueries) 477 LogManager::getSingleton().logMessage("using depth pass for queries"); 478 else 479 LogManager::getSingleton().logMessage("not using depth pass for queries"); 480 481 if (mDeleteQueueAfterRendering) 482 LogManager::getSingleton().logMessage("flushing queue after rendering"); 483 else 484 LogManager::getSingleton().logMessage("not flushing queue after rendering"); 485 492 486 493 LogManager::getSingleton().logMessage("****** OcclusionCullingSceneManager Options Finished ********"); 487 494 } … … 1126 1133 return true; 1127 1134 } 1128 if (key == " UseExactQueries")1129 { 1130 m UseExactQueries = *static_cast<const bool*>(val);1131 1132 return true; 1133 } 1134 if (key == " UseDepthPassForQueries")1135 { 1136 m UseDepthPassForQueries = *static_cast<const bool *>(val);1135 if (key == "QueryMode") 1136 { 1137 mQueryMode = *static_cast<const int *>(val); 1138 1139 return true; 1140 } 1141 if (key == "ResetMaterialForQueries") 1142 { 1143 mResetMaterialForQueries = *static_cast<const bool *>(val); 1137 1144 } 1138 1145 if (key == "UseFromPointQueries") … … 1192 1199 return true; 1193 1200 } 1201 1194 1202 if (key == "VisibleObjects") 1195 1203 { … … 1201 1209 1202 1210 * static_cast<unsigned int *>(val) = 1203 (unsigned int) FindExactVisibleObjects(mCameraInProgress,1204 mCurrentViewport,1205 fromPoint,1206 nodeVisibility);1211 (unsigned int)QueryVisibleObjectsExact(mCameraInProgress, 1212 mCurrentViewport, 1213 fromPoint, 1214 nodeVisibility); 1207 1215 return true; 1208 1216 } … … 1865 1873 int i = 0; 1866 1874 1867 if (filename == "terrain" )1868 { 1869 LogManager::getSingleton().logMessage(" loading terrain");1875 if (filename == "terrain" || filename == "") 1876 { 1877 LogManager::getSingleton().logMessage("not loading scene"); 1870 1878 1871 1879 // terrain hack … … 2203 2211 } 2204 2212 //----------------------------------------------------------------------- 2205 int OcclusionCullingSceneManager:: FindExactVisibleObjects(Camera *camera,2206 Viewport* vp,2207 const bool fromPoint,2208 const bool nodeVisibility)2213 int OcclusionCullingSceneManager::QueryVisibleObjectsExact(Camera *camera, 2214 Viewport* vp, 2215 const bool fromPoint, 2216 const bool nodeVisibility) 2209 2217 { 2210 2218 const int itemBufferMode = 0; 2211 2219 const bool relativeVisibility = false; 2220 const bool approximateVisibility = false; 2212 2221 2213 2222 int queryModes = 0; … … 2236 2245 &visibleGeometry, 2237 2246 &visiblePatches, 2238 relativeVisibility); 2247 relativeVisibility, 2248 approximateVisibility); 2239 2249 } 2240 2250 else … … 2244 2254 &visibleGeometry, 2245 2255 &visiblePatches, 2246 relativeVisibility); 2256 relativeVisibility, 2257 approximateVisibility); 2247 2258 } 2248 2259 … … 2489 2500 // note:have to disable deph write for nodes! 2490 2501 bool savedUseDepthPass = mUseDepthPass; 2491 if (m UseDepthPassForQueries) mUseDepthPass = true;2502 if (mResetMaterialForQueries) mUseDepthPass = true; 2492 2503 2493 2504 // lists only used for visualization … … 2498 2509 const int itemBufferMode = 0; 2499 2510 const bool relativeVisibility = false; 2511 bool approximateVisibility = false; 2500 2512 2501 2513 int queryModes = 0; 2502 2514 2503 if (mUseExactQueries) 2515 if (mQueryMode != 0) 2516 { 2517 queryModes |= GtpVisibility::QueryManager::NODE_VISIBILITY; 2518 2519 if (mQueryMode == 2) 2520 { 2521 approximateVisibility = true; 2522 } 2523 } 2524 else 2525 { 2504 2526 queryModes |= GtpVisibility::QueryManager::GEOMETRY_VISIBILITY; 2505 else 2506 queryModes |= GtpVisibility::QueryManager::NODE_VISIBILITY; 2527 } 2507 2528 2508 2529 … … 2526 2547 &visibleGeometry, 2527 2548 &visiblePatches, 2528 relativeVisibility); 2549 relativeVisibility, 2550 approximateVisibility); 2529 2551 } 2530 2552 else … … 2534 2556 &visibleGeometry, 2535 2557 &visiblePatches, 2536 relativeVisibility); 2558 relativeVisibility, 2559 approximateVisibility); 2537 2560 } 2538 2561 … … 2550 2573 //-- put items in render queue 2551 2574 2552 if (m UseExactQueries)2575 if (mQueryMode != EXACT_QUERIES) 2553 2576 { 2554 2577 //////////// 2555 2578 //-- apply queries on geometry level 2556 2579 2580 AddVisibleNodeGeometryToQueue(visibleNodes, cam); 2581 } 2582 else 2583 { 2557 2584 AddVisibleMeshGeometryToQueue(visibleGeometry, cam); 2558 }2559 else2560 {2561 AddVisibleNodeGeometryToQueue(visibleNodes, cam);2562 2585 } 2563 2586 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionQueriesQueryManager.cpp
r2254 r2255 28 28 GtpVisibility::MeshInfoContainer *visibleGeometry, 29 29 GtpVisibility::PatchInfoContainer *visiblePatches, 30 bool relativeVisibility) 30 const bool relativeVisibility, 31 const bool approximateVisibility) 31 32 { 32 33 // we need access to the scene manager and the rendersystem … … 37 38 bool overlayEnabled = mViewport->getOverlaysEnabled(); 38 39 39 ///////////40 //-- render scene with item buffer (i.e., objects with their id as color codes)41 42 40 //mItemBufferMode = 0; 43 if (0 && 44 (mItemBufferMode && mQueryModes) != 0) 45 { 41 if (0 && (mItemBufferMode && mQueryModes) != 0) 42 { 43 /////////// 44 //-- render scene with item buffer (ids are used as color codes) 45 46 46 int savedQueryModes = mQueryModes; 47 47 mQueryModes = mItemBufferMode; … … 51 51 visibleGeometry, 52 52 visiblePatches, 53 relativeVisibility); 53 relativeVisibility, 54 approximateVisibility); 54 55 55 56 // overlays cause false visibility … … 175 176 pfHierarchyInterface->CheckFrustumVisible(*nodeIt, intersects); 176 177 177 // always push back if intersects178 if ( 1 &&intersects)178 // always push back if only checking approximate visibility or intersects 179 if (approximateVisibility || intersects) 179 180 { 180 181 // no more information available … … 185 186 queryList[i].push_back(NULL); 186 187 } 187 else 188 else // issue occlusion query 188 189 { 189 190 queryList[i].push_back(mHierarchyInterface->IssueNodeOcclusionQuery(*nodeIt, false)); … … 200 201 for (geometryIt = geometryList.begin(); geometryIt != geometryIt_end; ++ geometryIt) 201 202 { 202 queryList[i].push_back(pfHierarchyInterface->IssueMeshOcclusionQuery(*geometryIt)); 203 if (approximateVisibility) 204 { 205 // no more information available 206 const int visPixels = 1; 207 const int projPixels = 1; 208 209 visibleGeometry->push_back(GtpVisibility::MeshInfo(*geometryIt, visPixels, projPixels)); 210 } 211 else 212 { 213 queryList[i].push_back(pfHierarchyInterface->IssueMeshOcclusionQuery(*geometryIt)); 214 } 203 215 } 204 216 } … … 211 223 for (patchIt = patchList.begin(); patchIt != patchIt_end; ++patchIt) 212 224 { 213 queryList[i].push_back(pfHierarchyInterface->IssuePatchOcclusionQuery(*patchIt)); 225 if (approximateVisibility) 226 { 227 // no more information available 228 const int visPixels = 1; 229 const int projPixels = 1; 230 231 visiblePatches->push_back(GtpVisibility::PatchInfo(*patchIt, visPixels, projPixels)); 232 } 233 else 234 { 235 queryList[i].push_back(pfHierarchyInterface->IssuePatchOcclusionQuery(*patchIt)); 236 } 214 237 } 215 238 } … … 284 307 GtpVisibility::MeshInfoContainer *visibleGeometry, 285 308 GtpVisibility::PatchInfoContainer *visiblePatches, 286 bool relativeVisibility) 309 const bool relativeVisibility, 310 const bool approximateVisibility) 287 311 { 288 312 PlatformQueryManager::ComputeFromPointVisibility(point, … … 290 314 visibleGeometry, 291 315 visiblePatches, 292 relativeVisibility); 316 relativeVisibility, 317 approximateVisibility); 293 318 294 319 // adds up their visibility and removes duplicates -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformQueryManager.cpp
r2184 r2255 33 33 GtpVisibility::MeshInfoContainer *visibleGeometry, 34 34 GtpVisibility::PatchInfoContainer *visiblePatches, 35 bool relativeVisibility) 35 const bool relativeVisibility, 36 const bool approximateVisibility) 36 37 { 37 38 SceneManager *sm = … … 87 88 visibleGeometry, 88 89 visiblePatches, 89 relativeVisibility); 90 relativeVisibility, 91 approximateVisibility); 90 92 //mViewport->getTarget()->update(); for(int j=0; j<10000000; j++) printf("wait"); 91 93 … … 102 104 //----------------------------------------------------------------------- 103 105 void PlatformQueryManager::ComputeCameraVisibility( 104 const Camera &camera, 105 GtpVisibility::NodeInfoContainer *visibleNodes, 106 GtpVisibility::MeshInfoContainer *visibleGeometry, 107 GtpVisibility::PatchInfoContainer *visiblePatches, 108 bool relativeVisibility) 106 const Camera &camera, 107 GtpVisibility::NodeInfoContainer *visibleNodes, 108 GtpVisibility::MeshInfoContainer *visibleGeometry, 109 GtpVisibility::PatchInfoContainer *visiblePatches, 110 const bool relativeVisibility, 111 const bool approximateVisibility) 109 112 { 110 113 // we need access to the scene manager and the rendersystem -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj
r2254 r2255 53 53 Name="VCPostBuildEventTool" 54 54 CommandLine="copy $(OutDir)\$(TargetFileName) $(OGRE_PATH)\Samples\Common\bin\$(ConfigurationName) 55 copy $(OutDir)\$(TargetFileName) E:\svn\gametools\GTP\trunk\App\Demos\Illum\Ogre\bin\$(ConfigurationName)56 55 "/> 57 56 <Tool … … 125 124 Name="VCPostBuildEventTool" 126 125 CommandLine="copy $(OutDir)\$(TargetFileName) $(OGRE_PATH)\Samples\Common\bin\$(ConfigurationName) 127 copy $(OutDir)\$(TargetFileName) E:\svn\gametools\GTP\trunk\App\Demos\Illum\Ogre\bin\$(ConfigurationName)128 126 "/> 129 127 <Tool
Note: See TracChangeset
for help on using the changeset viewer.