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.

510 lines
12 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. // 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. #include "shaderlib/cshader.h"
  23. class flesh_ps30_Static_Index
  24. {
  25. private:
  26. int m_nALPHABLEND;
  27. #ifdef _DEBUG
  28. bool m_bALPHABLEND;
  29. #endif
  30. public:
  31. void SetALPHABLEND( int i )
  32. {
  33. Assert( i >= 0 && i <= 1 );
  34. m_nALPHABLEND = i;
  35. #ifdef _DEBUG
  36. m_bALPHABLEND = true;
  37. #endif
  38. }
  39. void SetALPHABLEND( bool i )
  40. {
  41. m_nALPHABLEND = i ? 1 : 0;
  42. #ifdef _DEBUG
  43. m_bALPHABLEND = true;
  44. #endif
  45. }
  46. private:
  47. int m_nTRANSMAT;
  48. #ifdef _DEBUG
  49. bool m_bTRANSMAT;
  50. #endif
  51. public:
  52. void SetTRANSMAT( int i )
  53. {
  54. Assert( i >= 0 && i <= 1 );
  55. m_nTRANSMAT = i;
  56. #ifdef _DEBUG
  57. m_bTRANSMAT = true;
  58. #endif
  59. }
  60. void SetTRANSMAT( bool i )
  61. {
  62. m_nTRANSMAT = i ? 1 : 0;
  63. #ifdef _DEBUG
  64. m_bTRANSMAT = true;
  65. #endif
  66. }
  67. private:
  68. int m_nFRESNEL_WARP;
  69. #ifdef _DEBUG
  70. bool m_bFRESNEL_WARP;
  71. #endif
  72. public:
  73. void SetFRESNEL_WARP( int i )
  74. {
  75. Assert( i >= 0 && i <= 1 );
  76. m_nFRESNEL_WARP = i;
  77. #ifdef _DEBUG
  78. m_bFRESNEL_WARP = true;
  79. #endif
  80. }
  81. void SetFRESNEL_WARP( bool i )
  82. {
  83. m_nFRESNEL_WARP = i ? 1 : 0;
  84. #ifdef _DEBUG
  85. m_bFRESNEL_WARP = true;
  86. #endif
  87. }
  88. private:
  89. int m_nEFFECTS;
  90. #ifdef _DEBUG
  91. bool m_bEFFECTS;
  92. #endif
  93. public:
  94. void SetEFFECTS( int i )
  95. {
  96. Assert( i >= 0 && i <= 1 );
  97. m_nEFFECTS = i;
  98. #ifdef _DEBUG
  99. m_bEFFECTS = true;
  100. #endif
  101. }
  102. void SetEFFECTS( bool i )
  103. {
  104. m_nEFFECTS = i ? 1 : 0;
  105. #ifdef _DEBUG
  106. m_bEFFECTS = true;
  107. #endif
  108. }
  109. private:
  110. int m_nTINTING;
  111. #ifdef _DEBUG
  112. bool m_bTINTING;
  113. #endif
  114. public:
  115. void SetTINTING( int i )
  116. {
  117. Assert( i >= 0 && i <= 1 );
  118. m_nTINTING = i;
  119. #ifdef _DEBUG
  120. m_bTINTING = true;
  121. #endif
  122. }
  123. void SetTINTING( bool i )
  124. {
  125. m_nTINTING = i ? 1 : 0;
  126. #ifdef _DEBUG
  127. m_bTINTING = true;
  128. #endif
  129. }
  130. private:
  131. int m_nIRIDESCENCE;
  132. #ifdef _DEBUG
  133. bool m_bIRIDESCENCE;
  134. #endif
  135. public:
  136. void SetIRIDESCENCE( int i )
  137. {
  138. Assert( i >= 0 && i <= 1 );
  139. m_nIRIDESCENCE = i;
  140. #ifdef _DEBUG
  141. m_bIRIDESCENCE = true;
  142. #endif
  143. }
  144. void SetIRIDESCENCE( bool i )
  145. {
  146. m_nIRIDESCENCE = i ? 1 : 0;
  147. #ifdef _DEBUG
  148. m_bIRIDESCENCE = true;
  149. #endif
  150. }
  151. private:
  152. int m_nBACK_SCATTER;
  153. #ifdef _DEBUG
  154. bool m_bBACK_SCATTER;
  155. #endif
  156. public:
  157. void SetBACK_SCATTER( int i )
  158. {
  159. Assert( i >= 0 && i <= 1 );
  160. m_nBACK_SCATTER = i;
  161. #ifdef _DEBUG
  162. m_bBACK_SCATTER = true;
  163. #endif
  164. }
  165. void SetBACK_SCATTER( bool i )
  166. {
  167. m_nBACK_SCATTER = i ? 1 : 0;
  168. #ifdef _DEBUG
  169. m_bBACK_SCATTER = true;
  170. #endif
  171. }
  172. private:
  173. int m_nFORWARD_SCATTER;
  174. #ifdef _DEBUG
  175. bool m_bFORWARD_SCATTER;
  176. #endif
  177. public:
  178. void SetFORWARD_SCATTER( int i )
  179. {
  180. Assert( i >= 0 && i <= 1 );
  181. m_nFORWARD_SCATTER = i;
  182. #ifdef _DEBUG
  183. m_bFORWARD_SCATTER = true;
  184. #endif
  185. }
  186. void SetFORWARD_SCATTER( bool i )
  187. {
  188. m_nFORWARD_SCATTER = i ? 1 : 0;
  189. #ifdef _DEBUG
  190. m_bFORWARD_SCATTER = true;
  191. #endif
  192. }
  193. private:
  194. int m_nHIGH_PRECISION_DEPTH;
  195. #ifdef _DEBUG
  196. bool m_bHIGH_PRECISION_DEPTH;
  197. #endif
  198. public:
  199. void SetHIGH_PRECISION_DEPTH( int i )
  200. {
  201. Assert( i >= 0 && i <= 1 );
  202. m_nHIGH_PRECISION_DEPTH = i;
  203. #ifdef _DEBUG
  204. m_bHIGH_PRECISION_DEPTH = true;
  205. #endif
  206. }
  207. void SetHIGH_PRECISION_DEPTH( bool i )
  208. {
  209. m_nHIGH_PRECISION_DEPTH = i ? 1 : 0;
  210. #ifdef _DEBUG
  211. m_bHIGH_PRECISION_DEPTH = true;
  212. #endif
  213. }
  214. private:
  215. int m_nINTERIOR_LAYER;
  216. #ifdef _DEBUG
  217. bool m_bINTERIOR_LAYER;
  218. #endif
  219. public:
  220. void SetINTERIOR_LAYER( int i )
  221. {
  222. Assert( i >= 0 && i <= 1 );
  223. m_nINTERIOR_LAYER = i;
  224. #ifdef _DEBUG
  225. m_bINTERIOR_LAYER = true;
  226. #endif
  227. }
  228. void SetINTERIOR_LAYER( bool i )
  229. {
  230. m_nINTERIOR_LAYER = i ? 1 : 0;
  231. #ifdef _DEBUG
  232. m_bINTERIOR_LAYER = true;
  233. #endif
  234. }
  235. private:
  236. int m_nOPACITY_TEXTURE;
  237. #ifdef _DEBUG
  238. bool m_bOPACITY_TEXTURE;
  239. #endif
  240. public:
  241. void SetOPACITY_TEXTURE( int i )
  242. {
  243. Assert( i >= 0 && i <= 1 );
  244. m_nOPACITY_TEXTURE = i;
  245. #ifdef _DEBUG
  246. m_bOPACITY_TEXTURE = true;
  247. #endif
  248. }
  249. void SetOPACITY_TEXTURE( bool i )
  250. {
  251. m_nOPACITY_TEXTURE = i ? 1 : 0;
  252. #ifdef _DEBUG
  253. m_bOPACITY_TEXTURE = true;
  254. #endif
  255. }
  256. private:
  257. int m_nNORMAL2SOFT;
  258. #ifdef _DEBUG
  259. bool m_bNORMAL2SOFT;
  260. #endif
  261. public:
  262. void SetNORMAL2SOFT( int i )
  263. {
  264. Assert( i >= 0 && i <= 1 );
  265. m_nNORMAL2SOFT = i;
  266. #ifdef _DEBUG
  267. m_bNORMAL2SOFT = true;
  268. #endif
  269. }
  270. void SetNORMAL2SOFT( bool i )
  271. {
  272. m_nNORMAL2SOFT = i ? 1 : 0;
  273. #ifdef _DEBUG
  274. m_bNORMAL2SOFT = true;
  275. #endif
  276. }
  277. private:
  278. int m_nDETAIL;
  279. #ifdef _DEBUG
  280. bool m_bDETAIL;
  281. #endif
  282. public:
  283. void SetDETAIL( int i )
  284. {
  285. Assert( i >= 0 && i <= 1 );
  286. m_nDETAIL = i;
  287. #ifdef _DEBUG
  288. m_bDETAIL = true;
  289. #endif
  290. }
  291. void SetDETAIL( bool i )
  292. {
  293. m_nDETAIL = i ? 1 : 0;
  294. #ifdef _DEBUG
  295. m_bDETAIL = true;
  296. #endif
  297. }
  298. private:
  299. int m_nFLASHLIGHTDEPTHFILTERMODE;
  300. #ifdef _DEBUG
  301. bool m_bFLASHLIGHTDEPTHFILTERMODE;
  302. #endif
  303. public:
  304. void SetFLASHLIGHTDEPTHFILTERMODE( int i )
  305. {
  306. Assert( i >= 0 && i <= 2 );
  307. m_nFLASHLIGHTDEPTHFILTERMODE = i;
  308. #ifdef _DEBUG
  309. m_bFLASHLIGHTDEPTHFILTERMODE = true;
  310. #endif
  311. }
  312. void SetFLASHLIGHTDEPTHFILTERMODE( bool i )
  313. {
  314. m_nFLASHLIGHTDEPTHFILTERMODE = i ? 1 : 0;
  315. #ifdef _DEBUG
  316. m_bFLASHLIGHTDEPTHFILTERMODE = true;
  317. #endif
  318. }
  319. public:
  320. // CONSTRUCTOR
  321. flesh_ps30_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  322. {
  323. #ifdef _DEBUG
  324. m_bALPHABLEND = false;
  325. #endif // _DEBUG
  326. m_nALPHABLEND = 0;
  327. #ifdef _DEBUG
  328. m_bTRANSMAT = false;
  329. #endif // _DEBUG
  330. m_nTRANSMAT = 0;
  331. #ifdef _DEBUG
  332. m_bFRESNEL_WARP = false;
  333. #endif // _DEBUG
  334. m_nFRESNEL_WARP = 0;
  335. #ifdef _DEBUG
  336. m_bEFFECTS = false;
  337. #endif // _DEBUG
  338. m_nEFFECTS = 0;
  339. #ifdef _DEBUG
  340. m_bTINTING = false;
  341. #endif // _DEBUG
  342. m_nTINTING = 0;
  343. #ifdef _DEBUG
  344. m_bIRIDESCENCE = false;
  345. #endif // _DEBUG
  346. m_nIRIDESCENCE = 0;
  347. #ifdef _DEBUG
  348. m_bBACK_SCATTER = false;
  349. #endif // _DEBUG
  350. m_nBACK_SCATTER = 0;
  351. #ifdef _DEBUG
  352. m_bFORWARD_SCATTER = false;
  353. #endif // _DEBUG
  354. m_nFORWARD_SCATTER = 0;
  355. #ifdef _DEBUG
  356. m_bHIGH_PRECISION_DEPTH = false;
  357. #endif // _DEBUG
  358. m_nHIGH_PRECISION_DEPTH = 0;
  359. #ifdef _DEBUG
  360. m_bINTERIOR_LAYER = false;
  361. #endif // _DEBUG
  362. m_nINTERIOR_LAYER = 0;
  363. #ifdef _DEBUG
  364. m_bOPACITY_TEXTURE = false;
  365. #endif // _DEBUG
  366. m_nOPACITY_TEXTURE = 0;
  367. #ifdef _DEBUG
  368. m_bNORMAL2SOFT = false;
  369. #endif // _DEBUG
  370. m_nNORMAL2SOFT = 0;
  371. #ifdef _DEBUG
  372. m_bDETAIL = false;
  373. #endif // _DEBUG
  374. m_nDETAIL = 0;
  375. #ifdef _DEBUG
  376. m_bFLASHLIGHTDEPTHFILTERMODE = false;
  377. #endif // _DEBUG
  378. m_nFLASHLIGHTDEPTHFILTERMODE = 0;
  379. }
  380. int GetIndex()
  381. {
  382. // Asserts to make sure that we aren't using any skipped combinations.
  383. // Asserts to make sure that we are setting all of the combination vars.
  384. #ifdef _DEBUG
  385. bool bAllStaticVarsDefined = m_bALPHABLEND && m_bTRANSMAT && m_bFRESNEL_WARP && m_bEFFECTS && m_bTINTING && m_bIRIDESCENCE && m_bBACK_SCATTER && m_bFORWARD_SCATTER && m_bHIGH_PRECISION_DEPTH && m_bINTERIOR_LAYER && m_bOPACITY_TEXTURE && m_bNORMAL2SOFT && m_bDETAIL && m_bFLASHLIGHTDEPTHFILTERMODE;
  386. Assert( bAllStaticVarsDefined );
  387. #endif // _DEBUG
  388. return ( 40 * m_nALPHABLEND ) + ( 80 * m_nTRANSMAT ) + ( 160 * m_nFRESNEL_WARP ) + ( 320 * m_nEFFECTS ) + ( 640 * m_nTINTING ) + ( 1280 * m_nIRIDESCENCE ) + ( 2560 * m_nBACK_SCATTER ) + ( 5120 * m_nFORWARD_SCATTER ) + ( 10240 * m_nHIGH_PRECISION_DEPTH ) + ( 20480 * m_nINTERIOR_LAYER ) + ( 40960 * m_nOPACITY_TEXTURE ) + ( 81920 * m_nNORMAL2SOFT ) + ( 163840 * m_nDETAIL ) + ( 327680 * m_nFLASHLIGHTDEPTHFILTERMODE ) + 0;
  389. }
  390. };
  391. #define shaderStaticTest_flesh_ps30 psh_forgot_to_set_static_ALPHABLEND + psh_forgot_to_set_static_TRANSMAT + psh_forgot_to_set_static_FRESNEL_WARP + psh_forgot_to_set_static_EFFECTS + psh_forgot_to_set_static_TINTING + psh_forgot_to_set_static_IRIDESCENCE + psh_forgot_to_set_static_BACK_SCATTER + psh_forgot_to_set_static_FORWARD_SCATTER + 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_NORMAL2SOFT + psh_forgot_to_set_static_DETAIL + psh_forgot_to_set_static_FLASHLIGHTDEPTHFILTERMODE + 0
  392. class flesh_ps30_Dynamic_Index
  393. {
  394. private:
  395. int m_nPIXELFOGTYPE;
  396. #ifdef _DEBUG
  397. bool m_bPIXELFOGTYPE;
  398. #endif
  399. public:
  400. void SetPIXELFOGTYPE( int i )
  401. {
  402. Assert( i >= 0 && i <= 1 );
  403. m_nPIXELFOGTYPE = i;
  404. #ifdef _DEBUG
  405. m_bPIXELFOGTYPE = true;
  406. #endif
  407. }
  408. void SetPIXELFOGTYPE( bool i )
  409. {
  410. m_nPIXELFOGTYPE = i ? 1 : 0;
  411. #ifdef _DEBUG
  412. m_bPIXELFOGTYPE = true;
  413. #endif
  414. }
  415. private:
  416. int m_nNUM_LIGHTS;
  417. #ifdef _DEBUG
  418. bool m_bNUM_LIGHTS;
  419. #endif
  420. public:
  421. void SetNUM_LIGHTS( int i )
  422. {
  423. Assert( i >= 0 && i <= 4 );
  424. m_nNUM_LIGHTS = i;
  425. #ifdef _DEBUG
  426. m_bNUM_LIGHTS = true;
  427. #endif
  428. }
  429. void SetNUM_LIGHTS( bool i )
  430. {
  431. m_nNUM_LIGHTS = i ? 1 : 0;
  432. #ifdef _DEBUG
  433. m_bNUM_LIGHTS = true;
  434. #endif
  435. }
  436. private:
  437. int m_nFLASHLIGHT;
  438. #ifdef _DEBUG
  439. bool m_bFLASHLIGHT;
  440. #endif
  441. public:
  442. void SetFLASHLIGHT( int i )
  443. {
  444. Assert( i >= 0 && i <= 1 );
  445. m_nFLASHLIGHT = i;
  446. #ifdef _DEBUG
  447. m_bFLASHLIGHT = true;
  448. #endif
  449. }
  450. void SetFLASHLIGHT( bool i )
  451. {
  452. m_nFLASHLIGHT = i ? 1 : 0;
  453. #ifdef _DEBUG
  454. m_bFLASHLIGHT = true;
  455. #endif
  456. }
  457. private:
  458. int m_nFLASHLIGHTSHADOWS;
  459. #ifdef _DEBUG
  460. bool m_bFLASHLIGHTSHADOWS;
  461. #endif
  462. public:
  463. void SetFLASHLIGHTSHADOWS( int i )
  464. {
  465. Assert( i >= 0 && i <= 1 );
  466. m_nFLASHLIGHTSHADOWS = i;
  467. #ifdef _DEBUG
  468. m_bFLASHLIGHTSHADOWS = true;
  469. #endif
  470. }
  471. void SetFLASHLIGHTSHADOWS( bool i )
  472. {
  473. m_nFLASHLIGHTSHADOWS = i ? 1 : 0;
  474. #ifdef _DEBUG
  475. m_bFLASHLIGHTSHADOWS = true;
  476. #endif
  477. }
  478. public:
  479. // CONSTRUCTOR
  480. flesh_ps30_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  481. {
  482. #ifdef _DEBUG
  483. m_bPIXELFOGTYPE = true;
  484. #endif // _DEBUG
  485. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  486. #ifdef _DEBUG
  487. m_bNUM_LIGHTS = false;
  488. #endif // _DEBUG
  489. m_nNUM_LIGHTS = 0;
  490. #ifdef _DEBUG
  491. m_bFLASHLIGHT = false;
  492. #endif // _DEBUG
  493. m_nFLASHLIGHT = 0;
  494. #ifdef _DEBUG
  495. m_bFLASHLIGHTSHADOWS = false;
  496. #endif // _DEBUG
  497. m_nFLASHLIGHTSHADOWS = 0;
  498. }
  499. int GetIndex()
  500. {
  501. // Asserts to make sure that we aren't using any skipped combinations.
  502. // Asserts to make sure that we are setting all of the combination vars.
  503. #ifdef _DEBUG
  504. bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE && m_bNUM_LIGHTS && m_bFLASHLIGHT && m_bFLASHLIGHTSHADOWS;
  505. Assert( bAllDynamicVarsDefined );
  506. #endif // _DEBUG
  507. return ( 1 * m_nPIXELFOGTYPE ) + ( 2 * m_nNUM_LIGHTS ) + ( 10 * m_nFLASHLIGHT ) + ( 20 * m_nFLASHLIGHTSHADOWS ) + 0;
  508. }
  509. };
  510. #define shaderDynamicTest_flesh_ps30 psh_forgot_to_set_dynamic_NUM_LIGHTS + psh_forgot_to_set_dynamic_FLASHLIGHT + psh_forgot_to_set_dynamic_FLASHLIGHTSHADOWS + 0