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.

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