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.

818 lines
20 KiB

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