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.

309 lines
6.7 KiB

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