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.

528 lines
12 KiB

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