Counter Strike : Global Offensive Source Code
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.

65 lines
1.5 KiB

  1. //========= Copyright � 1996-2005, 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. // NOTE: This has to be the last file included!
  12. #include "tier0/memdbgon.h"
  13. // $monitorTextureVar
  14. class CMonitorMaterialProxy : public IMaterialProxy
  15. {
  16. public:
  17. CMonitorMaterialProxy();
  18. virtual ~CMonitorMaterialProxy();
  19. virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
  20. virtual void OnBind( void *pC_BaseEntity );
  21. virtual void Release( void ) { delete this; }
  22. private:
  23. IMaterialVar *m_pMonitorTextureVar;
  24. };
  25. CMonitorMaterialProxy::CMonitorMaterialProxy()
  26. {
  27. m_pMonitorTextureVar = NULL;
  28. }
  29. CMonitorMaterialProxy::~CMonitorMaterialProxy()
  30. {
  31. m_pMonitorTextureVar = NULL;
  32. }
  33. bool CMonitorMaterialProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
  34. {
  35. char const* pMonitorTextureVarName = pKeyValues->getString( "$monitorTextureVar" );
  36. if( !pMonitorTextureVarName )
  37. return false;
  38. bool foundVar;
  39. m_pMonitorTextureVar = pMaterial->FindVar( pMonitorTextureVarName, &foundVar, false );
  40. if( !foundVar )
  41. {
  42. m_pMonitorTextureVar = NULL;
  43. return false;
  44. }
  45. return true;
  46. }
  47. void CMonitorMaterialProxy::OnBind( void *pC_BaseEntity )
  48. {
  49. if( !m_pMonitorTextureVar )
  50. {
  51. return;
  52. }
  53. }
  54. EXPOSE_MATERIAL_PROXY( CMonitorMaterialProxy, Monitor );