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.

98 lines
3.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef CLIENTSIDEEFFECTS_H
  7. #define CLIENTSIDEEFFECTS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. class Vector;
  12. struct FXQuadData_t;
  13. struct FXLineData_t;
  14. //-----------------------------------------------------------------------------
  15. // Purpose: Base class for client side effects
  16. //-----------------------------------------------------------------------------
  17. abstract_class CClientSideEffect
  18. {
  19. public:
  20. // Constructs the named effect
  21. CClientSideEffect( const char *name );
  22. virtual ~CClientSideEffect( void );
  23. // Update/Draw the effect
  24. // Derived classes must implement this method!
  25. virtual void Draw( double frametime ) = 0;
  26. // Returns name of effect
  27. virtual const char *GetName( void );
  28. // Retuns whether the effect is still active
  29. virtual bool IsActive( void );
  30. // Sets the effect to inactive so it can be destroed
  31. virtual void Destroy( void );
  32. // Sets the effect name (useful for debugging).
  33. virtual void SetEffectName( const char *pszName );
  34. private:
  35. // Name of effect ( static data )
  36. const char *m_pszName;
  37. // Is the effect active
  38. bool m_bActive;
  39. };
  40. //-----------------------------------------------------------------------------
  41. // Purpose: Base interface to effects list
  42. //-----------------------------------------------------------------------------
  43. abstract_class IEffectsList
  44. {
  45. public:
  46. virtual ~IEffectsList( void ) {}
  47. // Add an effect to the list of effects
  48. virtual void AddEffect( CClientSideEffect *effect ) = 0;
  49. // Remove the specified effect
  50. virtual void RemoveEffect( CClientSideEffect *effect ) = 0;
  51. // Simulate/Update/Draw effects on list
  52. virtual void DrawEffects( double frametime ) = 0;
  53. // Flush out all effects fbrom the list
  54. virtual void Flush( void ) = 0;
  55. };
  56. extern IEffectsList *clienteffects;
  57. class IMaterialSystem;
  58. extern IMaterialSystem *materials;
  59. //Actual function references
  60. void FX_AddCube( const Vector &mins, const Vector &maxs, const Vector &vColor, float life, const char *materialName );
  61. void FX_AddCenteredCube( const Vector &center, float size, const Vector &vColor, float life, const char *materialName );
  62. void FX_AddStaticLine( const Vector& start, const Vector& end, float scale, float life, const char *materialName, unsigned char flags );
  63. void FX_AddDiscreetLine( const Vector& start, const Vector& direction, float velocity, float length, float clipLength, float scale, float life, const char *shader );
  64. void FX_AddLine( const FXLineData_t &data );
  65. void FX_AddQuad( const FXQuadData_t &data );
  66. void FX_AddQuad( const Vector &origin,
  67. const Vector &normal,
  68. float startSize,
  69. float endSize,
  70. float sizeBias,
  71. float startAlpha,
  72. float endAlpha,
  73. float alphaBias,
  74. float yaw,
  75. float deltaYaw,
  76. const Vector &color,
  77. float lifeTime,
  78. const char *shader,
  79. unsigned int flags );
  80. // For safe addition of client effects
  81. void SetFXCreationAllowed( bool state );
  82. bool FXCreationAllowed( void );
  83. #endif // CLIENTSIDEEFFECTS_H