Counter Strike : Global Offensive Source Code
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.

132 lines
4.5 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #include "cbase.h"
  7. // NOTE: This has to be the last file included!
  8. #include "tier0/memdbgon.h"
  9. extern bool g_bUseCustomAutoExposureMin;
  10. extern bool g_bUseCustomAutoExposureMax;
  11. extern bool g_bUseCustomBloomScale;
  12. extern float g_flCustomAutoExposureMin;
  13. extern float g_flCustomAutoExposureMax;
  14. extern float g_flCustomBloomScale;
  15. extern float g_flCustomBloomScaleMinimum;
  16. extern float g_flBloomExponent;
  17. extern float g_flBloomSaturation;
  18. extern float g_flTonemapPercentTarget;
  19. extern float g_flTonemapPercentBrightPixels;
  20. extern float g_flTonemapMinAvgLum;
  21. extern float g_flTonemapRate;
  22. EHANDLE g_hTonemapControllerInUse = INVALID_EHANDLE;
  23. //-----------------------------------------------------------------------------
  24. // Purpose:
  25. //-----------------------------------------------------------------------------
  26. class C_EnvTonemapController : public C_BaseEntity
  27. {
  28. DECLARE_CLASS( C_EnvTonemapController, C_BaseEntity );
  29. public:
  30. DECLARE_CLIENTCLASS();
  31. C_EnvTonemapController();
  32. //private:
  33. bool m_bUseCustomAutoExposureMin;
  34. bool m_bUseCustomAutoExposureMax;
  35. bool m_bUseCustomBloomScale;
  36. float m_flCustomAutoExposureMin;
  37. float m_flCustomAutoExposureMax;
  38. float m_flCustomBloomScale;
  39. float m_flCustomBloomScaleMinimum;
  40. float m_flBloomExponent;
  41. float m_flBloomSaturation;
  42. float m_flTonemapPercentTarget;
  43. float m_flTonemapPercentBrightPixels;
  44. float m_flTonemapMinAvgLum;
  45. float m_flTonemapRate;
  46. private:
  47. C_EnvTonemapController( const C_EnvTonemapController & );
  48. };
  49. IMPLEMENT_CLIENTCLASS_DT( C_EnvTonemapController, DT_EnvTonemapController, CEnvTonemapController )
  50. RecvPropInt( RECVINFO(m_bUseCustomAutoExposureMin) ),
  51. RecvPropInt( RECVINFO(m_bUseCustomAutoExposureMax) ),
  52. RecvPropInt( RECVINFO(m_bUseCustomBloomScale) ),
  53. RecvPropFloat( RECVINFO(m_flCustomAutoExposureMin) ),
  54. RecvPropFloat( RECVINFO(m_flCustomAutoExposureMax) ),
  55. RecvPropFloat( RECVINFO(m_flCustomBloomScale) ),
  56. RecvPropFloat( RECVINFO(m_flCustomBloomScaleMinimum) ),
  57. RecvPropFloat( RECVINFO(m_flBloomExponent) ),
  58. RecvPropFloat( RECVINFO(m_flBloomSaturation) ),
  59. RecvPropFloat( RECVINFO(m_flTonemapPercentTarget) ),
  60. RecvPropFloat( RECVINFO(m_flTonemapPercentBrightPixels) ),
  61. RecvPropFloat( RECVINFO(m_flTonemapMinAvgLum) ),
  62. RecvPropFloat( RECVINFO(m_flTonemapRate) ),
  63. END_RECV_TABLE()
  64. //-----------------------------------------------------------------------------
  65. // Purpose:
  66. //-----------------------------------------------------------------------------
  67. C_EnvTonemapController::C_EnvTonemapController( void )
  68. {
  69. m_bUseCustomAutoExposureMin = false;
  70. m_bUseCustomAutoExposureMax = false;
  71. m_bUseCustomBloomScale = false;
  72. m_flCustomAutoExposureMin = 0;
  73. m_flCustomAutoExposureMax = 0;
  74. m_flCustomBloomScale = 0.0f;
  75. m_flCustomBloomScaleMinimum = 0.0f;
  76. m_flBloomExponent = 2.5f;
  77. m_flBloomSaturation = 1.0f;
  78. m_flTonemapPercentTarget = 65.0f;
  79. m_flTonemapPercentBrightPixels = 2.0f;
  80. m_flTonemapMinAvgLum = 3.0f;
  81. m_flTonemapRate = 1.0f;
  82. }
  83. void GetTonemapSettingsFromEnvTonemapController( void )
  84. {
  85. C_BasePlayer *localPlayer = C_BasePlayer::GetLocalPlayer();
  86. if ( localPlayer )
  87. {
  88. C_EnvTonemapController *tonemapController = dynamic_cast< C_EnvTonemapController * >(localPlayer->m_hTonemapController.Get());
  89. if ( tonemapController != NULL )
  90. {
  91. g_bUseCustomAutoExposureMin = tonemapController->m_bUseCustomAutoExposureMin;
  92. g_bUseCustomAutoExposureMax = tonemapController->m_bUseCustomAutoExposureMax;
  93. g_bUseCustomBloomScale = tonemapController->m_bUseCustomBloomScale;
  94. g_flCustomAutoExposureMin = tonemapController->m_flCustomAutoExposureMin;
  95. g_flCustomAutoExposureMax = tonemapController->m_flCustomAutoExposureMax;
  96. g_flCustomBloomScale = tonemapController->m_flCustomBloomScale;
  97. g_flCustomBloomScaleMinimum = tonemapController->m_flCustomBloomScaleMinimum;
  98. g_flBloomExponent = tonemapController->m_flBloomExponent;
  99. g_flBloomSaturation = tonemapController->m_flBloomSaturation;
  100. g_flTonemapPercentTarget = tonemapController->m_flTonemapPercentTarget;
  101. g_flTonemapPercentBrightPixels = tonemapController->m_flTonemapPercentBrightPixels;
  102. g_flTonemapMinAvgLum = tonemapController->m_flTonemapMinAvgLum;
  103. g_flTonemapRate = tonemapController->m_flTonemapRate;
  104. return;
  105. }
  106. }
  107. g_bUseCustomAutoExposureMax = false;
  108. g_bUseCustomBloomScale = false;
  109. g_flBloomExponent = 2.5f;
  110. g_flBloomSaturation = 1.0f;
  111. g_flTonemapPercentTarget = 65.0f;
  112. g_flTonemapPercentBrightPixels = 2.0f;
  113. g_flTonemapMinAvgLum = 3.0f;
  114. g_flTonemapRate = 1.0f;
  115. }