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.

775 lines
19 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $AMBIENTREFLECTION == 0 ) && ( $USEBOUNCECOLOR == 1 )
  3. // ( $BASEALPHAENVMASK == 1 ) && ( $ENVMAP == 0 )
  4. // ( $BUMPALPHAENVMASK == 1 ) && ( $ENVMAP == 0 )
  5. // ( $BASEALPHAENVMASK == 1 ) && ( $BUMPALPHAENVMASK == 1 )
  6. // ( $BASEALPHASELFILLUMMASK == 1) && ( $BASEALPHAENVMASK == 1 )
  7. // ( $BASEALPHASELFILLUMMASK == 1) && ( $BASEALPHAPHONGMASK == 1 )
  8. // ( $BASEALPHAENVMASK == 1 ) && ( $BASEALPHASELFILLUMMASK )
  9. // ( $CASCADED_SHADOW_MAPPING == 0 ) && ( $DYN_CSM_ENABLED == 1 )
  10. // ( $CASCADED_SHADOW_MAPPING == 0 ) && ( $CSM_MODE != 0 )
  11. // ( $DOPREVIEW == 0 ) && ( $USEPATTERN != 0 )
  12. // ( $DOPREVIEW == 1 ) && ( $USEBOUNCECOLOR == 1 )
  13. // ( $DOPREVIEW == 1 ) && ( $BASEALPHASELFILLUMMASK == 1)
  14. // ( $DOPREVIEW == 1 ) && ( $FAKERIM == 1 )
  15. // ( $DOPREVIEW == 1 ) && ( $CSM_MODE > 0 )
  16. // ( $DOPREVIEW == 1 ) && ( $DYN_CSM_ENALBED == 1 )
  17. // ( $DOPREVIEW == 1 ) && ( $NUM_LIGHTS > 1 )
  18. // ( $DOPREVIEW == 1 ) && ( $FLASHLIGHT == 1 )
  19. // ( $CASCADED_SHADOW_MAPPING > 0) && ( $FLASHLIGHT == 1 )
  20. // ( $DYN_CSM_ENALBED == 1 ) && ( $FLASHLIGHT == 1 )
  21. // ( $CSM_MODE > 0 ) && ( $FLASHLIGHT == 1 )
  22. // ( $FLASHLIGHTDEPTHFILTERMODE > 0 ) && ( $FLASHLIGHT == 0 )
  23. // ( $FLASHLIGHT == 1 ) && ( $FAKERIM == 1 )
  24. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  25. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  26. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  27. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  28. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  29. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  30. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  31. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  32. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  33. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  34. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  35. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  36. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  37. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  38. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  39. #include "shaderlib/cshader.h"
  40. class character_ps30_Static_Index
  41. {
  42. private:
  43. int m_nMASKS1;
  44. #ifdef _DEBUG
  45. bool m_bMASKS1;
  46. #endif
  47. public:
  48. void SetMASKS1( int i )
  49. {
  50. Assert( i >= 0 && i <= 1 );
  51. m_nMASKS1 = i;
  52. #ifdef _DEBUG
  53. m_bMASKS1 = true;
  54. #endif
  55. }
  56. void SetMASKS1( bool i )
  57. {
  58. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  59. m_nMASKS1 = i ? 1 : 0;
  60. #ifdef _DEBUG
  61. m_bMASKS1 = true;
  62. #endif
  63. }
  64. private:
  65. int m_nMASKS2;
  66. #ifdef _DEBUG
  67. bool m_bMASKS2;
  68. #endif
  69. public:
  70. void SetMASKS2( int i )
  71. {
  72. Assert( i >= 0 && i <= 1 );
  73. m_nMASKS2 = i;
  74. #ifdef _DEBUG
  75. m_bMASKS2 = true;
  76. #endif
  77. }
  78. void SetMASKS2( bool i )
  79. {
  80. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  81. m_nMASKS2 = i ? 1 : 0;
  82. #ifdef _DEBUG
  83. m_bMASKS2 = true;
  84. #endif
  85. }
  86. private:
  87. int m_nFRESNELRANGESTEXTURE;
  88. #ifdef _DEBUG
  89. bool m_bFRESNELRANGESTEXTURE;
  90. #endif
  91. public:
  92. void SetFRESNELRANGESTEXTURE( int i )
  93. {
  94. Assert( i >= 0 && i <= 1 );
  95. m_nFRESNELRANGESTEXTURE = i;
  96. #ifdef _DEBUG
  97. m_bFRESNELRANGESTEXTURE = true;
  98. #endif
  99. }
  100. void SetFRESNELRANGESTEXTURE( bool i )
  101. {
  102. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  103. m_nFRESNELRANGESTEXTURE = i ? 1 : 0;
  104. #ifdef _DEBUG
  105. m_bFRESNELRANGESTEXTURE = true;
  106. #endif
  107. }
  108. private:
  109. int m_nPHONGWARPTEXTURE;
  110. #ifdef _DEBUG
  111. bool m_bPHONGWARPTEXTURE;
  112. #endif
  113. public:
  114. void SetPHONGWARPTEXTURE( int i )
  115. {
  116. Assert( i >= 0 && i <= 1 );
  117. m_nPHONGWARPTEXTURE = i;
  118. #ifdef _DEBUG
  119. m_bPHONGWARPTEXTURE = true;
  120. #endif
  121. }
  122. void SetPHONGWARPTEXTURE( bool i )
  123. {
  124. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  125. m_nPHONGWARPTEXTURE = i ? 1 : 0;
  126. #ifdef _DEBUG
  127. m_bPHONGWARPTEXTURE = true;
  128. #endif
  129. }
  130. private:
  131. int m_nENVMAP;
  132. #ifdef _DEBUG
  133. bool m_bENVMAP;
  134. #endif
  135. public:
  136. void SetENVMAP( int i )
  137. {
  138. Assert( i >= 0 && i <= 1 );
  139. m_nENVMAP = i;
  140. #ifdef _DEBUG
  141. m_bENVMAP = true;
  142. #endif
  143. }
  144. void SetENVMAP( bool i )
  145. {
  146. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  147. m_nENVMAP = i ? 1 : 0;
  148. #ifdef _DEBUG
  149. m_bENVMAP = true;
  150. #endif
  151. }
  152. private:
  153. int m_nAMBIENTREFLECTION;
  154. #ifdef _DEBUG
  155. bool m_bAMBIENTREFLECTION;
  156. #endif
  157. public:
  158. void SetAMBIENTREFLECTION( int i )
  159. {
  160. Assert( i >= 0 && i <= 1 );
  161. m_nAMBIENTREFLECTION = i;
  162. #ifdef _DEBUG
  163. m_bAMBIENTREFLECTION = true;
  164. #endif
  165. }
  166. void SetAMBIENTREFLECTION( bool i )
  167. {
  168. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  169. m_nAMBIENTREFLECTION = i ? 1 : 0;
  170. #ifdef _DEBUG
  171. m_bAMBIENTREFLECTION = true;
  172. #endif
  173. }
  174. private:
  175. int m_nUSEBOUNCECOLOR;
  176. #ifdef _DEBUG
  177. bool m_bUSEBOUNCECOLOR;
  178. #endif
  179. public:
  180. void SetUSEBOUNCECOLOR( int i )
  181. {
  182. Assert( i >= 0 && i <= 1 );
  183. m_nUSEBOUNCECOLOR = i;
  184. #ifdef _DEBUG
  185. m_bUSEBOUNCECOLOR = true;
  186. #endif
  187. }
  188. void SetUSEBOUNCECOLOR( bool i )
  189. {
  190. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  191. m_nUSEBOUNCECOLOR = i ? 1 : 0;
  192. #ifdef _DEBUG
  193. m_bUSEBOUNCECOLOR = true;
  194. #endif
  195. }
  196. private:
  197. int m_nANISOTROPY;
  198. #ifdef _DEBUG
  199. bool m_bANISOTROPY;
  200. #endif
  201. public:
  202. void SetANISOTROPY( int i )
  203. {
  204. Assert( i >= 0 && i <= 1 );
  205. m_nANISOTROPY = i;
  206. #ifdef _DEBUG
  207. m_bANISOTROPY = true;
  208. #endif
  209. }
  210. void SetANISOTROPY( bool i )
  211. {
  212. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  213. m_nANISOTROPY = i ? 1 : 0;
  214. #ifdef _DEBUG
  215. m_bANISOTROPY = true;
  216. #endif
  217. }
  218. private:
  219. int m_nBASEALPHAPHONGMASK;
  220. #ifdef _DEBUG
  221. bool m_bBASEALPHAPHONGMASK;
  222. #endif
  223. public:
  224. void SetBASEALPHAPHONGMASK( int i )
  225. {
  226. Assert( i >= 0 && i <= 1 );
  227. m_nBASEALPHAPHONGMASK = i;
  228. #ifdef _DEBUG
  229. m_bBASEALPHAPHONGMASK = true;
  230. #endif
  231. }
  232. void SetBASEALPHAPHONGMASK( bool i )
  233. {
  234. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  235. m_nBASEALPHAPHONGMASK = i ? 1 : 0;
  236. #ifdef _DEBUG
  237. m_bBASEALPHAPHONGMASK = true;
  238. #endif
  239. }
  240. private:
  241. int m_nBASEALPHAENVMASK;
  242. #ifdef _DEBUG
  243. bool m_bBASEALPHAENVMASK;
  244. #endif
  245. public:
  246. void SetBASEALPHAENVMASK( int i )
  247. {
  248. Assert( i >= 0 && i <= 1 );
  249. m_nBASEALPHAENVMASK = i;
  250. #ifdef _DEBUG
  251. m_bBASEALPHAENVMASK = true;
  252. #endif
  253. }
  254. void SetBASEALPHAENVMASK( bool i )
  255. {
  256. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  257. m_nBASEALPHAENVMASK = i ? 1 : 0;
  258. #ifdef _DEBUG
  259. m_bBASEALPHAENVMASK = true;
  260. #endif
  261. }
  262. private:
  263. int m_nBUMPALPHAENVMASK;
  264. #ifdef _DEBUG
  265. bool m_bBUMPALPHAENVMASK;
  266. #endif
  267. public:
  268. void SetBUMPALPHAENVMASK( int i )
  269. {
  270. Assert( i >= 0 && i <= 1 );
  271. m_nBUMPALPHAENVMASK = i;
  272. #ifdef _DEBUG
  273. m_bBUMPALPHAENVMASK = true;
  274. #endif
  275. }
  276. void SetBUMPALPHAENVMASK( bool i )
  277. {
  278. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  279. m_nBUMPALPHAENVMASK = i ? 1 : 0;
  280. #ifdef _DEBUG
  281. m_bBUMPALPHAENVMASK = true;
  282. #endif
  283. }
  284. private:
  285. int m_nSHADOWSATURATION;
  286. #ifdef _DEBUG
  287. bool m_bSHADOWSATURATION;
  288. #endif
  289. public:
  290. void SetSHADOWSATURATION( int i )
  291. {
  292. Assert( i >= 0 && i <= 1 );
  293. m_nSHADOWSATURATION = i;
  294. #ifdef _DEBUG
  295. m_bSHADOWSATURATION = true;
  296. #endif
  297. }
  298. void SetSHADOWSATURATION( bool i )
  299. {
  300. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  301. m_nSHADOWSATURATION = i ? 1 : 0;
  302. #ifdef _DEBUG
  303. m_bSHADOWSATURATION = true;
  304. #endif
  305. }
  306. private:
  307. int m_nBASEALPHASELFILLUMMASK;
  308. #ifdef _DEBUG
  309. bool m_bBASEALPHASELFILLUMMASK;
  310. #endif
  311. public:
  312. void SetBASEALPHASELFILLUMMASK( int i )
  313. {
  314. Assert( i >= 0 && i <= 1 );
  315. m_nBASEALPHASELFILLUMMASK = i;
  316. #ifdef _DEBUG
  317. m_bBASEALPHASELFILLUMMASK = true;
  318. #endif
  319. }
  320. void SetBASEALPHASELFILLUMMASK( bool i )
  321. {
  322. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  323. m_nBASEALPHASELFILLUMMASK = i ? 1 : 0;
  324. #ifdef _DEBUG
  325. m_bBASEALPHASELFILLUMMASK = true;
  326. #endif
  327. }
  328. private:
  329. int m_nFAKERIM;
  330. #ifdef _DEBUG
  331. bool m_bFAKERIM;
  332. #endif
  333. public:
  334. void SetFAKERIM( int i )
  335. {
  336. Assert( i >= 0 && i <= 1 );
  337. m_nFAKERIM = i;
  338. #ifdef _DEBUG
  339. m_bFAKERIM = true;
  340. #endif
  341. }
  342. void SetFAKERIM( bool i )
  343. {
  344. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  345. m_nFAKERIM = i ? 1 : 0;
  346. #ifdef _DEBUG
  347. m_bFAKERIM = true;
  348. #endif
  349. }
  350. private:
  351. int m_nCASCADED_SHADOW_MAPPING;
  352. #ifdef _DEBUG
  353. bool m_bCASCADED_SHADOW_MAPPING;
  354. #endif
  355. public:
  356. void SetCASCADED_SHADOW_MAPPING( int i )
  357. {
  358. Assert( i >= 0 && i <= 1 );
  359. m_nCASCADED_SHADOW_MAPPING = i;
  360. #ifdef _DEBUG
  361. m_bCASCADED_SHADOW_MAPPING = true;
  362. #endif
  363. }
  364. void SetCASCADED_SHADOW_MAPPING( bool i )
  365. {
  366. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  367. m_nCASCADED_SHADOW_MAPPING = i ? 1 : 0;
  368. #ifdef _DEBUG
  369. m_bCASCADED_SHADOW_MAPPING = true;
  370. #endif
  371. }
  372. private:
  373. int m_nCSM_MODE;
  374. #ifdef _DEBUG
  375. bool m_bCSM_MODE;
  376. #endif
  377. public:
  378. void SetCSM_MODE( int i )
  379. {
  380. Assert( i >= 0 && i <= 3 );
  381. m_nCSM_MODE = i;
  382. #ifdef _DEBUG
  383. m_bCSM_MODE = true;
  384. #endif
  385. }
  386. void SetCSM_MODE( bool i )
  387. {
  388. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 3 );
  389. m_nCSM_MODE = i ? 1 : 0;
  390. #ifdef _DEBUG
  391. m_bCSM_MODE = true;
  392. #endif
  393. }
  394. private:
  395. int m_nDOPREVIEW;
  396. #ifdef _DEBUG
  397. bool m_bDOPREVIEW;
  398. #endif
  399. public:
  400. void SetDOPREVIEW( int i )
  401. {
  402. Assert( i >= 0 && i <= 1 );
  403. m_nDOPREVIEW = i;
  404. #ifdef _DEBUG
  405. m_bDOPREVIEW = true;
  406. #endif
  407. }
  408. void SetDOPREVIEW( bool i )
  409. {
  410. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  411. m_nDOPREVIEW = i ? 1 : 0;
  412. #ifdef _DEBUG
  413. m_bDOPREVIEW = true;
  414. #endif
  415. }
  416. private:
  417. int m_nUSEPATTERN;
  418. #ifdef _DEBUG
  419. bool m_bUSEPATTERN;
  420. #endif
  421. public:
  422. void SetUSEPATTERN( int i )
  423. {
  424. Assert( i >= 0 && i <= 4 );
  425. m_nUSEPATTERN = i;
  426. #ifdef _DEBUG
  427. m_bUSEPATTERN = true;
  428. #endif
  429. }
  430. void SetUSEPATTERN( bool i )
  431. {
  432. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 4 );
  433. m_nUSEPATTERN = i ? 1 : 0;
  434. #ifdef _DEBUG
  435. m_bUSEPATTERN = true;
  436. #endif
  437. }
  438. private:
  439. int m_nFLASHLIGHT;
  440. #ifdef _DEBUG
  441. bool m_bFLASHLIGHT;
  442. #endif
  443. public:
  444. void SetFLASHLIGHT( int i )
  445. {
  446. Assert( i >= 0 && i <= 1 );
  447. m_nFLASHLIGHT = i;
  448. #ifdef _DEBUG
  449. m_bFLASHLIGHT = true;
  450. #endif
  451. }
  452. void SetFLASHLIGHT( bool i )
  453. {
  454. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  455. m_nFLASHLIGHT = i ? 1 : 0;
  456. #ifdef _DEBUG
  457. m_bFLASHLIGHT = true;
  458. #endif
  459. }
  460. private:
  461. int m_nFLASHLIGHTDEPTHFILTERMODE;
  462. #ifdef _DEBUG
  463. bool m_bFLASHLIGHTDEPTHFILTERMODE;
  464. #endif
  465. public:
  466. void SetFLASHLIGHTDEPTHFILTERMODE( int i )
  467. {
  468. Assert( i >= 0 && i <= 3 );
  469. m_nFLASHLIGHTDEPTHFILTERMODE = i;
  470. #ifdef _DEBUG
  471. m_bFLASHLIGHTDEPTHFILTERMODE = true;
  472. #endif
  473. }
  474. void SetFLASHLIGHTDEPTHFILTERMODE( bool i )
  475. {
  476. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 3 );
  477. m_nFLASHLIGHTDEPTHFILTERMODE = i ? 1 : 0;
  478. #ifdef _DEBUG
  479. m_bFLASHLIGHTDEPTHFILTERMODE = true;
  480. #endif
  481. }
  482. public:
  483. // CONSTRUCTOR
  484. character_ps30_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  485. {
  486. #ifdef _DEBUG
  487. m_bMASKS1 = false;
  488. #endif // _DEBUG
  489. m_nMASKS1 = 0;
  490. #ifdef _DEBUG
  491. m_bMASKS2 = false;
  492. #endif // _DEBUG
  493. m_nMASKS2 = 0;
  494. #ifdef _DEBUG
  495. m_bFRESNELRANGESTEXTURE = false;
  496. #endif // _DEBUG
  497. m_nFRESNELRANGESTEXTURE = 0;
  498. #ifdef _DEBUG
  499. m_bPHONGWARPTEXTURE = false;
  500. #endif // _DEBUG
  501. m_nPHONGWARPTEXTURE = 0;
  502. #ifdef _DEBUG
  503. m_bENVMAP = false;
  504. #endif // _DEBUG
  505. m_nENVMAP = 0;
  506. #ifdef _DEBUG
  507. m_bAMBIENTREFLECTION = false;
  508. #endif // _DEBUG
  509. m_nAMBIENTREFLECTION = 0;
  510. #ifdef _DEBUG
  511. m_bUSEBOUNCECOLOR = false;
  512. #endif // _DEBUG
  513. m_nUSEBOUNCECOLOR = 0;
  514. #ifdef _DEBUG
  515. m_bANISOTROPY = false;
  516. #endif // _DEBUG
  517. m_nANISOTROPY = 0;
  518. #ifdef _DEBUG
  519. m_bBASEALPHAPHONGMASK = false;
  520. #endif // _DEBUG
  521. m_nBASEALPHAPHONGMASK = 0;
  522. #ifdef _DEBUG
  523. m_bBASEALPHAENVMASK = false;
  524. #endif // _DEBUG
  525. m_nBASEALPHAENVMASK = 0;
  526. #ifdef _DEBUG
  527. m_bBUMPALPHAENVMASK = false;
  528. #endif // _DEBUG
  529. m_nBUMPALPHAENVMASK = 0;
  530. #ifdef _DEBUG
  531. m_bSHADOWSATURATION = false;
  532. #endif // _DEBUG
  533. m_nSHADOWSATURATION = 0;
  534. #ifdef _DEBUG
  535. m_bBASEALPHASELFILLUMMASK = false;
  536. #endif // _DEBUG
  537. m_nBASEALPHASELFILLUMMASK = 0;
  538. #ifdef _DEBUG
  539. m_bFAKERIM = false;
  540. #endif // _DEBUG
  541. m_nFAKERIM = 0;
  542. #ifdef _DEBUG
  543. m_bCASCADED_SHADOW_MAPPING = false;
  544. #endif // _DEBUG
  545. m_nCASCADED_SHADOW_MAPPING = 0;
  546. #ifdef _DEBUG
  547. m_bCSM_MODE = false;
  548. #endif // _DEBUG
  549. m_nCSM_MODE = 0;
  550. #ifdef _DEBUG
  551. m_bDOPREVIEW = false;
  552. #endif // _DEBUG
  553. m_nDOPREVIEW = 0;
  554. #ifdef _DEBUG
  555. m_bUSEPATTERN = false;
  556. #endif // _DEBUG
  557. m_nUSEPATTERN = 0;
  558. #ifdef _DEBUG
  559. m_bFLASHLIGHT = false;
  560. #endif // _DEBUG
  561. m_nFLASHLIGHT = 0;
  562. #ifdef _DEBUG
  563. m_bFLASHLIGHTDEPTHFILTERMODE = false;
  564. #endif // _DEBUG
  565. m_nFLASHLIGHTDEPTHFILTERMODE = 0;
  566. }
  567. int GetIndex()
  568. {
  569. // Asserts to make sure that we aren't using any skipped combinations.
  570. // Asserts to make sure that we are setting all of the combination vars.
  571. #ifdef _DEBUG
  572. bool bAllStaticVarsDefined = m_bMASKS1 && m_bMASKS2 && m_bFRESNELRANGESTEXTURE && m_bPHONGWARPTEXTURE && m_bENVMAP && m_bAMBIENTREFLECTION && m_bUSEBOUNCECOLOR && m_bANISOTROPY && m_bBASEALPHAPHONGMASK && m_bBASEALPHAENVMASK && m_bBUMPALPHAENVMASK && m_bSHADOWSATURATION && m_bBASEALPHASELFILLUMMASK && m_bFAKERIM && m_bCASCADED_SHADOW_MAPPING && m_bCSM_MODE && m_bDOPREVIEW && m_bUSEPATTERN && m_bFLASHLIGHT && m_bFLASHLIGHTDEPTHFILTERMODE;
  573. Assert( bAllStaticVarsDefined );
  574. #endif // _DEBUG
  575. return ( 40 * m_nMASKS1 ) + ( 80 * m_nMASKS2 ) + ( 160 * m_nFRESNELRANGESTEXTURE ) + ( 320 * m_nPHONGWARPTEXTURE ) + ( 640 * m_nENVMAP ) + ( 1280 * m_nAMBIENTREFLECTION ) + ( 2560 * m_nUSEBOUNCECOLOR ) + ( 5120 * m_nANISOTROPY ) + ( 10240 * m_nBASEALPHAPHONGMASK ) + ( 20480 * m_nBASEALPHAENVMASK ) + ( 40960 * m_nBUMPALPHAENVMASK ) + ( 81920 * m_nSHADOWSATURATION ) + ( 163840 * m_nBASEALPHASELFILLUMMASK ) + ( 327680 * m_nFAKERIM ) + ( 655360 * m_nCASCADED_SHADOW_MAPPING ) + ( 1310720 * m_nCSM_MODE ) + ( 5242880 * m_nDOPREVIEW ) + ( 10485760 * m_nUSEPATTERN ) + ( 52428800 * m_nFLASHLIGHT ) + ( 104857600 * m_nFLASHLIGHTDEPTHFILTERMODE ) + 0;
  576. }
  577. };
  578. #define shaderStaticTest_character_ps30 psh_forgot_to_set_static_MASKS1 + psh_forgot_to_set_static_MASKS2 + psh_forgot_to_set_static_FRESNELRANGESTEXTURE + psh_forgot_to_set_static_PHONGWARPTEXTURE + psh_forgot_to_set_static_ENVMAP + psh_forgot_to_set_static_AMBIENTREFLECTION + psh_forgot_to_set_static_USEBOUNCECOLOR + psh_forgot_to_set_static_ANISOTROPY + psh_forgot_to_set_static_BASEALPHAPHONGMASK + psh_forgot_to_set_static_BASEALPHAENVMASK + psh_forgot_to_set_static_BUMPALPHAENVMASK + psh_forgot_to_set_static_SHADOWSATURATION + psh_forgot_to_set_static_BASEALPHASELFILLUMMASK + psh_forgot_to_set_static_FAKERIM + psh_forgot_to_set_static_CASCADED_SHADOW_MAPPING + psh_forgot_to_set_static_CSM_MODE + psh_forgot_to_set_static_DOPREVIEW + psh_forgot_to_set_static_USEPATTERN + psh_forgot_to_set_static_FLASHLIGHT + psh_forgot_to_set_static_FLASHLIGHTDEPTHFILTERMODE + 0
  579. class character_ps30_Dynamic_Index
  580. {
  581. private:
  582. int m_nNUM_LIGHTS;
  583. #ifdef _DEBUG
  584. bool m_bNUM_LIGHTS;
  585. #endif
  586. public:
  587. void SetNUM_LIGHTS( int i )
  588. {
  589. Assert( i >= 0 && i <= 4 );
  590. m_nNUM_LIGHTS = i;
  591. #ifdef _DEBUG
  592. m_bNUM_LIGHTS = true;
  593. #endif
  594. }
  595. void SetNUM_LIGHTS( bool i )
  596. {
  597. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 4 );
  598. m_nNUM_LIGHTS = i ? 1 : 0;
  599. #ifdef _DEBUG
  600. m_bNUM_LIGHTS = true;
  601. #endif
  602. }
  603. private:
  604. int m_nDYN_CSM_ENABLED;
  605. #ifdef _DEBUG
  606. bool m_bDYN_CSM_ENABLED;
  607. #endif
  608. public:
  609. void SetDYN_CSM_ENABLED( int i )
  610. {
  611. Assert( i >= 0 && i <= 1 );
  612. m_nDYN_CSM_ENABLED = i;
  613. #ifdef _DEBUG
  614. m_bDYN_CSM_ENABLED = true;
  615. #endif
  616. }
  617. void SetDYN_CSM_ENABLED( bool i )
  618. {
  619. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  620. m_nDYN_CSM_ENABLED = i ? 1 : 0;
  621. #ifdef _DEBUG
  622. m_bDYN_CSM_ENABLED = true;
  623. #endif
  624. }
  625. private:
  626. int m_nWRITE_DEPTH_TO_DESTALPHA;
  627. #ifdef _DEBUG
  628. bool m_bWRITE_DEPTH_TO_DESTALPHA;
  629. #endif
  630. public:
  631. void SetWRITE_DEPTH_TO_DESTALPHA( int i )
  632. {
  633. Assert( i >= 0 && i <= 0 );
  634. m_nWRITE_DEPTH_TO_DESTALPHA = i;
  635. #ifdef _DEBUG
  636. m_bWRITE_DEPTH_TO_DESTALPHA = true;
  637. #endif
  638. }
  639. void SetWRITE_DEPTH_TO_DESTALPHA( bool i )
  640. {
  641. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  642. m_nWRITE_DEPTH_TO_DESTALPHA = i ? 1 : 0;
  643. #ifdef _DEBUG
  644. m_bWRITE_DEPTH_TO_DESTALPHA = true;
  645. #endif
  646. }
  647. private:
  648. int m_nWRITEWATERFOGTODESTALPHA;
  649. #ifdef _DEBUG
  650. bool m_bWRITEWATERFOGTODESTALPHA;
  651. #endif
  652. public:
  653. void SetWRITEWATERFOGTODESTALPHA( int i )
  654. {
  655. Assert( i >= 0 && i <= 1 );
  656. m_nWRITEWATERFOGTODESTALPHA = i;
  657. #ifdef _DEBUG
  658. m_bWRITEWATERFOGTODESTALPHA = true;
  659. #endif
  660. }
  661. void SetWRITEWATERFOGTODESTALPHA( bool i )
  662. {
  663. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  664. m_nWRITEWATERFOGTODESTALPHA = i ? 1 : 0;
  665. #ifdef _DEBUG
  666. m_bWRITEWATERFOGTODESTALPHA = true;
  667. #endif
  668. }
  669. private:
  670. int m_nPIXELFOGTYPE;
  671. #ifdef _DEBUG
  672. bool m_bPIXELFOGTYPE;
  673. #endif
  674. public:
  675. void SetPIXELFOGTYPE( int i )
  676. {
  677. Assert( i >= 0 && i <= 1 );
  678. m_nPIXELFOGTYPE = i;
  679. #ifdef _DEBUG
  680. m_bPIXELFOGTYPE = true;
  681. #endif
  682. }
  683. void SetPIXELFOGTYPE( bool i )
  684. {
  685. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  686. m_nPIXELFOGTYPE = i ? 1 : 0;
  687. #ifdef _DEBUG
  688. m_bPIXELFOGTYPE = true;
  689. #endif
  690. }
  691. public:
  692. // CONSTRUCTOR
  693. character_ps30_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  694. {
  695. #ifdef _DEBUG
  696. m_bNUM_LIGHTS = false;
  697. #endif // _DEBUG
  698. m_nNUM_LIGHTS = 0;
  699. #ifdef _DEBUG
  700. m_bDYN_CSM_ENABLED = false;
  701. #endif // _DEBUG
  702. m_nDYN_CSM_ENABLED = 0;
  703. #ifdef _DEBUG
  704. m_bWRITE_DEPTH_TO_DESTALPHA = false;
  705. #endif // _DEBUG
  706. m_nWRITE_DEPTH_TO_DESTALPHA = 0;
  707. #ifdef _DEBUG
  708. m_bWRITEWATERFOGTODESTALPHA = false;
  709. #endif // _DEBUG
  710. m_nWRITEWATERFOGTODESTALPHA = 0;
  711. #ifdef _DEBUG
  712. m_bPIXELFOGTYPE = true;
  713. #endif // _DEBUG
  714. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  715. }
  716. int GetIndex()
  717. {
  718. // Asserts to make sure that we aren't using any skipped combinations.
  719. // Asserts to make sure that we are setting all of the combination vars.
  720. #ifdef _DEBUG
  721. bool bAllDynamicVarsDefined = m_bNUM_LIGHTS && m_bDYN_CSM_ENABLED && m_bWRITE_DEPTH_TO_DESTALPHA && m_bWRITEWATERFOGTODESTALPHA && m_bPIXELFOGTYPE;
  722. Assert( bAllDynamicVarsDefined );
  723. #endif // _DEBUG
  724. return ( 1 * m_nNUM_LIGHTS ) + ( 5 * m_nDYN_CSM_ENABLED ) + ( 10 * m_nWRITE_DEPTH_TO_DESTALPHA ) + ( 10 * m_nWRITEWATERFOGTODESTALPHA ) + ( 20 * m_nPIXELFOGTYPE ) + 0;
  725. }
  726. };
  727. #define shaderDynamicTest_character_ps30 psh_forgot_to_set_dynamic_NUM_LIGHTS + psh_forgot_to_set_dynamic_DYN_CSM_ENABLED + psh_forgot_to_set_dynamic_WRITE_DEPTH_TO_DESTALPHA + psh_forgot_to_set_dynamic_WRITEWATERFOGTODESTALPHA + 0
  728. static const ShaderComboInformation_t s_DynamicComboArray_character_ps30[5] =
  729. {
  730. { "NUM_LIGHTS", 0, 4 },
  731. { "DYN_CSM_ENABLED", 0, 1 },
  732. { "WRITE_DEPTH_TO_DESTALPHA", 0, 0 },
  733. { "WRITEWATERFOGTODESTALPHA", 0, 1 },
  734. { "PIXELFOGTYPE", 0, 1 },
  735. };
  736. static const ShaderComboInformation_t s_StaticComboArray_character_ps30[20] =
  737. {
  738. { "MASKS1", 0, 1 },
  739. { "MASKS2", 0, 1 },
  740. { "FRESNELRANGESTEXTURE", 0, 1 },
  741. { "PHONGWARPTEXTURE", 0, 1 },
  742. { "ENVMAP", 0, 1 },
  743. { "AMBIENTREFLECTION", 0, 1 },
  744. { "USEBOUNCECOLOR", 0, 1 },
  745. { "ANISOTROPY", 0, 1 },
  746. { "BASEALPHAPHONGMASK", 0, 1 },
  747. { "BASEALPHAENVMASK", 0, 1 },
  748. { "BUMPALPHAENVMASK", 0, 1 },
  749. { "SHADOWSATURATION", 0, 1 },
  750. { "BASEALPHASELFILLUMMASK", 0, 1 },
  751. { "FAKERIM", 0, 1 },
  752. { "CASCADED_SHADOW_MAPPING", 0, 1 },
  753. { "CSM_MODE", 0, 3 },
  754. { "DOPREVIEW", 0, 1 },
  755. { "USEPATTERN", 0, 4 },
  756. { "FLASHLIGHT", 0, 1 },
  757. { "FLASHLIGHTDEPTHFILTERMODE", 0, 3 },
  758. };
  759. static const ShaderComboSemantics_t character_ps30_combos =
  760. {
  761. "character_ps30", s_DynamicComboArray_character_ps30, 5, s_StaticComboArray_character_ps30, 20
  762. };
  763. class ConstructMe_character_ps30
  764. {
  765. public:
  766. ConstructMe_character_ps30()
  767. {
  768. GetShaderDLL()->AddShaderComboInformation( &character_ps30_combos );
  769. }
  770. };
  771. static ConstructMe_character_ps30 s_ConstructMe_character_ps30;