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.

353 lines
9.3 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. // 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. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  18. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  19. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  20. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  21. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  22. #include "shaderlib/cshader.h"
  23. class worldtwotextureblend_ps20_Static_Index
  24. {
  25. private:
  26. int m_nDETAILTEXTURE;
  27. #ifdef _DEBUG
  28. bool m_bDETAILTEXTURE;
  29. #endif
  30. public:
  31. void SetDETAILTEXTURE( int i )
  32. {
  33. Assert( i >= 0 && i <= 1 );
  34. m_nDETAILTEXTURE = i;
  35. #ifdef _DEBUG
  36. m_bDETAILTEXTURE = true;
  37. #endif
  38. }
  39. void SetDETAILTEXTURE( bool i )
  40. {
  41. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  42. m_nDETAILTEXTURE = i ? 1 : 0;
  43. #ifdef _DEBUG
  44. m_bDETAILTEXTURE = true;
  45. #endif
  46. }
  47. private:
  48. int m_nBUMPMAP;
  49. #ifdef _DEBUG
  50. bool m_bBUMPMAP;
  51. #endif
  52. public:
  53. void SetBUMPMAP( int i )
  54. {
  55. Assert( i >= 0 && i <= 1 );
  56. m_nBUMPMAP = i;
  57. #ifdef _DEBUG
  58. m_bBUMPMAP = true;
  59. #endif
  60. }
  61. void SetBUMPMAP( bool i )
  62. {
  63. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  64. m_nBUMPMAP = i ? 1 : 0;
  65. #ifdef _DEBUG
  66. m_bBUMPMAP = true;
  67. #endif
  68. }
  69. private:
  70. int m_nVERTEXCOLOR;
  71. #ifdef _DEBUG
  72. bool m_bVERTEXCOLOR;
  73. #endif
  74. public:
  75. void SetVERTEXCOLOR( int i )
  76. {
  77. Assert( i >= 0 && i <= 1 );
  78. m_nVERTEXCOLOR = i;
  79. #ifdef _DEBUG
  80. m_bVERTEXCOLOR = true;
  81. #endif
  82. }
  83. void SetVERTEXCOLOR( bool i )
  84. {
  85. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  86. m_nVERTEXCOLOR = i ? 1 : 0;
  87. #ifdef _DEBUG
  88. m_bVERTEXCOLOR = true;
  89. #endif
  90. }
  91. private:
  92. int m_nSELFILLUM;
  93. #ifdef _DEBUG
  94. bool m_bSELFILLUM;
  95. #endif
  96. public:
  97. void SetSELFILLUM( int i )
  98. {
  99. Assert( i >= 0 && i <= 1 );
  100. m_nSELFILLUM = i;
  101. #ifdef _DEBUG
  102. m_bSELFILLUM = true;
  103. #endif
  104. }
  105. void SetSELFILLUM( bool i )
  106. {
  107. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  108. m_nSELFILLUM = i ? 1 : 0;
  109. #ifdef _DEBUG
  110. m_bSELFILLUM = true;
  111. #endif
  112. }
  113. private:
  114. int m_nDETAIL_ALPHA_MASK_BASE_TEXTURE;
  115. #ifdef _DEBUG
  116. bool m_bDETAIL_ALPHA_MASK_BASE_TEXTURE;
  117. #endif
  118. public:
  119. void SetDETAIL_ALPHA_MASK_BASE_TEXTURE( int i )
  120. {
  121. Assert( i >= 0 && i <= 1 );
  122. m_nDETAIL_ALPHA_MASK_BASE_TEXTURE = i;
  123. #ifdef _DEBUG
  124. m_bDETAIL_ALPHA_MASK_BASE_TEXTURE = true;
  125. #endif
  126. }
  127. void SetDETAIL_ALPHA_MASK_BASE_TEXTURE( bool i )
  128. {
  129. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  130. m_nDETAIL_ALPHA_MASK_BASE_TEXTURE = i ? 1 : 0;
  131. #ifdef _DEBUG
  132. m_bDETAIL_ALPHA_MASK_BASE_TEXTURE = true;
  133. #endif
  134. }
  135. private:
  136. int m_nFLASHLIGHT;
  137. #ifdef _DEBUG
  138. bool m_bFLASHLIGHT;
  139. #endif
  140. public:
  141. void SetFLASHLIGHT( int i )
  142. {
  143. Assert( i >= 0 && i <= 1 );
  144. m_nFLASHLIGHT = i;
  145. #ifdef _DEBUG
  146. m_bFLASHLIGHT = true;
  147. #endif
  148. }
  149. void SetFLASHLIGHT( bool i )
  150. {
  151. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  152. m_nFLASHLIGHT = i ? 1 : 0;
  153. #ifdef _DEBUG
  154. m_bFLASHLIGHT = true;
  155. #endif
  156. }
  157. private:
  158. int m_nSEAMLESS;
  159. #ifdef _DEBUG
  160. bool m_bSEAMLESS;
  161. #endif
  162. public:
  163. void SetSEAMLESS( int i )
  164. {
  165. Assert( i >= 0 && i <= 1 );
  166. m_nSEAMLESS = i;
  167. #ifdef _DEBUG
  168. m_bSEAMLESS = true;
  169. #endif
  170. }
  171. void SetSEAMLESS( bool i )
  172. {
  173. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  174. m_nSEAMLESS = i ? 1 : 0;
  175. #ifdef _DEBUG
  176. m_bSEAMLESS = true;
  177. #endif
  178. }
  179. private:
  180. int m_nSHADER_SRGB_READ;
  181. #ifdef _DEBUG
  182. bool m_bSHADER_SRGB_READ;
  183. #endif
  184. public:
  185. void SetSHADER_SRGB_READ( int i )
  186. {
  187. Assert( i >= 0 && i <= 0 );
  188. m_nSHADER_SRGB_READ = i;
  189. #ifdef _DEBUG
  190. m_bSHADER_SRGB_READ = true;
  191. #endif
  192. }
  193. void SetSHADER_SRGB_READ( bool i )
  194. {
  195. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  196. m_nSHADER_SRGB_READ = i ? 1 : 0;
  197. #ifdef _DEBUG
  198. m_bSHADER_SRGB_READ = true;
  199. #endif
  200. }
  201. public:
  202. // CONSTRUCTOR
  203. worldtwotextureblend_ps20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  204. {
  205. #ifdef _DEBUG
  206. m_bDETAILTEXTURE = false;
  207. #endif // _DEBUG
  208. m_nDETAILTEXTURE = 0;
  209. #ifdef _DEBUG
  210. m_bBUMPMAP = false;
  211. #endif // _DEBUG
  212. m_nBUMPMAP = 0;
  213. #ifdef _DEBUG
  214. m_bVERTEXCOLOR = false;
  215. #endif // _DEBUG
  216. m_nVERTEXCOLOR = 0;
  217. #ifdef _DEBUG
  218. m_bSELFILLUM = false;
  219. #endif // _DEBUG
  220. m_nSELFILLUM = 0;
  221. #ifdef _DEBUG
  222. m_bDETAIL_ALPHA_MASK_BASE_TEXTURE = false;
  223. #endif // _DEBUG
  224. m_nDETAIL_ALPHA_MASK_BASE_TEXTURE = 0;
  225. #ifdef _DEBUG
  226. m_bFLASHLIGHT = false;
  227. #endif // _DEBUG
  228. m_nFLASHLIGHT = 0;
  229. #ifdef _DEBUG
  230. m_bSEAMLESS = false;
  231. #endif // _DEBUG
  232. m_nSEAMLESS = 0;
  233. #ifdef _DEBUG
  234. m_bSHADER_SRGB_READ = false;
  235. #endif // _DEBUG
  236. m_nSHADER_SRGB_READ = 0;
  237. }
  238. int GetIndex()
  239. {
  240. // Asserts to make sure that we aren't using any skipped combinations.
  241. // Asserts to make sure that we are setting all of the combination vars.
  242. #ifdef _DEBUG
  243. bool bAllStaticVarsDefined = m_bDETAILTEXTURE && m_bBUMPMAP && m_bVERTEXCOLOR && m_bSELFILLUM && m_bDETAIL_ALPHA_MASK_BASE_TEXTURE && m_bFLASHLIGHT && m_bSEAMLESS && m_bSHADER_SRGB_READ;
  244. Assert( bAllStaticVarsDefined );
  245. #endif // _DEBUG
  246. return ( 4 * m_nDETAILTEXTURE ) + ( 8 * m_nBUMPMAP ) + ( 16 * m_nVERTEXCOLOR ) + ( 32 * m_nSELFILLUM ) + ( 64 * m_nDETAIL_ALPHA_MASK_BASE_TEXTURE ) + ( 128 * m_nFLASHLIGHT ) + ( 256 * m_nSEAMLESS ) + ( 512 * m_nSHADER_SRGB_READ ) + 0;
  247. }
  248. };
  249. #define shaderStaticTest_worldtwotextureblend_ps20 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_SHADER_SRGB_READ + 0
  250. class worldtwotextureblend_ps20_Dynamic_Index
  251. {
  252. private:
  253. int m_nWRITEWATERFOGTODESTALPHA;
  254. #ifdef _DEBUG
  255. bool m_bWRITEWATERFOGTODESTALPHA;
  256. #endif
  257. public:
  258. void SetWRITEWATERFOGTODESTALPHA( int i )
  259. {
  260. Assert( i >= 0 && i <= 1 );
  261. m_nWRITEWATERFOGTODESTALPHA = i;
  262. #ifdef _DEBUG
  263. m_bWRITEWATERFOGTODESTALPHA = true;
  264. #endif
  265. }
  266. void SetWRITEWATERFOGTODESTALPHA( bool i )
  267. {
  268. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  269. m_nWRITEWATERFOGTODESTALPHA = i ? 1 : 0;
  270. #ifdef _DEBUG
  271. m_bWRITEWATERFOGTODESTALPHA = true;
  272. #endif
  273. }
  274. private:
  275. int m_nPIXELFOGTYPE;
  276. #ifdef _DEBUG
  277. bool m_bPIXELFOGTYPE;
  278. #endif
  279. public:
  280. void SetPIXELFOGTYPE( int i )
  281. {
  282. Assert( i >= 0 && i <= 1 );
  283. m_nPIXELFOGTYPE = i;
  284. #ifdef _DEBUG
  285. m_bPIXELFOGTYPE = true;
  286. #endif
  287. }
  288. void SetPIXELFOGTYPE( bool i )
  289. {
  290. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  291. m_nPIXELFOGTYPE = i ? 1 : 0;
  292. #ifdef _DEBUG
  293. m_bPIXELFOGTYPE = true;
  294. #endif
  295. }
  296. public:
  297. // CONSTRUCTOR
  298. worldtwotextureblend_ps20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  299. {
  300. #ifdef _DEBUG
  301. m_bWRITEWATERFOGTODESTALPHA = false;
  302. #endif // _DEBUG
  303. m_nWRITEWATERFOGTODESTALPHA = 0;
  304. #ifdef _DEBUG
  305. m_bPIXELFOGTYPE = true;
  306. #endif // _DEBUG
  307. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  308. }
  309. int GetIndex()
  310. {
  311. // Asserts to make sure that we aren't using any skipped combinations.
  312. // Asserts to make sure that we are setting all of the combination vars.
  313. #ifdef _DEBUG
  314. bool bAllDynamicVarsDefined = m_bWRITEWATERFOGTODESTALPHA && m_bPIXELFOGTYPE;
  315. Assert( bAllDynamicVarsDefined );
  316. #endif // _DEBUG
  317. return ( 1 * m_nWRITEWATERFOGTODESTALPHA ) + ( 2 * m_nPIXELFOGTYPE ) + 0;
  318. }
  319. };
  320. #define shaderDynamicTest_worldtwotextureblend_ps20 psh_forgot_to_set_dynamic_WRITEWATERFOGTODESTALPHA + 0
  321. static const ShaderComboInformation_t s_DynamicComboArray_worldtwotextureblend_ps20[2] =
  322. {
  323. { "WRITEWATERFOGTODESTALPHA", 0, 1 },
  324. { "PIXELFOGTYPE", 0, 1 },
  325. };
  326. static const ShaderComboInformation_t s_StaticComboArray_worldtwotextureblend_ps20[8] =
  327. {
  328. { "DETAILTEXTURE", 0, 1 },
  329. { "BUMPMAP", 0, 1 },
  330. { "VERTEXCOLOR", 0, 1 },
  331. { "SELFILLUM", 0, 1 },
  332. { "DETAIL_ALPHA_MASK_BASE_TEXTURE", 0, 1 },
  333. { "FLASHLIGHT", 0, 1 },
  334. { "SEAMLESS", 0, 1 },
  335. { "SHADER_SRGB_READ", 0, 0 },
  336. };
  337. static const ShaderComboSemantics_t worldtwotextureblend_ps20_combos =
  338. {
  339. "worldtwotextureblend_ps20", s_DynamicComboArray_worldtwotextureblend_ps20, 2, s_StaticComboArray_worldtwotextureblend_ps20, 8
  340. };
  341. class ConstructMe_worldtwotextureblend_ps20
  342. {
  343. public:
  344. ConstructMe_worldtwotextureblend_ps20()
  345. {
  346. GetShaderDLL()->AddShaderComboInformation( &worldtwotextureblend_ps20_combos );
  347. }
  348. };
  349. static ConstructMe_worldtwotextureblend_ps20 s_ConstructMe_worldtwotextureblend_ps20;