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.

397 lines
9.5 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  3. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  4. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  5. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  6. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  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. #include "shaderlib/cshader.h"
  13. class vortwarp_ps20b_Static_Index
  14. {
  15. private:
  16. int m_nBASETEXTURE;
  17. #ifdef _DEBUG
  18. bool m_bBASETEXTURE;
  19. #endif
  20. public:
  21. void SetBASETEXTURE( int i )
  22. {
  23. Assert( i >= 0 && i <= 1 );
  24. m_nBASETEXTURE = i;
  25. #ifdef _DEBUG
  26. m_bBASETEXTURE = true;
  27. #endif
  28. }
  29. void SetBASETEXTURE( bool i )
  30. {
  31. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  32. m_nBASETEXTURE = i ? 1 : 0;
  33. #ifdef _DEBUG
  34. m_bBASETEXTURE = true;
  35. #endif
  36. }
  37. private:
  38. int m_nCUBEMAP;
  39. #ifdef _DEBUG
  40. bool m_bCUBEMAP;
  41. #endif
  42. public:
  43. void SetCUBEMAP( int i )
  44. {
  45. Assert( i >= 0 && i <= 1 );
  46. m_nCUBEMAP = i;
  47. #ifdef _DEBUG
  48. m_bCUBEMAP = true;
  49. #endif
  50. }
  51. void SetCUBEMAP( bool i )
  52. {
  53. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  54. m_nCUBEMAP = i ? 1 : 0;
  55. #ifdef _DEBUG
  56. m_bCUBEMAP = true;
  57. #endif
  58. }
  59. private:
  60. int m_nDIFFUSELIGHTING;
  61. #ifdef _DEBUG
  62. bool m_bDIFFUSELIGHTING;
  63. #endif
  64. public:
  65. void SetDIFFUSELIGHTING( int i )
  66. {
  67. Assert( i >= 0 && i <= 1 );
  68. m_nDIFFUSELIGHTING = i;
  69. #ifdef _DEBUG
  70. m_bDIFFUSELIGHTING = true;
  71. #endif
  72. }
  73. void SetDIFFUSELIGHTING( bool i )
  74. {
  75. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  76. m_nDIFFUSELIGHTING = i ? 1 : 0;
  77. #ifdef _DEBUG
  78. m_bDIFFUSELIGHTING = true;
  79. #endif
  80. }
  81. private:
  82. int m_nNORMALMAPALPHAENVMAPMASK;
  83. #ifdef _DEBUG
  84. bool m_bNORMALMAPALPHAENVMAPMASK;
  85. #endif
  86. public:
  87. void SetNORMALMAPALPHAENVMAPMASK( int i )
  88. {
  89. Assert( i >= 0 && i <= 1 );
  90. m_nNORMALMAPALPHAENVMAPMASK = i;
  91. #ifdef _DEBUG
  92. m_bNORMALMAPALPHAENVMAPMASK = true;
  93. #endif
  94. }
  95. void SetNORMALMAPALPHAENVMAPMASK( bool i )
  96. {
  97. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  98. m_nNORMALMAPALPHAENVMAPMASK = i ? 1 : 0;
  99. #ifdef _DEBUG
  100. m_bNORMALMAPALPHAENVMAPMASK = true;
  101. #endif
  102. }
  103. private:
  104. int m_nHALFLAMBERT;
  105. #ifdef _DEBUG
  106. bool m_bHALFLAMBERT;
  107. #endif
  108. public:
  109. void SetHALFLAMBERT( int i )
  110. {
  111. Assert( i >= 0 && i <= 1 );
  112. m_nHALFLAMBERT = i;
  113. #ifdef _DEBUG
  114. m_bHALFLAMBERT = true;
  115. #endif
  116. }
  117. void SetHALFLAMBERT( bool i )
  118. {
  119. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  120. m_nHALFLAMBERT = i ? 1 : 0;
  121. #ifdef _DEBUG
  122. m_bHALFLAMBERT = true;
  123. #endif
  124. }
  125. private:
  126. int m_nFLASHLIGHT;
  127. #ifdef _DEBUG
  128. bool m_bFLASHLIGHT;
  129. #endif
  130. public:
  131. void SetFLASHLIGHT( int i )
  132. {
  133. Assert( i >= 0 && i <= 1 );
  134. m_nFLASHLIGHT = i;
  135. #ifdef _DEBUG
  136. m_bFLASHLIGHT = true;
  137. #endif
  138. }
  139. void SetFLASHLIGHT( bool i )
  140. {
  141. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  142. m_nFLASHLIGHT = i ? 1 : 0;
  143. #ifdef _DEBUG
  144. m_bFLASHLIGHT = true;
  145. #endif
  146. }
  147. private:
  148. int m_nTRANSLUCENT;
  149. #ifdef _DEBUG
  150. bool m_bTRANSLUCENT;
  151. #endif
  152. public:
  153. void SetTRANSLUCENT( int i )
  154. {
  155. Assert( i >= 0 && i <= 1 );
  156. m_nTRANSLUCENT = i;
  157. #ifdef _DEBUG
  158. m_bTRANSLUCENT = true;
  159. #endif
  160. }
  161. void SetTRANSLUCENT( bool i )
  162. {
  163. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  164. m_nTRANSLUCENT = i ? 1 : 0;
  165. #ifdef _DEBUG
  166. m_bTRANSLUCENT = true;
  167. #endif
  168. }
  169. public:
  170. // CONSTRUCTOR
  171. vortwarp_ps20b_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  172. {
  173. #ifdef _DEBUG
  174. m_bBASETEXTURE = false;
  175. #endif // _DEBUG
  176. m_nBASETEXTURE = 0;
  177. #ifdef _DEBUG
  178. m_bCUBEMAP = false;
  179. #endif // _DEBUG
  180. m_nCUBEMAP = 0;
  181. #ifdef _DEBUG
  182. m_bDIFFUSELIGHTING = false;
  183. #endif // _DEBUG
  184. m_nDIFFUSELIGHTING = 0;
  185. #ifdef _DEBUG
  186. m_bNORMALMAPALPHAENVMAPMASK = false;
  187. #endif // _DEBUG
  188. m_nNORMALMAPALPHAENVMAPMASK = 0;
  189. #ifdef _DEBUG
  190. m_bHALFLAMBERT = false;
  191. #endif // _DEBUG
  192. m_nHALFLAMBERT = 0;
  193. #ifdef _DEBUG
  194. m_bFLASHLIGHT = false;
  195. #endif // _DEBUG
  196. m_nFLASHLIGHT = 0;
  197. #ifdef _DEBUG
  198. m_bTRANSLUCENT = false;
  199. #endif // _DEBUG
  200. m_nTRANSLUCENT = 0;
  201. }
  202. int GetIndex()
  203. {
  204. // Asserts to make sure that we aren't using any skipped combinations.
  205. // Asserts to make sure that we are setting all of the combination vars.
  206. #ifdef _DEBUG
  207. bool bAllStaticVarsDefined = m_bBASETEXTURE && m_bCUBEMAP && m_bDIFFUSELIGHTING && m_bNORMALMAPALPHAENVMAPMASK && m_bHALFLAMBERT && m_bFLASHLIGHT && m_bTRANSLUCENT;
  208. Assert( bAllStaticVarsDefined );
  209. #endif // _DEBUG
  210. return ( 80 * m_nBASETEXTURE ) + ( 160 * m_nCUBEMAP ) + ( 320 * m_nDIFFUSELIGHTING ) + ( 640 * m_nNORMALMAPALPHAENVMAPMASK ) + ( 1280 * m_nHALFLAMBERT ) + ( 2560 * m_nFLASHLIGHT ) + ( 5120 * m_nTRANSLUCENT ) + 0;
  211. }
  212. };
  213. #define shaderStaticTest_vortwarp_ps20b psh_forgot_to_set_static_BASETEXTURE + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_DIFFUSELIGHTING + psh_forgot_to_set_static_NORMALMAPALPHAENVMAPMASK + psh_forgot_to_set_static_HALFLAMBERT + psh_forgot_to_set_static_FLASHLIGHT + psh_forgot_to_set_static_TRANSLUCENT + 0
  214. class vortwarp_ps20b_Dynamic_Index
  215. {
  216. private:
  217. int m_nWRITEWATERFOGTODESTALPHA;
  218. #ifdef _DEBUG
  219. bool m_bWRITEWATERFOGTODESTALPHA;
  220. #endif
  221. public:
  222. void SetWRITEWATERFOGTODESTALPHA( int i )
  223. {
  224. Assert( i >= 0 && i <= 1 );
  225. m_nWRITEWATERFOGTODESTALPHA = i;
  226. #ifdef _DEBUG
  227. m_bWRITEWATERFOGTODESTALPHA = true;
  228. #endif
  229. }
  230. void SetWRITEWATERFOGTODESTALPHA( bool i )
  231. {
  232. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  233. m_nWRITEWATERFOGTODESTALPHA = i ? 1 : 0;
  234. #ifdef _DEBUG
  235. m_bWRITEWATERFOGTODESTALPHA = true;
  236. #endif
  237. }
  238. private:
  239. int m_nPIXELFOGTYPE;
  240. #ifdef _DEBUG
  241. bool m_bPIXELFOGTYPE;
  242. #endif
  243. public:
  244. void SetPIXELFOGTYPE( int i )
  245. {
  246. Assert( i >= 0 && i <= 1 );
  247. m_nPIXELFOGTYPE = i;
  248. #ifdef _DEBUG
  249. m_bPIXELFOGTYPE = true;
  250. #endif
  251. }
  252. void SetPIXELFOGTYPE( bool i )
  253. {
  254. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  255. m_nPIXELFOGTYPE = i ? 1 : 0;
  256. #ifdef _DEBUG
  257. m_bPIXELFOGTYPE = true;
  258. #endif
  259. }
  260. private:
  261. int m_nWARPINGIN;
  262. #ifdef _DEBUG
  263. bool m_bWARPINGIN;
  264. #endif
  265. public:
  266. void SetWARPINGIN( int i )
  267. {
  268. Assert( i >= 0 && i <= 1 );
  269. m_nWARPINGIN = i;
  270. #ifdef _DEBUG
  271. m_bWARPINGIN = true;
  272. #endif
  273. }
  274. void SetWARPINGIN( bool i )
  275. {
  276. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  277. m_nWARPINGIN = i ? 1 : 0;
  278. #ifdef _DEBUG
  279. m_bWARPINGIN = true;
  280. #endif
  281. }
  282. private:
  283. int m_nAMBIENT_LIGHT;
  284. #ifdef _DEBUG
  285. bool m_bAMBIENT_LIGHT;
  286. #endif
  287. public:
  288. void SetAMBIENT_LIGHT( int i )
  289. {
  290. Assert( i >= 0 && i <= 1 );
  291. m_nAMBIENT_LIGHT = i;
  292. #ifdef _DEBUG
  293. m_bAMBIENT_LIGHT = true;
  294. #endif
  295. }
  296. void SetAMBIENT_LIGHT( bool i )
  297. {
  298. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  299. m_nAMBIENT_LIGHT = i ? 1 : 0;
  300. #ifdef _DEBUG
  301. m_bAMBIENT_LIGHT = true;
  302. #endif
  303. }
  304. private:
  305. int m_nNUM_LIGHTS;
  306. #ifdef _DEBUG
  307. bool m_bNUM_LIGHTS;
  308. #endif
  309. public:
  310. void SetNUM_LIGHTS( int i )
  311. {
  312. Assert( i >= 0 && i <= 4 );
  313. m_nNUM_LIGHTS = i;
  314. #ifdef _DEBUG
  315. m_bNUM_LIGHTS = true;
  316. #endif
  317. }
  318. void SetNUM_LIGHTS( bool i )
  319. {
  320. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 4 );
  321. m_nNUM_LIGHTS = i ? 1 : 0;
  322. #ifdef _DEBUG
  323. m_bNUM_LIGHTS = true;
  324. #endif
  325. }
  326. public:
  327. // CONSTRUCTOR
  328. vortwarp_ps20b_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  329. {
  330. #ifdef _DEBUG
  331. m_bWRITEWATERFOGTODESTALPHA = false;
  332. #endif // _DEBUG
  333. m_nWRITEWATERFOGTODESTALPHA = 0;
  334. #ifdef _DEBUG
  335. m_bPIXELFOGTYPE = true;
  336. #endif // _DEBUG
  337. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  338. #ifdef _DEBUG
  339. m_bWARPINGIN = false;
  340. #endif // _DEBUG
  341. m_nWARPINGIN = 0;
  342. #ifdef _DEBUG
  343. m_bAMBIENT_LIGHT = false;
  344. #endif // _DEBUG
  345. m_nAMBIENT_LIGHT = 0;
  346. #ifdef _DEBUG
  347. m_bNUM_LIGHTS = false;
  348. #endif // _DEBUG
  349. m_nNUM_LIGHTS = 0;
  350. }
  351. int GetIndex()
  352. {
  353. // Asserts to make sure that we aren't using any skipped combinations.
  354. // Asserts to make sure that we are setting all of the combination vars.
  355. #ifdef _DEBUG
  356. bool bAllDynamicVarsDefined = m_bWRITEWATERFOGTODESTALPHA && m_bPIXELFOGTYPE && m_bWARPINGIN && m_bAMBIENT_LIGHT && m_bNUM_LIGHTS;
  357. Assert( bAllDynamicVarsDefined );
  358. #endif // _DEBUG
  359. return ( 1 * m_nWRITEWATERFOGTODESTALPHA ) + ( 2 * m_nPIXELFOGTYPE ) + ( 4 * m_nWARPINGIN ) + ( 8 * m_nAMBIENT_LIGHT ) + ( 16 * m_nNUM_LIGHTS ) + 0;
  360. }
  361. };
  362. #define shaderDynamicTest_vortwarp_ps20b psh_forgot_to_set_dynamic_WRITEWATERFOGTODESTALPHA + psh_forgot_to_set_dynamic_WARPINGIN + psh_forgot_to_set_dynamic_AMBIENT_LIGHT + psh_forgot_to_set_dynamic_NUM_LIGHTS + 0
  363. static const ShaderComboInformation_t s_DynamicComboArray_vortwarp_ps20b[5] =
  364. {
  365. { "WRITEWATERFOGTODESTALPHA", 0, 1 },
  366. { "PIXELFOGTYPE", 0, 1 },
  367. { "WARPINGIN", 0, 1 },
  368. { "AMBIENT_LIGHT", 0, 1 },
  369. { "NUM_LIGHTS", 0, 4 },
  370. };
  371. static const ShaderComboInformation_t s_StaticComboArray_vortwarp_ps20b[7] =
  372. {
  373. { "BASETEXTURE", 0, 1 },
  374. { "CUBEMAP", 0, 1 },
  375. { "DIFFUSELIGHTING", 0, 1 },
  376. { "NORMALMAPALPHAENVMAPMASK", 0, 1 },
  377. { "HALFLAMBERT", 0, 1 },
  378. { "FLASHLIGHT", 0, 1 },
  379. { "TRANSLUCENT", 0, 1 },
  380. };
  381. static const ShaderComboSemantics_t vortwarp_ps20b_combos =
  382. {
  383. "vortwarp_ps20b", s_DynamicComboArray_vortwarp_ps20b, 5, s_StaticComboArray_vortwarp_ps20b, 7
  384. };
  385. class ConstructMe_vortwarp_ps20b
  386. {
  387. public:
  388. ConstructMe_vortwarp_ps20b()
  389. {
  390. GetShaderDLL()->AddShaderComboInformation( &vortwarp_ps20b_combos );
  391. }
  392. };
  393. static ConstructMe_vortwarp_ps20b s_ConstructMe_vortwarp_ps20b;