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.

470 lines
12 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $CONTACT_SHADOW == 1 ) && ( $SELF_ILLUM_PULSE == 1 )
  3. // ( $BACK_SURFACE == 1 ) && ( $LIGHT_WARP > 0 )
  4. // ( $BACK_SURFACE == 1 ) && ( $FRESNEL_WARP > 0 )
  5. // ( $BACK_SURFACE == 1 ) && ( $INTERIOR_LAYER > 0 )
  6. // ( $BACK_SURFACE == 1 ) && ( $SELF_ILLUM_FRESNEL > 0 )
  7. // ( $BACK_SURFACE == 1 ) && ( $OPACITY_TEXTURE > 0 )
  8. // ( $BACK_SURFACE == 1 ) && ( $CONTACT_SHADOW > 0 )
  9. // ( $BACK_SURFACE == 1 ) && ( $SELF_ILLUM_PULSE > 0 )
  10. // ( $BACK_SURFACE == 1 ) && ( $VOLUME_TEXTURE > 0 )
  11. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  12. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  13. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  14. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  15. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  16. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  17. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  18. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  19. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  20. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  21. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  22. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  23. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  24. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  25. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  26. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  27. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  28. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  29. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  30. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  31. #include "shaderlib/cshader.h"
  32. class blob_ps30_Static_Index
  33. {
  34. private:
  35. int m_nBACK_SURFACE;
  36. #ifdef _DEBUG
  37. bool m_bBACK_SURFACE;
  38. #endif
  39. public:
  40. void SetBACK_SURFACE( int i )
  41. {
  42. Assert( i >= 0 && i <= 1 );
  43. m_nBACK_SURFACE = i;
  44. #ifdef _DEBUG
  45. m_bBACK_SURFACE = true;
  46. #endif
  47. }
  48. void SetBACK_SURFACE( bool i )
  49. {
  50. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  51. m_nBACK_SURFACE = i ? 1 : 0;
  52. #ifdef _DEBUG
  53. m_bBACK_SURFACE = true;
  54. #endif
  55. }
  56. private:
  57. int m_nLIGHT_WARP;
  58. #ifdef _DEBUG
  59. bool m_bLIGHT_WARP;
  60. #endif
  61. public:
  62. void SetLIGHT_WARP( int i )
  63. {
  64. Assert( i >= 0 && i <= 1 );
  65. m_nLIGHT_WARP = i;
  66. #ifdef _DEBUG
  67. m_bLIGHT_WARP = true;
  68. #endif
  69. }
  70. void SetLIGHT_WARP( bool i )
  71. {
  72. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  73. m_nLIGHT_WARP = i ? 1 : 0;
  74. #ifdef _DEBUG
  75. m_bLIGHT_WARP = true;
  76. #endif
  77. }
  78. private:
  79. int m_nFRESNEL_WARP;
  80. #ifdef _DEBUG
  81. bool m_bFRESNEL_WARP;
  82. #endif
  83. public:
  84. void SetFRESNEL_WARP( int i )
  85. {
  86. Assert( i >= 0 && i <= 1 );
  87. m_nFRESNEL_WARP = i;
  88. #ifdef _DEBUG
  89. m_bFRESNEL_WARP = true;
  90. #endif
  91. }
  92. void SetFRESNEL_WARP( bool i )
  93. {
  94. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  95. m_nFRESNEL_WARP = i ? 1 : 0;
  96. #ifdef _DEBUG
  97. m_bFRESNEL_WARP = true;
  98. #endif
  99. }
  100. private:
  101. int m_nHIGH_PRECISION_DEPTH;
  102. #ifdef _DEBUG
  103. bool m_bHIGH_PRECISION_DEPTH;
  104. #endif
  105. public:
  106. void SetHIGH_PRECISION_DEPTH( int i )
  107. {
  108. Assert( i >= 0 && i <= 1 );
  109. m_nHIGH_PRECISION_DEPTH = i;
  110. #ifdef _DEBUG
  111. m_bHIGH_PRECISION_DEPTH = true;
  112. #endif
  113. }
  114. void SetHIGH_PRECISION_DEPTH( bool i )
  115. {
  116. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  117. m_nHIGH_PRECISION_DEPTH = i ? 1 : 0;
  118. #ifdef _DEBUG
  119. m_bHIGH_PRECISION_DEPTH = true;
  120. #endif
  121. }
  122. private:
  123. int m_nINTERIOR_LAYER;
  124. #ifdef _DEBUG
  125. bool m_bINTERIOR_LAYER;
  126. #endif
  127. public:
  128. void SetINTERIOR_LAYER( int i )
  129. {
  130. Assert( i >= 0 && i <= 1 );
  131. m_nINTERIOR_LAYER = i;
  132. #ifdef _DEBUG
  133. m_bINTERIOR_LAYER = true;
  134. #endif
  135. }
  136. void SetINTERIOR_LAYER( bool i )
  137. {
  138. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  139. m_nINTERIOR_LAYER = i ? 1 : 0;
  140. #ifdef _DEBUG
  141. m_bINTERIOR_LAYER = true;
  142. #endif
  143. }
  144. private:
  145. int m_nSELF_ILLUM_FRESNEL;
  146. #ifdef _DEBUG
  147. bool m_bSELF_ILLUM_FRESNEL;
  148. #endif
  149. public:
  150. void SetSELF_ILLUM_FRESNEL( int i )
  151. {
  152. Assert( i >= 0 && i <= 1 );
  153. m_nSELF_ILLUM_FRESNEL = i;
  154. #ifdef _DEBUG
  155. m_bSELF_ILLUM_FRESNEL = true;
  156. #endif
  157. }
  158. void SetSELF_ILLUM_FRESNEL( bool i )
  159. {
  160. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  161. m_nSELF_ILLUM_FRESNEL = i ? 1 : 0;
  162. #ifdef _DEBUG
  163. m_bSELF_ILLUM_FRESNEL = true;
  164. #endif
  165. }
  166. private:
  167. int m_nOPACITY_TEXTURE;
  168. #ifdef _DEBUG
  169. bool m_bOPACITY_TEXTURE;
  170. #endif
  171. public:
  172. void SetOPACITY_TEXTURE( int i )
  173. {
  174. Assert( i >= 0 && i <= 1 );
  175. m_nOPACITY_TEXTURE = i;
  176. #ifdef _DEBUG
  177. m_bOPACITY_TEXTURE = true;
  178. #endif
  179. }
  180. void SetOPACITY_TEXTURE( bool i )
  181. {
  182. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  183. m_nOPACITY_TEXTURE = i ? 1 : 0;
  184. #ifdef _DEBUG
  185. m_bOPACITY_TEXTURE = true;
  186. #endif
  187. }
  188. private:
  189. int m_nFLASHLIGHTDEPTHFILTERMODE;
  190. #ifdef _DEBUG
  191. bool m_bFLASHLIGHTDEPTHFILTERMODE;
  192. #endif
  193. public:
  194. void SetFLASHLIGHTDEPTHFILTERMODE( int i )
  195. {
  196. Assert( i >= 0 && i <= 2 );
  197. m_nFLASHLIGHTDEPTHFILTERMODE = i;
  198. #ifdef _DEBUG
  199. m_bFLASHLIGHTDEPTHFILTERMODE = true;
  200. #endif
  201. }
  202. void SetFLASHLIGHTDEPTHFILTERMODE( bool i )
  203. {
  204. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  205. m_nFLASHLIGHTDEPTHFILTERMODE = i ? 1 : 0;
  206. #ifdef _DEBUG
  207. m_bFLASHLIGHTDEPTHFILTERMODE = true;
  208. #endif
  209. }
  210. private:
  211. int m_nCONTACT_SHADOW;
  212. #ifdef _DEBUG
  213. bool m_bCONTACT_SHADOW;
  214. #endif
  215. public:
  216. void SetCONTACT_SHADOW( int i )
  217. {
  218. Assert( i >= 0 && i <= 1 );
  219. m_nCONTACT_SHADOW = i;
  220. #ifdef _DEBUG
  221. m_bCONTACT_SHADOW = true;
  222. #endif
  223. }
  224. void SetCONTACT_SHADOW( bool i )
  225. {
  226. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  227. m_nCONTACT_SHADOW = i ? 1 : 0;
  228. #ifdef _DEBUG
  229. m_bCONTACT_SHADOW = true;
  230. #endif
  231. }
  232. private:
  233. int m_nSELF_ILLUM_PULSE;
  234. #ifdef _DEBUG
  235. bool m_bSELF_ILLUM_PULSE;
  236. #endif
  237. public:
  238. void SetSELF_ILLUM_PULSE( int i )
  239. {
  240. Assert( i >= 0 && i <= 1 );
  241. m_nSELF_ILLUM_PULSE = i;
  242. #ifdef _DEBUG
  243. m_bSELF_ILLUM_PULSE = true;
  244. #endif
  245. }
  246. void SetSELF_ILLUM_PULSE( bool i )
  247. {
  248. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  249. m_nSELF_ILLUM_PULSE = i ? 1 : 0;
  250. #ifdef _DEBUG
  251. m_bSELF_ILLUM_PULSE = true;
  252. #endif
  253. }
  254. private:
  255. int m_nVOLUME_TEXTURE;
  256. #ifdef _DEBUG
  257. bool m_bVOLUME_TEXTURE;
  258. #endif
  259. public:
  260. void SetVOLUME_TEXTURE( int i )
  261. {
  262. Assert( i >= 0 && i <= 1 );
  263. m_nVOLUME_TEXTURE = i;
  264. #ifdef _DEBUG
  265. m_bVOLUME_TEXTURE = true;
  266. #endif
  267. }
  268. void SetVOLUME_TEXTURE( bool i )
  269. {
  270. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  271. m_nVOLUME_TEXTURE = i ? 1 : 0;
  272. #ifdef _DEBUG
  273. m_bVOLUME_TEXTURE = true;
  274. #endif
  275. }
  276. public:
  277. // CONSTRUCTOR
  278. blob_ps30_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  279. {
  280. #ifdef _DEBUG
  281. m_bBACK_SURFACE = false;
  282. #endif // _DEBUG
  283. m_nBACK_SURFACE = 0;
  284. #ifdef _DEBUG
  285. m_bLIGHT_WARP = false;
  286. #endif // _DEBUG
  287. m_nLIGHT_WARP = 0;
  288. #ifdef _DEBUG
  289. m_bFRESNEL_WARP = false;
  290. #endif // _DEBUG
  291. m_nFRESNEL_WARP = 0;
  292. #ifdef _DEBUG
  293. m_bHIGH_PRECISION_DEPTH = false;
  294. #endif // _DEBUG
  295. m_nHIGH_PRECISION_DEPTH = 0;
  296. #ifdef _DEBUG
  297. m_bINTERIOR_LAYER = false;
  298. #endif // _DEBUG
  299. m_nINTERIOR_LAYER = 0;
  300. #ifdef _DEBUG
  301. m_bSELF_ILLUM_FRESNEL = false;
  302. #endif // _DEBUG
  303. m_nSELF_ILLUM_FRESNEL = 0;
  304. #ifdef _DEBUG
  305. m_bOPACITY_TEXTURE = false;
  306. #endif // _DEBUG
  307. m_nOPACITY_TEXTURE = 0;
  308. #ifdef _DEBUG
  309. m_bFLASHLIGHTDEPTHFILTERMODE = false;
  310. #endif // _DEBUG
  311. m_nFLASHLIGHTDEPTHFILTERMODE = 0;
  312. #ifdef _DEBUG
  313. m_bCONTACT_SHADOW = false;
  314. #endif // _DEBUG
  315. m_nCONTACT_SHADOW = 0;
  316. #ifdef _DEBUG
  317. m_bSELF_ILLUM_PULSE = false;
  318. #endif // _DEBUG
  319. m_nSELF_ILLUM_PULSE = 0;
  320. #ifdef _DEBUG
  321. m_bVOLUME_TEXTURE = false;
  322. #endif // _DEBUG
  323. m_nVOLUME_TEXTURE = 0;
  324. }
  325. int GetIndex()
  326. {
  327. // Asserts to make sure that we aren't using any skipped combinations.
  328. // Asserts to make sure that we are setting all of the combination vars.
  329. #ifdef _DEBUG
  330. bool bAllStaticVarsDefined = m_bBACK_SURFACE && m_bLIGHT_WARP && m_bFRESNEL_WARP && m_bHIGH_PRECISION_DEPTH && m_bINTERIOR_LAYER && m_bSELF_ILLUM_FRESNEL && m_bOPACITY_TEXTURE && m_bFLASHLIGHTDEPTHFILTERMODE && m_bCONTACT_SHADOW && m_bSELF_ILLUM_PULSE && m_bVOLUME_TEXTURE;
  331. Assert( bAllStaticVarsDefined );
  332. #endif // _DEBUG
  333. return ( 20 * m_nBACK_SURFACE ) + ( 40 * m_nLIGHT_WARP ) + ( 80 * m_nFRESNEL_WARP ) + ( 160 * m_nHIGH_PRECISION_DEPTH ) + ( 320 * m_nINTERIOR_LAYER ) + ( 640 * m_nSELF_ILLUM_FRESNEL ) + ( 1280 * m_nOPACITY_TEXTURE ) + ( 2560 * m_nFLASHLIGHTDEPTHFILTERMODE ) + ( 7680 * m_nCONTACT_SHADOW ) + ( 15360 * m_nSELF_ILLUM_PULSE ) + ( 30720 * m_nVOLUME_TEXTURE ) + 0;
  334. }
  335. };
  336. #define shaderStaticTest_blob_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_SELF_ILLUM_FRESNEL + psh_forgot_to_set_static_OPACITY_TEXTURE + psh_forgot_to_set_static_FLASHLIGHTDEPTHFILTERMODE + psh_forgot_to_set_static_CONTACT_SHADOW + psh_forgot_to_set_static_SELF_ILLUM_PULSE + psh_forgot_to_set_static_VOLUME_TEXTURE + 0
  337. class blob_ps30_Dynamic_Index
  338. {
  339. private:
  340. int m_nNUM_LIGHTS;
  341. #ifdef _DEBUG
  342. bool m_bNUM_LIGHTS;
  343. #endif
  344. public:
  345. void SetNUM_LIGHTS( int i )
  346. {
  347. Assert( i >= 0 && i <= 4 );
  348. m_nNUM_LIGHTS = i;
  349. #ifdef _DEBUG
  350. m_bNUM_LIGHTS = true;
  351. #endif
  352. }
  353. void SetNUM_LIGHTS( bool i )
  354. {
  355. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 4 );
  356. m_nNUM_LIGHTS = i ? 1 : 0;
  357. #ifdef _DEBUG
  358. m_bNUM_LIGHTS = true;
  359. #endif
  360. }
  361. private:
  362. int m_nFLASHLIGHT;
  363. #ifdef _DEBUG
  364. bool m_bFLASHLIGHT;
  365. #endif
  366. public:
  367. void SetFLASHLIGHT( int i )
  368. {
  369. Assert( i >= 0 && i <= 1 );
  370. m_nFLASHLIGHT = i;
  371. #ifdef _DEBUG
  372. m_bFLASHLIGHT = true;
  373. #endif
  374. }
  375. void SetFLASHLIGHT( bool i )
  376. {
  377. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  378. m_nFLASHLIGHT = i ? 1 : 0;
  379. #ifdef _DEBUG
  380. m_bFLASHLIGHT = true;
  381. #endif
  382. }
  383. private:
  384. int m_nFLASHLIGHTSHADOWS;
  385. #ifdef _DEBUG
  386. bool m_bFLASHLIGHTSHADOWS;
  387. #endif
  388. public:
  389. void SetFLASHLIGHTSHADOWS( int i )
  390. {
  391. Assert( i >= 0 && i <= 1 );
  392. m_nFLASHLIGHTSHADOWS = i;
  393. #ifdef _DEBUG
  394. m_bFLASHLIGHTSHADOWS = true;
  395. #endif
  396. }
  397. void SetFLASHLIGHTSHADOWS( bool i )
  398. {
  399. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  400. m_nFLASHLIGHTSHADOWS = i ? 1 : 0;
  401. #ifdef _DEBUG
  402. m_bFLASHLIGHTSHADOWS = true;
  403. #endif
  404. }
  405. public:
  406. // CONSTRUCTOR
  407. blob_ps30_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  408. {
  409. #ifdef _DEBUG
  410. m_bNUM_LIGHTS = false;
  411. #endif // _DEBUG
  412. m_nNUM_LIGHTS = 0;
  413. #ifdef _DEBUG
  414. m_bFLASHLIGHT = false;
  415. #endif // _DEBUG
  416. m_nFLASHLIGHT = 0;
  417. #ifdef _DEBUG
  418. m_bFLASHLIGHTSHADOWS = false;
  419. #endif // _DEBUG
  420. m_nFLASHLIGHTSHADOWS = 0;
  421. }
  422. int GetIndex()
  423. {
  424. // Asserts to make sure that we aren't using any skipped combinations.
  425. // Asserts to make sure that we are setting all of the combination vars.
  426. #ifdef _DEBUG
  427. bool bAllDynamicVarsDefined = m_bNUM_LIGHTS && m_bFLASHLIGHT && m_bFLASHLIGHTSHADOWS;
  428. Assert( bAllDynamicVarsDefined );
  429. #endif // _DEBUG
  430. return ( 1 * m_nNUM_LIGHTS ) + ( 5 * m_nFLASHLIGHT ) + ( 10 * m_nFLASHLIGHTSHADOWS ) + 0;
  431. }
  432. };
  433. #define shaderDynamicTest_blob_ps30 psh_forgot_to_set_dynamic_NUM_LIGHTS + psh_forgot_to_set_dynamic_FLASHLIGHT + psh_forgot_to_set_dynamic_FLASHLIGHTSHADOWS + 0
  434. static const ShaderComboInformation_t s_DynamicComboArray_blob_ps30[3] =
  435. {
  436. { "NUM_LIGHTS", 0, 4 },
  437. { "FLASHLIGHT", 0, 1 },
  438. { "FLASHLIGHTSHADOWS", 0, 1 },
  439. };
  440. static const ShaderComboInformation_t s_StaticComboArray_blob_ps30[11] =
  441. {
  442. { "BACK_SURFACE", 0, 1 },
  443. { "LIGHT_WARP", 0, 1 },
  444. { "FRESNEL_WARP", 0, 1 },
  445. { "HIGH_PRECISION_DEPTH", 0, 1 },
  446. { "INTERIOR_LAYER", 0, 1 },
  447. { "SELF_ILLUM_FRESNEL", 0, 1 },
  448. { "OPACITY_TEXTURE", 0, 1 },
  449. { "FLASHLIGHTDEPTHFILTERMODE", 0, 2 },
  450. { "CONTACT_SHADOW", 0, 1 },
  451. { "SELF_ILLUM_PULSE", 0, 1 },
  452. { "VOLUME_TEXTURE", 0, 1 },
  453. };
  454. static const ShaderComboSemantics_t blob_ps30_combos =
  455. {
  456. "blob_ps30", s_DynamicComboArray_blob_ps30, 3, s_StaticComboArray_blob_ps30, 11
  457. };
  458. class ConstructMe_blob_ps30
  459. {
  460. public:
  461. ConstructMe_blob_ps30()
  462. {
  463. GetShaderDLL()->AddShaderComboInformation( &blob_ps30_combos );
  464. }
  465. };
  466. static ConstructMe_blob_ps30 s_ConstructMe_blob_ps30;