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.

101 lines
2.6 KiB

  1. //========= Copyright � 1996-2005, 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[ MAX_SPLITSCREEN_CLIENTS ];
  22. Vector g_MainViewForward[ MAX_SPLITSCREEN_CLIENTS ];
  23. Vector g_MainViewRight[ MAX_SPLITSCREEN_CLIENTS ];
  24. Vector g_MainViewUp[ MAX_SPLITSCREEN_CLIENTS ];
  25. class CInitMainView
  26. {
  27. public:
  28. CInitMainView()
  29. {
  30. for ( int i = 0 ; i < MAX_SPLITSCREEN_CLIENTS; ++i )
  31. {
  32. g_MainViewOrigin[ i ] = vec3_origin;
  33. g_MainViewForward[ i ] = Vector( 1, 0, 0 );
  34. g_MainViewRight[ i ] = Vector( 0, -1, 0 );
  35. g_MainViewUp[ i ] = Vector( 0, 0, 1 );
  36. }
  37. }
  38. };
  39. CInitMainView g_InitMainView;
  40. //-----------------------------------------------------------------------------
  41. // Purpose:
  42. // Input : *pMaterial -
  43. //-----------------------------------------------------------------------------
  44. void GL_UnloadMaterial( IMaterial *pMaterial )
  45. {
  46. if ( pMaterial )
  47. {
  48. pMaterial->DecrementReferenceCount();
  49. }
  50. }
  51. //-----------------------------------------------------------------------------
  52. // Purpose:
  53. // Input : *pName -
  54. // Output : IMaterial
  55. //-----------------------------------------------------------------------------
  56. static IMaterial *GL_LoadMaterialNoRef( const char *pName, const char *pTextureGroupName )
  57. {
  58. IMaterial *material = NULL;
  59. if ( mat_loadtextures.GetInt() )
  60. {
  61. material = materials->FindMaterial( pName, pTextureGroupName );
  62. }
  63. else
  64. {
  65. material = g_materialEmpty;
  66. }
  67. return material;
  68. }
  69. //-----------------------------------------------------------------------------
  70. // Purpose:
  71. // Input : *pName -
  72. // Output : IMaterial
  73. //-----------------------------------------------------------------------------
  74. IMaterial *GL_LoadMaterial( const char *pName, const char *pTextureGroupName, bool bPrecache )
  75. {
  76. IMaterial *material;
  77. material = GL_LoadMaterialNoRef( pName, pTextureGroupName );
  78. if ( material )
  79. {
  80. material->IncrementReferenceCount();
  81. if ( bPrecache )
  82. {
  83. // forces the material to finalize its load
  84. material->GetMappingWidth();
  85. }
  86. }
  87. return material;
  88. }