Team Fortress 2 Source Code as on 22/4/2020
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

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: A base class for all material proxies in the tf client dll
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "cbase.h"
  8. #include "tf_proxyentity.h"
  9. #include "materialsystem/imaterialvar.h"
  10. CBaseInvisMaterialProxy::CBaseInvisMaterialProxy()
  11. {
  12. m_pPercentInvisible = NULL;
  13. }
  14. bool CBaseInvisMaterialProxy::Init( IMaterial *pMaterial, KeyValues* pKeyValues )
  15. {
  16. bool bFound;
  17. m_pPercentInvisible = pMaterial->FindVar( "$cloakfactor", &bFound );
  18. return bFound;
  19. }
  20. void CBaseInvisMaterialProxy::Release()
  21. {
  22. delete this;
  23. }
  24. IMaterial *CBaseInvisMaterialProxy::GetMaterial()
  25. {
  26. if ( !m_pPercentInvisible )
  27. return NULL;
  28. return m_pPercentInvisible->GetOwningMaterial();
  29. }
  30. void CBaseInvisMaterialProxy::OnBindNotEntity( void *pRenderable )
  31. {
  32. if ( m_pPercentInvisible )
  33. {
  34. m_pPercentInvisible->SetFloatValue( 0.0f );
  35. }
  36. }