- Timestamp:
- 10/20/05 18:49:11 (19 years ago)
- Location:
- trunk/VUT
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp
r295 r343 83 83 84 84 // if we assume node to be visible in this frame => skip query 85 // TODO: check this (not the expected speed up) 85 86 if (wasVisible && (mAssumedVisibility > 0) && DecideVisible(node) && mHierarchyInterface->HasGeometry(node)) 86 87 { -
trunk/VUT/Ogre/resources/overlays/VisibilityDemo.overlay
r254 r343 121 121 font_name TrebuchetMSBold 122 122 caption : 123 } 123 } 124 element TextArea(Example/Visibility/UseArbQueries): Example/Visibility/Templates/BasicText 125 { 126 left 5 127 width 120 128 height 30 129 caption [A] HW Query type 130 } 131 element TextArea(Example/Visibility/UseArbQueriesInfo): Example/Visibility/Templates/BasicText 132 { 133 left 210 134 width 90 135 font_name TrebuchetMSBold 136 caption : 137 } 138 124 139 } 125 140 -
trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp
r174 r343 106 106 } 107 107 #endif 108 108 109 } 109 110 //----------------------------------------------------------------------- -
trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
r259 r343 237 237 void VisibilityOctreeSceneManager::_renderVisibleObjects() 238 238 { 239 240 //InitVisibilityCulling(mCameraInProgress); 241 //mVisibilityManager->ApplyVisibilityCulling(); 242 243 if(1){ 239 244 InitDepthPass(); // create material for depth pass 240 245 InitItemBufferPass(); // create material for item buffer pass … … 340 345 // reset ambient light 341 346 setAmbientLight(savedAmbient); 342 347 } 343 348 getRenderQueue()->clear(); // finally clear render queue 344 349 OGRE_DELETE(mRenderQueue); // HACK: should be cleared before... 345 350 //WriteLog(); // write out stats 351 346 352 } 347 353 … … 428 434 return true; 429 435 } 436 if (key == "UseArbQueries") 437 { 438 bool useArbQueries = (*static_cast<const bool *>(val)); 439 440 if (useArbQueries) 441 { 442 mHierarchyInterface->DeleteQueries(); 443 mDestRenderSystem->setConfigOption("ArbQueries", "Yes"); 444 } 445 else 446 { 447 mHierarchyInterface->DeleteQueries(); 448 mDestRenderSystem->setConfigOption("ArbQueries", "No"); 449 } 450 } 451 430 452 return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 431 453 setOption(key, val) || OctreeSceneManager::setOption(key, val); -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r259 r343 434 434 } 435 435 436 if (key == "UseArbQueries") 437 { 438 bool useArbQueries = (*static_cast<const bool *>(val)); 439 440 if (useArbQueries) 441 { 442 mHierarchyInterface->DeleteQueries(); 443 mDestRenderSystem->setConfigOption("ArbQueries", "Yes"); 444 } 445 else 446 { 447 mHierarchyInterface->DeleteQueries(); 448 mDestRenderSystem->setConfigOption("ArbQueries", "No"); 449 } 450 } 436 451 return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 437 452 setOption(key, val) || TerrainSceneManager::setOption(key, val); -
trunk/VUT/scripts/GtpVisibility.sln
r187 r343 6 6 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_VisibilitySceneManager", "..\Ogre\scripts\Plugin_VisibilitySceneManager.vcproj", "{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}" 7 7 ProjectSection(ProjectDependencies) = postProject 8 {101A7691-74F3-48B4-96A3-CF35578F5900} = {101A7691-74F3-48B4-96A3-CF35578F5900}9 EndProjectSection10 EndProject11 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCulling", "..\work\TestCulling\TestCulling.vcproj", "{B5A492C7-F04F-4F9A-9483-3303EBEB4306}"12 ProjectSection(ProjectDependencies) = postProject13 {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436}14 8 {101A7691-74F3-48B4-96A3-CF35578F5900} = {101A7691-74F3-48B4-96A3-CF35578F5900} 15 9 EndProjectSection … … 50 44 {80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Release.ActiveCfg = Release|Win32 51 45 {80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Release.Build.0 = Release|Win32 52 {B5A492C7-F04F-4F9A-9483-3303EBEB4306}.Debug.ActiveCfg = Debug|Win3253 {B5A492C7-F04F-4F9A-9483-3303EBEB4306}.Debug.Build.0 = Debug|Win3254 {B5A492C7-F04F-4F9A-9483-3303EBEB4306}.Release.ActiveCfg = Release|Win3255 {B5A492C7-F04F-4F9A-9483-3303EBEB4306}.Release.Build.0 = Release|Win3256 46 {248F19A6-2FE0-4F5D-8928-E0EA10609887}.Debug.ActiveCfg = Debug|Win32 57 47 {248F19A6-2FE0-4F5D-8928-E0EA10609887}.Debug.Build.0 = Debug|Win32 -
trunk/VUT/work/IVReader/scripts/IVReader.vcproj
r183 r343 149 149 </File> 150 150 </Filter> 151 <File152 RelativePath=".\ReadMe.txt">153 </File>154 151 </Files> 155 152 <Globals> -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
r316 r343 140 140 mNumVideoFrames(0), 141 141 mDemoFps(0), 142 mUseDemoFps(false) 142 mUseDemoFps(false), 143 mUseArbQueries(false) 143 144 { 144 145 //mInputDevice = PlatformManager::getSingleton().createInputReader(); … … 188 189 mTimer = Root::getSingleton().getTimer(); 189 190 mTimeFrameEnded = mTimeFrameStarted = mTimer->getMilliseconds(); 191 192 // arb or nv queries 193 mSceneMgr->setOption("UseArbQueries", &mUseArbQueries); 190 194 191 195 // reset statistics … … 882 886 guiCurr->setCaption(currFpsString + StringConverter::toString(currentFps)); 883 887 888 //std::stringstream d; d << "frame rate :" << stats.lastFPS; 889 //Ogre::LogManager::getSingleton().logMessage(d.str()); 884 890 885 891 guiBest->setCaption(bestFpsString + StringConverter::toString(stats.bestFPS) … … 973 979 { 974 980 mUseDepthPassInfo->setCaption(": false"); 981 } 982 } 983 //----------------------------------------------------------------------- 984 void TerrainFrameListener::toggleUseArbQueries() 985 { 986 mUseArbQueries = !mUseArbQueries; 987 988 mSceneMgr->setOption("UseArbQueries", &mUseArbQueries); 989 990 if (mUseArbQueries) 991 { 992 mUseArbQueriesInfo->setCaption(": ARB"); 993 } 994 else 995 { 996 mUseArbQueriesInfo->setCaption(": NV"); 975 997 } 976 998 } … … 1173 1195 mUseDemoFps = !mUseDemoFps; 1174 1196 break; 1197 case KC_A: 1198 toggleUseArbQueries(); 1199 break; 1200 1175 1201 //KEY_PRESSED(KC_F3, 0.3, writeFrames()); 1176 1202 //KEY_PRESSED(KC_F4, 0.3, loadFrames()); … … 1502 1528 initOverlayElement(&mAssumedVisibilityInfo, ext, "AssumedVisibility", top, ": 0"); top += vert_space; 1503 1529 initOverlayElement(&mCurrentObjectTypeInfo, ext, "CurrentObjectType", top, ": "); top += vert_space; 1530 initOverlayElement(&mUseArbQueriesInfo, ext, "UseArbQueries", top, ": NV"); top += vert_space; 1504 1531 //initOverlayElement(&mHelpInfo, ext, "Help", top, ": "); top += vert_space; 1505 1532 -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h
r259 r343 210 210 */ 211 211 void toggleUseDepthPass(); 212 /** Toggles wether we use ARB or NV queries. 213 */ 214 void toggleUseArbQueries(); 212 215 /** Toggles wether the visualization is shown. 213 216 */ … … 288 291 OverlayElement *mTestGeometryForVisibleLeavesInfo; 289 292 OverlayElement *mUseDepthPassInfo; 293 OverlayElement *mUseArbQueriesInfo; 290 294 OverlayElement *mRenderedNodesInfo; 291 295 OverlayElement *mObjectsCountInfo; … … 312 316 bool mShowOctree; 313 317 bool mUseDepthPass; 318 bool mUseArbQueries; 314 319 bool mShowVisualization; 315 320 bool mCullCamera; -
trunk/VUT/work/iv/IVFrameListener.cpp
r316 r343 48 48 mVisibilityThreshold(0), 49 49 mAssumedVisibility(0), 50 mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING), 50 //mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING), 51 //mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::STOP_AND_WAIT_CULLING), 52 mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::FRUSTUM_CULLING), 51 53 mNodeVizMode(NODEVIZ_NONE), 52 54 mVizCameraHeight(Real(2500.0)), … … 63 65 mShowOctree(false), 64 66 mUseDepthPass(false), 67 mUseArbQueries(false), 65 68 mTestGeometryForVisibleLeaves(false), 66 69 mShowVisualization(false), … … 123 126 mSceneMgr->setOption("DelayRenderTransparents", &delayRenderTransparents); 124 127 mSceneMgr->setOption("UseDepthPass", &mUseDepthPass); 125 128 mSceneMgr->setOption("UseArbQueries", &mUseArbQueries); 129 126 130 mSceneMgr->setOption("ShowOctree", &mShowOctree); 127 131 mSceneMgr->setOption("CullCamera", &mCullCamera); … … 571 575 guiAvg->setCaption(avgFpsString + StringConverter::toString(avgFps) + " ms"); 572 576 } 577 //std::stringstream d; d << "frame rate :" << stats.lastFPS; 578 //Ogre::LogManager::getSingleton().logMessage(d.str()); 573 579 574 580 guiCurr->setCaption(currFpsString + StringConverter::toString(stats.lastFPS)); … … 646 652 647 653 mSceneMgr->setOption("ShowOctree", &mShowOctree); 654 } 655 //----------------------------------------------------------------------- 656 void IVFrameListener::toggleUseArbQueries() 657 { 658 mUseArbQueries = !mUseArbQueries; 659 660 mSceneMgr->setOption("UseArbQueries", &mUseArbQueries); 661 662 if (mUseArbQueries) 663 { 664 mUseArbQueriesInfo->setCaption(": ARB"); 665 } 666 else 667 { 668 mUseArbQueriesInfo->setCaption(": NV"); 669 } 648 670 } 649 671 //----------------------------------------------------------------------- … … 808 830 mShiftPressed = true; 809 831 break; 810 832 case KC_A: 833 toggleUseArbQueries(); 834 break; 811 835 default: 812 836 break; … … 1121 1145 initOverlayElement(&mAssumedVisibilityInfo, ext, "AssumedVisibility", top, ": 0"); top += vert_space; 1122 1146 initOverlayElement(&mCurrentObjectTypeInfo, ext, "CurrentObjectType", top, ": "); top += vert_space; 1147 initOverlayElement(&mUseArbQueriesInfo, ext, "UseArbQueries", top, ": NV"); top += vert_space; 1123 1148 //initOverlayElement(&mHelpInfo, ext, "Help", top, ": "); top += vert_space; 1124 1149 -
trunk/VUT/work/iv/IVFrameListener.h
r259 r343 115 115 void toggleShowOctree(); 116 116 void toggleUseDepthPass(); 117 void toggleUseArbQueries(); 117 118 void toggleShowViz(); 118 119 void toggleRecord(); … … 159 160 OverlayElement *mTestGeometryForVisibleLeavesInfo; 160 161 OverlayElement *mUseDepthPassInfo; 162 OverlayElement *mUseArbQueriesInfo; 161 163 OverlayElement *mRenderedNodesInfo; 162 164 OverlayElement *mObjectsCountInfo; … … 180 182 bool mShowOctree; 181 183 bool mUseDepthPass; 184 bool mUseArbQueries; 182 185 bool mShowVisualization; 183 186 bool mCullCamera; -
trunk/VUT/work/iv/TestCullingIVApplication.cpp
r259 r343 92 92 mSceneMgr->setOption("NodeVizScale", &scale); 93 93 // HACK: change this to relative path 94 String path = "D:/svn/ gtp/trunk/VUT/Ogre/resources/";94 String path = "D:/svn/trunk/VUT/Ogre/resources/"; 95 95 96 96 SceneNode *node1 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Node1"); -
trunk/VUT/work/ogre_changes/OgreMain/include/OgreRenderQueueSortingGrouping.h
r193 r343 202 202 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 203 203 204 /** Clears solids in this group of renderables. Leaves transparents in group.205 */206 void clearSolids(void);207 208 204 enum {SOLID_PASSES = 1, 209 205 SOLID_PASSES_DECAL = 2, … … 221 217 */ 222 218 void clear(const int leavePassesInQueue); 219 /** Destroys passes determined by parameter. 220 @param passes can be one or several (combined by |) of: 221 SOLID_PASSES 222 SOLID_PASSES_DECAL 223 SOLID_PASSES_DIFFUSE_SPECULAR 224 SOLID_PASSES_NOSHADOW 225 TRANSPARENT_PASSES 226 */ 227 void destroyPassMaps(const int leavePassesInQueue); 228 223 229 #endif // GTP_VISIBILITY_MODIFIED_OGRE 224 230 /** Sets whether or not the queue will split passes by their lighting type, … … 337 343 338 344 } 339 /** Clears only solid renderables. Leaves transparents in queue. */340 void clearSolids(void)345 346 void destroyPasses(int passes) 341 347 { 342 348 PriorityMap::iterator i, iend; … … 344 350 for (i = mPriorityGroups.begin(); i != iend; ++i) 345 351 { 346 i->second->clearSolids(); 347 } 352 i->second->destroyPassMaps(passes); 353 } 354 348 355 } 349 356 #endif // GTP_VISIBILITY_MODIFIED_OGRE -
trunk/VUT/work/ogre_changes/OgreMain/src/OgreRenderQueueSortingGrouping.cpp
r139 r343 278 278 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 279 279 //----------------------------------------------------------------------- 280 void RenderPriorityGroup::clearSolids(void)281 {282 /*SolidRenderablePassMap::iterator i, iend;283 // Delete queue groups which are using passes which are to be284 // deleted, we won't need these any more and they clutter up285 // the list and can cause problems with future clones286 const Pass::PassSet& graveyardList = Pass::getPassGraveyard();287 Pass::PassSet::const_iterator gi, giend;288 giend = graveyardList.end();289 for (gi = graveyardList.begin(); gi != giend; ++gi)290 {291 removeSolidPassEntry(*gi);292 }293 294 // Now remove any dirty passes, these will have their hashes recalculated295 // by the parent queue after all groups have been processed296 // If we don't do this, the std::map will become inconsistent for new insterts297 const Pass::PassSet& dirtyList = Pass::getDirtyHashList();298 Pass::PassSet::const_iterator di, diend;299 diend = dirtyList.end();300 for (di = dirtyList.begin(); di != diend; ++di)301 {302 removeSolidPassEntry(*di);303 }*/304 // NB we do NOT clear the graveyard or the dirty list here, because305 // it needs to be acted on for all groups, the parent queue takes306 // care of this afterwards307 308 // We do not clear the unchanged solid pass maps, only the contents of each list309 // This is because we assume passes are reused a lot and it saves resorting310 clearSolidPassMap(mSolidPasses);311 clearSolidPassMap(mSolidPassesDecal);312 clearSolidPassMap(mSolidPassesDiffuseSpecular);313 clearSolidPassMap(mSolidPassesNoShadow);314 }315 //-----------------------------------------------------------------------316 280 void RenderPriorityGroup::clear(const int leavePassesInQueue) 317 281 { 318 SolidRenderablePassMap::iterator i, iend; 319 320 // -- standard method if no passes are left in queue 282 //-- standard method if no passes are left in queue 321 283 if (leavePassesInQueue == 0) 322 284 { … … 328 290 // This is because we assume passes are reused a lot and it saves resorting 329 291 if (!(leavePassesInQueue & SOLID_PASSES)) 330 clearSolidPassMap(mSolidPasses);292 destroySolidPassMap(mSolidPasses); 331 293 if (!(leavePassesInQueue & SOLID_PASSES_DECAL)) 332 clearSolidPassMap(mSolidPassesDecal);294 destroySolidPassMap(mSolidPassesDecal); 333 295 if (!(leavePassesInQueue & SOLID_PASSES_DIFFUSE_SPECULAR)) 334 clearSolidPassMap(mSolidPassesDiffuseSpecular);296 destroySolidPassMap(mSolidPassesDiffuseSpecular); 335 297 if (!(leavePassesInQueue & SOLID_PASSES_NOSHADOW)) 336 clearSolidPassMap(mSolidPassesNoShadow);298 destroySolidPassMap(mSolidPassesNoShadow); 337 299 338 300 if (!(leavePassesInQueue & TRANSPARENT_PASSES)) 339 301 mTransparentPasses.clear(); 340 302 } 303 //----------------------------------------------------------------------- 304 void RenderPriorityGroup::destroyPassMaps(const int leavePassesInQueue) 305 { 306 /* 307 const Pass::PassSet& graveyardList = Pass::getPassGraveyard(); 308 Pass::PassSet::const_iterator gi, giend; 309 giend = graveyardList.end(); 310 for (gi = graveyardList.begin(); gi != giend; ++gi) 311 { 312 removeSolidPassEntry(*gi); 313 } 314 315 const Pass::PassSet& dirtyList = Pass::getDirtyHashList(); 316 Pass::PassSet::const_iterator di, diend; 317 diend = dirtyList.end(); 318 for (di = dirtyList.begin(); di != diend; ++di) 319 { 320 removeSolidPassEntry(*di); 321 } 322 */ 323 324 // We do not clear the unchanged solid pass maps, only the contents of each list 325 // This is because we assume passes are reused a lot and it saves resorting 326 if (!(leavePassesInQueue & SOLID_PASSES)) 327 destroySolidPassMap(mSolidPasses); 328 if (!(leavePassesInQueue & SOLID_PASSES_DECAL)) 329 destroySolidPassMap(mSolidPassesDecal); 330 if (!(leavePassesInQueue & SOLID_PASSES_DIFFUSE_SPECULAR)) 331 destroySolidPassMap(mSolidPassesDiffuseSpecular); 332 if (!(leavePassesInQueue & SOLID_PASSES_NOSHADOW)) 333 destroySolidPassMap(mSolidPassesNoShadow); 334 } 341 335 #endif // GTP_VISIBILITY_MODIFIED_OGRE 342 336 //----------------------------------------------------------------------- -
trunk/VUT/work/ogre_changes/OgreMain/src/OgreSceneManager.cpp
r316 r343 4226 4226 if (isRenderQueueToBeProcessed(qId)) 4227 4227 { 4228 /*if (leaveTransparentsInQueue) 4229 { pGroup->clearSolids(); } else 4230 { pGroup->clear(); }*/ 4231 pGroup->clear(leavePassesInQueue); 4228 pGroup->destroyPasses(leavePassesInQueue); 4232 4229 } 4233 4230 } -
trunk/VUT/work/ogre_changes/RenderSystems/GL/include/OgreGLHardwareOcclusionQuery.h
r115 r343 111 111 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 112 112 bool pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult, const HW_OCCLUSIONQUERY flag = HWOCCLUSIONQUERY_FLUSH ); 113 114 static bool sUseArbQueries; 113 115 #endif // GTP_VISIBILITY_MODIFIED_OGRE 114 116 //---------------------------------------------------------------------- … … 122 124 int mSkipCounter; 123 125 int mSkipInterval; 124 bool mHasOcclusionSupport; 126 bool mHasOcclusionSupportNV; 127 bool mHasOcclusionSupportARB; 125 128 }; 126 129 -
trunk/VUT/work/ogre_changes/RenderSystems/GL/src/OgreGLHardwareOcclusionQuery.cpp
r193 r343 29 29 namespace Ogre { 30 30 31 bool GLHardwareOcclusionQuery::sUseArbQueries = false; 31 32 /** 32 33 * This is a class that is the base class of the query class for … … 51 52 // Check for hardware occlusion support 52 53 // This is a hack to see if hw occlusion is supported. pointer is 0 if it's not supported. 53 #ifdef GTP_VISIBILITY_USE_ARB_QUERIES 54 if (glGenQueriesARB_ptr != 0) 55 #else 56 if (glGenOcclusionQueriesNV_ptr != 0) 57 #endif 58 { 59 mHasOcclusionSupport = true; 60 } 61 else 62 { 63 mHasOcclusionSupport = false; 64 } 54 mHasOcclusionSupportARB = (glGenQueriesARB_ptr != 0); 55 mHasOcclusionSupportNV = (glGenOcclusionQueriesNV_ptr != 0); 65 56 66 if(mHasOcclusionSupport) 67 { 68 #ifdef GTP_VISIBILITY_USE_ARB_QUERIES 57 if (sUseArbQueries && mHasOcclusionSupportARB) 69 58 glGenQueriesARB_ptr(1, &mQueryID ); 70 #else 59 else if (!sUseArbQueries && mHasOcclusionSupportNV) 71 60 glGenOcclusionQueriesNV_ptr(1, &mQueryID); 72 #endif73 }74 61 } 75 62 … … 79 66 GLHardwareOcclusionQuery::~GLHardwareOcclusionQuery() 80 67 { 81 if( mHasOcclusionSupport ) 82 { 83 #ifdef GTP_VISIBILITY_USE_ARB_QUERIES 68 if (sUseArbQueries && mHasOcclusionSupportARB) 84 69 glDeleteQueriesARB_ptr(1, &mQueryID); 85 #else 70 else if (!sUseArbQueries && mHasOcclusionSupportNV) 86 71 glDeleteOcclusionQueriesNV_ptr(1, &mQueryID); 87 #endif88 }89 72 } 90 73 … … 94 77 void GLHardwareOcclusionQuery::beginOcclusionQuery() 95 78 { 96 // Make it fail silently if hardware occlusion isn't supported 97 if(mHasOcclusionSupport) 98 { 99 // Counter starts at 0 again at mSkipInterval 100 #ifndef GTP_VISIBILITY_MODIFIED_OGRE 101 if(mSkipCounter == mSkipInterval) 102 #else 103 if (mSkipCounter >= mSkipInterval) // otherwise no query ever issued if mSkipInterval = 0 ! 104 #endif // GTP_VISIBILITY_MODIFIED_OGRE 105 { 106 mSkipCounter = 0; 107 } 79 //if (mSkipCounter >= mSkipInterval) // otherwise no query ever issued if mSkipInterval = 0 ! 80 // mSkipCounter = 0; if (mSkipCounter != 0) return; 108 81 109 if (mSkipCounter == 0) 110 { 111 #ifdef GTP_VISIBILITY_USE_ARB_QUERIES 82 if (sUseArbQueries && mHasOcclusionSupportARB) 112 83 glBeginQueryARB_ptr(GL_SAMPLES_PASSED_ARB, mQueryID); 113 #else 84 else if (!sUseArbQueries && mHasOcclusionSupportNV) 114 85 glBeginOcclusionQueryNV_ptr(mQueryID); 115 #endif116 }117 }118 86 } 119 87 120 88 void GLHardwareOcclusionQuery::endOcclusionQuery() 121 89 { 122 // Make it fail silently if hardware occlusion isn't supported 123 if(mHasOcclusionSupport) 124 { 125 if( mSkipCounter == 0) 126 { 127 #ifdef GTP_VISIBILITY_USE_ARB_QUERIES 90 //if( mSkipCounter != 0) return; 91 if (sUseArbQueries && mHasOcclusionSupportARB) 128 92 glEndQueryARB_ptr(GL_SAMPLES_PASSED_ARB); 129 #else 93 else if (!sUseArbQueries && mHasOcclusionSupportNV) 130 94 glEndOcclusionQueryNV_ptr(); 131 #endif 95 // mSkipCounter++; 132 96 } 133 97 134 mSkipCounter++;135 }136 }137 138 //------------------------------------------------------------------139 // OpenGL dosn't use the flag paramter.140 //------------------------------------------------------------------141 98 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const HW_OCCLUSIONQUERY flag ) 142 99 { 143 if( mHasOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 144 { 145 #ifdef GTP_VISIBILITY_USE_ARB_QUERIES 100 if (sUseArbQueries && mHasOcclusionSupportARB) 146 101 glGetQueryObjectuivARB_ptr(mQueryID, GL_QUERY_RESULT_ARB, NumOfFragments); 147 #else 102 else if (!sUseArbQueries && mHasOcclusionSupportNV) 148 103 glGetOcclusionQueryuivNV_ptr(mQueryID, GL_PIXEL_COUNT_NV, NumOfFragments); 149 #endif150 }151 104 else 152 { 153 *NumOfFragments = 100000; // Fails quitlly -> every object tested is visable. 154 } 105 *NumOfFragments = 100000; // Fails quietly 155 106 156 107 mPixelCount = *NumOfFragments; … … 161 112 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 162 113 //------------------------------------------------------------------ 163 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int * NumOfFragments, const bool waitForResult, const HW_OCCLUSIONQUERY flag) 114 bool GLHardwareOcclusionQuery::pullOcclusionQuery(unsigned int * NumOfFragments, 115 const bool waitForResult, 116 const HW_OCCLUSIONQUERY flag) 164 117 { 165 unsigned int isAvailable = GL_TRUE; 118 if (sUseArbQueries && mHasOcclusionSupportARB) 119 { 120 int isAvailable = GL_TRUE; 166 121 167 if (mHasOcclusionSupport)168 {169 122 if (!waitForResult) 123 glGetQueryivARB_ptr(mQueryID, GL_QUERY_RESULT_AVAILABLE_ARB, &isAvailable); 124 125 if (isAvailable == GL_TRUE) 126 glGetQueryObjectuivARB_ptr(mQueryID, GL_QUERY_RESULT_ARB, NumOfFragments); 127 128 mPixelCount = *NumOfFragments; 129 130 return isAvailable == GL_TRUE; 131 } 132 else if (!sUseArbQueries && mHasOcclusionSupportNV) 170 133 { 171 // use nv queries rather that arb because they are faster (no flush) 172 //glGetQueryivARB_ptr(mQueryID, GL_QUERY_RESULT_AVAILABLE_ARB, &isAvailable); 134 unsigned int isAvailable = GL_TRUE; 135 136 if (!waitForResult) 173 137 glGetOcclusionQueryuivNV_ptr(mQueryID, GL_PIXEL_COUNT_AVAILABLE_NV, &isAvailable); 174 }175 138 176 139 if (isAvailable == GL_TRUE) 177 {178 //glGetQueryObjectuivARB_ptr(mQueryID, GL_QUERY_RESULT_ARB, NumOfFragments);179 140 glGetOcclusionQueryuivNV_ptr(mQueryID, GL_PIXEL_COUNT_NV, NumOfFragments); 180 }181 }182 else183 {184 // In case hardware occlusion isn't supported, every object is set visible.185 *NumOfFragments = 100000;186 }187 141 188 142 mPixelCount = *NumOfFragments; 189 143 190 return isAvailable == GL_TRUE; 144 return isAvailable == GL_TRUE; 145 } 146 147 // In case hardware occlusion isn't supported, every object is set visible. 148 *NumOfFragments = 100000; 149 mPixelCount = *NumOfFragments; 150 151 return GL_TRUE; 191 152 } 192 153 -
trunk/VUT/work/ogre_changes/RenderSystems/GL/src/OgreGLRenderSystem.cpp
r316 r343 281 281 void GLRenderSystem::setConfigOption(const String &name, const String &value) 282 282 { 283 // set occlusion query 284 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 285 if ( name == "ArbQueries" ) 286 { 287 if ( value == "No" ) 288 { 289 GLHardwareOcclusionQuery::sUseArbQueries = false; 290 } 291 else if ( value == "Yes" ) 292 { 293 GLHardwareOcclusionQuery::sUseArbQueries = true; 294 } 295 return; 296 } 297 #endif 298 283 299 mGLSupport->setConfigOption(name, value); 284 300 }
Note: See TracChangeset
for help on using the changeset viewer.