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.

212 lines
4.4 KiB

  1. #include "shaderlib/cshader.h"
  2. class lightmappedreflective_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_nREFLECT;
  48. #ifdef _DEBUG
  49. bool m_bREFLECT;
  50. #endif
  51. public:
  52. void SetREFLECT( int i )
  53. {
  54. Assert( i >= 0 && i <= 1 );
  55. m_nREFLECT = i;
  56. #ifdef _DEBUG
  57. m_bREFLECT = true;
  58. #endif
  59. }
  60. void SetREFLECT( bool i )
  61. {
  62. m_nREFLECT = i ? 1 : 0;
  63. #ifdef _DEBUG
  64. m_bREFLECT = true;
  65. #endif
  66. }
  67. private:
  68. int m_nREFRACT;
  69. #ifdef _DEBUG
  70. bool m_bREFRACT;
  71. #endif
  72. public:
  73. void SetREFRACT( int i )
  74. {
  75. Assert( i >= 0 && i <= 1 );
  76. m_nREFRACT = i;
  77. #ifdef _DEBUG
  78. m_bREFRACT = true;
  79. #endif
  80. }
  81. void SetREFRACT( bool i )
  82. {
  83. m_nREFRACT = i ? 1 : 0;
  84. #ifdef _DEBUG
  85. m_bREFRACT = true;
  86. #endif
  87. }
  88. private:
  89. int m_nENVMAPMASK;
  90. #ifdef _DEBUG
  91. bool m_bENVMAPMASK;
  92. #endif
  93. public:
  94. void SetENVMAPMASK( int i )
  95. {
  96. Assert( i >= 0 && i <= 1 );
  97. m_nENVMAPMASK = i;
  98. #ifdef _DEBUG
  99. m_bENVMAPMASK = true;
  100. #endif
  101. }
  102. void SetENVMAPMASK( bool i )
  103. {
  104. m_nENVMAPMASK = i ? 1 : 0;
  105. #ifdef _DEBUG
  106. m_bENVMAPMASK = true;
  107. #endif
  108. }
  109. public:
  110. lightmappedreflective_ps20b_Static_Index( )
  111. {
  112. #ifdef _DEBUG
  113. m_bCONVERT_TO_SRGB = true;
  114. #endif // _DEBUG
  115. m_nCONVERT_TO_SRGB = g_pHardwareConfig->NeedsShaderSRGBConversion();
  116. #ifdef _DEBUG
  117. m_bBASETEXTURE = false;
  118. #endif // _DEBUG
  119. m_nBASETEXTURE = 0;
  120. #ifdef _DEBUG
  121. m_bREFLECT = false;
  122. #endif // _DEBUG
  123. m_nREFLECT = 0;
  124. #ifdef _DEBUG
  125. m_bREFRACT = false;
  126. #endif // _DEBUG
  127. m_nREFRACT = 0;
  128. #ifdef _DEBUG
  129. m_bENVMAPMASK = false;
  130. #endif // _DEBUG
  131. m_nENVMAPMASK = 0;
  132. }
  133. int GetIndex()
  134. {
  135. // Asserts to make sure that we aren't using any skipped combinations.
  136. // Asserts to make sure that we are setting all of the combination vars.
  137. #ifdef _DEBUG
  138. bool bAllStaticVarsDefined = m_bCONVERT_TO_SRGB && m_bBASETEXTURE && m_bREFLECT && m_bREFRACT && m_bENVMAPMASK;
  139. Assert( bAllStaticVarsDefined );
  140. #endif // _DEBUG
  141. return ( 4 * m_nCONVERT_TO_SRGB ) + ( 8 * m_nBASETEXTURE ) + ( 16 * m_nREFLECT ) + ( 32 * m_nREFRACT ) + ( 64 * m_nENVMAPMASK ) + 0;
  142. }
  143. };
  144. #define shaderStaticTest_lightmappedreflective_ps20b psh_forgot_to_set_static_BASETEXTURE + psh_forgot_to_set_static_REFLECT + psh_forgot_to_set_static_REFRACT + psh_forgot_to_set_static_ENVMAPMASK + 0
  145. class lightmappedreflective_ps20b_Dynamic_Index
  146. {
  147. private:
  148. int m_nPIXELFOGTYPE;
  149. #ifdef _DEBUG
  150. bool m_bPIXELFOGTYPE;
  151. #endif
  152. public:
  153. void SetPIXELFOGTYPE( int i )
  154. {
  155. Assert( i >= 0 && i <= 1 );
  156. m_nPIXELFOGTYPE = i;
  157. #ifdef _DEBUG
  158. m_bPIXELFOGTYPE = true;
  159. #endif
  160. }
  161. void SetPIXELFOGTYPE( bool i )
  162. {
  163. m_nPIXELFOGTYPE = i ? 1 : 0;
  164. #ifdef _DEBUG
  165. m_bPIXELFOGTYPE = true;
  166. #endif
  167. }
  168. private:
  169. int m_nWRITE_DEPTH_TO_DESTALPHA;
  170. #ifdef _DEBUG
  171. bool m_bWRITE_DEPTH_TO_DESTALPHA;
  172. #endif
  173. public:
  174. void SetWRITE_DEPTH_TO_DESTALPHA( int i )
  175. {
  176. Assert( i >= 0 && i <= 1 );
  177. m_nWRITE_DEPTH_TO_DESTALPHA = i;
  178. #ifdef _DEBUG
  179. m_bWRITE_DEPTH_TO_DESTALPHA = true;
  180. #endif
  181. }
  182. void SetWRITE_DEPTH_TO_DESTALPHA( bool i )
  183. {
  184. m_nWRITE_DEPTH_TO_DESTALPHA = i ? 1 : 0;
  185. #ifdef _DEBUG
  186. m_bWRITE_DEPTH_TO_DESTALPHA = true;
  187. #endif
  188. }
  189. public:
  190. lightmappedreflective_ps20b_Dynamic_Index()
  191. {
  192. #ifdef _DEBUG
  193. m_bPIXELFOGTYPE = false;
  194. #endif // _DEBUG
  195. m_nPIXELFOGTYPE = 0;
  196. #ifdef _DEBUG
  197. m_bWRITE_DEPTH_TO_DESTALPHA = false;
  198. #endif // _DEBUG
  199. m_nWRITE_DEPTH_TO_DESTALPHA = 0;
  200. }
  201. int GetIndex()
  202. {
  203. // Asserts to make sure that we aren't using any skipped combinations.
  204. // Asserts to make sure that we are setting all of the combination vars.
  205. #ifdef _DEBUG
  206. bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE && m_bWRITE_DEPTH_TO_DESTALPHA;
  207. Assert( bAllDynamicVarsDefined );
  208. #endif // _DEBUG
  209. return ( 1 * m_nPIXELFOGTYPE ) + ( 2 * m_nWRITE_DEPTH_TO_DESTALPHA ) + 0;
  210. }
  211. };
  212. #define shaderDynamicTest_lightmappedreflective_ps20b psh_forgot_to_set_dynamic_PIXELFOGTYPE + psh_forgot_to_set_dynamic_WRITE_DEPTH_TO_DESTALPHA + 0