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.

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