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.

287 lines
5.8 KiB

  1. #include "shaderlib/cshader.h"
  2. class water_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 <= 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_nMULTITEXTURE;
  48. #ifdef _DEBUG
  49. bool m_bMULTITEXTURE;
  50. #endif
  51. public:
  52. void SetMULTITEXTURE( int i )
  53. {
  54. Assert( i >= 0 && i <= 1 );
  55. m_nMULTITEXTURE = i;
  56. #ifdef _DEBUG
  57. m_bMULTITEXTURE = true;
  58. #endif
  59. }
  60. void SetMULTITEXTURE( bool i )
  61. {
  62. m_nMULTITEXTURE = i ? 1 : 0;
  63. #ifdef _DEBUG
  64. m_bMULTITEXTURE = true;
  65. #endif
  66. }
  67. private:
  68. int m_nREFLECT;
  69. #ifdef _DEBUG
  70. bool m_bREFLECT;
  71. #endif
  72. public:
  73. void SetREFLECT( int i )
  74. {
  75. Assert( i >= 0 && i <= 1 );
  76. m_nREFLECT = i;
  77. #ifdef _DEBUG
  78. m_bREFLECT = true;
  79. #endif
  80. }
  81. void SetREFLECT( bool i )
  82. {
  83. m_nREFLECT = i ? 1 : 0;
  84. #ifdef _DEBUG
  85. m_bREFLECT = true;
  86. #endif
  87. }
  88. private:
  89. int m_nREFRACT;
  90. #ifdef _DEBUG
  91. bool m_bREFRACT;
  92. #endif
  93. public:
  94. void SetREFRACT( int i )
  95. {
  96. Assert( i >= 0 && i <= 1 );
  97. m_nREFRACT = i;
  98. #ifdef _DEBUG
  99. m_bREFRACT = true;
  100. #endif
  101. }
  102. void SetREFRACT( bool i )
  103. {
  104. m_nREFRACT = i ? 1 : 0;
  105. #ifdef _DEBUG
  106. m_bREFRACT = true;
  107. #endif
  108. }
  109. private:
  110. int m_nABOVEWATER;
  111. #ifdef _DEBUG
  112. bool m_bABOVEWATER;
  113. #endif
  114. public:
  115. void SetABOVEWATER( int i )
  116. {
  117. Assert( i >= 0 && i <= 1 );
  118. m_nABOVEWATER = i;
  119. #ifdef _DEBUG
  120. m_bABOVEWATER = true;
  121. #endif
  122. }
  123. void SetABOVEWATER( bool i )
  124. {
  125. m_nABOVEWATER = i ? 1 : 0;
  126. #ifdef _DEBUG
  127. m_bABOVEWATER = true;
  128. #endif
  129. }
  130. private:
  131. int m_nBLURRY_REFRACT;
  132. #ifdef _DEBUG
  133. bool m_bBLURRY_REFRACT;
  134. #endif
  135. public:
  136. void SetBLURRY_REFRACT( int i )
  137. {
  138. Assert( i >= 0 && i <= 1 );
  139. m_nBLURRY_REFRACT = i;
  140. #ifdef _DEBUG
  141. m_bBLURRY_REFRACT = true;
  142. #endif
  143. }
  144. void SetBLURRY_REFRACT( bool i )
  145. {
  146. m_nBLURRY_REFRACT = i ? 1 : 0;
  147. #ifdef _DEBUG
  148. m_bBLURRY_REFRACT = true;
  149. #endif
  150. }
  151. private:
  152. int m_nNORMAL_DECODE_MODE;
  153. #ifdef _DEBUG
  154. bool m_bNORMAL_DECODE_MODE;
  155. #endif
  156. public:
  157. void SetNORMAL_DECODE_MODE( int i )
  158. {
  159. Assert( i >= 0 && i <= 0 );
  160. m_nNORMAL_DECODE_MODE = i;
  161. #ifdef _DEBUG
  162. m_bNORMAL_DECODE_MODE = true;
  163. #endif
  164. }
  165. void SetNORMAL_DECODE_MODE( bool i )
  166. {
  167. m_nNORMAL_DECODE_MODE = i ? 1 : 0;
  168. #ifdef _DEBUG
  169. m_bNORMAL_DECODE_MODE = true;
  170. #endif
  171. }
  172. public:
  173. water_ps20b_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_bMULTITEXTURE = false;
  185. #endif // _DEBUG
  186. m_nMULTITEXTURE = 0;
  187. #ifdef _DEBUG
  188. m_bREFLECT = false;
  189. #endif // _DEBUG
  190. m_nREFLECT = 0;
  191. #ifdef _DEBUG
  192. m_bREFRACT = false;
  193. #endif // _DEBUG
  194. m_nREFRACT = 0;
  195. #ifdef _DEBUG
  196. m_bABOVEWATER = false;
  197. #endif // _DEBUG
  198. m_nABOVEWATER = 0;
  199. #ifdef _DEBUG
  200. m_bBLURRY_REFRACT = false;
  201. #endif // _DEBUG
  202. m_nBLURRY_REFRACT = 0;
  203. #ifdef _DEBUG
  204. m_bNORMAL_DECODE_MODE = false;
  205. #endif // _DEBUG
  206. m_nNORMAL_DECODE_MODE = 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_bMULTITEXTURE && m_bREFLECT && m_bREFRACT && m_bABOVEWATER && m_bBLURRY_REFRACT && m_bNORMAL_DECODE_MODE;
  214. Assert( bAllStaticVarsDefined );
  215. #endif // _DEBUG
  216. return ( 4 * m_nCONVERT_TO_SRGB ) + ( 8 * m_nBASETEXTURE ) + ( 16 * m_nMULTITEXTURE ) + ( 32 * m_nREFLECT ) + ( 64 * m_nREFRACT ) + ( 128 * m_nABOVEWATER ) + ( 256 * m_nBLURRY_REFRACT ) + ( 512 * m_nNORMAL_DECODE_MODE ) + 0;
  217. }
  218. };
  219. #define shaderStaticTest_water_ps20b psh_forgot_to_set_static_BASETEXTURE + psh_forgot_to_set_static_MULTITEXTURE + psh_forgot_to_set_static_REFLECT + psh_forgot_to_set_static_REFRACT + psh_forgot_to_set_static_ABOVEWATER + psh_forgot_to_set_static_BLURRY_REFRACT + psh_forgot_to_set_static_NORMAL_DECODE_MODE + 0
  220. class water_ps20b_Dynamic_Index
  221. {
  222. private:
  223. int m_nPIXELFOGTYPE;
  224. #ifdef _DEBUG
  225. bool m_bPIXELFOGTYPE;
  226. #endif
  227. public:
  228. void SetPIXELFOGTYPE( int i )
  229. {
  230. Assert( i >= 0 && i <= 1 );
  231. m_nPIXELFOGTYPE = i;
  232. #ifdef _DEBUG
  233. m_bPIXELFOGTYPE = true;
  234. #endif
  235. }
  236. void SetPIXELFOGTYPE( bool i )
  237. {
  238. m_nPIXELFOGTYPE = i ? 1 : 0;
  239. #ifdef _DEBUG
  240. m_bPIXELFOGTYPE = true;
  241. #endif
  242. }
  243. private:
  244. int m_nWRITE_DEPTH_TO_DESTALPHA;
  245. #ifdef _DEBUG
  246. bool m_bWRITE_DEPTH_TO_DESTALPHA;
  247. #endif
  248. public:
  249. void SetWRITE_DEPTH_TO_DESTALPHA( int i )
  250. {
  251. Assert( i >= 0 && i <= 1 );
  252. m_nWRITE_DEPTH_TO_DESTALPHA = i;
  253. #ifdef _DEBUG
  254. m_bWRITE_DEPTH_TO_DESTALPHA = true;
  255. #endif
  256. }
  257. void SetWRITE_DEPTH_TO_DESTALPHA( bool i )
  258. {
  259. m_nWRITE_DEPTH_TO_DESTALPHA = i ? 1 : 0;
  260. #ifdef _DEBUG
  261. m_bWRITE_DEPTH_TO_DESTALPHA = true;
  262. #endif
  263. }
  264. public:
  265. water_ps20b_Dynamic_Index()
  266. {
  267. #ifdef _DEBUG
  268. m_bPIXELFOGTYPE = false;
  269. #endif // _DEBUG
  270. m_nPIXELFOGTYPE = 0;
  271. #ifdef _DEBUG
  272. m_bWRITE_DEPTH_TO_DESTALPHA = false;
  273. #endif // _DEBUG
  274. m_nWRITE_DEPTH_TO_DESTALPHA = 0;
  275. }
  276. int GetIndex()
  277. {
  278. // Asserts to make sure that we aren't using any skipped combinations.
  279. // Asserts to make sure that we are setting all of the combination vars.
  280. #ifdef _DEBUG
  281. bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE && m_bWRITE_DEPTH_TO_DESTALPHA;
  282. Assert( bAllDynamicVarsDefined );
  283. #endif // _DEBUG
  284. return ( 1 * m_nPIXELFOGTYPE ) + ( 2 * m_nWRITE_DEPTH_TO_DESTALPHA ) + 0;
  285. }
  286. };
  287. #define shaderDynamicTest_water_ps20b psh_forgot_to_set_dynamic_PIXELFOGTYPE + psh_forgot_to_set_dynamic_WRITE_DEPTH_TO_DESTALPHA + 0