MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / getDepthBufferFor

Method getDepthBufferFor

OgreMain/src/OgreRenderSystem.cpp:697–759  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

695 }
696 //---------------------------------------------------------------------
697 TextureGpu *RenderSystem::getDepthBufferFor( TextureGpu *colourTexture, uint16 poolId,
698 bool preferDepthTexture,
699 PixelFormatGpu depthBufferFormat )
700 {
701 if( poolId == DepthBuffer::POOL_NO_DEPTH || depthBufferFormat == PFG_NULL )
702 return 0; // RenderTarget explicitly requested no depth buffer
703
704 if( colourTexture->isRenderWindowSpecific() )
705 {
706 Window *window;
707 colourTexture->getCustomAttribute( "Window", &window );
708 return window->getDepthBuffer();
709 }
710
711 if( poolId == DepthBuffer::NO_POOL_EXPLICIT_RTV )
712 {
713 TextureGpu *retVal =
714 createDepthBufferFor( colourTexture, preferDepthTexture, depthBufferFormat, poolId );
715 return retVal;
716 }
717
718 // Find a depth buffer in the pool
719 TextureGpuVec::const_iterator itor = mDepthBufferPool2[poolId].begin();
720 TextureGpuVec::const_iterator endt = mDepthBufferPool2[poolId].end();
721
722 TextureGpu *retVal = 0;
723
724 while( itor != endt && !retVal )
725 {
726 if( preferDepthTexture == ( *itor )->isTexture() &&
727 ( depthBufferFormat == PFG_UNKNOWN ||
728 depthBufferFormat == ( *itor )->getPixelFormat() ) &&
729 ( *itor )->supportsAsDepthBufferFor( colourTexture ) )
730 {
731 retVal = *itor;
732 referenceSharedDepthBuffer( retVal );
733 }
734 else
735 {
736 retVal = 0;
737 }
738 ++itor;
739 }
740
741 // Not found yet? Create a new one!
742 if( !retVal )
743 {
744 retVal =
745 createDepthBufferFor( colourTexture, preferDepthTexture, depthBufferFormat, poolId );
746 mDepthBufferPool2[poolId].push_back( retVal );
747
748 if( !retVal )
749 {
750 LogManager::getSingleton().logMessage(
751 "WARNING: Couldn't create a suited "
752 "DepthBuffer for RTT: " +
753 colourTexture->getNameStr(),
754 LML_CRITICAL );

Callers 1

setupRenderPassTargetMethod · 0.80

Calls 11

getDepthBufferMethod · 0.80
isTextureMethod · 0.80
getCustomAttributeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getPixelFormatMethod · 0.45
push_backMethod · 0.45
logMessageMethod · 0.45
getNameStrMethod · 0.45

Tested by

no test coverage detected