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.

90 lines
2.4 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "clientsideeffects.h"
  7. #include "materialsystem/imaterial.h"
  8. #include "materialsystem/imaterialsystem.h"
  9. #ifndef FX_QUAD_H
  10. #define FX_QUAD_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. // Flags
  15. #define FXQUAD_BIAS_SCALE 0x0001 //Bias the scale's interpolation function
  16. #define FXQUAD_BIAS_ALPHA 0x0002 //Bias the alpha's interpolation function
  17. #define FXQUAD_COLOR_FADE 0x0004 //Blend the color towards black via the alpha (overcomes additive ignoring alpha)
  18. struct FXQuadData_t
  19. {
  20. FXQuadData_t( void )
  21. {
  22. m_flLifeTime = 0.0f;
  23. m_flDieTime = 0.0f;
  24. m_uiFlags = 0;
  25. }
  26. void SetFlags( unsigned int flags ) { m_uiFlags |= flags; }
  27. void SetOrigin( const Vector &origin ) { m_vecOrigin = origin; }
  28. void SetNormal( const Vector &normal ) { m_vecNormal = normal; }
  29. void SetScale( float start, float end ) { m_flStartScale = start; m_flEndScale = end; }
  30. void SetAlpha( float start, float end ) { m_flStartAlpha = start; m_flEndAlpha = end; }
  31. void SetLifeTime( float lifetime ) { m_flDieTime = lifetime; }
  32. void SetColor( float r, float g, float b ) { m_Color = Vector( r, g, b ); }
  33. void SetAlphaBias( float bias ) { m_flAlphaBias = bias; }
  34. void SetScaleBias( float bias ) { m_flScaleBias = bias; }
  35. void SetYaw( float yaw, float delta = 0.0f ){ m_flYaw = yaw; m_flDeltaYaw = delta; }
  36. void SetMaterial( const char *shader )
  37. {
  38. m_pMaterial = materials->FindMaterial( shader, TEXTURE_GROUP_CLIENT_EFFECTS );
  39. if ( m_pMaterial != NULL )
  40. {
  41. m_pMaterial->IncrementReferenceCount();
  42. }
  43. }
  44. unsigned int m_uiFlags;
  45. IMaterial *m_pMaterial;
  46. Vector m_vecOrigin;
  47. Vector m_vecNormal;
  48. float m_flStartScale;
  49. float m_flEndScale;
  50. float m_flDieTime;
  51. float m_flLifeTime;
  52. float m_flStartAlpha;
  53. float m_flEndAlpha;
  54. Vector m_Color;
  55. float m_flYaw;
  56. float m_flDeltaYaw;
  57. // Only used with FXQUAD_BIAS_ALPHA and FXQUAD_BIAS_SCALE
  58. float m_flScaleBias;
  59. float m_flAlphaBias;
  60. };
  61. class CFXQuad : public CClientSideEffect
  62. {
  63. public:
  64. CFXQuad( const FXQuadData_t &data );
  65. ~CFXQuad( void );
  66. virtual void Draw( double frametime );
  67. virtual bool IsActive( void );
  68. virtual void Destroy( void );
  69. virtual void Update( double frametime );
  70. protected:
  71. FXQuadData_t m_FXData;
  72. };
  73. #endif // FX_QUAD_H