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.

355 lines
8.8 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $CASCADED_SHADOW_MAPPING == 0 ) && ( $DYN_CSM_ENABLED == 1 )
  3. // ( $HIGHLIGHT > 0 ) && ( $THIRDPERSON == 1 )
  4. // ( $HIGHLIGHT > 0 ) && ( $PEEL == 1 )
  5. // ( $PEEL == 1 ) && ( $THIRDPERSON == 1 )
  6. // ( $ALPHAMASK == 1 ) && ( $THIRDPERSON == 1 )
  7. // ( $ALPHAMASK == 1 ) && ( $HIGHLIGHT == 1 )
  8. // ( $ALPHAMASK == 1 ) && ( $PEEL == 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 weapondecal_ps20b_Static_Index
  26. {
  27. private:
  28. int m_nPHONG;
  29. #ifdef _DEBUG
  30. bool m_bPHONG;
  31. #endif
  32. public:
  33. void SetPHONG( int i )
  34. {
  35. Assert( i >= 0 && i <= 1 );
  36. m_nPHONG = i;
  37. #ifdef _DEBUG
  38. m_bPHONG = true;
  39. #endif
  40. }
  41. void SetPHONG( bool i )
  42. {
  43. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  44. m_nPHONG = i ? 1 : 0;
  45. #ifdef _DEBUG
  46. m_bPHONG = true;
  47. #endif
  48. }
  49. private:
  50. int m_nPHONGEXPONENTTEXTURE;
  51. #ifdef _DEBUG
  52. bool m_bPHONGEXPONENTTEXTURE;
  53. #endif
  54. public:
  55. void SetPHONGEXPONENTTEXTURE( int i )
  56. {
  57. Assert( i >= 0 && i <= 1 );
  58. m_nPHONGEXPONENTTEXTURE = i;
  59. #ifdef _DEBUG
  60. m_bPHONGEXPONENTTEXTURE = true;
  61. #endif
  62. }
  63. void SetPHONGEXPONENTTEXTURE( bool i )
  64. {
  65. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  66. m_nPHONGEXPONENTTEXTURE = i ? 1 : 0;
  67. #ifdef _DEBUG
  68. m_bPHONGEXPONENTTEXTURE = true;
  69. #endif
  70. }
  71. private:
  72. int m_nCUBEMAP;
  73. #ifdef _DEBUG
  74. bool m_bCUBEMAP;
  75. #endif
  76. public:
  77. void SetCUBEMAP( int i )
  78. {
  79. Assert( i >= 0 && i <= 1 );
  80. m_nCUBEMAP = i;
  81. #ifdef _DEBUG
  82. m_bCUBEMAP = true;
  83. #endif
  84. }
  85. void SetCUBEMAP( bool i )
  86. {
  87. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  88. m_nCUBEMAP = i ? 1 : 0;
  89. #ifdef _DEBUG
  90. m_bCUBEMAP = true;
  91. #endif
  92. }
  93. private:
  94. int m_nDECALSTYLE;
  95. #ifdef _DEBUG
  96. bool m_bDECALSTYLE;
  97. #endif
  98. public:
  99. void SetDECALSTYLE( int i )
  100. {
  101. Assert( i >= 0 && i <= 5 );
  102. m_nDECALSTYLE = i;
  103. #ifdef _DEBUG
  104. m_bDECALSTYLE = true;
  105. #endif
  106. }
  107. void SetDECALSTYLE( bool i )
  108. {
  109. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 5 );
  110. m_nDECALSTYLE = i ? 1 : 0;
  111. #ifdef _DEBUG
  112. m_bDECALSTYLE = true;
  113. #endif
  114. }
  115. private:
  116. int m_nTHIRDPERSON;
  117. #ifdef _DEBUG
  118. bool m_bTHIRDPERSON;
  119. #endif
  120. public:
  121. void SetTHIRDPERSON( int i )
  122. {
  123. Assert( i >= 0 && i <= 1 );
  124. m_nTHIRDPERSON = i;
  125. #ifdef _DEBUG
  126. m_bTHIRDPERSON = true;
  127. #endif
  128. }
  129. void SetTHIRDPERSON( bool i )
  130. {
  131. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  132. m_nTHIRDPERSON = i ? 1 : 0;
  133. #ifdef _DEBUG
  134. m_bTHIRDPERSON = true;
  135. #endif
  136. }
  137. private:
  138. int m_nDESATBASETINT;
  139. #ifdef _DEBUG
  140. bool m_bDESATBASETINT;
  141. #endif
  142. public:
  143. void SetDESATBASETINT( int i )
  144. {
  145. Assert( i >= 0 && i <= 1 );
  146. m_nDESATBASETINT = i;
  147. #ifdef _DEBUG
  148. m_bDESATBASETINT = true;
  149. #endif
  150. }
  151. void SetDESATBASETINT( bool i )
  152. {
  153. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  154. m_nDESATBASETINT = i ? 1 : 0;
  155. #ifdef _DEBUG
  156. m_bDESATBASETINT = true;
  157. #endif
  158. }
  159. public:
  160. // CONSTRUCTOR
  161. weapondecal_ps20b_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  162. {
  163. #ifdef _DEBUG
  164. m_bPHONG = false;
  165. #endif // _DEBUG
  166. m_nPHONG = 0;
  167. #ifdef _DEBUG
  168. m_bPHONGEXPONENTTEXTURE = false;
  169. #endif // _DEBUG
  170. m_nPHONGEXPONENTTEXTURE = 0;
  171. #ifdef _DEBUG
  172. m_bCUBEMAP = false;
  173. #endif // _DEBUG
  174. m_nCUBEMAP = 0;
  175. #ifdef _DEBUG
  176. m_bDECALSTYLE = false;
  177. #endif // _DEBUG
  178. m_nDECALSTYLE = 0;
  179. #ifdef _DEBUG
  180. m_bTHIRDPERSON = false;
  181. #endif // _DEBUG
  182. m_nTHIRDPERSON = 0;
  183. #ifdef _DEBUG
  184. m_bDESATBASETINT = false;
  185. #endif // _DEBUG
  186. m_nDESATBASETINT = 0;
  187. }
  188. int GetIndex()
  189. {
  190. // Asserts to make sure that we aren't using any skipped combinations.
  191. // Asserts to make sure that we are setting all of the combination vars.
  192. #ifdef _DEBUG
  193. bool bAllStaticVarsDefined = m_bPHONG && m_bPHONGEXPONENTTEXTURE && m_bCUBEMAP && m_bDECALSTYLE && m_bTHIRDPERSON && m_bDESATBASETINT;
  194. Assert( bAllStaticVarsDefined );
  195. #endif // _DEBUG
  196. return ( 40 * m_nPHONG ) + ( 80 * m_nPHONGEXPONENTTEXTURE ) + ( 160 * m_nCUBEMAP ) + ( 320 * m_nDECALSTYLE ) + ( 1920 * m_nTHIRDPERSON ) + ( 3840 * m_nDESATBASETINT ) + 0;
  197. }
  198. };
  199. #define shaderStaticTest_weapondecal_ps20b psh_forgot_to_set_static_PHONG + psh_forgot_to_set_static_PHONGEXPONENTTEXTURE + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_DECALSTYLE + psh_forgot_to_set_static_THIRDPERSON + psh_forgot_to_set_static_DESATBASETINT + 0
  200. class weapondecal_ps20b_Dynamic_Index
  201. {
  202. private:
  203. int m_nNUM_LIGHTS;
  204. #ifdef _DEBUG
  205. bool m_bNUM_LIGHTS;
  206. #endif
  207. public:
  208. void SetNUM_LIGHTS( int i )
  209. {
  210. Assert( i >= 0 && i <= 4 );
  211. m_nNUM_LIGHTS = i;
  212. #ifdef _DEBUG
  213. m_bNUM_LIGHTS = true;
  214. #endif
  215. }
  216. void SetNUM_LIGHTS( bool i )
  217. {
  218. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 4 );
  219. m_nNUM_LIGHTS = i ? 1 : 0;
  220. #ifdef _DEBUG
  221. m_bNUM_LIGHTS = true;
  222. #endif
  223. }
  224. private:
  225. int m_nDYN_CSM_ENABLED;
  226. #ifdef _DEBUG
  227. bool m_bDYN_CSM_ENABLED;
  228. #endif
  229. public:
  230. void SetDYN_CSM_ENABLED( int i )
  231. {
  232. Assert( i >= 0 && i <= 1 );
  233. m_nDYN_CSM_ENABLED = i;
  234. #ifdef _DEBUG
  235. m_bDYN_CSM_ENABLED = true;
  236. #endif
  237. }
  238. void SetDYN_CSM_ENABLED( bool i )
  239. {
  240. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  241. m_nDYN_CSM_ENABLED = i ? 1 : 0;
  242. #ifdef _DEBUG
  243. m_bDYN_CSM_ENABLED = true;
  244. #endif
  245. }
  246. private:
  247. int m_nHIGHLIGHT;
  248. #ifdef _DEBUG
  249. bool m_bHIGHLIGHT;
  250. #endif
  251. public:
  252. void SetHIGHLIGHT( int i )
  253. {
  254. Assert( i >= 0 && i <= 1 );
  255. m_nHIGHLIGHT = i;
  256. #ifdef _DEBUG
  257. m_bHIGHLIGHT = true;
  258. #endif
  259. }
  260. void SetHIGHLIGHT( bool i )
  261. {
  262. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  263. m_nHIGHLIGHT = i ? 1 : 0;
  264. #ifdef _DEBUG
  265. m_bHIGHLIGHT = true;
  266. #endif
  267. }
  268. private:
  269. int m_nPEEL;
  270. #ifdef _DEBUG
  271. bool m_bPEEL;
  272. #endif
  273. public:
  274. void SetPEEL( int i )
  275. {
  276. Assert( i >= 0 && i <= 1 );
  277. m_nPEEL = i;
  278. #ifdef _DEBUG
  279. m_bPEEL = true;
  280. #endif
  281. }
  282. void SetPEEL( bool i )
  283. {
  284. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  285. m_nPEEL = i ? 1 : 0;
  286. #ifdef _DEBUG
  287. m_bPEEL = true;
  288. #endif
  289. }
  290. public:
  291. // CONSTRUCTOR
  292. weapondecal_ps20b_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  293. {
  294. #ifdef _DEBUG
  295. m_bNUM_LIGHTS = false;
  296. #endif // _DEBUG
  297. m_nNUM_LIGHTS = 0;
  298. #ifdef _DEBUG
  299. m_bDYN_CSM_ENABLED = false;
  300. #endif // _DEBUG
  301. m_nDYN_CSM_ENABLED = 0;
  302. #ifdef _DEBUG
  303. m_bHIGHLIGHT = false;
  304. #endif // _DEBUG
  305. m_nHIGHLIGHT = 0;
  306. #ifdef _DEBUG
  307. m_bPEEL = false;
  308. #endif // _DEBUG
  309. m_nPEEL = 0;
  310. }
  311. int GetIndex()
  312. {
  313. // Asserts to make sure that we aren't using any skipped combinations.
  314. // Asserts to make sure that we are setting all of the combination vars.
  315. #ifdef _DEBUG
  316. bool bAllDynamicVarsDefined = m_bNUM_LIGHTS && m_bDYN_CSM_ENABLED && m_bHIGHLIGHT && m_bPEEL;
  317. Assert( bAllDynamicVarsDefined );
  318. #endif // _DEBUG
  319. return ( 1 * m_nNUM_LIGHTS ) + ( 5 * m_nDYN_CSM_ENABLED ) + ( 10 * m_nHIGHLIGHT ) + ( 20 * m_nPEEL ) + 0;
  320. }
  321. };
  322. #define shaderDynamicTest_weapondecal_ps20b psh_forgot_to_set_dynamic_NUM_LIGHTS + psh_forgot_to_set_dynamic_DYN_CSM_ENABLED + psh_forgot_to_set_dynamic_HIGHLIGHT + psh_forgot_to_set_dynamic_PEEL + 0
  323. static const ShaderComboInformation_t s_DynamicComboArray_weapondecal_ps20b[4] =
  324. {
  325. { "NUM_LIGHTS", 0, 4 },
  326. { "DYN_CSM_ENABLED", 0, 1 },
  327. { "HIGHLIGHT", 0, 1 },
  328. { "PEEL", 0, 1 },
  329. };
  330. static const ShaderComboInformation_t s_StaticComboArray_weapondecal_ps20b[6] =
  331. {
  332. { "PHONG", 0, 1 },
  333. { "PHONGEXPONENTTEXTURE", 0, 1 },
  334. { "CUBEMAP", 0, 1 },
  335. { "DECALSTYLE", 0, 5 },
  336. { "THIRDPERSON", 0, 1 },
  337. { "DESATBASETINT", 0, 1 },
  338. };
  339. static const ShaderComboSemantics_t weapondecal_ps20b_combos =
  340. {
  341. "weapondecal_ps20b", s_DynamicComboArray_weapondecal_ps20b, 4, s_StaticComboArray_weapondecal_ps20b, 6
  342. };
  343. class ConstructMe_weapondecal_ps20b
  344. {
  345. public:
  346. ConstructMe_weapondecal_ps20b()
  347. {
  348. GetShaderDLL()->AddShaderComboInformation( &weapondecal_ps20b_combos );
  349. }
  350. };
  351. static ConstructMe_weapondecal_ps20b s_ConstructMe_weapondecal_ps20b;