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.

526 lines
12 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // $BUMPMASK && $SEAMLESS
  3. // $LIGHTING_PREVIEW && $FLASHLIGHT
  4. // ( $DOWATERFOG == 0 ) && ( $DOPIXELFOG && $HARDWAREFOGBLEND )
  5. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  6. #include "shaderlib/cshader.h"
  7. class lightmappedgeneric_vs20_Static_Index
  8. {
  9. private:
  10. int m_nENVMAP_MASK;
  11. #ifdef _DEBUG
  12. bool m_bENVMAP_MASK;
  13. #endif
  14. public:
  15. void SetENVMAP_MASK( int i )
  16. {
  17. Assert( i >= 0 && i <= 1 );
  18. m_nENVMAP_MASK = i;
  19. #ifdef _DEBUG
  20. m_bENVMAP_MASK = true;
  21. #endif
  22. }
  23. void SetENVMAP_MASK( bool i )
  24. {
  25. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  26. m_nENVMAP_MASK = i ? 1 : 0;
  27. #ifdef _DEBUG
  28. m_bENVMAP_MASK = true;
  29. #endif
  30. }
  31. private:
  32. int m_nTANGENTSPACE;
  33. #ifdef _DEBUG
  34. bool m_bTANGENTSPACE;
  35. #endif
  36. public:
  37. void SetTANGENTSPACE( int i )
  38. {
  39. Assert( i >= 0 && i <= 1 );
  40. m_nTANGENTSPACE = i;
  41. #ifdef _DEBUG
  42. m_bTANGENTSPACE = true;
  43. #endif
  44. }
  45. void SetTANGENTSPACE( bool i )
  46. {
  47. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  48. m_nTANGENTSPACE = i ? 1 : 0;
  49. #ifdef _DEBUG
  50. m_bTANGENTSPACE = true;
  51. #endif
  52. }
  53. private:
  54. int m_nBUMPMAP;
  55. #ifdef _DEBUG
  56. bool m_bBUMPMAP;
  57. #endif
  58. public:
  59. void SetBUMPMAP( int i )
  60. {
  61. Assert( i >= 0 && i <= 1 );
  62. m_nBUMPMAP = i;
  63. #ifdef _DEBUG
  64. m_bBUMPMAP = true;
  65. #endif
  66. }
  67. void SetBUMPMAP( bool i )
  68. {
  69. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  70. m_nBUMPMAP = i ? 1 : 0;
  71. #ifdef _DEBUG
  72. m_bBUMPMAP = true;
  73. #endif
  74. }
  75. private:
  76. int m_nDETAILTEXTURE;
  77. #ifdef _DEBUG
  78. bool m_bDETAILTEXTURE;
  79. #endif
  80. public:
  81. void SetDETAILTEXTURE( int i )
  82. {
  83. Assert( i >= 0 && i <= 1 );
  84. m_nDETAILTEXTURE = i;
  85. #ifdef _DEBUG
  86. m_bDETAILTEXTURE = true;
  87. #endif
  88. }
  89. void SetDETAILTEXTURE( bool i )
  90. {
  91. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  92. m_nDETAILTEXTURE = i ? 1 : 0;
  93. #ifdef _DEBUG
  94. m_bDETAILTEXTURE = true;
  95. #endif
  96. }
  97. private:
  98. int m_nVERTEXCOLOR;
  99. #ifdef _DEBUG
  100. bool m_bVERTEXCOLOR;
  101. #endif
  102. public:
  103. void SetVERTEXCOLOR( int i )
  104. {
  105. Assert( i >= 0 && i <= 1 );
  106. m_nVERTEXCOLOR = i;
  107. #ifdef _DEBUG
  108. m_bVERTEXCOLOR = true;
  109. #endif
  110. }
  111. void SetVERTEXCOLOR( bool i )
  112. {
  113. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  114. m_nVERTEXCOLOR = i ? 1 : 0;
  115. #ifdef _DEBUG
  116. m_bVERTEXCOLOR = true;
  117. #endif
  118. }
  119. private:
  120. int m_nVERTEXALPHATEXBLENDFACTOR;
  121. #ifdef _DEBUG
  122. bool m_bVERTEXALPHATEXBLENDFACTOR;
  123. #endif
  124. public:
  125. void SetVERTEXALPHATEXBLENDFACTOR( int i )
  126. {
  127. Assert( i >= 0 && i <= 1 );
  128. m_nVERTEXALPHATEXBLENDFACTOR = i;
  129. #ifdef _DEBUG
  130. m_bVERTEXALPHATEXBLENDFACTOR = true;
  131. #endif
  132. }
  133. void SetVERTEXALPHATEXBLENDFACTOR( bool i )
  134. {
  135. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  136. m_nVERTEXALPHATEXBLENDFACTOR = i ? 1 : 0;
  137. #ifdef _DEBUG
  138. m_bVERTEXALPHATEXBLENDFACTOR = true;
  139. #endif
  140. }
  141. private:
  142. int m_nSEAMLESS;
  143. #ifdef _DEBUG
  144. bool m_bSEAMLESS;
  145. #endif
  146. public:
  147. void SetSEAMLESS( int i )
  148. {
  149. Assert( i >= 0 && i <= 1 );
  150. m_nSEAMLESS = i;
  151. #ifdef _DEBUG
  152. m_bSEAMLESS = true;
  153. #endif
  154. }
  155. void SetSEAMLESS( bool i )
  156. {
  157. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  158. m_nSEAMLESS = i ? 1 : 0;
  159. #ifdef _DEBUG
  160. m_bSEAMLESS = true;
  161. #endif
  162. }
  163. private:
  164. int m_nBUMPMASK;
  165. #ifdef _DEBUG
  166. bool m_bBUMPMASK;
  167. #endif
  168. public:
  169. void SetBUMPMASK( int i )
  170. {
  171. Assert( i >= 0 && i <= 0 );
  172. m_nBUMPMASK = i;
  173. #ifdef _DEBUG
  174. m_bBUMPMASK = true;
  175. #endif
  176. }
  177. void SetBUMPMASK( bool i )
  178. {
  179. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  180. m_nBUMPMASK = i ? 1 : 0;
  181. #ifdef _DEBUG
  182. m_bBUMPMASK = true;
  183. #endif
  184. }
  185. private:
  186. int m_nFLASHLIGHT;
  187. #ifdef _DEBUG
  188. bool m_bFLASHLIGHT;
  189. #endif
  190. public:
  191. void SetFLASHLIGHT( int i )
  192. {
  193. Assert( i >= 0 && i <= 1 );
  194. m_nFLASHLIGHT = i;
  195. #ifdef _DEBUG
  196. m_bFLASHLIGHT = true;
  197. #endif
  198. }
  199. void SetFLASHLIGHT( bool i )
  200. {
  201. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  202. m_nFLASHLIGHT = i ? 1 : 0;
  203. #ifdef _DEBUG
  204. m_bFLASHLIGHT = true;
  205. #endif
  206. }
  207. private:
  208. int m_nFANCY_BLENDING;
  209. #ifdef _DEBUG
  210. bool m_bFANCY_BLENDING;
  211. #endif
  212. public:
  213. void SetFANCY_BLENDING( int i )
  214. {
  215. Assert( i >= 0 && i <= 1 );
  216. m_nFANCY_BLENDING = i;
  217. #ifdef _DEBUG
  218. m_bFANCY_BLENDING = true;
  219. #endif
  220. }
  221. void SetFANCY_BLENDING( bool i )
  222. {
  223. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  224. m_nFANCY_BLENDING = i ? 1 : 0;
  225. #ifdef _DEBUG
  226. m_bFANCY_BLENDING = true;
  227. #endif
  228. }
  229. private:
  230. int m_nSELFILLUM;
  231. #ifdef _DEBUG
  232. bool m_bSELFILLUM;
  233. #endif
  234. public:
  235. void SetSELFILLUM( int i )
  236. {
  237. Assert( i >= 0 && i <= 1 );
  238. m_nSELFILLUM = i;
  239. #ifdef _DEBUG
  240. m_bSELFILLUM = true;
  241. #endif
  242. }
  243. void SetSELFILLUM( bool i )
  244. {
  245. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  246. m_nSELFILLUM = i ? 1 : 0;
  247. #ifdef _DEBUG
  248. m_bSELFILLUM = true;
  249. #endif
  250. }
  251. private:
  252. int m_nLIGHTING_PREVIEW;
  253. #ifdef _DEBUG
  254. bool m_bLIGHTING_PREVIEW;
  255. #endif
  256. public:
  257. void SetLIGHTING_PREVIEW( int i )
  258. {
  259. Assert( i >= 0 && i <= 0 );
  260. m_nLIGHTING_PREVIEW = i;
  261. #ifdef _DEBUG
  262. m_bLIGHTING_PREVIEW = true;
  263. #endif
  264. }
  265. void SetLIGHTING_PREVIEW( bool i )
  266. {
  267. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  268. m_nLIGHTING_PREVIEW = i ? 1 : 0;
  269. #ifdef _DEBUG
  270. m_bLIGHTING_PREVIEW = true;
  271. #endif
  272. }
  273. private:
  274. int m_nPAINT;
  275. #ifdef _DEBUG
  276. bool m_bPAINT;
  277. #endif
  278. public:
  279. void SetPAINT( int i )
  280. {
  281. Assert( i >= 0 && i <= 1 );
  282. m_nPAINT = i;
  283. #ifdef _DEBUG
  284. m_bPAINT = true;
  285. #endif
  286. }
  287. void SetPAINT( bool i )
  288. {
  289. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  290. m_nPAINT = i ? 1 : 0;
  291. #ifdef _DEBUG
  292. m_bPAINT = true;
  293. #endif
  294. }
  295. private:
  296. int m_nDOPIXELFOG;
  297. #ifdef _DEBUG
  298. bool m_bDOPIXELFOG;
  299. #endif
  300. public:
  301. void SetDOPIXELFOG( int i )
  302. {
  303. Assert( i >= 0 && i <= 1 );
  304. m_nDOPIXELFOG = i;
  305. #ifdef _DEBUG
  306. m_bDOPIXELFOG = true;
  307. #endif
  308. }
  309. void SetDOPIXELFOG( bool i )
  310. {
  311. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  312. m_nDOPIXELFOG = i ? 1 : 0;
  313. #ifdef _DEBUG
  314. m_bDOPIXELFOG = true;
  315. #endif
  316. }
  317. private:
  318. int m_nHARDWAREFOGBLEND;
  319. #ifdef _DEBUG
  320. bool m_bHARDWAREFOGBLEND;
  321. #endif
  322. public:
  323. void SetHARDWAREFOGBLEND( int i )
  324. {
  325. Assert( i >= 0 && i <= 0 );
  326. m_nHARDWAREFOGBLEND = i;
  327. #ifdef _DEBUG
  328. m_bHARDWAREFOGBLEND = true;
  329. #endif
  330. }
  331. void SetHARDWAREFOGBLEND( bool i )
  332. {
  333. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  334. m_nHARDWAREFOGBLEND = i ? 1 : 0;
  335. #ifdef _DEBUG
  336. m_bHARDWAREFOGBLEND = true;
  337. #endif
  338. }
  339. public:
  340. // CONSTRUCTOR
  341. lightmappedgeneric_vs20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  342. {
  343. #ifdef _DEBUG
  344. m_bENVMAP_MASK = false;
  345. #endif // _DEBUG
  346. m_nENVMAP_MASK = 0;
  347. #ifdef _DEBUG
  348. m_bTANGENTSPACE = false;
  349. #endif // _DEBUG
  350. m_nTANGENTSPACE = 0;
  351. #ifdef _DEBUG
  352. m_bBUMPMAP = false;
  353. #endif // _DEBUG
  354. m_nBUMPMAP = 0;
  355. #ifdef _DEBUG
  356. m_bDETAILTEXTURE = false;
  357. #endif // _DEBUG
  358. m_nDETAILTEXTURE = 0;
  359. #ifdef _DEBUG
  360. m_bVERTEXCOLOR = false;
  361. #endif // _DEBUG
  362. m_nVERTEXCOLOR = 0;
  363. #ifdef _DEBUG
  364. m_bVERTEXALPHATEXBLENDFACTOR = false;
  365. #endif // _DEBUG
  366. m_nVERTEXALPHATEXBLENDFACTOR = 0;
  367. #ifdef _DEBUG
  368. m_bSEAMLESS = false;
  369. #endif // _DEBUG
  370. m_nSEAMLESS = 0;
  371. #ifdef _DEBUG
  372. m_bBUMPMASK = false;
  373. #endif // _DEBUG
  374. m_nBUMPMASK = 0;
  375. #ifdef _DEBUG
  376. m_bFLASHLIGHT = false;
  377. #endif // _DEBUG
  378. m_nFLASHLIGHT = 0;
  379. #ifdef _DEBUG
  380. m_bFANCY_BLENDING = false;
  381. #endif // _DEBUG
  382. m_nFANCY_BLENDING = 0;
  383. #ifdef _DEBUG
  384. m_bSELFILLUM = false;
  385. #endif // _DEBUG
  386. m_nSELFILLUM = 0;
  387. #ifdef _DEBUG
  388. m_bLIGHTING_PREVIEW = false;
  389. #endif // _DEBUG
  390. m_nLIGHTING_PREVIEW = 0;
  391. #ifdef _DEBUG
  392. m_bPAINT = false;
  393. #endif // _DEBUG
  394. m_nPAINT = 0;
  395. #ifdef _DEBUG
  396. m_bDOPIXELFOG = true;
  397. #endif // _DEBUG
  398. m_nDOPIXELFOG = ( g_pHardwareConfig->SupportsPixelShaders_2_b() && !IS_FLAG_SET( MATERIAL_VAR_VERTEXFOG ) ) ? 1 : 0 ;
  399. #ifdef _DEBUG
  400. m_bHARDWAREFOGBLEND = true;
  401. #endif // _DEBUG
  402. m_nHARDWAREFOGBLEND = 0 ;
  403. }
  404. int GetIndex()
  405. {
  406. // Asserts to make sure that we aren't using any skipped combinations.
  407. // Asserts to make sure that we are setting all of the combination vars.
  408. #ifdef _DEBUG
  409. bool bAllStaticVarsDefined = m_bENVMAP_MASK && m_bTANGENTSPACE && m_bBUMPMAP && m_bDETAILTEXTURE && m_bVERTEXCOLOR && m_bVERTEXALPHATEXBLENDFACTOR && m_bSEAMLESS && m_bBUMPMASK && m_bFLASHLIGHT && m_bFANCY_BLENDING && m_bSELFILLUM && m_bLIGHTING_PREVIEW && m_bPAINT && m_bDOPIXELFOG && m_bHARDWAREFOGBLEND;
  410. Assert( bAllStaticVarsDefined );
  411. #endif // _DEBUG
  412. return ( 4 * m_nENVMAP_MASK ) + ( 8 * m_nTANGENTSPACE ) + ( 16 * m_nBUMPMAP ) + ( 32 * m_nDETAILTEXTURE ) + ( 64 * m_nVERTEXCOLOR ) + ( 128 * m_nVERTEXALPHATEXBLENDFACTOR ) + ( 256 * m_nSEAMLESS ) + ( 512 * m_nBUMPMASK ) + ( 512 * m_nFLASHLIGHT ) + ( 1024 * m_nFANCY_BLENDING ) + ( 2048 * m_nSELFILLUM ) + ( 4096 * m_nLIGHTING_PREVIEW ) + ( 4096 * m_nPAINT ) + ( 8192 * m_nDOPIXELFOG ) + ( 16384 * m_nHARDWAREFOGBLEND ) + 0;
  413. }
  414. };
  415. #define shaderStaticTest_lightmappedgeneric_vs20 vsh_forgot_to_set_static_ENVMAP_MASK + vsh_forgot_to_set_static_TANGENTSPACE + vsh_forgot_to_set_static_BUMPMAP + vsh_forgot_to_set_static_DETAILTEXTURE + vsh_forgot_to_set_static_VERTEXCOLOR + vsh_forgot_to_set_static_VERTEXALPHATEXBLENDFACTOR + vsh_forgot_to_set_static_SEAMLESS + vsh_forgot_to_set_static_BUMPMASK + vsh_forgot_to_set_static_FLASHLIGHT + vsh_forgot_to_set_static_FANCY_BLENDING + vsh_forgot_to_set_static_SELFILLUM + vsh_forgot_to_set_static_LIGHTING_PREVIEW + vsh_forgot_to_set_static_PAINT + 0
  416. class lightmappedgeneric_vs20_Dynamic_Index
  417. {
  418. private:
  419. int m_nFASTPATH;
  420. #ifdef _DEBUG
  421. bool m_bFASTPATH;
  422. #endif
  423. public:
  424. void SetFASTPATH( int i )
  425. {
  426. Assert( i >= 0 && i <= 1 );
  427. m_nFASTPATH = i;
  428. #ifdef _DEBUG
  429. m_bFASTPATH = true;
  430. #endif
  431. }
  432. void SetFASTPATH( bool i )
  433. {
  434. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  435. m_nFASTPATH = i ? 1 : 0;
  436. #ifdef _DEBUG
  437. m_bFASTPATH = true;
  438. #endif
  439. }
  440. private:
  441. int m_nDOWATERFOG;
  442. #ifdef _DEBUG
  443. bool m_bDOWATERFOG;
  444. #endif
  445. public:
  446. void SetDOWATERFOG( int i )
  447. {
  448. Assert( i >= 0 && i <= 1 );
  449. m_nDOWATERFOG = i;
  450. #ifdef _DEBUG
  451. m_bDOWATERFOG = true;
  452. #endif
  453. }
  454. void SetDOWATERFOG( bool i )
  455. {
  456. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  457. m_nDOWATERFOG = i ? 1 : 0;
  458. #ifdef _DEBUG
  459. m_bDOWATERFOG = true;
  460. #endif
  461. }
  462. public:
  463. // CONSTRUCTOR
  464. lightmappedgeneric_vs20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  465. {
  466. #ifdef _DEBUG
  467. m_bFASTPATH = false;
  468. #endif // _DEBUG
  469. m_nFASTPATH = 0;
  470. #ifdef _DEBUG
  471. m_bDOWATERFOG = true;
  472. #endif // _DEBUG
  473. m_nDOWATERFOG = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  474. }
  475. int GetIndex()
  476. {
  477. // Asserts to make sure that we aren't using any skipped combinations.
  478. // Asserts to make sure that we are setting all of the combination vars.
  479. #ifdef _DEBUG
  480. bool bAllDynamicVarsDefined = m_bFASTPATH && m_bDOWATERFOG;
  481. Assert( bAllDynamicVarsDefined );
  482. #endif // _DEBUG
  483. return ( 1 * m_nFASTPATH ) + ( 2 * m_nDOWATERFOG ) + 0;
  484. }
  485. };
  486. #define shaderDynamicTest_lightmappedgeneric_vs20 vsh_forgot_to_set_dynamic_FASTPATH + 0
  487. static const ShaderComboInformation_t s_DynamicComboArray_lightmappedgeneric_vs20[2] =
  488. {
  489. { "FASTPATH", 0, 1 },
  490. { "DOWATERFOG", 0, 1 },
  491. };
  492. static const ShaderComboInformation_t s_StaticComboArray_lightmappedgeneric_vs20[15] =
  493. {
  494. { "ENVMAP_MASK", 0, 1 },
  495. { "TANGENTSPACE", 0, 1 },
  496. { "BUMPMAP", 0, 1 },
  497. { "DETAILTEXTURE", 0, 1 },
  498. { "VERTEXCOLOR", 0, 1 },
  499. { "VERTEXALPHATEXBLENDFACTOR", 0, 1 },
  500. { "SEAMLESS", 0, 1 },
  501. { "BUMPMASK", 0, 0 },
  502. { "FLASHLIGHT", 0, 1 },
  503. { "FANCY_BLENDING", 0, 1 },
  504. { "SELFILLUM", 0, 1 },
  505. { "LIGHTING_PREVIEW", 0, 0 },
  506. { "PAINT", 0, 1 },
  507. { "DOPIXELFOG", 0, 1 },
  508. { "HARDWAREFOGBLEND", 0, 0 },
  509. };
  510. static const ShaderComboSemantics_t lightmappedgeneric_vs20_combos =
  511. {
  512. "lightmappedgeneric_vs20", s_DynamicComboArray_lightmappedgeneric_vs20, 2, s_StaticComboArray_lightmappedgeneric_vs20, 15
  513. };
  514. class ConstructMe_lightmappedgeneric_vs20
  515. {
  516. public:
  517. ConstructMe_lightmappedgeneric_vs20()
  518. {
  519. GetShaderDLL()->AddShaderComboInformation( &lightmappedgeneric_vs20_combos );
  520. }
  521. };
  522. static ConstructMe_lightmappedgeneric_vs20 s_ConstructMe_lightmappedgeneric_vs20;