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.

48 lines
1.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "cbase.h"
  8. #include "proxyentity.h"
  9. #include "iclientrenderable.h"
  10. #include "toolframework_client.h"
  11. // memdbgon must be the last include file in a .cpp file!!!
  12. #include "tier0/memdbgon.h"
  13. //-----------------------------------------------------------------------------
  14. // Cleanup
  15. //-----------------------------------------------------------------------------
  16. void CEntityMaterialProxy::Release( void )
  17. {
  18. delete this;
  19. }
  20. //-----------------------------------------------------------------------------
  21. //
  22. //-----------------------------------------------------------------------------
  23. void CEntityMaterialProxy::OnBind( void *pRenderable )
  24. {
  25. if( !pRenderable )
  26. {
  27. OnBindNotEntity( pRenderable );
  28. return;
  29. }
  30. IClientRenderable *pRend = ( IClientRenderable* )pRenderable;
  31. C_BaseEntity *pEnt = pRend->GetIClientUnknown()->GetBaseEntity();
  32. if ( pEnt )
  33. {
  34. OnBind( pEnt );
  35. if ( ToolsEnabled() )
  36. {
  37. ToolFramework_RecordMaterialParams( GetMaterial() );
  38. }
  39. }
  40. else
  41. {
  42. OnBindNotEntity( pRenderable );
  43. }
  44. }