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.

732 lines
18 KiB

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