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.

63 lines
1.5 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include "materialsystem/imaterialproxy.h"
  10. #include "materialproxyfactory.h"
  11. #include "toolframework/itoolframework.h"
  12. #include "toolframework/itoolsystem.h"
  13. #include "server.h"
  14. #include "cdll_int.h"
  15. // memdbgon must be the last include file in a .cpp file!!!
  16. #include "tier0/memdbgon.h"
  17. extern IBaseClientDLL *g_ClientDLL;
  18. #ifndef DEDICATED
  19. extern CSysModule *g_ClientDLLModule;
  20. #endif
  21. IMaterialProxy *CMaterialProxyFactory::CreateProxy( const char *proxyName )
  22. {
  23. #if !defined(DEDICATED)
  24. IMaterialProxy *materialProxy = g_ClientDLL->InstantiateMaterialProxy( proxyName );
  25. // If the client didn't have it and we're in tool mode, ask the tools...
  26. if ( toolframework->InToolMode() && !materialProxy )
  27. {
  28. materialProxy = toolframework->LookupProxy( proxyName );
  29. }
  30. if( !materialProxy && !sv.IsDedicated() )
  31. {
  32. ConDMsg( "Can't find material proxy \"%s\"\n", proxyName );
  33. return NULL;
  34. }
  35. return materialProxy;
  36. #else
  37. return NULL;
  38. #endif
  39. }
  40. void CMaterialProxyFactory::DeleteProxy( IMaterialProxy *pProxy )
  41. {
  42. // how do you delete something generated by an interface.h factory?
  43. if( pProxy )
  44. {
  45. pProxy->Release();
  46. }
  47. }
  48. CreateInterfaceFn CMaterialProxyFactory::GetFactory()
  49. {
  50. #ifndef DEDICATED
  51. return Sys_GetFactory( g_ClientDLLModule );
  52. #else
  53. return NULL;
  54. #endif
  55. }