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.

82 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "fx_envelope.h"
  8. // memdbgon must be the last include file in a .cpp file!!!
  9. #include "tier0/memdbgon.h"
  10. //-----------------------------------------------------------------------------
  11. // Constructor
  12. //-----------------------------------------------------------------------------
  13. C_EnvelopeFX::C_EnvelopeFX( void )
  14. {
  15. m_active = false;
  16. }
  17. C_EnvelopeFX::~C_EnvelopeFX()
  18. {
  19. RemoveRenderable();
  20. }
  21. const matrix3x4_t & C_EnvelopeFX::RenderableToWorldTransform()
  22. {
  23. static matrix3x4_t mat;
  24. SetIdentityMatrix( mat );
  25. PositionMatrix( GetRenderOrigin(), mat );
  26. return mat;
  27. }
  28. void C_EnvelopeFX::RemoveRenderable()
  29. {
  30. ClientLeafSystem()->RemoveRenderable( m_hRenderHandle );
  31. }
  32. //-----------------------------------------------------------------------------
  33. // Purpose: Updates the envelope being in the client's known entity list
  34. //-----------------------------------------------------------------------------
  35. void C_EnvelopeFX::Update( void )
  36. {
  37. if ( m_active )
  38. {
  39. if ( m_hRenderHandle == INVALID_CLIENT_RENDER_HANDLE )
  40. {
  41. ClientLeafSystem()->AddRenderable( this, RENDER_GROUP_TRANSLUCENT_ENTITY );
  42. }
  43. else
  44. {
  45. ClientLeafSystem()->RenderableChanged( m_hRenderHandle );
  46. }
  47. }
  48. else
  49. {
  50. RemoveRenderable();
  51. }
  52. }
  53. //-----------------------------------------------------------------------------
  54. // Purpose: Starts up the effect
  55. // Input : entityIndex - entity to be attached to
  56. // attachment - attachment point (if any) to be attached to
  57. //-----------------------------------------------------------------------------
  58. void C_EnvelopeFX::EffectInit( int entityIndex, int attachment )
  59. {
  60. m_entityIndex = entityIndex;
  61. m_attachment = attachment;
  62. m_active = 1;
  63. m_t = 0;
  64. }
  65. //-----------------------------------------------------------------------------
  66. // Purpose: Shuts down the effect
  67. //-----------------------------------------------------------------------------
  68. void C_EnvelopeFX::EffectShutdown( void )
  69. {
  70. m_active = 0;
  71. m_t = 0;
  72. }