summaryrefslogtreecommitdiff
path: root/game/client/tf/tf_proxyentity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'game/client/tf/tf_proxyentity.cpp')
-rw-r--r--game/client/tf/tf_proxyentity.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/game/client/tf/tf_proxyentity.cpp b/game/client/tf/tf_proxyentity.cpp
new file mode 100644
index 0000000..cd7b86b
--- /dev/null
+++ b/game/client/tf/tf_proxyentity.cpp
@@ -0,0 +1,45 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: A base class for all material proxies in the tf client dll
+//
+// $NoKeywords: $
+//=============================================================================//
+#include "cbase.h"
+#include "tf_proxyentity.h"
+#include "materialsystem/imaterialvar.h"
+
+
+CBaseInvisMaterialProxy::CBaseInvisMaterialProxy()
+{
+ m_pPercentInvisible = NULL;
+}
+
+
+bool CBaseInvisMaterialProxy::Init( IMaterial *pMaterial, KeyValues* pKeyValues )
+{
+ bool bFound;
+ m_pPercentInvisible = pMaterial->FindVar( "$cloakfactor", &bFound );
+
+ return bFound;
+}
+
+void CBaseInvisMaterialProxy::Release()
+{
+ delete this;
+}
+
+IMaterial *CBaseInvisMaterialProxy::GetMaterial()
+{
+ if ( !m_pPercentInvisible )
+ return NULL;
+
+ return m_pPercentInvisible->GetOwningMaterial();
+}
+
+void CBaseInvisMaterialProxy::OnBindNotEntity( void *pRenderable )
+{
+ if ( m_pPercentInvisible )
+ {
+ m_pPercentInvisible->SetFloatValue( 0.0f );
+ }
+}