diff options
| author | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
| commit | 39ed87570bdb2f86969d4be821c94b722dc71179 (patch) | |
| tree | abc53757f75f40c80278e87650ea92808274aa59 /mp/src/game/client/functionproxy.h | |
| download | source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip | |
First version of the SOurce SDK 2013
Diffstat (limited to 'mp/src/game/client/functionproxy.h')
| -rw-r--r-- | mp/src/game/client/functionproxy.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/mp/src/game/client/functionproxy.h b/mp/src/game/client/functionproxy.h new file mode 100644 index 00000000..ff86f959 --- /dev/null +++ b/mp/src/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
+
|