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.

229 lines
7.5 KiB

  1. //========= Copyright 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. #include "materialsystem/imaterialsystem.h"
  13. #define MATERIALSYSTEM_CONFIG_VERSION "VMaterialSystemConfig002"
  14. enum MaterialSystem_Config_Flags_t
  15. {
  16. MATSYS_VIDCFG_FLAGS_WINDOWED = ( 1 << 0 ),
  17. MATSYS_VIDCFG_FLAGS_RESIZING = ( 1 << 1 ),
  18. MATSYS_VIDCFG_FLAGS_NO_WAIT_FOR_VSYNC = ( 1 << 3 ),
  19. MATSYS_VIDCFG_FLAGS_STENCIL = ( 1 << 4 ),
  20. MATSYS_VIDCFG_FLAGS_FORCE_TRILINEAR = ( 1 << 5 ),
  21. MATSYS_VIDCFG_FLAGS_FORCE_HWSYNC = ( 1 << 6 ),
  22. MATSYS_VIDCFG_FLAGS_DISABLE_SPECULAR = ( 1 << 7 ),
  23. MATSYS_VIDCFG_FLAGS_DISABLE_BUMPMAP = ( 1 << 8 ),
  24. MATSYS_VIDCFG_FLAGS_ENABLE_PARALLAX_MAPPING = ( 1 << 9 ),
  25. MATSYS_VIDCFG_FLAGS_USE_Z_PREFILL = ( 1 << 10 ),
  26. MATSYS_VIDCFG_FLAGS_REDUCE_FILLRATE = ( 1 << 11 ),
  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_VR_MODE = ( 1 << 17 ),
  33. };
  34. struct MaterialSystemHardwareIdentifier_t
  35. {
  36. char *m_pCardName;
  37. unsigned int m_nVendorID;
  38. unsigned int m_nDeviceID;
  39. };
  40. struct MaterialSystem_Config_t
  41. {
  42. bool Windowed() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_WINDOWED ) != 0; }
  43. bool Resizing() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_RESIZING ) != 0; }
  44. #ifdef CSS_PERF_TEST
  45. bool WaitForVSync() const { return false; }//( m_Flags & MATSYS_VIDCFG_FLAGS_NO_WAIT_FOR_VSYNC ) == 0; }
  46. #else
  47. bool WaitForVSync() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_NO_WAIT_FOR_VSYNC ) == 0; }
  48. #endif
  49. bool Stencil() const { return (m_Flags & MATSYS_VIDCFG_FLAGS_STENCIL ) != 0; }
  50. bool ForceTrilinear() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_FORCE_TRILINEAR ) != 0; }
  51. bool ForceHWSync() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_FORCE_HWSYNC ) != 0; }
  52. bool UseSpecular() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_DISABLE_SPECULAR ) == 0; }
  53. bool UseBumpmapping() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_DISABLE_BUMPMAP ) == 0; }
  54. bool UseParallaxMapping() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_ENABLE_PARALLAX_MAPPING ) != 0; }
  55. bool UseZPrefill() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_USE_Z_PREFILL ) != 0; }
  56. bool ReduceFillrate() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_REDUCE_FILLRATE ) != 0; }
  57. bool HDREnabled() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_ENABLE_HDR ) != 0; }
  58. bool LimitWindowedSize() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_LIMIT_WINDOWED_SIZE ) != 0; }
  59. bool ScaleToOutputResolution() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_SCALE_TO_OUTPUT_RESOLUTION ) != 0; }
  60. bool UsingMultipleWindows() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_USING_MULTIPLE_WINDOWS ) != 0; }
  61. bool UsePhong() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_DISABLE_PHONG ) == 0; }
  62. bool VRMode() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_VR_MODE) != 0; }
  63. bool ShadowDepthTexture() const { return m_bShadowDepthTexture; }
  64. bool MotionBlur() const { return m_bMotionBlur; }
  65. bool SupportFlashlight() const { return m_bSupportFlashlight; }
  66. void SetFlag( unsigned int flag, bool val )
  67. {
  68. if( val )
  69. {
  70. m_Flags |= flag;
  71. }
  72. else
  73. {
  74. m_Flags &= ~flag;
  75. }
  76. }
  77. // control panel stuff
  78. MaterialVideoMode_t m_VideoMode;
  79. float m_fMonitorGamma;
  80. float m_fGammaTVRangeMin;
  81. float m_fGammaTVRangeMax;
  82. float m_fGammaTVExponent;
  83. bool m_bGammaTVEnabled;
  84. int m_nAASamples;
  85. int m_nForceAnisotropicLevel;
  86. int skipMipLevels;
  87. int dxSupportLevel;
  88. unsigned int m_Flags;
  89. bool bEditMode; // true if in Hammer.
  90. unsigned char proxiesTestMode; // 0 = normal, 1 = no proxies, 2 = alpha test all, 3 = color mod all
  91. bool bCompressedTextures;
  92. bool bFilterLightmaps;
  93. bool bFilterTextures;
  94. bool bReverseDepth;
  95. bool bBufferPrimitives;
  96. bool bDrawFlat;
  97. bool bMeasureFillRate;
  98. bool bVisualizeFillRate;
  99. bool bNoTransparency;
  100. bool bSoftwareLighting;
  101. bool bAllowCheats;
  102. char nShowMipLevels;
  103. bool bShowLowResImage;
  104. bool bShowNormalMap;
  105. bool bMipMapTextures;
  106. unsigned char nFullbright;
  107. bool m_bFastNoBump;
  108. bool m_bSuppressRendering;
  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. // misc
  113. int m_nReserved; // Currently unused
  114. // No depth bias
  115. float m_SlopeScaleDepthBias_Normal;
  116. float m_DepthBias_Normal;
  117. // Depth bias for rendering decals closer to the camera
  118. float m_SlopeScaleDepthBias_Decal;
  119. float m_DepthBias_Decal;
  120. // Depth bias for biasing shadow depth map rendering away from the camera
  121. float m_SlopeScaleDepthBias_ShadowMap;
  122. float m_DepthBias_ShadowMap;
  123. uint m_WindowedSizeLimitWidth;
  124. uint m_WindowedSizeLimitHeight;
  125. int m_nAAQuality;
  126. bool m_bShadowDepthTexture;
  127. bool m_bMotionBlur;
  128. bool m_bSupportFlashlight;
  129. int m_nVRModeAdapter;
  130. MaterialSystem_Config_t()
  131. {
  132. memset( this, 0, sizeof( *this ) );
  133. // video config defaults
  134. SetFlag( MATSYS_VIDCFG_FLAGS_WINDOWED, false );
  135. SetFlag( MATSYS_VIDCFG_FLAGS_RESIZING, false );
  136. SetFlag( MATSYS_VIDCFG_FLAGS_NO_WAIT_FOR_VSYNC, true );
  137. SetFlag( MATSYS_VIDCFG_FLAGS_STENCIL, false );
  138. SetFlag( MATSYS_VIDCFG_FLAGS_FORCE_TRILINEAR, true );
  139. SetFlag( MATSYS_VIDCFG_FLAGS_FORCE_HWSYNC, true );
  140. SetFlag( MATSYS_VIDCFG_FLAGS_DISABLE_SPECULAR, false );
  141. SetFlag( MATSYS_VIDCFG_FLAGS_DISABLE_BUMPMAP, false );
  142. SetFlag( MATSYS_VIDCFG_FLAGS_ENABLE_PARALLAX_MAPPING, true );
  143. SetFlag( MATSYS_VIDCFG_FLAGS_USE_Z_PREFILL, false );
  144. SetFlag( MATSYS_VIDCFG_FLAGS_REDUCE_FILLRATE, false );
  145. SetFlag( MATSYS_VIDCFG_FLAGS_LIMIT_WINDOWED_SIZE, false );
  146. SetFlag( MATSYS_VIDCFG_FLAGS_SCALE_TO_OUTPUT_RESOLUTION, false );
  147. SetFlag( MATSYS_VIDCFG_FLAGS_USING_MULTIPLE_WINDOWS, false );
  148. SetFlag( MATSYS_VIDCFG_FLAGS_DISABLE_PHONG, false );
  149. SetFlag( MATSYS_VIDCFG_FLAGS_VR_MODE, false );
  150. m_VideoMode.m_Width = 640;
  151. m_VideoMode.m_Height = 480;
  152. m_VideoMode.m_RefreshRate = 60;
  153. dxSupportLevel = 0;
  154. bCompressedTextures = true;
  155. bFilterTextures = true;
  156. bFilterLightmaps = true;
  157. bMipMapTextures = true;
  158. bBufferPrimitives = true;
  159. m_fMonitorGamma = 2.2f;
  160. m_fGammaTVRangeMin = 16.0f;
  161. m_fGammaTVRangeMax = 255.0f;
  162. m_fGammaTVExponent = 2.5;
  163. m_bGammaTVEnabled = IsX360();
  164. m_nAASamples = 1;
  165. m_bShadowDepthTexture = false;
  166. m_bMotionBlur = false;
  167. m_bSupportFlashlight = true;
  168. m_nVRModeAdapter = -1;
  169. // misc defaults
  170. bAllowCheats = false;
  171. bCompressedTextures = true;
  172. bEditMode = false;
  173. // debug modes
  174. bShowSpecular = true;
  175. bShowDiffuse = true;
  176. nFullbright = 0;
  177. bShowNormalMap = false;
  178. bFilterLightmaps = true;
  179. bFilterTextures = true;
  180. bMipMapTextures = true;
  181. nShowMipLevels = 0;
  182. bShowLowResImage = false;
  183. bReverseDepth = false;
  184. bBufferPrimitives = true;
  185. bDrawFlat = false;
  186. bMeasureFillRate = false;
  187. bVisualizeFillRate = false;
  188. bSoftwareLighting = false;
  189. bNoTransparency = false;
  190. proxiesTestMode = 0;
  191. m_bFastNoBump = false;
  192. m_bSuppressRendering = false;
  193. m_SlopeScaleDepthBias_Decal = -0.5f;
  194. m_SlopeScaleDepthBias_Normal = 0.0f;
  195. m_SlopeScaleDepthBias_ShadowMap = 0.5f;
  196. m_DepthBias_Decal = -262144;
  197. m_DepthBias_Normal = 0.0f;
  198. m_DepthBias_ShadowMap = 262144;
  199. m_WindowedSizeLimitWidth = 1280;
  200. m_WindowedSizeLimitHeight = 1024;
  201. }
  202. };
  203. #endif // MATERIALSYSTEM_CONFIG_H