Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #include "cbase.h"
  7. extern bool g_bUseCustomAutoExposureMin;
  8. extern bool g_bUseCustomAutoExposureMax;
  9. extern bool g_bUseCustomBloomScale;
  10. extern float g_flCustomAutoExposureMin;
  11. extern float g_flCustomAutoExposureMax;
  12. extern float g_flCustomBloomScale;
  13. extern float g_flCustomBloomScaleMinimum;
  14. EHANDLE g_hTonemapControllerInUse = NULL;
  15. //-----------------------------------------------------------------------------
  16. // Purpose:
  17. //-----------------------------------------------------------------------------
  18. class C_EnvTonemapController : public C_BaseEntity
  19. {
  20. DECLARE_CLASS( C_EnvTonemapController, C_BaseEntity );
  21. public:
  22. DECLARE_CLIENTCLASS();
  23. C_EnvTonemapController();
  24. ~C_EnvTonemapController();
  25. virtual void OnDataChanged( DataUpdateType_t updateType );
  26. private:
  27. bool m_bUseCustomAutoExposureMin;
  28. bool m_bUseCustomAutoExposureMax;
  29. bool m_bUseCustomBloomScale;
  30. float m_flCustomAutoExposureMin;
  31. float m_flCustomAutoExposureMax;
  32. float m_flCustomBloomScale;
  33. float m_flCustomBloomScaleMinimum;
  34. private:
  35. C_EnvTonemapController( const C_EnvTonemapController & );
  36. };
  37. IMPLEMENT_CLIENTCLASS_DT( C_EnvTonemapController, DT_EnvTonemapController, CEnvTonemapController )
  38. RecvPropInt( RECVINFO(m_bUseCustomAutoExposureMin) ),
  39. RecvPropInt( RECVINFO(m_bUseCustomAutoExposureMax) ),
  40. RecvPropInt( RECVINFO(m_bUseCustomBloomScale) ),
  41. RecvPropFloat( RECVINFO(m_flCustomAutoExposureMin) ),
  42. RecvPropFloat( RECVINFO(m_flCustomAutoExposureMax) ),
  43. RecvPropFloat( RECVINFO(m_flCustomBloomScale) ),
  44. RecvPropFloat( RECVINFO(m_flCustomBloomScaleMinimum) ),
  45. END_RECV_TABLE()
  46. //-----------------------------------------------------------------------------
  47. // Purpose:
  48. //-----------------------------------------------------------------------------
  49. C_EnvTonemapController::C_EnvTonemapController( void )
  50. {
  51. m_bUseCustomAutoExposureMin = false;
  52. m_bUseCustomAutoExposureMax = false;
  53. m_bUseCustomBloomScale = false;
  54. m_flCustomAutoExposureMin = 0;
  55. m_flCustomAutoExposureMax = 0;
  56. m_flCustomBloomScale = 0.0f;
  57. m_flCustomBloomScaleMinimum = 0.0f;
  58. }
  59. //-----------------------------------------------------------------------------
  60. // Purpose:
  61. //-----------------------------------------------------------------------------
  62. C_EnvTonemapController::~C_EnvTonemapController( void )
  63. {
  64. if ( g_hTonemapControllerInUse == this )
  65. {
  66. g_bUseCustomAutoExposureMin = false;
  67. g_bUseCustomAutoExposureMax = false;
  68. g_bUseCustomBloomScale = false;
  69. }
  70. }
  71. //-----------------------------------------------------------------------------
  72. // Purpose:
  73. //-----------------------------------------------------------------------------
  74. void C_EnvTonemapController::OnDataChanged( DataUpdateType_t updateType )
  75. {
  76. BaseClass::OnDataChanged(updateType);
  77. g_bUseCustomAutoExposureMin = m_bUseCustomAutoExposureMin;
  78. g_bUseCustomAutoExposureMax = m_bUseCustomAutoExposureMax;
  79. g_bUseCustomBloomScale = m_bUseCustomBloomScale;
  80. g_flCustomAutoExposureMin = m_flCustomAutoExposureMin;
  81. g_flCustomAutoExposureMax = m_flCustomAutoExposureMax;
  82. g_flCustomBloomScale = m_flCustomBloomScale;
  83. g_flCustomBloomScaleMinimum = m_flCustomBloomScaleMinimum;
  84. g_hTonemapControllerInUse = this;
  85. }