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.

410 lines
10 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $CASCADED_SHADOW_MAPPING == 0 ) && ( $DYN_CSM_ENABLED == 1 )
  3. // ( $HIGHLIGHT == 1 )
  4. // ( $HIGHLIGHT > 0 ) && ( $THIRDPERSON == 1 )
  5. // ( $HIGHLIGHT > 0 ) && ( $PEEL == 1 )
  6. // ( $PEEL == 1 ) && ( $THIRDPERSON == 1 )
  7. // ( $ALPHAMASK == 1 ) && ( $THIRDPERSON == 1 )
  8. // ( $ALPHAMASK == 1 ) && ( $HIGHLIGHT == 1 )
  9. // ( $ALPHAMASK == 1 ) && ( $PEEL == 1 )
  10. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  11. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  12. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  13. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  14. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  15. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  16. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  17. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  18. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  19. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  20. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  21. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  22. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  23. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  24. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  25. #include "shaderlib/cshader.h"
  26. class weapondecal_ps30_Static_Index
  27. {
  28. private:
  29. int m_nPHONG;
  30. #ifdef _DEBUG
  31. bool m_bPHONG;
  32. #endif
  33. public:
  34. void SetPHONG( int i )
  35. {
  36. Assert( i >= 0 && i <= 1 );
  37. m_nPHONG = i;
  38. #ifdef _DEBUG
  39. m_bPHONG = true;
  40. #endif
  41. }
  42. void SetPHONG( bool i )
  43. {
  44. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  45. m_nPHONG = i ? 1 : 0;
  46. #ifdef _DEBUG
  47. m_bPHONG = true;
  48. #endif
  49. }
  50. private:
  51. int m_nPHONGEXPONENTTEXTURE;
  52. #ifdef _DEBUG
  53. bool m_bPHONGEXPONENTTEXTURE;
  54. #endif
  55. public:
  56. void SetPHONGEXPONENTTEXTURE( int i )
  57. {
  58. Assert( i >= 0 && i <= 1 );
  59. m_nPHONGEXPONENTTEXTURE = i;
  60. #ifdef _DEBUG
  61. m_bPHONGEXPONENTTEXTURE = true;
  62. #endif
  63. }
  64. void SetPHONGEXPONENTTEXTURE( bool i )
  65. {
  66. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  67. m_nPHONGEXPONENTTEXTURE = i ? 1 : 0;
  68. #ifdef _DEBUG
  69. m_bPHONGEXPONENTTEXTURE = true;
  70. #endif
  71. }
  72. private:
  73. int m_nCUBEMAP;
  74. #ifdef _DEBUG
  75. bool m_bCUBEMAP;
  76. #endif
  77. public:
  78. void SetCUBEMAP( int i )
  79. {
  80. Assert( i >= 0 && i <= 1 );
  81. m_nCUBEMAP = i;
  82. #ifdef _DEBUG
  83. m_bCUBEMAP = true;
  84. #endif
  85. }
  86. void SetCUBEMAP( bool i )
  87. {
  88. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  89. m_nCUBEMAP = i ? 1 : 0;
  90. #ifdef _DEBUG
  91. m_bCUBEMAP = true;
  92. #endif
  93. }
  94. private:
  95. int m_nDECALSTYLE;
  96. #ifdef _DEBUG
  97. bool m_bDECALSTYLE;
  98. #endif
  99. public:
  100. void SetDECALSTYLE( int i )
  101. {
  102. Assert( i >= 0 && i <= 5 );
  103. m_nDECALSTYLE = i;
  104. #ifdef _DEBUG
  105. m_bDECALSTYLE = true;
  106. #endif
  107. }
  108. void SetDECALSTYLE( bool i )
  109. {
  110. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 5 );
  111. m_nDECALSTYLE = i ? 1 : 0;
  112. #ifdef _DEBUG
  113. m_bDECALSTYLE = true;
  114. #endif
  115. }
  116. private:
  117. int m_nTHIRDPERSON;
  118. #ifdef _DEBUG
  119. bool m_bTHIRDPERSON;
  120. #endif
  121. public:
  122. void SetTHIRDPERSON( int i )
  123. {
  124. Assert( i >= 0 && i <= 1 );
  125. m_nTHIRDPERSON = i;
  126. #ifdef _DEBUG
  127. m_bTHIRDPERSON = true;
  128. #endif
  129. }
  130. void SetTHIRDPERSON( bool i )
  131. {
  132. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  133. m_nTHIRDPERSON = i ? 1 : 0;
  134. #ifdef _DEBUG
  135. m_bTHIRDPERSON = true;
  136. #endif
  137. }
  138. private:
  139. int m_nCASCADED_SHADOW_MAPPING;
  140. #ifdef _DEBUG
  141. bool m_bCASCADED_SHADOW_MAPPING;
  142. #endif
  143. public:
  144. void SetCASCADED_SHADOW_MAPPING( int i )
  145. {
  146. Assert( i >= 0 && i <= 1 );
  147. m_nCASCADED_SHADOW_MAPPING = i;
  148. #ifdef _DEBUG
  149. m_bCASCADED_SHADOW_MAPPING = true;
  150. #endif
  151. }
  152. void SetCASCADED_SHADOW_MAPPING( bool i )
  153. {
  154. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  155. m_nCASCADED_SHADOW_MAPPING = i ? 1 : 0;
  156. #ifdef _DEBUG
  157. m_bCASCADED_SHADOW_MAPPING = true;
  158. #endif
  159. }
  160. private:
  161. int m_nALPHAMASK;
  162. #ifdef _DEBUG
  163. bool m_bALPHAMASK;
  164. #endif
  165. public:
  166. void SetALPHAMASK( int i )
  167. {
  168. Assert( i >= 0 && i <= 1 );
  169. m_nALPHAMASK = i;
  170. #ifdef _DEBUG
  171. m_bALPHAMASK = true;
  172. #endif
  173. }
  174. void SetALPHAMASK( bool i )
  175. {
  176. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  177. m_nALPHAMASK = i ? 1 : 0;
  178. #ifdef _DEBUG
  179. m_bALPHAMASK = true;
  180. #endif
  181. }
  182. private:
  183. int m_nDESATBASETINT;
  184. #ifdef _DEBUG
  185. bool m_bDESATBASETINT;
  186. #endif
  187. public:
  188. void SetDESATBASETINT( int i )
  189. {
  190. Assert( i >= 0 && i <= 1 );
  191. m_nDESATBASETINT = i;
  192. #ifdef _DEBUG
  193. m_bDESATBASETINT = true;
  194. #endif
  195. }
  196. void SetDESATBASETINT( bool i )
  197. {
  198. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  199. m_nDESATBASETINT = i ? 1 : 0;
  200. #ifdef _DEBUG
  201. m_bDESATBASETINT = true;
  202. #endif
  203. }
  204. public:
  205. // CONSTRUCTOR
  206. weapondecal_ps30_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  207. {
  208. #ifdef _DEBUG
  209. m_bPHONG = false;
  210. #endif // _DEBUG
  211. m_nPHONG = 0;
  212. #ifdef _DEBUG
  213. m_bPHONGEXPONENTTEXTURE = false;
  214. #endif // _DEBUG
  215. m_nPHONGEXPONENTTEXTURE = 0;
  216. #ifdef _DEBUG
  217. m_bCUBEMAP = false;
  218. #endif // _DEBUG
  219. m_nCUBEMAP = 0;
  220. #ifdef _DEBUG
  221. m_bDECALSTYLE = false;
  222. #endif // _DEBUG
  223. m_nDECALSTYLE = 0;
  224. #ifdef _DEBUG
  225. m_bTHIRDPERSON = false;
  226. #endif // _DEBUG
  227. m_nTHIRDPERSON = 0;
  228. #ifdef _DEBUG
  229. m_bCASCADED_SHADOW_MAPPING = false;
  230. #endif // _DEBUG
  231. m_nCASCADED_SHADOW_MAPPING = 0;
  232. #ifdef _DEBUG
  233. m_bALPHAMASK = false;
  234. #endif // _DEBUG
  235. m_nALPHAMASK = 0;
  236. #ifdef _DEBUG
  237. m_bDESATBASETINT = false;
  238. #endif // _DEBUG
  239. m_nDESATBASETINT = 0;
  240. }
  241. int GetIndex()
  242. {
  243. // Asserts to make sure that we aren't using any skipped combinations.
  244. // Asserts to make sure that we are setting all of the combination vars.
  245. #ifdef _DEBUG
  246. bool bAllStaticVarsDefined = m_bPHONG && m_bPHONGEXPONENTTEXTURE && m_bCUBEMAP && m_bDECALSTYLE && m_bTHIRDPERSON && m_bCASCADED_SHADOW_MAPPING && m_bALPHAMASK && m_bDESATBASETINT;
  247. Assert( bAllStaticVarsDefined );
  248. #endif // _DEBUG
  249. return ( 60 * m_nPHONG ) + ( 120 * m_nPHONGEXPONENTTEXTURE ) + ( 240 * m_nCUBEMAP ) + ( 480 * m_nDECALSTYLE ) + ( 2880 * m_nTHIRDPERSON ) + ( 5760 * m_nCASCADED_SHADOW_MAPPING ) + ( 11520 * m_nALPHAMASK ) + ( 23040 * m_nDESATBASETINT ) + 0;
  250. }
  251. };
  252. #define shaderStaticTest_weapondecal_ps30 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_CASCADED_SHADOW_MAPPING + psh_forgot_to_set_static_ALPHAMASK + psh_forgot_to_set_static_DESATBASETINT + 0
  253. class weapondecal_ps30_Dynamic_Index
  254. {
  255. private:
  256. int m_nNUM_LIGHTS;
  257. #ifdef _DEBUG
  258. bool m_bNUM_LIGHTS;
  259. #endif
  260. public:
  261. void SetNUM_LIGHTS( int i )
  262. {
  263. Assert( i >= 0 && i <= 4 );
  264. m_nNUM_LIGHTS = i;
  265. #ifdef _DEBUG
  266. m_bNUM_LIGHTS = true;
  267. #endif
  268. }
  269. void SetNUM_LIGHTS( bool i )
  270. {
  271. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 4 );
  272. m_nNUM_LIGHTS = i ? 1 : 0;
  273. #ifdef _DEBUG
  274. m_bNUM_LIGHTS = true;
  275. #endif
  276. }
  277. private:
  278. int m_nDYN_CSM_ENABLED;
  279. #ifdef _DEBUG
  280. bool m_bDYN_CSM_ENABLED;
  281. #endif
  282. public:
  283. void SetDYN_CSM_ENABLED( int i )
  284. {
  285. Assert( i >= 0 && i <= 1 );
  286. m_nDYN_CSM_ENABLED = i;
  287. #ifdef _DEBUG
  288. m_bDYN_CSM_ENABLED = true;
  289. #endif
  290. }
  291. void SetDYN_CSM_ENABLED( bool i )
  292. {
  293. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  294. m_nDYN_CSM_ENABLED = i ? 1 : 0;
  295. #ifdef _DEBUG
  296. m_bDYN_CSM_ENABLED = true;
  297. #endif
  298. }
  299. private:
  300. int m_nHIGHLIGHT;
  301. #ifdef _DEBUG
  302. bool m_bHIGHLIGHT;
  303. #endif
  304. public:
  305. void SetHIGHLIGHT( int i )
  306. {
  307. Assert( i >= 0 && i <= 2 );
  308. m_nHIGHLIGHT = i;
  309. #ifdef _DEBUG
  310. m_bHIGHLIGHT = true;
  311. #endif
  312. }
  313. void SetHIGHLIGHT( bool i )
  314. {
  315. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  316. m_nHIGHLIGHT = i ? 1 : 0;
  317. #ifdef _DEBUG
  318. m_bHIGHLIGHT = true;
  319. #endif
  320. }
  321. private:
  322. int m_nPEEL;
  323. #ifdef _DEBUG
  324. bool m_bPEEL;
  325. #endif
  326. public:
  327. void SetPEEL( int i )
  328. {
  329. Assert( i >= 0 && i <= 1 );
  330. m_nPEEL = i;
  331. #ifdef _DEBUG
  332. m_bPEEL = true;
  333. #endif
  334. }
  335. void SetPEEL( bool i )
  336. {
  337. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  338. m_nPEEL = i ? 1 : 0;
  339. #ifdef _DEBUG
  340. m_bPEEL = true;
  341. #endif
  342. }
  343. public:
  344. // CONSTRUCTOR
  345. weapondecal_ps30_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  346. {
  347. #ifdef _DEBUG
  348. m_bNUM_LIGHTS = false;
  349. #endif // _DEBUG
  350. m_nNUM_LIGHTS = 0;
  351. #ifdef _DEBUG
  352. m_bDYN_CSM_ENABLED = false;
  353. #endif // _DEBUG
  354. m_nDYN_CSM_ENABLED = 0;
  355. #ifdef _DEBUG
  356. m_bHIGHLIGHT = false;
  357. #endif // _DEBUG
  358. m_nHIGHLIGHT = 0;
  359. #ifdef _DEBUG
  360. m_bPEEL = false;
  361. #endif // _DEBUG
  362. m_nPEEL = 0;
  363. }
  364. int GetIndex()
  365. {
  366. // Asserts to make sure that we aren't using any skipped combinations.
  367. // Asserts to make sure that we are setting all of the combination vars.
  368. #ifdef _DEBUG
  369. bool bAllDynamicVarsDefined = m_bNUM_LIGHTS && m_bDYN_CSM_ENABLED && m_bHIGHLIGHT && m_bPEEL;
  370. Assert( bAllDynamicVarsDefined );
  371. #endif // _DEBUG
  372. return ( 1 * m_nNUM_LIGHTS ) + ( 5 * m_nDYN_CSM_ENABLED ) + ( 10 * m_nHIGHLIGHT ) + ( 30 * m_nPEEL ) + 0;
  373. }
  374. };
  375. #define shaderDynamicTest_weapondecal_ps30 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
  376. static const ShaderComboInformation_t s_DynamicComboArray_weapondecal_ps30[4] =
  377. {
  378. { "NUM_LIGHTS", 0, 4 },
  379. { "DYN_CSM_ENABLED", 0, 1 },
  380. { "HIGHLIGHT", 0, 2 },
  381. { "PEEL", 0, 1 },
  382. };
  383. static const ShaderComboInformation_t s_StaticComboArray_weapondecal_ps30[8] =
  384. {
  385. { "PHONG", 0, 1 },
  386. { "PHONGEXPONENTTEXTURE", 0, 1 },
  387. { "CUBEMAP", 0, 1 },
  388. { "DECALSTYLE", 0, 5 },
  389. { "THIRDPERSON", 0, 1 },
  390. { "CASCADED_SHADOW_MAPPING", 0, 1 },
  391. { "ALPHAMASK", 0, 1 },
  392. { "DESATBASETINT", 0, 1 },
  393. };
  394. static const ShaderComboSemantics_t weapondecal_ps30_combos =
  395. {
  396. "weapondecal_ps30", s_DynamicComboArray_weapondecal_ps30, 4, s_StaticComboArray_weapondecal_ps30, 8
  397. };
  398. class ConstructMe_weapondecal_ps30
  399. {
  400. public:
  401. ConstructMe_weapondecal_ps30()
  402. {
  403. GetShaderDLL()->AddShaderComboInformation( &weapondecal_ps30_combos );
  404. }
  405. };
  406. static ConstructMe_weapondecal_ps30 s_ConstructMe_weapondecal_ps30;