Added shadow filter keyvalue to env_projectedtexture

This commit is contained in:
Blixibon 2022-10-21 10:14:51 -05:00
parent b5428d5a77
commit d93a2f0b17
4 changed files with 16 additions and 0 deletions

View File

@ -92,6 +92,7 @@ private:
float m_flLinearAtten;
float m_flQuadraticAtten;
float m_flShadowAtten;
float m_flShadowFilter;
bool m_bAlwaysDraw;
//bool m_bProjectedTextureVersion;

View File

@ -60,6 +60,7 @@ IMPLEMENT_CLIENTCLASS_DT( C_EnvProjectedTexture, DT_EnvProjectedTexture, CEnvPro
RecvPropFloat( RECVINFO( m_flLinearAtten ) ),
RecvPropFloat( RECVINFO( m_flQuadraticAtten ) ),
RecvPropFloat( RECVINFO( m_flShadowAtten ) ),
RecvPropFloat( RECVINFO( m_flShadowFilter ) ),
RecvPropBool( RECVINFO( m_bAlwaysDraw ) ),
// Not needed on the client right now, change when it actually is needed
@ -97,6 +98,7 @@ C_EnvProjectedTexture *C_EnvProjectedTexture::Create( )
pEnt->m_flLinearAtten = 100.0f;
pEnt->m_flQuadraticAtten = 0.0f;
pEnt->m_flShadowAtten = 0.0f;
pEnt->m_flShadowFilter = 0.5f;
//pEnt->m_bProjectedTextureVersion = 1;
#endif
@ -403,6 +405,7 @@ void C_EnvProjectedTexture::UpdateLight( void )
state.m_flShadowSlopeScaleDepthBias = mat_slopescaledepthbias_shadowmap.GetFloat();
state.m_flShadowDepthBias = mat_depthbias_shadowmap.GetFloat();
state.m_flShadowAtten = m_flShadowAtten;
state.m_flShadowFilterSize = m_flShadowFilter;
#else
state.m_fQuadraticAtten = 0.0;
state.m_fLinearAtten = 100;

View File

@ -50,6 +50,7 @@ BEGIN_DATADESC( CEnvProjectedTexture )
DEFINE_FIELD( m_flLinearAtten, FIELD_FLOAT ),
DEFINE_FIELD( m_flQuadraticAtten, FIELD_FLOAT ),
DEFINE_KEYFIELD( m_flShadowAtten, FIELD_FLOAT, "shadowatten" ),
DEFINE_KEYFIELD( m_flShadowFilter, FIELD_FLOAT, "shadowfilter" ),
#endif
DEFINE_INPUTFUNC( FIELD_VOID, "TurnOn", InputTurnOn ),
@ -77,6 +78,7 @@ BEGIN_DATADESC( CEnvProjectedTexture )
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetLinear", InputSetLinear ),
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetConstant", InputSetConstant ),
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetShadowAtten", InputSetShadowAtten ),
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetFilter", InputSetFilter ),
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetNearZ", InputSetNearZ ),
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetFarZ", InputSetFarZ ),
DEFINE_INPUTFUNC( FIELD_VOID, "AlwaysDrawOn", InputAlwaysDrawOn ),
@ -116,6 +118,7 @@ IMPLEMENT_SERVERCLASS_ST( CEnvProjectedTexture, DT_EnvProjectedTexture )
SendPropFloat( SENDINFO( m_flLinearAtten ) ),
SendPropFloat( SENDINFO( m_flQuadraticAtten ) ),
SendPropFloat( SENDINFO( m_flShadowAtten ) ),
SendPropFloat( SENDINFO( m_flShadowFilter ) ),
SendPropBool( SENDINFO( m_bAlwaysDraw ) ),
// Not needed on the client right now, change when it actually is needed
@ -158,6 +161,7 @@ CEnvProjectedTexture::CEnvProjectedTexture( void )
m_flLinearAtten = 100.0f;
m_flConstantAtten = 0.0f;
m_flShadowAtten = 0.0f;
m_flShadowFilter = 0.5f;
#endif
}
@ -316,6 +320,11 @@ void CEnvProjectedTexture::InputSetHorFOV( inputdata_t &inputdata )
{
m_flLightHorFOV = inputdata.value.Float();
}
void CEnvProjectedTexture::InputSetFilter( inputdata_t &inputdata )
{
m_flShadowFilter = inputdata.value.Float();
}
#endif
void CEnvProjectedTexture::InputSetTarget( inputdata_t &inputdata )

View File

@ -64,6 +64,7 @@ public:
void InputAlwaysDrawOff( inputdata_t &inputdata ) { m_bAlwaysDraw = false; }
void InputStopFollowingTarget( inputdata_t &inputdata ) { m_bDontFollowTarget = true; }
void InputStartFollowingTarget( inputdata_t &inputdata ) { m_bDontFollowTarget = false; }
void InputSetFilter( inputdata_t &inputdata );
// Corrects keyvalue/input attenuation for internal FlashlightEffect_t attenuation.
float CorrectConstantAtten( float fl ) { return fl * 0.5f; }
@ -105,6 +106,8 @@ private:
CNetworkVar( float, m_flQuadraticAtten );
CNetworkVar( float, m_flShadowAtten );
CNetworkVar( float, m_flShadowFilter );
CNetworkVar( bool, m_bAlwaysDraw );
// 1 = New projected texture