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.

800 lines
19 KiB

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