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.

391 lines
8.6 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $DOWATERFOG == 0 ) && ( $DOPIXELFOG && $HARDWAREFOGBLEND )
  3. // ( $DOWATERFOG == 0 ) && ( $HARDWAREFOGBLEND == 0 ) && ( $DOPIXELFOG == 0 )
  4. // ( $MORPHING || $SKINNING || $COMPRESSED_VERTS ) && $TESSELLATION
  5. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  6. #include "shaderlib/cshader.h"
  7. class eye_refract_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_nFLASHLIGHT;
  33. #ifdef _DEBUG
  34. bool m_bFLASHLIGHT;
  35. #endif
  36. public:
  37. void SetFLASHLIGHT( int i )
  38. {
  39. Assert( i >= 0 && i <= 1 );
  40. m_nFLASHLIGHT = i;
  41. #ifdef _DEBUG
  42. m_bFLASHLIGHT = true;
  43. #endif
  44. }
  45. void SetFLASHLIGHT( bool i )
  46. {
  47. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  48. m_nFLASHLIGHT = i ? 1 : 0;
  49. #ifdef _DEBUG
  50. m_bFLASHLIGHT = true;
  51. #endif
  52. }
  53. private:
  54. int m_nLIGHTWARPTEXTURE;
  55. #ifdef _DEBUG
  56. bool m_bLIGHTWARPTEXTURE;
  57. #endif
  58. public:
  59. void SetLIGHTWARPTEXTURE( int i )
  60. {
  61. Assert( i >= 0 && i <= 1 );
  62. m_nLIGHTWARPTEXTURE = i;
  63. #ifdef _DEBUG
  64. m_bLIGHTWARPTEXTURE = true;
  65. #endif
  66. }
  67. void SetLIGHTWARPTEXTURE( bool i )
  68. {
  69. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  70. m_nLIGHTWARPTEXTURE = i ? 1 : 0;
  71. #ifdef _DEBUG
  72. m_bLIGHTWARPTEXTURE = true;
  73. #endif
  74. }
  75. private:
  76. int m_nWORLD_NORMAL;
  77. #ifdef _DEBUG
  78. bool m_bWORLD_NORMAL;
  79. #endif
  80. public:
  81. void SetWORLD_NORMAL( int i )
  82. {
  83. Assert( i >= 0 && i <= 0 );
  84. m_nWORLD_NORMAL = i;
  85. #ifdef _DEBUG
  86. m_bWORLD_NORMAL = true;
  87. #endif
  88. }
  89. void SetWORLD_NORMAL( bool i )
  90. {
  91. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  92. m_nWORLD_NORMAL = i ? 1 : 0;
  93. #ifdef _DEBUG
  94. m_bWORLD_NORMAL = true;
  95. #endif
  96. }
  97. private:
  98. int m_nDOPIXELFOG;
  99. #ifdef _DEBUG
  100. bool m_bDOPIXELFOG;
  101. #endif
  102. public:
  103. void SetDOPIXELFOG( int i )
  104. {
  105. Assert( i >= 0 && i <= 1 );
  106. m_nDOPIXELFOG = i;
  107. #ifdef _DEBUG
  108. m_bDOPIXELFOG = true;
  109. #endif
  110. }
  111. void SetDOPIXELFOG( bool i )
  112. {
  113. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  114. m_nDOPIXELFOG = i ? 1 : 0;
  115. #ifdef _DEBUG
  116. m_bDOPIXELFOG = true;
  117. #endif
  118. }
  119. public:
  120. // CONSTRUCTOR
  121. eye_refract_vs20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  122. {
  123. #ifdef _DEBUG
  124. m_bHALFLAMBERT = false;
  125. #endif // _DEBUG
  126. m_nHALFLAMBERT = 0;
  127. #ifdef _DEBUG
  128. m_bFLASHLIGHT = false;
  129. #endif // _DEBUG
  130. m_nFLASHLIGHT = 0;
  131. #ifdef _DEBUG
  132. m_bLIGHTWARPTEXTURE = false;
  133. #endif // _DEBUG
  134. m_nLIGHTWARPTEXTURE = 0;
  135. #ifdef _DEBUG
  136. m_bWORLD_NORMAL = false;
  137. #endif // _DEBUG
  138. m_nWORLD_NORMAL = 0;
  139. #ifdef _DEBUG
  140. m_bDOPIXELFOG = true;
  141. #endif // _DEBUG
  142. m_nDOPIXELFOG = g_pHardwareConfig->SupportsPixelShaders_2_b() ;
  143. }
  144. int GetIndex()
  145. {
  146. // Asserts to make sure that we aren't using any skipped combinations.
  147. // Asserts to make sure that we are setting all of the combination vars.
  148. #ifdef _DEBUG
  149. bool bAllStaticVarsDefined = m_bHALFLAMBERT && m_bFLASHLIGHT && m_bLIGHTWARPTEXTURE && m_bWORLD_NORMAL && m_bDOPIXELFOG;
  150. Assert( bAllStaticVarsDefined );
  151. #endif // _DEBUG
  152. return ( 80 * m_nHALFLAMBERT ) + ( 160 * m_nFLASHLIGHT ) + ( 320 * m_nLIGHTWARPTEXTURE ) + ( 640 * m_nWORLD_NORMAL ) + ( 640 * m_nDOPIXELFOG ) + 0;
  153. }
  154. };
  155. #define shaderStaticTest_eye_refract_vs20 vsh_forgot_to_set_static_HALFLAMBERT + vsh_forgot_to_set_static_FLASHLIGHT + vsh_forgot_to_set_static_LIGHTWARPTEXTURE + vsh_forgot_to_set_static_WORLD_NORMAL + 0
  156. class eye_refract_vs20_Dynamic_Index
  157. {
  158. private:
  159. int m_nCOMPRESSED_VERTS;
  160. #ifdef _DEBUG
  161. bool m_bCOMPRESSED_VERTS;
  162. #endif
  163. public:
  164. void SetCOMPRESSED_VERTS( int i )
  165. {
  166. Assert( i >= 0 && i <= 1 );
  167. m_nCOMPRESSED_VERTS = i;
  168. #ifdef _DEBUG
  169. m_bCOMPRESSED_VERTS = true;
  170. #endif
  171. }
  172. void SetCOMPRESSED_VERTS( bool i )
  173. {
  174. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  175. m_nCOMPRESSED_VERTS = i ? 1 : 0;
  176. #ifdef _DEBUG
  177. m_bCOMPRESSED_VERTS = true;
  178. #endif
  179. }
  180. private:
  181. int m_nSKINNING;
  182. #ifdef _DEBUG
  183. bool m_bSKINNING;
  184. #endif
  185. public:
  186. void SetSKINNING( int i )
  187. {
  188. Assert( i >= 0 && i <= 1 );
  189. m_nSKINNING = i;
  190. #ifdef _DEBUG
  191. m_bSKINNING = true;
  192. #endif
  193. }
  194. void SetSKINNING( bool i )
  195. {
  196. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  197. m_nSKINNING = i ? 1 : 0;
  198. #ifdef _DEBUG
  199. m_bSKINNING = true;
  200. #endif
  201. }
  202. private:
  203. int m_nDOWATERFOG;
  204. #ifdef _DEBUG
  205. bool m_bDOWATERFOG;
  206. #endif
  207. public:
  208. void SetDOWATERFOG( int i )
  209. {
  210. Assert( i >= 0 && i <= 1 );
  211. m_nDOWATERFOG = i;
  212. #ifdef _DEBUG
  213. m_bDOWATERFOG = true;
  214. #endif
  215. }
  216. void SetDOWATERFOG( bool i )
  217. {
  218. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  219. m_nDOWATERFOG = i ? 1 : 0;
  220. #ifdef _DEBUG
  221. m_bDOWATERFOG = true;
  222. #endif
  223. }
  224. private:
  225. int m_nDYNAMIC_LIGHT;
  226. #ifdef _DEBUG
  227. bool m_bDYNAMIC_LIGHT;
  228. #endif
  229. public:
  230. void SetDYNAMIC_LIGHT( int i )
  231. {
  232. Assert( i >= 0 && i <= 1 );
  233. m_nDYNAMIC_LIGHT = i;
  234. #ifdef _DEBUG
  235. m_bDYNAMIC_LIGHT = true;
  236. #endif
  237. }
  238. void SetDYNAMIC_LIGHT( bool i )
  239. {
  240. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  241. m_nDYNAMIC_LIGHT = i ? 1 : 0;
  242. #ifdef _DEBUG
  243. m_bDYNAMIC_LIGHT = true;
  244. #endif
  245. }
  246. private:
  247. int m_nNUM_LIGHTS;
  248. #ifdef _DEBUG
  249. bool m_bNUM_LIGHTS;
  250. #endif
  251. public:
  252. void SetNUM_LIGHTS( int i )
  253. {
  254. Assert( i >= 0 && i <= 4 );
  255. m_nNUM_LIGHTS = i;
  256. #ifdef _DEBUG
  257. m_bNUM_LIGHTS = true;
  258. #endif
  259. }
  260. void SetNUM_LIGHTS( bool i )
  261. {
  262. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 4 );
  263. m_nNUM_LIGHTS = i ? 1 : 0;
  264. #ifdef _DEBUG
  265. m_bNUM_LIGHTS = true;
  266. #endif
  267. }
  268. private:
  269. int m_nTESSELLATION;
  270. #ifdef _DEBUG
  271. bool m_bTESSELLATION;
  272. #endif
  273. public:
  274. void SetTESSELLATION( int i )
  275. {
  276. Assert( i >= 0 && i <= 0 );
  277. m_nTESSELLATION = i;
  278. #ifdef _DEBUG
  279. m_bTESSELLATION = true;
  280. #endif
  281. }
  282. void SetTESSELLATION( bool i )
  283. {
  284. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  285. m_nTESSELLATION = i ? 1 : 0;
  286. #ifdef _DEBUG
  287. m_bTESSELLATION = true;
  288. #endif
  289. }
  290. private:
  291. int m_nMORPHING;
  292. #ifdef _DEBUG
  293. bool m_bMORPHING;
  294. #endif
  295. public:
  296. void SetMORPHING( int i )
  297. {
  298. Assert( i >= 0 && i <= 0 );
  299. m_nMORPHING = i;
  300. #ifdef _DEBUG
  301. m_bMORPHING = true;
  302. #endif
  303. }
  304. void SetMORPHING( bool i )
  305. {
  306. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  307. m_nMORPHING = i ? 1 : 0;
  308. #ifdef _DEBUG
  309. m_bMORPHING = true;
  310. #endif
  311. }
  312. public:
  313. // CONSTRUCTOR
  314. eye_refract_vs20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  315. {
  316. #ifdef _DEBUG
  317. m_bCOMPRESSED_VERTS = false;
  318. #endif // _DEBUG
  319. m_nCOMPRESSED_VERTS = 0;
  320. #ifdef _DEBUG
  321. m_bSKINNING = false;
  322. #endif // _DEBUG
  323. m_nSKINNING = 0;
  324. #ifdef _DEBUG
  325. m_bDOWATERFOG = true;
  326. #endif // _DEBUG
  327. m_nDOWATERFOG = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  328. #ifdef _DEBUG
  329. m_bDYNAMIC_LIGHT = false;
  330. #endif // _DEBUG
  331. m_nDYNAMIC_LIGHT = 0;
  332. #ifdef _DEBUG
  333. m_bNUM_LIGHTS = false;
  334. #endif // _DEBUG
  335. m_nNUM_LIGHTS = 0;
  336. #ifdef _DEBUG
  337. m_bTESSELLATION = false;
  338. #endif // _DEBUG
  339. m_nTESSELLATION = 0;
  340. #ifdef _DEBUG
  341. m_bMORPHING = true;
  342. #endif // _DEBUG
  343. m_nMORPHING = false ;
  344. }
  345. int GetIndex()
  346. {
  347. // Asserts to make sure that we aren't using any skipped combinations.
  348. // Asserts to make sure that we are setting all of the combination vars.
  349. #ifdef _DEBUG
  350. bool bAllDynamicVarsDefined = m_bCOMPRESSED_VERTS && m_bSKINNING && m_bDOWATERFOG && m_bDYNAMIC_LIGHT && m_bNUM_LIGHTS && m_bTESSELLATION && m_bMORPHING;
  351. Assert( bAllDynamicVarsDefined );
  352. #endif // _DEBUG
  353. return ( 1 * m_nCOMPRESSED_VERTS ) + ( 2 * m_nSKINNING ) + ( 4 * m_nDOWATERFOG ) + ( 8 * m_nDYNAMIC_LIGHT ) + ( 16 * m_nNUM_LIGHTS ) + ( 80 * m_nTESSELLATION ) + ( 80 * m_nMORPHING ) + 0;
  354. }
  355. };
  356. #define shaderDynamicTest_eye_refract_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_NUM_LIGHTS + vsh_forgot_to_set_dynamic_TESSELLATION + 0
  357. static const ShaderComboInformation_t s_DynamicComboArray_eye_refract_vs20[7] =
  358. {
  359. { "COMPRESSED_VERTS", 0, 1 },
  360. { "SKINNING", 0, 1 },
  361. { "DOWATERFOG", 0, 1 },
  362. { "DYNAMIC_LIGHT", 0, 1 },
  363. { "NUM_LIGHTS", 0, 4 },
  364. { "TESSELLATION", 0, 0 },
  365. { "MORPHING", 0, 0 },
  366. };
  367. static const ShaderComboInformation_t s_StaticComboArray_eye_refract_vs20[5] =
  368. {
  369. { "HALFLAMBERT", 0, 1 },
  370. { "FLASHLIGHT", 0, 1 },
  371. { "LIGHTWARPTEXTURE", 0, 1 },
  372. { "WORLD_NORMAL", 0, 0 },
  373. { "DOPIXELFOG", 0, 1 },
  374. };
  375. static const ShaderComboSemantics_t eye_refract_vs20_combos =
  376. {
  377. "eye_refract_vs20", s_DynamicComboArray_eye_refract_vs20, 7, s_StaticComboArray_eye_refract_vs20, 5
  378. };
  379. class ConstructMe_eye_refract_vs20
  380. {
  381. public:
  382. ConstructMe_eye_refract_vs20()
  383. {
  384. GetShaderDLL()->AddShaderComboInformation( &eye_refract_vs20_combos );
  385. }
  386. };
  387. static ConstructMe_eye_refract_vs20 s_ConstructMe_eye_refract_vs20;