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.

390 lines
8.7 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // $LIGHTING_PREVIEW && $FLASHLIGHT
  3. // ( $DOWATERFOG == 0 ) && ( $DOPIXELFOG && $HARDWAREFOGBLEND )
  4. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  5. #include "shaderlib/cshader.h"
  6. class lightmapped_4wayblend_vs20_Static_Index
  7. {
  8. private:
  9. int m_nENVMAP_MASK;
  10. #ifdef _DEBUG
  11. bool m_bENVMAP_MASK;
  12. #endif
  13. public:
  14. void SetENVMAP_MASK( int i )
  15. {
  16. Assert( i >= 0 && i <= 1 );
  17. m_nENVMAP_MASK = i;
  18. #ifdef _DEBUG
  19. m_bENVMAP_MASK = true;
  20. #endif
  21. }
  22. void SetENVMAP_MASK( bool i )
  23. {
  24. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  25. m_nENVMAP_MASK = i ? 1 : 0;
  26. #ifdef _DEBUG
  27. m_bENVMAP_MASK = true;
  28. #endif
  29. }
  30. private:
  31. int m_nTANGENTSPACE;
  32. #ifdef _DEBUG
  33. bool m_bTANGENTSPACE;
  34. #endif
  35. public:
  36. void SetTANGENTSPACE( int i )
  37. {
  38. Assert( i >= 0 && i <= 1 );
  39. m_nTANGENTSPACE = i;
  40. #ifdef _DEBUG
  41. m_bTANGENTSPACE = true;
  42. #endif
  43. }
  44. void SetTANGENTSPACE( bool i )
  45. {
  46. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  47. m_nTANGENTSPACE = i ? 1 : 0;
  48. #ifdef _DEBUG
  49. m_bTANGENTSPACE = true;
  50. #endif
  51. }
  52. private:
  53. int m_nBUMPMAP;
  54. #ifdef _DEBUG
  55. bool m_bBUMPMAP;
  56. #endif
  57. public:
  58. void SetBUMPMAP( int i )
  59. {
  60. Assert( i >= 0 && i <= 1 );
  61. m_nBUMPMAP = i;
  62. #ifdef _DEBUG
  63. m_bBUMPMAP = true;
  64. #endif
  65. }
  66. void SetBUMPMAP( bool i )
  67. {
  68. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  69. m_nBUMPMAP = i ? 1 : 0;
  70. #ifdef _DEBUG
  71. m_bBUMPMAP = true;
  72. #endif
  73. }
  74. private:
  75. int m_nDETAILTEXTURE;
  76. #ifdef _DEBUG
  77. bool m_bDETAILTEXTURE;
  78. #endif
  79. public:
  80. void SetDETAILTEXTURE( int i )
  81. {
  82. Assert( i >= 0 && i <= 1 );
  83. m_nDETAILTEXTURE = i;
  84. #ifdef _DEBUG
  85. m_bDETAILTEXTURE = true;
  86. #endif
  87. }
  88. void SetDETAILTEXTURE( bool i )
  89. {
  90. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  91. m_nDETAILTEXTURE = i ? 1 : 0;
  92. #ifdef _DEBUG
  93. m_bDETAILTEXTURE = true;
  94. #endif
  95. }
  96. private:
  97. int m_nVERTEXCOLOR;
  98. #ifdef _DEBUG
  99. bool m_bVERTEXCOLOR;
  100. #endif
  101. public:
  102. void SetVERTEXCOLOR( int i )
  103. {
  104. Assert( i >= 0 && i <= 1 );
  105. m_nVERTEXCOLOR = i;
  106. #ifdef _DEBUG
  107. m_bVERTEXCOLOR = true;
  108. #endif
  109. }
  110. void SetVERTEXCOLOR( bool i )
  111. {
  112. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  113. m_nVERTEXCOLOR = i ? 1 : 0;
  114. #ifdef _DEBUG
  115. m_bVERTEXCOLOR = true;
  116. #endif
  117. }
  118. private:
  119. int m_nSEAMLESS;
  120. #ifdef _DEBUG
  121. bool m_bSEAMLESS;
  122. #endif
  123. public:
  124. void SetSEAMLESS( int i )
  125. {
  126. Assert( i >= 0 && i <= 1 );
  127. m_nSEAMLESS = i;
  128. #ifdef _DEBUG
  129. m_bSEAMLESS = true;
  130. #endif
  131. }
  132. void SetSEAMLESS( bool i )
  133. {
  134. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  135. m_nSEAMLESS = i ? 1 : 0;
  136. #ifdef _DEBUG
  137. m_bSEAMLESS = true;
  138. #endif
  139. }
  140. private:
  141. int m_nSELFILLUM;
  142. #ifdef _DEBUG
  143. bool m_bSELFILLUM;
  144. #endif
  145. public:
  146. void SetSELFILLUM( int i )
  147. {
  148. Assert( i >= 0 && i <= 1 );
  149. m_nSELFILLUM = i;
  150. #ifdef _DEBUG
  151. m_bSELFILLUM = true;
  152. #endif
  153. }
  154. void SetSELFILLUM( bool i )
  155. {
  156. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  157. m_nSELFILLUM = i ? 1 : 0;
  158. #ifdef _DEBUG
  159. m_bSELFILLUM = true;
  160. #endif
  161. }
  162. private:
  163. int m_nLIGHTING_PREVIEW;
  164. #ifdef _DEBUG
  165. bool m_bLIGHTING_PREVIEW;
  166. #endif
  167. public:
  168. void SetLIGHTING_PREVIEW( int i )
  169. {
  170. Assert( i >= 0 && i <= 3 );
  171. m_nLIGHTING_PREVIEW = i;
  172. #ifdef _DEBUG
  173. m_bLIGHTING_PREVIEW = true;
  174. #endif
  175. }
  176. void SetLIGHTING_PREVIEW( bool i )
  177. {
  178. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 3 );
  179. m_nLIGHTING_PREVIEW = i ? 1 : 0;
  180. #ifdef _DEBUG
  181. m_bLIGHTING_PREVIEW = true;
  182. #endif
  183. }
  184. private:
  185. int m_nDOPIXELFOG;
  186. #ifdef _DEBUG
  187. bool m_bDOPIXELFOG;
  188. #endif
  189. public:
  190. void SetDOPIXELFOG( int i )
  191. {
  192. Assert( i >= 0 && i <= 1 );
  193. m_nDOPIXELFOG = i;
  194. #ifdef _DEBUG
  195. m_bDOPIXELFOG = true;
  196. #endif
  197. }
  198. void SetDOPIXELFOG( bool i )
  199. {
  200. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  201. m_nDOPIXELFOG = i ? 1 : 0;
  202. #ifdef _DEBUG
  203. m_bDOPIXELFOG = true;
  204. #endif
  205. }
  206. private:
  207. int m_nHARDWAREFOGBLEND;
  208. #ifdef _DEBUG
  209. bool m_bHARDWAREFOGBLEND;
  210. #endif
  211. public:
  212. void SetHARDWAREFOGBLEND( int i )
  213. {
  214. Assert( i >= 0 && i <= 1 );
  215. m_nHARDWAREFOGBLEND = i;
  216. #ifdef _DEBUG
  217. m_bHARDWAREFOGBLEND = true;
  218. #endif
  219. }
  220. void SetHARDWAREFOGBLEND( bool i )
  221. {
  222. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  223. m_nHARDWAREFOGBLEND = i ? 1 : 0;
  224. #ifdef _DEBUG
  225. m_bHARDWAREFOGBLEND = true;
  226. #endif
  227. }
  228. public:
  229. // CONSTRUCTOR
  230. lightmapped_4wayblend_vs20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  231. {
  232. #ifdef _DEBUG
  233. m_bENVMAP_MASK = false;
  234. #endif // _DEBUG
  235. m_nENVMAP_MASK = 0;
  236. #ifdef _DEBUG
  237. m_bTANGENTSPACE = false;
  238. #endif // _DEBUG
  239. m_nTANGENTSPACE = 0;
  240. #ifdef _DEBUG
  241. m_bBUMPMAP = false;
  242. #endif // _DEBUG
  243. m_nBUMPMAP = 0;
  244. #ifdef _DEBUG
  245. m_bDETAILTEXTURE = false;
  246. #endif // _DEBUG
  247. m_nDETAILTEXTURE = 0;
  248. #ifdef _DEBUG
  249. m_bVERTEXCOLOR = false;
  250. #endif // _DEBUG
  251. m_nVERTEXCOLOR = 0;
  252. #ifdef _DEBUG
  253. m_bSEAMLESS = false;
  254. #endif // _DEBUG
  255. m_nSEAMLESS = 0;
  256. #ifdef _DEBUG
  257. m_bSELFILLUM = false;
  258. #endif // _DEBUG
  259. m_nSELFILLUM = 0;
  260. #ifdef _DEBUG
  261. m_bLIGHTING_PREVIEW = false;
  262. #endif // _DEBUG
  263. m_nLIGHTING_PREVIEW = 0;
  264. #ifdef _DEBUG
  265. m_bDOPIXELFOG = true;
  266. #endif // _DEBUG
  267. m_nDOPIXELFOG = ( g_pHardwareConfig->SupportsPixelShaders_2_b() && !IS_FLAG_SET( MATERIAL_VAR_VERTEXFOG ) ) ? 1 : 0 ;
  268. #ifdef _DEBUG
  269. m_bHARDWAREFOGBLEND = true;
  270. #endif // _DEBUG
  271. m_nHARDWAREFOGBLEND = !g_pHardwareConfig->SupportsPixelShaders_2_b() ;
  272. }
  273. int GetIndex()
  274. {
  275. // Asserts to make sure that we aren't using any skipped combinations.
  276. // Asserts to make sure that we are setting all of the combination vars.
  277. #ifdef _DEBUG
  278. bool bAllStaticVarsDefined = m_bENVMAP_MASK && m_bTANGENTSPACE && m_bBUMPMAP && m_bDETAILTEXTURE && m_bVERTEXCOLOR && m_bSEAMLESS && m_bSELFILLUM && m_bLIGHTING_PREVIEW && m_bDOPIXELFOG && m_bHARDWAREFOGBLEND;
  279. Assert( bAllStaticVarsDefined );
  280. #endif // _DEBUG
  281. return ( 4 * m_nENVMAP_MASK ) + ( 8 * m_nTANGENTSPACE ) + ( 16 * m_nBUMPMAP ) + ( 32 * m_nDETAILTEXTURE ) + ( 64 * m_nVERTEXCOLOR ) + ( 128 * m_nSEAMLESS ) + ( 256 * m_nSELFILLUM ) + ( 512 * m_nLIGHTING_PREVIEW ) + ( 2048 * m_nDOPIXELFOG ) + ( 4096 * m_nHARDWAREFOGBLEND ) + 0;
  282. }
  283. };
  284. #define shaderStaticTest_lightmapped_4wayblend_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_SEAMLESS + vsh_forgot_to_set_static_SELFILLUM + vsh_forgot_to_set_static_LIGHTING_PREVIEW + 0
  285. class lightmapped_4wayblend_vs20_Dynamic_Index
  286. {
  287. private:
  288. int m_nFASTPATH;
  289. #ifdef _DEBUG
  290. bool m_bFASTPATH;
  291. #endif
  292. public:
  293. void SetFASTPATH( int i )
  294. {
  295. Assert( i >= 0 && i <= 1 );
  296. m_nFASTPATH = i;
  297. #ifdef _DEBUG
  298. m_bFASTPATH = true;
  299. #endif
  300. }
  301. void SetFASTPATH( bool i )
  302. {
  303. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  304. m_nFASTPATH = i ? 1 : 0;
  305. #ifdef _DEBUG
  306. m_bFASTPATH = true;
  307. #endif
  308. }
  309. private:
  310. int m_nDOWATERFOG;
  311. #ifdef _DEBUG
  312. bool m_bDOWATERFOG;
  313. #endif
  314. public:
  315. void SetDOWATERFOG( int i )
  316. {
  317. Assert( i >= 0 && i <= 1 );
  318. m_nDOWATERFOG = i;
  319. #ifdef _DEBUG
  320. m_bDOWATERFOG = true;
  321. #endif
  322. }
  323. void SetDOWATERFOG( bool i )
  324. {
  325. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  326. m_nDOWATERFOG = i ? 1 : 0;
  327. #ifdef _DEBUG
  328. m_bDOWATERFOG = true;
  329. #endif
  330. }
  331. public:
  332. // CONSTRUCTOR
  333. lightmapped_4wayblend_vs20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  334. {
  335. #ifdef _DEBUG
  336. m_bFASTPATH = false;
  337. #endif // _DEBUG
  338. m_nFASTPATH = 0;
  339. #ifdef _DEBUG
  340. m_bDOWATERFOG = true;
  341. #endif // _DEBUG
  342. m_nDOWATERFOG = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  343. }
  344. int GetIndex()
  345. {
  346. // Asserts to make sure that we aren't using any skipped combinations.
  347. // Asserts to make sure that we are setting all of the combination vars.
  348. #ifdef _DEBUG
  349. bool bAllDynamicVarsDefined = m_bFASTPATH && m_bDOWATERFOG;
  350. Assert( bAllDynamicVarsDefined );
  351. #endif // _DEBUG
  352. return ( 1 * m_nFASTPATH ) + ( 2 * m_nDOWATERFOG ) + 0;
  353. }
  354. };
  355. #define shaderDynamicTest_lightmapped_4wayblend_vs20 vsh_forgot_to_set_dynamic_FASTPATH + 0
  356. static const ShaderComboInformation_t s_DynamicComboArray_lightmapped_4wayblend_vs20[2] =
  357. {
  358. { "FASTPATH", 0, 1 },
  359. { "DOWATERFOG", 0, 1 },
  360. };
  361. static const ShaderComboInformation_t s_StaticComboArray_lightmapped_4wayblend_vs20[10] =
  362. {
  363. { "ENVMAP_MASK", 0, 1 },
  364. { "TANGENTSPACE", 0, 1 },
  365. { "BUMPMAP", 0, 1 },
  366. { "DETAILTEXTURE", 0, 1 },
  367. { "VERTEXCOLOR", 0, 1 },
  368. { "SEAMLESS", 0, 1 },
  369. { "SELFILLUM", 0, 1 },
  370. { "LIGHTING_PREVIEW", 0, 3 },
  371. { "DOPIXELFOG", 0, 1 },
  372. { "HARDWAREFOGBLEND", 0, 1 },
  373. };
  374. static const ShaderComboSemantics_t lightmapped_4wayblend_vs20_combos =
  375. {
  376. "lightmapped_4wayblend_vs20", s_DynamicComboArray_lightmapped_4wayblend_vs20, 2, s_StaticComboArray_lightmapped_4wayblend_vs20, 10
  377. };
  378. class ConstructMe_lightmapped_4wayblend_vs20
  379. {
  380. public:
  381. ConstructMe_lightmapped_4wayblend_vs20()
  382. {
  383. GetShaderDLL()->AddShaderComboInformation( &lightmapped_4wayblend_vs20_combos );
  384. }
  385. };
  386. static ConstructMe_lightmapped_4wayblend_vs20 s_ConstructMe_lightmapped_4wayblend_vs20;