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.

337 lines
7.6 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $DOWATERFOG == 0 ) && ( $DOPIXELFOG && $HARDWAREFOGBLEND )
  3. // ( $DOWATERFOG == 0 ) && ( $HARDWAREFOGBLEND == 0 ) && ( $DOPIXELFOG == 0 )
  4. // ( $FLATTEN_STATIC_CONTROL_FLOW == 0 ) && ( $NUM_LIGHTS > 0 ) [PC]
  5. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  6. #include "shaderlib/cshader.h"
  7. class teeth_vs20_Static_Index
  8. {
  9. private:
  10. int m_nFLATTEN_STATIC_CONTROL_FLOW;
  11. #ifdef _DEBUG
  12. bool m_bFLATTEN_STATIC_CONTROL_FLOW;
  13. #endif
  14. public:
  15. void SetFLATTEN_STATIC_CONTROL_FLOW( int i )
  16. {
  17. Assert( i >= 0 && i <= 1 );
  18. m_nFLATTEN_STATIC_CONTROL_FLOW = i;
  19. #ifdef _DEBUG
  20. m_bFLATTEN_STATIC_CONTROL_FLOW = true;
  21. #endif
  22. }
  23. void SetFLATTEN_STATIC_CONTROL_FLOW( bool i )
  24. {
  25. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  26. m_nFLATTEN_STATIC_CONTROL_FLOW = i ? 1 : 0;
  27. #ifdef _DEBUG
  28. m_bFLATTEN_STATIC_CONTROL_FLOW = true;
  29. #endif
  30. }
  31. private:
  32. int m_nDOPIXELFOG;
  33. #ifdef _DEBUG
  34. bool m_bDOPIXELFOG;
  35. #endif
  36. public:
  37. void SetDOPIXELFOG( int i )
  38. {
  39. Assert( i >= 0 && i <= 1 );
  40. m_nDOPIXELFOG = i;
  41. #ifdef _DEBUG
  42. m_bDOPIXELFOG = true;
  43. #endif
  44. }
  45. void SetDOPIXELFOG( bool i )
  46. {
  47. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  48. m_nDOPIXELFOG = i ? 1 : 0;
  49. #ifdef _DEBUG
  50. m_bDOPIXELFOG = true;
  51. #endif
  52. }
  53. private:
  54. int m_nHARDWAREFOGBLEND;
  55. #ifdef _DEBUG
  56. bool m_bHARDWAREFOGBLEND;
  57. #endif
  58. public:
  59. void SetHARDWAREFOGBLEND( int i )
  60. {
  61. Assert( i >= 0 && i <= 1 );
  62. m_nHARDWAREFOGBLEND = i;
  63. #ifdef _DEBUG
  64. m_bHARDWAREFOGBLEND = true;
  65. #endif
  66. }
  67. void SetHARDWAREFOGBLEND( bool i )
  68. {
  69. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  70. m_nHARDWAREFOGBLEND = i ? 1 : 0;
  71. #ifdef _DEBUG
  72. m_bHARDWAREFOGBLEND = true;
  73. #endif
  74. }
  75. public:
  76. // CONSTRUCTOR
  77. teeth_vs20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  78. {
  79. #ifdef _DEBUG
  80. m_bFLATTEN_STATIC_CONTROL_FLOW = false;
  81. #endif // _DEBUG
  82. m_nFLATTEN_STATIC_CONTROL_FLOW = 0;
  83. #ifdef _DEBUG
  84. m_bDOPIXELFOG = true;
  85. #endif // _DEBUG
  86. m_nDOPIXELFOG = g_pHardwareConfig->SupportsPixelShaders_2_b() ;
  87. #ifdef _DEBUG
  88. m_bHARDWAREFOGBLEND = true;
  89. #endif // _DEBUG
  90. m_nHARDWAREFOGBLEND = !g_pHardwareConfig->SupportsPixelShaders_2_b() ;
  91. }
  92. int GetIndex()
  93. {
  94. // Asserts to make sure that we aren't using any skipped combinations.
  95. // Asserts to make sure that we are setting all of the combination vars.
  96. #ifdef _DEBUG
  97. bool bAllStaticVarsDefined = m_bFLATTEN_STATIC_CONTROL_FLOW && m_bDOPIXELFOG && m_bHARDWAREFOGBLEND;
  98. Assert( bAllStaticVarsDefined );
  99. #endif // _DEBUG
  100. return ( 96 * m_nFLATTEN_STATIC_CONTROL_FLOW ) + ( 192 * m_nDOPIXELFOG ) + ( 384 * m_nHARDWAREFOGBLEND ) + 0;
  101. }
  102. };
  103. #define shaderStaticTest_teeth_vs20 vsh_forgot_to_set_static_FLATTEN_STATIC_CONTROL_FLOW + 0
  104. class teeth_vs20_Dynamic_Index
  105. {
  106. private:
  107. int m_nCOMPRESSED_VERTS;
  108. #ifdef _DEBUG
  109. bool m_bCOMPRESSED_VERTS;
  110. #endif
  111. public:
  112. void SetCOMPRESSED_VERTS( int i )
  113. {
  114. Assert( i >= 0 && i <= 1 );
  115. m_nCOMPRESSED_VERTS = i;
  116. #ifdef _DEBUG
  117. m_bCOMPRESSED_VERTS = true;
  118. #endif
  119. }
  120. void SetCOMPRESSED_VERTS( bool i )
  121. {
  122. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  123. m_nCOMPRESSED_VERTS = i ? 1 : 0;
  124. #ifdef _DEBUG
  125. m_bCOMPRESSED_VERTS = true;
  126. #endif
  127. }
  128. private:
  129. int m_nDOWATERFOG;
  130. #ifdef _DEBUG
  131. bool m_bDOWATERFOG;
  132. #endif
  133. public:
  134. void SetDOWATERFOG( int i )
  135. {
  136. Assert( i >= 0 && i <= 1 );
  137. m_nDOWATERFOG = i;
  138. #ifdef _DEBUG
  139. m_bDOWATERFOG = true;
  140. #endif
  141. }
  142. void SetDOWATERFOG( bool i )
  143. {
  144. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  145. m_nDOWATERFOG = i ? 1 : 0;
  146. #ifdef _DEBUG
  147. m_bDOWATERFOG = true;
  148. #endif
  149. }
  150. private:
  151. int m_nSKINNING;
  152. #ifdef _DEBUG
  153. bool m_bSKINNING;
  154. #endif
  155. public:
  156. void SetSKINNING( int i )
  157. {
  158. Assert( i >= 0 && i <= 1 );
  159. m_nSKINNING = i;
  160. #ifdef _DEBUG
  161. m_bSKINNING = true;
  162. #endif
  163. }
  164. void SetSKINNING( bool i )
  165. {
  166. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  167. m_nSKINNING = i ? 1 : 0;
  168. #ifdef _DEBUG
  169. m_bSKINNING = true;
  170. #endif
  171. }
  172. private:
  173. int m_nDYNAMIC_LIGHT;
  174. #ifdef _DEBUG
  175. bool m_bDYNAMIC_LIGHT;
  176. #endif
  177. public:
  178. void SetDYNAMIC_LIGHT( int i )
  179. {
  180. Assert( i >= 0 && i <= 1 );
  181. m_nDYNAMIC_LIGHT = i;
  182. #ifdef _DEBUG
  183. m_bDYNAMIC_LIGHT = true;
  184. #endif
  185. }
  186. void SetDYNAMIC_LIGHT( bool i )
  187. {
  188. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  189. m_nDYNAMIC_LIGHT = i ? 1 : 0;
  190. #ifdef _DEBUG
  191. m_bDYNAMIC_LIGHT = true;
  192. #endif
  193. }
  194. private:
  195. int m_nSTATIC_LIGHT;
  196. #ifdef _DEBUG
  197. bool m_bSTATIC_LIGHT;
  198. #endif
  199. public:
  200. void SetSTATIC_LIGHT( int i )
  201. {
  202. Assert( i >= 0 && i <= 1 );
  203. m_nSTATIC_LIGHT = i;
  204. #ifdef _DEBUG
  205. m_bSTATIC_LIGHT = true;
  206. #endif
  207. }
  208. void SetSTATIC_LIGHT( bool i )
  209. {
  210. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  211. m_nSTATIC_LIGHT = i ? 1 : 0;
  212. #ifdef _DEBUG
  213. m_bSTATIC_LIGHT = true;
  214. #endif
  215. }
  216. private:
  217. int m_nMORPHING;
  218. #ifdef _DEBUG
  219. bool m_bMORPHING;
  220. #endif
  221. public:
  222. void SetMORPHING( int i )
  223. {
  224. Assert( i >= 0 && i <= 0 );
  225. m_nMORPHING = i;
  226. #ifdef _DEBUG
  227. m_bMORPHING = true;
  228. #endif
  229. }
  230. void SetMORPHING( bool i )
  231. {
  232. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  233. m_nMORPHING = i ? 1 : 0;
  234. #ifdef _DEBUG
  235. m_bMORPHING = true;
  236. #endif
  237. }
  238. private:
  239. int m_nNUM_LIGHTS;
  240. #ifdef _DEBUG
  241. bool m_bNUM_LIGHTS;
  242. #endif
  243. public:
  244. void SetNUM_LIGHTS( int i )
  245. {
  246. Assert( i >= 0 && i <= 2 );
  247. m_nNUM_LIGHTS = i;
  248. #ifdef _DEBUG
  249. m_bNUM_LIGHTS = true;
  250. #endif
  251. }
  252. void SetNUM_LIGHTS( bool i )
  253. {
  254. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  255. m_nNUM_LIGHTS = i ? 1 : 0;
  256. #ifdef _DEBUG
  257. m_bNUM_LIGHTS = true;
  258. #endif
  259. }
  260. public:
  261. // CONSTRUCTOR
  262. teeth_vs20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  263. {
  264. #ifdef _DEBUG
  265. m_bCOMPRESSED_VERTS = false;
  266. #endif // _DEBUG
  267. m_nCOMPRESSED_VERTS = 0;
  268. #ifdef _DEBUG
  269. m_bDOWATERFOG = true;
  270. #endif // _DEBUG
  271. m_nDOWATERFOG = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  272. #ifdef _DEBUG
  273. m_bSKINNING = false;
  274. #endif // _DEBUG
  275. m_nSKINNING = 0;
  276. #ifdef _DEBUG
  277. m_bDYNAMIC_LIGHT = false;
  278. #endif // _DEBUG
  279. m_nDYNAMIC_LIGHT = 0;
  280. #ifdef _DEBUG
  281. m_bSTATIC_LIGHT = false;
  282. #endif // _DEBUG
  283. m_nSTATIC_LIGHT = 0;
  284. #ifdef _DEBUG
  285. m_bMORPHING = true;
  286. #endif // _DEBUG
  287. m_nMORPHING = false ;
  288. #ifdef _DEBUG
  289. m_bNUM_LIGHTS = false;
  290. #endif // _DEBUG
  291. m_nNUM_LIGHTS = 0;
  292. }
  293. int GetIndex()
  294. {
  295. // Asserts to make sure that we aren't using any skipped combinations.
  296. // Asserts to make sure that we are setting all of the combination vars.
  297. #ifdef _DEBUG
  298. bool bAllDynamicVarsDefined = m_bCOMPRESSED_VERTS && m_bDOWATERFOG && m_bSKINNING && m_bDYNAMIC_LIGHT && m_bSTATIC_LIGHT && m_bMORPHING && m_bNUM_LIGHTS;
  299. Assert( bAllDynamicVarsDefined );
  300. #endif // _DEBUG
  301. return ( 1 * m_nCOMPRESSED_VERTS ) + ( 2 * m_nDOWATERFOG ) + ( 4 * m_nSKINNING ) + ( 8 * m_nDYNAMIC_LIGHT ) + ( 16 * m_nSTATIC_LIGHT ) + ( 32 * m_nMORPHING ) + ( 32 * m_nNUM_LIGHTS ) + 0;
  302. }
  303. };
  304. #define shaderDynamicTest_teeth_vs20 vsh_forgot_to_set_dynamic_COMPRESSED_VERTS + vsh_forgot_to_set_dynamic_SKINNING + vsh_forgot_to_set_dynamic_DYNAMIC_LIGHT + vsh_forgot_to_set_dynamic_STATIC_LIGHT + vsh_forgot_to_set_dynamic_NUM_LIGHTS + 0
  305. static const ShaderComboInformation_t s_DynamicComboArray_teeth_vs20[7] =
  306. {
  307. { "COMPRESSED_VERTS", 0, 1 },
  308. { "DOWATERFOG", 0, 1 },
  309. { "SKINNING", 0, 1 },
  310. { "DYNAMIC_LIGHT", 0, 1 },
  311. { "STATIC_LIGHT", 0, 1 },
  312. { "MORPHING", 0, 0 },
  313. { "NUM_LIGHTS", 0, 2 },
  314. };
  315. static const ShaderComboInformation_t s_StaticComboArray_teeth_vs20[3] =
  316. {
  317. { "FLATTEN_STATIC_CONTROL_FLOW", 0, 1 },
  318. { "DOPIXELFOG", 0, 1 },
  319. { "HARDWAREFOGBLEND", 0, 1 },
  320. };
  321. static const ShaderComboSemantics_t teeth_vs20_combos =
  322. {
  323. "teeth_vs20", s_DynamicComboArray_teeth_vs20, 7, s_StaticComboArray_teeth_vs20, 3
  324. };
  325. class ConstructMe_teeth_vs20
  326. {
  327. public:
  328. ConstructMe_teeth_vs20()
  329. {
  330. GetShaderDLL()->AddShaderComboInformation( &teeth_vs20_combos );
  331. }
  332. };
  333. static ConstructMe_teeth_vs20 s_ConstructMe_teeth_vs20;