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.

268 lines
6.9 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( CASCADED_SHADOW_MAPPING ) != ( DYN_CSM_ENABLED )
  3. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  4. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  5. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  6. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  7. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  8. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  9. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  10. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  11. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  12. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  13. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  14. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  15. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  16. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  17. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  18. #include "shaderlib/cshader.h"
  19. class weapondecal_ps20b_Static_Index
  20. {
  21. private:
  22. int m_nPHONG;
  23. #ifdef _DEBUG
  24. bool m_bPHONG;
  25. #endif
  26. public:
  27. void SetPHONG( int i )
  28. {
  29. Assert( i >= 0 && i <= 1 );
  30. m_nPHONG = i;
  31. #ifdef _DEBUG
  32. m_bPHONG = true;
  33. #endif
  34. }
  35. void SetPHONG( bool i )
  36. {
  37. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  38. m_nPHONG = i ? 1 : 0;
  39. #ifdef _DEBUG
  40. m_bPHONG = true;
  41. #endif
  42. }
  43. private:
  44. int m_nPHONGEXPONENTTEXTURE;
  45. #ifdef _DEBUG
  46. bool m_bPHONGEXPONENTTEXTURE;
  47. #endif
  48. public:
  49. void SetPHONGEXPONENTTEXTURE( int i )
  50. {
  51. Assert( i >= 0 && i <= 1 );
  52. m_nPHONGEXPONENTTEXTURE = i;
  53. #ifdef _DEBUG
  54. m_bPHONGEXPONENTTEXTURE = true;
  55. #endif
  56. }
  57. void SetPHONGEXPONENTTEXTURE( bool i )
  58. {
  59. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  60. m_nPHONGEXPONENTTEXTURE = i ? 1 : 0;
  61. #ifdef _DEBUG
  62. m_bPHONGEXPONENTTEXTURE = true;
  63. #endif
  64. }
  65. private:
  66. int m_nCUBEMAP;
  67. #ifdef _DEBUG
  68. bool m_bCUBEMAP;
  69. #endif
  70. public:
  71. void SetCUBEMAP( int i )
  72. {
  73. Assert( i >= 0 && i <= 1 );
  74. m_nCUBEMAP = i;
  75. #ifdef _DEBUG
  76. m_bCUBEMAP = true;
  77. #endif
  78. }
  79. void SetCUBEMAP( bool i )
  80. {
  81. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  82. m_nCUBEMAP = i ? 1 : 0;
  83. #ifdef _DEBUG
  84. m_bCUBEMAP = true;
  85. #endif
  86. }
  87. private:
  88. int m_nDECALSTYLE;
  89. #ifdef _DEBUG
  90. bool m_bDECALSTYLE;
  91. #endif
  92. public:
  93. void SetDECALSTYLE( int i )
  94. {
  95. Assert( i >= 0 && i <= 4 );
  96. m_nDECALSTYLE = i;
  97. #ifdef _DEBUG
  98. m_bDECALSTYLE = true;
  99. #endif
  100. }
  101. void SetDECALSTYLE( bool i )
  102. {
  103. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 4 );
  104. m_nDECALSTYLE = i ? 1 : 0;
  105. #ifdef _DEBUG
  106. m_bDECALSTYLE = true;
  107. #endif
  108. }
  109. private:
  110. int m_nTHIRDPERSON;
  111. #ifdef _DEBUG
  112. bool m_bTHIRDPERSON;
  113. #endif
  114. public:
  115. void SetTHIRDPERSON( int i )
  116. {
  117. Assert( i >= 0 && i <= 1 );
  118. m_nTHIRDPERSON = i;
  119. #ifdef _DEBUG
  120. m_bTHIRDPERSON = true;
  121. #endif
  122. }
  123. void SetTHIRDPERSON( bool i )
  124. {
  125. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  126. m_nTHIRDPERSON = i ? 1 : 0;
  127. #ifdef _DEBUG
  128. m_bTHIRDPERSON = true;
  129. #endif
  130. }
  131. public:
  132. // CONSTRUCTOR
  133. weapondecal_ps20b_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  134. {
  135. #ifdef _DEBUG
  136. m_bPHONG = false;
  137. #endif // _DEBUG
  138. m_nPHONG = 0;
  139. #ifdef _DEBUG
  140. m_bPHONGEXPONENTTEXTURE = false;
  141. #endif // _DEBUG
  142. m_nPHONGEXPONENTTEXTURE = 0;
  143. #ifdef _DEBUG
  144. m_bCUBEMAP = false;
  145. #endif // _DEBUG
  146. m_nCUBEMAP = 0;
  147. #ifdef _DEBUG
  148. m_bDECALSTYLE = false;
  149. #endif // _DEBUG
  150. m_nDECALSTYLE = 0;
  151. #ifdef _DEBUG
  152. m_bTHIRDPERSON = false;
  153. #endif // _DEBUG
  154. m_nTHIRDPERSON = 0;
  155. }
  156. int GetIndex()
  157. {
  158. // Asserts to make sure that we aren't using any skipped combinations.
  159. // Asserts to make sure that we are setting all of the combination vars.
  160. #ifdef _DEBUG
  161. bool bAllStaticVarsDefined = m_bPHONG && m_bPHONGEXPONENTTEXTURE && m_bCUBEMAP && m_bDECALSTYLE && m_bTHIRDPERSON;
  162. Assert( bAllStaticVarsDefined );
  163. #endif // _DEBUG
  164. return ( 10 * m_nPHONG ) + ( 20 * m_nPHONGEXPONENTTEXTURE ) + ( 40 * m_nCUBEMAP ) + ( 80 * m_nDECALSTYLE ) + ( 400 * m_nTHIRDPERSON ) + 0;
  165. }
  166. };
  167. #define shaderStaticTest_weapondecal_ps20b psh_forgot_to_set_static_PHONG + psh_forgot_to_set_static_PHONGEXPONENTTEXTURE + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_DECALSTYLE + psh_forgot_to_set_static_THIRDPERSON + 0
  168. class weapondecal_ps20b_Dynamic_Index
  169. {
  170. private:
  171. int m_nNUM_LIGHTS;
  172. #ifdef _DEBUG
  173. bool m_bNUM_LIGHTS;
  174. #endif
  175. public:
  176. void SetNUM_LIGHTS( int i )
  177. {
  178. Assert( i >= 0 && i <= 4 );
  179. m_nNUM_LIGHTS = i;
  180. #ifdef _DEBUG
  181. m_bNUM_LIGHTS = true;
  182. #endif
  183. }
  184. void SetNUM_LIGHTS( bool i )
  185. {
  186. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 4 );
  187. m_nNUM_LIGHTS = i ? 1 : 0;
  188. #ifdef _DEBUG
  189. m_bNUM_LIGHTS = true;
  190. #endif
  191. }
  192. private:
  193. int m_nDYN_CSM_ENABLED;
  194. #ifdef _DEBUG
  195. bool m_bDYN_CSM_ENABLED;
  196. #endif
  197. public:
  198. void SetDYN_CSM_ENABLED( int i )
  199. {
  200. Assert( i >= 0 && i <= 1 );
  201. m_nDYN_CSM_ENABLED = i;
  202. #ifdef _DEBUG
  203. m_bDYN_CSM_ENABLED = true;
  204. #endif
  205. }
  206. void SetDYN_CSM_ENABLED( bool i )
  207. {
  208. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  209. m_nDYN_CSM_ENABLED = i ? 1 : 0;
  210. #ifdef _DEBUG
  211. m_bDYN_CSM_ENABLED = true;
  212. #endif
  213. }
  214. public:
  215. // CONSTRUCTOR
  216. weapondecal_ps20b_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  217. {
  218. #ifdef _DEBUG
  219. m_bNUM_LIGHTS = false;
  220. #endif // _DEBUG
  221. m_nNUM_LIGHTS = 0;
  222. #ifdef _DEBUG
  223. m_bDYN_CSM_ENABLED = false;
  224. #endif // _DEBUG
  225. m_nDYN_CSM_ENABLED = 0;
  226. }
  227. int GetIndex()
  228. {
  229. // Asserts to make sure that we aren't using any skipped combinations.
  230. // Asserts to make sure that we are setting all of the combination vars.
  231. #ifdef _DEBUG
  232. bool bAllDynamicVarsDefined = m_bNUM_LIGHTS && m_bDYN_CSM_ENABLED;
  233. Assert( bAllDynamicVarsDefined );
  234. #endif // _DEBUG
  235. return ( 1 * m_nNUM_LIGHTS ) + ( 5 * m_nDYN_CSM_ENABLED ) + 0;
  236. }
  237. };
  238. #define shaderDynamicTest_weapondecal_ps20b psh_forgot_to_set_dynamic_NUM_LIGHTS + psh_forgot_to_set_dynamic_DYN_CSM_ENABLED + 0
  239. static const ShaderComboInformation_t s_DynamicComboArray_weapondecal_ps20b[2] =
  240. {
  241. { "NUM_LIGHTS", 0, 4 },
  242. { "DYN_CSM_ENABLED", 0, 1 },
  243. };
  244. static const ShaderComboInformation_t s_StaticComboArray_weapondecal_ps20b[5] =
  245. {
  246. { "PHONG", 0, 1 },
  247. { "PHONGEXPONENTTEXTURE", 0, 1 },
  248. { "CUBEMAP", 0, 1 },
  249. { "DECALSTYLE", 0, 4 },
  250. { "THIRDPERSON", 0, 1 },
  251. };
  252. static const ShaderComboSemantics_t weapondecal_ps20b_combos =
  253. {
  254. "weapondecal_ps20b", s_DynamicComboArray_weapondecal_ps20b, 2, s_StaticComboArray_weapondecal_ps20b, 5
  255. };
  256. class ConstructMe_weapondecal_ps20b
  257. {
  258. public:
  259. ConstructMe_weapondecal_ps20b()
  260. {
  261. GetShaderDLL()->AddShaderComboInformation( &weapondecal_ps20b_combos );
  262. }
  263. };
  264. static ConstructMe_weapondecal_ps20b s_ConstructMe_weapondecal_ps20b;