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.

76 lines
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #include "render_pch.h"
  9. #include "draw.h"
  10. #include "decal.h"
  11. #include "gl_cvars.h"
  12. #include "view.h"
  13. #include "screen.h"
  14. #include "gl_matsysiface.h"
  15. #include "cdll_int.h"
  16. #include "materialsystem/imesh.h"
  17. #include "materialsystem/imaterial.h"
  18. // memdbgon must be the last include file in a .cpp file!!!
  19. #include "tier0/memdbgon.h"
  20. Vector g_CurrentViewOrigin(0, 0, 0), g_CurrentViewForward(1, 0, 0), g_CurrentViewRight(0, -1, 0), g_CurrentViewUp(0, 0, 1);
  21. Vector g_MainViewOrigin(0, 0, 0), g_MainViewForward(1, 0, 0), g_MainViewRight(0, -1, 0), g_MainViewUp(0, 0, 1);
  22. //-----------------------------------------------------------------------------
  23. // Purpose:
  24. // Input : *pMaterial -
  25. //-----------------------------------------------------------------------------
  26. void GL_UnloadMaterial( IMaterial *pMaterial )
  27. {
  28. if ( pMaterial )
  29. {
  30. pMaterial->DecrementReferenceCount();
  31. }
  32. }
  33. //-----------------------------------------------------------------------------
  34. // Purpose:
  35. // Input : *pName -
  36. // Output : IMaterial
  37. //-----------------------------------------------------------------------------
  38. static IMaterial *GL_LoadMaterialNoRef( const char *pName, const char *pTextureGroupName )
  39. {
  40. IMaterial *material = NULL;
  41. if( mat_loadtextures.GetInt() )
  42. {
  43. material = materials->FindMaterial( pName, pTextureGroupName );
  44. }
  45. else
  46. {
  47. material = g_materialEmpty;
  48. }
  49. return material;
  50. }
  51. //-----------------------------------------------------------------------------
  52. // Purpose:
  53. // Input : *pName -
  54. // Output : IMaterial
  55. //-----------------------------------------------------------------------------
  56. IMaterial *GL_LoadMaterial( const char *pName, const char *pTextureGroupName )
  57. {
  58. IMaterial *material;
  59. material = GL_LoadMaterialNoRef( pName, pTextureGroupName );
  60. if( material )
  61. {
  62. material->IncrementReferenceCount();
  63. }
  64. return material;
  65. }