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.

536 lines
12 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( ( $DETAIL1 == 0 ) && ( $DETAIL2 != 0 ) )
  3. // ( ( $DETAIL1 == 0 ) && ( $DETAIL1BLENDMODE != 0 ) )
  4. // ( ( $DETAIL2 == 0 ) && ( $DETAIL2BLENDMODE != 0 ) )
  5. // ( $TANGENTTOPACITY && $TANGENTSOPACITY )
  6. // ( $FRESNELOPACITY ) && ( $TANGENTTOPACITY || $TANGENTSOPACITY )
  7. // ( $FLOWMAP && ( $DETAIL1 || $DETAIL2 ) )
  8. // ( $FLOW_CHEAP && !$FLOWMAP )
  9. // ( ( $FLOWMAP == 0 ) && ( $VORTEX1 || $VORTEX2 || $POWERUP ) )
  10. // ( ( $ACTIVE == 0 ) && ( $VORTEX1 || $VORTEX2 || $POWERUP ) )
  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. #include "shaderlib/cshader.h"
  17. class solidenergy_ps20b_Static_Index
  18. {
  19. private:
  20. int m_nADDITIVE;
  21. #ifdef _DEBUG
  22. bool m_bADDITIVE;
  23. #endif
  24. public:
  25. void SetADDITIVE( int i )
  26. {
  27. Assert( i >= 0 && i <= 1 );
  28. m_nADDITIVE = i;
  29. #ifdef _DEBUG
  30. m_bADDITIVE = true;
  31. #endif
  32. }
  33. void SetADDITIVE( bool i )
  34. {
  35. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  36. m_nADDITIVE = i ? 1 : 0;
  37. #ifdef _DEBUG
  38. m_bADDITIVE = true;
  39. #endif
  40. }
  41. private:
  42. int m_nDETAIL1;
  43. #ifdef _DEBUG
  44. bool m_bDETAIL1;
  45. #endif
  46. public:
  47. void SetDETAIL1( int i )
  48. {
  49. Assert( i >= 0 && i <= 1 );
  50. m_nDETAIL1 = i;
  51. #ifdef _DEBUG
  52. m_bDETAIL1 = true;
  53. #endif
  54. }
  55. void SetDETAIL1( bool i )
  56. {
  57. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  58. m_nDETAIL1 = i ? 1 : 0;
  59. #ifdef _DEBUG
  60. m_bDETAIL1 = true;
  61. #endif
  62. }
  63. private:
  64. int m_nDETAIL1BLENDMODE;
  65. #ifdef _DEBUG
  66. bool m_bDETAIL1BLENDMODE;
  67. #endif
  68. public:
  69. void SetDETAIL1BLENDMODE( int i )
  70. {
  71. Assert( i >= 0 && i <= 1 );
  72. m_nDETAIL1BLENDMODE = i;
  73. #ifdef _DEBUG
  74. m_bDETAIL1BLENDMODE = true;
  75. #endif
  76. }
  77. void SetDETAIL1BLENDMODE( bool i )
  78. {
  79. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  80. m_nDETAIL1BLENDMODE = i ? 1 : 0;
  81. #ifdef _DEBUG
  82. m_bDETAIL1BLENDMODE = true;
  83. #endif
  84. }
  85. private:
  86. int m_nDETAIL2;
  87. #ifdef _DEBUG
  88. bool m_bDETAIL2;
  89. #endif
  90. public:
  91. void SetDETAIL2( int i )
  92. {
  93. Assert( i >= 0 && i <= 1 );
  94. m_nDETAIL2 = i;
  95. #ifdef _DEBUG
  96. m_bDETAIL2 = true;
  97. #endif
  98. }
  99. void SetDETAIL2( bool i )
  100. {
  101. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  102. m_nDETAIL2 = i ? 1 : 0;
  103. #ifdef _DEBUG
  104. m_bDETAIL2 = true;
  105. #endif
  106. }
  107. private:
  108. int m_nDETAIL2BLENDMODE;
  109. #ifdef _DEBUG
  110. bool m_bDETAIL2BLENDMODE;
  111. #endif
  112. public:
  113. void SetDETAIL2BLENDMODE( int i )
  114. {
  115. Assert( i >= 0 && i <= 1 );
  116. m_nDETAIL2BLENDMODE = i;
  117. #ifdef _DEBUG
  118. m_bDETAIL2BLENDMODE = true;
  119. #endif
  120. }
  121. void SetDETAIL2BLENDMODE( bool i )
  122. {
  123. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  124. m_nDETAIL2BLENDMODE = i ? 1 : 0;
  125. #ifdef _DEBUG
  126. m_bDETAIL2BLENDMODE = true;
  127. #endif
  128. }
  129. private:
  130. int m_nTANGENTTOPACITY;
  131. #ifdef _DEBUG
  132. bool m_bTANGENTTOPACITY;
  133. #endif
  134. public:
  135. void SetTANGENTTOPACITY( int i )
  136. {
  137. Assert( i >= 0 && i <= 1 );
  138. m_nTANGENTTOPACITY = i;
  139. #ifdef _DEBUG
  140. m_bTANGENTTOPACITY = true;
  141. #endif
  142. }
  143. void SetTANGENTTOPACITY( bool i )
  144. {
  145. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  146. m_nTANGENTTOPACITY = i ? 1 : 0;
  147. #ifdef _DEBUG
  148. m_bTANGENTTOPACITY = true;
  149. #endif
  150. }
  151. private:
  152. int m_nTANGENTSOPACITY;
  153. #ifdef _DEBUG
  154. bool m_bTANGENTSOPACITY;
  155. #endif
  156. public:
  157. void SetTANGENTSOPACITY( int i )
  158. {
  159. Assert( i >= 0 && i <= 1 );
  160. m_nTANGENTSOPACITY = i;
  161. #ifdef _DEBUG
  162. m_bTANGENTSOPACITY = true;
  163. #endif
  164. }
  165. void SetTANGENTSOPACITY( bool i )
  166. {
  167. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  168. m_nTANGENTSOPACITY = i ? 1 : 0;
  169. #ifdef _DEBUG
  170. m_bTANGENTSOPACITY = true;
  171. #endif
  172. }
  173. private:
  174. int m_nFRESNELOPACITY;
  175. #ifdef _DEBUG
  176. bool m_bFRESNELOPACITY;
  177. #endif
  178. public:
  179. void SetFRESNELOPACITY( int i )
  180. {
  181. Assert( i >= 0 && i <= 1 );
  182. m_nFRESNELOPACITY = i;
  183. #ifdef _DEBUG
  184. m_bFRESNELOPACITY = true;
  185. #endif
  186. }
  187. void SetFRESNELOPACITY( bool i )
  188. {
  189. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  190. m_nFRESNELOPACITY = i ? 1 : 0;
  191. #ifdef _DEBUG
  192. m_bFRESNELOPACITY = true;
  193. #endif
  194. }
  195. private:
  196. int m_nDEPTHBLEND;
  197. #ifdef _DEBUG
  198. bool m_bDEPTHBLEND;
  199. #endif
  200. public:
  201. void SetDEPTHBLEND( int i )
  202. {
  203. Assert( i >= 0 && i <= 0 );
  204. m_nDEPTHBLEND = i;
  205. #ifdef _DEBUG
  206. m_bDEPTHBLEND = true;
  207. #endif
  208. }
  209. void SetDEPTHBLEND( bool i )
  210. {
  211. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  212. m_nDEPTHBLEND = i ? 1 : 0;
  213. #ifdef _DEBUG
  214. m_bDEPTHBLEND = true;
  215. #endif
  216. }
  217. private:
  218. int m_nVERTEXCOLOR;
  219. #ifdef _DEBUG
  220. bool m_bVERTEXCOLOR;
  221. #endif
  222. public:
  223. void SetVERTEXCOLOR( int i )
  224. {
  225. Assert( i >= 0 && i <= 1 );
  226. m_nVERTEXCOLOR = i;
  227. #ifdef _DEBUG
  228. m_bVERTEXCOLOR = true;
  229. #endif
  230. }
  231. void SetVERTEXCOLOR( bool i )
  232. {
  233. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  234. m_nVERTEXCOLOR = i ? 1 : 0;
  235. #ifdef _DEBUG
  236. m_bVERTEXCOLOR = true;
  237. #endif
  238. }
  239. private:
  240. int m_nFLOWMAP;
  241. #ifdef _DEBUG
  242. bool m_bFLOWMAP;
  243. #endif
  244. public:
  245. void SetFLOWMAP( int i )
  246. {
  247. Assert( i >= 0 && i <= 1 );
  248. m_nFLOWMAP = i;
  249. #ifdef _DEBUG
  250. m_bFLOWMAP = true;
  251. #endif
  252. }
  253. void SetFLOWMAP( bool i )
  254. {
  255. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  256. m_nFLOWMAP = i ? 1 : 0;
  257. #ifdef _DEBUG
  258. m_bFLOWMAP = true;
  259. #endif
  260. }
  261. private:
  262. int m_nFLOW_CHEAP;
  263. #ifdef _DEBUG
  264. bool m_bFLOW_CHEAP;
  265. #endif
  266. public:
  267. void SetFLOW_CHEAP( int i )
  268. {
  269. Assert( i >= 0 && i <= 1 );
  270. m_nFLOW_CHEAP = i;
  271. #ifdef _DEBUG
  272. m_bFLOW_CHEAP = true;
  273. #endif
  274. }
  275. void SetFLOW_CHEAP( bool i )
  276. {
  277. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  278. m_nFLOW_CHEAP = i ? 1 : 0;
  279. #ifdef _DEBUG
  280. m_bFLOW_CHEAP = true;
  281. #endif
  282. }
  283. public:
  284. // CONSTRUCTOR
  285. solidenergy_ps20b_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  286. {
  287. #ifdef _DEBUG
  288. m_bADDITIVE = false;
  289. #endif // _DEBUG
  290. m_nADDITIVE = 0;
  291. #ifdef _DEBUG
  292. m_bDETAIL1 = false;
  293. #endif // _DEBUG
  294. m_nDETAIL1 = 0;
  295. #ifdef _DEBUG
  296. m_bDETAIL1BLENDMODE = false;
  297. #endif // _DEBUG
  298. m_nDETAIL1BLENDMODE = 0;
  299. #ifdef _DEBUG
  300. m_bDETAIL2 = false;
  301. #endif // _DEBUG
  302. m_nDETAIL2 = 0;
  303. #ifdef _DEBUG
  304. m_bDETAIL2BLENDMODE = false;
  305. #endif // _DEBUG
  306. m_nDETAIL2BLENDMODE = 0;
  307. #ifdef _DEBUG
  308. m_bTANGENTTOPACITY = false;
  309. #endif // _DEBUG
  310. m_nTANGENTTOPACITY = 0;
  311. #ifdef _DEBUG
  312. m_bTANGENTSOPACITY = false;
  313. #endif // _DEBUG
  314. m_nTANGENTSOPACITY = 0;
  315. #ifdef _DEBUG
  316. m_bFRESNELOPACITY = false;
  317. #endif // _DEBUG
  318. m_nFRESNELOPACITY = 0;
  319. #ifdef _DEBUG
  320. m_bDEPTHBLEND = false;
  321. #endif // _DEBUG
  322. m_nDEPTHBLEND = 0;
  323. #ifdef _DEBUG
  324. m_bVERTEXCOLOR = false;
  325. #endif // _DEBUG
  326. m_nVERTEXCOLOR = 0;
  327. #ifdef _DEBUG
  328. m_bFLOWMAP = false;
  329. #endif // _DEBUG
  330. m_nFLOWMAP = 0;
  331. #ifdef _DEBUG
  332. m_bFLOW_CHEAP = false;
  333. #endif // _DEBUG
  334. m_nFLOW_CHEAP = 0;
  335. }
  336. int GetIndex()
  337. {
  338. // Asserts to make sure that we aren't using any skipped combinations.
  339. // Asserts to make sure that we are setting all of the combination vars.
  340. #ifdef _DEBUG
  341. bool bAllStaticVarsDefined = m_bADDITIVE && m_bDETAIL1 && m_bDETAIL1BLENDMODE && m_bDETAIL2 && m_bDETAIL2BLENDMODE && m_bTANGENTTOPACITY && m_bTANGENTSOPACITY && m_bFRESNELOPACITY && m_bDEPTHBLEND && m_bVERTEXCOLOR && m_bFLOWMAP && m_bFLOW_CHEAP;
  342. Assert( bAllStaticVarsDefined );
  343. #endif // _DEBUG
  344. return ( 32 * m_nADDITIVE ) + ( 64 * m_nDETAIL1 ) + ( 128 * m_nDETAIL1BLENDMODE ) + ( 256 * m_nDETAIL2 ) + ( 512 * m_nDETAIL2BLENDMODE ) + ( 1024 * m_nTANGENTTOPACITY ) + ( 2048 * m_nTANGENTSOPACITY ) + ( 4096 * m_nFRESNELOPACITY ) + ( 8192 * m_nDEPTHBLEND ) + ( 8192 * m_nVERTEXCOLOR ) + ( 16384 * m_nFLOWMAP ) + ( 32768 * m_nFLOW_CHEAP ) + 0;
  345. }
  346. };
  347. #define shaderStaticTest_solidenergy_ps20b psh_forgot_to_set_static_ADDITIVE + psh_forgot_to_set_static_DETAIL1 + psh_forgot_to_set_static_DETAIL1BLENDMODE + psh_forgot_to_set_static_DETAIL2 + psh_forgot_to_set_static_DETAIL2BLENDMODE + psh_forgot_to_set_static_TANGENTTOPACITY + psh_forgot_to_set_static_TANGENTSOPACITY + psh_forgot_to_set_static_FRESNELOPACITY + psh_forgot_to_set_static_DEPTHBLEND + psh_forgot_to_set_static_VERTEXCOLOR + psh_forgot_to_set_static_FLOWMAP + psh_forgot_to_set_static_FLOW_CHEAP + 0
  348. class solidenergy_ps20b_Dynamic_Index
  349. {
  350. private:
  351. int m_nACTIVE;
  352. #ifdef _DEBUG
  353. bool m_bACTIVE;
  354. #endif
  355. public:
  356. void SetACTIVE( int i )
  357. {
  358. Assert( i >= 0 && i <= 1 );
  359. m_nACTIVE = i;
  360. #ifdef _DEBUG
  361. m_bACTIVE = true;
  362. #endif
  363. }
  364. void SetACTIVE( bool i )
  365. {
  366. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  367. m_nACTIVE = i ? 1 : 0;
  368. #ifdef _DEBUG
  369. m_bACTIVE = true;
  370. #endif
  371. }
  372. private:
  373. int m_nPOWERUP;
  374. #ifdef _DEBUG
  375. bool m_bPOWERUP;
  376. #endif
  377. public:
  378. void SetPOWERUP( int i )
  379. {
  380. Assert( i >= 0 && i <= 1 );
  381. m_nPOWERUP = i;
  382. #ifdef _DEBUG
  383. m_bPOWERUP = true;
  384. #endif
  385. }
  386. void SetPOWERUP( bool i )
  387. {
  388. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  389. m_nPOWERUP = i ? 1 : 0;
  390. #ifdef _DEBUG
  391. m_bPOWERUP = true;
  392. #endif
  393. }
  394. private:
  395. int m_nVORTEX1;
  396. #ifdef _DEBUG
  397. bool m_bVORTEX1;
  398. #endif
  399. public:
  400. void SetVORTEX1( int i )
  401. {
  402. Assert( i >= 0 && i <= 1 );
  403. m_nVORTEX1 = i;
  404. #ifdef _DEBUG
  405. m_bVORTEX1 = true;
  406. #endif
  407. }
  408. void SetVORTEX1( bool i )
  409. {
  410. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  411. m_nVORTEX1 = i ? 1 : 0;
  412. #ifdef _DEBUG
  413. m_bVORTEX1 = true;
  414. #endif
  415. }
  416. private:
  417. int m_nVORTEX2;
  418. #ifdef _DEBUG
  419. bool m_bVORTEX2;
  420. #endif
  421. public:
  422. void SetVORTEX2( int i )
  423. {
  424. Assert( i >= 0 && i <= 1 );
  425. m_nVORTEX2 = i;
  426. #ifdef _DEBUG
  427. m_bVORTEX2 = true;
  428. #endif
  429. }
  430. void SetVORTEX2( bool i )
  431. {
  432. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  433. m_nVORTEX2 = i ? 1 : 0;
  434. #ifdef _DEBUG
  435. m_bVORTEX2 = true;
  436. #endif
  437. }
  438. private:
  439. int m_nPIXELFOGTYPE;
  440. #ifdef _DEBUG
  441. bool m_bPIXELFOGTYPE;
  442. #endif
  443. public:
  444. void SetPIXELFOGTYPE( int i )
  445. {
  446. Assert( i >= 0 && i <= 1 );
  447. m_nPIXELFOGTYPE = i;
  448. #ifdef _DEBUG
  449. m_bPIXELFOGTYPE = true;
  450. #endif
  451. }
  452. void SetPIXELFOGTYPE( bool i )
  453. {
  454. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  455. m_nPIXELFOGTYPE = i ? 1 : 0;
  456. #ifdef _DEBUG
  457. m_bPIXELFOGTYPE = true;
  458. #endif
  459. }
  460. public:
  461. // CONSTRUCTOR
  462. solidenergy_ps20b_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  463. {
  464. #ifdef _DEBUG
  465. m_bACTIVE = false;
  466. #endif // _DEBUG
  467. m_nACTIVE = 0;
  468. #ifdef _DEBUG
  469. m_bPOWERUP = false;
  470. #endif // _DEBUG
  471. m_nPOWERUP = 0;
  472. #ifdef _DEBUG
  473. m_bVORTEX1 = false;
  474. #endif // _DEBUG
  475. m_nVORTEX1 = 0;
  476. #ifdef _DEBUG
  477. m_bVORTEX2 = false;
  478. #endif // _DEBUG
  479. m_nVORTEX2 = 0;
  480. #ifdef _DEBUG
  481. m_bPIXELFOGTYPE = true;
  482. #endif // _DEBUG
  483. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  484. }
  485. int GetIndex()
  486. {
  487. // Asserts to make sure that we aren't using any skipped combinations.
  488. // Asserts to make sure that we are setting all of the combination vars.
  489. #ifdef _DEBUG
  490. bool bAllDynamicVarsDefined = m_bACTIVE && m_bPOWERUP && m_bVORTEX1 && m_bVORTEX2 && m_bPIXELFOGTYPE;
  491. Assert( bAllDynamicVarsDefined );
  492. #endif // _DEBUG
  493. return ( 1 * m_nACTIVE ) + ( 2 * m_nPOWERUP ) + ( 4 * m_nVORTEX1 ) + ( 8 * m_nVORTEX2 ) + ( 16 * m_nPIXELFOGTYPE ) + 0;
  494. }
  495. };
  496. #define shaderDynamicTest_solidenergy_ps20b psh_forgot_to_set_dynamic_ACTIVE + psh_forgot_to_set_dynamic_POWERUP + psh_forgot_to_set_dynamic_VORTEX1 + psh_forgot_to_set_dynamic_VORTEX2 + 0
  497. static const ShaderComboInformation_t s_DynamicComboArray_solidenergy_ps20b[5] =
  498. {
  499. { "ACTIVE", 0, 1 },
  500. { "POWERUP", 0, 1 },
  501. { "VORTEX1", 0, 1 },
  502. { "VORTEX2", 0, 1 },
  503. { "PIXELFOGTYPE", 0, 1 },
  504. };
  505. static const ShaderComboInformation_t s_StaticComboArray_solidenergy_ps20b[12] =
  506. {
  507. { "ADDITIVE", 0, 1 },
  508. { "DETAIL1", 0, 1 },
  509. { "DETAIL1BLENDMODE", 0, 1 },
  510. { "DETAIL2", 0, 1 },
  511. { "DETAIL2BLENDMODE", 0, 1 },
  512. { "TANGENTTOPACITY", 0, 1 },
  513. { "TANGENTSOPACITY", 0, 1 },
  514. { "FRESNELOPACITY", 0, 1 },
  515. { "DEPTHBLEND", 0, 0 },
  516. { "VERTEXCOLOR", 0, 1 },
  517. { "FLOWMAP", 0, 1 },
  518. { "FLOW_CHEAP", 0, 1 },
  519. };
  520. static const ShaderComboSemantics_t solidenergy_ps20b_combos =
  521. {
  522. "solidenergy_ps20b", s_DynamicComboArray_solidenergy_ps20b, 5, s_StaticComboArray_solidenergy_ps20b, 12
  523. };
  524. class ConstructMe_solidenergy_ps20b
  525. {
  526. public:
  527. ConstructMe_solidenergy_ps20b()
  528. {
  529. GetShaderDLL()->AddShaderComboInformation( &solidenergy_ps20b_combos );
  530. }
  531. };
  532. static ConstructMe_solidenergy_ps20b s_ConstructMe_solidenergy_ps20b;