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.

87 lines
2.7 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=====================================================================================//
  8. #ifndef SCREENSPACEEFFECTS_H
  9. #define SCREENSPACEEFFECTS_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. class KeyValues;
  14. //------------------------------------------------------------------------------
  15. // Simple base class for screen space post-processing effects
  16. //------------------------------------------------------------------------------
  17. abstract_class IScreenSpaceEffect
  18. {
  19. public:
  20. virtual void Init( ) = 0;
  21. virtual void Shutdown( ) = 0;
  22. virtual void SetParameters( KeyValues *params ) = 0;
  23. virtual void Render( int x, int y, int w, int h ) = 0;
  24. virtual void Enable( bool bEnable ) = 0;
  25. virtual bool IsEnabled( ) = 0;
  26. };
  27. //------------------------------------------------------------------------------
  28. // Interface class for managing screen space post-processing effects
  29. //------------------------------------------------------------------------------
  30. abstract_class IScreenSpaceEffectManager
  31. {
  32. public:
  33. virtual void InitScreenSpaceEffects( ) = 0;
  34. virtual void ShutdownScreenSpaceEffects( ) = 0;
  35. virtual IScreenSpaceEffect *GetScreenSpaceEffect( const char *pEffectName ) = 0;
  36. virtual void SetScreenSpaceEffectParams( const char *pEffectName, KeyValues *params ) = 0;
  37. virtual void SetScreenSpaceEffectParams( IScreenSpaceEffect *pEffect, KeyValues *params ) = 0;
  38. virtual void EnableScreenSpaceEffect( const char *pEffectName ) = 0;
  39. virtual void EnableScreenSpaceEffect( IScreenSpaceEffect *pEffect ) = 0;
  40. virtual void DisableScreenSpaceEffect( const char *pEffectName ) = 0;
  41. virtual void DisableScreenSpaceEffect( IScreenSpaceEffect *pEffect ) = 0;
  42. virtual void DisableAllScreenSpaceEffects( ) = 0;
  43. virtual void RenderEffects( int x, int y, int w, int h ) = 0;
  44. };
  45. extern IScreenSpaceEffectManager *g_pScreenSpaceEffects;
  46. //-------------------------------------------------------------------------------------
  47. // Registration class for adding screen space effects to the IScreenSpaceEffectManager
  48. //-------------------------------------------------------------------------------------
  49. class CScreenSpaceEffectRegistration
  50. {
  51. public:
  52. CScreenSpaceEffectRegistration( const char *pName, IScreenSpaceEffect *pEffect );
  53. const char *m_pEffectName;
  54. IScreenSpaceEffect *m_pEffect;
  55. CScreenSpaceEffectRegistration *m_pNext;
  56. static CScreenSpaceEffectRegistration *s_pHead;
  57. };
  58. #define ADD_SCREENSPACE_EFFECT( CEffect, pEffectName ) CEffect pEffectName##_effect; \
  59. CScreenSpaceEffectRegistration pEffectName##_reg( #pEffectName, &pEffectName##_effect );
  60. #endif