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.

413 lines
10 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_ps30_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_nCASCADED_SHADOW_MAPPING;
  55. #ifdef _DEBUG
  56. bool m_bCASCADED_SHADOW_MAPPING;
  57. #endif
  58. public:
  59. void SetCASCADED_SHADOW_MAPPING( int i )
  60. {
  61. Assert( i >= 0 && i <= 1 );
  62. m_nCASCADED_SHADOW_MAPPING = i;
  63. #ifdef _DEBUG
  64. m_bCASCADED_SHADOW_MAPPING = true;
  65. #endif
  66. }
  67. void SetCASCADED_SHADOW_MAPPING( bool i )
  68. {
  69. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  70. m_nCASCADED_SHADOW_MAPPING = i ? 1 : 0;
  71. #ifdef _DEBUG
  72. m_bCASCADED_SHADOW_MAPPING = true;
  73. #endif
  74. }
  75. private:
  76. int m_nCSM_MODE;
  77. #ifdef _DEBUG
  78. bool m_bCSM_MODE;
  79. #endif
  80. public:
  81. void SetCSM_MODE( int i )
  82. {
  83. Assert( i >= 0 && i <= 3 );
  84. m_nCSM_MODE = i;
  85. #ifdef _DEBUG
  86. m_bCSM_MODE = true;
  87. #endif
  88. }
  89. void SetCSM_MODE( bool i )
  90. {
  91. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 3 );
  92. m_nCSM_MODE = i ? 1 : 0;
  93. #ifdef _DEBUG
  94. m_bCSM_MODE = true;
  95. #endif
  96. }
  97. private:
  98. int m_nUSE_PATTERN1;
  99. #ifdef _DEBUG
  100. bool m_bUSE_PATTERN1;
  101. #endif
  102. public:
  103. void SetUSE_PATTERN1( int i )
  104. {
  105. Assert( i >= 0 && i <= 1 );
  106. m_nUSE_PATTERN1 = i;
  107. #ifdef _DEBUG
  108. m_bUSE_PATTERN1 = true;
  109. #endif
  110. }
  111. void SetUSE_PATTERN1( bool i )
  112. {
  113. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  114. m_nUSE_PATTERN1 = i ? 1 : 0;
  115. #ifdef _DEBUG
  116. m_bUSE_PATTERN1 = true;
  117. #endif
  118. }
  119. private:
  120. int m_nUSE_PATTERN2;
  121. #ifdef _DEBUG
  122. bool m_bUSE_PATTERN2;
  123. #endif
  124. public:
  125. void SetUSE_PATTERN2( int i )
  126. {
  127. Assert( i >= 0 && i <= 1 );
  128. m_nUSE_PATTERN2 = i;
  129. #ifdef _DEBUG
  130. m_bUSE_PATTERN2 = true;
  131. #endif
  132. }
  133. void SetUSE_PATTERN2( bool i )
  134. {
  135. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  136. m_nUSE_PATTERN2 = i ? 1 : 0;
  137. #ifdef _DEBUG
  138. m_bUSE_PATTERN2 = true;
  139. #endif
  140. }
  141. private:
  142. int m_nUSE_PATTERN_OFFSET;
  143. #ifdef _DEBUG
  144. bool m_bUSE_PATTERN_OFFSET;
  145. #endif
  146. public:
  147. void SetUSE_PATTERN_OFFSET( int i )
  148. {
  149. Assert( i >= 0 && i <= 1 );
  150. m_nUSE_PATTERN_OFFSET = i;
  151. #ifdef _DEBUG
  152. m_bUSE_PATTERN_OFFSET = true;
  153. #endif
  154. }
  155. void SetUSE_PATTERN_OFFSET( bool i )
  156. {
  157. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  158. m_nUSE_PATTERN_OFFSET = i ? 1 : 0;
  159. #ifdef _DEBUG
  160. m_bUSE_PATTERN_OFFSET = true;
  161. #endif
  162. }
  163. private:
  164. int m_nUSE_LOGO1;
  165. #ifdef _DEBUG
  166. bool m_bUSE_LOGO1;
  167. #endif
  168. public:
  169. void SetUSE_LOGO1( int i )
  170. {
  171. Assert( i >= 0 && i <= 1 );
  172. m_nUSE_LOGO1 = i;
  173. #ifdef _DEBUG
  174. m_bUSE_LOGO1 = true;
  175. #endif
  176. }
  177. void SetUSE_LOGO1( bool i )
  178. {
  179. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  180. m_nUSE_LOGO1 = i ? 1 : 0;
  181. #ifdef _DEBUG
  182. m_bUSE_LOGO1 = true;
  183. #endif
  184. }
  185. private:
  186. int m_nUSE_LOGO2;
  187. #ifdef _DEBUG
  188. bool m_bUSE_LOGO2;
  189. #endif
  190. public:
  191. void SetUSE_LOGO2( int i )
  192. {
  193. Assert( i >= 0 && i <= 1 );
  194. m_nUSE_LOGO2 = i;
  195. #ifdef _DEBUG
  196. m_bUSE_LOGO2 = true;
  197. #endif
  198. }
  199. void SetUSE_LOGO2( bool i )
  200. {
  201. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  202. m_nUSE_LOGO2 = i ? 1 : 0;
  203. #ifdef _DEBUG
  204. m_bUSE_LOGO2 = true;
  205. #endif
  206. }
  207. private:
  208. int m_nSWAP_PATTERN_MASKS;
  209. #ifdef _DEBUG
  210. bool m_bSWAP_PATTERN_MASKS;
  211. #endif
  212. public:
  213. void SetSWAP_PATTERN_MASKS( int i )
  214. {
  215. Assert( i >= 0 && i <= 1 );
  216. m_nSWAP_PATTERN_MASKS = i;
  217. #ifdef _DEBUG
  218. m_bSWAP_PATTERN_MASKS = true;
  219. #endif
  220. }
  221. void SetSWAP_PATTERN_MASKS( bool i )
  222. {
  223. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  224. m_nSWAP_PATTERN_MASKS = i ? 1 : 0;
  225. #ifdef _DEBUG
  226. m_bSWAP_PATTERN_MASKS = true;
  227. #endif
  228. }
  229. public:
  230. // CONSTRUCTOR
  231. customclothing_ps30_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  232. {
  233. #ifdef _DEBUG
  234. m_bCOMPOSITEMODE = false;
  235. #endif // _DEBUG
  236. m_nCOMPOSITEMODE = 0;
  237. #ifdef _DEBUG
  238. m_bCASCADED_SHADOW_MAPPING = false;
  239. #endif // _DEBUG
  240. m_nCASCADED_SHADOW_MAPPING = 0;
  241. #ifdef _DEBUG
  242. m_bCSM_MODE = false;
  243. #endif // _DEBUG
  244. m_nCSM_MODE = 0;
  245. #ifdef _DEBUG
  246. m_bUSE_PATTERN1 = false;
  247. #endif // _DEBUG
  248. m_nUSE_PATTERN1 = 0;
  249. #ifdef _DEBUG
  250. m_bUSE_PATTERN2 = false;
  251. #endif // _DEBUG
  252. m_nUSE_PATTERN2 = 0;
  253. #ifdef _DEBUG
  254. m_bUSE_PATTERN_OFFSET = false;
  255. #endif // _DEBUG
  256. m_nUSE_PATTERN_OFFSET = 0;
  257. #ifdef _DEBUG
  258. m_bUSE_LOGO1 = false;
  259. #endif // _DEBUG
  260. m_nUSE_LOGO1 = 0;
  261. #ifdef _DEBUG
  262. m_bUSE_LOGO2 = false;
  263. #endif // _DEBUG
  264. m_nUSE_LOGO2 = 0;
  265. #ifdef _DEBUG
  266. m_bSWAP_PATTERN_MASKS = false;
  267. #endif // _DEBUG
  268. m_nSWAP_PATTERN_MASKS = 0;
  269. }
  270. int GetIndex()
  271. {
  272. // Asserts to make sure that we aren't using any skipped combinations.
  273. // Asserts to make sure that we are setting all of the combination vars.
  274. #ifdef _DEBUG
  275. bool bAllStaticVarsDefined = m_bCOMPOSITEMODE && m_bCASCADED_SHADOW_MAPPING && m_bCSM_MODE && m_bUSE_PATTERN1 && m_bUSE_PATTERN2 && m_bUSE_PATTERN_OFFSET && m_bUSE_LOGO1 && m_bUSE_LOGO2 && m_bSWAP_PATTERN_MASKS;
  276. Assert( bAllStaticVarsDefined );
  277. #endif // _DEBUG
  278. return ( 20 * m_nCOMPOSITEMODE ) + ( 60 * m_nCASCADED_SHADOW_MAPPING ) + ( 120 * m_nCSM_MODE ) + ( 480 * m_nUSE_PATTERN1 ) + ( 960 * m_nUSE_PATTERN2 ) + ( 1920 * m_nUSE_PATTERN_OFFSET ) + ( 3840 * m_nUSE_LOGO1 ) + ( 7680 * m_nUSE_LOGO2 ) + ( 15360 * m_nSWAP_PATTERN_MASKS ) + 0;
  279. }
  280. };
  281. #define shaderStaticTest_customclothing_ps30 psh_forgot_to_set_static_COMPOSITEMODE + psh_forgot_to_set_static_CASCADED_SHADOW_MAPPING + psh_forgot_to_set_static_CSM_MODE + 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
  282. class customclothing_ps30_Dynamic_Index
  283. {
  284. private:
  285. int m_nNUM_LIGHTS;
  286. #ifdef _DEBUG
  287. bool m_bNUM_LIGHTS;
  288. #endif
  289. public:
  290. void SetNUM_LIGHTS( int i )
  291. {
  292. Assert( i >= 0 && i <= 4 );
  293. m_nNUM_LIGHTS = i;
  294. #ifdef _DEBUG
  295. m_bNUM_LIGHTS = true;
  296. #endif
  297. }
  298. void SetNUM_LIGHTS( bool i )
  299. {
  300. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 4 );
  301. m_nNUM_LIGHTS = i ? 1 : 0;
  302. #ifdef _DEBUG
  303. m_bNUM_LIGHTS = true;
  304. #endif
  305. }
  306. private:
  307. int m_nDYN_CSM_ENABLED;
  308. #ifdef _DEBUG
  309. bool m_bDYN_CSM_ENABLED;
  310. #endif
  311. public:
  312. void SetDYN_CSM_ENABLED( int i )
  313. {
  314. Assert( i >= 0 && i <= 1 );
  315. m_nDYN_CSM_ENABLED = i;
  316. #ifdef _DEBUG
  317. m_bDYN_CSM_ENABLED = true;
  318. #endif
  319. }
  320. void SetDYN_CSM_ENABLED( bool i )
  321. {
  322. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  323. m_nDYN_CSM_ENABLED = i ? 1 : 0;
  324. #ifdef _DEBUG
  325. m_bDYN_CSM_ENABLED = true;
  326. #endif
  327. }
  328. private:
  329. int m_nAO_MODE;
  330. #ifdef _DEBUG
  331. bool m_bAO_MODE;
  332. #endif
  333. public:
  334. void SetAO_MODE( int i )
  335. {
  336. Assert( i >= 0 && i <= 1 );
  337. m_nAO_MODE = i;
  338. #ifdef _DEBUG
  339. m_bAO_MODE = true;
  340. #endif
  341. }
  342. void SetAO_MODE( bool i )
  343. {
  344. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  345. m_nAO_MODE = i ? 1 : 0;
  346. #ifdef _DEBUG
  347. m_bAO_MODE = true;
  348. #endif
  349. }
  350. public:
  351. // CONSTRUCTOR
  352. customclothing_ps30_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  353. {
  354. #ifdef _DEBUG
  355. m_bNUM_LIGHTS = false;
  356. #endif // _DEBUG
  357. m_nNUM_LIGHTS = 0;
  358. #ifdef _DEBUG
  359. m_bDYN_CSM_ENABLED = false;
  360. #endif // _DEBUG
  361. m_nDYN_CSM_ENABLED = 0;
  362. #ifdef _DEBUG
  363. m_bAO_MODE = false;
  364. #endif // _DEBUG
  365. m_nAO_MODE = 0;
  366. }
  367. int GetIndex()
  368. {
  369. // Asserts to make sure that we aren't using any skipped combinations.
  370. // Asserts to make sure that we are setting all of the combination vars.
  371. #ifdef _DEBUG
  372. bool bAllDynamicVarsDefined = m_bNUM_LIGHTS && m_bDYN_CSM_ENABLED && m_bAO_MODE;
  373. Assert( bAllDynamicVarsDefined );
  374. #endif // _DEBUG
  375. return ( 1 * m_nNUM_LIGHTS ) + ( 5 * m_nDYN_CSM_ENABLED ) + ( 10 * m_nAO_MODE ) + 0;
  376. }
  377. };
  378. #define shaderDynamicTest_customclothing_ps30 psh_forgot_to_set_dynamic_NUM_LIGHTS + psh_forgot_to_set_dynamic_DYN_CSM_ENABLED + psh_forgot_to_set_dynamic_AO_MODE + 0
  379. static const ShaderComboInformation_t s_DynamicComboArray_customclothing_ps30[3] =
  380. {
  381. { "NUM_LIGHTS", 0, 4 },
  382. { "DYN_CSM_ENABLED", 0, 1 },
  383. { "AO_MODE", 0, 1 },
  384. };
  385. static const ShaderComboInformation_t s_StaticComboArray_customclothing_ps30[9] =
  386. {
  387. { "COMPOSITEMODE", 0, 2 },
  388. { "CASCADED_SHADOW_MAPPING", 0, 1 },
  389. { "CSM_MODE", 0, 3 },
  390. { "USE_PATTERN1", 0, 1 },
  391. { "USE_PATTERN2", 0, 1 },
  392. { "USE_PATTERN_OFFSET", 0, 1 },
  393. { "USE_LOGO1", 0, 1 },
  394. { "USE_LOGO2", 0, 1 },
  395. { "SWAP_PATTERN_MASKS", 0, 1 },
  396. };
  397. static const ShaderComboSemantics_t customclothing_ps30_combos =
  398. {
  399. "customclothing_ps30", s_DynamicComboArray_customclothing_ps30, 3, s_StaticComboArray_customclothing_ps30, 9
  400. };
  401. class ConstructMe_customclothing_ps30
  402. {
  403. public:
  404. ConstructMe_customclothing_ps30()
  405. {
  406. GetShaderDLL()->AddShaderComboInformation( &customclothing_ps30_combos );
  407. }
  408. };
  409. static ConstructMe_customclothing_ps30 s_ConstructMe_customclothing_ps30;