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.

187 lines
3.6 KiB

  1. #include "shaderlib/cshader.h"
  2. class sprite_ps20_Static_Index
  3. {
  4. private:
  5. int m_nVERTEXCOLOR;
  6. #ifdef _DEBUG
  7. bool m_bVERTEXCOLOR;
  8. #endif
  9. public:
  10. void SetVERTEXCOLOR( int i )
  11. {
  12. Assert( i >= 0 && i <= 1 );
  13. m_nVERTEXCOLOR = i;
  14. #ifdef _DEBUG
  15. m_bVERTEXCOLOR = true;
  16. #endif
  17. }
  18. void SetVERTEXCOLOR( bool i )
  19. {
  20. m_nVERTEXCOLOR = i ? 1 : 0;
  21. #ifdef _DEBUG
  22. m_bVERTEXCOLOR = true;
  23. #endif
  24. }
  25. private:
  26. int m_nCONSTANTCOLOR;
  27. #ifdef _DEBUG
  28. bool m_bCONSTANTCOLOR;
  29. #endif
  30. public:
  31. void SetCONSTANTCOLOR( int i )
  32. {
  33. Assert( i >= 0 && i <= 1 );
  34. m_nCONSTANTCOLOR = i;
  35. #ifdef _DEBUG
  36. m_bCONSTANTCOLOR = true;
  37. #endif
  38. }
  39. void SetCONSTANTCOLOR( bool i )
  40. {
  41. m_nCONSTANTCOLOR = i ? 1 : 0;
  42. #ifdef _DEBUG
  43. m_bCONSTANTCOLOR = true;
  44. #endif
  45. }
  46. private:
  47. int m_nHDRTYPE;
  48. #ifdef _DEBUG
  49. bool m_bHDRTYPE;
  50. #endif
  51. public:
  52. void SetHDRTYPE( int i )
  53. {
  54. Assert( i >= 0 && i <= 2 );
  55. m_nHDRTYPE = i;
  56. #ifdef _DEBUG
  57. m_bHDRTYPE = true;
  58. #endif
  59. }
  60. void SetHDRTYPE( bool i )
  61. {
  62. m_nHDRTYPE = i ? 1 : 0;
  63. #ifdef _DEBUG
  64. m_bHDRTYPE = true;
  65. #endif
  66. }
  67. private:
  68. int m_nSRGB;
  69. #ifdef _DEBUG
  70. bool m_bSRGB;
  71. #endif
  72. public:
  73. void SetSRGB( int i )
  74. {
  75. Assert( i >= 0 && i <= 1 );
  76. m_nSRGB = i;
  77. #ifdef _DEBUG
  78. m_bSRGB = true;
  79. #endif
  80. }
  81. void SetSRGB( bool i )
  82. {
  83. m_nSRGB = i ? 1 : 0;
  84. #ifdef _DEBUG
  85. m_bSRGB = true;
  86. #endif
  87. }
  88. public:
  89. sprite_ps20_Static_Index( )
  90. {
  91. #ifdef _DEBUG
  92. m_bVERTEXCOLOR = false;
  93. #endif // _DEBUG
  94. m_nVERTEXCOLOR = 0;
  95. #ifdef _DEBUG
  96. m_bCONSTANTCOLOR = false;
  97. #endif // _DEBUG
  98. m_nCONSTANTCOLOR = 0;
  99. #ifdef _DEBUG
  100. m_bHDRTYPE = false;
  101. #endif // _DEBUG
  102. m_nHDRTYPE = 0;
  103. #ifdef _DEBUG
  104. m_bSRGB = false;
  105. #endif // _DEBUG
  106. m_nSRGB = 0;
  107. }
  108. int GetIndex()
  109. {
  110. // Asserts to make sure that we aren't using any skipped combinations.
  111. // Asserts to make sure that we are setting all of the combination vars.
  112. #ifdef _DEBUG
  113. bool bAllStaticVarsDefined = m_bVERTEXCOLOR && m_bCONSTANTCOLOR && m_bHDRTYPE && m_bSRGB;
  114. Assert( bAllStaticVarsDefined );
  115. #endif // _DEBUG
  116. return ( 4 * m_nVERTEXCOLOR ) + ( 8 * m_nCONSTANTCOLOR ) + ( 16 * m_nHDRTYPE ) + ( 48 * m_nSRGB ) + 0;
  117. }
  118. };
  119. #define shaderStaticTest_sprite_ps20 psh_forgot_to_set_static_VERTEXCOLOR + psh_forgot_to_set_static_CONSTANTCOLOR + psh_forgot_to_set_static_HDRTYPE + psh_forgot_to_set_static_SRGB + 0
  120. class sprite_ps20_Dynamic_Index
  121. {
  122. private:
  123. int m_nHDRENABLED;
  124. #ifdef _DEBUG
  125. bool m_bHDRENABLED;
  126. #endif
  127. public:
  128. void SetHDRENABLED( int i )
  129. {
  130. Assert( i >= 0 && i <= 1 );
  131. m_nHDRENABLED = i;
  132. #ifdef _DEBUG
  133. m_bHDRENABLED = true;
  134. #endif
  135. }
  136. void SetHDRENABLED( bool i )
  137. {
  138. m_nHDRENABLED = i ? 1 : 0;
  139. #ifdef _DEBUG
  140. m_bHDRENABLED = true;
  141. #endif
  142. }
  143. private:
  144. int m_nPIXELFOGTYPE;
  145. #ifdef _DEBUG
  146. bool m_bPIXELFOGTYPE;
  147. #endif
  148. public:
  149. void SetPIXELFOGTYPE( int i )
  150. {
  151. Assert( i >= 0 && i <= 1 );
  152. m_nPIXELFOGTYPE = i;
  153. #ifdef _DEBUG
  154. m_bPIXELFOGTYPE = true;
  155. #endif
  156. }
  157. void SetPIXELFOGTYPE( bool i )
  158. {
  159. m_nPIXELFOGTYPE = i ? 1 : 0;
  160. #ifdef _DEBUG
  161. m_bPIXELFOGTYPE = true;
  162. #endif
  163. }
  164. public:
  165. sprite_ps20_Dynamic_Index()
  166. {
  167. #ifdef _DEBUG
  168. m_bHDRENABLED = false;
  169. #endif // _DEBUG
  170. m_nHDRENABLED = 0;
  171. #ifdef _DEBUG
  172. m_bPIXELFOGTYPE = false;
  173. #endif // _DEBUG
  174. m_nPIXELFOGTYPE = 0;
  175. }
  176. int GetIndex()
  177. {
  178. // Asserts to make sure that we aren't using any skipped combinations.
  179. // Asserts to make sure that we are setting all of the combination vars.
  180. #ifdef _DEBUG
  181. bool bAllDynamicVarsDefined = m_bHDRENABLED && m_bPIXELFOGTYPE;
  182. Assert( bAllDynamicVarsDefined );
  183. #endif // _DEBUG
  184. return ( 1 * m_nHDRENABLED ) + ( 2 * m_nPIXELFOGTYPE ) + 0;
  185. }
  186. };
  187. #define shaderDynamicTest_sprite_ps20 psh_forgot_to_set_dynamic_HDRENABLED + psh_forgot_to_set_dynamic_PIXELFOGTYPE + 0