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.

110 lines
3.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Header: $
  6. // $NoKeywords: $
  7. //
  8. //=============================================================================//
  9. #ifndef MATERIALSYSTEM_GLOBAL_H
  10. #define MATERIALSYSTEM_GLOBAL_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. #include "imaterialsysteminternal.h"
  15. #include "tier0/dbg.h"
  16. #include "tier2/tier2.h"
  17. //-----------------------------------------------------------------------------
  18. // Forward declarations
  19. //-----------------------------------------------------------------------------
  20. class ITextureInternal;
  21. class IShaderAPI;
  22. class IHardwareConfigInternal;
  23. class IShaderUtil;
  24. class IShaderShadow;
  25. class IShaderDeviceMgr;
  26. class IShaderDevice;
  27. class IShaderSystemInternal;
  28. class IMaterialInternal;
  29. class IColorCorrectionSystem;
  30. class IMaterialVar;
  31. //-----------------------------------------------------------------------------
  32. // Constants used by the system
  33. //-----------------------------------------------------------------------------
  34. #define MATERIAL_MAX_PATH 256
  35. // GR - limits for blured image (HDR stuff)
  36. #define MAX_BLUR_IMAGE_WIDTH 256
  37. #define MAX_BLUR_IMAGE_HEIGHT 192
  38. #define CLAMP_BLUR_IMAGE_WIDTH( _w ) ( ( _w < MAX_BLUR_IMAGE_WIDTH ) ? _w : MAX_BLUR_IMAGE_WIDTH )
  39. #define CLAMP_BLUR_IMAGE_HEIGHT( _h ) ( ( _h < MAX_BLUR_IMAGE_HEIGHT ) ? _h : MAX_BLUR_IMAGE_HEIGHT )
  40. //-----------------------------------------------------------------------------
  41. // Global structures
  42. //-----------------------------------------------------------------------------
  43. extern MaterialSystem_Config_t g_config;
  44. extern uint32 g_nDebugVarsSignature;
  45. //extern MaterialSystem_ErrorFunc_t Error;
  46. //extern MaterialSystem_WarningFunc_t Warning;
  47. extern int g_FrameNum;
  48. extern IShaderAPI* g_pShaderAPI;
  49. extern IShaderDeviceMgr* g_pShaderDeviceMgr;
  50. extern IShaderDevice* g_pShaderDevice;
  51. extern IShaderShadow* g_pShaderShadow;
  52. extern IMaterialInternal *g_pErrorMaterial;
  53. IShaderSystemInternal* ShaderSystem();
  54. inline IShaderSystemInternal* ShaderSystem()
  55. {
  56. extern IShaderSystemInternal *g_pShaderSystem;
  57. return g_pShaderSystem;
  58. }
  59. inline IHardwareConfigInternal *HardwareConfig()
  60. {
  61. extern IHardwareConfigInternal* g_pHWConfig;
  62. return g_pHWConfig;
  63. }
  64. //-----------------------------------------------------------------------------
  65. // Accessor to get at the material system
  66. //-----------------------------------------------------------------------------
  67. inline IMaterialSystemInternal* MaterialSystem()
  68. {
  69. extern IMaterialSystemInternal *g_pInternalMaterialSystem;
  70. return g_pInternalMaterialSystem;
  71. }
  72. inline IShaderUtil* ShaderUtil()
  73. {
  74. extern IShaderUtil *g_pShaderUtil;
  75. return g_pShaderUtil;
  76. }
  77. extern IColorCorrectionSystem *g_pColorCorrectionSystem;
  78. inline IColorCorrectionSystem *ColorCorrectionSystem()
  79. {
  80. return g_pColorCorrectionSystem;
  81. }
  82. //-----------------------------------------------------------------------------
  83. // Global methods related to material vars
  84. //-----------------------------------------------------------------------------
  85. void EnableThreadedMaterialVarAccess( bool bEnable, IMaterialVar **ppParams, int nVarCount );
  86. #endif // MATERIALSYSTEM_GLOBAL_H