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.

362 lines
7.4 KiB

  1. #include "shaderlib/cshader.h"
  2. class vortwarp_ps30_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 <= 1 );
  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_nBASETEXTURE;
  27. #ifdef _DEBUG
  28. bool m_bBASETEXTURE;
  29. #endif
  30. public:
  31. void SetBASETEXTURE( int i )
  32. {
  33. Assert( i >= 0 && i <= 1 );
  34. m_nBASETEXTURE = i;
  35. #ifdef _DEBUG
  36. m_bBASETEXTURE = true;
  37. #endif
  38. }
  39. void SetBASETEXTURE( bool i )
  40. {
  41. m_nBASETEXTURE = i ? 1 : 0;
  42. #ifdef _DEBUG
  43. m_bBASETEXTURE = true;
  44. #endif
  45. }
  46. private:
  47. int m_nCUBEMAP;
  48. #ifdef _DEBUG
  49. bool m_bCUBEMAP;
  50. #endif
  51. public:
  52. void SetCUBEMAP( int i )
  53. {
  54. Assert( i >= 0 && i <= 1 );
  55. m_nCUBEMAP = i;
  56. #ifdef _DEBUG
  57. m_bCUBEMAP = true;
  58. #endif
  59. }
  60. void SetCUBEMAP( bool i )
  61. {
  62. m_nCUBEMAP = i ? 1 : 0;
  63. #ifdef _DEBUG
  64. m_bCUBEMAP = true;
  65. #endif
  66. }
  67. private:
  68. int m_nDIFFUSELIGHTING;
  69. #ifdef _DEBUG
  70. bool m_bDIFFUSELIGHTING;
  71. #endif
  72. public:
  73. void SetDIFFUSELIGHTING( int i )
  74. {
  75. Assert( i >= 0 && i <= 1 );
  76. m_nDIFFUSELIGHTING = i;
  77. #ifdef _DEBUG
  78. m_bDIFFUSELIGHTING = true;
  79. #endif
  80. }
  81. void SetDIFFUSELIGHTING( bool i )
  82. {
  83. m_nDIFFUSELIGHTING = i ? 1 : 0;
  84. #ifdef _DEBUG
  85. m_bDIFFUSELIGHTING = true;
  86. #endif
  87. }
  88. private:
  89. int m_nNORMALMAPALPHAENVMAPMASK;
  90. #ifdef _DEBUG
  91. bool m_bNORMALMAPALPHAENVMAPMASK;
  92. #endif
  93. public:
  94. void SetNORMALMAPALPHAENVMAPMASK( int i )
  95. {
  96. Assert( i >= 0 && i <= 1 );
  97. m_nNORMALMAPALPHAENVMAPMASK = i;
  98. #ifdef _DEBUG
  99. m_bNORMALMAPALPHAENVMAPMASK = true;
  100. #endif
  101. }
  102. void SetNORMALMAPALPHAENVMAPMASK( bool i )
  103. {
  104. m_nNORMALMAPALPHAENVMAPMASK = i ? 1 : 0;
  105. #ifdef _DEBUG
  106. m_bNORMALMAPALPHAENVMAPMASK = true;
  107. #endif
  108. }
  109. private:
  110. int m_nHALFLAMBERT;
  111. #ifdef _DEBUG
  112. bool m_bHALFLAMBERT;
  113. #endif
  114. public:
  115. void SetHALFLAMBERT( int i )
  116. {
  117. Assert( i >= 0 && i <= 1 );
  118. m_nHALFLAMBERT = i;
  119. #ifdef _DEBUG
  120. m_bHALFLAMBERT = true;
  121. #endif
  122. }
  123. void SetHALFLAMBERT( bool i )
  124. {
  125. m_nHALFLAMBERT = i ? 1 : 0;
  126. #ifdef _DEBUG
  127. m_bHALFLAMBERT = true;
  128. #endif
  129. }
  130. private:
  131. int m_nFLASHLIGHT;
  132. #ifdef _DEBUG
  133. bool m_bFLASHLIGHT;
  134. #endif
  135. public:
  136. void SetFLASHLIGHT( int i )
  137. {
  138. Assert( i >= 0 && i <= 1 );
  139. m_nFLASHLIGHT = i;
  140. #ifdef _DEBUG
  141. m_bFLASHLIGHT = true;
  142. #endif
  143. }
  144. void SetFLASHLIGHT( bool i )
  145. {
  146. m_nFLASHLIGHT = i ? 1 : 0;
  147. #ifdef _DEBUG
  148. m_bFLASHLIGHT = true;
  149. #endif
  150. }
  151. private:
  152. int m_nTRANSLUCENT;
  153. #ifdef _DEBUG
  154. bool m_bTRANSLUCENT;
  155. #endif
  156. public:
  157. void SetTRANSLUCENT( int i )
  158. {
  159. Assert( i >= 0 && i <= 1 );
  160. m_nTRANSLUCENT = i;
  161. #ifdef _DEBUG
  162. m_bTRANSLUCENT = true;
  163. #endif
  164. }
  165. void SetTRANSLUCENT( bool i )
  166. {
  167. m_nTRANSLUCENT = i ? 1 : 0;
  168. #ifdef _DEBUG
  169. m_bTRANSLUCENT = true;
  170. #endif
  171. }
  172. public:
  173. vortwarp_ps30_Static_Index( )
  174. {
  175. #ifdef _DEBUG
  176. m_bCONVERT_TO_SRGB = true;
  177. #endif // _DEBUG
  178. m_nCONVERT_TO_SRGB = g_pHardwareConfig->NeedsShaderSRGBConversion();
  179. #ifdef _DEBUG
  180. m_bBASETEXTURE = false;
  181. #endif // _DEBUG
  182. m_nBASETEXTURE = 0;
  183. #ifdef _DEBUG
  184. m_bCUBEMAP = false;
  185. #endif // _DEBUG
  186. m_nCUBEMAP = 0;
  187. #ifdef _DEBUG
  188. m_bDIFFUSELIGHTING = false;
  189. #endif // _DEBUG
  190. m_nDIFFUSELIGHTING = 0;
  191. #ifdef _DEBUG
  192. m_bNORMALMAPALPHAENVMAPMASK = false;
  193. #endif // _DEBUG
  194. m_nNORMALMAPALPHAENVMAPMASK = 0;
  195. #ifdef _DEBUG
  196. m_bHALFLAMBERT = false;
  197. #endif // _DEBUG
  198. m_nHALFLAMBERT = 0;
  199. #ifdef _DEBUG
  200. m_bFLASHLIGHT = false;
  201. #endif // _DEBUG
  202. m_nFLASHLIGHT = 0;
  203. #ifdef _DEBUG
  204. m_bTRANSLUCENT = false;
  205. #endif // _DEBUG
  206. m_nTRANSLUCENT = 0;
  207. }
  208. int GetIndex()
  209. {
  210. // Asserts to make sure that we aren't using any skipped combinations.
  211. // Asserts to make sure that we are setting all of the combination vars.
  212. #ifdef _DEBUG
  213. bool bAllStaticVarsDefined = m_bCONVERT_TO_SRGB && m_bBASETEXTURE && m_bCUBEMAP && m_bDIFFUSELIGHTING && m_bNORMALMAPALPHAENVMAPMASK && m_bHALFLAMBERT && m_bFLASHLIGHT && m_bTRANSLUCENT;
  214. Assert( bAllStaticVarsDefined );
  215. #endif // _DEBUG
  216. return ( 80 * m_nCONVERT_TO_SRGB ) + ( 160 * m_nBASETEXTURE ) + ( 320 * m_nCUBEMAP ) + ( 640 * m_nDIFFUSELIGHTING ) + ( 1280 * m_nNORMALMAPALPHAENVMAPMASK ) + ( 2560 * m_nHALFLAMBERT ) + ( 5120 * m_nFLASHLIGHT ) + ( 10240 * m_nTRANSLUCENT ) + 0;
  217. }
  218. };
  219. #define shaderStaticTest_vortwarp_ps30 psh_forgot_to_set_static_BASETEXTURE + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_DIFFUSELIGHTING + psh_forgot_to_set_static_NORMALMAPALPHAENVMAPMASK + psh_forgot_to_set_static_HALFLAMBERT + psh_forgot_to_set_static_FLASHLIGHT + psh_forgot_to_set_static_TRANSLUCENT + 0
  220. class vortwarp_ps30_Dynamic_Index
  221. {
  222. private:
  223. int m_nWRITEWATERFOGTODESTALPHA;
  224. #ifdef _DEBUG
  225. bool m_bWRITEWATERFOGTODESTALPHA;
  226. #endif
  227. public:
  228. void SetWRITEWATERFOGTODESTALPHA( int i )
  229. {
  230. Assert( i >= 0 && i <= 1 );
  231. m_nWRITEWATERFOGTODESTALPHA = i;
  232. #ifdef _DEBUG
  233. m_bWRITEWATERFOGTODESTALPHA = true;
  234. #endif
  235. }
  236. void SetWRITEWATERFOGTODESTALPHA( bool i )
  237. {
  238. m_nWRITEWATERFOGTODESTALPHA = i ? 1 : 0;
  239. #ifdef _DEBUG
  240. m_bWRITEWATERFOGTODESTALPHA = true;
  241. #endif
  242. }
  243. private:
  244. int m_nPIXELFOGTYPE;
  245. #ifdef _DEBUG
  246. bool m_bPIXELFOGTYPE;
  247. #endif
  248. public:
  249. void SetPIXELFOGTYPE( int i )
  250. {
  251. Assert( i >= 0 && i <= 1 );
  252. m_nPIXELFOGTYPE = i;
  253. #ifdef _DEBUG
  254. m_bPIXELFOGTYPE = true;
  255. #endif
  256. }
  257. void SetPIXELFOGTYPE( bool i )
  258. {
  259. m_nPIXELFOGTYPE = i ? 1 : 0;
  260. #ifdef _DEBUG
  261. m_bPIXELFOGTYPE = true;
  262. #endif
  263. }
  264. private:
  265. int m_nWARPINGIN;
  266. #ifdef _DEBUG
  267. bool m_bWARPINGIN;
  268. #endif
  269. public:
  270. void SetWARPINGIN( int i )
  271. {
  272. Assert( i >= 0 && i <= 1 );
  273. m_nWARPINGIN = i;
  274. #ifdef _DEBUG
  275. m_bWARPINGIN = true;
  276. #endif
  277. }
  278. void SetWARPINGIN( bool i )
  279. {
  280. m_nWARPINGIN = i ? 1 : 0;
  281. #ifdef _DEBUG
  282. m_bWARPINGIN = true;
  283. #endif
  284. }
  285. private:
  286. int m_nAMBIENT_LIGHT;
  287. #ifdef _DEBUG
  288. bool m_bAMBIENT_LIGHT;
  289. #endif
  290. public:
  291. void SetAMBIENT_LIGHT( int i )
  292. {
  293. Assert( i >= 0 && i <= 1 );
  294. m_nAMBIENT_LIGHT = i;
  295. #ifdef _DEBUG
  296. m_bAMBIENT_LIGHT = true;
  297. #endif
  298. }
  299. void SetAMBIENT_LIGHT( bool i )
  300. {
  301. m_nAMBIENT_LIGHT = i ? 1 : 0;
  302. #ifdef _DEBUG
  303. m_bAMBIENT_LIGHT = true;
  304. #endif
  305. }
  306. private:
  307. int m_nNUM_LIGHTS;
  308. #ifdef _DEBUG
  309. bool m_bNUM_LIGHTS;
  310. #endif
  311. public:
  312. void SetNUM_LIGHTS( int i )
  313. {
  314. Assert( i >= 0 && i <= 4 );
  315. m_nNUM_LIGHTS = i;
  316. #ifdef _DEBUG
  317. m_bNUM_LIGHTS = true;
  318. #endif
  319. }
  320. void SetNUM_LIGHTS( bool i )
  321. {
  322. m_nNUM_LIGHTS = i ? 1 : 0;
  323. #ifdef _DEBUG
  324. m_bNUM_LIGHTS = true;
  325. #endif
  326. }
  327. public:
  328. vortwarp_ps30_Dynamic_Index()
  329. {
  330. #ifdef _DEBUG
  331. m_bWRITEWATERFOGTODESTALPHA = false;
  332. #endif // _DEBUG
  333. m_nWRITEWATERFOGTODESTALPHA = 0;
  334. #ifdef _DEBUG
  335. m_bPIXELFOGTYPE = false;
  336. #endif // _DEBUG
  337. m_nPIXELFOGTYPE = 0;
  338. #ifdef _DEBUG
  339. m_bWARPINGIN = false;
  340. #endif // _DEBUG
  341. m_nWARPINGIN = 0;
  342. #ifdef _DEBUG
  343. m_bAMBIENT_LIGHT = false;
  344. #endif // _DEBUG
  345. m_nAMBIENT_LIGHT = 0;
  346. #ifdef _DEBUG
  347. m_bNUM_LIGHTS = false;
  348. #endif // _DEBUG
  349. m_nNUM_LIGHTS = 0;
  350. }
  351. int GetIndex()
  352. {
  353. // Asserts to make sure that we aren't using any skipped combinations.
  354. // Asserts to make sure that we are setting all of the combination vars.
  355. #ifdef _DEBUG
  356. bool bAllDynamicVarsDefined = m_bWRITEWATERFOGTODESTALPHA && m_bPIXELFOGTYPE && m_bWARPINGIN && m_bAMBIENT_LIGHT && m_bNUM_LIGHTS;
  357. Assert( bAllDynamicVarsDefined );
  358. #endif // _DEBUG
  359. return ( 1 * m_nWRITEWATERFOGTODESTALPHA ) + ( 2 * m_nPIXELFOGTYPE ) + ( 4 * m_nWARPINGIN ) + ( 8 * m_nAMBIENT_LIGHT ) + ( 16 * m_nNUM_LIGHTS ) + 0;
  360. }
  361. };
  362. #define shaderDynamicTest_vortwarp_ps30 psh_forgot_to_set_dynamic_WRITEWATERFOGTODESTALPHA + psh_forgot_to_set_dynamic_PIXELFOGTYPE + psh_forgot_to_set_dynamic_WARPINGIN + psh_forgot_to_set_dynamic_AMBIENT_LIGHT + psh_forgot_to_set_dynamic_NUM_LIGHTS + 0