MCPcopy Create free account
hub / github.com/OGRECave/ogre / setDepthBufferFor

Method setDepthBufferFor

OgreMain/src/OgreRenderSystem.cpp:509–550  ·  view source on GitHub ↗

-----------------------------------------------------------------------

Source from the content-addressed store, hash-verified

507 }
508 //-----------------------------------------------------------------------
509 void RenderSystem::setDepthBufferFor( RenderTarget *renderTarget )
510 {
511 uint16 poolNum = renderTarget->getDepthBufferPool();
512 if( poolNum == RBP_NONE )
513 return; //RenderTarget explicitly requested no depth buffer
514
515 uint32 poolId = HashCombine(0, poolNum);
516 poolId = HashCombine(poolId, renderTarget->getFSAA());
517
518 if(!getCapabilities()->hasCapability(RSC_RTT_INDEPENDENT_BUFFER_SIZE))
519 {
520 //Depth buffer must be EXACT same size as RT
521 poolId = HashCombine(poolId, renderTarget->getWidth());
522 poolId = HashCombine(poolId, renderTarget->getHeight());
523 }
524
525 //Find a depth buffer in the pool
526 bool bAttached = false;
527 for (auto& d : mDepthBufferPool[poolId]) {
528 bAttached = renderTarget->attachDepthBuffer(d);
529 if (bAttached) break;
530 }
531
532 //Not found yet? Create a new one!
533 if( !bAttached )
534 {
535 DepthBuffer *newDepthBuffer = _createDepthBufferFor( renderTarget );
536
537 if( newDepthBuffer )
538 {
539 mDepthBufferPool[poolId].push_back( newDepthBuffer );
540
541 bAttached = renderTarget->attachDepthBuffer( newDepthBuffer );
542
543 OgreAssert( bAttached ,"A new DepthBuffer for a RenderTarget was created, but after creation"
544 " it says it's incompatible with that RT" );
545 }
546 else
547 LogManager::getSingleton().logWarning( "Couldn't create a suited DepthBuffer"
548 "for RT: " + renderTarget->getName());
549 }
550 }
551 //-----------------------------------------------------------------------
552 bool RenderSystem::isReverseDepthBufferEnabled() const
553 {

Callers

nothing calls this directly

Calls 8

HashCombineFunction · 0.85
getCapabilitiesFunction · 0.85
logWarningMethod · 0.80
getWidthMethod · 0.45
getHeightMethod · 0.45
attachDepthBufferMethod · 0.45
push_backMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected