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.

435 lines
12 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // $DETAILTEXTURE && ( $BUMPMAP && !$DETAIL_ALPHA_MASK_BASE_TEXTURE )
  3. // $VERTEXCOLOR && $BUMPMAP
  4. // $FLASHLIGHT && $SELFILLUM
  5. // $FLASHLIGHT && $DETAIL_ALPHA_MASK_BASE_TEXTURE
  6. // $FLASHLIGHT && $BUMPMAP
  7. // ( $FLASHLIGHT == 0 ) && ( $FLASHLIGHTSHADOWS == 1 ) [ps30]
  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. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  14. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  15. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  16. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  17. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  18. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  19. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  20. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  21. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  22. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  23. #include "shaderlib/cshader.h"
  24. class worldtwotextureblend_ps20b_Static_Index
  25. {
  26. private:
  27. int m_nDETAILTEXTURE;
  28. #ifdef _DEBUG
  29. bool m_bDETAILTEXTURE;
  30. #endif
  31. public:
  32. void SetDETAILTEXTURE( int i )
  33. {
  34. Assert( i >= 0 && i <= 1 );
  35. m_nDETAILTEXTURE = i;
  36. #ifdef _DEBUG
  37. m_bDETAILTEXTURE = true;
  38. #endif
  39. }
  40. void SetDETAILTEXTURE( bool i )
  41. {
  42. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  43. m_nDETAILTEXTURE = i ? 1 : 0;
  44. #ifdef _DEBUG
  45. m_bDETAILTEXTURE = true;
  46. #endif
  47. }
  48. private:
  49. int m_nBUMPMAP;
  50. #ifdef _DEBUG
  51. bool m_bBUMPMAP;
  52. #endif
  53. public:
  54. void SetBUMPMAP( int i )
  55. {
  56. Assert( i >= 0 && i <= 1 );
  57. m_nBUMPMAP = i;
  58. #ifdef _DEBUG
  59. m_bBUMPMAP = true;
  60. #endif
  61. }
  62. void SetBUMPMAP( bool i )
  63. {
  64. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  65. m_nBUMPMAP = i ? 1 : 0;
  66. #ifdef _DEBUG
  67. m_bBUMPMAP = true;
  68. #endif
  69. }
  70. private:
  71. int m_nVERTEXCOLOR;
  72. #ifdef _DEBUG
  73. bool m_bVERTEXCOLOR;
  74. #endif
  75. public:
  76. void SetVERTEXCOLOR( int i )
  77. {
  78. Assert( i >= 0 && i <= 1 );
  79. m_nVERTEXCOLOR = i;
  80. #ifdef _DEBUG
  81. m_bVERTEXCOLOR = true;
  82. #endif
  83. }
  84. void SetVERTEXCOLOR( bool i )
  85. {
  86. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  87. m_nVERTEXCOLOR = i ? 1 : 0;
  88. #ifdef _DEBUG
  89. m_bVERTEXCOLOR = true;
  90. #endif
  91. }
  92. private:
  93. int m_nSELFILLUM;
  94. #ifdef _DEBUG
  95. bool m_bSELFILLUM;
  96. #endif
  97. public:
  98. void SetSELFILLUM( int i )
  99. {
  100. Assert( i >= 0 && i <= 1 );
  101. m_nSELFILLUM = i;
  102. #ifdef _DEBUG
  103. m_bSELFILLUM = true;
  104. #endif
  105. }
  106. void SetSELFILLUM( bool i )
  107. {
  108. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  109. m_nSELFILLUM = i ? 1 : 0;
  110. #ifdef _DEBUG
  111. m_bSELFILLUM = true;
  112. #endif
  113. }
  114. private:
  115. int m_nDETAIL_ALPHA_MASK_BASE_TEXTURE;
  116. #ifdef _DEBUG
  117. bool m_bDETAIL_ALPHA_MASK_BASE_TEXTURE;
  118. #endif
  119. public:
  120. void SetDETAIL_ALPHA_MASK_BASE_TEXTURE( int i )
  121. {
  122. Assert( i >= 0 && i <= 1 );
  123. m_nDETAIL_ALPHA_MASK_BASE_TEXTURE = i;
  124. #ifdef _DEBUG
  125. m_bDETAIL_ALPHA_MASK_BASE_TEXTURE = true;
  126. #endif
  127. }
  128. void SetDETAIL_ALPHA_MASK_BASE_TEXTURE( bool i )
  129. {
  130. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  131. m_nDETAIL_ALPHA_MASK_BASE_TEXTURE = i ? 1 : 0;
  132. #ifdef _DEBUG
  133. m_bDETAIL_ALPHA_MASK_BASE_TEXTURE = true;
  134. #endif
  135. }
  136. private:
  137. int m_nFLASHLIGHT;
  138. #ifdef _DEBUG
  139. bool m_bFLASHLIGHT;
  140. #endif
  141. public:
  142. void SetFLASHLIGHT( int i )
  143. {
  144. Assert( i >= 0 && i <= 1 );
  145. m_nFLASHLIGHT = i;
  146. #ifdef _DEBUG
  147. m_bFLASHLIGHT = true;
  148. #endif
  149. }
  150. void SetFLASHLIGHT( bool i )
  151. {
  152. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  153. m_nFLASHLIGHT = i ? 1 : 0;
  154. #ifdef _DEBUG
  155. m_bFLASHLIGHT = true;
  156. #endif
  157. }
  158. private:
  159. int m_nSEAMLESS;
  160. #ifdef _DEBUG
  161. bool m_bSEAMLESS;
  162. #endif
  163. public:
  164. void SetSEAMLESS( int i )
  165. {
  166. Assert( i >= 0 && i <= 1 );
  167. m_nSEAMLESS = i;
  168. #ifdef _DEBUG
  169. m_bSEAMLESS = true;
  170. #endif
  171. }
  172. void SetSEAMLESS( bool i )
  173. {
  174. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  175. m_nSEAMLESS = i ? 1 : 0;
  176. #ifdef _DEBUG
  177. m_bSEAMLESS = true;
  178. #endif
  179. }
  180. private:
  181. int m_nFLASHLIGHTDEPTHFILTERMODE;
  182. #ifdef _DEBUG
  183. bool m_bFLASHLIGHTDEPTHFILTERMODE;
  184. #endif
  185. public:
  186. void SetFLASHLIGHTDEPTHFILTERMODE( int i )
  187. {
  188. Assert( i >= 0 && i <= 3 );
  189. m_nFLASHLIGHTDEPTHFILTERMODE = i;
  190. #ifdef _DEBUG
  191. m_bFLASHLIGHTDEPTHFILTERMODE = true;
  192. #endif
  193. }
  194. void SetFLASHLIGHTDEPTHFILTERMODE( bool i )
  195. {
  196. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 3 );
  197. m_nFLASHLIGHTDEPTHFILTERMODE = i ? 1 : 0;
  198. #ifdef _DEBUG
  199. m_bFLASHLIGHTDEPTHFILTERMODE = true;
  200. #endif
  201. }
  202. private:
  203. int m_nSHADER_SRGB_READ;
  204. #ifdef _DEBUG
  205. bool m_bSHADER_SRGB_READ;
  206. #endif
  207. public:
  208. void SetSHADER_SRGB_READ( int i )
  209. {
  210. Assert( i >= 0 && i <= 0 );
  211. m_nSHADER_SRGB_READ = i;
  212. #ifdef _DEBUG
  213. m_bSHADER_SRGB_READ = true;
  214. #endif
  215. }
  216. void SetSHADER_SRGB_READ( bool i )
  217. {
  218. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  219. m_nSHADER_SRGB_READ = i ? 1 : 0;
  220. #ifdef _DEBUG
  221. m_bSHADER_SRGB_READ = true;
  222. #endif
  223. }
  224. public:
  225. // CONSTRUCTOR
  226. worldtwotextureblend_ps20b_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  227. {
  228. #ifdef _DEBUG
  229. m_bDETAILTEXTURE = false;
  230. #endif // _DEBUG
  231. m_nDETAILTEXTURE = 0;
  232. #ifdef _DEBUG
  233. m_bBUMPMAP = false;
  234. #endif // _DEBUG
  235. m_nBUMPMAP = 0;
  236. #ifdef _DEBUG
  237. m_bVERTEXCOLOR = false;
  238. #endif // _DEBUG
  239. m_nVERTEXCOLOR = 0;
  240. #ifdef _DEBUG
  241. m_bSELFILLUM = false;
  242. #endif // _DEBUG
  243. m_nSELFILLUM = 0;
  244. #ifdef _DEBUG
  245. m_bDETAIL_ALPHA_MASK_BASE_TEXTURE = false;
  246. #endif // _DEBUG
  247. m_nDETAIL_ALPHA_MASK_BASE_TEXTURE = 0;
  248. #ifdef _DEBUG
  249. m_bFLASHLIGHT = false;
  250. #endif // _DEBUG
  251. m_nFLASHLIGHT = 0;
  252. #ifdef _DEBUG
  253. m_bSEAMLESS = false;
  254. #endif // _DEBUG
  255. m_nSEAMLESS = 0;
  256. #ifdef _DEBUG
  257. m_bFLASHLIGHTDEPTHFILTERMODE = false;
  258. #endif // _DEBUG
  259. m_nFLASHLIGHTDEPTHFILTERMODE = 0;
  260. #ifdef _DEBUG
  261. m_bSHADER_SRGB_READ = false;
  262. #endif // _DEBUG
  263. m_nSHADER_SRGB_READ = 0;
  264. }
  265. int GetIndex()
  266. {
  267. // Asserts to make sure that we aren't using any skipped combinations.
  268. // Asserts to make sure that we are setting all of the combination vars.
  269. #ifdef _DEBUG
  270. bool bAllStaticVarsDefined = m_bDETAILTEXTURE && m_bBUMPMAP && m_bVERTEXCOLOR && m_bSELFILLUM && m_bDETAIL_ALPHA_MASK_BASE_TEXTURE && m_bFLASHLIGHT && m_bSEAMLESS && m_bFLASHLIGHTDEPTHFILTERMODE && m_bSHADER_SRGB_READ;
  271. Assert( bAllStaticVarsDefined );
  272. #endif // _DEBUG
  273. return ( 16 * m_nDETAILTEXTURE ) + ( 32 * m_nBUMPMAP ) + ( 64 * m_nVERTEXCOLOR ) + ( 128 * m_nSELFILLUM ) + ( 256 * m_nDETAIL_ALPHA_MASK_BASE_TEXTURE ) + ( 512 * m_nFLASHLIGHT ) + ( 1024 * m_nSEAMLESS ) + ( 2048 * m_nFLASHLIGHTDEPTHFILTERMODE ) + ( 8192 * m_nSHADER_SRGB_READ ) + 0;
  274. }
  275. };
  276. #define shaderStaticTest_worldtwotextureblend_ps20b psh_forgot_to_set_static_DETAILTEXTURE + psh_forgot_to_set_static_BUMPMAP + psh_forgot_to_set_static_VERTEXCOLOR + psh_forgot_to_set_static_SELFILLUM + psh_forgot_to_set_static_DETAIL_ALPHA_MASK_BASE_TEXTURE + psh_forgot_to_set_static_FLASHLIGHT + psh_forgot_to_set_static_SEAMLESS + psh_forgot_to_set_static_FLASHLIGHTDEPTHFILTERMODE + psh_forgot_to_set_static_SHADER_SRGB_READ + 0
  277. class worldtwotextureblend_ps20b_Dynamic_Index
  278. {
  279. private:
  280. int m_nWRITEWATERFOGTODESTALPHA;
  281. #ifdef _DEBUG
  282. bool m_bWRITEWATERFOGTODESTALPHA;
  283. #endif
  284. public:
  285. void SetWRITEWATERFOGTODESTALPHA( int i )
  286. {
  287. Assert( i >= 0 && i <= 1 );
  288. m_nWRITEWATERFOGTODESTALPHA = i;
  289. #ifdef _DEBUG
  290. m_bWRITEWATERFOGTODESTALPHA = true;
  291. #endif
  292. }
  293. void SetWRITEWATERFOGTODESTALPHA( bool i )
  294. {
  295. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  296. m_nWRITEWATERFOGTODESTALPHA = i ? 1 : 0;
  297. #ifdef _DEBUG
  298. m_bWRITEWATERFOGTODESTALPHA = true;
  299. #endif
  300. }
  301. private:
  302. int m_nPIXELFOGTYPE;
  303. #ifdef _DEBUG
  304. bool m_bPIXELFOGTYPE;
  305. #endif
  306. public:
  307. void SetPIXELFOGTYPE( int i )
  308. {
  309. Assert( i >= 0 && i <= 1 );
  310. m_nPIXELFOGTYPE = i;
  311. #ifdef _DEBUG
  312. m_bPIXELFOGTYPE = true;
  313. #endif
  314. }
  315. void SetPIXELFOGTYPE( bool i )
  316. {
  317. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  318. m_nPIXELFOGTYPE = i ? 1 : 0;
  319. #ifdef _DEBUG
  320. m_bPIXELFOGTYPE = true;
  321. #endif
  322. }
  323. private:
  324. int m_nWRITE_DEPTH_TO_DESTALPHA;
  325. #ifdef _DEBUG
  326. bool m_bWRITE_DEPTH_TO_DESTALPHA;
  327. #endif
  328. public:
  329. void SetWRITE_DEPTH_TO_DESTALPHA( int i )
  330. {
  331. Assert( i >= 0 && i <= 1 );
  332. m_nWRITE_DEPTH_TO_DESTALPHA = i;
  333. #ifdef _DEBUG
  334. m_bWRITE_DEPTH_TO_DESTALPHA = true;
  335. #endif
  336. }
  337. void SetWRITE_DEPTH_TO_DESTALPHA( bool i )
  338. {
  339. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  340. m_nWRITE_DEPTH_TO_DESTALPHA = i ? 1 : 0;
  341. #ifdef _DEBUG
  342. m_bWRITE_DEPTH_TO_DESTALPHA = true;
  343. #endif
  344. }
  345. private:
  346. int m_nFLASHLIGHTSHADOWS;
  347. #ifdef _DEBUG
  348. bool m_bFLASHLIGHTSHADOWS;
  349. #endif
  350. public:
  351. void SetFLASHLIGHTSHADOWS( int i )
  352. {
  353. Assert( i >= 0 && i <= 1 );
  354. m_nFLASHLIGHTSHADOWS = i;
  355. #ifdef _DEBUG
  356. m_bFLASHLIGHTSHADOWS = true;
  357. #endif
  358. }
  359. void SetFLASHLIGHTSHADOWS( bool i )
  360. {
  361. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  362. m_nFLASHLIGHTSHADOWS = i ? 1 : 0;
  363. #ifdef _DEBUG
  364. m_bFLASHLIGHTSHADOWS = true;
  365. #endif
  366. }
  367. public:
  368. // CONSTRUCTOR
  369. worldtwotextureblend_ps20b_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  370. {
  371. #ifdef _DEBUG
  372. m_bWRITEWATERFOGTODESTALPHA = false;
  373. #endif // _DEBUG
  374. m_nWRITEWATERFOGTODESTALPHA = 0;
  375. #ifdef _DEBUG
  376. m_bPIXELFOGTYPE = true;
  377. #endif // _DEBUG
  378. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  379. #ifdef _DEBUG
  380. m_bWRITE_DEPTH_TO_DESTALPHA = false;
  381. #endif // _DEBUG
  382. m_nWRITE_DEPTH_TO_DESTALPHA = 0;
  383. #ifdef _DEBUG
  384. m_bFLASHLIGHTSHADOWS = false;
  385. #endif // _DEBUG
  386. m_nFLASHLIGHTSHADOWS = 0;
  387. }
  388. int GetIndex()
  389. {
  390. // Asserts to make sure that we aren't using any skipped combinations.
  391. // Asserts to make sure that we are setting all of the combination vars.
  392. #ifdef _DEBUG
  393. bool bAllDynamicVarsDefined = m_bWRITEWATERFOGTODESTALPHA && m_bPIXELFOGTYPE && m_bWRITE_DEPTH_TO_DESTALPHA && m_bFLASHLIGHTSHADOWS;
  394. Assert( bAllDynamicVarsDefined );
  395. #endif // _DEBUG
  396. return ( 1 * m_nWRITEWATERFOGTODESTALPHA ) + ( 2 * m_nPIXELFOGTYPE ) + ( 4 * m_nWRITE_DEPTH_TO_DESTALPHA ) + ( 8 * m_nFLASHLIGHTSHADOWS ) + 0;
  397. }
  398. };
  399. #define shaderDynamicTest_worldtwotextureblend_ps20b psh_forgot_to_set_dynamic_WRITEWATERFOGTODESTALPHA + psh_forgot_to_set_dynamic_WRITE_DEPTH_TO_DESTALPHA + psh_forgot_to_set_dynamic_FLASHLIGHTSHADOWS + 0
  400. static const ShaderComboInformation_t s_DynamicComboArray_worldtwotextureblend_ps20b[4] =
  401. {
  402. { "WRITEWATERFOGTODESTALPHA", 0, 1 },
  403. { "PIXELFOGTYPE", 0, 1 },
  404. { "WRITE_DEPTH_TO_DESTALPHA", 0, 1 },
  405. { "FLASHLIGHTSHADOWS", 0, 1 },
  406. };
  407. static const ShaderComboInformation_t s_StaticComboArray_worldtwotextureblend_ps20b[9] =
  408. {
  409. { "DETAILTEXTURE", 0, 1 },
  410. { "BUMPMAP", 0, 1 },
  411. { "VERTEXCOLOR", 0, 1 },
  412. { "SELFILLUM", 0, 1 },
  413. { "DETAIL_ALPHA_MASK_BASE_TEXTURE", 0, 1 },
  414. { "FLASHLIGHT", 0, 1 },
  415. { "SEAMLESS", 0, 1 },
  416. { "FLASHLIGHTDEPTHFILTERMODE", 0, 3 },
  417. { "SHADER_SRGB_READ", 0, 0 },
  418. };
  419. static const ShaderComboSemantics_t worldtwotextureblend_ps20b_combos =
  420. {
  421. "worldtwotextureblend_ps20b", s_DynamicComboArray_worldtwotextureblend_ps20b, 4, s_StaticComboArray_worldtwotextureblend_ps20b, 9
  422. };
  423. class ConstructMe_worldtwotextureblend_ps20b
  424. {
  425. public:
  426. ConstructMe_worldtwotextureblend_ps20b()
  427. {
  428. GetShaderDLL()->AddShaderComboInformation( &worldtwotextureblend_ps20b_combos );
  429. }
  430. };
  431. static ConstructMe_worldtwotextureblend_ps20b s_ConstructMe_worldtwotextureblend_ps20b;