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.

448 lines
9.7 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( ( $DETAIL1 == 0 ) && ( $DETAIL2 != 0 ) )
  3. // ( $TANGENTTOPACITY && $TANGENTSOPACITY )
  4. // ( $FLOWMAP && ( $DETAIL1 || $DETAIL2 ) )
  5. // ( ( $FLOWMAP == 0 ) && ( $VORTEX1 || $VORTEX2 ) )
  6. // ( $DOWATERFOG == 0 ) && ( $DOPIXELFOG && $HARDWAREFOGBLEND )
  7. // ( $DOWATERFOG == 0 ) && ( $HARDWAREFOGBLEND == 0 ) && ( $DOPIXELFOG == 0 )
  8. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  9. #include "shaderlib/cshader.h"
  10. class solidenergy_vs20_Static_Index
  11. {
  12. private:
  13. int m_nDETAIL1;
  14. #ifdef _DEBUG
  15. bool m_bDETAIL1;
  16. #endif
  17. public:
  18. void SetDETAIL1( int i )
  19. {
  20. Assert( i >= 0 && i <= 1 );
  21. m_nDETAIL1 = i;
  22. #ifdef _DEBUG
  23. m_bDETAIL1 = true;
  24. #endif
  25. }
  26. void SetDETAIL1( bool i )
  27. {
  28. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  29. m_nDETAIL1 = i ? 1 : 0;
  30. #ifdef _DEBUG
  31. m_bDETAIL1 = true;
  32. #endif
  33. }
  34. private:
  35. int m_nDETAIL2;
  36. #ifdef _DEBUG
  37. bool m_bDETAIL2;
  38. #endif
  39. public:
  40. void SetDETAIL2( int i )
  41. {
  42. Assert( i >= 0 && i <= 1 );
  43. m_nDETAIL2 = i;
  44. #ifdef _DEBUG
  45. m_bDETAIL2 = true;
  46. #endif
  47. }
  48. void SetDETAIL2( bool i )
  49. {
  50. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  51. m_nDETAIL2 = i ? 1 : 0;
  52. #ifdef _DEBUG
  53. m_bDETAIL2 = true;
  54. #endif
  55. }
  56. private:
  57. int m_nTANGENTTOPACITY;
  58. #ifdef _DEBUG
  59. bool m_bTANGENTTOPACITY;
  60. #endif
  61. public:
  62. void SetTANGENTTOPACITY( int i )
  63. {
  64. Assert( i >= 0 && i <= 1 );
  65. m_nTANGENTTOPACITY = i;
  66. #ifdef _DEBUG
  67. m_bTANGENTTOPACITY = true;
  68. #endif
  69. }
  70. void SetTANGENTTOPACITY( bool i )
  71. {
  72. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  73. m_nTANGENTTOPACITY = i ? 1 : 0;
  74. #ifdef _DEBUG
  75. m_bTANGENTTOPACITY = true;
  76. #endif
  77. }
  78. private:
  79. int m_nTANGENTSOPACITY;
  80. #ifdef _DEBUG
  81. bool m_bTANGENTSOPACITY;
  82. #endif
  83. public:
  84. void SetTANGENTSOPACITY( int i )
  85. {
  86. Assert( i >= 0 && i <= 1 );
  87. m_nTANGENTSOPACITY = i;
  88. #ifdef _DEBUG
  89. m_bTANGENTSOPACITY = true;
  90. #endif
  91. }
  92. void SetTANGENTSOPACITY( bool i )
  93. {
  94. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  95. m_nTANGENTSOPACITY = i ? 1 : 0;
  96. #ifdef _DEBUG
  97. m_bTANGENTSOPACITY = true;
  98. #endif
  99. }
  100. private:
  101. int m_nFRESNELOPACITY;
  102. #ifdef _DEBUG
  103. bool m_bFRESNELOPACITY;
  104. #endif
  105. public:
  106. void SetFRESNELOPACITY( int i )
  107. {
  108. Assert( i >= 0 && i <= 1 );
  109. m_nFRESNELOPACITY = i;
  110. #ifdef _DEBUG
  111. m_bFRESNELOPACITY = true;
  112. #endif
  113. }
  114. void SetFRESNELOPACITY( bool i )
  115. {
  116. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  117. m_nFRESNELOPACITY = i ? 1 : 0;
  118. #ifdef _DEBUG
  119. m_bFRESNELOPACITY = true;
  120. #endif
  121. }
  122. private:
  123. int m_nVERTEXCOLOR;
  124. #ifdef _DEBUG
  125. bool m_bVERTEXCOLOR;
  126. #endif
  127. public:
  128. void SetVERTEXCOLOR( int i )
  129. {
  130. Assert( i >= 0 && i <= 1 );
  131. m_nVERTEXCOLOR = i;
  132. #ifdef _DEBUG
  133. m_bVERTEXCOLOR = true;
  134. #endif
  135. }
  136. void SetVERTEXCOLOR( bool i )
  137. {
  138. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  139. m_nVERTEXCOLOR = i ? 1 : 0;
  140. #ifdef _DEBUG
  141. m_bVERTEXCOLOR = true;
  142. #endif
  143. }
  144. private:
  145. int m_nFLOWMAP;
  146. #ifdef _DEBUG
  147. bool m_bFLOWMAP;
  148. #endif
  149. public:
  150. void SetFLOWMAP( int i )
  151. {
  152. Assert( i >= 0 && i <= 1 );
  153. m_nFLOWMAP = i;
  154. #ifdef _DEBUG
  155. m_bFLOWMAP = true;
  156. #endif
  157. }
  158. void SetFLOWMAP( bool i )
  159. {
  160. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  161. m_nFLOWMAP = i ? 1 : 0;
  162. #ifdef _DEBUG
  163. m_bFLOWMAP = true;
  164. #endif
  165. }
  166. private:
  167. int m_nMODELFORMAT;
  168. #ifdef _DEBUG
  169. bool m_bMODELFORMAT;
  170. #endif
  171. public:
  172. void SetMODELFORMAT( int i )
  173. {
  174. Assert( i >= 0 && i <= 1 );
  175. m_nMODELFORMAT = i;
  176. #ifdef _DEBUG
  177. m_bMODELFORMAT = true;
  178. #endif
  179. }
  180. void SetMODELFORMAT( bool i )
  181. {
  182. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  183. m_nMODELFORMAT = i ? 1 : 0;
  184. #ifdef _DEBUG
  185. m_bMODELFORMAT = true;
  186. #endif
  187. }
  188. private:
  189. int m_nDOPIXELFOG;
  190. #ifdef _DEBUG
  191. bool m_bDOPIXELFOG;
  192. #endif
  193. public:
  194. void SetDOPIXELFOG( int i )
  195. {
  196. Assert( i >= 0 && i <= 1 );
  197. m_nDOPIXELFOG = i;
  198. #ifdef _DEBUG
  199. m_bDOPIXELFOG = true;
  200. #endif
  201. }
  202. void SetDOPIXELFOG( bool i )
  203. {
  204. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  205. m_nDOPIXELFOG = i ? 1 : 0;
  206. #ifdef _DEBUG
  207. m_bDOPIXELFOG = true;
  208. #endif
  209. }
  210. public:
  211. // CONSTRUCTOR
  212. solidenergy_vs20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  213. {
  214. #ifdef _DEBUG
  215. m_bDETAIL1 = false;
  216. #endif // _DEBUG
  217. m_nDETAIL1 = 0;
  218. #ifdef _DEBUG
  219. m_bDETAIL2 = false;
  220. #endif // _DEBUG
  221. m_nDETAIL2 = 0;
  222. #ifdef _DEBUG
  223. m_bTANGENTTOPACITY = false;
  224. #endif // _DEBUG
  225. m_nTANGENTTOPACITY = 0;
  226. #ifdef _DEBUG
  227. m_bTANGENTSOPACITY = false;
  228. #endif // _DEBUG
  229. m_nTANGENTSOPACITY = 0;
  230. #ifdef _DEBUG
  231. m_bFRESNELOPACITY = false;
  232. #endif // _DEBUG
  233. m_nFRESNELOPACITY = 0;
  234. #ifdef _DEBUG
  235. m_bVERTEXCOLOR = false;
  236. #endif // _DEBUG
  237. m_nVERTEXCOLOR = 0;
  238. #ifdef _DEBUG
  239. m_bFLOWMAP = false;
  240. #endif // _DEBUG
  241. m_nFLOWMAP = 0;
  242. #ifdef _DEBUG
  243. m_bMODELFORMAT = false;
  244. #endif // _DEBUG
  245. m_nMODELFORMAT = 0;
  246. #ifdef _DEBUG
  247. m_bDOPIXELFOG = true;
  248. #endif // _DEBUG
  249. m_nDOPIXELFOG = g_pHardwareConfig->SupportsPixelShaders_2_b() ;
  250. }
  251. int GetIndex()
  252. {
  253. // Asserts to make sure that we aren't using any skipped combinations.
  254. // Asserts to make sure that we are setting all of the combination vars.
  255. #ifdef _DEBUG
  256. bool bAllStaticVarsDefined = m_bDETAIL1 && m_bDETAIL2 && m_bTANGENTTOPACITY && m_bTANGENTSOPACITY && m_bFRESNELOPACITY && m_bVERTEXCOLOR && m_bFLOWMAP && m_bMODELFORMAT && m_bDOPIXELFOG;
  257. Assert( bAllStaticVarsDefined );
  258. #endif // _DEBUG
  259. return ( 32 * m_nDETAIL1 ) + ( 64 * m_nDETAIL2 ) + ( 128 * m_nTANGENTTOPACITY ) + ( 256 * m_nTANGENTSOPACITY ) + ( 512 * m_nFRESNELOPACITY ) + ( 1024 * m_nVERTEXCOLOR ) + ( 2048 * m_nFLOWMAP ) + ( 4096 * m_nMODELFORMAT ) + ( 8192 * m_nDOPIXELFOG ) + 0;
  260. }
  261. };
  262. #define shaderStaticTest_solidenergy_vs20 vsh_forgot_to_set_static_DETAIL1 + vsh_forgot_to_set_static_DETAIL2 + vsh_forgot_to_set_static_TANGENTTOPACITY + vsh_forgot_to_set_static_TANGENTSOPACITY + vsh_forgot_to_set_static_FRESNELOPACITY + vsh_forgot_to_set_static_VERTEXCOLOR + vsh_forgot_to_set_static_FLOWMAP + vsh_forgot_to_set_static_MODELFORMAT + 0
  263. class solidenergy_vs20_Dynamic_Index
  264. {
  265. private:
  266. int m_nCOMPRESSED_VERTS;
  267. #ifdef _DEBUG
  268. bool m_bCOMPRESSED_VERTS;
  269. #endif
  270. public:
  271. void SetCOMPRESSED_VERTS( int i )
  272. {
  273. Assert( i >= 0 && i <= 1 );
  274. m_nCOMPRESSED_VERTS = i;
  275. #ifdef _DEBUG
  276. m_bCOMPRESSED_VERTS = true;
  277. #endif
  278. }
  279. void SetCOMPRESSED_VERTS( bool i )
  280. {
  281. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  282. m_nCOMPRESSED_VERTS = i ? 1 : 0;
  283. #ifdef _DEBUG
  284. m_bCOMPRESSED_VERTS = true;
  285. #endif
  286. }
  287. private:
  288. int m_nSKINNING;
  289. #ifdef _DEBUG
  290. bool m_bSKINNING;
  291. #endif
  292. public:
  293. void SetSKINNING( int i )
  294. {
  295. Assert( i >= 0 && i <= 1 );
  296. m_nSKINNING = i;
  297. #ifdef _DEBUG
  298. m_bSKINNING = true;
  299. #endif
  300. }
  301. void SetSKINNING( bool i )
  302. {
  303. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  304. m_nSKINNING = i ? 1 : 0;
  305. #ifdef _DEBUG
  306. m_bSKINNING = true;
  307. #endif
  308. }
  309. private:
  310. int m_nVORTEX1;
  311. #ifdef _DEBUG
  312. bool m_bVORTEX1;
  313. #endif
  314. public:
  315. void SetVORTEX1( int i )
  316. {
  317. Assert( i >= 0 && i <= 1 );
  318. m_nVORTEX1 = i;
  319. #ifdef _DEBUG
  320. m_bVORTEX1 = true;
  321. #endif
  322. }
  323. void SetVORTEX1( bool i )
  324. {
  325. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  326. m_nVORTEX1 = i ? 1 : 0;
  327. #ifdef _DEBUG
  328. m_bVORTEX1 = true;
  329. #endif
  330. }
  331. private:
  332. int m_nVORTEX2;
  333. #ifdef _DEBUG
  334. bool m_bVORTEX2;
  335. #endif
  336. public:
  337. void SetVORTEX2( int i )
  338. {
  339. Assert( i >= 0 && i <= 1 );
  340. m_nVORTEX2 = i;
  341. #ifdef _DEBUG
  342. m_bVORTEX2 = true;
  343. #endif
  344. }
  345. void SetVORTEX2( bool i )
  346. {
  347. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  348. m_nVORTEX2 = i ? 1 : 0;
  349. #ifdef _DEBUG
  350. m_bVORTEX2 = true;
  351. #endif
  352. }
  353. private:
  354. int m_nDOWATERFOG;
  355. #ifdef _DEBUG
  356. bool m_bDOWATERFOG;
  357. #endif
  358. public:
  359. void SetDOWATERFOG( int i )
  360. {
  361. Assert( i >= 0 && i <= 1 );
  362. m_nDOWATERFOG = i;
  363. #ifdef _DEBUG
  364. m_bDOWATERFOG = true;
  365. #endif
  366. }
  367. void SetDOWATERFOG( bool i )
  368. {
  369. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  370. m_nDOWATERFOG = i ? 1 : 0;
  371. #ifdef _DEBUG
  372. m_bDOWATERFOG = true;
  373. #endif
  374. }
  375. public:
  376. // CONSTRUCTOR
  377. solidenergy_vs20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  378. {
  379. #ifdef _DEBUG
  380. m_bCOMPRESSED_VERTS = false;
  381. #endif // _DEBUG
  382. m_nCOMPRESSED_VERTS = 0;
  383. #ifdef _DEBUG
  384. m_bSKINNING = false;
  385. #endif // _DEBUG
  386. m_nSKINNING = 0;
  387. #ifdef _DEBUG
  388. m_bVORTEX1 = false;
  389. #endif // _DEBUG
  390. m_nVORTEX1 = 0;
  391. #ifdef _DEBUG
  392. m_bVORTEX2 = false;
  393. #endif // _DEBUG
  394. m_nVORTEX2 = 0;
  395. #ifdef _DEBUG
  396. m_bDOWATERFOG = true;
  397. #endif // _DEBUG
  398. m_nDOWATERFOG = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  399. }
  400. int GetIndex()
  401. {
  402. // Asserts to make sure that we aren't using any skipped combinations.
  403. // Asserts to make sure that we are setting all of the combination vars.
  404. #ifdef _DEBUG
  405. bool bAllDynamicVarsDefined = m_bCOMPRESSED_VERTS && m_bSKINNING && m_bVORTEX1 && m_bVORTEX2 && m_bDOWATERFOG;
  406. Assert( bAllDynamicVarsDefined );
  407. #endif // _DEBUG
  408. return ( 1 * m_nCOMPRESSED_VERTS ) + ( 2 * m_nSKINNING ) + ( 4 * m_nVORTEX1 ) + ( 8 * m_nVORTEX2 ) + ( 16 * m_nDOWATERFOG ) + 0;
  409. }
  410. };
  411. #define shaderDynamicTest_solidenergy_vs20 vsh_forgot_to_set_dynamic_COMPRESSED_VERTS + vsh_forgot_to_set_dynamic_SKINNING + vsh_forgot_to_set_dynamic_VORTEX1 + vsh_forgot_to_set_dynamic_VORTEX2 + 0
  412. static const ShaderComboInformation_t s_DynamicComboArray_solidenergy_vs20[5] =
  413. {
  414. { "COMPRESSED_VERTS", 0, 1 },
  415. { "SKINNING", 0, 1 },
  416. { "VORTEX1", 0, 1 },
  417. { "VORTEX2", 0, 1 },
  418. { "DOWATERFOG", 0, 1 },
  419. };
  420. static const ShaderComboInformation_t s_StaticComboArray_solidenergy_vs20[9] =
  421. {
  422. { "DETAIL1", 0, 1 },
  423. { "DETAIL2", 0, 1 },
  424. { "TANGENTTOPACITY", 0, 1 },
  425. { "TANGENTSOPACITY", 0, 1 },
  426. { "FRESNELOPACITY", 0, 1 },
  427. { "VERTEXCOLOR", 0, 1 },
  428. { "FLOWMAP", 0, 1 },
  429. { "MODELFORMAT", 0, 1 },
  430. { "DOPIXELFOG", 0, 1 },
  431. };
  432. static const ShaderComboSemantics_t solidenergy_vs20_combos =
  433. {
  434. "solidenergy_vs20", s_DynamicComboArray_solidenergy_vs20, 5, s_StaticComboArray_solidenergy_vs20, 9
  435. };
  436. class ConstructMe_solidenergy_vs20
  437. {
  438. public:
  439. ConstructMe_solidenergy_vs20()
  440. {
  441. GetShaderDLL()->AddShaderComboInformation( &solidenergy_vs20_combos );
  442. }
  443. };
  444. static ConstructMe_solidenergy_vs20 s_ConstructMe_solidenergy_vs20;