mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-09-20 04:26:03 +08:00
Added original SDK code for Alien Swarm.
This commit is contained in:
75
game/client/functionproxy.h
Normal file
75
game/client/functionproxy.h
Normal file
@ -0,0 +1,75 @@
|
||||
//========= Copyright 1996-2005, 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 );
|
||||
void SetVecResult( float x, float y, float z, float w );
|
||||
|
||||
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
|
||||
|
Reference in New Issue
Block a user