diff --git a/Components/Hlms/Pbs/src/OgreHlmsPbsDatablock.cpp b/Components/Hlms/Pbs/src/OgreHlmsPbsDatablock.cpp index 147626a4bd7..6c29a002557 100644 --- a/Components/Hlms/Pbs/src/OgreHlmsPbsDatablock.cpp +++ b/Components/Hlms/Pbs/src/OgreHlmsPbsDatablock.cpp @@ -839,7 +839,7 @@ namespace Ogre } if( newBlendblock != *mBlendblock[0] ) - setBlendblock( newBlendblock ); + setBlendblock( newBlendblock, false, false ); if( mTransparencyMode == Refractive && mMacroblock[0]->mDepthWrite ) { diff --git a/Docs/src/manual/Scripts/compositor.md b/Docs/src/manual/Scripts/compositor.md index 9a3dd344e76..f8593488198 100644 --- a/Docs/src/manual/Scripts/compositor.md +++ b/Docs/src/manual/Scripts/compositor.md @@ -3819,4 +3819,4 @@ compositor_node CubemapRendererNodeMsaa target mixedCubemapRtv +Z : cubemap_target {} target mixedCubemapRtv -Z : cubemap_target {} } -``` \ No newline at end of file +``` diff --git a/OgreMain/include/OgreHlmsDatablock.h b/OgreMain/include/OgreHlmsDatablock.h index 79f7dd58274..cf5ed685fcd 100644 --- a/OgreMain/include/OgreHlmsDatablock.h +++ b/OgreMain/include/OgreHlmsDatablock.h @@ -427,10 +427,12 @@ namespace Ogre @see HlmsManager::getMacroblock @param casterBlock True to directly set the macroblock to be used during the shadow mapping's caster pass. - Note that when false, it will automatically reset the caster's block according to - HlmsManager::setShadowMappingUseBackFaces setting. + When false, the value of overrideCasterBlock becomes relevant. + @param overrideCasterBlock + If true and casterBlock = false, the caster block will also be set to the input value. */ - void setMacroblock( const HlmsMacroblock ¯oblock, bool casterBlock = false ); + void setMacroblock( const HlmsMacroblock ¯oblock, bool casterBlock = false, + bool overrideCasterBlock = true ); /** Sets the macroblock from the given pointer that was already retrieved from the HlmsManager. Unlike the other overload, @@ -440,10 +442,12 @@ namespace Ogre A valid block. The reference count is increased inside this function. @param casterBlock True to directly set the macroblock to be used during the shadow mapping's caster pass. - Note that when false, it will automatically reset the caster's block according to - HlmsManager::setShadowMappingUseBackFaces setting. + When false, the value of overrideCasterBlock becomes relevant. + @param overrideCasterBlock + If true and casterBlock = false, the caster block will also be set to the input value. */ - void setMacroblock( const HlmsMacroblock *macroblock, bool casterBlock = false ); + void setMacroblock( const HlmsMacroblock *macroblock, bool casterBlock = false, + bool overrideCasterBlock = true ); /** Sets a new blendblock that matches the same parameter as the input. Decreases the reference count of the previous mBlendblock. @@ -453,9 +457,12 @@ namespace Ogre @see HlmsManager::getBlendblock @param casterBlock True to directly set the blendblock to be used during the shadow mapping's caster pass. - Note that when false, it will reset the caster block to the same as the regular one. + When false, the value of overrideCasterBlock becomes relevant. + @param overrideCasterBlock + If true and casterBlock = false, the caster block will also be set to the input value. */ - void setBlendblock( const HlmsBlendblock &blendblock, bool casterBlock = false ); + void setBlendblock( const HlmsBlendblock &blendblock, bool casterBlock = false, + bool overrideCasterBlock = true ); /** Sets the blendblock from the given pointer that was already retrieved from the HlmsManager. Unlike the other overload, @@ -465,9 +472,12 @@ namespace Ogre A valid block. The reference count is increased inside this function. @param casterBlock True to directly set the blendblock to be used during the shadow mapping's caster pass. - Note that when false, it will reset the caster block to the same as the regular one. + When false, the value of overrideCasterBlock becomes relevant. + @param overrideCasterBlock + If true and casterBlock = false, the caster block will also be set to the input value. */ - void setBlendblock( const HlmsBlendblock *blendblock, bool casterBlock = false ); + void setBlendblock( const HlmsBlendblock *blendblock, bool casterBlock = false, + bool overrideCasterBlock = true ); const HlmsMacroblock *getMacroblock( bool casterBlock = false ) const { @@ -532,11 +542,11 @@ namespace Ogre virtual void setAlphaTestThreshold( float threshold ); float getAlphaTestThreshold() const { return mAlphaTestThreshold; } - /// @see Hlms::getNameStr. This operations is NOT fast. Might return null + /// @see Hlms::getNameStr. This operation is NOT fast. Might return null /// (if the datablock was removed from the Hlms but somehow is still alive) const String *getNameStr() const; - /// @see Hlms::getFilenameAndResourceGroup. This operations is NOT fast. Might return + /// @see Hlms::getFilenameAndResourceGroup. This operation is NOT fast. Might return /// null (if the datablock was removed from the Hlms but somehow is still alive) /// Usage: /// String const *filename; diff --git a/OgreMain/src/OgreHlmsDatablock.cpp b/OgreMain/src/OgreHlmsDatablock.cpp index 04584d8200e..3ca70250056 100644 --- a/OgreMain/src/OgreHlmsDatablock.cpp +++ b/OgreMain/src/OgreHlmsDatablock.cpp @@ -303,7 +303,8 @@ namespace Ogre return mCreator->getDatablockCustomPieceFileNameStr( mCustomPieceFileIdHash[shaderType] ); } //----------------------------------------------------------------------------------- - void HlmsDatablock::setMacroblock( const HlmsMacroblock ¯oblock, bool casterBlock ) + void HlmsDatablock::setMacroblock( const HlmsMacroblock ¯oblock, const bool casterBlock, + const bool overrideCasterBlock ) { OgreProfileExhaustive( "HlmsDatablock::setMacroblockRef" ); @@ -316,7 +317,7 @@ namespace Ogre hlmsManager->destroyMacroblock( oldBlock ); updateMacroblockHash( casterBlock ); - if( !casterBlock ) + if( !casterBlock && overrideCasterBlock ) { mIgnoreFlushRenderables = true; setMacroblock( mMacroblock[0], true ); @@ -333,7 +334,8 @@ namespace Ogre } } //----------------------------------------------------------------------------------- - void HlmsDatablock::setMacroblock( const HlmsMacroblock *macroblock, bool casterBlock ) + void HlmsDatablock::setMacroblock( const HlmsMacroblock *macroblock, const bool casterBlock, + const bool overrideCasterBlock ) { OgreProfileExhaustive( "HlmsDatablock::setMacroblockPtr" ); @@ -346,7 +348,7 @@ namespace Ogre updateMacroblockHash( casterBlock ); - if( !casterBlock ) + if( !casterBlock && overrideCasterBlock ) { mIgnoreFlushRenderables = true; setMacroblock( mMacroblock[0], true ); @@ -363,7 +365,8 @@ namespace Ogre } } //----------------------------------------------------------------------------------- - void HlmsDatablock::setBlendblock( const HlmsBlendblock &blendblock, bool casterBlock ) + void HlmsDatablock::setBlendblock( const HlmsBlendblock &blendblock, const bool casterBlock, + const bool overrideCasterBlock ) { OgreProfileExhaustive( "HlmsDatablock::setBlendblockRef" ); @@ -376,7 +379,7 @@ namespace Ogre hlmsManager->destroyBlendblock( oldBlock ); updateMacroblockHash( casterBlock ); - if( !casterBlock ) + if( !casterBlock && overrideCasterBlock ) { mIgnoreFlushRenderables = true; if( mBlendblock[0]->mAlphaToCoverage == HlmsBlendblock::A2cDisabled ) @@ -400,7 +403,8 @@ namespace Ogre } } //----------------------------------------------------------------------------------- - void HlmsDatablock::setBlendblock( const HlmsBlendblock *blendblock, bool casterBlock ) + void HlmsDatablock::setBlendblock( const HlmsBlendblock *blendblock, const bool casterBlock, + const bool overrideCasterBlock ) { OgreProfileExhaustive( "HlmsDatablock::setBlendblockPtr" ); @@ -412,7 +416,7 @@ namespace Ogre mBlendblock[casterBlock] = blendblock; updateMacroblockHash( casterBlock ); - if( !casterBlock ) + if( !casterBlock && overrideCasterBlock ) { mIgnoreFlushRenderables = true; if( mBlendblock[0]->mAlphaToCoverage == HlmsBlendblock::A2cDisabled )