Skip to content

Commit

Permalink
Clean up global shadow max blur size variable
Browse files Browse the repository at this point in the history
  • Loading branch information
dpogue committed Dec 30, 2022
1 parent a8fb981 commit 5380d3f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
10 changes: 6 additions & 4 deletions Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1240,10 +1240,12 @@ PF_CONSOLE_CMD( Graphics_Shadow,
"...",
"Max shadowmap blur size." )
{
extern float blurScale;
if( numParams > 0 )
{
blurScale = (float)atof( params[ 0 ] );
float blurScale;
if (numParams > 0) {
blurScale = (float)atof(params[0]);
plShadowMaster::SetGlobalMaxBlur(blurScale);
} else {
blurScale = plShadowMaster::GetGlobalMaxBlur();
}
pfConsolePrintF(PrintString, "Max shadowmap Blur {f}", blurScale);
}
Expand Down
5 changes: 3 additions & 2 deletions Sources/Plasma/FeatureLib/pfDXPipeline/plDXPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ You can contact Cyan Worlds, Inc. by email [email protected]
#include "plGImage/plMipmap.h"
#include "plGLight/plLightInfo.h"
#include "plGLight/plShadowCaster.h"
#include "plGLight/plShadowMaster.h"
#include "plGLight/plShadowSlave.h"
#include "plMessage/plDeviceRecreateMsg.h"
#include "plResMgr/plLocalization.h"
Expand Down Expand Up @@ -9629,7 +9630,6 @@ const char *plDXPipeline::IGetDXFormatName( D3DFORMAT format )



float blurScale = -1.f;
static const int kL2NumSamples = 3; // Log2(4)

// IBlurShadowMap //////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -10898,7 +10898,8 @@ bool plDXPipeline::IRenderShadowCaster(plShadowSlave* slave)
}

// Debug only.
if( blurScale >= 0.f )
float blurScale = plShadowMaster::GetGlobalMaxBlur();
if (blurScale >= 0.f)
slave->fBlurScale = blurScale;

// If this shadow requests being blurred, do it.
Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ uint32_t plShadowMaster::fGlobalMaxSize = 512;
float plShadowMaster::fGlobalMaxDist = 160.f; // PERSPTEST
// float plShadowMaster::fGlobalMaxDist = 100000.f; // PERSPTEST
float plShadowMaster::fGlobalVisParm = 1.f;
float plShadowMaster::fGlobalMaxBlur = -1.f;

void plShadowMaster::SetGlobalShadowQuality(float s)
{
Expand Down
22 changes: 13 additions & 9 deletions Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,20 @@ class plShadowMaster : public plObjInterface

protected:
// Global clamp on shadow map size and stuff
static uint32_t fGlobalMaxSize;
static float fGlobalMaxDist;
static float fGlobalVisParm;
static uint32_t fGlobalMaxSize;
static float fGlobalMaxDist;
static float fGlobalVisParm;
static float fGlobalMaxBlur;

// Constant parameter(s) for this master.
float fAttenDist;
float fMaxDist;
float fMinDist;
float fAttenDist;
float fMaxDist;
float fMinDist;

uint32_t fMaxSize;
uint32_t fMinSize;
uint32_t fMaxSize;
uint32_t fMinSize;

float fPower;
float fPower;

// Temp data used for one frame and recycled.
hsPoolVector<std::unique_ptr<plShadowSlave>> fSlavePool;
Expand Down Expand Up @@ -166,6 +167,9 @@ class plShadowMaster : public plObjInterface

static void SetGlobalShadowQuality(float s);
static float GetGlobalShadowQuality() { return fGlobalVisParm; }

static void SetGlobalMaxBlur(float s) { fGlobalMaxBlur = s; }
static float GetGlobalMaxBlur() { return fGlobalMaxBlur; }
};


Expand Down

0 comments on commit 5380d3f

Please sign in to comment.