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.

219 lines
6.2 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #ifndef DMEPARTICLEPANEL_H
  8. #define DMEPARTICLEPANEL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "matsys_controls/potterywheelpanel.h"
  13. #include "datamodel/dmattributetypes.h"
  14. #include "particles/particles.h"
  15. //-----------------------------------------------------------------------------
  16. // Forward declarations
  17. //-----------------------------------------------------------------------------
  18. class IMaterial;
  19. class CMeshBuilder;
  20. class Vector;
  21. class CParticleCollection;
  22. class CColorPickerButton;
  23. class CDmeParticleSystemDefinition;
  24. class CDmeParticleFunction;
  25. class CControlPointPage;
  26. namespace vgui
  27. {
  28. class ScrollBar;
  29. class IScheme;
  30. class PropertyPage;
  31. class PropertySheet;
  32. class Splitter;
  33. class Label;
  34. class TextEntry;
  35. }
  36. //-----------------------------------------------------------------------------
  37. // Particle System Viewer Panel
  38. //-----------------------------------------------------------------------------
  39. class CParticleSystemPanel : public CPotteryWheelPanel
  40. {
  41. DECLARE_CLASS_SIMPLE( CParticleSystemPanel, CPotteryWheelPanel );
  42. public:
  43. // constructor, destructor
  44. CParticleSystemPanel( vgui::Panel *pParent, const char *pName );
  45. virtual ~CParticleSystemPanel();
  46. // Set the particle system to draw
  47. void SetParticleSystem( CDmeParticleSystemDefinition *pDef );
  48. void SetDmeElement( CDmeParticleSystemDefinition *pDef );
  49. void SetParticleSystem( const char* szParticleSystemName );
  50. CParticleCollection *GetParticleSystem();
  51. //Indicates that the grid should be drawn
  52. void RenderGrid( bool bEnable );
  53. // Indicates that bounds should be drawn
  54. void RenderBounds( bool bEnable );
  55. // Indicates that cull sphere should be drawn
  56. void RenderCullBounds( bool bEnable );
  57. // Indicates that helpers should be drawn
  58. void RenderHelpers( bool bEnable );
  59. // Indicates that control points should be drawn
  60. void RenderControlPoints( bool bEnable );
  61. // Stops effect and plays endcap effect
  62. void StopEffect();
  63. // Indicates which helper to draw
  64. void SetRenderedHelper( CDmeParticleFunction *pOp );
  65. virtual void OnTick();
  66. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  67. // Accessor for control point values
  68. const Vector& GetControlPointValue( int nControlPoint ) const;
  69. void SetControlPointValue( int nControlPoint, const Vector &value );
  70. // Allow a parent panel to drive the ticking for this panel
  71. void SetSelfSimulation(bool bSelfSimulate );
  72. void Simulate();
  73. virtual void ResetView();
  74. // tells the panel to automatically find a good view of the particle system
  75. void EnableAutoViewing( bool bEnable );
  76. protected:
  77. virtual void EnterManipulationMode( ManipulationMode_t manipMode, bool bMouseCapture, vgui::MouseCode mouseCode );
  78. private:
  79. // Shutdown, startup particle collection
  80. void StartupParticleCollection();
  81. void ShutdownParticleCollection();
  82. // Draw bounds
  83. void DrawBounds();
  84. void DrawCullBounds();
  85. void UseAutoView();
  86. // paint it!
  87. virtual void OnPaint3D();
  88. private:
  89. bool m_bRenderGrid : 1;
  90. bool m_bRenderBounds : 1;
  91. bool m_bRenderCullBounds : 1;
  92. bool m_bRenderHelpers : 1;
  93. bool m_bPerformNameBasedLookup : 1;
  94. bool m_bRenderControlPoints : 1;
  95. bool m_bTickMyself : 1;
  96. bool m_bAutoView : 1;
  97. bool m_bSuppressAutoView : 1;
  98. Vector m_pControlPointValue[MAX_PARTICLE_CONTROL_POINTS];
  99. Vector m_BestViewBoundsMin, m_BestViewBoundsMax;
  100. DmObjectId_t m_RenderHelperId;
  101. float m_flLastTime;
  102. // Stores the id or name of the particle system being viewed
  103. DmObjectId_t m_ParticleSystemId;
  104. CUtlString m_ParticleSystemName;
  105. // The particle system to draw
  106. CParticleCollection *m_pParticleSystem;
  107. // A texture to use for a lightmap
  108. CTextureReference m_pLightmapTexture;
  109. // The default env_cubemap
  110. CTextureReference m_DefaultEnvCubemap;
  111. };
  112. //-----------------------------------------------------------------------------
  113. // Accessor for control point values
  114. //-----------------------------------------------------------------------------
  115. inline const Vector& CParticleSystemPanel::GetControlPointValue( int nControlPoint ) const
  116. {
  117. return m_pControlPointValue[nControlPoint];
  118. }
  119. inline void CParticleSystemPanel::SetControlPointValue( int nControlPoint, const Vector &value )
  120. {
  121. m_pControlPointValue[nControlPoint] = value;
  122. }
  123. //-----------------------------------------------------------------------------
  124. // This panel has a particle system viewer as well as controls
  125. //-----------------------------------------------------------------------------
  126. class CParticleSystemPreviewPanel : public vgui::EditablePanel
  127. {
  128. DECLARE_CLASS_SIMPLE( CParticleSystemPreviewPanel, vgui::EditablePanel );
  129. public:
  130. // constructor, destructor
  131. CParticleSystemPreviewPanel( vgui::Panel *pParent, const char *pName );
  132. virtual ~CParticleSystemPreviewPanel();
  133. // Set the material to draw
  134. void SetParticleSystem( CDmeParticleSystemDefinition *pDef, bool bOverrideLock );
  135. void SetParticleFunction( CDmeParticleFunction *pFunction );
  136. void SetDmeElement( CDmeParticleSystemDefinition *pDef );
  137. virtual void OnCommand( const char *pCommand );
  138. void StopEffect();
  139. virtual void OnThink();
  140. void ClearParticleSystemLock();
  141. private:
  142. MESSAGE_FUNC_PARAMS( OnCheckButtonChecked, "CheckButtonChecked", params );
  143. MESSAGE_FUNC_PARAMS( OnBackgroundColorChanged, "ColorPickerPicked", params );
  144. MESSAGE_FUNC_PARAMS( OnBackgroundColorPreview, "ColorPickerPreview", params );
  145. MESSAGE_FUNC_PARAMS( OnBackgroundColorCancel, "ColorPickerCancel", params );
  146. MESSAGE_FUNC( OnParticleSystemReconstructed, "ParticleSystemReconstructed" );
  147. vgui::Splitter *m_Splitter;
  148. CParticleSystemPanel *m_pParticleSystemPanel;
  149. vgui::PropertySheet *m_pControlSheet;
  150. vgui::PropertyPage *m_pRenderPage;
  151. CControlPointPage *m_pControlPointPage;
  152. vgui::CheckButton *m_pRenderCullBounds;
  153. vgui::CheckButton *m_pRenderBounds;
  154. vgui::CheckButton *m_pRenderControlPoints;
  155. vgui::CheckButton *m_pRenderHelpers;
  156. vgui::CheckButton *m_pRenderGrid;
  157. vgui::CheckButton *m_pLockPreview;
  158. CColorPickerButton *m_pBackgroundColor;
  159. vgui::Button *m_pStopEffect;
  160. vgui::Label *m_pParticleCount;
  161. CDmeParticleSystemDefinition* m_pUnlockSystem;
  162. };
  163. #endif // DMEPARTICLEPANEL_H