Skip to content

Commit

Permalink
Merge branch 'v3-0'
Browse files Browse the repository at this point in the history
Samples/2.0/Tutorials/Tutorial_Terrain/src/Terra/Hlms/PbsListener/OgreHlmsPbsTerraShadows.cpp
  • Loading branch information
darksylinc committed Mar 17, 2024
2 parents 66d1757 + fb27a18 commit 9983d53
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2 deletions.
7 changes: 7 additions & 0 deletions Components/Hlms/Pbs/src/OgreHlmsJsonPbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,10 @@ namespace Ogre
changeBlendblock );
}

itor = json.FindMember( "refraction_strength" );
if( itor != json.MemberEnd() && itor->value.IsNumber() )
pbsDatablock->setRefractionStrength( static_cast<float>( itor->value.GetDouble() ) );

itor = json.FindMember( "clear_coat" );
if( itor != json.MemberEnd() && itor->value.IsObject() )
{
Expand Down Expand Up @@ -837,6 +841,9 @@ namespace Ogre
outString += "\n\t\t\t}";
}

outString += ",\n\t\t\t\"refraction_strength\" : ";
outString += StringConverter::toString( pbsDatablock->getRefractionStrength() );

if( pbsDatablock->getClearCoat() != 0.0f )
{
outString += ",\n\t\t\t\"clear_coat\" :\n\t\t\t{";
Expand Down
2 changes: 2 additions & 0 deletions Components/Hlms/Pbs/src/OgreHlmsPbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3193,6 +3193,8 @@ namespace Ogre

#ifdef OGRE_BUILD_COMPONENT_PLANAR_REFLECTIONS
mLastBoundPlanarReflection = 0u;
if( mHasPlanarReflections )
++texUnit; // We do not bind this texture now, but its slot is reserved.
#endif
mListener->hlmsTypeChanged( casterPass, commandBuffer, datablock, texUnit );
}
Expand Down
1 change: 1 addition & 0 deletions Docs/2.0/JSON/PbsAllSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ including invalid combinations (i.e. having a Metallic texture and a Specular te
"shadow_const_bias" : 0.01,
"two_sided" : false,
"receive_shadows" : true,
"refraction_strength" : 0.2,

"workflow" : "specular_ogre" "specular_fresnel" "metallic",

Expand Down
8 changes: 8 additions & 0 deletions Docs/src/manual/HlmsPBSDatablockReference.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ Reference Guide: HLMS PBS Datablock {#hlmspbsdatablockref}
- If switching from the 'default' BRDF implementation, the scene will be too bright. If so, divide light power by PI.
- **DEFAULT="default"**

## Parameter: refraction_strength

- Value of type float
- See Ogre::HlmsPbsDatablock::setRefractionStrength
- **DEFAULT=0.075**

## Parameter: detail_diffuse[X] {#dbParamDetailDiffuse}
- Name of the detail map to be used on top of the diffuse colour
- Can contain up to 4 detail_diffuse blocks (`detail_diffuse0` to `detail_diffuse3`)
Expand Down Expand Up @@ -263,6 +269,8 @@ Reference Guide: HLMS PBS Datablock {#hlmspbsdatablockref}
"macroblock" : "macroblock_name",
"macroblock" : ["macroblock_name", "macroblock_name_for_shadows"],
"shadow_const_bias" : 0.01,
"refraction_strength" : 0.2,
"brdf" : "default",
"detail_diffuse0" :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,8 @@ namespace Ogre

#ifdef OGRE_BUILD_COMPONENT_PLANAR_REFLECTIONS
mLastBoundPlanarReflection = 0u;
if( mHasPlanarReflections )
++texUnit; // We do not bind this texture now, but its slot is reserved.
#endif
mListener->hlmsTypeChanged( casterPass, commandBuffer, datablock, 0u );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ namespace Ogre
hlms->_getProperty( tid, PbsTerraProperty::TerraEnabled ) != 0 )
{
int32 texUnit = hlms->_getProperty( tid, PbsProperty::Set0TextureSlotEnd ) - 1;
if( hlms->_getProperty( tid, PbsProperty::HasPlanarReflections ) )
--texUnit;
hlms->_setTextureReg( tid, VertexShader, "terrainShadows", texUnit );
}
}
Expand Down

0 comments on commit 9983d53

Please sign in to comment.