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.

308 lines
7.0 KiB

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