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.

374 lines
9.1 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $SFM == 0 ) && ( $UBERLIGHT == 1 )
  3. // !$WORLDVERTEXTRANSITION && $NORMALMAP2
  4. // !$NORMALMAP && $NORMALMAP2
  5. // !$DETAILTEXTURE && ( $DETAIL_BLEND_MODE != 0 )
  6. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  7. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  8. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  9. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  10. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  11. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  12. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  13. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  14. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  15. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  16. #include "shaderlib/cshader.h"
  17. class flashlight_ps20b_Static_Index
  18. {
  19. private:
  20. int m_nSFM;
  21. #ifdef _DEBUG
  22. bool m_bSFM;
  23. #endif
  24. public:
  25. void SetSFM( int i )
  26. {
  27. Assert( i >= 0 && i <= 0 );
  28. m_nSFM = i;
  29. #ifdef _DEBUG
  30. m_bSFM = true;
  31. #endif
  32. }
  33. void SetSFM( bool i )
  34. {
  35. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  36. m_nSFM = i ? 1 : 0;
  37. #ifdef _DEBUG
  38. m_bSFM = true;
  39. #endif
  40. }
  41. private:
  42. int m_nNORMALMAP;
  43. #ifdef _DEBUG
  44. bool m_bNORMALMAP;
  45. #endif
  46. public:
  47. void SetNORMALMAP( int i )
  48. {
  49. Assert( i >= 0 && i <= 2 );
  50. m_nNORMALMAP = i;
  51. #ifdef _DEBUG
  52. m_bNORMALMAP = true;
  53. #endif
  54. }
  55. void SetNORMALMAP( bool i )
  56. {
  57. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  58. m_nNORMALMAP = i ? 1 : 0;
  59. #ifdef _DEBUG
  60. m_bNORMALMAP = true;
  61. #endif
  62. }
  63. private:
  64. int m_nNORMALMAP2;
  65. #ifdef _DEBUG
  66. bool m_bNORMALMAP2;
  67. #endif
  68. public:
  69. void SetNORMALMAP2( int i )
  70. {
  71. Assert( i >= 0 && i <= 1 );
  72. m_nNORMALMAP2 = i;
  73. #ifdef _DEBUG
  74. m_bNORMALMAP2 = true;
  75. #endif
  76. }
  77. void SetNORMALMAP2( bool i )
  78. {
  79. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  80. m_nNORMALMAP2 = i ? 1 : 0;
  81. #ifdef _DEBUG
  82. m_bNORMALMAP2 = true;
  83. #endif
  84. }
  85. private:
  86. int m_nWORLDVERTEXTRANSITION;
  87. #ifdef _DEBUG
  88. bool m_bWORLDVERTEXTRANSITION;
  89. #endif
  90. public:
  91. void SetWORLDVERTEXTRANSITION( int i )
  92. {
  93. Assert( i >= 0 && i <= 1 );
  94. m_nWORLDVERTEXTRANSITION = i;
  95. #ifdef _DEBUG
  96. m_bWORLDVERTEXTRANSITION = true;
  97. #endif
  98. }
  99. void SetWORLDVERTEXTRANSITION( bool i )
  100. {
  101. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  102. m_nWORLDVERTEXTRANSITION = i ? 1 : 0;
  103. #ifdef _DEBUG
  104. m_bWORLDVERTEXTRANSITION = true;
  105. #endif
  106. }
  107. private:
  108. int m_nSEAMLESS;
  109. #ifdef _DEBUG
  110. bool m_bSEAMLESS;
  111. #endif
  112. public:
  113. void SetSEAMLESS( int i )
  114. {
  115. Assert( i >= 0 && i <= 1 );
  116. m_nSEAMLESS = i;
  117. #ifdef _DEBUG
  118. m_bSEAMLESS = true;
  119. #endif
  120. }
  121. void SetSEAMLESS( bool i )
  122. {
  123. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  124. m_nSEAMLESS = i ? 1 : 0;
  125. #ifdef _DEBUG
  126. m_bSEAMLESS = true;
  127. #endif
  128. }
  129. private:
  130. int m_nDETAILTEXTURE;
  131. #ifdef _DEBUG
  132. bool m_bDETAILTEXTURE;
  133. #endif
  134. public:
  135. void SetDETAILTEXTURE( int i )
  136. {
  137. Assert( i >= 0 && i <= 1 );
  138. m_nDETAILTEXTURE = i;
  139. #ifdef _DEBUG
  140. m_bDETAILTEXTURE = true;
  141. #endif
  142. }
  143. void SetDETAILTEXTURE( bool i )
  144. {
  145. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  146. m_nDETAILTEXTURE = i ? 1 : 0;
  147. #ifdef _DEBUG
  148. m_bDETAILTEXTURE = true;
  149. #endif
  150. }
  151. private:
  152. int m_nDETAIL_BLEND_MODE;
  153. #ifdef _DEBUG
  154. bool m_bDETAIL_BLEND_MODE;
  155. #endif
  156. public:
  157. void SetDETAIL_BLEND_MODE( int i )
  158. {
  159. Assert( i >= 0 && i <= 11 );
  160. m_nDETAIL_BLEND_MODE = i;
  161. #ifdef _DEBUG
  162. m_bDETAIL_BLEND_MODE = true;
  163. #endif
  164. }
  165. void SetDETAIL_BLEND_MODE( bool i )
  166. {
  167. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 11 );
  168. m_nDETAIL_BLEND_MODE = i ? 1 : 0;
  169. #ifdef _DEBUG
  170. m_bDETAIL_BLEND_MODE = true;
  171. #endif
  172. }
  173. private:
  174. int m_nFLASHLIGHTDEPTHFILTERMODE;
  175. #ifdef _DEBUG
  176. bool m_bFLASHLIGHTDEPTHFILTERMODE;
  177. #endif
  178. public:
  179. void SetFLASHLIGHTDEPTHFILTERMODE( int i )
  180. {
  181. Assert( i >= 0 && i <= 3 );
  182. m_nFLASHLIGHTDEPTHFILTERMODE = i;
  183. #ifdef _DEBUG
  184. m_bFLASHLIGHTDEPTHFILTERMODE = true;
  185. #endif
  186. }
  187. void SetFLASHLIGHTDEPTHFILTERMODE( bool i )
  188. {
  189. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 3 );
  190. m_nFLASHLIGHTDEPTHFILTERMODE = i ? 1 : 0;
  191. #ifdef _DEBUG
  192. m_bFLASHLIGHTDEPTHFILTERMODE = true;
  193. #endif
  194. }
  195. private:
  196. int m_nDOPIXELFOG;
  197. #ifdef _DEBUG
  198. bool m_bDOPIXELFOG;
  199. #endif
  200. public:
  201. void SetDOPIXELFOG( int i )
  202. {
  203. Assert( i >= 0 && i <= 1 );
  204. m_nDOPIXELFOG = i;
  205. #ifdef _DEBUG
  206. m_bDOPIXELFOG = true;
  207. #endif
  208. }
  209. void SetDOPIXELFOG( bool i )
  210. {
  211. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  212. m_nDOPIXELFOG = i ? 1 : 0;
  213. #ifdef _DEBUG
  214. m_bDOPIXELFOG = true;
  215. #endif
  216. }
  217. public:
  218. // CONSTRUCTOR
  219. flashlight_ps20b_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  220. {
  221. #ifdef _DEBUG
  222. m_bSFM = false;
  223. #endif // _DEBUG
  224. m_nSFM = 0;
  225. #ifdef _DEBUG
  226. m_bNORMALMAP = false;
  227. #endif // _DEBUG
  228. m_nNORMALMAP = 0;
  229. #ifdef _DEBUG
  230. m_bNORMALMAP2 = false;
  231. #endif // _DEBUG
  232. m_nNORMALMAP2 = 0;
  233. #ifdef _DEBUG
  234. m_bWORLDVERTEXTRANSITION = false;
  235. #endif // _DEBUG
  236. m_nWORLDVERTEXTRANSITION = 0;
  237. #ifdef _DEBUG
  238. m_bSEAMLESS = false;
  239. #endif // _DEBUG
  240. m_nSEAMLESS = 0;
  241. #ifdef _DEBUG
  242. m_bDETAILTEXTURE = false;
  243. #endif // _DEBUG
  244. m_nDETAILTEXTURE = 0;
  245. #ifdef _DEBUG
  246. m_bDETAIL_BLEND_MODE = false;
  247. #endif // _DEBUG
  248. m_nDETAIL_BLEND_MODE = 0;
  249. #ifdef _DEBUG
  250. m_bFLASHLIGHTDEPTHFILTERMODE = false;
  251. #endif // _DEBUG
  252. m_nFLASHLIGHTDEPTHFILTERMODE = 0;
  253. #ifdef _DEBUG
  254. m_bDOPIXELFOG = true;
  255. #endif // _DEBUG
  256. m_nDOPIXELFOG = !IS_FLAG_SET( MATERIAL_VAR_VERTEXFOG ) ? 1 : 0 ;
  257. }
  258. int GetIndex()
  259. {
  260. // Asserts to make sure that we aren't using any skipped combinations.
  261. // Asserts to make sure that we are setting all of the combination vars.
  262. #ifdef _DEBUG
  263. bool bAllStaticVarsDefined = m_bSFM && m_bNORMALMAP && m_bNORMALMAP2 && m_bWORLDVERTEXTRANSITION && m_bSEAMLESS && m_bDETAILTEXTURE && m_bDETAIL_BLEND_MODE && m_bFLASHLIGHTDEPTHFILTERMODE && m_bDOPIXELFOG;
  264. Assert( bAllStaticVarsDefined );
  265. #endif // _DEBUG
  266. return ( 4 * m_nSFM ) + ( 4 * m_nNORMALMAP ) + ( 12 * m_nNORMALMAP2 ) + ( 24 * m_nWORLDVERTEXTRANSITION ) + ( 48 * m_nSEAMLESS ) + ( 96 * m_nDETAILTEXTURE ) + ( 192 * m_nDETAIL_BLEND_MODE ) + ( 2304 * m_nFLASHLIGHTDEPTHFILTERMODE ) + ( 9216 * m_nDOPIXELFOG ) + 0;
  267. }
  268. };
  269. #define shaderStaticTest_flashlight_ps20b psh_forgot_to_set_static_SFM + psh_forgot_to_set_static_NORMALMAP + psh_forgot_to_set_static_NORMALMAP2 + psh_forgot_to_set_static_WORLDVERTEXTRANSITION + psh_forgot_to_set_static_SEAMLESS + psh_forgot_to_set_static_DETAILTEXTURE + psh_forgot_to_set_static_DETAIL_BLEND_MODE + psh_forgot_to_set_static_FLASHLIGHTDEPTHFILTERMODE + 0
  270. class flashlight_ps20b_Dynamic_Index
  271. {
  272. private:
  273. int m_nFLASHLIGHTSHADOWS;
  274. #ifdef _DEBUG
  275. bool m_bFLASHLIGHTSHADOWS;
  276. #endif
  277. public:
  278. void SetFLASHLIGHTSHADOWS( int i )
  279. {
  280. Assert( i >= 0 && i <= 1 );
  281. m_nFLASHLIGHTSHADOWS = i;
  282. #ifdef _DEBUG
  283. m_bFLASHLIGHTSHADOWS = true;
  284. #endif
  285. }
  286. void SetFLASHLIGHTSHADOWS( bool i )
  287. {
  288. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  289. m_nFLASHLIGHTSHADOWS = i ? 1 : 0;
  290. #ifdef _DEBUG
  291. m_bFLASHLIGHTSHADOWS = true;
  292. #endif
  293. }
  294. private:
  295. int m_nPIXELFOGTYPE;
  296. #ifdef _DEBUG
  297. bool m_bPIXELFOGTYPE;
  298. #endif
  299. public:
  300. void SetPIXELFOGTYPE( int i )
  301. {
  302. Assert( i >= 0 && i <= 1 );
  303. m_nPIXELFOGTYPE = i;
  304. #ifdef _DEBUG
  305. m_bPIXELFOGTYPE = true;
  306. #endif
  307. }
  308. void SetPIXELFOGTYPE( bool i )
  309. {
  310. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  311. m_nPIXELFOGTYPE = i ? 1 : 0;
  312. #ifdef _DEBUG
  313. m_bPIXELFOGTYPE = true;
  314. #endif
  315. }
  316. public:
  317. // CONSTRUCTOR
  318. flashlight_ps20b_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  319. {
  320. #ifdef _DEBUG
  321. m_bFLASHLIGHTSHADOWS = false;
  322. #endif // _DEBUG
  323. m_nFLASHLIGHTSHADOWS = 0;
  324. #ifdef _DEBUG
  325. m_bPIXELFOGTYPE = true;
  326. #endif // _DEBUG
  327. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  328. }
  329. int GetIndex()
  330. {
  331. // Asserts to make sure that we aren't using any skipped combinations.
  332. // Asserts to make sure that we are setting all of the combination vars.
  333. #ifdef _DEBUG
  334. bool bAllDynamicVarsDefined = m_bFLASHLIGHTSHADOWS && m_bPIXELFOGTYPE;
  335. Assert( bAllDynamicVarsDefined );
  336. #endif // _DEBUG
  337. return ( 1 * m_nFLASHLIGHTSHADOWS ) + ( 2 * m_nPIXELFOGTYPE ) + 0;
  338. }
  339. };
  340. #define shaderDynamicTest_flashlight_ps20b psh_forgot_to_set_dynamic_FLASHLIGHTSHADOWS + 0
  341. static const ShaderComboInformation_t s_DynamicComboArray_flashlight_ps20b[2] =
  342. {
  343. { "FLASHLIGHTSHADOWS", 0, 1 },
  344. { "PIXELFOGTYPE", 0, 1 },
  345. };
  346. static const ShaderComboInformation_t s_StaticComboArray_flashlight_ps20b[9] =
  347. {
  348. { "SFM", 0, 0 },
  349. { "NORMALMAP", 0, 2 },
  350. { "NORMALMAP2", 0, 1 },
  351. { "WORLDVERTEXTRANSITION", 0, 1 },
  352. { "SEAMLESS", 0, 1 },
  353. { "DETAILTEXTURE", 0, 1 },
  354. { "DETAIL_BLEND_MODE", 0, 11 },
  355. { "FLASHLIGHTDEPTHFILTERMODE", 0, 3 },
  356. { "DOPIXELFOG", 0, 1 },
  357. };
  358. static const ShaderComboSemantics_t flashlight_ps20b_combos =
  359. {
  360. "flashlight_ps20b", s_DynamicComboArray_flashlight_ps20b, 2, s_StaticComboArray_flashlight_ps20b, 9
  361. };
  362. class ConstructMe_flashlight_ps20b
  363. {
  364. public:
  365. ConstructMe_flashlight_ps20b()
  366. {
  367. GetShaderDLL()->AddShaderComboInformation( &flashlight_ps20b_combos );
  368. }
  369. };
  370. static ConstructMe_flashlight_ps20b s_ConstructMe_flashlight_ps20b;