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.

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