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.

499 lines
11 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. public:
  318. // CONSTRUCTOR
  319. lightmappedgeneric_vs20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  320. {
  321. #ifdef _DEBUG
  322. m_bENVMAP_MASK = false;
  323. #endif // _DEBUG
  324. m_nENVMAP_MASK = 0;
  325. #ifdef _DEBUG
  326. m_bTANGENTSPACE = false;
  327. #endif // _DEBUG
  328. m_nTANGENTSPACE = 0;
  329. #ifdef _DEBUG
  330. m_bBUMPMAP = false;
  331. #endif // _DEBUG
  332. m_nBUMPMAP = 0;
  333. #ifdef _DEBUG
  334. m_bDETAILTEXTURE = false;
  335. #endif // _DEBUG
  336. m_nDETAILTEXTURE = 0;
  337. #ifdef _DEBUG
  338. m_bVERTEXCOLOR = false;
  339. #endif // _DEBUG
  340. m_nVERTEXCOLOR = 0;
  341. #ifdef _DEBUG
  342. m_bVERTEXALPHATEXBLENDFACTOR = false;
  343. #endif // _DEBUG
  344. m_nVERTEXALPHATEXBLENDFACTOR = 0;
  345. #ifdef _DEBUG
  346. m_bSEAMLESS = false;
  347. #endif // _DEBUG
  348. m_nSEAMLESS = 0;
  349. #ifdef _DEBUG
  350. m_bBUMPMASK = false;
  351. #endif // _DEBUG
  352. m_nBUMPMASK = 0;
  353. #ifdef _DEBUG
  354. m_bFLASHLIGHT = false;
  355. #endif // _DEBUG
  356. m_nFLASHLIGHT = 0;
  357. #ifdef _DEBUG
  358. m_bFANCY_BLENDING = false;
  359. #endif // _DEBUG
  360. m_nFANCY_BLENDING = 0;
  361. #ifdef _DEBUG
  362. m_bSELFILLUM = false;
  363. #endif // _DEBUG
  364. m_nSELFILLUM = 0;
  365. #ifdef _DEBUG
  366. m_bLIGHTING_PREVIEW = false;
  367. #endif // _DEBUG
  368. m_nLIGHTING_PREVIEW = 0;
  369. #ifdef _DEBUG
  370. m_bPAINT = false;
  371. #endif // _DEBUG
  372. m_nPAINT = 0;
  373. #ifdef _DEBUG
  374. m_bDOPIXELFOG = true;
  375. #endif // _DEBUG
  376. m_nDOPIXELFOG = ( g_pHardwareConfig->SupportsPixelShaders_2_b() && !IS_FLAG_SET( MATERIAL_VAR_VERTEXFOG ) ) ? 1 : 0 ;
  377. }
  378. int GetIndex()
  379. {
  380. // Asserts to make sure that we aren't using any skipped combinations.
  381. // Asserts to make sure that we are setting all of the combination vars.
  382. #ifdef _DEBUG
  383. 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;
  384. Assert( bAllStaticVarsDefined );
  385. #endif // _DEBUG
  386. 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 ) + 0;
  387. }
  388. };
  389. #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
  390. class lightmappedgeneric_vs20_Dynamic_Index
  391. {
  392. private:
  393. int m_nFASTPATH;
  394. #ifdef _DEBUG
  395. bool m_bFASTPATH;
  396. #endif
  397. public:
  398. void SetFASTPATH( int i )
  399. {
  400. Assert( i >= 0 && i <= 1 );
  401. m_nFASTPATH = i;
  402. #ifdef _DEBUG
  403. m_bFASTPATH = true;
  404. #endif
  405. }
  406. void SetFASTPATH( bool i )
  407. {
  408. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  409. m_nFASTPATH = i ? 1 : 0;
  410. #ifdef _DEBUG
  411. m_bFASTPATH = true;
  412. #endif
  413. }
  414. private:
  415. int m_nDOWATERFOG;
  416. #ifdef _DEBUG
  417. bool m_bDOWATERFOG;
  418. #endif
  419. public:
  420. void SetDOWATERFOG( int i )
  421. {
  422. Assert( i >= 0 && i <= 1 );
  423. m_nDOWATERFOG = i;
  424. #ifdef _DEBUG
  425. m_bDOWATERFOG = true;
  426. #endif
  427. }
  428. void SetDOWATERFOG( bool i )
  429. {
  430. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  431. m_nDOWATERFOG = i ? 1 : 0;
  432. #ifdef _DEBUG
  433. m_bDOWATERFOG = true;
  434. #endif
  435. }
  436. public:
  437. // CONSTRUCTOR
  438. lightmappedgeneric_vs20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  439. {
  440. #ifdef _DEBUG
  441. m_bFASTPATH = false;
  442. #endif // _DEBUG
  443. m_nFASTPATH = 0;
  444. #ifdef _DEBUG
  445. m_bDOWATERFOG = true;
  446. #endif // _DEBUG
  447. m_nDOWATERFOG = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  448. }
  449. int GetIndex()
  450. {
  451. // Asserts to make sure that we aren't using any skipped combinations.
  452. // Asserts to make sure that we are setting all of the combination vars.
  453. #ifdef _DEBUG
  454. bool bAllDynamicVarsDefined = m_bFASTPATH && m_bDOWATERFOG;
  455. Assert( bAllDynamicVarsDefined );
  456. #endif // _DEBUG
  457. return ( 1 * m_nFASTPATH ) + ( 2 * m_nDOWATERFOG ) + 0;
  458. }
  459. };
  460. #define shaderDynamicTest_lightmappedgeneric_vs20 vsh_forgot_to_set_dynamic_FASTPATH + 0
  461. static const ShaderComboInformation_t s_DynamicComboArray_lightmappedgeneric_vs20[2] =
  462. {
  463. { "FASTPATH", 0, 1 },
  464. { "DOWATERFOG", 0, 1 },
  465. };
  466. static const ShaderComboInformation_t s_StaticComboArray_lightmappedgeneric_vs20[14] =
  467. {
  468. { "ENVMAP_MASK", 0, 1 },
  469. { "TANGENTSPACE", 0, 1 },
  470. { "BUMPMAP", 0, 1 },
  471. { "DETAILTEXTURE", 0, 1 },
  472. { "VERTEXCOLOR", 0, 1 },
  473. { "VERTEXALPHATEXBLENDFACTOR", 0, 1 },
  474. { "SEAMLESS", 0, 1 },
  475. { "BUMPMASK", 0, 0 },
  476. { "FLASHLIGHT", 0, 1 },
  477. { "FANCY_BLENDING", 0, 1 },
  478. { "SELFILLUM", 0, 1 },
  479. { "LIGHTING_PREVIEW", 0, 0 },
  480. { "PAINT", 0, 1 },
  481. { "DOPIXELFOG", 0, 1 },
  482. };
  483. static const ShaderComboSemantics_t lightmappedgeneric_vs20_combos =
  484. {
  485. "lightmappedgeneric_vs20", s_DynamicComboArray_lightmappedgeneric_vs20, 2, s_StaticComboArray_lightmappedgeneric_vs20, 14
  486. };
  487. class ConstructMe_lightmappedgeneric_vs20
  488. {
  489. public:
  490. ConstructMe_lightmappedgeneric_vs20()
  491. {
  492. GetShaderDLL()->AddShaderComboInformation( &lightmappedgeneric_vs20_combos );
  493. }
  494. };
  495. static ConstructMe_lightmappedgeneric_vs20 s_ConstructMe_lightmappedgeneric_vs20;