Skip to content

Commit

Permalink
introduced mCullLights in CubemapProbe to be able control if static p…
Browse files Browse the repository at this point in the history
…robe camera takes part in global lights culling, for example if our probe renders with dir lights only and doesn't need to collect other lights
  • Loading branch information
dyunchik authored and eugenegff committed Dec 20, 2024
1 parent 7a8cc4d commit f372883
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Components/Hlms/Pbs/include/Cubemaps/OgreCubemapProbe.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ namespace Ogre

/// False if it should be updated every frame. True if only updated when dirty
bool mStatic;
/// False if it's static and its camera should not take part in global lighting culling
bool mCullLights;

public:
/// While disabled, this probe won't be updated (even if dirty) and won't be considered
Expand Down Expand Up @@ -197,6 +199,13 @@ namespace Ogre
void setStatic( bool isStatic );
bool getStatic() const { return mStatic; }

/** Set to False if it's static and its camera should not take part in global lighting culling
@remarks
call it outside before renderOneFrame()
*/
void setCullLights( bool b ) { mCullLights = b; }
bool getCullLights() const { return mCullLights; }

/** When two probes overlap, you may want one probe to have particularly more influence
than the others. Use this value to decrease/increase the weight when blending the probes.
@remarks
Expand Down
3 changes: 2 additions & 1 deletion Components/Hlms/Pbs/src/Cubemaps/OgreCubemapProbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ namespace Ogre
mNumDatablockUsers( 0 ),
mPriority( 10u ),
mStatic( true ),
mCullLights( true ),
mEnabled( true ),
mDirty( true ),
mNumIterations( 8 ),
Expand Down Expand Up @@ -548,7 +549,7 @@ namespace Ogre
{
mCamera->setPosition( mProbeCameraPos );
mCamera->setOrientation( Quaternion( mOrientation ) );
if( mStatic )
if( mStatic && mCullLights )
mCamera->setLightCullingVisibility( true, true );
}
}
Expand Down

0 comments on commit f372883

Please sign in to comment.