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.

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