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.

221 lines
7.4 KiB

  1. //===== Copyright (c) 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #ifndef MATERIALSYSTEM_CONFIG_H
  8. #define MATERIALSYSTEM_CONFIG_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #if (!defined(_CERT)) && defined (_X360)
  13. #define X360_ALLOW_TIMESTAMPS 1 // Comment in to enable showfps 12 etc...
  14. #endif
  15. #include "materialsystem/imaterialsystem.h"
  16. #define MATERIALSYSTEM_CONFIG_VERSION "VMaterialSystemConfig004"
  17. enum MaterialSystem_Config_Flags_t
  18. {
  19. MATSYS_VIDCFG_FLAGS_WINDOWED = ( 1 << 0 ),
  20. MATSYS_VIDCFG_FLAGS_RESIZING = ( 1 << 1 ),
  21. MATSYS_VIDCFG_FLAGS_NO_WAIT_FOR_VSYNC = ( 1 << 3 ),
  22. MATSYS_VIDCFG_FLAGS_STENCIL = ( 1 << 4 ),
  23. MATSYS_VIDCFG_FLAGS_DISABLE_SPECULAR = ( 1 << 7 ),
  24. MATSYS_VIDCFG_FLAGS_DISABLE_BUMPMAP = ( 1 << 8 ),
  25. MATSYS_VIDCFG_FLAGS_ENABLE_PARALLAX_MAPPING = ( 1 << 9 ),
  26. MATSYS_VIDCFG_FLAGS_USE_Z_PREFILL = ( 1 << 10 ),
  27. MATSYS_VIDCFG_FLAGS_ENABLE_HDR = ( 1 << 12 ),
  28. MATSYS_VIDCFG_FLAGS_LIMIT_WINDOWED_SIZE = ( 1 << 13 ),
  29. MATSYS_VIDCFG_FLAGS_SCALE_TO_OUTPUT_RESOLUTION = ( 1 << 14 ),
  30. MATSYS_VIDCFG_FLAGS_USING_MULTIPLE_WINDOWS = ( 1 << 15 ),
  31. MATSYS_VIDCFG_FLAGS_DISABLE_PHONG = ( 1 << 16 ),
  32. MATSYS_VIDCFG_FLAGS_NO_WINDOW_BORDER = ( 1 << 17 ),
  33. MATSYS_VIDCFG_FLAGS_DISABLE_DETAIL = ( 1 << 18 ),
  34. MATSYS_VIDCFG_FLAGS_UNSUPPORTED = ( 1 << 19 ),
  35. };
  36. struct MaterialSystemHardwareIdentifier_t
  37. {
  38. char *m_pCardName;
  39. unsigned int m_nVendorID;
  40. unsigned int m_nDeviceID;
  41. };
  42. struct MaterialSystem_Config_t
  43. {
  44. bool Windowed() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_WINDOWED ) != 0; }
  45. bool NoWindowBorder() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_NO_WINDOW_BORDER ) != 0; }
  46. bool Resizing() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_RESIZING ) != 0; }
  47. bool WaitForVSync() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_NO_WAIT_FOR_VSYNC ) == 0; }
  48. bool Stencil() const { return (m_Flags & MATSYS_VIDCFG_FLAGS_STENCIL ) != 0; }
  49. bool UseSpecular() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_DISABLE_SPECULAR ) == 0; }
  50. bool UseBumpmapping() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_DISABLE_BUMPMAP ) == 0; }
  51. bool UseDetailTexturing() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_DISABLE_DETAIL ) == 0; }
  52. bool UseParallaxMapping() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_ENABLE_PARALLAX_MAPPING ) != 0; }
  53. bool UseZPrefill() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_USE_Z_PREFILL ) != 0; }
  54. bool HDREnabled() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_ENABLE_HDR ) != 0; }
  55. bool LimitWindowedSize() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_LIMIT_WINDOWED_SIZE ) != 0; }
  56. bool ScaleToOutputResolution() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_SCALE_TO_OUTPUT_RESOLUTION ) != 0; }
  57. bool UsingMultipleWindows() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_USING_MULTIPLE_WINDOWS ) != 0; }
  58. bool ShadowDepthTexture() const { return m_bShadowDepthTexture; }
  59. bool MotionBlur() const { return m_bMotionBlur; }
  60. bool SupportFlashlight() const { return m_bSupportFlashlight; }
  61. bool UsePhong() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_DISABLE_PHONG ) == 0; }
  62. bool IsUnsupported() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_UNSUPPORTED ) != 0; }
  63. CSMQualityMode_t GetCSMQualityMode() const { return m_nCSMQuality; }
  64. void SetFlag( unsigned int flag, bool val )
  65. {
  66. if( val )
  67. {
  68. m_Flags |= flag;
  69. }
  70. else
  71. {
  72. m_Flags &= ~flag;
  73. }
  74. }
  75. // control panel stuff
  76. MaterialVideoMode_t m_VideoMode;
  77. float m_fMonitorGamma;
  78. float m_fGammaTVRangeMin;
  79. float m_fGammaTVRangeMax;
  80. float m_fGammaTVExponent;
  81. bool m_bGammaTVEnabled;
  82. bool m_bWantTripleBuffered; // We only get triple buffering if fullscreen and vsync'd
  83. int m_nAASamples;
  84. int m_nForceAnisotropicLevel;
  85. int skipMipLevels;
  86. int dxSupportLevel;
  87. unsigned int m_Flags;
  88. bool bEditMode; // true if in Hammer.
  89. unsigned char proxiesTestMode; // 0 = normal, 1 = no proxies, 2 = alpha test all, 3 = color mod all
  90. bool bCompressedTextures;
  91. bool bFilterLightmaps;
  92. bool bFilterTextures;
  93. bool bReverseDepth;
  94. bool bBufferPrimitives;
  95. bool bDrawFlat;
  96. bool bMeasureFillRate;
  97. bool bVisualizeFillRate;
  98. bool bNoTransparency;
  99. bool bSoftwareLighting;
  100. bool bAllowCheats;
  101. char nShowMipLevels;
  102. bool bShowLowResImage;
  103. bool bShowNormalMap;
  104. bool bMipMapTextures;
  105. unsigned char nFullbright;
  106. bool m_bFastNoBump;
  107. bool m_bSuppressRendering;
  108. bool bDrawGray;
  109. // debug modes
  110. bool bShowSpecular; // This is the fast version that doesn't require reloading materials
  111. bool bShowDiffuse; // This is the fast version that doesn't require reloading materials
  112. uint m_WindowedSizeLimitWidth;
  113. uint m_WindowedSizeLimitHeight;
  114. int m_nAAQuality;
  115. bool m_bShadowDepthTexture;
  116. bool m_bMotionBlur;
  117. bool m_bSupportFlashlight;
  118. // PAINT
  119. // True if the current mod supports paint at all (should be always true or always false in a game, and is practically only true in Portal2)
  120. bool m_bPaintInGame;
  121. // True if the current level supports paint (should be only true if m_bPaintInGame is true AND the currently loaded level supports paint)
  122. bool m_bPaintInMap;
  123. CSMQualityMode_t m_nCSMQuality;
  124. bool m_bCSMAccurateBlending;
  125. MaterialSystem_Config_t()
  126. {
  127. memset( this, 0, sizeof( *this ) );
  128. // video config defaults
  129. SetFlag( MATSYS_VIDCFG_FLAGS_WINDOWED, false );
  130. SetFlag( MATSYS_VIDCFG_FLAGS_NO_WINDOW_BORDER, false );
  131. SetFlag( MATSYS_VIDCFG_FLAGS_RESIZING, false );
  132. SetFlag( MATSYS_VIDCFG_FLAGS_NO_WAIT_FOR_VSYNC, true );
  133. SetFlag( MATSYS_VIDCFG_FLAGS_STENCIL, false );
  134. SetFlag( MATSYS_VIDCFG_FLAGS_DISABLE_SPECULAR, false );
  135. SetFlag( MATSYS_VIDCFG_FLAGS_DISABLE_BUMPMAP, false );
  136. SetFlag( MATSYS_VIDCFG_FLAGS_DISABLE_DETAIL, false );
  137. SetFlag( MATSYS_VIDCFG_FLAGS_ENABLE_PARALLAX_MAPPING, true );
  138. SetFlag( MATSYS_VIDCFG_FLAGS_USE_Z_PREFILL, false );
  139. SetFlag( MATSYS_VIDCFG_FLAGS_LIMIT_WINDOWED_SIZE, false );
  140. SetFlag( MATSYS_VIDCFG_FLAGS_SCALE_TO_OUTPUT_RESOLUTION, false );
  141. SetFlag( MATSYS_VIDCFG_FLAGS_USING_MULTIPLE_WINDOWS, false );
  142. SetFlag( MATSYS_VIDCFG_FLAGS_UNSUPPORTED, false );
  143. m_VideoMode.m_Width = 640;
  144. m_VideoMode.m_Height = 480;
  145. m_VideoMode.m_RefreshRate = 60;
  146. dxSupportLevel = 0;
  147. bCompressedTextures = true;
  148. bFilterTextures = true;
  149. bFilterLightmaps = true;
  150. bMipMapTextures = true;
  151. bBufferPrimitives = true;
  152. m_fMonitorGamma = 2.2f;
  153. m_fGammaTVRangeMin = 16.0f;
  154. m_fGammaTVRangeMax = 255.0f;
  155. m_fGammaTVExponent = 2.5;
  156. m_bGammaTVEnabled = IsGameConsole();
  157. m_bWantTripleBuffered = false;
  158. m_nAASamples = 1;
  159. m_bShadowDepthTexture = false;
  160. m_bMotionBlur = false;
  161. m_bSupportFlashlight = true;
  162. // misc defaults
  163. bAllowCheats = false;
  164. bCompressedTextures = true;
  165. bEditMode = false;
  166. // debug modes
  167. bShowSpecular = true;
  168. bShowDiffuse = true;
  169. nFullbright = 0;
  170. bShowNormalMap = false;
  171. bFilterLightmaps = true;
  172. bFilterTextures = true;
  173. bMipMapTextures = true;
  174. nShowMipLevels = 0;
  175. bShowLowResImage = false;
  176. bReverseDepth = false;
  177. bBufferPrimitives = true;
  178. bDrawFlat = false;
  179. bMeasureFillRate = false;
  180. bVisualizeFillRate = false;
  181. bSoftwareLighting = false;
  182. bNoTransparency = false;
  183. proxiesTestMode = 0;
  184. m_bFastNoBump = false;
  185. m_bSuppressRendering = false;
  186. m_WindowedSizeLimitWidth = 1280;
  187. m_WindowedSizeLimitHeight = 1024;
  188. bDrawGray = false;
  189. // PAINT
  190. m_bPaintInGame = false;
  191. m_bPaintInMap = false;
  192. m_nCSMQuality = CSMQUALITY_VERY_LOW;
  193. m_bCSMAccurateBlending = true;
  194. }
  195. };
  196. #endif // MATERIALSYSTEM_CONFIG_H