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.

262 lines
6.3 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  3. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  4. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  5. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  6. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  7. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  8. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  9. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  10. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  11. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  12. #include "shaderlib/cshader.h"
  13. class sprite_ps20b_Static_Index
  14. {
  15. private:
  16. int m_nVERTEXCOLOR;
  17. #ifdef _DEBUG
  18. bool m_bVERTEXCOLOR;
  19. #endif
  20. public:
  21. void SetVERTEXCOLOR( int i )
  22. {
  23. Assert( i >= 0 && i <= 1 );
  24. m_nVERTEXCOLOR = i;
  25. #ifdef _DEBUG
  26. m_bVERTEXCOLOR = true;
  27. #endif
  28. }
  29. void SetVERTEXCOLOR( bool i )
  30. {
  31. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  32. m_nVERTEXCOLOR = i ? 1 : 0;
  33. #ifdef _DEBUG
  34. m_bVERTEXCOLOR = true;
  35. #endif
  36. }
  37. private:
  38. int m_nCONSTANTCOLOR;
  39. #ifdef _DEBUG
  40. bool m_bCONSTANTCOLOR;
  41. #endif
  42. public:
  43. void SetCONSTANTCOLOR( int i )
  44. {
  45. Assert( i >= 0 && i <= 1 );
  46. m_nCONSTANTCOLOR = i;
  47. #ifdef _DEBUG
  48. m_bCONSTANTCOLOR = true;
  49. #endif
  50. }
  51. void SetCONSTANTCOLOR( bool i )
  52. {
  53. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  54. m_nCONSTANTCOLOR = i ? 1 : 0;
  55. #ifdef _DEBUG
  56. m_bCONSTANTCOLOR = true;
  57. #endif
  58. }
  59. private:
  60. int m_nHDRTYPE;
  61. #ifdef _DEBUG
  62. bool m_bHDRTYPE;
  63. #endif
  64. public:
  65. void SetHDRTYPE( int i )
  66. {
  67. Assert( i >= 0 && i <= 2 );
  68. m_nHDRTYPE = i;
  69. #ifdef _DEBUG
  70. m_bHDRTYPE = true;
  71. #endif
  72. }
  73. void SetHDRTYPE( bool i )
  74. {
  75. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  76. m_nHDRTYPE = i ? 1 : 0;
  77. #ifdef _DEBUG
  78. m_bHDRTYPE = true;
  79. #endif
  80. }
  81. private:
  82. int m_nSRGB;
  83. #ifdef _DEBUG
  84. bool m_bSRGB;
  85. #endif
  86. public:
  87. void SetSRGB( int i )
  88. {
  89. Assert( i >= 0 && i <= 1 );
  90. m_nSRGB = i;
  91. #ifdef _DEBUG
  92. m_bSRGB = true;
  93. #endif
  94. }
  95. void SetSRGB( bool i )
  96. {
  97. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  98. m_nSRGB = i ? 1 : 0;
  99. #ifdef _DEBUG
  100. m_bSRGB = true;
  101. #endif
  102. }
  103. private:
  104. int m_nSRGB_OUTPUT_ADAPTER;
  105. #ifdef _DEBUG
  106. bool m_bSRGB_OUTPUT_ADAPTER;
  107. #endif
  108. public:
  109. void SetSRGB_OUTPUT_ADAPTER( int i )
  110. {
  111. Assert( i >= 0 && i <= 1 );
  112. m_nSRGB_OUTPUT_ADAPTER = i;
  113. #ifdef _DEBUG
  114. m_bSRGB_OUTPUT_ADAPTER = true;
  115. #endif
  116. }
  117. void SetSRGB_OUTPUT_ADAPTER( bool i )
  118. {
  119. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  120. m_nSRGB_OUTPUT_ADAPTER = i ? 1 : 0;
  121. #ifdef _DEBUG
  122. m_bSRGB_OUTPUT_ADAPTER = true;
  123. #endif
  124. }
  125. public:
  126. // CONSTRUCTOR
  127. sprite_ps20b_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  128. {
  129. #ifdef _DEBUG
  130. m_bVERTEXCOLOR = false;
  131. #endif // _DEBUG
  132. m_nVERTEXCOLOR = 0;
  133. #ifdef _DEBUG
  134. m_bCONSTANTCOLOR = false;
  135. #endif // _DEBUG
  136. m_nCONSTANTCOLOR = 0;
  137. #ifdef _DEBUG
  138. m_bHDRTYPE = false;
  139. #endif // _DEBUG
  140. m_nHDRTYPE = 0;
  141. #ifdef _DEBUG
  142. m_bSRGB = false;
  143. #endif // _DEBUG
  144. m_nSRGB = 0;
  145. #ifdef _DEBUG
  146. m_bSRGB_OUTPUT_ADAPTER = false;
  147. #endif // _DEBUG
  148. m_nSRGB_OUTPUT_ADAPTER = 0;
  149. }
  150. int GetIndex()
  151. {
  152. // Asserts to make sure that we aren't using any skipped combinations.
  153. // Asserts to make sure that we are setting all of the combination vars.
  154. #ifdef _DEBUG
  155. bool bAllStaticVarsDefined = m_bVERTEXCOLOR && m_bCONSTANTCOLOR && m_bHDRTYPE && m_bSRGB && m_bSRGB_OUTPUT_ADAPTER;
  156. Assert( bAllStaticVarsDefined );
  157. #endif // _DEBUG
  158. return ( 4 * m_nVERTEXCOLOR ) + ( 8 * m_nCONSTANTCOLOR ) + ( 16 * m_nHDRTYPE ) + ( 48 * m_nSRGB ) + ( 96 * m_nSRGB_OUTPUT_ADAPTER ) + 0;
  159. }
  160. };
  161. #define shaderStaticTest_sprite_ps20b psh_forgot_to_set_static_VERTEXCOLOR + psh_forgot_to_set_static_CONSTANTCOLOR + psh_forgot_to_set_static_HDRTYPE + psh_forgot_to_set_static_SRGB + psh_forgot_to_set_static_SRGB_OUTPUT_ADAPTER + 0
  162. class sprite_ps20b_Dynamic_Index
  163. {
  164. private:
  165. int m_nHDRENABLED;
  166. #ifdef _DEBUG
  167. bool m_bHDRENABLED;
  168. #endif
  169. public:
  170. void SetHDRENABLED( int i )
  171. {
  172. Assert( i >= 0 && i <= 1 );
  173. m_nHDRENABLED = i;
  174. #ifdef _DEBUG
  175. m_bHDRENABLED = true;
  176. #endif
  177. }
  178. void SetHDRENABLED( bool i )
  179. {
  180. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  181. m_nHDRENABLED = i ? 1 : 0;
  182. #ifdef _DEBUG
  183. m_bHDRENABLED = true;
  184. #endif
  185. }
  186. private:
  187. int m_nPIXELFOGTYPE;
  188. #ifdef _DEBUG
  189. bool m_bPIXELFOGTYPE;
  190. #endif
  191. public:
  192. void SetPIXELFOGTYPE( int i )
  193. {
  194. Assert( i >= 0 && i <= 1 );
  195. m_nPIXELFOGTYPE = i;
  196. #ifdef _DEBUG
  197. m_bPIXELFOGTYPE = true;
  198. #endif
  199. }
  200. void SetPIXELFOGTYPE( bool i )
  201. {
  202. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  203. m_nPIXELFOGTYPE = i ? 1 : 0;
  204. #ifdef _DEBUG
  205. m_bPIXELFOGTYPE = true;
  206. #endif
  207. }
  208. public:
  209. // CONSTRUCTOR
  210. sprite_ps20b_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  211. {
  212. #ifdef _DEBUG
  213. m_bHDRENABLED = false;
  214. #endif // _DEBUG
  215. m_nHDRENABLED = 0;
  216. #ifdef _DEBUG
  217. m_bPIXELFOGTYPE = true;
  218. #endif // _DEBUG
  219. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  220. }
  221. int GetIndex()
  222. {
  223. // Asserts to make sure that we aren't using any skipped combinations.
  224. // Asserts to make sure that we are setting all of the combination vars.
  225. #ifdef _DEBUG
  226. bool bAllDynamicVarsDefined = m_bHDRENABLED && m_bPIXELFOGTYPE;
  227. Assert( bAllDynamicVarsDefined );
  228. #endif // _DEBUG
  229. return ( 1 * m_nHDRENABLED ) + ( 2 * m_nPIXELFOGTYPE ) + 0;
  230. }
  231. };
  232. #define shaderDynamicTest_sprite_ps20b psh_forgot_to_set_dynamic_HDRENABLED + 0
  233. static const ShaderComboInformation_t s_DynamicComboArray_sprite_ps20b[2] =
  234. {
  235. { "HDRENABLED", 0, 1 },
  236. { "PIXELFOGTYPE", 0, 1 },
  237. };
  238. static const ShaderComboInformation_t s_StaticComboArray_sprite_ps20b[5] =
  239. {
  240. { "VERTEXCOLOR", 0, 1 },
  241. { "CONSTANTCOLOR", 0, 1 },
  242. { "HDRTYPE", 0, 2 },
  243. { "SRGB", 0, 1 },
  244. { "SRGB_OUTPUT_ADAPTER", 0, 1 },
  245. };
  246. static const ShaderComboSemantics_t sprite_ps20b_combos =
  247. {
  248. "sprite_ps20b", s_DynamicComboArray_sprite_ps20b, 2, s_StaticComboArray_sprite_ps20b, 5
  249. };
  250. class ConstructMe_sprite_ps20b
  251. {
  252. public:
  253. ConstructMe_sprite_ps20b()
  254. {
  255. GetShaderDLL()->AddShaderComboInformation( &sprite_ps20b_combos );
  256. }
  257. };
  258. static ConstructMe_sprite_ps20b s_ConstructMe_sprite_ps20b;