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 /game/client/functionproxy.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/client/functionproxy.h')
| -rw-r--r-- | game/client/functionproxy.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/game/client/functionproxy.h b/game/client/functionproxy.h new file mode 100644 index 0000000..22bb818 --- /dev/null +++ b/game/client/functionproxy.h @@ -0,0 +1,74 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: These are a couple of base proxy classes to help us with +// getting/setting source/result material vars +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef FUNCTIONPROXY_H +#define FUNCTIONPROXY_H + +#include "materialsystem/imaterialproxy.h" +#include "materialsystem/imaterialvar.h" + +class IMaterialVar; +class C_BaseEntity; + + +//----------------------------------------------------------------------------- +// Helper class to deal with floating point inputs +//----------------------------------------------------------------------------- +class CFloatInput +{ +public: + bool Init( IMaterial *pMaterial, KeyValues *pKeyValues, const char *pKeyName, float flDefault = 0.0f ); + float GetFloat() const; + +private: + float m_flValue; + IMaterialVar *m_pFloatVar; + int m_FloatVecComp; +}; + + +//----------------------------------------------------------------------------- +// Result proxy; a result (with vector friendliness) +//----------------------------------------------------------------------------- +class CResultProxy : public IMaterialProxy +{ +public: + CResultProxy(); + virtual ~CResultProxy(); + virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues ); + virtual void Release( void ) { delete this; } + virtual IMaterial *GetMaterial(); + +protected: + C_BaseEntity *BindArgToEntity( void *pArg ); + void SetFloatResult( float result ); + + IMaterialVar* m_pResult; + int m_ResultVecComp; +}; + + +//----------------------------------------------------------------------------- +// Base functional proxy; two sources (one is optional) and a result +//----------------------------------------------------------------------------- +class CFunctionProxy : public CResultProxy +{ +public: + CFunctionProxy(); + virtual ~CFunctionProxy(); + virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues ); + +protected: + void ComputeResultType( MaterialVarType_t& resultType, int& vecSize ); + + IMaterialVar* m_pSrc1; + IMaterialVar* m_pSrc2; +}; + +#endif // FUNCTIONPROXY_H + |