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.

320 lines
7.7 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $SFM == 0 ) && ( $UBERLIGHT == 1 )
  3. // !$WORLDVERTEXTRANSITION && $NORMALMAP2
  4. // !$NORMALMAP && $NORMALMAP2
  5. // !$DETAILTEXTURE && ( $DETAIL_BLEND_MODE != 0 )
  6. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  7. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  8. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  9. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  10. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  11. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  12. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  13. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  14. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  15. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  16. #include "shaderlib/cshader.h"
  17. class flashlight_ps20_Static_Index
  18. {
  19. private:
  20. int m_nSFM;
  21. #ifdef _DEBUG
  22. bool m_bSFM;
  23. #endif
  24. public:
  25. void SetSFM( int i )
  26. {
  27. Assert( i >= 0 && i <= 0 );
  28. m_nSFM = i;
  29. #ifdef _DEBUG
  30. m_bSFM = true;
  31. #endif
  32. }
  33. void SetSFM( bool i )
  34. {
  35. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  36. m_nSFM = i ? 1 : 0;
  37. #ifdef _DEBUG
  38. m_bSFM = true;
  39. #endif
  40. }
  41. private:
  42. int m_nNORMALMAP;
  43. #ifdef _DEBUG
  44. bool m_bNORMALMAP;
  45. #endif
  46. public:
  47. void SetNORMALMAP( int i )
  48. {
  49. Assert( i >= 0 && i <= 2 );
  50. m_nNORMALMAP = i;
  51. #ifdef _DEBUG
  52. m_bNORMALMAP = true;
  53. #endif
  54. }
  55. void SetNORMALMAP( bool i )
  56. {
  57. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  58. m_nNORMALMAP = i ? 1 : 0;
  59. #ifdef _DEBUG
  60. m_bNORMALMAP = true;
  61. #endif
  62. }
  63. private:
  64. int m_nNORMALMAP2;
  65. #ifdef _DEBUG
  66. bool m_bNORMALMAP2;
  67. #endif
  68. public:
  69. void SetNORMALMAP2( int i )
  70. {
  71. Assert( i >= 0 && i <= 1 );
  72. m_nNORMALMAP2 = i;
  73. #ifdef _DEBUG
  74. m_bNORMALMAP2 = true;
  75. #endif
  76. }
  77. void SetNORMALMAP2( bool i )
  78. {
  79. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  80. m_nNORMALMAP2 = i ? 1 : 0;
  81. #ifdef _DEBUG
  82. m_bNORMALMAP2 = true;
  83. #endif
  84. }
  85. private:
  86. int m_nWORLDVERTEXTRANSITION;
  87. #ifdef _DEBUG
  88. bool m_bWORLDVERTEXTRANSITION;
  89. #endif
  90. public:
  91. void SetWORLDVERTEXTRANSITION( int i )
  92. {
  93. Assert( i >= 0 && i <= 1 );
  94. m_nWORLDVERTEXTRANSITION = i;
  95. #ifdef _DEBUG
  96. m_bWORLDVERTEXTRANSITION = true;
  97. #endif
  98. }
  99. void SetWORLDVERTEXTRANSITION( bool i )
  100. {
  101. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  102. m_nWORLDVERTEXTRANSITION = i ? 1 : 0;
  103. #ifdef _DEBUG
  104. m_bWORLDVERTEXTRANSITION = true;
  105. #endif
  106. }
  107. private:
  108. int m_nSEAMLESS;
  109. #ifdef _DEBUG
  110. bool m_bSEAMLESS;
  111. #endif
  112. public:
  113. void SetSEAMLESS( int i )
  114. {
  115. Assert( i >= 0 && i <= 1 );
  116. m_nSEAMLESS = i;
  117. #ifdef _DEBUG
  118. m_bSEAMLESS = true;
  119. #endif
  120. }
  121. void SetSEAMLESS( bool i )
  122. {
  123. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  124. m_nSEAMLESS = i ? 1 : 0;
  125. #ifdef _DEBUG
  126. m_bSEAMLESS = true;
  127. #endif
  128. }
  129. private:
  130. int m_nDETAILTEXTURE;
  131. #ifdef _DEBUG
  132. bool m_bDETAILTEXTURE;
  133. #endif
  134. public:
  135. void SetDETAILTEXTURE( int i )
  136. {
  137. Assert( i >= 0 && i <= 1 );
  138. m_nDETAILTEXTURE = i;
  139. #ifdef _DEBUG
  140. m_bDETAILTEXTURE = true;
  141. #endif
  142. }
  143. void SetDETAILTEXTURE( bool i )
  144. {
  145. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  146. m_nDETAILTEXTURE = i ? 1 : 0;
  147. #ifdef _DEBUG
  148. m_bDETAILTEXTURE = true;
  149. #endif
  150. }
  151. private:
  152. int m_nDETAIL_BLEND_MODE;
  153. #ifdef _DEBUG
  154. bool m_bDETAIL_BLEND_MODE;
  155. #endif
  156. public:
  157. void SetDETAIL_BLEND_MODE( int i )
  158. {
  159. Assert( i >= 0 && i <= 11 );
  160. m_nDETAIL_BLEND_MODE = i;
  161. #ifdef _DEBUG
  162. m_bDETAIL_BLEND_MODE = true;
  163. #endif
  164. }
  165. void SetDETAIL_BLEND_MODE( bool i )
  166. {
  167. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 11 );
  168. m_nDETAIL_BLEND_MODE = i ? 1 : 0;
  169. #ifdef _DEBUG
  170. m_bDETAIL_BLEND_MODE = true;
  171. #endif
  172. }
  173. private:
  174. int m_nDOPIXELFOG;
  175. #ifdef _DEBUG
  176. bool m_bDOPIXELFOG;
  177. #endif
  178. public:
  179. void SetDOPIXELFOG( int i )
  180. {
  181. Assert( i >= 0 && i <= 0 );
  182. m_nDOPIXELFOG = i;
  183. #ifdef _DEBUG
  184. m_bDOPIXELFOG = true;
  185. #endif
  186. }
  187. void SetDOPIXELFOG( bool i )
  188. {
  189. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  190. m_nDOPIXELFOG = i ? 1 : 0;
  191. #ifdef _DEBUG
  192. m_bDOPIXELFOG = true;
  193. #endif
  194. }
  195. public:
  196. // CONSTRUCTOR
  197. flashlight_ps20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  198. {
  199. #ifdef _DEBUG
  200. m_bSFM = false;
  201. #endif // _DEBUG
  202. m_nSFM = 0;
  203. #ifdef _DEBUG
  204. m_bNORMALMAP = false;
  205. #endif // _DEBUG
  206. m_nNORMALMAP = 0;
  207. #ifdef _DEBUG
  208. m_bNORMALMAP2 = false;
  209. #endif // _DEBUG
  210. m_nNORMALMAP2 = 0;
  211. #ifdef _DEBUG
  212. m_bWORLDVERTEXTRANSITION = false;
  213. #endif // _DEBUG
  214. m_nWORLDVERTEXTRANSITION = 0;
  215. #ifdef _DEBUG
  216. m_bSEAMLESS = false;
  217. #endif // _DEBUG
  218. m_nSEAMLESS = 0;
  219. #ifdef _DEBUG
  220. m_bDETAILTEXTURE = false;
  221. #endif // _DEBUG
  222. m_nDETAILTEXTURE = 0;
  223. #ifdef _DEBUG
  224. m_bDETAIL_BLEND_MODE = false;
  225. #endif // _DEBUG
  226. m_nDETAIL_BLEND_MODE = 0;
  227. #ifdef _DEBUG
  228. m_bDOPIXELFOG = true;
  229. #endif // _DEBUG
  230. m_nDOPIXELFOG = 0 ;
  231. }
  232. int GetIndex()
  233. {
  234. // Asserts to make sure that we aren't using any skipped combinations.
  235. // Asserts to make sure that we are setting all of the combination vars.
  236. #ifdef _DEBUG
  237. bool bAllStaticVarsDefined = m_bSFM && m_bNORMALMAP && m_bNORMALMAP2 && m_bWORLDVERTEXTRANSITION && m_bSEAMLESS && m_bDETAILTEXTURE && m_bDETAIL_BLEND_MODE && m_bDOPIXELFOG;
  238. Assert( bAllStaticVarsDefined );
  239. #endif // _DEBUG
  240. return ( 2 * m_nSFM ) + ( 2 * m_nNORMALMAP ) + ( 6 * m_nNORMALMAP2 ) + ( 12 * m_nWORLDVERTEXTRANSITION ) + ( 24 * m_nSEAMLESS ) + ( 48 * m_nDETAILTEXTURE ) + ( 96 * m_nDETAIL_BLEND_MODE ) + ( 1152 * m_nDOPIXELFOG ) + 0;
  241. }
  242. };
  243. #define shaderStaticTest_flashlight_ps20 psh_forgot_to_set_static_SFM + psh_forgot_to_set_static_NORMALMAP + psh_forgot_to_set_static_NORMALMAP2 + psh_forgot_to_set_static_WORLDVERTEXTRANSITION + psh_forgot_to_set_static_SEAMLESS + psh_forgot_to_set_static_DETAILTEXTURE + psh_forgot_to_set_static_DETAIL_BLEND_MODE + 0
  244. class flashlight_ps20_Dynamic_Index
  245. {
  246. private:
  247. int m_nPIXELFOGTYPE;
  248. #ifdef _DEBUG
  249. bool m_bPIXELFOGTYPE;
  250. #endif
  251. public:
  252. void SetPIXELFOGTYPE( int i )
  253. {
  254. Assert( i >= 0 && i <= 1 );
  255. m_nPIXELFOGTYPE = i;
  256. #ifdef _DEBUG
  257. m_bPIXELFOGTYPE = true;
  258. #endif
  259. }
  260. void SetPIXELFOGTYPE( bool i )
  261. {
  262. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  263. m_nPIXELFOGTYPE = i ? 1 : 0;
  264. #ifdef _DEBUG
  265. m_bPIXELFOGTYPE = true;
  266. #endif
  267. }
  268. public:
  269. // CONSTRUCTOR
  270. flashlight_ps20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  271. {
  272. #ifdef _DEBUG
  273. m_bPIXELFOGTYPE = true;
  274. #endif // _DEBUG
  275. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  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 bAllDynamicVarsDefined = m_bPIXELFOGTYPE;
  283. Assert( bAllDynamicVarsDefined );
  284. #endif // _DEBUG
  285. return ( 1 * m_nPIXELFOGTYPE ) + 0;
  286. }
  287. };
  288. #define shaderDynamicTest_flashlight_ps20 0
  289. static const ShaderComboInformation_t s_DynamicComboArray_flashlight_ps20[1] =
  290. {
  291. { "PIXELFOGTYPE", 0, 1 },
  292. };
  293. static const ShaderComboInformation_t s_StaticComboArray_flashlight_ps20[8] =
  294. {
  295. { "SFM", 0, 0 },
  296. { "NORMALMAP", 0, 2 },
  297. { "NORMALMAP2", 0, 1 },
  298. { "WORLDVERTEXTRANSITION", 0, 1 },
  299. { "SEAMLESS", 0, 1 },
  300. { "DETAILTEXTURE", 0, 1 },
  301. { "DETAIL_BLEND_MODE", 0, 11 },
  302. { "DOPIXELFOG", 0, 0 },
  303. };
  304. static const ShaderComboSemantics_t flashlight_ps20_combos =
  305. {
  306. "flashlight_ps20", s_DynamicComboArray_flashlight_ps20, 1, s_StaticComboArray_flashlight_ps20, 8
  307. };
  308. class ConstructMe_flashlight_ps20
  309. {
  310. public:
  311. ConstructMe_flashlight_ps20()
  312. {
  313. GetShaderDLL()->AddShaderComboInformation( &flashlight_ps20_combos );
  314. }
  315. };
  316. static ConstructMe_flashlight_ps20 s_ConstructMe_flashlight_ps20;