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.

262 lines
5.3 KiB

  1. #include "shaderlib/cshader.h"
  2. class refract_ps20_Static_Index
  3. {
  4. private:
  5. int m_nBLUR;
  6. #ifdef _DEBUG
  7. bool m_bBLUR;
  8. #endif
  9. public:
  10. void SetBLUR( int i )
  11. {
  12. Assert( i >= 0 && i <= 1 );
  13. m_nBLUR = i;
  14. #ifdef _DEBUG
  15. m_bBLUR = true;
  16. #endif
  17. }
  18. void SetBLUR( bool i )
  19. {
  20. m_nBLUR = i ? 1 : 0;
  21. #ifdef _DEBUG
  22. m_bBLUR = true;
  23. #endif
  24. }
  25. private:
  26. int m_nFADEOUTONSILHOUETTE;
  27. #ifdef _DEBUG
  28. bool m_bFADEOUTONSILHOUETTE;
  29. #endif
  30. public:
  31. void SetFADEOUTONSILHOUETTE( int i )
  32. {
  33. Assert( i >= 0 && i <= 1 );
  34. m_nFADEOUTONSILHOUETTE = i;
  35. #ifdef _DEBUG
  36. m_bFADEOUTONSILHOUETTE = true;
  37. #endif
  38. }
  39. void SetFADEOUTONSILHOUETTE( bool i )
  40. {
  41. m_nFADEOUTONSILHOUETTE = i ? 1 : 0;
  42. #ifdef _DEBUG
  43. m_bFADEOUTONSILHOUETTE = 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_nREFRACTTINTTEXTURE;
  69. #ifdef _DEBUG
  70. bool m_bREFRACTTINTTEXTURE;
  71. #endif
  72. public:
  73. void SetREFRACTTINTTEXTURE( int i )
  74. {
  75. Assert( i >= 0 && i <= 1 );
  76. m_nREFRACTTINTTEXTURE = i;
  77. #ifdef _DEBUG
  78. m_bREFRACTTINTTEXTURE = true;
  79. #endif
  80. }
  81. void SetREFRACTTINTTEXTURE( bool i )
  82. {
  83. m_nREFRACTTINTTEXTURE = i ? 1 : 0;
  84. #ifdef _DEBUG
  85. m_bREFRACTTINTTEXTURE = true;
  86. #endif
  87. }
  88. private:
  89. int m_nMASKED;
  90. #ifdef _DEBUG
  91. bool m_bMASKED;
  92. #endif
  93. public:
  94. void SetMASKED( int i )
  95. {
  96. Assert( i >= 0 && i <= 1 );
  97. m_nMASKED = i;
  98. #ifdef _DEBUG
  99. m_bMASKED = true;
  100. #endif
  101. }
  102. void SetMASKED( bool i )
  103. {
  104. m_nMASKED = i ? 1 : 0;
  105. #ifdef _DEBUG
  106. m_bMASKED = true;
  107. #endif
  108. }
  109. private:
  110. int m_nCOLORMODULATE;
  111. #ifdef _DEBUG
  112. bool m_bCOLORMODULATE;
  113. #endif
  114. public:
  115. void SetCOLORMODULATE( int i )
  116. {
  117. Assert( i >= 0 && i <= 1 );
  118. m_nCOLORMODULATE = i;
  119. #ifdef _DEBUG
  120. m_bCOLORMODULATE = true;
  121. #endif
  122. }
  123. void SetCOLORMODULATE( bool i )
  124. {
  125. m_nCOLORMODULATE = i ? 1 : 0;
  126. #ifdef _DEBUG
  127. m_bCOLORMODULATE = true;
  128. #endif
  129. }
  130. private:
  131. int m_nSECONDARY_NORMAL;
  132. #ifdef _DEBUG
  133. bool m_bSECONDARY_NORMAL;
  134. #endif
  135. public:
  136. void SetSECONDARY_NORMAL( int i )
  137. {
  138. Assert( i >= 0 && i <= 1 );
  139. m_nSECONDARY_NORMAL = i;
  140. #ifdef _DEBUG
  141. m_bSECONDARY_NORMAL = true;
  142. #endif
  143. }
  144. void SetSECONDARY_NORMAL( bool i )
  145. {
  146. m_nSECONDARY_NORMAL = i ? 1 : 0;
  147. #ifdef _DEBUG
  148. m_bSECONDARY_NORMAL = 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. refract_ps20_Static_Index( )
  174. {
  175. #ifdef _DEBUG
  176. m_bBLUR = false;
  177. #endif // _DEBUG
  178. m_nBLUR = 0;
  179. #ifdef _DEBUG
  180. m_bFADEOUTONSILHOUETTE = false;
  181. #endif // _DEBUG
  182. m_nFADEOUTONSILHOUETTE = 0;
  183. #ifdef _DEBUG
  184. m_bCUBEMAP = false;
  185. #endif // _DEBUG
  186. m_nCUBEMAP = 0;
  187. #ifdef _DEBUG
  188. m_bREFRACTTINTTEXTURE = false;
  189. #endif // _DEBUG
  190. m_nREFRACTTINTTEXTURE = 0;
  191. #ifdef _DEBUG
  192. m_bMASKED = false;
  193. #endif // _DEBUG
  194. m_nMASKED = 0;
  195. #ifdef _DEBUG
  196. m_bCOLORMODULATE = false;
  197. #endif // _DEBUG
  198. m_nCOLORMODULATE = 0;
  199. #ifdef _DEBUG
  200. m_bSECONDARY_NORMAL = false;
  201. #endif // _DEBUG
  202. m_nSECONDARY_NORMAL = 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_bBLUR && m_bFADEOUTONSILHOUETTE && m_bCUBEMAP && m_bREFRACTTINTTEXTURE && m_bMASKED && m_bCOLORMODULATE && m_bSECONDARY_NORMAL && m_bNORMAL_DECODE_MODE;
  214. Assert( bAllStaticVarsDefined );
  215. #endif // _DEBUG
  216. return ( 2 * m_nBLUR ) + ( 4 * m_nFADEOUTONSILHOUETTE ) + ( 8 * m_nCUBEMAP ) + ( 16 * m_nREFRACTTINTTEXTURE ) + ( 32 * m_nMASKED ) + ( 64 * m_nCOLORMODULATE ) + ( 128 * m_nSECONDARY_NORMAL ) + ( 256 * m_nNORMAL_DECODE_MODE ) + 0;
  217. }
  218. };
  219. #define shaderStaticTest_refract_ps20 psh_forgot_to_set_static_BLUR + psh_forgot_to_set_static_FADEOUTONSILHOUETTE + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_REFRACTTINTTEXTURE + psh_forgot_to_set_static_MASKED + psh_forgot_to_set_static_COLORMODULATE + psh_forgot_to_set_static_SECONDARY_NORMAL + psh_forgot_to_set_static_NORMAL_DECODE_MODE + 0
  220. class refract_ps20_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. public:
  244. refract_ps20_Dynamic_Index()
  245. {
  246. #ifdef _DEBUG
  247. m_bPIXELFOGTYPE = false;
  248. #endif // _DEBUG
  249. m_nPIXELFOGTYPE = 0;
  250. }
  251. int GetIndex()
  252. {
  253. // Asserts to make sure that we aren't using any skipped combinations.
  254. // Asserts to make sure that we are setting all of the combination vars.
  255. #ifdef _DEBUG
  256. bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE;
  257. Assert( bAllDynamicVarsDefined );
  258. #endif // _DEBUG
  259. return ( 1 * m_nPIXELFOGTYPE ) + 0;
  260. }
  261. };
  262. #define shaderDynamicTest_refract_ps20 psh_forgot_to_set_dynamic_PIXELFOGTYPE + 0