source-engine/game/client/c_env_tonemap_controller.cpp

102 lines
3.4 KiB
C++
Raw Normal View History

2023-10-03 17:23:56 +03:00
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
2020-04-22 12:56:21 -04:00
//
// Purpose:
//
//=============================================================================
2023-10-03 17:23:56 +03:00
2020-04-22 12:56:21 -04:00
#include "cbase.h"
2023-10-03 17:23:56 +03:00
// NOTE: This has to be the last file included!
#include "tier0/memdbgon.h"
2020-04-22 12:56:21 -04:00
extern bool g_bUseCustomAutoExposureMin;
extern bool g_bUseCustomAutoExposureMax;
extern bool g_bUseCustomBloomScale;
extern float g_flCustomAutoExposureMin;
extern float g_flCustomAutoExposureMax;
extern float g_flCustomBloomScale;
extern float g_flCustomBloomScaleMinimum;
EHANDLE g_hTonemapControllerInUse = NULL;
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class C_EnvTonemapController : public C_BaseEntity
{
DECLARE_CLASS( C_EnvTonemapController, C_BaseEntity );
public:
DECLARE_CLIENTCLASS();
C_EnvTonemapController();
private:
bool m_bUseCustomAutoExposureMin;
bool m_bUseCustomAutoExposureMax;
bool m_bUseCustomBloomScale;
float m_flCustomAutoExposureMin;
float m_flCustomAutoExposureMax;
float m_flCustomBloomScale;
float m_flCustomBloomScaleMinimum;
2023-10-03 17:23:56 +03:00
float m_flBloomExponent;
float m_flBloomSaturation;
2020-04-22 12:56:21 -04:00
private:
C_EnvTonemapController( const C_EnvTonemapController & );
2023-10-03 17:23:56 +03:00
friend void GetTonemapSettingsFromEnvTonemapController( void );
2020-04-22 12:56:21 -04:00
};
IMPLEMENT_CLIENTCLASS_DT( C_EnvTonemapController, DT_EnvTonemapController, CEnvTonemapController )
RecvPropInt( RECVINFO(m_bUseCustomAutoExposureMin) ),
RecvPropInt( RECVINFO(m_bUseCustomAutoExposureMax) ),
RecvPropInt( RECVINFO(m_bUseCustomBloomScale) ),
RecvPropFloat( RECVINFO(m_flCustomAutoExposureMin) ),
RecvPropFloat( RECVINFO(m_flCustomAutoExposureMax) ),
RecvPropFloat( RECVINFO(m_flCustomBloomScale) ),
RecvPropFloat( RECVINFO(m_flCustomBloomScaleMinimum) ),
2023-10-03 17:23:56 +03:00
RecvPropFloat( RECVINFO(m_flBloomExponent) ),
RecvPropFloat( RECVINFO(m_flBloomSaturation) ),
2020-04-22 12:56:21 -04:00
END_RECV_TABLE()
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
C_EnvTonemapController::C_EnvTonemapController( void )
{
m_bUseCustomAutoExposureMin = false;
m_bUseCustomAutoExposureMax = false;
m_bUseCustomBloomScale = false;
m_flCustomAutoExposureMin = 0;
m_flCustomAutoExposureMax = 0;
m_flCustomBloomScale = 0.0f;
m_flCustomBloomScaleMinimum = 0.0f;
2023-10-03 17:23:56 +03:00
m_flBloomExponent = 2.5f;
m_flBloomSaturation = 1.0f;
2020-04-22 12:56:21 -04:00
}
2023-10-03 17:23:56 +03:00
void GetTonemapSettingsFromEnvTonemapController( void )
2020-04-22 12:56:21 -04:00
{
2023-10-03 17:23:56 +03:00
C_BasePlayer *localPlayer = C_BasePlayer::GetLocalPlayer();
if ( localPlayer )
2020-04-22 12:56:21 -04:00
{
2023-10-03 17:23:56 +03:00
C_EnvTonemapController *tonemapController = dynamic_cast< C_EnvTonemapController * >(localPlayer->m_hTonemapController.Get());
if ( tonemapController != NULL )
{
g_bUseCustomAutoExposureMin = tonemapController->m_bUseCustomAutoExposureMin;
g_bUseCustomAutoExposureMax = tonemapController->m_bUseCustomAutoExposureMax;
g_bUseCustomBloomScale = tonemapController->m_bUseCustomBloomScale;
g_flCustomAutoExposureMin = tonemapController->m_flCustomAutoExposureMin;
g_flCustomAutoExposureMax = tonemapController->m_flCustomAutoExposureMax;
g_flCustomBloomScale = tonemapController->m_flCustomBloomScale;
g_flCustomBloomScaleMinimum = tonemapController->m_flCustomBloomScaleMinimum;
return;
}
2020-04-22 12:56:21 -04:00
}
2023-10-03 17:23:56 +03:00
g_bUseCustomAutoExposureMax = false;
g_bUseCustomBloomScale = false;
2020-04-22 12:56:21 -04:00
}