Team Fortress 2 Source Code as on 22/4/2020
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.

537 lines
12 KiB

  1. #include "shaderlib/cshader.h"
  2. class skin_ps20b_Static_Index
  3. {
  4. private:
  5. int m_nCONVERT_TO_SRGB;
  6. #ifdef _DEBUG
  7. bool m_bCONVERT_TO_SRGB;
  8. #endif
  9. public:
  10. void SetCONVERT_TO_SRGB( int i )
  11. {
  12. Assert( i >= 0 && i <= 0 );
  13. m_nCONVERT_TO_SRGB = i;
  14. #ifdef _DEBUG
  15. m_bCONVERT_TO_SRGB = true;
  16. #endif
  17. }
  18. void SetCONVERT_TO_SRGB( bool i )
  19. {
  20. m_nCONVERT_TO_SRGB = i ? 1 : 0;
  21. #ifdef _DEBUG
  22. m_bCONVERT_TO_SRGB = true;
  23. #endif
  24. }
  25. private:
  26. int m_nCUBEMAP;
  27. #ifdef _DEBUG
  28. bool m_bCUBEMAP;
  29. #endif
  30. public:
  31. void SetCUBEMAP( int i )
  32. {
  33. Assert( i >= 0 && i <= 1 );
  34. m_nCUBEMAP = i;
  35. #ifdef _DEBUG
  36. m_bCUBEMAP = true;
  37. #endif
  38. }
  39. void SetCUBEMAP( bool i )
  40. {
  41. m_nCUBEMAP = i ? 1 : 0;
  42. #ifdef _DEBUG
  43. m_bCUBEMAP = true;
  44. #endif
  45. }
  46. private:
  47. int m_nSELFILLUM;
  48. #ifdef _DEBUG
  49. bool m_bSELFILLUM;
  50. #endif
  51. public:
  52. void SetSELFILLUM( int i )
  53. {
  54. Assert( i >= 0 && i <= 1 );
  55. m_nSELFILLUM = i;
  56. #ifdef _DEBUG
  57. m_bSELFILLUM = true;
  58. #endif
  59. }
  60. void SetSELFILLUM( bool i )
  61. {
  62. m_nSELFILLUM = i ? 1 : 0;
  63. #ifdef _DEBUG
  64. m_bSELFILLUM = true;
  65. #endif
  66. }
  67. private:
  68. int m_nSELFILLUMFRESNEL;
  69. #ifdef _DEBUG
  70. bool m_bSELFILLUMFRESNEL;
  71. #endif
  72. public:
  73. void SetSELFILLUMFRESNEL( int i )
  74. {
  75. Assert( i >= 0 && i <= 1 );
  76. m_nSELFILLUMFRESNEL = i;
  77. #ifdef _DEBUG
  78. m_bSELFILLUMFRESNEL = true;
  79. #endif
  80. }
  81. void SetSELFILLUMFRESNEL( bool i )
  82. {
  83. m_nSELFILLUMFRESNEL = i ? 1 : 0;
  84. #ifdef _DEBUG
  85. m_bSELFILLUMFRESNEL = true;
  86. #endif
  87. }
  88. private:
  89. int m_nFLASHLIGHT;
  90. #ifdef _DEBUG
  91. bool m_bFLASHLIGHT;
  92. #endif
  93. public:
  94. void SetFLASHLIGHT( int i )
  95. {
  96. Assert( i >= 0 && i <= 1 );
  97. m_nFLASHLIGHT = i;
  98. #ifdef _DEBUG
  99. m_bFLASHLIGHT = true;
  100. #endif
  101. }
  102. void SetFLASHLIGHT( bool i )
  103. {
  104. m_nFLASHLIGHT = i ? 1 : 0;
  105. #ifdef _DEBUG
  106. m_bFLASHLIGHT = true;
  107. #endif
  108. }
  109. private:
  110. int m_nLIGHTWARPTEXTURE;
  111. #ifdef _DEBUG
  112. bool m_bLIGHTWARPTEXTURE;
  113. #endif
  114. public:
  115. void SetLIGHTWARPTEXTURE( int i )
  116. {
  117. Assert( i >= 0 && i <= 1 );
  118. m_nLIGHTWARPTEXTURE = i;
  119. #ifdef _DEBUG
  120. m_bLIGHTWARPTEXTURE = true;
  121. #endif
  122. }
  123. void SetLIGHTWARPTEXTURE( bool i )
  124. {
  125. m_nLIGHTWARPTEXTURE = i ? 1 : 0;
  126. #ifdef _DEBUG
  127. m_bLIGHTWARPTEXTURE = true;
  128. #endif
  129. }
  130. private:
  131. int m_nPHONGWARPTEXTURE;
  132. #ifdef _DEBUG
  133. bool m_bPHONGWARPTEXTURE;
  134. #endif
  135. public:
  136. void SetPHONGWARPTEXTURE( int i )
  137. {
  138. Assert( i >= 0 && i <= 1 );
  139. m_nPHONGWARPTEXTURE = i;
  140. #ifdef _DEBUG
  141. m_bPHONGWARPTEXTURE = true;
  142. #endif
  143. }
  144. void SetPHONGWARPTEXTURE( bool i )
  145. {
  146. m_nPHONGWARPTEXTURE = i ? 1 : 0;
  147. #ifdef _DEBUG
  148. m_bPHONGWARPTEXTURE = true;
  149. #endif
  150. }
  151. private:
  152. int m_nWRINKLEMAP;
  153. #ifdef _DEBUG
  154. bool m_bWRINKLEMAP;
  155. #endif
  156. public:
  157. void SetWRINKLEMAP( int i )
  158. {
  159. Assert( i >= 0 && i <= 1 );
  160. m_nWRINKLEMAP = i;
  161. #ifdef _DEBUG
  162. m_bWRINKLEMAP = true;
  163. #endif
  164. }
  165. void SetWRINKLEMAP( bool i )
  166. {
  167. m_nWRINKLEMAP = i ? 1 : 0;
  168. #ifdef _DEBUG
  169. m_bWRINKLEMAP = true;
  170. #endif
  171. }
  172. private:
  173. int m_nDETAIL_BLEND_MODE;
  174. #ifdef _DEBUG
  175. bool m_bDETAIL_BLEND_MODE;
  176. #endif
  177. public:
  178. void SetDETAIL_BLEND_MODE( int i )
  179. {
  180. Assert( i >= 0 && i <= 6 );
  181. m_nDETAIL_BLEND_MODE = i;
  182. #ifdef _DEBUG
  183. m_bDETAIL_BLEND_MODE = true;
  184. #endif
  185. }
  186. void SetDETAIL_BLEND_MODE( bool i )
  187. {
  188. m_nDETAIL_BLEND_MODE = i ? 1 : 0;
  189. #ifdef _DEBUG
  190. m_bDETAIL_BLEND_MODE = true;
  191. #endif
  192. }
  193. private:
  194. int m_nDETAILTEXTURE;
  195. #ifdef _DEBUG
  196. bool m_bDETAILTEXTURE;
  197. #endif
  198. public:
  199. void SetDETAILTEXTURE( int i )
  200. {
  201. Assert( i >= 0 && i <= 1 );
  202. m_nDETAILTEXTURE = i;
  203. #ifdef _DEBUG
  204. m_bDETAILTEXTURE = true;
  205. #endif
  206. }
  207. void SetDETAILTEXTURE( bool i )
  208. {
  209. m_nDETAILTEXTURE = i ? 1 : 0;
  210. #ifdef _DEBUG
  211. m_bDETAILTEXTURE = true;
  212. #endif
  213. }
  214. private:
  215. int m_nRIMLIGHT;
  216. #ifdef _DEBUG
  217. bool m_bRIMLIGHT;
  218. #endif
  219. public:
  220. void SetRIMLIGHT( int i )
  221. {
  222. Assert( i >= 0 && i <= 1 );
  223. m_nRIMLIGHT = i;
  224. #ifdef _DEBUG
  225. m_bRIMLIGHT = true;
  226. #endif
  227. }
  228. void SetRIMLIGHT( bool i )
  229. {
  230. m_nRIMLIGHT = i ? 1 : 0;
  231. #ifdef _DEBUG
  232. m_bRIMLIGHT = true;
  233. #endif
  234. }
  235. private:
  236. int m_nFLASHLIGHTDEPTHFILTERMODE;
  237. #ifdef _DEBUG
  238. bool m_bFLASHLIGHTDEPTHFILTERMODE;
  239. #endif
  240. public:
  241. void SetFLASHLIGHTDEPTHFILTERMODE( int i )
  242. {
  243. Assert( i >= 0 && i <= 2 );
  244. m_nFLASHLIGHTDEPTHFILTERMODE = i;
  245. #ifdef _DEBUG
  246. m_bFLASHLIGHTDEPTHFILTERMODE = true;
  247. #endif
  248. }
  249. void SetFLASHLIGHTDEPTHFILTERMODE( bool i )
  250. {
  251. m_nFLASHLIGHTDEPTHFILTERMODE = i ? 1 : 0;
  252. #ifdef _DEBUG
  253. m_bFLASHLIGHTDEPTHFILTERMODE = true;
  254. #endif
  255. }
  256. private:
  257. int m_nFASTPATH_NOBUMP;
  258. #ifdef _DEBUG
  259. bool m_bFASTPATH_NOBUMP;
  260. #endif
  261. public:
  262. void SetFASTPATH_NOBUMP( int i )
  263. {
  264. Assert( i >= 0 && i <= 1 );
  265. m_nFASTPATH_NOBUMP = i;
  266. #ifdef _DEBUG
  267. m_bFASTPATH_NOBUMP = true;
  268. #endif
  269. }
  270. void SetFASTPATH_NOBUMP( bool i )
  271. {
  272. m_nFASTPATH_NOBUMP = i ? 1 : 0;
  273. #ifdef _DEBUG
  274. m_bFASTPATH_NOBUMP = true;
  275. #endif
  276. }
  277. private:
  278. int m_nBLENDTINTBYBASEALPHA;
  279. #ifdef _DEBUG
  280. bool m_bBLENDTINTBYBASEALPHA;
  281. #endif
  282. public:
  283. void SetBLENDTINTBYBASEALPHA( int i )
  284. {
  285. Assert( i >= 0 && i <= 1 );
  286. m_nBLENDTINTBYBASEALPHA = i;
  287. #ifdef _DEBUG
  288. m_bBLENDTINTBYBASEALPHA = true;
  289. #endif
  290. }
  291. void SetBLENDTINTBYBASEALPHA( bool i )
  292. {
  293. m_nBLENDTINTBYBASEALPHA = i ? 1 : 0;
  294. #ifdef _DEBUG
  295. m_bBLENDTINTBYBASEALPHA = true;
  296. #endif
  297. }
  298. public:
  299. skin_ps20b_Static_Index( )
  300. {
  301. #ifdef _DEBUG
  302. m_bCONVERT_TO_SRGB = false;
  303. #endif // _DEBUG
  304. m_nCONVERT_TO_SRGB = 0;
  305. #ifdef _DEBUG
  306. m_bCUBEMAP = false;
  307. #endif // _DEBUG
  308. m_nCUBEMAP = 0;
  309. #ifdef _DEBUG
  310. m_bSELFILLUM = false;
  311. #endif // _DEBUG
  312. m_nSELFILLUM = 0;
  313. #ifdef _DEBUG
  314. m_bSELFILLUMFRESNEL = false;
  315. #endif // _DEBUG
  316. m_nSELFILLUMFRESNEL = 0;
  317. #ifdef _DEBUG
  318. m_bFLASHLIGHT = false;
  319. #endif // _DEBUG
  320. m_nFLASHLIGHT = 0;
  321. #ifdef _DEBUG
  322. m_bLIGHTWARPTEXTURE = false;
  323. #endif // _DEBUG
  324. m_nLIGHTWARPTEXTURE = 0;
  325. #ifdef _DEBUG
  326. m_bPHONGWARPTEXTURE = false;
  327. #endif // _DEBUG
  328. m_nPHONGWARPTEXTURE = 0;
  329. #ifdef _DEBUG
  330. m_bWRINKLEMAP = false;
  331. #endif // _DEBUG
  332. m_nWRINKLEMAP = 0;
  333. #ifdef _DEBUG
  334. m_bDETAIL_BLEND_MODE = false;
  335. #endif // _DEBUG
  336. m_nDETAIL_BLEND_MODE = 0;
  337. #ifdef _DEBUG
  338. m_bDETAILTEXTURE = false;
  339. #endif // _DEBUG
  340. m_nDETAILTEXTURE = 0;
  341. #ifdef _DEBUG
  342. m_bRIMLIGHT = false;
  343. #endif // _DEBUG
  344. m_nRIMLIGHT = 0;
  345. #ifdef _DEBUG
  346. m_bFLASHLIGHTDEPTHFILTERMODE = false;
  347. #endif // _DEBUG
  348. m_nFLASHLIGHTDEPTHFILTERMODE = 0;
  349. #ifdef _DEBUG
  350. m_bFASTPATH_NOBUMP = false;
  351. #endif // _DEBUG
  352. m_nFASTPATH_NOBUMP = 0;
  353. #ifdef _DEBUG
  354. m_bBLENDTINTBYBASEALPHA = false;
  355. #endif // _DEBUG
  356. m_nBLENDTINTBYBASEALPHA = 0;
  357. }
  358. int GetIndex()
  359. {
  360. // Asserts to make sure that we aren't using any skipped combinations.
  361. // Asserts to make sure that we are setting all of the combination vars.
  362. #ifdef _DEBUG
  363. bool bAllStaticVarsDefined = m_bCONVERT_TO_SRGB && 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_bFASTPATH_NOBUMP && m_bBLENDTINTBYBASEALPHA;
  364. Assert( bAllStaticVarsDefined );
  365. #endif // _DEBUG
  366. return ( 160 * m_nCONVERT_TO_SRGB ) + ( 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 ) + ( 143360 * m_nDETAILTEXTURE ) + ( 286720 * m_nRIMLIGHT ) + ( 573440 * m_nFLASHLIGHTDEPTHFILTERMODE ) + ( 1720320 * m_nFASTPATH_NOBUMP ) + ( 3440640 * m_nBLENDTINTBYBASEALPHA ) + 0;
  367. }
  368. };
  369. #define shaderStaticTest_skin_ps20b psh_forgot_to_set_static_CONVERT_TO_SRGB + 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_FASTPATH_NOBUMP + psh_forgot_to_set_static_BLENDTINTBYBASEALPHA + 0
  370. class skin_ps20b_Dynamic_Index
  371. {
  372. private:
  373. int m_nWRITEWATERFOGTODESTALPHA;
  374. #ifdef _DEBUG
  375. bool m_bWRITEWATERFOGTODESTALPHA;
  376. #endif
  377. public:
  378. void SetWRITEWATERFOGTODESTALPHA( int i )
  379. {
  380. Assert( i >= 0 && i <= 1 );
  381. m_nWRITEWATERFOGTODESTALPHA = i;
  382. #ifdef _DEBUG
  383. m_bWRITEWATERFOGTODESTALPHA = true;
  384. #endif
  385. }
  386. void SetWRITEWATERFOGTODESTALPHA( bool i )
  387. {
  388. m_nWRITEWATERFOGTODESTALPHA = i ? 1 : 0;
  389. #ifdef _DEBUG
  390. m_bWRITEWATERFOGTODESTALPHA = true;
  391. #endif
  392. }
  393. private:
  394. int m_nPIXELFOGTYPE;
  395. #ifdef _DEBUG
  396. bool m_bPIXELFOGTYPE;
  397. #endif
  398. public:
  399. void SetPIXELFOGTYPE( int i )
  400. {
  401. Assert( i >= 0 && i <= 1 );
  402. m_nPIXELFOGTYPE = i;
  403. #ifdef _DEBUG
  404. m_bPIXELFOGTYPE = true;
  405. #endif
  406. }
  407. void SetPIXELFOGTYPE( bool i )
  408. {
  409. m_nPIXELFOGTYPE = i ? 1 : 0;
  410. #ifdef _DEBUG
  411. m_bPIXELFOGTYPE = true;
  412. #endif
  413. }
  414. private:
  415. int m_nNUM_LIGHTS;
  416. #ifdef _DEBUG
  417. bool m_bNUM_LIGHTS;
  418. #endif
  419. public:
  420. void SetNUM_LIGHTS( int i )
  421. {
  422. Assert( i >= 0 && i <= 4 );
  423. m_nNUM_LIGHTS = i;
  424. #ifdef _DEBUG
  425. m_bNUM_LIGHTS = true;
  426. #endif
  427. }
  428. void SetNUM_LIGHTS( bool i )
  429. {
  430. m_nNUM_LIGHTS = i ? 1 : 0;
  431. #ifdef _DEBUG
  432. m_bNUM_LIGHTS = true;
  433. #endif
  434. }
  435. private:
  436. int m_nWRITE_DEPTH_TO_DESTALPHA;
  437. #ifdef _DEBUG
  438. bool m_bWRITE_DEPTH_TO_DESTALPHA;
  439. #endif
  440. public:
  441. void SetWRITE_DEPTH_TO_DESTALPHA( int i )
  442. {
  443. Assert( i >= 0 && i <= 1 );
  444. m_nWRITE_DEPTH_TO_DESTALPHA = i;
  445. #ifdef _DEBUG
  446. m_bWRITE_DEPTH_TO_DESTALPHA = true;
  447. #endif
  448. }
  449. void SetWRITE_DEPTH_TO_DESTALPHA( bool i )
  450. {
  451. m_nWRITE_DEPTH_TO_DESTALPHA = i ? 1 : 0;
  452. #ifdef _DEBUG
  453. m_bWRITE_DEPTH_TO_DESTALPHA = true;
  454. #endif
  455. }
  456. private:
  457. int m_nFLASHLIGHTSHADOWS;
  458. #ifdef _DEBUG
  459. bool m_bFLASHLIGHTSHADOWS;
  460. #endif
  461. public:
  462. void SetFLASHLIGHTSHADOWS( int i )
  463. {
  464. Assert( i >= 0 && i <= 1 );
  465. m_nFLASHLIGHTSHADOWS = i;
  466. #ifdef _DEBUG
  467. m_bFLASHLIGHTSHADOWS = true;
  468. #endif
  469. }
  470. void SetFLASHLIGHTSHADOWS( bool i )
  471. {
  472. m_nFLASHLIGHTSHADOWS = i ? 1 : 0;
  473. #ifdef _DEBUG
  474. m_bFLASHLIGHTSHADOWS = true;
  475. #endif
  476. }
  477. private:
  478. int m_nPHONG_USE_EXPONENT_FACTOR;
  479. #ifdef _DEBUG
  480. bool m_bPHONG_USE_EXPONENT_FACTOR;
  481. #endif
  482. public:
  483. void SetPHONG_USE_EXPONENT_FACTOR( int i )
  484. {
  485. Assert( i >= 0 && i <= 1 );
  486. m_nPHONG_USE_EXPONENT_FACTOR = i;
  487. #ifdef _DEBUG
  488. m_bPHONG_USE_EXPONENT_FACTOR = true;
  489. #endif
  490. }
  491. void SetPHONG_USE_EXPONENT_FACTOR( bool i )
  492. {
  493. m_nPHONG_USE_EXPONENT_FACTOR = i ? 1 : 0;
  494. #ifdef _DEBUG
  495. m_bPHONG_USE_EXPONENT_FACTOR = true;
  496. #endif
  497. }
  498. public:
  499. skin_ps20b_Dynamic_Index()
  500. {
  501. #ifdef _DEBUG
  502. m_bWRITEWATERFOGTODESTALPHA = false;
  503. #endif // _DEBUG
  504. m_nWRITEWATERFOGTODESTALPHA = 0;
  505. #ifdef _DEBUG
  506. m_bPIXELFOGTYPE = false;
  507. #endif // _DEBUG
  508. m_nPIXELFOGTYPE = 0;
  509. #ifdef _DEBUG
  510. m_bNUM_LIGHTS = false;
  511. #endif // _DEBUG
  512. m_nNUM_LIGHTS = 0;
  513. #ifdef _DEBUG
  514. m_bWRITE_DEPTH_TO_DESTALPHA = false;
  515. #endif // _DEBUG
  516. m_nWRITE_DEPTH_TO_DESTALPHA = 0;
  517. #ifdef _DEBUG
  518. m_bFLASHLIGHTSHADOWS = false;
  519. #endif // _DEBUG
  520. m_nFLASHLIGHTSHADOWS = 0;
  521. #ifdef _DEBUG
  522. m_bPHONG_USE_EXPONENT_FACTOR = false;
  523. #endif // _DEBUG
  524. m_nPHONG_USE_EXPONENT_FACTOR = 0;
  525. }
  526. int GetIndex()
  527. {
  528. // Asserts to make sure that we aren't using any skipped combinations.
  529. // Asserts to make sure that we are setting all of the combination vars.
  530. #ifdef _DEBUG
  531. bool bAllDynamicVarsDefined = m_bWRITEWATERFOGTODESTALPHA && m_bPIXELFOGTYPE && m_bNUM_LIGHTS && m_bWRITE_DEPTH_TO_DESTALPHA && m_bFLASHLIGHTSHADOWS && m_bPHONG_USE_EXPONENT_FACTOR;
  532. Assert( bAllDynamicVarsDefined );
  533. #endif // _DEBUG
  534. return ( 1 * m_nWRITEWATERFOGTODESTALPHA ) + ( 2 * m_nPIXELFOGTYPE ) + ( 4 * m_nNUM_LIGHTS ) + ( 20 * m_nWRITE_DEPTH_TO_DESTALPHA ) + ( 40 * m_nFLASHLIGHTSHADOWS ) + ( 80 * m_nPHONG_USE_EXPONENT_FACTOR ) + 0;
  535. }
  536. };
  537. #define shaderDynamicTest_skin_ps20b psh_forgot_to_set_dynamic_WRITEWATERFOGTODESTALPHA + psh_forgot_to_set_dynamic_PIXELFOGTYPE + 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_PHONG_USE_EXPONENT_FACTOR + 0