Counter Strike : Global Offensive Source Code
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.

235 lines
5.6 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  3. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  4. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  5. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  6. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  7. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  8. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  9. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  10. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  11. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  12. #include "shaderlib/cshader.h"
  13. class sprite_ps20_Static_Index
  14. {
  15. private:
  16. int m_nVERTEXCOLOR;
  17. #ifdef _DEBUG
  18. bool m_bVERTEXCOLOR;
  19. #endif
  20. public:
  21. void SetVERTEXCOLOR( int i )
  22. {
  23. Assert( i >= 0 && i <= 1 );
  24. m_nVERTEXCOLOR = i;
  25. #ifdef _DEBUG
  26. m_bVERTEXCOLOR = true;
  27. #endif
  28. }
  29. void SetVERTEXCOLOR( bool i )
  30. {
  31. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  32. m_nVERTEXCOLOR = i ? 1 : 0;
  33. #ifdef _DEBUG
  34. m_bVERTEXCOLOR = true;
  35. #endif
  36. }
  37. private:
  38. int m_nCONSTANTCOLOR;
  39. #ifdef _DEBUG
  40. bool m_bCONSTANTCOLOR;
  41. #endif
  42. public:
  43. void SetCONSTANTCOLOR( int i )
  44. {
  45. Assert( i >= 0 && i <= 1 );
  46. m_nCONSTANTCOLOR = i;
  47. #ifdef _DEBUG
  48. m_bCONSTANTCOLOR = true;
  49. #endif
  50. }
  51. void SetCONSTANTCOLOR( bool i )
  52. {
  53. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  54. m_nCONSTANTCOLOR = i ? 1 : 0;
  55. #ifdef _DEBUG
  56. m_bCONSTANTCOLOR = true;
  57. #endif
  58. }
  59. private:
  60. int m_nHDRTYPE;
  61. #ifdef _DEBUG
  62. bool m_bHDRTYPE;
  63. #endif
  64. public:
  65. void SetHDRTYPE( int i )
  66. {
  67. Assert( i >= 0 && i <= 2 );
  68. m_nHDRTYPE = i;
  69. #ifdef _DEBUG
  70. m_bHDRTYPE = true;
  71. #endif
  72. }
  73. void SetHDRTYPE( bool i )
  74. {
  75. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  76. m_nHDRTYPE = i ? 1 : 0;
  77. #ifdef _DEBUG
  78. m_bHDRTYPE = true;
  79. #endif
  80. }
  81. private:
  82. int m_nSRGB;
  83. #ifdef _DEBUG
  84. bool m_bSRGB;
  85. #endif
  86. public:
  87. void SetSRGB( int i )
  88. {
  89. Assert( i >= 0 && i <= 1 );
  90. m_nSRGB = i;
  91. #ifdef _DEBUG
  92. m_bSRGB = true;
  93. #endif
  94. }
  95. void SetSRGB( bool i )
  96. {
  97. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  98. m_nSRGB = i ? 1 : 0;
  99. #ifdef _DEBUG
  100. m_bSRGB = true;
  101. #endif
  102. }
  103. public:
  104. // CONSTRUCTOR
  105. sprite_ps20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  106. {
  107. #ifdef _DEBUG
  108. m_bVERTEXCOLOR = false;
  109. #endif // _DEBUG
  110. m_nVERTEXCOLOR = 0;
  111. #ifdef _DEBUG
  112. m_bCONSTANTCOLOR = false;
  113. #endif // _DEBUG
  114. m_nCONSTANTCOLOR = 0;
  115. #ifdef _DEBUG
  116. m_bHDRTYPE = false;
  117. #endif // _DEBUG
  118. m_nHDRTYPE = 0;
  119. #ifdef _DEBUG
  120. m_bSRGB = false;
  121. #endif // _DEBUG
  122. m_nSRGB = 0;
  123. }
  124. int GetIndex()
  125. {
  126. // Asserts to make sure that we aren't using any skipped combinations.
  127. // Asserts to make sure that we are setting all of the combination vars.
  128. #ifdef _DEBUG
  129. bool bAllStaticVarsDefined = m_bVERTEXCOLOR && m_bCONSTANTCOLOR && m_bHDRTYPE && m_bSRGB;
  130. Assert( bAllStaticVarsDefined );
  131. #endif // _DEBUG
  132. return ( 4 * m_nVERTEXCOLOR ) + ( 8 * m_nCONSTANTCOLOR ) + ( 16 * m_nHDRTYPE ) + ( 48 * m_nSRGB ) + 0;
  133. }
  134. };
  135. #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
  136. class sprite_ps20_Dynamic_Index
  137. {
  138. private:
  139. int m_nHDRENABLED;
  140. #ifdef _DEBUG
  141. bool m_bHDRENABLED;
  142. #endif
  143. public:
  144. void SetHDRENABLED( int i )
  145. {
  146. Assert( i >= 0 && i <= 1 );
  147. m_nHDRENABLED = i;
  148. #ifdef _DEBUG
  149. m_bHDRENABLED = true;
  150. #endif
  151. }
  152. void SetHDRENABLED( bool i )
  153. {
  154. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  155. m_nHDRENABLED = i ? 1 : 0;
  156. #ifdef _DEBUG
  157. m_bHDRENABLED = true;
  158. #endif
  159. }
  160. private:
  161. int m_nPIXELFOGTYPE;
  162. #ifdef _DEBUG
  163. bool m_bPIXELFOGTYPE;
  164. #endif
  165. public:
  166. void SetPIXELFOGTYPE( int i )
  167. {
  168. Assert( i >= 0 && i <= 1 );
  169. m_nPIXELFOGTYPE = i;
  170. #ifdef _DEBUG
  171. m_bPIXELFOGTYPE = true;
  172. #endif
  173. }
  174. void SetPIXELFOGTYPE( bool i )
  175. {
  176. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  177. m_nPIXELFOGTYPE = i ? 1 : 0;
  178. #ifdef _DEBUG
  179. m_bPIXELFOGTYPE = true;
  180. #endif
  181. }
  182. public:
  183. // CONSTRUCTOR
  184. sprite_ps20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  185. {
  186. #ifdef _DEBUG
  187. m_bHDRENABLED = false;
  188. #endif // _DEBUG
  189. m_nHDRENABLED = 0;
  190. #ifdef _DEBUG
  191. m_bPIXELFOGTYPE = true;
  192. #endif // _DEBUG
  193. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  194. }
  195. int GetIndex()
  196. {
  197. // Asserts to make sure that we aren't using any skipped combinations.
  198. // Asserts to make sure that we are setting all of the combination vars.
  199. #ifdef _DEBUG
  200. bool bAllDynamicVarsDefined = m_bHDRENABLED && m_bPIXELFOGTYPE;
  201. Assert( bAllDynamicVarsDefined );
  202. #endif // _DEBUG
  203. return ( 1 * m_nHDRENABLED ) + ( 2 * m_nPIXELFOGTYPE ) + 0;
  204. }
  205. };
  206. #define shaderDynamicTest_sprite_ps20 psh_forgot_to_set_dynamic_HDRENABLED + 0
  207. static const ShaderComboInformation_t s_DynamicComboArray_sprite_ps20[2] =
  208. {
  209. { "HDRENABLED", 0, 1 },
  210. { "PIXELFOGTYPE", 0, 1 },
  211. };
  212. static const ShaderComboInformation_t s_StaticComboArray_sprite_ps20[4] =
  213. {
  214. { "VERTEXCOLOR", 0, 1 },
  215. { "CONSTANTCOLOR", 0, 1 },
  216. { "HDRTYPE", 0, 2 },
  217. { "SRGB", 0, 1 },
  218. };
  219. static const ShaderComboSemantics_t sprite_ps20_combos =
  220. {
  221. "sprite_ps20", s_DynamicComboArray_sprite_ps20, 2, s_StaticComboArray_sprite_ps20, 4
  222. };
  223. class ConstructMe_sprite_ps20
  224. {
  225. public:
  226. ConstructMe_sprite_ps20()
  227. {
  228. GetShaderDLL()->AddShaderComboInformation( &sprite_ps20_combos );
  229. }
  230. };
  231. static ConstructMe_sprite_ps20 s_ConstructMe_sprite_ps20;