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.

60 lines
1.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "cbase.h"
  8. #include "materialsystem/imaterialproxy.h"
  9. #include "materialsystem/imaterial.h"
  10. #include "materialsystem/imaterialvar.h"
  11. // $monitorTextureVar
  12. class CMonitorMaterialProxy : public IMaterialProxy
  13. {
  14. public:
  15. CMonitorMaterialProxy();
  16. virtual ~CMonitorMaterialProxy();
  17. virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
  18. virtual void OnBind( void *pC_BaseEntity );
  19. virtual void Release( void ) { delete this; }
  20. private:
  21. IMaterialVar *m_pMonitorTextureVar;
  22. };
  23. CMonitorMaterialProxy::CMonitorMaterialProxy()
  24. {
  25. m_pMonitorTextureVar = NULL;
  26. }
  27. CMonitorMaterialProxy::~CMonitorMaterialProxy()
  28. {
  29. m_pMonitorTextureVar = NULL;
  30. }
  31. bool CMonitorMaterialProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
  32. {
  33. char const* pMonitorTextureVarName = pKeyValues->getString( "$monitorTextureVar" );
  34. if( !pMonitorTextureVarName )
  35. return false;
  36. bool foundVar;
  37. m_pMonitorTextureVar = pMaterial->FindVar( pMonitorTextureVarName, &foundVar, false );
  38. if( !foundVar )
  39. {
  40. m_pMonitorTextureVar = NULL;
  41. return false;
  42. }
  43. return true;
  44. }
  45. void CMonitorMaterialProxy::OnBind( void *pC_BaseEntity )
  46. {
  47. if( !m_pMonitorTextureVar )
  48. {
  49. return;
  50. }
  51. }
  52. EXPOSE_INTERFACE( CMonitorMaterialProxy, IMaterialProxy, "Monitor" IMATERIAL_PROXY_INTERFACE_VERSION );