Skip to content

Commit

Permalink
Merge branch 'v3-0'
Browse files Browse the repository at this point in the history
  • Loading branch information
darksylinc committed Jul 27, 2024
2 parents 5545cb1 + e3a7340 commit a7a8764
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Components/Hlms/Pbs/src/OgreHlmsPbsDatablock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ namespace Ogre
}

if( newBlendblock != *mBlendblock[0] )
setBlendblock( newBlendblock );
setBlendblock( newBlendblock, false, false );

if( mTransparencyMode == Refractive && mMacroblock[0]->mDepthWrite )
{
Expand Down
2 changes: 1 addition & 1 deletion Docs/src/manual/Scripts/compositor.md
Original file line number Diff line number Diff line change
Expand Up @@ -3819,4 +3819,4 @@ compositor_node CubemapRendererNodeMsaa
target mixedCubemapRtv +Z : cubemap_target {}
target mixedCubemapRtv -Z : cubemap_target {}
}
```
```
34 changes: 22 additions & 12 deletions OgreMain/include/OgreHlmsDatablock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 &macroblock, bool casterBlock = false );
void setMacroblock( const HlmsMacroblock &macroblock, bool casterBlock = false,
bool overrideCasterBlock = true );

/** Sets the macroblock from the given pointer that was already
retrieved from the HlmsManager. Unlike the other overload,
Expand All @@ -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.
Expand All @@ -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,
Expand All @@ -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
{
Expand Down Expand Up @@ -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;
Expand Down
20 changes: 12 additions & 8 deletions OgreMain/src/OgreHlmsDatablock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ namespace Ogre
return mCreator->getDatablockCustomPieceFileNameStr( mCustomPieceFileIdHash[shaderType] );
}
//-----------------------------------------------------------------------------------
void HlmsDatablock::setMacroblock( const HlmsMacroblock &macroblock, bool casterBlock )
void HlmsDatablock::setMacroblock( const HlmsMacroblock &macroblock, const bool casterBlock,
const bool overrideCasterBlock )
{
OgreProfileExhaustive( "HlmsDatablock::setMacroblockRef" );

Expand All @@ -316,7 +317,7 @@ namespace Ogre
hlmsManager->destroyMacroblock( oldBlock );
updateMacroblockHash( casterBlock );

if( !casterBlock )
if( !casterBlock && overrideCasterBlock )
{
mIgnoreFlushRenderables = true;
setMacroblock( mMacroblock[0], true );
Expand All @@ -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" );

Expand All @@ -346,7 +348,7 @@ namespace Ogre

updateMacroblockHash( casterBlock );

if( !casterBlock )
if( !casterBlock && overrideCasterBlock )
{
mIgnoreFlushRenderables = true;
setMacroblock( mMacroblock[0], true );
Expand All @@ -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" );

Expand All @@ -376,7 +379,7 @@ namespace Ogre
hlmsManager->destroyBlendblock( oldBlock );
updateMacroblockHash( casterBlock );

if( !casterBlock )
if( !casterBlock && overrideCasterBlock )
{
mIgnoreFlushRenderables = true;
if( mBlendblock[0]->mAlphaToCoverage == HlmsBlendblock::A2cDisabled )
Expand All @@ -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" );

Expand All @@ -412,7 +416,7 @@ namespace Ogre
mBlendblock[casterBlock] = blendblock;
updateMacroblockHash( casterBlock );

if( !casterBlock )
if( !casterBlock && overrideCasterBlock )
{
mIgnoreFlushRenderables = true;
if( mBlendblock[0]->mAlphaToCoverage == HlmsBlendblock::A2cDisabled )
Expand Down

0 comments on commit a7a8764

Please sign in to comment.