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.

418 lines
9.2 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. private:
  120. int m_nHARDWAREFOGBLEND;
  121. #ifdef _DEBUG
  122. bool m_bHARDWAREFOGBLEND;
  123. #endif
  124. public:
  125. void SetHARDWAREFOGBLEND( int i )
  126. {
  127. Assert( i >= 0 && i <= 0 );
  128. m_nHARDWAREFOGBLEND = i;
  129. #ifdef _DEBUG
  130. m_bHARDWAREFOGBLEND = true;
  131. #endif
  132. }
  133. void SetHARDWAREFOGBLEND( bool i )
  134. {
  135. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  136. m_nHARDWAREFOGBLEND = i ? 1 : 0;
  137. #ifdef _DEBUG
  138. m_bHARDWAREFOGBLEND = true;
  139. #endif
  140. }
  141. public:
  142. // CONSTRUCTOR
  143. eye_refract_vs20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  144. {
  145. #ifdef _DEBUG
  146. m_bHALFLAMBERT = false;
  147. #endif // _DEBUG
  148. m_nHALFLAMBERT = 0;
  149. #ifdef _DEBUG
  150. m_bFLASHLIGHT = false;
  151. #endif // _DEBUG
  152. m_nFLASHLIGHT = 0;
  153. #ifdef _DEBUG
  154. m_bLIGHTWARPTEXTURE = false;
  155. #endif // _DEBUG
  156. m_nLIGHTWARPTEXTURE = 0;
  157. #ifdef _DEBUG
  158. m_bWORLD_NORMAL = false;
  159. #endif // _DEBUG
  160. m_nWORLD_NORMAL = 0;
  161. #ifdef _DEBUG
  162. m_bDOPIXELFOG = true;
  163. #endif // _DEBUG
  164. m_nDOPIXELFOG = g_pHardwareConfig->SupportsPixelShaders_2_b() ;
  165. #ifdef _DEBUG
  166. m_bHARDWAREFOGBLEND = true;
  167. #endif // _DEBUG
  168. m_nHARDWAREFOGBLEND = 0 ;
  169. }
  170. int GetIndex()
  171. {
  172. // Asserts to make sure that we aren't using any skipped combinations.
  173. // Asserts to make sure that we are setting all of the combination vars.
  174. #ifdef _DEBUG
  175. bool bAllStaticVarsDefined = m_bHALFLAMBERT && m_bFLASHLIGHT && m_bLIGHTWARPTEXTURE && m_bWORLD_NORMAL && m_bDOPIXELFOG && m_bHARDWAREFOGBLEND;
  176. Assert( bAllStaticVarsDefined );
  177. #endif // _DEBUG
  178. return ( 80 * m_nHALFLAMBERT ) + ( 160 * m_nFLASHLIGHT ) + ( 320 * m_nLIGHTWARPTEXTURE ) + ( 640 * m_nWORLD_NORMAL ) + ( 640 * m_nDOPIXELFOG ) + ( 1280 * m_nHARDWAREFOGBLEND ) + 0;
  179. }
  180. };
  181. #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
  182. class eye_refract_vs20_Dynamic_Index
  183. {
  184. private:
  185. int m_nCOMPRESSED_VERTS;
  186. #ifdef _DEBUG
  187. bool m_bCOMPRESSED_VERTS;
  188. #endif
  189. public:
  190. void SetCOMPRESSED_VERTS( int i )
  191. {
  192. Assert( i >= 0 && i <= 1 );
  193. m_nCOMPRESSED_VERTS = i;
  194. #ifdef _DEBUG
  195. m_bCOMPRESSED_VERTS = true;
  196. #endif
  197. }
  198. void SetCOMPRESSED_VERTS( bool i )
  199. {
  200. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  201. m_nCOMPRESSED_VERTS = i ? 1 : 0;
  202. #ifdef _DEBUG
  203. m_bCOMPRESSED_VERTS = true;
  204. #endif
  205. }
  206. private:
  207. int m_nSKINNING;
  208. #ifdef _DEBUG
  209. bool m_bSKINNING;
  210. #endif
  211. public:
  212. void SetSKINNING( int i )
  213. {
  214. Assert( i >= 0 && i <= 1 );
  215. m_nSKINNING = i;
  216. #ifdef _DEBUG
  217. m_bSKINNING = true;
  218. #endif
  219. }
  220. void SetSKINNING( bool i )
  221. {
  222. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  223. m_nSKINNING = i ? 1 : 0;
  224. #ifdef _DEBUG
  225. m_bSKINNING = true;
  226. #endif
  227. }
  228. private:
  229. int m_nDOWATERFOG;
  230. #ifdef _DEBUG
  231. bool m_bDOWATERFOG;
  232. #endif
  233. public:
  234. void SetDOWATERFOG( int i )
  235. {
  236. Assert( i >= 0 && i <= 1 );
  237. m_nDOWATERFOG = i;
  238. #ifdef _DEBUG
  239. m_bDOWATERFOG = true;
  240. #endif
  241. }
  242. void SetDOWATERFOG( bool i )
  243. {
  244. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  245. m_nDOWATERFOG = i ? 1 : 0;
  246. #ifdef _DEBUG
  247. m_bDOWATERFOG = true;
  248. #endif
  249. }
  250. private:
  251. int m_nDYNAMIC_LIGHT;
  252. #ifdef _DEBUG
  253. bool m_bDYNAMIC_LIGHT;
  254. #endif
  255. public:
  256. void SetDYNAMIC_LIGHT( int i )
  257. {
  258. Assert( i >= 0 && i <= 1 );
  259. m_nDYNAMIC_LIGHT = i;
  260. #ifdef _DEBUG
  261. m_bDYNAMIC_LIGHT = true;
  262. #endif
  263. }
  264. void SetDYNAMIC_LIGHT( bool i )
  265. {
  266. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  267. m_nDYNAMIC_LIGHT = i ? 1 : 0;
  268. #ifdef _DEBUG
  269. m_bDYNAMIC_LIGHT = true;
  270. #endif
  271. }
  272. private:
  273. int m_nNUM_LIGHTS;
  274. #ifdef _DEBUG
  275. bool m_bNUM_LIGHTS;
  276. #endif
  277. public:
  278. void SetNUM_LIGHTS( int i )
  279. {
  280. Assert( i >= 0 && i <= 4 );
  281. m_nNUM_LIGHTS = i;
  282. #ifdef _DEBUG
  283. m_bNUM_LIGHTS = true;
  284. #endif
  285. }
  286. void SetNUM_LIGHTS( bool i )
  287. {
  288. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 4 );
  289. m_nNUM_LIGHTS = i ? 1 : 0;
  290. #ifdef _DEBUG
  291. m_bNUM_LIGHTS = true;
  292. #endif
  293. }
  294. private:
  295. int m_nTESSELLATION;
  296. #ifdef _DEBUG
  297. bool m_bTESSELLATION;
  298. #endif
  299. public:
  300. void SetTESSELLATION( int i )
  301. {
  302. Assert( i >= 0 && i <= 0 );
  303. m_nTESSELLATION = i;
  304. #ifdef _DEBUG
  305. m_bTESSELLATION = true;
  306. #endif
  307. }
  308. void SetTESSELLATION( bool i )
  309. {
  310. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  311. m_nTESSELLATION = i ? 1 : 0;
  312. #ifdef _DEBUG
  313. m_bTESSELLATION = true;
  314. #endif
  315. }
  316. private:
  317. int m_nMORPHING;
  318. #ifdef _DEBUG
  319. bool m_bMORPHING;
  320. #endif
  321. public:
  322. void SetMORPHING( int i )
  323. {
  324. Assert( i >= 0 && i <= 0 );
  325. m_nMORPHING = i;
  326. #ifdef _DEBUG
  327. m_bMORPHING = true;
  328. #endif
  329. }
  330. void SetMORPHING( bool i )
  331. {
  332. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  333. m_nMORPHING = i ? 1 : 0;
  334. #ifdef _DEBUG
  335. m_bMORPHING = true;
  336. #endif
  337. }
  338. public:
  339. // CONSTRUCTOR
  340. eye_refract_vs20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  341. {
  342. #ifdef _DEBUG
  343. m_bCOMPRESSED_VERTS = false;
  344. #endif // _DEBUG
  345. m_nCOMPRESSED_VERTS = 0;
  346. #ifdef _DEBUG
  347. m_bSKINNING = false;
  348. #endif // _DEBUG
  349. m_nSKINNING = 0;
  350. #ifdef _DEBUG
  351. m_bDOWATERFOG = true;
  352. #endif // _DEBUG
  353. m_nDOWATERFOG = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  354. #ifdef _DEBUG
  355. m_bDYNAMIC_LIGHT = false;
  356. #endif // _DEBUG
  357. m_nDYNAMIC_LIGHT = 0;
  358. #ifdef _DEBUG
  359. m_bNUM_LIGHTS = false;
  360. #endif // _DEBUG
  361. m_nNUM_LIGHTS = 0;
  362. #ifdef _DEBUG
  363. m_bTESSELLATION = false;
  364. #endif // _DEBUG
  365. m_nTESSELLATION = 0;
  366. #ifdef _DEBUG
  367. m_bMORPHING = true;
  368. #endif // _DEBUG
  369. m_nMORPHING = false ;
  370. }
  371. int GetIndex()
  372. {
  373. // Asserts to make sure that we aren't using any skipped combinations.
  374. // Asserts to make sure that we are setting all of the combination vars.
  375. #ifdef _DEBUG
  376. bool bAllDynamicVarsDefined = m_bCOMPRESSED_VERTS && m_bSKINNING && m_bDOWATERFOG && m_bDYNAMIC_LIGHT && m_bNUM_LIGHTS && m_bTESSELLATION && m_bMORPHING;
  377. Assert( bAllDynamicVarsDefined );
  378. #endif // _DEBUG
  379. 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;
  380. }
  381. };
  382. #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
  383. static const ShaderComboInformation_t s_DynamicComboArray_eye_refract_vs20[7] =
  384. {
  385. { "COMPRESSED_VERTS", 0, 1 },
  386. { "SKINNING", 0, 1 },
  387. { "DOWATERFOG", 0, 1 },
  388. { "DYNAMIC_LIGHT", 0, 1 },
  389. { "NUM_LIGHTS", 0, 4 },
  390. { "TESSELLATION", 0, 0 },
  391. { "MORPHING", 0, 0 },
  392. };
  393. static const ShaderComboInformation_t s_StaticComboArray_eye_refract_vs20[6] =
  394. {
  395. { "HALFLAMBERT", 0, 1 },
  396. { "FLASHLIGHT", 0, 1 },
  397. { "LIGHTWARPTEXTURE", 0, 1 },
  398. { "WORLD_NORMAL", 0, 0 },
  399. { "DOPIXELFOG", 0, 1 },
  400. { "HARDWAREFOGBLEND", 0, 0 },
  401. };
  402. static const ShaderComboSemantics_t eye_refract_vs20_combos =
  403. {
  404. "eye_refract_vs20", s_DynamicComboArray_eye_refract_vs20, 7, s_StaticComboArray_eye_refract_vs20, 6
  405. };
  406. class ConstructMe_eye_refract_vs20
  407. {
  408. public:
  409. ConstructMe_eye_refract_vs20()
  410. {
  411. GetShaderDLL()->AddShaderComboInformation( &eye_refract_vs20_combos );
  412. }
  413. };
  414. static ConstructMe_eye_refract_vs20 s_ConstructMe_eye_refract_vs20;