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.

255 lines
5.5 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $DOWATERFOG == 0 ) && ( $DOPIXELFOG && $HARDWAREFOGBLEND )
  3. // ( $DOWATERFOG == 0 ) && ( $HARDWAREFOGBLEND == 0 ) && ( $DOPIXELFOG == 0 )
  4. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  5. #include "shaderlib/cshader.h"
  6. class multiblend_vs20_Static_Index
  7. {
  8. private:
  9. int m_nMODEL;
  10. #ifdef _DEBUG
  11. bool m_bMODEL;
  12. #endif
  13. public:
  14. void SetMODEL( int i )
  15. {
  16. Assert( i >= 0 && i <= 1 );
  17. m_nMODEL = i;
  18. #ifdef _DEBUG
  19. m_bMODEL = true;
  20. #endif
  21. }
  22. void SetMODEL( bool i )
  23. {
  24. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  25. m_nMODEL = i ? 1 : 0;
  26. #ifdef _DEBUG
  27. m_bMODEL = true;
  28. #endif
  29. }
  30. private:
  31. int m_nDOPIXELFOG;
  32. #ifdef _DEBUG
  33. bool m_bDOPIXELFOG;
  34. #endif
  35. public:
  36. void SetDOPIXELFOG( int i )
  37. {
  38. Assert( i >= 0 && i <= 1 );
  39. m_nDOPIXELFOG = i;
  40. #ifdef _DEBUG
  41. m_bDOPIXELFOG = true;
  42. #endif
  43. }
  44. void SetDOPIXELFOG( bool i )
  45. {
  46. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  47. m_nDOPIXELFOG = i ? 1 : 0;
  48. #ifdef _DEBUG
  49. m_bDOPIXELFOG = true;
  50. #endif
  51. }
  52. private:
  53. int m_nHARDWAREFOGBLEND;
  54. #ifdef _DEBUG
  55. bool m_bHARDWAREFOGBLEND;
  56. #endif
  57. public:
  58. void SetHARDWAREFOGBLEND( int i )
  59. {
  60. Assert( i >= 0 && i <= 1 );
  61. m_nHARDWAREFOGBLEND = i;
  62. #ifdef _DEBUG
  63. m_bHARDWAREFOGBLEND = true;
  64. #endif
  65. }
  66. void SetHARDWAREFOGBLEND( bool i )
  67. {
  68. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  69. m_nHARDWAREFOGBLEND = i ? 1 : 0;
  70. #ifdef _DEBUG
  71. m_bHARDWAREFOGBLEND = true;
  72. #endif
  73. }
  74. private:
  75. int m_nSPECULAR;
  76. #ifdef _DEBUG
  77. bool m_bSPECULAR;
  78. #endif
  79. public:
  80. void SetSPECULAR( int i )
  81. {
  82. Assert( i >= 0 && i <= 1 );
  83. m_nSPECULAR = i;
  84. #ifdef _DEBUG
  85. m_bSPECULAR = true;
  86. #endif
  87. }
  88. void SetSPECULAR( bool i )
  89. {
  90. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  91. m_nSPECULAR = i ? 1 : 0;
  92. #ifdef _DEBUG
  93. m_bSPECULAR = true;
  94. #endif
  95. }
  96. public:
  97. // CONSTRUCTOR
  98. multiblend_vs20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  99. {
  100. #ifdef _DEBUG
  101. m_bMODEL = false;
  102. #endif // _DEBUG
  103. m_nMODEL = 0;
  104. #ifdef _DEBUG
  105. m_bDOPIXELFOG = true;
  106. #endif // _DEBUG
  107. m_nDOPIXELFOG = g_pHardwareConfig->SupportsPixelShaders_2_b() ;
  108. #ifdef _DEBUG
  109. m_bHARDWAREFOGBLEND = true;
  110. #endif // _DEBUG
  111. m_nHARDWAREFOGBLEND = !g_pHardwareConfig->SupportsPixelShaders_2_b() ;
  112. #ifdef _DEBUG
  113. m_bSPECULAR = false;
  114. #endif // _DEBUG
  115. m_nSPECULAR = 0;
  116. }
  117. int GetIndex()
  118. {
  119. // Asserts to make sure that we aren't using any skipped combinations.
  120. // Asserts to make sure that we are setting all of the combination vars.
  121. #ifdef _DEBUG
  122. bool bAllStaticVarsDefined = m_bMODEL && m_bDOPIXELFOG && m_bHARDWAREFOGBLEND && m_bSPECULAR;
  123. Assert( bAllStaticVarsDefined );
  124. #endif // _DEBUG
  125. return ( 4 * m_nMODEL ) + ( 8 * m_nDOPIXELFOG ) + ( 16 * m_nHARDWAREFOGBLEND ) + ( 32 * m_nSPECULAR ) + 0;
  126. }
  127. };
  128. #define shaderStaticTest_multiblend_vs20 vsh_forgot_to_set_static_MODEL + vsh_forgot_to_set_static_SPECULAR + 0
  129. class multiblend_vs20_Dynamic_Index
  130. {
  131. private:
  132. int m_nDOWATERFOG;
  133. #ifdef _DEBUG
  134. bool m_bDOWATERFOG;
  135. #endif
  136. public:
  137. void SetDOWATERFOG( int i )
  138. {
  139. Assert( i >= 0 && i <= 1 );
  140. m_nDOWATERFOG = i;
  141. #ifdef _DEBUG
  142. m_bDOWATERFOG = true;
  143. #endif
  144. }
  145. void SetDOWATERFOG( bool i )
  146. {
  147. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  148. m_nDOWATERFOG = i ? 1 : 0;
  149. #ifdef _DEBUG
  150. m_bDOWATERFOG = true;
  151. #endif
  152. }
  153. private:
  154. int m_nSKINNING;
  155. #ifdef _DEBUG
  156. bool m_bSKINNING;
  157. #endif
  158. public:
  159. void SetSKINNING( int i )
  160. {
  161. Assert( i >= 0 && i <= 1 );
  162. m_nSKINNING = i;
  163. #ifdef _DEBUG
  164. m_bSKINNING = true;
  165. #endif
  166. }
  167. void SetSKINNING( bool i )
  168. {
  169. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  170. m_nSKINNING = i ? 1 : 0;
  171. #ifdef _DEBUG
  172. m_bSKINNING = true;
  173. #endif
  174. }
  175. private:
  176. int m_nMORPHING;
  177. #ifdef _DEBUG
  178. bool m_bMORPHING;
  179. #endif
  180. public:
  181. void SetMORPHING( int i )
  182. {
  183. Assert( i >= 0 && i <= 0 );
  184. m_nMORPHING = i;
  185. #ifdef _DEBUG
  186. m_bMORPHING = true;
  187. #endif
  188. }
  189. void SetMORPHING( bool i )
  190. {
  191. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  192. m_nMORPHING = i ? 1 : 0;
  193. #ifdef _DEBUG
  194. m_bMORPHING = true;
  195. #endif
  196. }
  197. public:
  198. // CONSTRUCTOR
  199. multiblend_vs20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  200. {
  201. #ifdef _DEBUG
  202. m_bDOWATERFOG = true;
  203. #endif // _DEBUG
  204. m_nDOWATERFOG = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  205. #ifdef _DEBUG
  206. m_bSKINNING = false;
  207. #endif // _DEBUG
  208. m_nSKINNING = 0;
  209. #ifdef _DEBUG
  210. m_bMORPHING = true;
  211. #endif // _DEBUG
  212. m_nMORPHING = false ;
  213. }
  214. int GetIndex()
  215. {
  216. // Asserts to make sure that we aren't using any skipped combinations.
  217. // Asserts to make sure that we are setting all of the combination vars.
  218. #ifdef _DEBUG
  219. bool bAllDynamicVarsDefined = m_bDOWATERFOG && m_bSKINNING && m_bMORPHING;
  220. Assert( bAllDynamicVarsDefined );
  221. #endif // _DEBUG
  222. return ( 1 * m_nDOWATERFOG ) + ( 2 * m_nSKINNING ) + ( 4 * m_nMORPHING ) + 0;
  223. }
  224. };
  225. #define shaderDynamicTest_multiblend_vs20 vsh_forgot_to_set_dynamic_SKINNING + 0
  226. static const ShaderComboInformation_t s_DynamicComboArray_multiblend_vs20[3] =
  227. {
  228. { "DOWATERFOG", 0, 1 },
  229. { "SKINNING", 0, 1 },
  230. { "MORPHING", 0, 0 },
  231. };
  232. static const ShaderComboInformation_t s_StaticComboArray_multiblend_vs20[4] =
  233. {
  234. { "MODEL", 0, 1 },
  235. { "DOPIXELFOG", 0, 1 },
  236. { "HARDWAREFOGBLEND", 0, 1 },
  237. { "SPECULAR", 0, 1 },
  238. };
  239. static const ShaderComboSemantics_t multiblend_vs20_combos =
  240. {
  241. "multiblend_vs20", s_DynamicComboArray_multiblend_vs20, 3, s_StaticComboArray_multiblend_vs20, 4
  242. };
  243. class ConstructMe_multiblend_vs20
  244. {
  245. public:
  246. ConstructMe_multiblend_vs20()
  247. {
  248. GetShaderDLL()->AddShaderComboInformation( &multiblend_vs20_combos );
  249. }
  250. };
  251. static ConstructMe_multiblend_vs20 s_ConstructMe_multiblend_vs20;