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.

318 lines
6.4 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // $TESSELATION && DAMAGED
  3. // ( $DOWATERFOG == 0 ) && ( $DOPIXELFOG && $HARDWAREFOGBLEND )
  4. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  5. #include "shaderlib/cshader.h"
  6. class vertexlit_sob_vs30_Static_Index
  7. {
  8. private:
  9. int m_nHALFLAMBERT;
  10. #ifdef _DEBUG
  11. bool m_bHALFLAMBERT;
  12. #endif
  13. public:
  14. void SetHALFLAMBERT( int i )
  15. {
  16. Assert( i >= 0 && i <= 1 );
  17. m_nHALFLAMBERT = i;
  18. #ifdef _DEBUG
  19. m_bHALFLAMBERT = true;
  20. #endif
  21. }
  22. void SetHALFLAMBERT( bool i )
  23. {
  24. m_nHALFLAMBERT = i ? 1 : 0;
  25. #ifdef _DEBUG
  26. m_bHALFLAMBERT = true;
  27. #endif
  28. }
  29. private:
  30. int m_nUSE_WITH_2B;
  31. #ifdef _DEBUG
  32. bool m_bUSE_WITH_2B;
  33. #endif
  34. public:
  35. void SetUSE_WITH_2B( int i )
  36. {
  37. Assert( i >= 1 && i <= 1 );
  38. m_nUSE_WITH_2B = i;
  39. #ifdef _DEBUG
  40. m_bUSE_WITH_2B = true;
  41. #endif
  42. }
  43. void SetUSE_WITH_2B( bool i )
  44. {
  45. m_nUSE_WITH_2B = i ? 1 : 0;
  46. #ifdef _DEBUG
  47. m_bUSE_WITH_2B = true;
  48. #endif
  49. }
  50. private:
  51. int m_nDECAL;
  52. #ifdef _DEBUG
  53. bool m_bDECAL;
  54. #endif
  55. public:
  56. void SetDECAL( int i )
  57. {
  58. Assert( i >= 0 && i <= 1 );
  59. m_nDECAL = i;
  60. #ifdef _DEBUG
  61. m_bDECAL = true;
  62. #endif
  63. }
  64. void SetDECAL( bool i )
  65. {
  66. m_nDECAL = i ? 1 : 0;
  67. #ifdef _DEBUG
  68. m_bDECAL = true;
  69. #endif
  70. }
  71. private:
  72. int m_nDAMAGED;
  73. #ifdef _DEBUG
  74. bool m_bDAMAGED;
  75. #endif
  76. public:
  77. void SetDAMAGED( int i )
  78. {
  79. Assert( i >= 0 && i <= 1 );
  80. m_nDAMAGED = i;
  81. #ifdef _DEBUG
  82. m_bDAMAGED = true;
  83. #endif
  84. }
  85. void SetDAMAGED( bool i )
  86. {
  87. m_nDAMAGED = i ? 1 : 0;
  88. #ifdef _DEBUG
  89. m_bDAMAGED = true;
  90. #endif
  91. }
  92. private:
  93. int m_nDOPIXELFOG;
  94. #ifdef _DEBUG
  95. bool m_bDOPIXELFOG;
  96. #endif
  97. public:
  98. void SetDOPIXELFOG( int i )
  99. {
  100. Assert( i >= 0 && i <= 1 );
  101. m_nDOPIXELFOG = i;
  102. #ifdef _DEBUG
  103. m_bDOPIXELFOG = true;
  104. #endif
  105. }
  106. void SetDOPIXELFOG( bool i )
  107. {
  108. m_nDOPIXELFOG = i ? 1 : 0;
  109. #ifdef _DEBUG
  110. m_bDOPIXELFOG = true;
  111. #endif
  112. }
  113. private:
  114. int m_nHARDWAREFOGBLEND;
  115. #ifdef _DEBUG
  116. bool m_bHARDWAREFOGBLEND;
  117. #endif
  118. public:
  119. void SetHARDWAREFOGBLEND( int i )
  120. {
  121. Assert( i >= 0 && i <= 0 );
  122. m_nHARDWAREFOGBLEND = i;
  123. #ifdef _DEBUG
  124. m_bHARDWAREFOGBLEND = true;
  125. #endif
  126. }
  127. void SetHARDWAREFOGBLEND( bool i )
  128. {
  129. m_nHARDWAREFOGBLEND = i ? 1 : 0;
  130. #ifdef _DEBUG
  131. m_bHARDWAREFOGBLEND = true;
  132. #endif
  133. }
  134. public:
  135. // CONSTRUCTOR
  136. vertexlit_sob_vs30_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  137. {
  138. #ifdef _DEBUG
  139. m_bHALFLAMBERT = false;
  140. #endif // _DEBUG
  141. m_nHALFLAMBERT = 0;
  142. #ifdef _DEBUG
  143. m_bUSE_WITH_2B = false;
  144. #endif // _DEBUG
  145. m_nUSE_WITH_2B = 0;
  146. #ifdef _DEBUG
  147. m_bDECAL = false;
  148. #endif // _DEBUG
  149. m_nDECAL = 0;
  150. #ifdef _DEBUG
  151. m_bDAMAGED = false;
  152. #endif // _DEBUG
  153. m_nDAMAGED = 0;
  154. #ifdef _DEBUG
  155. m_bDOPIXELFOG = true;
  156. #endif // _DEBUG
  157. m_nDOPIXELFOG = ( g_pHardwareConfig->SupportsPixelShaders_2_b() && !IS_FLAG_SET( MATERIAL_VAR_VERTEXFOG ) ) ? 1 : 0 ;
  158. #ifdef _DEBUG
  159. m_bHARDWAREFOGBLEND = true;
  160. #endif // _DEBUG
  161. m_nHARDWAREFOGBLEND = 0 ;
  162. }
  163. int GetIndex()
  164. {
  165. // Asserts to make sure that we aren't using any skipped combinations.
  166. // Asserts to make sure that we are setting all of the combination vars.
  167. #ifdef _DEBUG
  168. bool bAllStaticVarsDefined = m_bHALFLAMBERT && m_bUSE_WITH_2B && m_bDECAL && m_bDAMAGED && m_bDOPIXELFOG && m_bHARDWAREFOGBLEND;
  169. Assert( bAllStaticVarsDefined );
  170. #endif // _DEBUG
  171. return ( 48 * m_nHALFLAMBERT ) + ( 96 * m_nUSE_WITH_2B ) + ( 96 * m_nDECAL ) + ( 192 * m_nDAMAGED ) + ( 384 * m_nDOPIXELFOG ) + ( 768 * m_nHARDWAREFOGBLEND ) + 0;
  172. }
  173. };
  174. #define shaderStaticTest_vertexlit_sob_vs30 vsh_forgot_to_set_static_HALFLAMBERT + vsh_forgot_to_set_static_USE_WITH_2B + vsh_forgot_to_set_static_DECAL + vsh_forgot_to_set_static_DAMAGED + 0
  175. class vertexlit_sob_vs30_Dynamic_Index
  176. {
  177. private:
  178. int m_nCOMPRESSED_VERTS;
  179. #ifdef _DEBUG
  180. bool m_bCOMPRESSED_VERTS;
  181. #endif
  182. public:
  183. void SetCOMPRESSED_VERTS( int i )
  184. {
  185. Assert( i >= 0 && i <= 1 );
  186. m_nCOMPRESSED_VERTS = i;
  187. #ifdef _DEBUG
  188. m_bCOMPRESSED_VERTS = true;
  189. #endif
  190. }
  191. void SetCOMPRESSED_VERTS( bool i )
  192. {
  193. m_nCOMPRESSED_VERTS = i ? 1 : 0;
  194. #ifdef _DEBUG
  195. m_bCOMPRESSED_VERTS = true;
  196. #endif
  197. }
  198. private:
  199. int m_nSKINNING;
  200. #ifdef _DEBUG
  201. bool m_bSKINNING;
  202. #endif
  203. public:
  204. void SetSKINNING( int i )
  205. {
  206. Assert( i >= 0 && i <= 1 );
  207. m_nSKINNING = i;
  208. #ifdef _DEBUG
  209. m_bSKINNING = true;
  210. #endif
  211. }
  212. void SetSKINNING( bool i )
  213. {
  214. m_nSKINNING = i ? 1 : 0;
  215. #ifdef _DEBUG
  216. m_bSKINNING = true;
  217. #endif
  218. }
  219. private:
  220. int m_nMORPHING;
  221. #ifdef _DEBUG
  222. bool m_bMORPHING;
  223. #endif
  224. public:
  225. void SetMORPHING( int i )
  226. {
  227. Assert( i >= 0 && i <= 1 );
  228. m_nMORPHING = i;
  229. #ifdef _DEBUG
  230. m_bMORPHING = true;
  231. #endif
  232. }
  233. void SetMORPHING( bool i )
  234. {
  235. m_nMORPHING = i ? 1 : 0;
  236. #ifdef _DEBUG
  237. m_bMORPHING = true;
  238. #endif
  239. }
  240. private:
  241. int m_nTESSELLATION;
  242. #ifdef _DEBUG
  243. bool m_bTESSELLATION;
  244. #endif
  245. public:
  246. void SetTESSELLATION( int i )
  247. {
  248. Assert( i >= 0 && i <= 2 );
  249. m_nTESSELLATION = i;
  250. #ifdef _DEBUG
  251. m_bTESSELLATION = true;
  252. #endif
  253. }
  254. void SetTESSELLATION( bool i )
  255. {
  256. m_nTESSELLATION = i ? 1 : 0;
  257. #ifdef _DEBUG
  258. m_bTESSELLATION = true;
  259. #endif
  260. }
  261. private:
  262. int m_nDOWATERFOG;
  263. #ifdef _DEBUG
  264. bool m_bDOWATERFOG;
  265. #endif
  266. public:
  267. void SetDOWATERFOG( int i )
  268. {
  269. Assert( i >= 0 && i <= 1 );
  270. m_nDOWATERFOG = i;
  271. #ifdef _DEBUG
  272. m_bDOWATERFOG = true;
  273. #endif
  274. }
  275. void SetDOWATERFOG( bool i )
  276. {
  277. m_nDOWATERFOG = i ? 1 : 0;
  278. #ifdef _DEBUG
  279. m_bDOWATERFOG = true;
  280. #endif
  281. }
  282. public:
  283. // CONSTRUCTOR
  284. vertexlit_sob_vs30_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  285. {
  286. #ifdef _DEBUG
  287. m_bCOMPRESSED_VERTS = false;
  288. #endif // _DEBUG
  289. m_nCOMPRESSED_VERTS = 0;
  290. #ifdef _DEBUG
  291. m_bSKINNING = false;
  292. #endif // _DEBUG
  293. m_nSKINNING = 0;
  294. #ifdef _DEBUG
  295. m_bMORPHING = true;
  296. #endif // _DEBUG
  297. m_nMORPHING = pShaderAPI->IsHWMorphingEnabled() ;
  298. #ifdef _DEBUG
  299. m_bTESSELLATION = false;
  300. #endif // _DEBUG
  301. m_nTESSELLATION = 0;
  302. #ifdef _DEBUG
  303. m_bDOWATERFOG = true;
  304. #endif // _DEBUG
  305. m_nDOWATERFOG = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  306. }
  307. int GetIndex()
  308. {
  309. // Asserts to make sure that we aren't using any skipped combinations.
  310. // Asserts to make sure that we are setting all of the combination vars.
  311. #ifdef _DEBUG
  312. bool bAllDynamicVarsDefined = m_bCOMPRESSED_VERTS && m_bSKINNING && m_bMORPHING && m_bTESSELLATION && m_bDOWATERFOG;
  313. Assert( bAllDynamicVarsDefined );
  314. #endif // _DEBUG
  315. return ( 1 * m_nCOMPRESSED_VERTS ) + ( 2 * m_nSKINNING ) + ( 4 * m_nMORPHING ) + ( 8 * m_nTESSELLATION ) + ( 24 * m_nDOWATERFOG ) + 0;
  316. }
  317. };
  318. #define shaderDynamicTest_vertexlit_sob_vs30 vsh_forgot_to_set_dynamic_COMPRESSED_VERTS + vsh_forgot_to_set_dynamic_SKINNING + vsh_forgot_to_set_dynamic_TESSELLATION + 0