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.

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