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.

371 lines
8.8 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_ps20_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 <= 1 );
  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 ) <= 1 );
  209. m_nMIRRORABOUTVIEWPORTEDGES = i ? 1 : 0;
  210. #ifdef _DEBUG
  211. m_bMIRRORABOUTVIEWPORTEDGES = true;
  212. #endif
  213. }
  214. private:
  215. int m_nLOCALREFRACT;
  216. #ifdef _DEBUG
  217. bool m_bLOCALREFRACT;
  218. #endif
  219. public:
  220. void SetLOCALREFRACT( int i )
  221. {
  222. Assert( i >= 0 && i <= 1 );
  223. m_nLOCALREFRACT = i;
  224. #ifdef _DEBUG
  225. m_bLOCALREFRACT = true;
  226. #endif
  227. }
  228. void SetLOCALREFRACT( bool i )
  229. {
  230. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  231. m_nLOCALREFRACT = i ? 1 : 0;
  232. #ifdef _DEBUG
  233. m_bLOCALREFRACT = true;
  234. #endif
  235. }
  236. public:
  237. // CONSTRUCTOR
  238. refract_ps20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  239. {
  240. #ifdef _DEBUG
  241. m_bMAGNIFY = false;
  242. #endif // _DEBUG
  243. m_nMAGNIFY = 0;
  244. #ifdef _DEBUG
  245. m_bBLUR = false;
  246. #endif // _DEBUG
  247. m_nBLUR = 0;
  248. #ifdef _DEBUG
  249. m_bFADEOUTONSILHOUETTE = false;
  250. #endif // _DEBUG
  251. m_nFADEOUTONSILHOUETTE = 0;
  252. #ifdef _DEBUG
  253. m_bCUBEMAP = false;
  254. #endif // _DEBUG
  255. m_nCUBEMAP = 0;
  256. #ifdef _DEBUG
  257. m_bREFRACTTINTTEXTURE = false;
  258. #endif // _DEBUG
  259. m_nREFRACTTINTTEXTURE = 0;
  260. #ifdef _DEBUG
  261. m_bMASKED = false;
  262. #endif // _DEBUG
  263. m_nMASKED = 0;
  264. #ifdef _DEBUG
  265. m_bCOLORMODULATE = false;
  266. #endif // _DEBUG
  267. m_nCOLORMODULATE = 0;
  268. #ifdef _DEBUG
  269. m_bSECONDARY_NORMAL = false;
  270. #endif // _DEBUG
  271. m_nSECONDARY_NORMAL = 0;
  272. #ifdef _DEBUG
  273. m_bMIRRORABOUTVIEWPORTEDGES = false;
  274. #endif // _DEBUG
  275. m_nMIRRORABOUTVIEWPORTEDGES = 0;
  276. #ifdef _DEBUG
  277. m_bLOCALREFRACT = false;
  278. #endif // _DEBUG
  279. m_nLOCALREFRACT = 0;
  280. }
  281. int GetIndex()
  282. {
  283. // Asserts to make sure that we aren't using any skipped combinations.
  284. // Asserts to make sure that we are setting all of the combination vars.
  285. #ifdef _DEBUG
  286. bool bAllStaticVarsDefined = m_bMAGNIFY && m_bBLUR && m_bFADEOUTONSILHOUETTE && m_bCUBEMAP && m_bREFRACTTINTTEXTURE && m_bMASKED && m_bCOLORMODULATE && m_bSECONDARY_NORMAL && m_bMIRRORABOUTVIEWPORTEDGES && m_bLOCALREFRACT;
  287. Assert( bAllStaticVarsDefined );
  288. #endif // _DEBUG
  289. return ( 2 * m_nMAGNIFY ) + ( 4 * m_nBLUR ) + ( 8 * m_nFADEOUTONSILHOUETTE ) + ( 16 * m_nCUBEMAP ) + ( 32 * m_nREFRACTTINTTEXTURE ) + ( 64 * m_nMASKED ) + ( 128 * m_nCOLORMODULATE ) + ( 256 * m_nSECONDARY_NORMAL ) + ( 512 * m_nMIRRORABOUTVIEWPORTEDGES ) + ( 1024 * m_nLOCALREFRACT ) + 0;
  290. }
  291. };
  292. #define shaderStaticTest_refract_ps20 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_LOCALREFRACT + 0
  293. class refract_ps20_Dynamic_Index
  294. {
  295. private:
  296. int m_nPIXELFOGTYPE;
  297. #ifdef _DEBUG
  298. bool m_bPIXELFOGTYPE;
  299. #endif
  300. public:
  301. void SetPIXELFOGTYPE( int i )
  302. {
  303. Assert( i >= 0 && i <= 1 );
  304. m_nPIXELFOGTYPE = i;
  305. #ifdef _DEBUG
  306. m_bPIXELFOGTYPE = true;
  307. #endif
  308. }
  309. void SetPIXELFOGTYPE( bool i )
  310. {
  311. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  312. m_nPIXELFOGTYPE = i ? 1 : 0;
  313. #ifdef _DEBUG
  314. m_bPIXELFOGTYPE = true;
  315. #endif
  316. }
  317. public:
  318. // CONSTRUCTOR
  319. refract_ps20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  320. {
  321. #ifdef _DEBUG
  322. m_bPIXELFOGTYPE = true;
  323. #endif // _DEBUG
  324. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  325. }
  326. int GetIndex()
  327. {
  328. // Asserts to make sure that we aren't using any skipped combinations.
  329. // Asserts to make sure that we are setting all of the combination vars.
  330. #ifdef _DEBUG
  331. bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE;
  332. Assert( bAllDynamicVarsDefined );
  333. #endif // _DEBUG
  334. return ( 1 * m_nPIXELFOGTYPE ) + 0;
  335. }
  336. };
  337. #define shaderDynamicTest_refract_ps20 0
  338. static const ShaderComboInformation_t s_DynamicComboArray_refract_ps20[1] =
  339. {
  340. { "PIXELFOGTYPE", 0, 1 },
  341. };
  342. static const ShaderComboInformation_t s_StaticComboArray_refract_ps20[10] =
  343. {
  344. { "MAGNIFY", 0, 1 },
  345. { "BLUR", 0, 1 },
  346. { "FADEOUTONSILHOUETTE", 0, 1 },
  347. { "CUBEMAP", 0, 1 },
  348. { "REFRACTTINTTEXTURE", 0, 1 },
  349. { "MASKED", 0, 1 },
  350. { "COLORMODULATE", 0, 1 },
  351. { "SECONDARY_NORMAL", 0, 1 },
  352. { "MIRRORABOUTVIEWPORTEDGES", 0, 1 },
  353. { "LOCALREFRACT", 0, 1 },
  354. };
  355. static const ShaderComboSemantics_t refract_ps20_combos =
  356. {
  357. "refract_ps20", s_DynamicComboArray_refract_ps20, 1, s_StaticComboArray_refract_ps20, 10
  358. };
  359. class ConstructMe_refract_ps20
  360. {
  361. public:
  362. ConstructMe_refract_ps20()
  363. {
  364. GetShaderDLL()->AddShaderComboInformation( &refract_ps20_combos );
  365. }
  366. };
  367. static ConstructMe_refract_ps20 s_ConstructMe_refract_ps20;