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.

348 lines
8.8 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $FLASHLIGHT != 0 ) && ( $NUM_LIGHTS > 0 )
  3. // ( $FLASHLIGHT == 0 ) && ( $FLASHLIGHTSHADOWS == 1 )
  4. // ( $RAYTRACESPHERE == 0 ) && ( $SPHERETEXKILLCOMBO == 1 )
  5. // ( $WORLD_NORMAL ) && ( $FLASHLIGHTSHADOWS != 0 ) && ( $NUM_LIGHTS != 0 )
  6. // ( $FLASHLIGHT == 0 ) && ( $UBERLIGHT == 1 )
  7. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  8. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  9. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  10. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  11. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  12. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  13. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  14. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  15. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  16. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  17. #include "shaderlib/cshader.h"
  18. class eye_refract_ps30_Static_Index
  19. {
  20. private:
  21. int m_nFLASHLIGHT;
  22. #ifdef _DEBUG
  23. bool m_bFLASHLIGHT;
  24. #endif
  25. public:
  26. void SetFLASHLIGHT( int i )
  27. {
  28. Assert( i >= 0 && i <= 1 );
  29. m_nFLASHLIGHT = i;
  30. #ifdef _DEBUG
  31. m_bFLASHLIGHT = true;
  32. #endif
  33. }
  34. void SetFLASHLIGHT( bool i )
  35. {
  36. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  37. m_nFLASHLIGHT = i ? 1 : 0;
  38. #ifdef _DEBUG
  39. m_bFLASHLIGHT = true;
  40. #endif
  41. }
  42. private:
  43. int m_nLIGHTWARPTEXTURE;
  44. #ifdef _DEBUG
  45. bool m_bLIGHTWARPTEXTURE;
  46. #endif
  47. public:
  48. void SetLIGHTWARPTEXTURE( int i )
  49. {
  50. Assert( i >= 0 && i <= 1 );
  51. m_nLIGHTWARPTEXTURE = i;
  52. #ifdef _DEBUG
  53. m_bLIGHTWARPTEXTURE = true;
  54. #endif
  55. }
  56. void SetLIGHTWARPTEXTURE( bool i )
  57. {
  58. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  59. m_nLIGHTWARPTEXTURE = i ? 1 : 0;
  60. #ifdef _DEBUG
  61. m_bLIGHTWARPTEXTURE = true;
  62. #endif
  63. }
  64. private:
  65. int m_nSPHERETEXKILLCOMBO;
  66. #ifdef _DEBUG
  67. bool m_bSPHERETEXKILLCOMBO;
  68. #endif
  69. public:
  70. void SetSPHERETEXKILLCOMBO( int i )
  71. {
  72. Assert( i >= 0 && i <= 1 );
  73. m_nSPHERETEXKILLCOMBO = i;
  74. #ifdef _DEBUG
  75. m_bSPHERETEXKILLCOMBO = true;
  76. #endif
  77. }
  78. void SetSPHERETEXKILLCOMBO( bool i )
  79. {
  80. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  81. m_nSPHERETEXKILLCOMBO = i ? 1 : 0;
  82. #ifdef _DEBUG
  83. m_bSPHERETEXKILLCOMBO = true;
  84. #endif
  85. }
  86. private:
  87. int m_nRAYTRACESPHERE;
  88. #ifdef _DEBUG
  89. bool m_bRAYTRACESPHERE;
  90. #endif
  91. public:
  92. void SetRAYTRACESPHERE( int i )
  93. {
  94. Assert( i >= 0 && i <= 1 );
  95. m_nRAYTRACESPHERE = i;
  96. #ifdef _DEBUG
  97. m_bRAYTRACESPHERE = true;
  98. #endif
  99. }
  100. void SetRAYTRACESPHERE( bool i )
  101. {
  102. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  103. m_nRAYTRACESPHERE = i ? 1 : 0;
  104. #ifdef _DEBUG
  105. m_bRAYTRACESPHERE = true;
  106. #endif
  107. }
  108. private:
  109. int m_nFLASHLIGHTDEPTHFILTERMODE;
  110. #ifdef _DEBUG
  111. bool m_bFLASHLIGHTDEPTHFILTERMODE;
  112. #endif
  113. public:
  114. void SetFLASHLIGHTDEPTHFILTERMODE( int i )
  115. {
  116. Assert( i >= 0 && i <= 2 );
  117. m_nFLASHLIGHTDEPTHFILTERMODE = i;
  118. #ifdef _DEBUG
  119. m_bFLASHLIGHTDEPTHFILTERMODE = true;
  120. #endif
  121. }
  122. void SetFLASHLIGHTDEPTHFILTERMODE( bool i )
  123. {
  124. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  125. m_nFLASHLIGHTDEPTHFILTERMODE = i ? 1 : 0;
  126. #ifdef _DEBUG
  127. m_bFLASHLIGHTDEPTHFILTERMODE = true;
  128. #endif
  129. }
  130. private:
  131. int m_nWORLD_NORMAL;
  132. #ifdef _DEBUG
  133. bool m_bWORLD_NORMAL;
  134. #endif
  135. public:
  136. void SetWORLD_NORMAL( int i )
  137. {
  138. Assert( i >= 0 && i <= 1 );
  139. m_nWORLD_NORMAL = i;
  140. #ifdef _DEBUG
  141. m_bWORLD_NORMAL = true;
  142. #endif
  143. }
  144. void SetWORLD_NORMAL( bool i )
  145. {
  146. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  147. m_nWORLD_NORMAL = i ? 1 : 0;
  148. #ifdef _DEBUG
  149. m_bWORLD_NORMAL = true;
  150. #endif
  151. }
  152. public:
  153. // CONSTRUCTOR
  154. eye_refract_ps30_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  155. {
  156. #ifdef _DEBUG
  157. m_bFLASHLIGHT = false;
  158. #endif // _DEBUG
  159. m_nFLASHLIGHT = 0;
  160. #ifdef _DEBUG
  161. m_bLIGHTWARPTEXTURE = false;
  162. #endif // _DEBUG
  163. m_nLIGHTWARPTEXTURE = 0;
  164. #ifdef _DEBUG
  165. m_bSPHERETEXKILLCOMBO = false;
  166. #endif // _DEBUG
  167. m_nSPHERETEXKILLCOMBO = 0;
  168. #ifdef _DEBUG
  169. m_bRAYTRACESPHERE = false;
  170. #endif // _DEBUG
  171. m_nRAYTRACESPHERE = 0;
  172. #ifdef _DEBUG
  173. m_bFLASHLIGHTDEPTHFILTERMODE = false;
  174. #endif // _DEBUG
  175. m_nFLASHLIGHTDEPTHFILTERMODE = 0;
  176. #ifdef _DEBUG
  177. m_bWORLD_NORMAL = false;
  178. #endif // _DEBUG
  179. m_nWORLD_NORMAL = 0;
  180. }
  181. int GetIndex()
  182. {
  183. // Asserts to make sure that we aren't using any skipped combinations.
  184. // Asserts to make sure that we are setting all of the combination vars.
  185. #ifdef _DEBUG
  186. bool bAllStaticVarsDefined = m_bFLASHLIGHT && m_bLIGHTWARPTEXTURE && m_bSPHERETEXKILLCOMBO && m_bRAYTRACESPHERE && m_bFLASHLIGHTDEPTHFILTERMODE && m_bWORLD_NORMAL;
  187. Assert( bAllStaticVarsDefined );
  188. #endif // _DEBUG
  189. return ( 40 * m_nFLASHLIGHT ) + ( 80 * m_nLIGHTWARPTEXTURE ) + ( 160 * m_nSPHERETEXKILLCOMBO ) + ( 320 * m_nRAYTRACESPHERE ) + ( 640 * m_nFLASHLIGHTDEPTHFILTERMODE ) + ( 1920 * m_nWORLD_NORMAL ) + 0;
  190. }
  191. };
  192. #define shaderStaticTest_eye_refract_ps30 psh_forgot_to_set_static_FLASHLIGHT + psh_forgot_to_set_static_LIGHTWARPTEXTURE + psh_forgot_to_set_static_SPHERETEXKILLCOMBO + psh_forgot_to_set_static_RAYTRACESPHERE + psh_forgot_to_set_static_FLASHLIGHTDEPTHFILTERMODE + psh_forgot_to_set_static_WORLD_NORMAL + 0
  193. class eye_refract_ps30_Dynamic_Index
  194. {
  195. private:
  196. int m_nPIXELFOGTYPE;
  197. #ifdef _DEBUG
  198. bool m_bPIXELFOGTYPE;
  199. #endif
  200. public:
  201. void SetPIXELFOGTYPE( int i )
  202. {
  203. Assert( i >= 0 && i <= 1 );
  204. m_nPIXELFOGTYPE = i;
  205. #ifdef _DEBUG
  206. m_bPIXELFOGTYPE = true;
  207. #endif
  208. }
  209. void SetPIXELFOGTYPE( bool i )
  210. {
  211. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  212. m_nPIXELFOGTYPE = i ? 1 : 0;
  213. #ifdef _DEBUG
  214. m_bPIXELFOGTYPE = true;
  215. #endif
  216. }
  217. private:
  218. int m_nNUM_LIGHTS;
  219. #ifdef _DEBUG
  220. bool m_bNUM_LIGHTS;
  221. #endif
  222. public:
  223. void SetNUM_LIGHTS( int i )
  224. {
  225. Assert( i >= 0 && i <= 4 );
  226. m_nNUM_LIGHTS = i;
  227. #ifdef _DEBUG
  228. m_bNUM_LIGHTS = true;
  229. #endif
  230. }
  231. void SetNUM_LIGHTS( bool i )
  232. {
  233. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 4 );
  234. m_nNUM_LIGHTS = i ? 1 : 0;
  235. #ifdef _DEBUG
  236. m_bNUM_LIGHTS = true;
  237. #endif
  238. }
  239. private:
  240. int m_nFLASHLIGHTSHADOWS;
  241. #ifdef _DEBUG
  242. bool m_bFLASHLIGHTSHADOWS;
  243. #endif
  244. public:
  245. void SetFLASHLIGHTSHADOWS( int i )
  246. {
  247. Assert( i >= 0 && i <= 1 );
  248. m_nFLASHLIGHTSHADOWS = i;
  249. #ifdef _DEBUG
  250. m_bFLASHLIGHTSHADOWS = true;
  251. #endif
  252. }
  253. void SetFLASHLIGHTSHADOWS( bool i )
  254. {
  255. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  256. m_nFLASHLIGHTSHADOWS = i ? 1 : 0;
  257. #ifdef _DEBUG
  258. m_bFLASHLIGHTSHADOWS = true;
  259. #endif
  260. }
  261. private:
  262. int m_nUBERLIGHT;
  263. #ifdef _DEBUG
  264. bool m_bUBERLIGHT;
  265. #endif
  266. public:
  267. void SetUBERLIGHT( int i )
  268. {
  269. Assert( i >= 0 && i <= 1 );
  270. m_nUBERLIGHT = i;
  271. #ifdef _DEBUG
  272. m_bUBERLIGHT = true;
  273. #endif
  274. }
  275. void SetUBERLIGHT( bool i )
  276. {
  277. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  278. m_nUBERLIGHT = i ? 1 : 0;
  279. #ifdef _DEBUG
  280. m_bUBERLIGHT = true;
  281. #endif
  282. }
  283. public:
  284. // CONSTRUCTOR
  285. eye_refract_ps30_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  286. {
  287. #ifdef _DEBUG
  288. m_bPIXELFOGTYPE = true;
  289. #endif // _DEBUG
  290. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  291. #ifdef _DEBUG
  292. m_bNUM_LIGHTS = false;
  293. #endif // _DEBUG
  294. m_nNUM_LIGHTS = 0;
  295. #ifdef _DEBUG
  296. m_bFLASHLIGHTSHADOWS = false;
  297. #endif // _DEBUG
  298. m_nFLASHLIGHTSHADOWS = 0;
  299. #ifdef _DEBUG
  300. m_bUBERLIGHT = false;
  301. #endif // _DEBUG
  302. m_nUBERLIGHT = 0;
  303. }
  304. int GetIndex()
  305. {
  306. // Asserts to make sure that we aren't using any skipped combinations.
  307. // Asserts to make sure that we are setting all of the combination vars.
  308. #ifdef _DEBUG
  309. bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE && m_bNUM_LIGHTS && m_bFLASHLIGHTSHADOWS && m_bUBERLIGHT;
  310. Assert( bAllDynamicVarsDefined );
  311. #endif // _DEBUG
  312. return ( 1 * m_nPIXELFOGTYPE ) + ( 2 * m_nNUM_LIGHTS ) + ( 10 * m_nFLASHLIGHTSHADOWS ) + ( 20 * m_nUBERLIGHT ) + 0;
  313. }
  314. };
  315. #define shaderDynamicTest_eye_refract_ps30 psh_forgot_to_set_dynamic_NUM_LIGHTS + psh_forgot_to_set_dynamic_FLASHLIGHTSHADOWS + psh_forgot_to_set_dynamic_UBERLIGHT + 0
  316. static const ShaderComboInformation_t s_DynamicComboArray_eye_refract_ps30[4] =
  317. {
  318. { "PIXELFOGTYPE", 0, 1 },
  319. { "NUM_LIGHTS", 0, 4 },
  320. { "FLASHLIGHTSHADOWS", 0, 1 },
  321. { "UBERLIGHT", 0, 1 },
  322. };
  323. static const ShaderComboInformation_t s_StaticComboArray_eye_refract_ps30[6] =
  324. {
  325. { "FLASHLIGHT", 0, 1 },
  326. { "LIGHTWARPTEXTURE", 0, 1 },
  327. { "SPHERETEXKILLCOMBO", 0, 1 },
  328. { "RAYTRACESPHERE", 0, 1 },
  329. { "FLASHLIGHTDEPTHFILTERMODE", 0, 2 },
  330. { "WORLD_NORMAL", 0, 1 },
  331. };
  332. static const ShaderComboSemantics_t eye_refract_ps30_combos =
  333. {
  334. "eye_refract_ps30", s_DynamicComboArray_eye_refract_ps30, 4, s_StaticComboArray_eye_refract_ps30, 6
  335. };
  336. class ConstructMe_eye_refract_ps30
  337. {
  338. public:
  339. ConstructMe_eye_refract_ps30()
  340. {
  341. GetShaderDLL()->AddShaderComboInformation( &eye_refract_ps30_combos );
  342. }
  343. };
  344. static ConstructMe_eye_refract_ps30 s_ConstructMe_eye_refract_ps30;