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.

386 lines
9.7 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( ( $COMPOSITEMODE == 1 ) && ( $CASCADED_SHADOW_MAPPING != 0 ) )
  3. // ( ( $COMPOSITEMODE == 1 ) && ( $NUM_LIGHTS != 0 ) )
  4. // ( $CASCADED_SHADOW_MAPPING == 0 ) && ( $DYN_CSM_ENABLED == 1 )
  5. // ( $CASCADED_SHADOW_MAPPING == 0 ) && ( $CSM_MODE != 0 )
  6. // ( $USE_PATTERN2 == 1 ) && ( $USE_PATTERN1 == 0 )
  7. // ( $USE_PATTERN_OFFSET == 1 ) && ( $USE_PATTERN1 == 0 && $USE_PATTERN2 == 0 )
  8. // ( $SWAP_PATTERN_MASKS == 1 ) && ( $USE_PATTERN1 == 0 && $USE_PATTERN2 == 0 )
  9. // ( $USE_LOGO2 == 1 ) && ( $USE_LOGO1 == 0 )
  10. // ( $COMPOSITEMODE == 2 ) && ( $USE_PATTERN1 == 1 )
  11. // ( $COMPOSITEMODE == 2 ) && ( $USE_PATTERN2 == 1 )
  12. // ( $COMPOSITEMODE == 2 ) && ( $USE_PATTERN_OFFSET == 1 )
  13. // ( $COMPOSITEMODE == 2 ) && ( $USE_LOGO1 == 1 )
  14. // ( $COMPOSITEMODE == 2 ) && ( $USE_LOGO2 == 1 )
  15. // ( $AO_MODE == 1 ) && ( $COMPOSITEMODE == 1 )
  16. // ( $AO_MODE == 1 ) && ( $NUM_LIGHTS != 0 )
  17. // ( $AO_MODE == 1 ) && ( $DYN_CSM_ENABLED == 1 )
  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. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  24. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  25. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  26. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  27. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  28. #include "shaderlib/cshader.h"
  29. class customclothing_ps20b_Static_Index
  30. {
  31. private:
  32. int m_nCOMPOSITEMODE;
  33. #ifdef _DEBUG
  34. bool m_bCOMPOSITEMODE;
  35. #endif
  36. public:
  37. void SetCOMPOSITEMODE( int i )
  38. {
  39. Assert( i >= 0 && i <= 2 );
  40. m_nCOMPOSITEMODE = i;
  41. #ifdef _DEBUG
  42. m_bCOMPOSITEMODE = true;
  43. #endif
  44. }
  45. void SetCOMPOSITEMODE( bool i )
  46. {
  47. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  48. m_nCOMPOSITEMODE = i ? 1 : 0;
  49. #ifdef _DEBUG
  50. m_bCOMPOSITEMODE = true;
  51. #endif
  52. }
  53. private:
  54. int m_nCSM_MODE;
  55. #ifdef _DEBUG
  56. bool m_bCSM_MODE;
  57. #endif
  58. public:
  59. void SetCSM_MODE( int i )
  60. {
  61. Assert( i >= 0 && i <= 0 );
  62. m_nCSM_MODE = i;
  63. #ifdef _DEBUG
  64. m_bCSM_MODE = true;
  65. #endif
  66. }
  67. void SetCSM_MODE( bool i )
  68. {
  69. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  70. m_nCSM_MODE = i ? 1 : 0;
  71. #ifdef _DEBUG
  72. m_bCSM_MODE = true;
  73. #endif
  74. }
  75. private:
  76. int m_nUSE_PATTERN1;
  77. #ifdef _DEBUG
  78. bool m_bUSE_PATTERN1;
  79. #endif
  80. public:
  81. void SetUSE_PATTERN1( int i )
  82. {
  83. Assert( i >= 0 && i <= 1 );
  84. m_nUSE_PATTERN1 = i;
  85. #ifdef _DEBUG
  86. m_bUSE_PATTERN1 = true;
  87. #endif
  88. }
  89. void SetUSE_PATTERN1( bool i )
  90. {
  91. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  92. m_nUSE_PATTERN1 = i ? 1 : 0;
  93. #ifdef _DEBUG
  94. m_bUSE_PATTERN1 = true;
  95. #endif
  96. }
  97. private:
  98. int m_nUSE_PATTERN2;
  99. #ifdef _DEBUG
  100. bool m_bUSE_PATTERN2;
  101. #endif
  102. public:
  103. void SetUSE_PATTERN2( int i )
  104. {
  105. Assert( i >= 0 && i <= 1 );
  106. m_nUSE_PATTERN2 = i;
  107. #ifdef _DEBUG
  108. m_bUSE_PATTERN2 = true;
  109. #endif
  110. }
  111. void SetUSE_PATTERN2( bool i )
  112. {
  113. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  114. m_nUSE_PATTERN2 = i ? 1 : 0;
  115. #ifdef _DEBUG
  116. m_bUSE_PATTERN2 = true;
  117. #endif
  118. }
  119. private:
  120. int m_nUSE_PATTERN_OFFSET;
  121. #ifdef _DEBUG
  122. bool m_bUSE_PATTERN_OFFSET;
  123. #endif
  124. public:
  125. void SetUSE_PATTERN_OFFSET( int i )
  126. {
  127. Assert( i >= 0 && i <= 1 );
  128. m_nUSE_PATTERN_OFFSET = i;
  129. #ifdef _DEBUG
  130. m_bUSE_PATTERN_OFFSET = true;
  131. #endif
  132. }
  133. void SetUSE_PATTERN_OFFSET( bool i )
  134. {
  135. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  136. m_nUSE_PATTERN_OFFSET = i ? 1 : 0;
  137. #ifdef _DEBUG
  138. m_bUSE_PATTERN_OFFSET = true;
  139. #endif
  140. }
  141. private:
  142. int m_nUSE_LOGO1;
  143. #ifdef _DEBUG
  144. bool m_bUSE_LOGO1;
  145. #endif
  146. public:
  147. void SetUSE_LOGO1( int i )
  148. {
  149. Assert( i >= 0 && i <= 1 );
  150. m_nUSE_LOGO1 = i;
  151. #ifdef _DEBUG
  152. m_bUSE_LOGO1 = true;
  153. #endif
  154. }
  155. void SetUSE_LOGO1( bool i )
  156. {
  157. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  158. m_nUSE_LOGO1 = i ? 1 : 0;
  159. #ifdef _DEBUG
  160. m_bUSE_LOGO1 = true;
  161. #endif
  162. }
  163. private:
  164. int m_nUSE_LOGO2;
  165. #ifdef _DEBUG
  166. bool m_bUSE_LOGO2;
  167. #endif
  168. public:
  169. void SetUSE_LOGO2( int i )
  170. {
  171. Assert( i >= 0 && i <= 1 );
  172. m_nUSE_LOGO2 = i;
  173. #ifdef _DEBUG
  174. m_bUSE_LOGO2 = true;
  175. #endif
  176. }
  177. void SetUSE_LOGO2( bool i )
  178. {
  179. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  180. m_nUSE_LOGO2 = i ? 1 : 0;
  181. #ifdef _DEBUG
  182. m_bUSE_LOGO2 = true;
  183. #endif
  184. }
  185. private:
  186. int m_nSWAP_PATTERN_MASKS;
  187. #ifdef _DEBUG
  188. bool m_bSWAP_PATTERN_MASKS;
  189. #endif
  190. public:
  191. void SetSWAP_PATTERN_MASKS( int i )
  192. {
  193. Assert( i >= 0 && i <= 1 );
  194. m_nSWAP_PATTERN_MASKS = i;
  195. #ifdef _DEBUG
  196. m_bSWAP_PATTERN_MASKS = true;
  197. #endif
  198. }
  199. void SetSWAP_PATTERN_MASKS( bool i )
  200. {
  201. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  202. m_nSWAP_PATTERN_MASKS = i ? 1 : 0;
  203. #ifdef _DEBUG
  204. m_bSWAP_PATTERN_MASKS = true;
  205. #endif
  206. }
  207. public:
  208. // CONSTRUCTOR
  209. customclothing_ps20b_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  210. {
  211. #ifdef _DEBUG
  212. m_bCOMPOSITEMODE = false;
  213. #endif // _DEBUG
  214. m_nCOMPOSITEMODE = 0;
  215. #ifdef _DEBUG
  216. m_bCSM_MODE = true;
  217. #endif // _DEBUG
  218. m_nCSM_MODE = 0 ;
  219. #ifdef _DEBUG
  220. m_bUSE_PATTERN1 = false;
  221. #endif // _DEBUG
  222. m_nUSE_PATTERN1 = 0;
  223. #ifdef _DEBUG
  224. m_bUSE_PATTERN2 = false;
  225. #endif // _DEBUG
  226. m_nUSE_PATTERN2 = 0;
  227. #ifdef _DEBUG
  228. m_bUSE_PATTERN_OFFSET = false;
  229. #endif // _DEBUG
  230. m_nUSE_PATTERN_OFFSET = 0;
  231. #ifdef _DEBUG
  232. m_bUSE_LOGO1 = false;
  233. #endif // _DEBUG
  234. m_nUSE_LOGO1 = 0;
  235. #ifdef _DEBUG
  236. m_bUSE_LOGO2 = false;
  237. #endif // _DEBUG
  238. m_nUSE_LOGO2 = 0;
  239. #ifdef _DEBUG
  240. m_bSWAP_PATTERN_MASKS = false;
  241. #endif // _DEBUG
  242. m_nSWAP_PATTERN_MASKS = 0;
  243. }
  244. int GetIndex()
  245. {
  246. // Asserts to make sure that we aren't using any skipped combinations.
  247. // Asserts to make sure that we are setting all of the combination vars.
  248. #ifdef _DEBUG
  249. bool bAllStaticVarsDefined = m_bCOMPOSITEMODE && m_bCSM_MODE && m_bUSE_PATTERN1 && m_bUSE_PATTERN2 && m_bUSE_PATTERN_OFFSET && m_bUSE_LOGO1 && m_bUSE_LOGO2 && m_bSWAP_PATTERN_MASKS;
  250. Assert( bAllStaticVarsDefined );
  251. #endif // _DEBUG
  252. return ( 20 * m_nCOMPOSITEMODE ) + ( 60 * m_nCSM_MODE ) + ( 60 * m_nUSE_PATTERN1 ) + ( 120 * m_nUSE_PATTERN2 ) + ( 240 * m_nUSE_PATTERN_OFFSET ) + ( 480 * m_nUSE_LOGO1 ) + ( 960 * m_nUSE_LOGO2 ) + ( 1920 * m_nSWAP_PATTERN_MASKS ) + 0;
  253. }
  254. };
  255. #define shaderStaticTest_customclothing_ps20b psh_forgot_to_set_static_COMPOSITEMODE + psh_forgot_to_set_static_USE_PATTERN1 + psh_forgot_to_set_static_USE_PATTERN2 + psh_forgot_to_set_static_USE_PATTERN_OFFSET + psh_forgot_to_set_static_USE_LOGO1 + psh_forgot_to_set_static_USE_LOGO2 + psh_forgot_to_set_static_SWAP_PATTERN_MASKS + 0
  256. class customclothing_ps20b_Dynamic_Index
  257. {
  258. private:
  259. int m_nNUM_LIGHTS;
  260. #ifdef _DEBUG
  261. bool m_bNUM_LIGHTS;
  262. #endif
  263. public:
  264. void SetNUM_LIGHTS( int i )
  265. {
  266. Assert( i >= 0 && i <= 4 );
  267. m_nNUM_LIGHTS = i;
  268. #ifdef _DEBUG
  269. m_bNUM_LIGHTS = true;
  270. #endif
  271. }
  272. void SetNUM_LIGHTS( bool i )
  273. {
  274. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 4 );
  275. m_nNUM_LIGHTS = i ? 1 : 0;
  276. #ifdef _DEBUG
  277. m_bNUM_LIGHTS = true;
  278. #endif
  279. }
  280. private:
  281. int m_nDYN_CSM_ENABLED;
  282. #ifdef _DEBUG
  283. bool m_bDYN_CSM_ENABLED;
  284. #endif
  285. public:
  286. void SetDYN_CSM_ENABLED( int i )
  287. {
  288. Assert( i >= 0 && i <= 1 );
  289. m_nDYN_CSM_ENABLED = i;
  290. #ifdef _DEBUG
  291. m_bDYN_CSM_ENABLED = true;
  292. #endif
  293. }
  294. void SetDYN_CSM_ENABLED( bool i )
  295. {
  296. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  297. m_nDYN_CSM_ENABLED = i ? 1 : 0;
  298. #ifdef _DEBUG
  299. m_bDYN_CSM_ENABLED = true;
  300. #endif
  301. }
  302. private:
  303. int m_nAO_MODE;
  304. #ifdef _DEBUG
  305. bool m_bAO_MODE;
  306. #endif
  307. public:
  308. void SetAO_MODE( int i )
  309. {
  310. Assert( i >= 0 && i <= 1 );
  311. m_nAO_MODE = i;
  312. #ifdef _DEBUG
  313. m_bAO_MODE = true;
  314. #endif
  315. }
  316. void SetAO_MODE( bool i )
  317. {
  318. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  319. m_nAO_MODE = i ? 1 : 0;
  320. #ifdef _DEBUG
  321. m_bAO_MODE = true;
  322. #endif
  323. }
  324. public:
  325. // CONSTRUCTOR
  326. customclothing_ps20b_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  327. {
  328. #ifdef _DEBUG
  329. m_bNUM_LIGHTS = false;
  330. #endif // _DEBUG
  331. m_nNUM_LIGHTS = 0;
  332. #ifdef _DEBUG
  333. m_bDYN_CSM_ENABLED = false;
  334. #endif // _DEBUG
  335. m_nDYN_CSM_ENABLED = 0;
  336. #ifdef _DEBUG
  337. m_bAO_MODE = false;
  338. #endif // _DEBUG
  339. m_nAO_MODE = 0;
  340. }
  341. int GetIndex()
  342. {
  343. // Asserts to make sure that we aren't using any skipped combinations.
  344. // Asserts to make sure that we are setting all of the combination vars.
  345. #ifdef _DEBUG
  346. bool bAllDynamicVarsDefined = m_bNUM_LIGHTS && m_bDYN_CSM_ENABLED && m_bAO_MODE;
  347. Assert( bAllDynamicVarsDefined );
  348. #endif // _DEBUG
  349. return ( 1 * m_nNUM_LIGHTS ) + ( 5 * m_nDYN_CSM_ENABLED ) + ( 10 * m_nAO_MODE ) + 0;
  350. }
  351. };
  352. #define shaderDynamicTest_customclothing_ps20b psh_forgot_to_set_dynamic_NUM_LIGHTS + psh_forgot_to_set_dynamic_DYN_CSM_ENABLED + psh_forgot_to_set_dynamic_AO_MODE + 0
  353. static const ShaderComboInformation_t s_DynamicComboArray_customclothing_ps20b[3] =
  354. {
  355. { "NUM_LIGHTS", 0, 4 },
  356. { "DYN_CSM_ENABLED", 0, 1 },
  357. { "AO_MODE", 0, 1 },
  358. };
  359. static const ShaderComboInformation_t s_StaticComboArray_customclothing_ps20b[8] =
  360. {
  361. { "COMPOSITEMODE", 0, 2 },
  362. { "CSM_MODE", 0, 0 },
  363. { "USE_PATTERN1", 0, 1 },
  364. { "USE_PATTERN2", 0, 1 },
  365. { "USE_PATTERN_OFFSET", 0, 1 },
  366. { "USE_LOGO1", 0, 1 },
  367. { "USE_LOGO2", 0, 1 },
  368. { "SWAP_PATTERN_MASKS", 0, 1 },
  369. };
  370. static const ShaderComboSemantics_t customclothing_ps20b_combos =
  371. {
  372. "customclothing_ps20b", s_DynamicComboArray_customclothing_ps20b, 3, s_StaticComboArray_customclothing_ps20b, 8
  373. };
  374. class ConstructMe_customclothing_ps20b
  375. {
  376. public:
  377. ConstructMe_customclothing_ps20b()
  378. {
  379. GetShaderDLL()->AddShaderComboInformation( &customclothing_ps20b_combos );
  380. }
  381. };
  382. static ConstructMe_customclothing_ps20b s_ConstructMe_customclothing_ps20b;