Modified source engine (2017) developed by valve and leaked in 2020. Not for commercial purporses
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

45 lines
978 B

//========= 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 );
}
}