summaryrefslogtreecommitdiff
path: root/game/client/tf/tf_proxyentity.cpp
blob: cd7b86be41220a322f41253b7fc6435cc9f6cf98 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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 );
	}
}