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.

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