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.

307 lines
7.3 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $FLASHLIGHT == 0 ) && ( $GLOBALLIGHT == 1 )
  3. // ( $EDITOR == 1 ) && ( $FOW == 1 )
  4. // ( $DEFERRED == 1 ) && ( $FOW == 1 )
  5. // ( $DEFERRED == 1 ) && ( $GLOBALLIGHT == 1 )
  6. // ( $DEFERRED == 1 ) && ( $FLASHLIGHT == 1 )
  7. // ( $DEFERRED == 1 ) && ( $LIGHTING_PREVIEW == 1 )
  8. // ( $DEFERRED == 1 ) && ( $EDITOR == 1 )
  9. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  10. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  11. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  12. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  13. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  14. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  15. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  16. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  17. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  18. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  19. #include "shaderlib/cshader.h"
  20. class global_lit_simple_ps20_Static_Index
  21. {
  22. private:
  23. int m_nEDITOR;
  24. #ifdef _DEBUG
  25. bool m_bEDITOR;
  26. #endif
  27. public:
  28. void SetEDITOR( int i )
  29. {
  30. Assert( i >= 0 && i <= 1 );
  31. m_nEDITOR = i;
  32. #ifdef _DEBUG
  33. m_bEDITOR = true;
  34. #endif
  35. }
  36. void SetEDITOR( bool i )
  37. {
  38. m_nEDITOR = i ? 1 : 0;
  39. #ifdef _DEBUG
  40. m_bEDITOR = true;
  41. #endif
  42. }
  43. private:
  44. int m_nFLASHLIGHT;
  45. #ifdef _DEBUG
  46. bool m_bFLASHLIGHT;
  47. #endif
  48. public:
  49. void SetFLASHLIGHT( int i )
  50. {
  51. Assert( i >= 0 && i <= 1 );
  52. m_nFLASHLIGHT = i;
  53. #ifdef _DEBUG
  54. m_bFLASHLIGHT = true;
  55. #endif
  56. }
  57. void SetFLASHLIGHT( bool i )
  58. {
  59. m_nFLASHLIGHT = i ? 1 : 0;
  60. #ifdef _DEBUG
  61. m_bFLASHLIGHT = true;
  62. #endif
  63. }
  64. private:
  65. int m_nFLASHLIGHTDEPTHFILTERMODE;
  66. #ifdef _DEBUG
  67. bool m_bFLASHLIGHTDEPTHFILTERMODE;
  68. #endif
  69. public:
  70. void SetFLASHLIGHTDEPTHFILTERMODE( int i )
  71. {
  72. Assert( i >= 0 && i <= 2 );
  73. m_nFLASHLIGHTDEPTHFILTERMODE = i;
  74. #ifdef _DEBUG
  75. m_bFLASHLIGHTDEPTHFILTERMODE = true;
  76. #endif
  77. }
  78. void SetFLASHLIGHTDEPTHFILTERMODE( bool i )
  79. {
  80. m_nFLASHLIGHTDEPTHFILTERMODE = i ? 1 : 0;
  81. #ifdef _DEBUG
  82. m_bFLASHLIGHTDEPTHFILTERMODE = true;
  83. #endif
  84. }
  85. private:
  86. int m_nSPECULAR;
  87. #ifdef _DEBUG
  88. bool m_bSPECULAR;
  89. #endif
  90. public:
  91. void SetSPECULAR( int i )
  92. {
  93. Assert( i >= 0 && i <= 1 );
  94. m_nSPECULAR = i;
  95. #ifdef _DEBUG
  96. m_bSPECULAR = true;
  97. #endif
  98. }
  99. void SetSPECULAR( bool i )
  100. {
  101. m_nSPECULAR = i ? 1 : 0;
  102. #ifdef _DEBUG
  103. m_bSPECULAR = true;
  104. #endif
  105. }
  106. public:
  107. // CONSTRUCTOR
  108. global_lit_simple_ps20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  109. {
  110. #ifdef _DEBUG
  111. m_bEDITOR = false;
  112. #endif // _DEBUG
  113. m_nEDITOR = 0;
  114. #ifdef _DEBUG
  115. m_bFLASHLIGHT = false;
  116. #endif // _DEBUG
  117. m_nFLASHLIGHT = 0;
  118. #ifdef _DEBUG
  119. m_bFLASHLIGHTDEPTHFILTERMODE = false;
  120. #endif // _DEBUG
  121. m_nFLASHLIGHTDEPTHFILTERMODE = 0;
  122. #ifdef _DEBUG
  123. m_bSPECULAR = false;
  124. #endif // _DEBUG
  125. m_nSPECULAR = 0;
  126. }
  127. int GetIndex()
  128. {
  129. // Asserts to make sure that we aren't using any skipped combinations.
  130. // Asserts to make sure that we are setting all of the combination vars.
  131. #ifdef _DEBUG
  132. bool bAllStaticVarsDefined = m_bEDITOR && m_bFLASHLIGHT && m_bFLASHLIGHTDEPTHFILTERMODE && m_bSPECULAR;
  133. Assert( bAllStaticVarsDefined );
  134. #endif // _DEBUG
  135. return ( 64 * m_nEDITOR ) + ( 128 * m_nFLASHLIGHT ) + ( 256 * m_nFLASHLIGHTDEPTHFILTERMODE ) + ( 768 * m_nSPECULAR ) + 0;
  136. }
  137. };
  138. #define shaderStaticTest_global_lit_simple_ps20 psh_forgot_to_set_static_EDITOR + psh_forgot_to_set_static_FLASHLIGHT + psh_forgot_to_set_static_FLASHLIGHTDEPTHFILTERMODE + psh_forgot_to_set_static_SPECULAR + 0
  139. class global_lit_simple_ps20_Dynamic_Index
  140. {
  141. private:
  142. int m_nFOW;
  143. #ifdef _DEBUG
  144. bool m_bFOW;
  145. #endif
  146. public:
  147. void SetFOW( int i )
  148. {
  149. Assert( i >= 0 && i <= 1 );
  150. m_nFOW = i;
  151. #ifdef _DEBUG
  152. m_bFOW = true;
  153. #endif
  154. }
  155. void SetFOW( bool i )
  156. {
  157. m_nFOW = i ? 1 : 0;
  158. #ifdef _DEBUG
  159. m_bFOW = true;
  160. #endif
  161. }
  162. private:
  163. int m_nFLASHLIGHTSHADOWS;
  164. #ifdef _DEBUG
  165. bool m_bFLASHLIGHTSHADOWS;
  166. #endif
  167. public:
  168. void SetFLASHLIGHTSHADOWS( int i )
  169. {
  170. Assert( i >= 0 && i <= 1 );
  171. m_nFLASHLIGHTSHADOWS = i;
  172. #ifdef _DEBUG
  173. m_bFLASHLIGHTSHADOWS = true;
  174. #endif
  175. }
  176. void SetFLASHLIGHTSHADOWS( bool i )
  177. {
  178. m_nFLASHLIGHTSHADOWS = i ? 1 : 0;
  179. #ifdef _DEBUG
  180. m_bFLASHLIGHTSHADOWS = true;
  181. #endif
  182. }
  183. private:
  184. int m_nGLOBALLIGHT;
  185. #ifdef _DEBUG
  186. bool m_bGLOBALLIGHT;
  187. #endif
  188. public:
  189. void SetGLOBALLIGHT( int i )
  190. {
  191. Assert( i >= 0 && i <= 1 );
  192. m_nGLOBALLIGHT = i;
  193. #ifdef _DEBUG
  194. m_bGLOBALLIGHT = true;
  195. #endif
  196. }
  197. void SetGLOBALLIGHT( bool i )
  198. {
  199. m_nGLOBALLIGHT = i ? 1 : 0;
  200. #ifdef _DEBUG
  201. m_bGLOBALLIGHT = true;
  202. #endif
  203. }
  204. private:
  205. int m_nWRITEWATERFOGTODESTALPHA;
  206. #ifdef _DEBUG
  207. bool m_bWRITEWATERFOGTODESTALPHA;
  208. #endif
  209. public:
  210. void SetWRITEWATERFOGTODESTALPHA( int i )
  211. {
  212. Assert( i >= 0 && i <= 1 );
  213. m_nWRITEWATERFOGTODESTALPHA = i;
  214. #ifdef _DEBUG
  215. m_bWRITEWATERFOGTODESTALPHA = true;
  216. #endif
  217. }
  218. void SetWRITEWATERFOGTODESTALPHA( bool i )
  219. {
  220. m_nWRITEWATERFOGTODESTALPHA = i ? 1 : 0;
  221. #ifdef _DEBUG
  222. m_bWRITEWATERFOGTODESTALPHA = true;
  223. #endif
  224. }
  225. private:
  226. int m_nDEFERRED;
  227. #ifdef _DEBUG
  228. bool m_bDEFERRED;
  229. #endif
  230. public:
  231. void SetDEFERRED( int i )
  232. {
  233. Assert( i >= 0 && i <= 1 );
  234. m_nDEFERRED = i;
  235. #ifdef _DEBUG
  236. m_bDEFERRED = true;
  237. #endif
  238. }
  239. void SetDEFERRED( bool i )
  240. {
  241. m_nDEFERRED = i ? 1 : 0;
  242. #ifdef _DEBUG
  243. m_bDEFERRED = true;
  244. #endif
  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. m_nPIXELFOGTYPE = i ? 1 : 0;
  263. #ifdef _DEBUG
  264. m_bPIXELFOGTYPE = true;
  265. #endif
  266. }
  267. public:
  268. // CONSTRUCTOR
  269. global_lit_simple_ps20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  270. {
  271. #ifdef _DEBUG
  272. m_bFOW = false;
  273. #endif // _DEBUG
  274. m_nFOW = 0;
  275. #ifdef _DEBUG
  276. m_bFLASHLIGHTSHADOWS = false;
  277. #endif // _DEBUG
  278. m_nFLASHLIGHTSHADOWS = 0;
  279. #ifdef _DEBUG
  280. m_bGLOBALLIGHT = false;
  281. #endif // _DEBUG
  282. m_nGLOBALLIGHT = 0;
  283. #ifdef _DEBUG
  284. m_bWRITEWATERFOGTODESTALPHA = false;
  285. #endif // _DEBUG
  286. m_nWRITEWATERFOGTODESTALPHA = 0;
  287. #ifdef _DEBUG
  288. m_bDEFERRED = false;
  289. #endif // _DEBUG
  290. m_nDEFERRED = 0;
  291. #ifdef _DEBUG
  292. m_bPIXELFOGTYPE = true;
  293. #endif // _DEBUG
  294. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  295. }
  296. int GetIndex()
  297. {
  298. // Asserts to make sure that we aren't using any skipped combinations.
  299. // Asserts to make sure that we are setting all of the combination vars.
  300. #ifdef _DEBUG
  301. bool bAllDynamicVarsDefined = m_bFOW && m_bFLASHLIGHTSHADOWS && m_bGLOBALLIGHT && m_bWRITEWATERFOGTODESTALPHA && m_bDEFERRED && m_bPIXELFOGTYPE;
  302. Assert( bAllDynamicVarsDefined );
  303. #endif // _DEBUG
  304. return ( 1 * m_nFOW ) + ( 2 * m_nFLASHLIGHTSHADOWS ) + ( 4 * m_nGLOBALLIGHT ) + ( 8 * m_nWRITEWATERFOGTODESTALPHA ) + ( 16 * m_nDEFERRED ) + ( 32 * m_nPIXELFOGTYPE ) + 0;
  305. }
  306. };
  307. #define shaderDynamicTest_global_lit_simple_ps20 psh_forgot_to_set_dynamic_FOW + psh_forgot_to_set_dynamic_FLASHLIGHTSHADOWS + psh_forgot_to_set_dynamic_GLOBALLIGHT + psh_forgot_to_set_dynamic_WRITEWATERFOGTODESTALPHA + psh_forgot_to_set_dynamic_DEFERRED + 0