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.

84 lines
2.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: A panel that display particle systems
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef TF_PARTICLEPANEL_H
  8. #define TF_PARTICLEPANEL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "tier2/camerautils.h"
  13. class CTFParticlePanel : public vgui::EditablePanel
  14. {
  15. DECLARE_CLASS_SIMPLE( CTFParticlePanel, vgui::EditablePanel );
  16. public:
  17. // constructor, destructor
  18. CTFParticlePanel( vgui::Panel *pParent, const char *pName );
  19. virtual ~CTFParticlePanel();
  20. virtual void OnTick();
  21. virtual void ApplySettings( KeyValues *inResourceData );
  22. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  23. virtual void OnCommand( const char *command ) OVERRIDE;
  24. void FireParticleEffect( const char *pszName, int xPos, int yPos, float flScale, bool bLoop, float flEndTime = FLT_MAX );
  25. private:
  26. // paint it!
  27. virtual void Paint() OVERRIDE;
  28. private:
  29. // Class to contain all of the per-instance particle system data
  30. struct ParticleEffect_t
  31. {
  32. ParticleEffect_t();
  33. // Shutdown, startup particle collection
  34. void StartupParticleCollection();
  35. void ShutdownParticleCollection();
  36. // Accessor for control point values
  37. const Vector& GetControlPointValue( int nControlPoint ) const { return m_pControlPointValue[ nControlPoint ]; };
  38. void SetControlPointValue( int nControlPoint, const Vector &value ) { m_pControlPointValue[ nControlPoint ] = value; }
  39. // Set the particle system to draw
  40. void SetParticleSystem( const char* pszParticleSystemName );
  41. bool Update( float flTime );
  42. void Paint( CMatRenderContextPtr& pRenderContext, int iXOffset, int iYOffset, float flXScale, float flYScale, int screenW, int screenH );
  43. Vector m_pControlPointValue[MAX_PARTICLE_CONTROL_POINTS];
  44. CParticleCollection *m_pParticleSystem;
  45. CUtlString m_ParticleSystemName;
  46. float m_flLastTime;
  47. float m_flScale;
  48. float m_flEndTime;
  49. int m_nXPos;
  50. int m_nYPos;
  51. QAngle m_Angles;
  52. bool m_bStartActivated; // Start the effect immediately?
  53. bool m_bLoop; // Loop the effect?
  54. bool m_bForceStopped;
  55. bool m_bAutoDelete;
  56. bool m_bStarted;
  57. Panel* m_pParent;
  58. };
  59. CUtlVector< ParticleEffect_t* > m_vecParticleEffects;
  60. // A texture to use for a lightmap
  61. CTextureReference m_pLightmapTexture;
  62. // The default env_cubemap
  63. CTextureReference m_DefaultEnvCubemap;
  64. Camera_t m_Camera;
  65. };
  66. #endif // TF_PARTICLEPANEL_H