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.

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