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.

237 lines
4.7 KiB

  1. #include "shaderlib/cshader.h"
  2. class shatteredglass_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_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_nVERTEXCOLOR;
  48. #ifdef _DEBUG
  49. bool m_bVERTEXCOLOR;
  50. #endif
  51. public:
  52. void SetVERTEXCOLOR( int i )
  53. {
  54. Assert( i >= 0 && i <= 1 );
  55. m_nVERTEXCOLOR = i;
  56. #ifdef _DEBUG
  57. m_bVERTEXCOLOR = true;
  58. #endif
  59. }
  60. void SetVERTEXCOLOR( bool i )
  61. {
  62. m_nVERTEXCOLOR = i ? 1 : 0;
  63. #ifdef _DEBUG
  64. m_bVERTEXCOLOR = true;
  65. #endif
  66. }
  67. private:
  68. int m_nENVMAPMASK;
  69. #ifdef _DEBUG
  70. bool m_bENVMAPMASK;
  71. #endif
  72. public:
  73. void SetENVMAPMASK( int i )
  74. {
  75. Assert( i >= 0 && i <= 1 );
  76. m_nENVMAPMASK = i;
  77. #ifdef _DEBUG
  78. m_bENVMAPMASK = true;
  79. #endif
  80. }
  81. void SetENVMAPMASK( bool i )
  82. {
  83. m_nENVMAPMASK = i ? 1 : 0;
  84. #ifdef _DEBUG
  85. m_bENVMAPMASK = true;
  86. #endif
  87. }
  88. private:
  89. int m_nBASEALPHAENVMAPMASK;
  90. #ifdef _DEBUG
  91. bool m_bBASEALPHAENVMAPMASK;
  92. #endif
  93. public:
  94. void SetBASEALPHAENVMAPMASK( int i )
  95. {
  96. Assert( i >= 0 && i <= 1 );
  97. m_nBASEALPHAENVMAPMASK = i;
  98. #ifdef _DEBUG
  99. m_bBASEALPHAENVMAPMASK = true;
  100. #endif
  101. }
  102. void SetBASEALPHAENVMAPMASK( bool i )
  103. {
  104. m_nBASEALPHAENVMAPMASK = i ? 1 : 0;
  105. #ifdef _DEBUG
  106. m_bBASEALPHAENVMAPMASK = true;
  107. #endif
  108. }
  109. private:
  110. int m_nHDRTYPE;
  111. #ifdef _DEBUG
  112. bool m_bHDRTYPE;
  113. #endif
  114. public:
  115. void SetHDRTYPE( int i )
  116. {
  117. Assert( i >= 0 && i <= 2 );
  118. m_nHDRTYPE = i;
  119. #ifdef _DEBUG
  120. m_bHDRTYPE = true;
  121. #endif
  122. }
  123. void SetHDRTYPE( bool i )
  124. {
  125. m_nHDRTYPE = i ? 1 : 0;
  126. #ifdef _DEBUG
  127. m_bHDRTYPE = true;
  128. #endif
  129. }
  130. public:
  131. shatteredglass_ps20b_Static_Index( )
  132. {
  133. #ifdef _DEBUG
  134. m_bCONVERT_TO_SRGB = true;
  135. #endif // _DEBUG
  136. m_nCONVERT_TO_SRGB = g_pHardwareConfig->NeedsShaderSRGBConversion();
  137. #ifdef _DEBUG
  138. m_bCUBEMAP = false;
  139. #endif // _DEBUG
  140. m_nCUBEMAP = 0;
  141. #ifdef _DEBUG
  142. m_bVERTEXCOLOR = false;
  143. #endif // _DEBUG
  144. m_nVERTEXCOLOR = 0;
  145. #ifdef _DEBUG
  146. m_bENVMAPMASK = false;
  147. #endif // _DEBUG
  148. m_nENVMAPMASK = 0;
  149. #ifdef _DEBUG
  150. m_bBASEALPHAENVMAPMASK = false;
  151. #endif // _DEBUG
  152. m_nBASEALPHAENVMAPMASK = 0;
  153. #ifdef _DEBUG
  154. m_bHDRTYPE = false;
  155. #endif // _DEBUG
  156. m_nHDRTYPE = 0;
  157. }
  158. int GetIndex()
  159. {
  160. // Asserts to make sure that we aren't using any skipped combinations.
  161. // Asserts to make sure that we are setting all of the combination vars.
  162. #ifdef _DEBUG
  163. bool bAllStaticVarsDefined = m_bCONVERT_TO_SRGB && m_bCUBEMAP && m_bVERTEXCOLOR && m_bENVMAPMASK && m_bBASEALPHAENVMAPMASK && m_bHDRTYPE;
  164. Assert( bAllStaticVarsDefined );
  165. #endif // _DEBUG
  166. return ( 4 * m_nCONVERT_TO_SRGB ) + ( 8 * m_nCUBEMAP ) + ( 16 * m_nVERTEXCOLOR ) + ( 32 * m_nENVMAPMASK ) + ( 64 * m_nBASEALPHAENVMAPMASK ) + ( 128 * m_nHDRTYPE ) + 0;
  167. }
  168. };
  169. #define shaderStaticTest_shatteredglass_ps20b psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_VERTEXCOLOR + psh_forgot_to_set_static_ENVMAPMASK + psh_forgot_to_set_static_BASEALPHAENVMAPMASK + psh_forgot_to_set_static_HDRTYPE + 0
  170. class shatteredglass_ps20b_Dynamic_Index
  171. {
  172. private:
  173. int m_nHDRENABLED;
  174. #ifdef _DEBUG
  175. bool m_bHDRENABLED;
  176. #endif
  177. public:
  178. void SetHDRENABLED( int i )
  179. {
  180. Assert( i >= 0 && i <= 1 );
  181. m_nHDRENABLED = i;
  182. #ifdef _DEBUG
  183. m_bHDRENABLED = true;
  184. #endif
  185. }
  186. void SetHDRENABLED( bool i )
  187. {
  188. m_nHDRENABLED = i ? 1 : 0;
  189. #ifdef _DEBUG
  190. m_bHDRENABLED = true;
  191. #endif
  192. }
  193. private:
  194. int m_nPIXELFOGTYPE;
  195. #ifdef _DEBUG
  196. bool m_bPIXELFOGTYPE;
  197. #endif
  198. public:
  199. void SetPIXELFOGTYPE( int i )
  200. {
  201. Assert( i >= 0 && i <= 1 );
  202. m_nPIXELFOGTYPE = i;
  203. #ifdef _DEBUG
  204. m_bPIXELFOGTYPE = true;
  205. #endif
  206. }
  207. void SetPIXELFOGTYPE( bool i )
  208. {
  209. m_nPIXELFOGTYPE = i ? 1 : 0;
  210. #ifdef _DEBUG
  211. m_bPIXELFOGTYPE = true;
  212. #endif
  213. }
  214. public:
  215. shatteredglass_ps20b_Dynamic_Index()
  216. {
  217. #ifdef _DEBUG
  218. m_bHDRENABLED = false;
  219. #endif // _DEBUG
  220. m_nHDRENABLED = 0;
  221. #ifdef _DEBUG
  222. m_bPIXELFOGTYPE = false;
  223. #endif // _DEBUG
  224. m_nPIXELFOGTYPE = 0;
  225. }
  226. int GetIndex()
  227. {
  228. // Asserts to make sure that we aren't using any skipped combinations.
  229. // Asserts to make sure that we are setting all of the combination vars.
  230. #ifdef _DEBUG
  231. bool bAllDynamicVarsDefined = m_bHDRENABLED && m_bPIXELFOGTYPE;
  232. Assert( bAllDynamicVarsDefined );
  233. #endif // _DEBUG
  234. return ( 1 * m_nHDRENABLED ) + ( 2 * m_nPIXELFOGTYPE ) + 0;
  235. }
  236. };
  237. #define shaderDynamicTest_shatteredglass_ps20b psh_forgot_to_set_dynamic_HDRENABLED + psh_forgot_to_set_dynamic_PIXELFOGTYPE + 0