diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /public/dme_controls/particlesystempanel.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'public/dme_controls/particlesystempanel.h')
| -rw-r--r-- | public/dme_controls/particlesystempanel.h | 174 |
1 files changed, 174 insertions, 0 deletions
diff --git a/public/dme_controls/particlesystempanel.h b/public/dme_controls/particlesystempanel.h new file mode 100644 index 0000000..7401dab --- /dev/null +++ b/public/dme_controls/particlesystempanel.h @@ -0,0 +1,174 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//===========================================================================// + +#ifndef DMEPARTICLEPANEL_H +#define DMEPARTICLEPANEL_H + +#ifdef _WIN32 +#pragma once +#endif + +#include "matsys_controls/PotteryWheelPanel.h" +#include "datamodel/dmattributetypes.h" +#include "particles/particles.h" + + +//----------------------------------------------------------------------------- +// Forward declarations +//----------------------------------------------------------------------------- +class IMaterial; +class CMeshBuilder; +class Vector; +class CParticleCollection; +class CColorPickerButton; +class CDmeParticleSystemDefinition; +class CDmeParticleFunction; +class CControlPointPage; + +namespace vgui +{ + class ScrollBar; + class IScheme; + class PropertyPage; + class PropertySheet; + class Splitter; + class Label; + class TextEntry; +} + + +//----------------------------------------------------------------------------- +// Particle System Viewer Panel +//----------------------------------------------------------------------------- +class CParticleSystemPanel : public CPotteryWheelPanel +{ + DECLARE_CLASS_SIMPLE( CParticleSystemPanel, CPotteryWheelPanel ); + +public: + // constructor, destructor + CParticleSystemPanel( vgui::Panel *pParent, const char *pName ); + virtual ~CParticleSystemPanel(); + + // Set the particle system to draw + void SetParticleSystem( CDmeParticleSystemDefinition *pDef ); + void SetDmeElement( CDmeParticleSystemDefinition *pDef ); + + CParticleCollection *GetParticleSystem(); + + // Indicates that bounds should be drawn + void RenderBounds( bool bEnable ); + + // Indicates that cull sphere should be drawn + void RenderCullBounds( bool bEnable ); + + // Indicates that helpers should be drawn + void RenderHelpers( bool bEnable ); + + // Indicates which helper to draw + void SetRenderedHelper( CDmeParticleFunction *pOp ); + + virtual void OnTick(); + virtual void ApplySchemeSettings( vgui::IScheme *pScheme ); + + // Accessor for control point values + const Vector& GetControlPointValue( int nControlPoint ) const; + void SetControlPointValue( int nControlPoint, const Vector &value ); + +private: + // Shutdown, startup particle collection + void StartupParticleCollection(); + void ShutdownParticleCollection(); + + // Draw bounds + void DrawBounds(); + void DrawCullBounds(); + + // paint it! + virtual void OnPaint3D(); + +private: + bool m_bRenderBounds : 1; + bool m_bRenderCullBounds : 1; + bool m_bRenderHelpers : 1; + bool m_bPerformNameBasedLookup : 1; + + Vector m_pControlPointValue[MAX_PARTICLE_CONTROL_POINTS]; + + DmObjectId_t m_RenderHelperId; + float m_flLastTime; + + // Stores the id or name of the particle system being viewed + DmObjectId_t m_ParticleSystemId; + CUtlString m_ParticleSystemName; + + // The particle system to draw + CParticleCollection *m_pParticleSystem; + + // A texture to use for a lightmap + CTextureReference m_pLightmapTexture; + + // The default env_cubemap + CTextureReference m_DefaultEnvCubemap; +}; + + +//----------------------------------------------------------------------------- +// Accessor for control point values +//----------------------------------------------------------------------------- +inline const Vector& CParticleSystemPanel::GetControlPointValue( int nControlPoint ) const +{ + return m_pControlPointValue[nControlPoint]; +} + +inline void CParticleSystemPanel::SetControlPointValue( int nControlPoint, const Vector &value ) +{ + m_pControlPointValue[nControlPoint] = value; +} + + +//----------------------------------------------------------------------------- +// This panel has a particle system viewer as well as controls +//----------------------------------------------------------------------------- +class CParticleSystemPreviewPanel : public vgui::EditablePanel +{ + DECLARE_CLASS_SIMPLE( CParticleSystemPreviewPanel, vgui::EditablePanel ); + +public: + // constructor, destructor + CParticleSystemPreviewPanel( vgui::Panel *pParent, const char *pName ); + virtual ~CParticleSystemPreviewPanel(); + + // Set the material to draw + void SetParticleSystem( CDmeParticleSystemDefinition *pDef ); + void SetParticleFunction( CDmeParticleFunction *pFunction ); + void SetDmeElement( CDmeParticleSystemDefinition *pDef ); + virtual void OnThink(); + +private: + MESSAGE_FUNC_PARAMS( OnCheckButtonChecked, "CheckButtonChecked", params ); + MESSAGE_FUNC_PARAMS( OnBackgroundColorChanged, "ColorPickerPicked", params ); + MESSAGE_FUNC_PARAMS( OnBackgroundColorPreview, "ColorPickerPreview", params ); + MESSAGE_FUNC_PARAMS( OnBackgroundColorCancel, "ColorPickerCancel", params ); + MESSAGE_FUNC( OnParticleSystemReconstructed, "ParticleSystemReconstructed" ); + + vgui::Splitter *m_Splitter; + CParticleSystemPanel *m_pParticleSystemPanel; + vgui::PropertySheet *m_pControlSheet; + vgui::PropertyPage *m_pRenderPage; + CControlPointPage *m_pControlPointPage; + + vgui::CheckButton *m_pRenderCullBounds; + vgui::CheckButton *m_pRenderBounds; + vgui::CheckButton *m_pRenderHelpers; + CColorPickerButton *m_pBackgroundColor; + vgui::Label *m_pParticleCount; +}; + + + +#endif // DMEPARTICLEPANEL_H +
\ No newline at end of file |