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.

398 lines
9.5 KiB

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