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.

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