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.

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