Changeset 343 for trunk/VUT/work/ogre_changes
- Timestamp:
- 10/20/05 18:49:11 (19 years ago)
- Location:
- trunk/VUT/work/ogre_changes
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
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.