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.

316 lines
7.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 watercheap_ps20b_Static_Index
  14. {
  15. private:
  16. int m_nMULTITEXTURE;
  17. #ifdef _DEBUG
  18. bool m_bMULTITEXTURE;
  19. #endif
  20. public:
  21. void SetMULTITEXTURE( int i )
  22. {
  23. Assert( i >= 0 && i <= 1 );
  24. m_nMULTITEXTURE = i;
  25. #ifdef _DEBUG
  26. m_bMULTITEXTURE = true;
  27. #endif
  28. }
  29. void SetMULTITEXTURE( bool i )
  30. {
  31. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  32. m_nMULTITEXTURE = i ? 1 : 0;
  33. #ifdef _DEBUG
  34. m_bMULTITEXTURE = true;
  35. #endif
  36. }
  37. private:
  38. int m_nFRESNEL;
  39. #ifdef _DEBUG
  40. bool m_bFRESNEL;
  41. #endif
  42. public:
  43. void SetFRESNEL( int i )
  44. {
  45. Assert( i >= 0 && i <= 1 );
  46. m_nFRESNEL = i;
  47. #ifdef _DEBUG
  48. m_bFRESNEL = true;
  49. #endif
  50. }
  51. void SetFRESNEL( bool i )
  52. {
  53. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  54. m_nFRESNEL = i ? 1 : 0;
  55. #ifdef _DEBUG
  56. m_bFRESNEL = true;
  57. #endif
  58. }
  59. private:
  60. int m_nBLEND;
  61. #ifdef _DEBUG
  62. bool m_bBLEND;
  63. #endif
  64. public:
  65. void SetBLEND( int i )
  66. {
  67. Assert( i >= 0 && i <= 1 );
  68. m_nBLEND = i;
  69. #ifdef _DEBUG
  70. m_bBLEND = true;
  71. #endif
  72. }
  73. void SetBLEND( bool i )
  74. {
  75. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  76. m_nBLEND = i ? 1 : 0;
  77. #ifdef _DEBUG
  78. m_bBLEND = true;
  79. #endif
  80. }
  81. private:
  82. int m_nREFRACTALPHA;
  83. #ifdef _DEBUG
  84. bool m_bREFRACTALPHA;
  85. #endif
  86. public:
  87. void SetREFRACTALPHA( int i )
  88. {
  89. Assert( i >= 0 && i <= 1 );
  90. m_nREFRACTALPHA = i;
  91. #ifdef _DEBUG
  92. m_bREFRACTALPHA = true;
  93. #endif
  94. }
  95. void SetREFRACTALPHA( bool i )
  96. {
  97. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  98. m_nREFRACTALPHA = i ? 1 : 0;
  99. #ifdef _DEBUG
  100. m_bREFRACTALPHA = true;
  101. #endif
  102. }
  103. private:
  104. int m_nHDRTYPE;
  105. #ifdef _DEBUG
  106. bool m_bHDRTYPE;
  107. #endif
  108. public:
  109. void SetHDRTYPE( int i )
  110. {
  111. Assert( i >= 0 && i <= 2 );
  112. m_nHDRTYPE = i;
  113. #ifdef _DEBUG
  114. m_bHDRTYPE = true;
  115. #endif
  116. }
  117. void SetHDRTYPE( bool i )
  118. {
  119. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  120. m_nHDRTYPE = i ? 1 : 0;
  121. #ifdef _DEBUG
  122. m_bHDRTYPE = true;
  123. #endif
  124. }
  125. private:
  126. int m_nFLOWMAP;
  127. #ifdef _DEBUG
  128. bool m_bFLOWMAP;
  129. #endif
  130. public:
  131. void SetFLOWMAP( int i )
  132. {
  133. Assert( i >= 0 && i <= 1 );
  134. m_nFLOWMAP = i;
  135. #ifdef _DEBUG
  136. m_bFLOWMAP = true;
  137. #endif
  138. }
  139. void SetFLOWMAP( bool i )
  140. {
  141. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  142. m_nFLOWMAP = i ? 1 : 0;
  143. #ifdef _DEBUG
  144. m_bFLOWMAP = true;
  145. #endif
  146. }
  147. private:
  148. int m_nFLOW_DEBUG;
  149. #ifdef _DEBUG
  150. bool m_bFLOW_DEBUG;
  151. #endif
  152. public:
  153. void SetFLOW_DEBUG( int i )
  154. {
  155. Assert( i >= 0 && i <= 1 );
  156. m_nFLOW_DEBUG = i;
  157. #ifdef _DEBUG
  158. m_bFLOW_DEBUG = true;
  159. #endif
  160. }
  161. void SetFLOW_DEBUG( bool i )
  162. {
  163. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  164. m_nFLOW_DEBUG = i ? 1 : 0;
  165. #ifdef _DEBUG
  166. m_bFLOW_DEBUG = true;
  167. #endif
  168. }
  169. public:
  170. // CONSTRUCTOR
  171. watercheap_ps20b_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  172. {
  173. #ifdef _DEBUG
  174. m_bMULTITEXTURE = false;
  175. #endif // _DEBUG
  176. m_nMULTITEXTURE = 0;
  177. #ifdef _DEBUG
  178. m_bFRESNEL = false;
  179. #endif // _DEBUG
  180. m_nFRESNEL = 0;
  181. #ifdef _DEBUG
  182. m_bBLEND = false;
  183. #endif // _DEBUG
  184. m_nBLEND = 0;
  185. #ifdef _DEBUG
  186. m_bREFRACTALPHA = false;
  187. #endif // _DEBUG
  188. m_nREFRACTALPHA = 0;
  189. #ifdef _DEBUG
  190. m_bHDRTYPE = false;
  191. #endif // _DEBUG
  192. m_nHDRTYPE = 0;
  193. #ifdef _DEBUG
  194. m_bFLOWMAP = false;
  195. #endif // _DEBUG
  196. m_nFLOWMAP = 0;
  197. #ifdef _DEBUG
  198. m_bFLOW_DEBUG = false;
  199. #endif // _DEBUG
  200. m_nFLOW_DEBUG = 0;
  201. }
  202. int GetIndex()
  203. {
  204. // Asserts to make sure that we aren't using any skipped combinations.
  205. // Asserts to make sure that we are setting all of the combination vars.
  206. #ifdef _DEBUG
  207. bool bAllStaticVarsDefined = m_bMULTITEXTURE && m_bFRESNEL && m_bBLEND && m_bREFRACTALPHA && m_bHDRTYPE && m_bFLOWMAP && m_bFLOW_DEBUG;
  208. Assert( bAllStaticVarsDefined );
  209. #endif // _DEBUG
  210. return ( 4 * m_nMULTITEXTURE ) + ( 8 * m_nFRESNEL ) + ( 16 * m_nBLEND ) + ( 32 * m_nREFRACTALPHA ) + ( 64 * m_nHDRTYPE ) + ( 192 * m_nFLOWMAP ) + ( 384 * m_nFLOW_DEBUG ) + 0;
  211. }
  212. };
  213. #define shaderStaticTest_watercheap_ps20b psh_forgot_to_set_static_MULTITEXTURE + psh_forgot_to_set_static_FRESNEL + psh_forgot_to_set_static_BLEND + psh_forgot_to_set_static_REFRACTALPHA + psh_forgot_to_set_static_HDRTYPE + psh_forgot_to_set_static_FLOWMAP + psh_forgot_to_set_static_FLOW_DEBUG + 0
  214. class watercheap_ps20b_Dynamic_Index
  215. {
  216. private:
  217. int m_nHDRENABLED;
  218. #ifdef _DEBUG
  219. bool m_bHDRENABLED;
  220. #endif
  221. public:
  222. void SetHDRENABLED( int i )
  223. {
  224. Assert( i >= 0 && i <= 1 );
  225. m_nHDRENABLED = i;
  226. #ifdef _DEBUG
  227. m_bHDRENABLED = true;
  228. #endif
  229. }
  230. void SetHDRENABLED( bool i )
  231. {
  232. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  233. m_nHDRENABLED = i ? 1 : 0;
  234. #ifdef _DEBUG
  235. m_bHDRENABLED = true;
  236. #endif
  237. }
  238. private:
  239. int m_nPIXELFOGTYPE;
  240. #ifdef _DEBUG
  241. bool m_bPIXELFOGTYPE;
  242. #endif
  243. public:
  244. void SetPIXELFOGTYPE( int i )
  245. {
  246. Assert( i >= 0 && i <= 1 );
  247. m_nPIXELFOGTYPE = i;
  248. #ifdef _DEBUG
  249. m_bPIXELFOGTYPE = true;
  250. #endif
  251. }
  252. void SetPIXELFOGTYPE( bool i )
  253. {
  254. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  255. m_nPIXELFOGTYPE = i ? 1 : 0;
  256. #ifdef _DEBUG
  257. m_bPIXELFOGTYPE = true;
  258. #endif
  259. }
  260. public:
  261. // CONSTRUCTOR
  262. watercheap_ps20b_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  263. {
  264. #ifdef _DEBUG
  265. m_bHDRENABLED = false;
  266. #endif // _DEBUG
  267. m_nHDRENABLED = 0;
  268. #ifdef _DEBUG
  269. m_bPIXELFOGTYPE = true;
  270. #endif // _DEBUG
  271. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  272. }
  273. int GetIndex()
  274. {
  275. // Asserts to make sure that we aren't using any skipped combinations.
  276. // Asserts to make sure that we are setting all of the combination vars.
  277. #ifdef _DEBUG
  278. bool bAllDynamicVarsDefined = m_bHDRENABLED && m_bPIXELFOGTYPE;
  279. Assert( bAllDynamicVarsDefined );
  280. #endif // _DEBUG
  281. return ( 1 * m_nHDRENABLED ) + ( 2 * m_nPIXELFOGTYPE ) + 0;
  282. }
  283. };
  284. #define shaderDynamicTest_watercheap_ps20b psh_forgot_to_set_dynamic_HDRENABLED + 0
  285. static const ShaderComboInformation_t s_DynamicComboArray_watercheap_ps20b[2] =
  286. {
  287. { "HDRENABLED", 0, 1 },
  288. { "PIXELFOGTYPE", 0, 1 },
  289. };
  290. static const ShaderComboInformation_t s_StaticComboArray_watercheap_ps20b[7] =
  291. {
  292. { "MULTITEXTURE", 0, 1 },
  293. { "FRESNEL", 0, 1 },
  294. { "BLEND", 0, 1 },
  295. { "REFRACTALPHA", 0, 1 },
  296. { "HDRTYPE", 0, 2 },
  297. { "FLOWMAP", 0, 1 },
  298. { "FLOW_DEBUG", 0, 1 },
  299. };
  300. static const ShaderComboSemantics_t watercheap_ps20b_combos =
  301. {
  302. "watercheap_ps20b", s_DynamicComboArray_watercheap_ps20b, 2, s_StaticComboArray_watercheap_ps20b, 7
  303. };
  304. class ConstructMe_watercheap_ps20b
  305. {
  306. public:
  307. ConstructMe_watercheap_ps20b()
  308. {
  309. GetShaderDLL()->AddShaderComboInformation( &watercheap_ps20b_combos );
  310. }
  311. };
  312. static ConstructMe_watercheap_ps20b s_ConstructMe_watercheap_ps20b;