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.

452 lines
11 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // $MASKED && $BLUR
  3. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  4. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  5. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  6. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  7. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  8. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  9. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  10. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  11. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  12. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  13. #include "shaderlib/cshader.h"
  14. class refract_ps20b_Static_Index
  15. {
  16. private:
  17. int m_nMAGNIFY;
  18. #ifdef _DEBUG
  19. bool m_bMAGNIFY;
  20. #endif
  21. public:
  22. void SetMAGNIFY( int i )
  23. {
  24. Assert( i >= 0 && i <= 1 );
  25. m_nMAGNIFY = i;
  26. #ifdef _DEBUG
  27. m_bMAGNIFY = true;
  28. #endif
  29. }
  30. void SetMAGNIFY( bool i )
  31. {
  32. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  33. m_nMAGNIFY = i ? 1 : 0;
  34. #ifdef _DEBUG
  35. m_bMAGNIFY = true;
  36. #endif
  37. }
  38. private:
  39. int m_nBLUR;
  40. #ifdef _DEBUG
  41. bool m_bBLUR;
  42. #endif
  43. public:
  44. void SetBLUR( int i )
  45. {
  46. Assert( i >= 0 && i <= 1 );
  47. m_nBLUR = i;
  48. #ifdef _DEBUG
  49. m_bBLUR = true;
  50. #endif
  51. }
  52. void SetBLUR( bool i )
  53. {
  54. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  55. m_nBLUR = i ? 1 : 0;
  56. #ifdef _DEBUG
  57. m_bBLUR = true;
  58. #endif
  59. }
  60. private:
  61. int m_nFADEOUTONSILHOUETTE;
  62. #ifdef _DEBUG
  63. bool m_bFADEOUTONSILHOUETTE;
  64. #endif
  65. public:
  66. void SetFADEOUTONSILHOUETTE( int i )
  67. {
  68. Assert( i >= 0 && i <= 1 );
  69. m_nFADEOUTONSILHOUETTE = i;
  70. #ifdef _DEBUG
  71. m_bFADEOUTONSILHOUETTE = true;
  72. #endif
  73. }
  74. void SetFADEOUTONSILHOUETTE( bool i )
  75. {
  76. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  77. m_nFADEOUTONSILHOUETTE = i ? 1 : 0;
  78. #ifdef _DEBUG
  79. m_bFADEOUTONSILHOUETTE = true;
  80. #endif
  81. }
  82. private:
  83. int m_nCUBEMAP;
  84. #ifdef _DEBUG
  85. bool m_bCUBEMAP;
  86. #endif
  87. public:
  88. void SetCUBEMAP( int i )
  89. {
  90. Assert( i >= 0 && i <= 1 );
  91. m_nCUBEMAP = i;
  92. #ifdef _DEBUG
  93. m_bCUBEMAP = true;
  94. #endif
  95. }
  96. void SetCUBEMAP( bool i )
  97. {
  98. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  99. m_nCUBEMAP = i ? 1 : 0;
  100. #ifdef _DEBUG
  101. m_bCUBEMAP = true;
  102. #endif
  103. }
  104. private:
  105. int m_nREFRACTTINTTEXTURE;
  106. #ifdef _DEBUG
  107. bool m_bREFRACTTINTTEXTURE;
  108. #endif
  109. public:
  110. void SetREFRACTTINTTEXTURE( int i )
  111. {
  112. Assert( i >= 0 && i <= 1 );
  113. m_nREFRACTTINTTEXTURE = i;
  114. #ifdef _DEBUG
  115. m_bREFRACTTINTTEXTURE = true;
  116. #endif
  117. }
  118. void SetREFRACTTINTTEXTURE( bool i )
  119. {
  120. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  121. m_nREFRACTTINTTEXTURE = i ? 1 : 0;
  122. #ifdef _DEBUG
  123. m_bREFRACTTINTTEXTURE = true;
  124. #endif
  125. }
  126. private:
  127. int m_nMASKED;
  128. #ifdef _DEBUG
  129. bool m_bMASKED;
  130. #endif
  131. public:
  132. void SetMASKED( int i )
  133. {
  134. Assert( i >= 0 && i <= 1 );
  135. m_nMASKED = i;
  136. #ifdef _DEBUG
  137. m_bMASKED = true;
  138. #endif
  139. }
  140. void SetMASKED( bool i )
  141. {
  142. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  143. m_nMASKED = i ? 1 : 0;
  144. #ifdef _DEBUG
  145. m_bMASKED = true;
  146. #endif
  147. }
  148. private:
  149. int m_nCOLORMODULATE;
  150. #ifdef _DEBUG
  151. bool m_bCOLORMODULATE;
  152. #endif
  153. public:
  154. void SetCOLORMODULATE( int i )
  155. {
  156. Assert( i >= 0 && i <= 1 );
  157. m_nCOLORMODULATE = i;
  158. #ifdef _DEBUG
  159. m_bCOLORMODULATE = true;
  160. #endif
  161. }
  162. void SetCOLORMODULATE( bool i )
  163. {
  164. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  165. m_nCOLORMODULATE = i ? 1 : 0;
  166. #ifdef _DEBUG
  167. m_bCOLORMODULATE = true;
  168. #endif
  169. }
  170. private:
  171. int m_nSECONDARY_NORMAL;
  172. #ifdef _DEBUG
  173. bool m_bSECONDARY_NORMAL;
  174. #endif
  175. public:
  176. void SetSECONDARY_NORMAL( int i )
  177. {
  178. Assert( i >= 0 && i <= 1 );
  179. m_nSECONDARY_NORMAL = i;
  180. #ifdef _DEBUG
  181. m_bSECONDARY_NORMAL = true;
  182. #endif
  183. }
  184. void SetSECONDARY_NORMAL( bool i )
  185. {
  186. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  187. m_nSECONDARY_NORMAL = i ? 1 : 0;
  188. #ifdef _DEBUG
  189. m_bSECONDARY_NORMAL = true;
  190. #endif
  191. }
  192. private:
  193. int m_nMIRRORABOUTVIEWPORTEDGES;
  194. #ifdef _DEBUG
  195. bool m_bMIRRORABOUTVIEWPORTEDGES;
  196. #endif
  197. public:
  198. void SetMIRRORABOUTVIEWPORTEDGES( int i )
  199. {
  200. Assert( i >= 0 && i <= 0 );
  201. m_nMIRRORABOUTVIEWPORTEDGES = i;
  202. #ifdef _DEBUG
  203. m_bMIRRORABOUTVIEWPORTEDGES = true;
  204. #endif
  205. }
  206. void SetMIRRORABOUTVIEWPORTEDGES( bool i )
  207. {
  208. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  209. m_nMIRRORABOUTVIEWPORTEDGES = i ? 1 : 0;
  210. #ifdef _DEBUG
  211. m_bMIRRORABOUTVIEWPORTEDGES = true;
  212. #endif
  213. }
  214. private:
  215. int m_nSHADER_SRGB_READ;
  216. #ifdef _DEBUG
  217. bool m_bSHADER_SRGB_READ;
  218. #endif
  219. public:
  220. void SetSHADER_SRGB_READ( int i )
  221. {
  222. Assert( i >= 0 && i <= 1 );
  223. m_nSHADER_SRGB_READ = i;
  224. #ifdef _DEBUG
  225. m_bSHADER_SRGB_READ = true;
  226. #endif
  227. }
  228. void SetSHADER_SRGB_READ( bool i )
  229. {
  230. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  231. m_nSHADER_SRGB_READ = i ? 1 : 0;
  232. #ifdef _DEBUG
  233. m_bSHADER_SRGB_READ = true;
  234. #endif
  235. }
  236. private:
  237. int m_nLOCALREFRACT;
  238. #ifdef _DEBUG
  239. bool m_bLOCALREFRACT;
  240. #endif
  241. public:
  242. void SetLOCALREFRACT( int i )
  243. {
  244. Assert( i >= 0 && i <= 1 );
  245. m_nLOCALREFRACT = i;
  246. #ifdef _DEBUG
  247. m_bLOCALREFRACT = true;
  248. #endif
  249. }
  250. void SetLOCALREFRACT( bool i )
  251. {
  252. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  253. m_nLOCALREFRACT = i ? 1 : 0;
  254. #ifdef _DEBUG
  255. m_bLOCALREFRACT = true;
  256. #endif
  257. }
  258. public:
  259. // CONSTRUCTOR
  260. refract_ps20b_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  261. {
  262. #ifdef _DEBUG
  263. m_bMAGNIFY = false;
  264. #endif // _DEBUG
  265. m_nMAGNIFY = 0;
  266. #ifdef _DEBUG
  267. m_bBLUR = false;
  268. #endif // _DEBUG
  269. m_nBLUR = 0;
  270. #ifdef _DEBUG
  271. m_bFADEOUTONSILHOUETTE = false;
  272. #endif // _DEBUG
  273. m_nFADEOUTONSILHOUETTE = 0;
  274. #ifdef _DEBUG
  275. m_bCUBEMAP = false;
  276. #endif // _DEBUG
  277. m_nCUBEMAP = 0;
  278. #ifdef _DEBUG
  279. m_bREFRACTTINTTEXTURE = false;
  280. #endif // _DEBUG
  281. m_nREFRACTTINTTEXTURE = 0;
  282. #ifdef _DEBUG
  283. m_bMASKED = false;
  284. #endif // _DEBUG
  285. m_nMASKED = 0;
  286. #ifdef _DEBUG
  287. m_bCOLORMODULATE = false;
  288. #endif // _DEBUG
  289. m_nCOLORMODULATE = 0;
  290. #ifdef _DEBUG
  291. m_bSECONDARY_NORMAL = false;
  292. #endif // _DEBUG
  293. m_nSECONDARY_NORMAL = 0;
  294. #ifdef _DEBUG
  295. m_bMIRRORABOUTVIEWPORTEDGES = false;
  296. #endif // _DEBUG
  297. m_nMIRRORABOUTVIEWPORTEDGES = 0;
  298. #ifdef _DEBUG
  299. m_bSHADER_SRGB_READ = false;
  300. #endif // _DEBUG
  301. m_nSHADER_SRGB_READ = 0;
  302. #ifdef _DEBUG
  303. m_bLOCALREFRACT = false;
  304. #endif // _DEBUG
  305. m_nLOCALREFRACT = 0;
  306. }
  307. int GetIndex()
  308. {
  309. // Asserts to make sure that we aren't using any skipped combinations.
  310. // Asserts to make sure that we are setting all of the combination vars.
  311. #ifdef _DEBUG
  312. bool bAllStaticVarsDefined = m_bMAGNIFY && m_bBLUR && m_bFADEOUTONSILHOUETTE && m_bCUBEMAP && m_bREFRACTTINTTEXTURE && m_bMASKED && m_bCOLORMODULATE && m_bSECONDARY_NORMAL && m_bMIRRORABOUTVIEWPORTEDGES && m_bSHADER_SRGB_READ && m_bLOCALREFRACT;
  313. Assert( bAllStaticVarsDefined );
  314. #endif // _DEBUG
  315. return ( 8 * m_nMAGNIFY ) + ( 16 * m_nBLUR ) + ( 32 * m_nFADEOUTONSILHOUETTE ) + ( 64 * m_nCUBEMAP ) + ( 128 * m_nREFRACTTINTTEXTURE ) + ( 256 * m_nMASKED ) + ( 512 * m_nCOLORMODULATE ) + ( 1024 * m_nSECONDARY_NORMAL ) + ( 2048 * m_nMIRRORABOUTVIEWPORTEDGES ) + ( 2048 * m_nSHADER_SRGB_READ ) + ( 4096 * m_nLOCALREFRACT ) + 0;
  316. }
  317. };
  318. #define shaderStaticTest_refract_ps20b psh_forgot_to_set_static_MAGNIFY + psh_forgot_to_set_static_BLUR + psh_forgot_to_set_static_FADEOUTONSILHOUETTE + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_REFRACTTINTTEXTURE + psh_forgot_to_set_static_MASKED + psh_forgot_to_set_static_COLORMODULATE + psh_forgot_to_set_static_SECONDARY_NORMAL + psh_forgot_to_set_static_MIRRORABOUTVIEWPORTEDGES + psh_forgot_to_set_static_SHADER_SRGB_READ + psh_forgot_to_set_static_LOCALREFRACT + 0
  319. class refract_ps20b_Dynamic_Index
  320. {
  321. private:
  322. int m_nPIXELFOGTYPE;
  323. #ifdef _DEBUG
  324. bool m_bPIXELFOGTYPE;
  325. #endif
  326. public:
  327. void SetPIXELFOGTYPE( int i )
  328. {
  329. Assert( i >= 0 && i <= 1 );
  330. m_nPIXELFOGTYPE = i;
  331. #ifdef _DEBUG
  332. m_bPIXELFOGTYPE = true;
  333. #endif
  334. }
  335. void SetPIXELFOGTYPE( bool i )
  336. {
  337. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  338. m_nPIXELFOGTYPE = i ? 1 : 0;
  339. #ifdef _DEBUG
  340. m_bPIXELFOGTYPE = true;
  341. #endif
  342. }
  343. private:
  344. int m_nWRITE_DEPTH_TO_DESTALPHA;
  345. #ifdef _DEBUG
  346. bool m_bWRITE_DEPTH_TO_DESTALPHA;
  347. #endif
  348. public:
  349. void SetWRITE_DEPTH_TO_DESTALPHA( int i )
  350. {
  351. Assert( i >= 0 && i <= 1 );
  352. m_nWRITE_DEPTH_TO_DESTALPHA = i;
  353. #ifdef _DEBUG
  354. m_bWRITE_DEPTH_TO_DESTALPHA = true;
  355. #endif
  356. }
  357. void SetWRITE_DEPTH_TO_DESTALPHA( bool i )
  358. {
  359. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  360. m_nWRITE_DEPTH_TO_DESTALPHA = i ? 1 : 0;
  361. #ifdef _DEBUG
  362. m_bWRITE_DEPTH_TO_DESTALPHA = true;
  363. #endif
  364. }
  365. private:
  366. int m_nD_NVIDIA_STEREO;
  367. #ifdef _DEBUG
  368. bool m_bD_NVIDIA_STEREO;
  369. #endif
  370. public:
  371. void SetD_NVIDIA_STEREO( int i )
  372. {
  373. Assert( i >= 0 && i <= 1 );
  374. m_nD_NVIDIA_STEREO = i;
  375. #ifdef _DEBUG
  376. m_bD_NVIDIA_STEREO = true;
  377. #endif
  378. }
  379. void SetD_NVIDIA_STEREO( bool i )
  380. {
  381. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  382. m_nD_NVIDIA_STEREO = i ? 1 : 0;
  383. #ifdef _DEBUG
  384. m_bD_NVIDIA_STEREO = true;
  385. #endif
  386. }
  387. public:
  388. // CONSTRUCTOR
  389. refract_ps20b_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  390. {
  391. #ifdef _DEBUG
  392. m_bPIXELFOGTYPE = true;
  393. #endif // _DEBUG
  394. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  395. #ifdef _DEBUG
  396. m_bWRITE_DEPTH_TO_DESTALPHA = false;
  397. #endif // _DEBUG
  398. m_nWRITE_DEPTH_TO_DESTALPHA = 0;
  399. #ifdef _DEBUG
  400. m_bD_NVIDIA_STEREO = false;
  401. #endif // _DEBUG
  402. m_nD_NVIDIA_STEREO = 0;
  403. }
  404. int GetIndex()
  405. {
  406. // Asserts to make sure that we aren't using any skipped combinations.
  407. // Asserts to make sure that we are setting all of the combination vars.
  408. #ifdef _DEBUG
  409. bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE && m_bWRITE_DEPTH_TO_DESTALPHA && m_bD_NVIDIA_STEREO;
  410. Assert( bAllDynamicVarsDefined );
  411. #endif // _DEBUG
  412. return ( 1 * m_nPIXELFOGTYPE ) + ( 2 * m_nWRITE_DEPTH_TO_DESTALPHA ) + ( 4 * m_nD_NVIDIA_STEREO ) + 0;
  413. }
  414. };
  415. #define shaderDynamicTest_refract_ps20b psh_forgot_to_set_dynamic_WRITE_DEPTH_TO_DESTALPHA + psh_forgot_to_set_dynamic_D_NVIDIA_STEREO + 0
  416. static const ShaderComboInformation_t s_DynamicComboArray_refract_ps20b[3] =
  417. {
  418. { "PIXELFOGTYPE", 0, 1 },
  419. { "WRITE_DEPTH_TO_DESTALPHA", 0, 1 },
  420. { "D_NVIDIA_STEREO", 0, 1 },
  421. };
  422. static const ShaderComboInformation_t s_StaticComboArray_refract_ps20b[11] =
  423. {
  424. { "MAGNIFY", 0, 1 },
  425. { "BLUR", 0, 1 },
  426. { "FADEOUTONSILHOUETTE", 0, 1 },
  427. { "CUBEMAP", 0, 1 },
  428. { "REFRACTTINTTEXTURE", 0, 1 },
  429. { "MASKED", 0, 1 },
  430. { "COLORMODULATE", 0, 1 },
  431. { "SECONDARY_NORMAL", 0, 1 },
  432. { "MIRRORABOUTVIEWPORTEDGES", 0, 0 },
  433. { "SHADER_SRGB_READ", 0, 1 },
  434. { "LOCALREFRACT", 0, 1 },
  435. };
  436. static const ShaderComboSemantics_t refract_ps20b_combos =
  437. {
  438. "refract_ps20b", s_DynamicComboArray_refract_ps20b, 3, s_StaticComboArray_refract_ps20b, 11
  439. };
  440. class ConstructMe_refract_ps20b
  441. {
  442. public:
  443. ConstructMe_refract_ps20b()
  444. {
  445. GetShaderDLL()->AddShaderComboInformation( &refract_ps20b_combos );
  446. }
  447. };
  448. static ConstructMe_refract_ps20b s_ConstructMe_refract_ps20b;