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.

475 lines
10 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. private:
  211. int m_nHARDWAREFOGBLEND;
  212. #ifdef _DEBUG
  213. bool m_bHARDWAREFOGBLEND;
  214. #endif
  215. public:
  216. void SetHARDWAREFOGBLEND( int i )
  217. {
  218. Assert( i >= 0 && i <= 0 );
  219. m_nHARDWAREFOGBLEND = i;
  220. #ifdef _DEBUG
  221. m_bHARDWAREFOGBLEND = true;
  222. #endif
  223. }
  224. void SetHARDWAREFOGBLEND( bool i )
  225. {
  226. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  227. m_nHARDWAREFOGBLEND = i ? 1 : 0;
  228. #ifdef _DEBUG
  229. m_bHARDWAREFOGBLEND = true;
  230. #endif
  231. }
  232. public:
  233. // CONSTRUCTOR
  234. solidenergy_vs20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  235. {
  236. #ifdef _DEBUG
  237. m_bDETAIL1 = false;
  238. #endif // _DEBUG
  239. m_nDETAIL1 = 0;
  240. #ifdef _DEBUG
  241. m_bDETAIL2 = false;
  242. #endif // _DEBUG
  243. m_nDETAIL2 = 0;
  244. #ifdef _DEBUG
  245. m_bTANGENTTOPACITY = false;
  246. #endif // _DEBUG
  247. m_nTANGENTTOPACITY = 0;
  248. #ifdef _DEBUG
  249. m_bTANGENTSOPACITY = false;
  250. #endif // _DEBUG
  251. m_nTANGENTSOPACITY = 0;
  252. #ifdef _DEBUG
  253. m_bFRESNELOPACITY = false;
  254. #endif // _DEBUG
  255. m_nFRESNELOPACITY = 0;
  256. #ifdef _DEBUG
  257. m_bVERTEXCOLOR = false;
  258. #endif // _DEBUG
  259. m_nVERTEXCOLOR = 0;
  260. #ifdef _DEBUG
  261. m_bFLOWMAP = false;
  262. #endif // _DEBUG
  263. m_nFLOWMAP = 0;
  264. #ifdef _DEBUG
  265. m_bMODELFORMAT = false;
  266. #endif // _DEBUG
  267. m_nMODELFORMAT = 0;
  268. #ifdef _DEBUG
  269. m_bDOPIXELFOG = true;
  270. #endif // _DEBUG
  271. m_nDOPIXELFOG = g_pHardwareConfig->SupportsPixelShaders_2_b() ;
  272. #ifdef _DEBUG
  273. m_bHARDWAREFOGBLEND = true;
  274. #endif // _DEBUG
  275. m_nHARDWAREFOGBLEND = 0 ;
  276. }
  277. int GetIndex()
  278. {
  279. // Asserts to make sure that we aren't using any skipped combinations.
  280. // Asserts to make sure that we are setting all of the combination vars.
  281. #ifdef _DEBUG
  282. bool bAllStaticVarsDefined = m_bDETAIL1 && m_bDETAIL2 && m_bTANGENTTOPACITY && m_bTANGENTSOPACITY && m_bFRESNELOPACITY && m_bVERTEXCOLOR && m_bFLOWMAP && m_bMODELFORMAT && m_bDOPIXELFOG && m_bHARDWAREFOGBLEND;
  283. Assert( bAllStaticVarsDefined );
  284. #endif // _DEBUG
  285. 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 ) + ( 16384 * m_nHARDWAREFOGBLEND ) + 0;
  286. }
  287. };
  288. #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
  289. class solidenergy_vs20_Dynamic_Index
  290. {
  291. private:
  292. int m_nCOMPRESSED_VERTS;
  293. #ifdef _DEBUG
  294. bool m_bCOMPRESSED_VERTS;
  295. #endif
  296. public:
  297. void SetCOMPRESSED_VERTS( int i )
  298. {
  299. Assert( i >= 0 && i <= 1 );
  300. m_nCOMPRESSED_VERTS = i;
  301. #ifdef _DEBUG
  302. m_bCOMPRESSED_VERTS = true;
  303. #endif
  304. }
  305. void SetCOMPRESSED_VERTS( bool i )
  306. {
  307. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  308. m_nCOMPRESSED_VERTS = i ? 1 : 0;
  309. #ifdef _DEBUG
  310. m_bCOMPRESSED_VERTS = true;
  311. #endif
  312. }
  313. private:
  314. int m_nSKINNING;
  315. #ifdef _DEBUG
  316. bool m_bSKINNING;
  317. #endif
  318. public:
  319. void SetSKINNING( int i )
  320. {
  321. Assert( i >= 0 && i <= 1 );
  322. m_nSKINNING = i;
  323. #ifdef _DEBUG
  324. m_bSKINNING = true;
  325. #endif
  326. }
  327. void SetSKINNING( bool i )
  328. {
  329. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  330. m_nSKINNING = i ? 1 : 0;
  331. #ifdef _DEBUG
  332. m_bSKINNING = true;
  333. #endif
  334. }
  335. private:
  336. int m_nVORTEX1;
  337. #ifdef _DEBUG
  338. bool m_bVORTEX1;
  339. #endif
  340. public:
  341. void SetVORTEX1( int i )
  342. {
  343. Assert( i >= 0 && i <= 1 );
  344. m_nVORTEX1 = i;
  345. #ifdef _DEBUG
  346. m_bVORTEX1 = true;
  347. #endif
  348. }
  349. void SetVORTEX1( bool i )
  350. {
  351. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  352. m_nVORTEX1 = i ? 1 : 0;
  353. #ifdef _DEBUG
  354. m_bVORTEX1 = true;
  355. #endif
  356. }
  357. private:
  358. int m_nVORTEX2;
  359. #ifdef _DEBUG
  360. bool m_bVORTEX2;
  361. #endif
  362. public:
  363. void SetVORTEX2( int i )
  364. {
  365. Assert( i >= 0 && i <= 1 );
  366. m_nVORTEX2 = i;
  367. #ifdef _DEBUG
  368. m_bVORTEX2 = true;
  369. #endif
  370. }
  371. void SetVORTEX2( bool i )
  372. {
  373. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  374. m_nVORTEX2 = i ? 1 : 0;
  375. #ifdef _DEBUG
  376. m_bVORTEX2 = true;
  377. #endif
  378. }
  379. private:
  380. int m_nDOWATERFOG;
  381. #ifdef _DEBUG
  382. bool m_bDOWATERFOG;
  383. #endif
  384. public:
  385. void SetDOWATERFOG( int i )
  386. {
  387. Assert( i >= 0 && i <= 1 );
  388. m_nDOWATERFOG = i;
  389. #ifdef _DEBUG
  390. m_bDOWATERFOG = true;
  391. #endif
  392. }
  393. void SetDOWATERFOG( bool i )
  394. {
  395. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  396. m_nDOWATERFOG = i ? 1 : 0;
  397. #ifdef _DEBUG
  398. m_bDOWATERFOG = true;
  399. #endif
  400. }
  401. public:
  402. // CONSTRUCTOR
  403. solidenergy_vs20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  404. {
  405. #ifdef _DEBUG
  406. m_bCOMPRESSED_VERTS = false;
  407. #endif // _DEBUG
  408. m_nCOMPRESSED_VERTS = 0;
  409. #ifdef _DEBUG
  410. m_bSKINNING = false;
  411. #endif // _DEBUG
  412. m_nSKINNING = 0;
  413. #ifdef _DEBUG
  414. m_bVORTEX1 = false;
  415. #endif // _DEBUG
  416. m_nVORTEX1 = 0;
  417. #ifdef _DEBUG
  418. m_bVORTEX2 = false;
  419. #endif // _DEBUG
  420. m_nVORTEX2 = 0;
  421. #ifdef _DEBUG
  422. m_bDOWATERFOG = true;
  423. #endif // _DEBUG
  424. m_nDOWATERFOG = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  425. }
  426. int GetIndex()
  427. {
  428. // Asserts to make sure that we aren't using any skipped combinations.
  429. // Asserts to make sure that we are setting all of the combination vars.
  430. #ifdef _DEBUG
  431. bool bAllDynamicVarsDefined = m_bCOMPRESSED_VERTS && m_bSKINNING && m_bVORTEX1 && m_bVORTEX2 && m_bDOWATERFOG;
  432. Assert( bAllDynamicVarsDefined );
  433. #endif // _DEBUG
  434. return ( 1 * m_nCOMPRESSED_VERTS ) + ( 2 * m_nSKINNING ) + ( 4 * m_nVORTEX1 ) + ( 8 * m_nVORTEX2 ) + ( 16 * m_nDOWATERFOG ) + 0;
  435. }
  436. };
  437. #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
  438. static const ShaderComboInformation_t s_DynamicComboArray_solidenergy_vs20[5] =
  439. {
  440. { "COMPRESSED_VERTS", 0, 1 },
  441. { "SKINNING", 0, 1 },
  442. { "VORTEX1", 0, 1 },
  443. { "VORTEX2", 0, 1 },
  444. { "DOWATERFOG", 0, 1 },
  445. };
  446. static const ShaderComboInformation_t s_StaticComboArray_solidenergy_vs20[10] =
  447. {
  448. { "DETAIL1", 0, 1 },
  449. { "DETAIL2", 0, 1 },
  450. { "TANGENTTOPACITY", 0, 1 },
  451. { "TANGENTSOPACITY", 0, 1 },
  452. { "FRESNELOPACITY", 0, 1 },
  453. { "VERTEXCOLOR", 0, 1 },
  454. { "FLOWMAP", 0, 1 },
  455. { "MODELFORMAT", 0, 1 },
  456. { "DOPIXELFOG", 0, 1 },
  457. { "HARDWAREFOGBLEND", 0, 0 },
  458. };
  459. static const ShaderComboSemantics_t solidenergy_vs20_combos =
  460. {
  461. "solidenergy_vs20", s_DynamicComboArray_solidenergy_vs20, 5, s_StaticComboArray_solidenergy_vs20, 10
  462. };
  463. class ConstructMe_solidenergy_vs20
  464. {
  465. public:
  466. ConstructMe_solidenergy_vs20()
  467. {
  468. GetShaderDLL()->AddShaderComboInformation( &solidenergy_vs20_combos );
  469. }
  470. };
  471. static ConstructMe_solidenergy_vs20 s_ConstructMe_solidenergy_vs20;