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.

385 lines
10 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $BACK_SURFACE == 1 ) && ( $LIGHT_WARP > 0 )
  3. // ( $BACK_SURFACE == 1 ) && ( $FRESNEL_WARP > 0 )
  4. // ( $BACK_SURFACE == 1 ) && ( $INTERIOR_LAYER > 0 )
  5. // ( $BACK_SURFACE == 1 ) && ( $OPACITY_TEXTURE > 0 )
  6. // ( $BACK_SURFACE == 1 ) && ( $CONTACT_SHADOW > 0 )
  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. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  13. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  14. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  15. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  16. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  17. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  18. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  19. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  20. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  21. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  22. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  23. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  24. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  25. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  26. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  27. #include "shaderlib/cshader.h"
  28. class icesurface_ps30_Static_Index
  29. {
  30. private:
  31. int m_nBACK_SURFACE;
  32. #ifdef _DEBUG
  33. bool m_bBACK_SURFACE;
  34. #endif
  35. public:
  36. void SetBACK_SURFACE( int i )
  37. {
  38. Assert( i >= 0 && i <= 1 );
  39. m_nBACK_SURFACE = i;
  40. #ifdef _DEBUG
  41. m_bBACK_SURFACE = true;
  42. #endif
  43. }
  44. void SetBACK_SURFACE( bool i )
  45. {
  46. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  47. m_nBACK_SURFACE = i ? 1 : 0;
  48. #ifdef _DEBUG
  49. m_bBACK_SURFACE = true;
  50. #endif
  51. }
  52. private:
  53. int m_nLIGHT_WARP;
  54. #ifdef _DEBUG
  55. bool m_bLIGHT_WARP;
  56. #endif
  57. public:
  58. void SetLIGHT_WARP( int i )
  59. {
  60. Assert( i >= 0 && i <= 1 );
  61. m_nLIGHT_WARP = i;
  62. #ifdef _DEBUG
  63. m_bLIGHT_WARP = true;
  64. #endif
  65. }
  66. void SetLIGHT_WARP( bool i )
  67. {
  68. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  69. m_nLIGHT_WARP = i ? 1 : 0;
  70. #ifdef _DEBUG
  71. m_bLIGHT_WARP = true;
  72. #endif
  73. }
  74. private:
  75. int m_nFRESNEL_WARP;
  76. #ifdef _DEBUG
  77. bool m_bFRESNEL_WARP;
  78. #endif
  79. public:
  80. void SetFRESNEL_WARP( int i )
  81. {
  82. Assert( i >= 0 && i <= 1 );
  83. m_nFRESNEL_WARP = i;
  84. #ifdef _DEBUG
  85. m_bFRESNEL_WARP = true;
  86. #endif
  87. }
  88. void SetFRESNEL_WARP( bool i )
  89. {
  90. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  91. m_nFRESNEL_WARP = i ? 1 : 0;
  92. #ifdef _DEBUG
  93. m_bFRESNEL_WARP = true;
  94. #endif
  95. }
  96. private:
  97. int m_nHIGH_PRECISION_DEPTH;
  98. #ifdef _DEBUG
  99. bool m_bHIGH_PRECISION_DEPTH;
  100. #endif
  101. public:
  102. void SetHIGH_PRECISION_DEPTH( int i )
  103. {
  104. Assert( i >= 0 && i <= 1 );
  105. m_nHIGH_PRECISION_DEPTH = i;
  106. #ifdef _DEBUG
  107. m_bHIGH_PRECISION_DEPTH = true;
  108. #endif
  109. }
  110. void SetHIGH_PRECISION_DEPTH( bool i )
  111. {
  112. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  113. m_nHIGH_PRECISION_DEPTH = i ? 1 : 0;
  114. #ifdef _DEBUG
  115. m_bHIGH_PRECISION_DEPTH = true;
  116. #endif
  117. }
  118. private:
  119. int m_nINTERIOR_LAYER;
  120. #ifdef _DEBUG
  121. bool m_bINTERIOR_LAYER;
  122. #endif
  123. public:
  124. void SetINTERIOR_LAYER( int i )
  125. {
  126. Assert( i >= 0 && i <= 1 );
  127. m_nINTERIOR_LAYER = i;
  128. #ifdef _DEBUG
  129. m_bINTERIOR_LAYER = true;
  130. #endif
  131. }
  132. void SetINTERIOR_LAYER( bool i )
  133. {
  134. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  135. m_nINTERIOR_LAYER = i ? 1 : 0;
  136. #ifdef _DEBUG
  137. m_bINTERIOR_LAYER = true;
  138. #endif
  139. }
  140. private:
  141. int m_nOPACITY_TEXTURE;
  142. #ifdef _DEBUG
  143. bool m_bOPACITY_TEXTURE;
  144. #endif
  145. public:
  146. void SetOPACITY_TEXTURE( int i )
  147. {
  148. Assert( i >= 0 && i <= 1 );
  149. m_nOPACITY_TEXTURE = i;
  150. #ifdef _DEBUG
  151. m_bOPACITY_TEXTURE = true;
  152. #endif
  153. }
  154. void SetOPACITY_TEXTURE( bool i )
  155. {
  156. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  157. m_nOPACITY_TEXTURE = i ? 1 : 0;
  158. #ifdef _DEBUG
  159. m_bOPACITY_TEXTURE = true;
  160. #endif
  161. }
  162. private:
  163. int m_nFLASHLIGHTDEPTHFILTERMODE;
  164. #ifdef _DEBUG
  165. bool m_bFLASHLIGHTDEPTHFILTERMODE;
  166. #endif
  167. public:
  168. void SetFLASHLIGHTDEPTHFILTERMODE( int i )
  169. {
  170. Assert( i >= 0 && i <= 2 );
  171. m_nFLASHLIGHTDEPTHFILTERMODE = i;
  172. #ifdef _DEBUG
  173. m_bFLASHLIGHTDEPTHFILTERMODE = true;
  174. #endif
  175. }
  176. void SetFLASHLIGHTDEPTHFILTERMODE( bool i )
  177. {
  178. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  179. m_nFLASHLIGHTDEPTHFILTERMODE = i ? 1 : 0;
  180. #ifdef _DEBUG
  181. m_bFLASHLIGHTDEPTHFILTERMODE = true;
  182. #endif
  183. }
  184. private:
  185. int m_nCONTACT_SHADOW;
  186. #ifdef _DEBUG
  187. bool m_bCONTACT_SHADOW;
  188. #endif
  189. public:
  190. void SetCONTACT_SHADOW( int i )
  191. {
  192. Assert( i >= 0 && i <= 1 );
  193. m_nCONTACT_SHADOW = i;
  194. #ifdef _DEBUG
  195. m_bCONTACT_SHADOW = true;
  196. #endif
  197. }
  198. void SetCONTACT_SHADOW( bool i )
  199. {
  200. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  201. m_nCONTACT_SHADOW = i ? 1 : 0;
  202. #ifdef _DEBUG
  203. m_bCONTACT_SHADOW = true;
  204. #endif
  205. }
  206. public:
  207. // CONSTRUCTOR
  208. icesurface_ps30_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  209. {
  210. #ifdef _DEBUG
  211. m_bBACK_SURFACE = false;
  212. #endif // _DEBUG
  213. m_nBACK_SURFACE = 0;
  214. #ifdef _DEBUG
  215. m_bLIGHT_WARP = false;
  216. #endif // _DEBUG
  217. m_nLIGHT_WARP = 0;
  218. #ifdef _DEBUG
  219. m_bFRESNEL_WARP = false;
  220. #endif // _DEBUG
  221. m_nFRESNEL_WARP = 0;
  222. #ifdef _DEBUG
  223. m_bHIGH_PRECISION_DEPTH = false;
  224. #endif // _DEBUG
  225. m_nHIGH_PRECISION_DEPTH = 0;
  226. #ifdef _DEBUG
  227. m_bINTERIOR_LAYER = false;
  228. #endif // _DEBUG
  229. m_nINTERIOR_LAYER = 0;
  230. #ifdef _DEBUG
  231. m_bOPACITY_TEXTURE = false;
  232. #endif // _DEBUG
  233. m_nOPACITY_TEXTURE = 0;
  234. #ifdef _DEBUG
  235. m_bFLASHLIGHTDEPTHFILTERMODE = false;
  236. #endif // _DEBUG
  237. m_nFLASHLIGHTDEPTHFILTERMODE = 0;
  238. #ifdef _DEBUG
  239. m_bCONTACT_SHADOW = false;
  240. #endif // _DEBUG
  241. m_nCONTACT_SHADOW = 0;
  242. }
  243. int GetIndex()
  244. {
  245. // Asserts to make sure that we aren't using any skipped combinations.
  246. // Asserts to make sure that we are setting all of the combination vars.
  247. #ifdef _DEBUG
  248. bool bAllStaticVarsDefined = m_bBACK_SURFACE && m_bLIGHT_WARP && m_bFRESNEL_WARP && m_bHIGH_PRECISION_DEPTH && m_bINTERIOR_LAYER && m_bOPACITY_TEXTURE && m_bFLASHLIGHTDEPTHFILTERMODE && m_bCONTACT_SHADOW;
  249. Assert( bAllStaticVarsDefined );
  250. #endif // _DEBUG
  251. return ( 20 * m_nBACK_SURFACE ) + ( 40 * m_nLIGHT_WARP ) + ( 80 * m_nFRESNEL_WARP ) + ( 160 * m_nHIGH_PRECISION_DEPTH ) + ( 320 * m_nINTERIOR_LAYER ) + ( 640 * m_nOPACITY_TEXTURE ) + ( 1280 * m_nFLASHLIGHTDEPTHFILTERMODE ) + ( 3840 * m_nCONTACT_SHADOW ) + 0;
  252. }
  253. };
  254. #define shaderStaticTest_icesurface_ps30 psh_forgot_to_set_static_BACK_SURFACE + psh_forgot_to_set_static_LIGHT_WARP + psh_forgot_to_set_static_FRESNEL_WARP + psh_forgot_to_set_static_HIGH_PRECISION_DEPTH + psh_forgot_to_set_static_INTERIOR_LAYER + psh_forgot_to_set_static_OPACITY_TEXTURE + psh_forgot_to_set_static_FLASHLIGHTDEPTHFILTERMODE + psh_forgot_to_set_static_CONTACT_SHADOW + 0
  255. class icesurface_ps30_Dynamic_Index
  256. {
  257. private:
  258. int m_nNUM_LIGHTS;
  259. #ifdef _DEBUG
  260. bool m_bNUM_LIGHTS;
  261. #endif
  262. public:
  263. void SetNUM_LIGHTS( int i )
  264. {
  265. Assert( i >= 0 && i <= 4 );
  266. m_nNUM_LIGHTS = i;
  267. #ifdef _DEBUG
  268. m_bNUM_LIGHTS = true;
  269. #endif
  270. }
  271. void SetNUM_LIGHTS( bool i )
  272. {
  273. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 4 );
  274. m_nNUM_LIGHTS = i ? 1 : 0;
  275. #ifdef _DEBUG
  276. m_bNUM_LIGHTS = true;
  277. #endif
  278. }
  279. private:
  280. int m_nFLASHLIGHT;
  281. #ifdef _DEBUG
  282. bool m_bFLASHLIGHT;
  283. #endif
  284. public:
  285. void SetFLASHLIGHT( int i )
  286. {
  287. Assert( i >= 0 && i <= 1 );
  288. m_nFLASHLIGHT = i;
  289. #ifdef _DEBUG
  290. m_bFLASHLIGHT = true;
  291. #endif
  292. }
  293. void SetFLASHLIGHT( bool i )
  294. {
  295. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  296. m_nFLASHLIGHT = i ? 1 : 0;
  297. #ifdef _DEBUG
  298. m_bFLASHLIGHT = true;
  299. #endif
  300. }
  301. private:
  302. int m_nFLASHLIGHTSHADOWS;
  303. #ifdef _DEBUG
  304. bool m_bFLASHLIGHTSHADOWS;
  305. #endif
  306. public:
  307. void SetFLASHLIGHTSHADOWS( int i )
  308. {
  309. Assert( i >= 0 && i <= 1 );
  310. m_nFLASHLIGHTSHADOWS = i;
  311. #ifdef _DEBUG
  312. m_bFLASHLIGHTSHADOWS = true;
  313. #endif
  314. }
  315. void SetFLASHLIGHTSHADOWS( bool i )
  316. {
  317. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  318. m_nFLASHLIGHTSHADOWS = i ? 1 : 0;
  319. #ifdef _DEBUG
  320. m_bFLASHLIGHTSHADOWS = true;
  321. #endif
  322. }
  323. public:
  324. // CONSTRUCTOR
  325. icesurface_ps30_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  326. {
  327. #ifdef _DEBUG
  328. m_bNUM_LIGHTS = false;
  329. #endif // _DEBUG
  330. m_nNUM_LIGHTS = 0;
  331. #ifdef _DEBUG
  332. m_bFLASHLIGHT = false;
  333. #endif // _DEBUG
  334. m_nFLASHLIGHT = 0;
  335. #ifdef _DEBUG
  336. m_bFLASHLIGHTSHADOWS = false;
  337. #endif // _DEBUG
  338. m_nFLASHLIGHTSHADOWS = 0;
  339. }
  340. int GetIndex()
  341. {
  342. // Asserts to make sure that we aren't using any skipped combinations.
  343. // Asserts to make sure that we are setting all of the combination vars.
  344. #ifdef _DEBUG
  345. bool bAllDynamicVarsDefined = m_bNUM_LIGHTS && m_bFLASHLIGHT && m_bFLASHLIGHTSHADOWS;
  346. Assert( bAllDynamicVarsDefined );
  347. #endif // _DEBUG
  348. return ( 1 * m_nNUM_LIGHTS ) + ( 5 * m_nFLASHLIGHT ) + ( 10 * m_nFLASHLIGHTSHADOWS ) + 0;
  349. }
  350. };
  351. #define shaderDynamicTest_icesurface_ps30 psh_forgot_to_set_dynamic_NUM_LIGHTS + psh_forgot_to_set_dynamic_FLASHLIGHT + psh_forgot_to_set_dynamic_FLASHLIGHTSHADOWS + 0
  352. static const ShaderComboInformation_t s_DynamicComboArray_IceSurface_ps30[3] =
  353. {
  354. { "NUM_LIGHTS", 0, 4 },
  355. { "FLASHLIGHT", 0, 1 },
  356. { "FLASHLIGHTSHADOWS", 0, 1 },
  357. };
  358. static const ShaderComboInformation_t s_StaticComboArray_IceSurface_ps30[8] =
  359. {
  360. { "BACK_SURFACE", 0, 1 },
  361. { "LIGHT_WARP", 0, 1 },
  362. { "FRESNEL_WARP", 0, 1 },
  363. { "HIGH_PRECISION_DEPTH", 0, 1 },
  364. { "INTERIOR_LAYER", 0, 1 },
  365. { "OPACITY_TEXTURE", 0, 1 },
  366. { "FLASHLIGHTDEPTHFILTERMODE", 0, 2 },
  367. { "CONTACT_SHADOW", 0, 1 },
  368. };
  369. static const ShaderComboSemantics_t IceSurface_ps30_combos =
  370. {
  371. "IceSurface_ps30", s_DynamicComboArray_IceSurface_ps30, 3, s_StaticComboArray_IceSurface_ps30, 8
  372. };
  373. class ConstructMe_IceSurface_ps30
  374. {
  375. public:
  376. ConstructMe_IceSurface_ps30()
  377. {
  378. GetShaderDLL()->AddShaderComboInformation( &IceSurface_ps30_combos );
  379. }
  380. };
  381. static ConstructMe_IceSurface_ps30 s_ConstructMe_IceSurface_ps30;