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.

99 lines
2.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. // This defines the client-side SmokeTrail entity. It can also be used without
  9. // an entity, in which case you must pass calls to it and set its position each frame.
  10. #ifndef PARTICLE_SMOKETRAIL_H
  11. #define PARTICLE_SMOKETRAIL_H
  12. #include "particlemgr.h"
  13. #include "particle_prototype.h"
  14. #include "particle_util.h"
  15. #include "particles_simple.h"
  16. #include "c_baseentity.h"
  17. #include "baseparticleentity.h"
  18. #include "fx_trail.h"
  19. //
  20. // Smoke Trail
  21. //
  22. class C_GrenadeTrail : public C_BaseParticleEntity, public IPrototypeAppEffect
  23. {
  24. public:
  25. DECLARE_CLASS( C_GrenadeTrail, C_BaseParticleEntity );
  26. DECLARE_CLIENTCLASS();
  27. C_GrenadeTrail();
  28. virtual ~C_GrenadeTrail();
  29. public:
  30. //For attachments
  31. void GetAimEntOrigin( IClientEntity *pAttachedTo, Vector *pAbsOrigin, QAngle *pAbsAngles );
  32. // Enable/disable emission.
  33. void SetEmit(bool bEmit);
  34. // Change the spawn rate.
  35. void SetSpawnRate(float rate);
  36. // C_BaseEntity.
  37. public:
  38. virtual void OnDataChanged(DataUpdateType_t updateType);
  39. // IPrototypeAppEffect.
  40. public:
  41. virtual void Start(CParticleMgr *pParticleMgr, IPrototypeArgAccess *pArgs);
  42. // IParticleEffect.
  43. public:
  44. virtual void Update(float fTimeDelta);
  45. virtual void RenderParticles( CParticleRenderIterator *pIterator );
  46. virtual void SimulateParticles( CParticleSimulateIterator *pIterator );
  47. public:
  48. // Effect parameters. These will assume default values but you can change them.
  49. float m_SpawnRate; // How many particles per second.
  50. Vector m_StartColor; // Fade between these colors.
  51. Vector m_EndColor;
  52. float m_Opacity;
  53. float m_ParticleLifetime; // How long do the particles live?
  54. float m_StopEmitTime; // When do I stop emitting particles? (-1 = never)
  55. float m_MinSpeed; // Speed range.
  56. float m_MaxSpeed;
  57. float m_MinDirectedSpeed; // Directed speed range.
  58. float m_MaxDirectedSpeed;
  59. float m_StartSize; // Size ramp.
  60. float m_EndSize;
  61. float m_SpawnRadius;
  62. Vector m_VelocityOffset; // Emit the particles in a certain direction.
  63. bool m_bEmit; // Keep emitting particles?
  64. int m_nAttachment;
  65. private:
  66. PMaterialHandle m_MaterialHandle[2];
  67. TimedEvent m_ParticleSpawn;
  68. CParticleMgr *m_pParticleMgr;
  69. CSmartPtr<CSimpleEmitter> m_pSmokeEmitter;
  70. C_GrenadeTrail( const C_GrenadeTrail & );
  71. };
  72. #endif //PARTICLE_SMOKETRAIL_H