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.

850 lines
21 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ($DETAIL_BLEND_MODE == 1 )
  3. // ($DETAIL_BLEND_MODE == 2 )
  4. // ($DETAIL_BLEND_MODE == 3 )
  5. // ($DETAIL_BLEND_MODE == 4 )
  6. // ($DETAIL_BLEND_MODE == 5 )
  7. // ($DETAIL_BLEND_MODE == 6 )
  8. // ($DETAIL_BLEND_MODE == 8 )
  9. // ($DETAIL_BLEND_MODE == 9) && ( $BASETEXTURE2 )
  10. // ($DETAIL_BLEND_MODE == 9) && ( $BUMPMAP )
  11. // ($DETAIL_BLEND_MODE == 9) && ( $BUMPMAP2 )
  12. // ($DETAIL_BLEND_MODE == 9) && ( $CUBEMAP )
  13. // ($DETAIL_BLEND_MODE == 9) && ( $ENVMAPMASK )
  14. // ($DETAIL_BLEND_MODE == 9) && ( $BASEALPHAENVMAPMASK )
  15. // ($DETAIL_BLEND_MODE == 9) && ( $SELFILLUM )
  16. // ($DETAIL_BLEND_MODE == 9) && ( $NORMALMAPALPHAENVMAPMASK )
  17. // ($DETAIL_BLEND_MODE == 9) && ( $FANCY_BLENDING )
  18. // ($DETAIL_BLEND_MODE == 9) && ( $SEAMLESS )
  19. // ($DETAIL_BLEND_MODE == 9) && ( $ENVMAPANISOTROPY )
  20. // ($DETAIL_BLEND_MODE == 9) && ( $ADDBUMPMAPS )
  21. // ($DETAIL_BLEND_MODE == 9) && ( $BUMPMASK )
  22. // ($DETAIL_BLEND_MODE == 9) && ( $DETAIL2 )
  23. // ($DETAIL_BLEND_MODE == 9) && ( $LIGHTING_PREVIEW )
  24. // ($FANCY_BLENDING) && ($DETAIL_BLEND_MODE == 7 )
  25. // ($FANCY_BLENDING) && ($BASETEXTURE2 == 0 ) && ($BUMPMAP2 == 0 )
  26. // ( $FLASHLIGHT == 0 ) && ( $FLASHLIGHTSHADOWS == 1 )
  27. // ( $CUBEMAP == 2 ) && ( $BUMPMAP2 )
  28. // ( $CASCADED_SHADOW_MAPPING == 0 ) && ( $CASCADE_SIZE != 0 )
  29. // ( $CASCADED_SHADOW_MAPPING != 0 ) && ( $SFM != 0 )
  30. // ( $CASCADED_SHADOW_MAPPING == 0 ) && ( $CSM_MODE != 0 )
  31. // ( $PHONG == 1 ) && ( $CASCADED_SHADOW_MAPPING == 0 )
  32. // ( $DETAIL_BLEND_MODE == 12 ) && ( $DETAIL2 == 1 )
  33. // $NORMALMAPALPHAENVMAPMASK && $BASEALPHAENVMAPMASK
  34. // $NORMALMAPALPHAENVMAPMASK && $ENVMAPMASK
  35. // $BASEALPHAENVMAPMASK && $ENVMAPMASK
  36. // $BASEALPHAENVMAPMASK && $SELFILLUM
  37. // !$FASTPATH && $FASTPATHENVMAPCONTRAST
  38. // !$FASTPATH && $FASTPATHENVMAPTINT
  39. // !$BUMPMAP && $BUMPMAP2
  40. // $BASEALPHAENVMAPMASK && ( $BUMPMAP && !$ENVMAPANISOTROPY )
  41. // $SEAMLESS && ( $DETAIL_BLEND_MODE != 12 )
  42. // $BUMPMASK && ( $SEAMLESS || ( $DETAILTEXTURE != 12 ) || $SELFILLUM || $BASETEXTURE2 )
  43. // $ENVMAPANISOTROPY && !$ENVMAP && ( $BUMPMAP != 1 )
  44. // $ENVMAPANISOTROPY && $NORMALMAPALPHAENVMAPMASK
  45. // !$BUMPMAP && $ADDBUMPMAPS
  46. // !$BUMPMAP2 && $ADDBUMPMAPS
  47. // $BUMPMASK && $ADDBUMPMAPS
  48. // $ADDBUMPMAPS && ( $DETAIL_BLEND_MODE != 12 )
  49. // ( $DETAIL == 2 ) && !$BASETEXTURE2
  50. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  51. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  52. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  53. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  54. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  55. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  56. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  57. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  58. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  59. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  60. #include "shaderlib/cshader.h"
  61. class lightmappedgeneric_ps20_Static_Index
  62. {
  63. private:
  64. int m_nBASETEXTURE2;
  65. #ifdef _DEBUG
  66. bool m_bBASETEXTURE2;
  67. #endif
  68. public:
  69. void SetBASETEXTURE2( int i )
  70. {
  71. Assert( i >= 0 && i <= 1 );
  72. m_nBASETEXTURE2 = i;
  73. #ifdef _DEBUG
  74. m_bBASETEXTURE2 = true;
  75. #endif
  76. }
  77. void SetBASETEXTURE2( bool i )
  78. {
  79. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  80. m_nBASETEXTURE2 = i ? 1 : 0;
  81. #ifdef _DEBUG
  82. m_bBASETEXTURE2 = true;
  83. #endif
  84. }
  85. private:
  86. int m_nBUMPMAP;
  87. #ifdef _DEBUG
  88. bool m_bBUMPMAP;
  89. #endif
  90. public:
  91. void SetBUMPMAP( int i )
  92. {
  93. Assert( i >= 0 && i <= 2 );
  94. m_nBUMPMAP = i;
  95. #ifdef _DEBUG
  96. m_bBUMPMAP = true;
  97. #endif
  98. }
  99. void SetBUMPMAP( bool i )
  100. {
  101. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  102. m_nBUMPMAP = i ? 1 : 0;
  103. #ifdef _DEBUG
  104. m_bBUMPMAP = true;
  105. #endif
  106. }
  107. private:
  108. int m_nBUMPMAP2;
  109. #ifdef _DEBUG
  110. bool m_bBUMPMAP2;
  111. #endif
  112. public:
  113. void SetBUMPMAP2( int i )
  114. {
  115. Assert( i >= 0 && i <= 0 );
  116. m_nBUMPMAP2 = i;
  117. #ifdef _DEBUG
  118. m_bBUMPMAP2 = true;
  119. #endif
  120. }
  121. void SetBUMPMAP2( bool i )
  122. {
  123. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  124. m_nBUMPMAP2 = i ? 1 : 0;
  125. #ifdef _DEBUG
  126. m_bBUMPMAP2 = true;
  127. #endif
  128. }
  129. private:
  130. int m_nCUBEMAP;
  131. #ifdef _DEBUG
  132. bool m_bCUBEMAP;
  133. #endif
  134. public:
  135. void SetCUBEMAP( int i )
  136. {
  137. Assert( i >= 0 && i <= 2 );
  138. m_nCUBEMAP = i;
  139. #ifdef _DEBUG
  140. m_bCUBEMAP = true;
  141. #endif
  142. }
  143. void SetCUBEMAP( bool i )
  144. {
  145. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  146. m_nCUBEMAP = i ? 1 : 0;
  147. #ifdef _DEBUG
  148. m_bCUBEMAP = true;
  149. #endif
  150. }
  151. private:
  152. int m_nENVMAPMASK;
  153. #ifdef _DEBUG
  154. bool m_bENVMAPMASK;
  155. #endif
  156. public:
  157. void SetENVMAPMASK( int i )
  158. {
  159. Assert( i >= 0 && i <= 1 );
  160. m_nENVMAPMASK = i;
  161. #ifdef _DEBUG
  162. m_bENVMAPMASK = true;
  163. #endif
  164. }
  165. void SetENVMAPMASK( bool i )
  166. {
  167. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  168. m_nENVMAPMASK = i ? 1 : 0;
  169. #ifdef _DEBUG
  170. m_bENVMAPMASK = true;
  171. #endif
  172. }
  173. private:
  174. int m_nBASEALPHAENVMAPMASK;
  175. #ifdef _DEBUG
  176. bool m_bBASEALPHAENVMAPMASK;
  177. #endif
  178. public:
  179. void SetBASEALPHAENVMAPMASK( int i )
  180. {
  181. Assert( i >= 0 && i <= 1 );
  182. m_nBASEALPHAENVMAPMASK = i;
  183. #ifdef _DEBUG
  184. m_bBASEALPHAENVMAPMASK = true;
  185. #endif
  186. }
  187. void SetBASEALPHAENVMAPMASK( bool i )
  188. {
  189. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  190. m_nBASEALPHAENVMAPMASK = i ? 1 : 0;
  191. #ifdef _DEBUG
  192. m_bBASEALPHAENVMAPMASK = true;
  193. #endif
  194. }
  195. private:
  196. int m_nSELFILLUM;
  197. #ifdef _DEBUG
  198. bool m_bSELFILLUM;
  199. #endif
  200. public:
  201. void SetSELFILLUM( int i )
  202. {
  203. Assert( i >= 0 && i <= 1 );
  204. m_nSELFILLUM = i;
  205. #ifdef _DEBUG
  206. m_bSELFILLUM = true;
  207. #endif
  208. }
  209. void SetSELFILLUM( bool i )
  210. {
  211. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  212. m_nSELFILLUM = i ? 1 : 0;
  213. #ifdef _DEBUG
  214. m_bSELFILLUM = true;
  215. #endif
  216. }
  217. private:
  218. int m_nNORMALMAPALPHAENVMAPMASK;
  219. #ifdef _DEBUG
  220. bool m_bNORMALMAPALPHAENVMAPMASK;
  221. #endif
  222. public:
  223. void SetNORMALMAPALPHAENVMAPMASK( int i )
  224. {
  225. Assert( i >= 0 && i <= 1 );
  226. m_nNORMALMAPALPHAENVMAPMASK = i;
  227. #ifdef _DEBUG
  228. m_bNORMALMAPALPHAENVMAPMASK = true;
  229. #endif
  230. }
  231. void SetNORMALMAPALPHAENVMAPMASK( bool i )
  232. {
  233. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  234. m_nNORMALMAPALPHAENVMAPMASK = i ? 1 : 0;
  235. #ifdef _DEBUG
  236. m_bNORMALMAPALPHAENVMAPMASK = true;
  237. #endif
  238. }
  239. private:
  240. int m_nFANCY_BLENDING;
  241. #ifdef _DEBUG
  242. bool m_bFANCY_BLENDING;
  243. #endif
  244. public:
  245. void SetFANCY_BLENDING( int i )
  246. {
  247. Assert( i >= 0 && i <= 0 );
  248. m_nFANCY_BLENDING = i;
  249. #ifdef _DEBUG
  250. m_bFANCY_BLENDING = true;
  251. #endif
  252. }
  253. void SetFANCY_BLENDING( bool i )
  254. {
  255. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  256. m_nFANCY_BLENDING = i ? 1 : 0;
  257. #ifdef _DEBUG
  258. m_bFANCY_BLENDING = true;
  259. #endif
  260. }
  261. private:
  262. int m_nSEAMLESS;
  263. #ifdef _DEBUG
  264. bool m_bSEAMLESS;
  265. #endif
  266. public:
  267. void SetSEAMLESS( int i )
  268. {
  269. Assert( i >= 0 && i <= 1 );
  270. m_nSEAMLESS = i;
  271. #ifdef _DEBUG
  272. m_bSEAMLESS = true;
  273. #endif
  274. }
  275. void SetSEAMLESS( bool i )
  276. {
  277. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  278. m_nSEAMLESS = i ? 1 : 0;
  279. #ifdef _DEBUG
  280. m_bSEAMLESS = true;
  281. #endif
  282. }
  283. private:
  284. int m_nENVMAPANISOTROPY;
  285. #ifdef _DEBUG
  286. bool m_bENVMAPANISOTROPY;
  287. #endif
  288. public:
  289. void SetENVMAPANISOTROPY( int i )
  290. {
  291. Assert( i >= 0 && i <= 0 );
  292. m_nENVMAPANISOTROPY = i;
  293. #ifdef _DEBUG
  294. m_bENVMAPANISOTROPY = true;
  295. #endif
  296. }
  297. void SetENVMAPANISOTROPY( bool i )
  298. {
  299. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  300. m_nENVMAPANISOTROPY = i ? 1 : 0;
  301. #ifdef _DEBUG
  302. m_bENVMAPANISOTROPY = true;
  303. #endif
  304. }
  305. private:
  306. int m_nADDBUMPMAPS;
  307. #ifdef _DEBUG
  308. bool m_bADDBUMPMAPS;
  309. #endif
  310. public:
  311. void SetADDBUMPMAPS( int i )
  312. {
  313. Assert( i >= 0 && i <= 0 );
  314. m_nADDBUMPMAPS = i;
  315. #ifdef _DEBUG
  316. m_bADDBUMPMAPS = true;
  317. #endif
  318. }
  319. void SetADDBUMPMAPS( bool i )
  320. {
  321. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  322. m_nADDBUMPMAPS = i ? 1 : 0;
  323. #ifdef _DEBUG
  324. m_bADDBUMPMAPS = true;
  325. #endif
  326. }
  327. private:
  328. int m_nBUMPMASK;
  329. #ifdef _DEBUG
  330. bool m_bBUMPMASK;
  331. #endif
  332. public:
  333. void SetBUMPMASK( int i )
  334. {
  335. Assert( i >= 0 && i <= 0 );
  336. m_nBUMPMASK = i;
  337. #ifdef _DEBUG
  338. m_bBUMPMASK = true;
  339. #endif
  340. }
  341. void SetBUMPMASK( bool i )
  342. {
  343. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  344. m_nBUMPMASK = i ? 1 : 0;
  345. #ifdef _DEBUG
  346. m_bBUMPMASK = true;
  347. #endif
  348. }
  349. private:
  350. int m_nDETAIL_BLEND_MODE;
  351. #ifdef _DEBUG
  352. bool m_bDETAIL_BLEND_MODE;
  353. #endif
  354. public:
  355. void SetDETAIL_BLEND_MODE( int i )
  356. {
  357. Assert( i >= 0 && i <= 12 );
  358. m_nDETAIL_BLEND_MODE = i;
  359. #ifdef _DEBUG
  360. m_bDETAIL_BLEND_MODE = true;
  361. #endif
  362. }
  363. void SetDETAIL_BLEND_MODE( bool i )
  364. {
  365. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 12 );
  366. m_nDETAIL_BLEND_MODE = i ? 1 : 0;
  367. #ifdef _DEBUG
  368. m_bDETAIL_BLEND_MODE = true;
  369. #endif
  370. }
  371. private:
  372. int m_nSHADER_SRGB_READ;
  373. #ifdef _DEBUG
  374. bool m_bSHADER_SRGB_READ;
  375. #endif
  376. public:
  377. void SetSHADER_SRGB_READ( int i )
  378. {
  379. Assert( i >= 0 && i <= 0 );
  380. m_nSHADER_SRGB_READ = i;
  381. #ifdef _DEBUG
  382. m_bSHADER_SRGB_READ = true;
  383. #endif
  384. }
  385. void SetSHADER_SRGB_READ( bool i )
  386. {
  387. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  388. m_nSHADER_SRGB_READ = i ? 1 : 0;
  389. #ifdef _DEBUG
  390. m_bSHADER_SRGB_READ = true;
  391. #endif
  392. }
  393. private:
  394. int m_nLIGHTING_PREVIEW;
  395. #ifdef _DEBUG
  396. bool m_bLIGHTING_PREVIEW;
  397. #endif
  398. public:
  399. void SetLIGHTING_PREVIEW( int i )
  400. {
  401. Assert( i >= 0 && i <= 1 );
  402. m_nLIGHTING_PREVIEW = i;
  403. #ifdef _DEBUG
  404. m_bLIGHTING_PREVIEW = true;
  405. #endif
  406. }
  407. void SetLIGHTING_PREVIEW( bool i )
  408. {
  409. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  410. m_nLIGHTING_PREVIEW = i ? 1 : 0;
  411. #ifdef _DEBUG
  412. m_bLIGHTING_PREVIEW = true;
  413. #endif
  414. }
  415. private:
  416. int m_nCASCADED_SHADOW_MAPPING;
  417. #ifdef _DEBUG
  418. bool m_bCASCADED_SHADOW_MAPPING;
  419. #endif
  420. public:
  421. void SetCASCADED_SHADOW_MAPPING( int i )
  422. {
  423. Assert( i >= 0 && i <= 0 );
  424. m_nCASCADED_SHADOW_MAPPING = i;
  425. #ifdef _DEBUG
  426. m_bCASCADED_SHADOW_MAPPING = true;
  427. #endif
  428. }
  429. void SetCASCADED_SHADOW_MAPPING( bool i )
  430. {
  431. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  432. m_nCASCADED_SHADOW_MAPPING = i ? 1 : 0;
  433. #ifdef _DEBUG
  434. m_bCASCADED_SHADOW_MAPPING = true;
  435. #endif
  436. }
  437. private:
  438. int m_nCSM_MODE;
  439. #ifdef _DEBUG
  440. bool m_bCSM_MODE;
  441. #endif
  442. public:
  443. void SetCSM_MODE( int i )
  444. {
  445. Assert( i >= 0 && i <= 0 );
  446. m_nCSM_MODE = i;
  447. #ifdef _DEBUG
  448. m_bCSM_MODE = true;
  449. #endif
  450. }
  451. void SetCSM_MODE( bool i )
  452. {
  453. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  454. m_nCSM_MODE = i ? 1 : 0;
  455. #ifdef _DEBUG
  456. m_bCSM_MODE = true;
  457. #endif
  458. }
  459. private:
  460. int m_nCSM_BLENDING;
  461. #ifdef _DEBUG
  462. bool m_bCSM_BLENDING;
  463. #endif
  464. public:
  465. void SetCSM_BLENDING( int i )
  466. {
  467. Assert( i >= 0 && i <= 1 );
  468. m_nCSM_BLENDING = i;
  469. #ifdef _DEBUG
  470. m_bCSM_BLENDING = true;
  471. #endif
  472. }
  473. void SetCSM_BLENDING( bool i )
  474. {
  475. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  476. m_nCSM_BLENDING = i ? 1 : 0;
  477. #ifdef _DEBUG
  478. m_bCSM_BLENDING = true;
  479. #endif
  480. }
  481. private:
  482. int m_nPHONG;
  483. #ifdef _DEBUG
  484. bool m_bPHONG;
  485. #endif
  486. public:
  487. void SetPHONG( int i )
  488. {
  489. Assert( i >= 0 && i <= 0 );
  490. m_nPHONG = i;
  491. #ifdef _DEBUG
  492. m_bPHONG = true;
  493. #endif
  494. }
  495. void SetPHONG( bool i )
  496. {
  497. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  498. m_nPHONG = i ? 1 : 0;
  499. #ifdef _DEBUG
  500. m_bPHONG = true;
  501. #endif
  502. }
  503. private:
  504. int m_nDOPIXELFOG;
  505. #ifdef _DEBUG
  506. bool m_bDOPIXELFOG;
  507. #endif
  508. public:
  509. void SetDOPIXELFOG( int i )
  510. {
  511. Assert( i >= 0 && i <= 0 );
  512. m_nDOPIXELFOG = i;
  513. #ifdef _DEBUG
  514. m_bDOPIXELFOG = true;
  515. #endif
  516. }
  517. void SetDOPIXELFOG( bool i )
  518. {
  519. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  520. m_nDOPIXELFOG = i ? 1 : 0;
  521. #ifdef _DEBUG
  522. m_bDOPIXELFOG = true;
  523. #endif
  524. }
  525. public:
  526. // CONSTRUCTOR
  527. lightmappedgeneric_ps20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  528. {
  529. #ifdef _DEBUG
  530. m_bBASETEXTURE2 = false;
  531. #endif // _DEBUG
  532. m_nBASETEXTURE2 = 0;
  533. #ifdef _DEBUG
  534. m_bBUMPMAP = false;
  535. #endif // _DEBUG
  536. m_nBUMPMAP = 0;
  537. #ifdef _DEBUG
  538. m_bBUMPMAP2 = false;
  539. #endif // _DEBUG
  540. m_nBUMPMAP2 = 0;
  541. #ifdef _DEBUG
  542. m_bCUBEMAP = false;
  543. #endif // _DEBUG
  544. m_nCUBEMAP = 0;
  545. #ifdef _DEBUG
  546. m_bENVMAPMASK = false;
  547. #endif // _DEBUG
  548. m_nENVMAPMASK = 0;
  549. #ifdef _DEBUG
  550. m_bBASEALPHAENVMAPMASK = false;
  551. #endif // _DEBUG
  552. m_nBASEALPHAENVMAPMASK = 0;
  553. #ifdef _DEBUG
  554. m_bSELFILLUM = false;
  555. #endif // _DEBUG
  556. m_nSELFILLUM = 0;
  557. #ifdef _DEBUG
  558. m_bNORMALMAPALPHAENVMAPMASK = false;
  559. #endif // _DEBUG
  560. m_nNORMALMAPALPHAENVMAPMASK = 0;
  561. #ifdef _DEBUG
  562. m_bFANCY_BLENDING = false;
  563. #endif // _DEBUG
  564. m_nFANCY_BLENDING = 0;
  565. #ifdef _DEBUG
  566. m_bSEAMLESS = false;
  567. #endif // _DEBUG
  568. m_nSEAMLESS = 0;
  569. #ifdef _DEBUG
  570. m_bENVMAPANISOTROPY = false;
  571. #endif // _DEBUG
  572. m_nENVMAPANISOTROPY = 0;
  573. #ifdef _DEBUG
  574. m_bADDBUMPMAPS = false;
  575. #endif // _DEBUG
  576. m_nADDBUMPMAPS = 0;
  577. #ifdef _DEBUG
  578. m_bBUMPMASK = false;
  579. #endif // _DEBUG
  580. m_nBUMPMASK = 0;
  581. #ifdef _DEBUG
  582. m_bDETAIL_BLEND_MODE = false;
  583. #endif // _DEBUG
  584. m_nDETAIL_BLEND_MODE = 0;
  585. #ifdef _DEBUG
  586. m_bSHADER_SRGB_READ = false;
  587. #endif // _DEBUG
  588. m_nSHADER_SRGB_READ = 0;
  589. #ifdef _DEBUG
  590. m_bLIGHTING_PREVIEW = false;
  591. #endif // _DEBUG
  592. m_nLIGHTING_PREVIEW = 0;
  593. #ifdef _DEBUG
  594. m_bCASCADED_SHADOW_MAPPING = true;
  595. #endif // _DEBUG
  596. m_nCASCADED_SHADOW_MAPPING = 0 ;
  597. #ifdef _DEBUG
  598. m_bCSM_MODE = true;
  599. #endif // _DEBUG
  600. m_nCSM_MODE = 0 ;
  601. #ifdef _DEBUG
  602. m_bCSM_BLENDING = false;
  603. #endif // _DEBUG
  604. m_nCSM_BLENDING = 0;
  605. #ifdef _DEBUG
  606. m_bPHONG = false;
  607. #endif // _DEBUG
  608. m_nPHONG = 0;
  609. #ifdef _DEBUG
  610. m_bDOPIXELFOG = true;
  611. #endif // _DEBUG
  612. m_nDOPIXELFOG = 0 ;
  613. }
  614. int GetIndex()
  615. {
  616. // Asserts to make sure that we aren't using any skipped combinations.
  617. // Asserts to make sure that we are setting all of the combination vars.
  618. #ifdef _DEBUG
  619. bool bAllStaticVarsDefined = m_bBASETEXTURE2 && m_bBUMPMAP && m_bBUMPMAP2 && m_bCUBEMAP && m_bENVMAPMASK && m_bBASEALPHAENVMAPMASK && m_bSELFILLUM && m_bNORMALMAPALPHAENVMAPMASK && m_bFANCY_BLENDING && m_bSEAMLESS && m_bENVMAPANISOTROPY && m_bADDBUMPMAPS && m_bBUMPMASK && m_bDETAIL_BLEND_MODE && m_bSHADER_SRGB_READ && m_bLIGHTING_PREVIEW && m_bCASCADED_SHADOW_MAPPING && m_bCSM_MODE && m_bCSM_BLENDING && m_bPHONG && m_bDOPIXELFOG;
  620. Assert( bAllStaticVarsDefined );
  621. #endif // _DEBUG
  622. return ( 16 * m_nBASETEXTURE2 ) + ( 32 * m_nBUMPMAP ) + ( 96 * m_nBUMPMAP2 ) + ( 96 * m_nCUBEMAP ) + ( 288 * m_nENVMAPMASK ) + ( 576 * m_nBASEALPHAENVMAPMASK ) + ( 1152 * m_nSELFILLUM ) + ( 2304 * m_nNORMALMAPALPHAENVMAPMASK ) + ( 4608 * m_nFANCY_BLENDING ) + ( 4608 * m_nSEAMLESS ) + ( 9216 * m_nENVMAPANISOTROPY ) + ( 9216 * m_nADDBUMPMAPS ) + ( 9216 * m_nBUMPMASK ) + ( 9216 * m_nDETAIL_BLEND_MODE ) + ( 119808 * m_nSHADER_SRGB_READ ) + ( 119808 * m_nLIGHTING_PREVIEW ) + ( 239616 * m_nCASCADED_SHADOW_MAPPING ) + ( 239616 * m_nCSM_MODE ) + ( 239616 * m_nCSM_BLENDING ) + ( 479232 * m_nPHONG ) + ( 479232 * m_nDOPIXELFOG ) + 0;
  623. }
  624. };
  625. #define shaderStaticTest_lightmappedgeneric_ps20 psh_forgot_to_set_static_BASETEXTURE2 + psh_forgot_to_set_static_BUMPMAP + psh_forgot_to_set_static_BUMPMAP2 + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_ENVMAPMASK + psh_forgot_to_set_static_BASEALPHAENVMAPMASK + psh_forgot_to_set_static_SELFILLUM + psh_forgot_to_set_static_NORMALMAPALPHAENVMAPMASK + psh_forgot_to_set_static_FANCY_BLENDING + psh_forgot_to_set_static_SEAMLESS + psh_forgot_to_set_static_ENVMAPANISOTROPY + psh_forgot_to_set_static_ADDBUMPMAPS + psh_forgot_to_set_static_BUMPMASK + psh_forgot_to_set_static_DETAIL_BLEND_MODE + psh_forgot_to_set_static_SHADER_SRGB_READ + psh_forgot_to_set_static_LIGHTING_PREVIEW + psh_forgot_to_set_static_CSM_BLENDING + psh_forgot_to_set_static_PHONG + 0
  626. class lightmappedgeneric_ps20_Dynamic_Index
  627. {
  628. private:
  629. int m_nFASTPATHENVMAPCONTRAST;
  630. #ifdef _DEBUG
  631. bool m_bFASTPATHENVMAPCONTRAST;
  632. #endif
  633. public:
  634. void SetFASTPATHENVMAPCONTRAST( int i )
  635. {
  636. Assert( i >= 0 && i <= 1 );
  637. m_nFASTPATHENVMAPCONTRAST = i;
  638. #ifdef _DEBUG
  639. m_bFASTPATHENVMAPCONTRAST = true;
  640. #endif
  641. }
  642. void SetFASTPATHENVMAPCONTRAST( bool i )
  643. {
  644. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  645. m_nFASTPATHENVMAPCONTRAST = i ? 1 : 0;
  646. #ifdef _DEBUG
  647. m_bFASTPATHENVMAPCONTRAST = true;
  648. #endif
  649. }
  650. private:
  651. int m_nFASTPATH;
  652. #ifdef _DEBUG
  653. bool m_bFASTPATH;
  654. #endif
  655. public:
  656. void SetFASTPATH( int i )
  657. {
  658. Assert( i >= 0 && i <= 1 );
  659. m_nFASTPATH = i;
  660. #ifdef _DEBUG
  661. m_bFASTPATH = true;
  662. #endif
  663. }
  664. void SetFASTPATH( bool i )
  665. {
  666. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  667. m_nFASTPATH = i ? 1 : 0;
  668. #ifdef _DEBUG
  669. m_bFASTPATH = true;
  670. #endif
  671. }
  672. private:
  673. int m_nWRITEWATERFOGTODESTALPHA;
  674. #ifdef _DEBUG
  675. bool m_bWRITEWATERFOGTODESTALPHA;
  676. #endif
  677. public:
  678. void SetWRITEWATERFOGTODESTALPHA( int i )
  679. {
  680. Assert( i >= 0 && i <= 1 );
  681. m_nWRITEWATERFOGTODESTALPHA = i;
  682. #ifdef _DEBUG
  683. m_bWRITEWATERFOGTODESTALPHA = true;
  684. #endif
  685. }
  686. void SetWRITEWATERFOGTODESTALPHA( bool i )
  687. {
  688. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  689. m_nWRITEWATERFOGTODESTALPHA = i ? 1 : 0;
  690. #ifdef _DEBUG
  691. m_bWRITEWATERFOGTODESTALPHA = true;
  692. #endif
  693. }
  694. private:
  695. int m_nWRITE_DEPTH_TO_DESTALPHA;
  696. #ifdef _DEBUG
  697. bool m_bWRITE_DEPTH_TO_DESTALPHA;
  698. #endif
  699. public:
  700. void SetWRITE_DEPTH_TO_DESTALPHA( int i )
  701. {
  702. Assert( i >= 0 && i <= 0 );
  703. m_nWRITE_DEPTH_TO_DESTALPHA = i;
  704. #ifdef _DEBUG
  705. m_bWRITE_DEPTH_TO_DESTALPHA = true;
  706. #endif
  707. }
  708. void SetWRITE_DEPTH_TO_DESTALPHA( bool i )
  709. {
  710. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  711. m_nWRITE_DEPTH_TO_DESTALPHA = i ? 1 : 0;
  712. #ifdef _DEBUG
  713. m_bWRITE_DEPTH_TO_DESTALPHA = true;
  714. #endif
  715. }
  716. private:
  717. int m_nCASCADE_SIZE;
  718. #ifdef _DEBUG
  719. bool m_bCASCADE_SIZE;
  720. #endif
  721. public:
  722. void SetCASCADE_SIZE( int i )
  723. {
  724. Assert( i >= 0 && i <= 0 );
  725. m_nCASCADE_SIZE = i;
  726. #ifdef _DEBUG
  727. m_bCASCADE_SIZE = true;
  728. #endif
  729. }
  730. void SetCASCADE_SIZE( bool i )
  731. {
  732. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  733. m_nCASCADE_SIZE = i ? 1 : 0;
  734. #ifdef _DEBUG
  735. m_bCASCADE_SIZE = true;
  736. #endif
  737. }
  738. private:
  739. int m_nPIXELFOGTYPE;
  740. #ifdef _DEBUG
  741. bool m_bPIXELFOGTYPE;
  742. #endif
  743. public:
  744. void SetPIXELFOGTYPE( int i )
  745. {
  746. Assert( i >= 0 && i <= 1 );
  747. m_nPIXELFOGTYPE = i;
  748. #ifdef _DEBUG
  749. m_bPIXELFOGTYPE = true;
  750. #endif
  751. }
  752. void SetPIXELFOGTYPE( bool i )
  753. {
  754. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  755. m_nPIXELFOGTYPE = i ? 1 : 0;
  756. #ifdef _DEBUG
  757. m_bPIXELFOGTYPE = true;
  758. #endif
  759. }
  760. public:
  761. // CONSTRUCTOR
  762. lightmappedgeneric_ps20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  763. {
  764. #ifdef _DEBUG
  765. m_bFASTPATHENVMAPCONTRAST = false;
  766. #endif // _DEBUG
  767. m_nFASTPATHENVMAPCONTRAST = 0;
  768. #ifdef _DEBUG
  769. m_bFASTPATH = false;
  770. #endif // _DEBUG
  771. m_nFASTPATH = 0;
  772. #ifdef _DEBUG
  773. m_bWRITEWATERFOGTODESTALPHA = false;
  774. #endif // _DEBUG
  775. m_nWRITEWATERFOGTODESTALPHA = 0;
  776. #ifdef _DEBUG
  777. m_bWRITE_DEPTH_TO_DESTALPHA = false;
  778. #endif // _DEBUG
  779. m_nWRITE_DEPTH_TO_DESTALPHA = 0;
  780. #ifdef _DEBUG
  781. m_bCASCADE_SIZE = false;
  782. #endif // _DEBUG
  783. m_nCASCADE_SIZE = 0;
  784. #ifdef _DEBUG
  785. m_bPIXELFOGTYPE = true;
  786. #endif // _DEBUG
  787. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  788. }
  789. int GetIndex()
  790. {
  791. // Asserts to make sure that we aren't using any skipped combinations.
  792. // Asserts to make sure that we are setting all of the combination vars.
  793. #ifdef _DEBUG
  794. bool bAllDynamicVarsDefined = m_bFASTPATHENVMAPCONTRAST && m_bFASTPATH && m_bWRITEWATERFOGTODESTALPHA && m_bWRITE_DEPTH_TO_DESTALPHA && m_bCASCADE_SIZE && m_bPIXELFOGTYPE;
  795. Assert( bAllDynamicVarsDefined );
  796. #endif // _DEBUG
  797. return ( 1 * m_nFASTPATHENVMAPCONTRAST ) + ( 2 * m_nFASTPATH ) + ( 4 * m_nWRITEWATERFOGTODESTALPHA ) + ( 8 * m_nWRITE_DEPTH_TO_DESTALPHA ) + ( 8 * m_nCASCADE_SIZE ) + ( 8 * m_nPIXELFOGTYPE ) + 0;
  798. }
  799. };
  800. #define shaderDynamicTest_lightmappedgeneric_ps20 psh_forgot_to_set_dynamic_FASTPATHENVMAPCONTRAST + psh_forgot_to_set_dynamic_FASTPATH + psh_forgot_to_set_dynamic_WRITEWATERFOGTODESTALPHA + psh_forgot_to_set_dynamic_WRITE_DEPTH_TO_DESTALPHA + psh_forgot_to_set_dynamic_CASCADE_SIZE + 0
  801. static const ShaderComboInformation_t s_DynamicComboArray_lightmappedgeneric_ps20[6] =
  802. {
  803. { "FASTPATHENVMAPCONTRAST", 0, 1 },
  804. { "FASTPATH", 0, 1 },
  805. { "WRITEWATERFOGTODESTALPHA", 0, 1 },
  806. { "WRITE_DEPTH_TO_DESTALPHA", 0, 0 },
  807. { "CASCADE_SIZE", 0, 0 },
  808. { "PIXELFOGTYPE", 0, 1 },
  809. };
  810. static const ShaderComboInformation_t s_StaticComboArray_lightmappedgeneric_ps20[21] =
  811. {
  812. { "BASETEXTURE2", 0, 1 },
  813. { "BUMPMAP", 0, 2 },
  814. { "BUMPMAP2", 0, 0 },
  815. { "CUBEMAP", 0, 2 },
  816. { "ENVMAPMASK", 0, 1 },
  817. { "BASEALPHAENVMAPMASK", 0, 1 },
  818. { "SELFILLUM", 0, 1 },
  819. { "NORMALMAPALPHAENVMAPMASK", 0, 1 },
  820. { "FANCY_BLENDING", 0, 0 },
  821. { "SEAMLESS", 0, 1 },
  822. { "ENVMAPANISOTROPY", 0, 0 },
  823. { "ADDBUMPMAPS", 0, 0 },
  824. { "BUMPMASK", 0, 0 },
  825. { "DETAIL_BLEND_MODE", 0, 12 },
  826. { "SHADER_SRGB_READ", 0, 0 },
  827. { "LIGHTING_PREVIEW", 0, 1 },
  828. { "CASCADED_SHADOW_MAPPING", 0, 0 },
  829. { "CSM_MODE", 0, 0 },
  830. { "CSM_BLENDING", 0, 1 },
  831. { "PHONG", 0, 0 },
  832. { "DOPIXELFOG", 0, 0 },
  833. };
  834. static const ShaderComboSemantics_t lightmappedgeneric_ps20_combos =
  835. {
  836. "lightmappedgeneric_ps20", s_DynamicComboArray_lightmappedgeneric_ps20, 6, s_StaticComboArray_lightmappedgeneric_ps20, 21
  837. };
  838. class ConstructMe_lightmappedgeneric_ps20
  839. {
  840. public:
  841. ConstructMe_lightmappedgeneric_ps20()
  842. {
  843. GetShaderDLL()->AddShaderComboInformation( &lightmappedgeneric_ps20_combos );
  844. }
  845. };
  846. static ConstructMe_lightmappedgeneric_ps20 s_ConstructMe_lightmappedgeneric_ps20;