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.

285 lines
6.5 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $BUMPMAP == 0 )
  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. #include "shaderlib/cshader.h"
  9. class lightmappedpaint_ps20_Static_Index
  10. {
  11. private:
  12. int m_nBUMPMAP;
  13. #ifdef _DEBUG
  14. bool m_bBUMPMAP;
  15. #endif
  16. public:
  17. void SetBUMPMAP( int i )
  18. {
  19. Assert( i >= 0 && i <= 2 );
  20. m_nBUMPMAP = i;
  21. #ifdef _DEBUG
  22. m_bBUMPMAP = true;
  23. #endif
  24. }
  25. void SetBUMPMAP( bool i )
  26. {
  27. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  28. m_nBUMPMAP = i ? 1 : 0;
  29. #ifdef _DEBUG
  30. m_bBUMPMAP = true;
  31. #endif
  32. }
  33. private:
  34. int m_nCUBEMAP;
  35. #ifdef _DEBUG
  36. bool m_bCUBEMAP;
  37. #endif
  38. public:
  39. void SetCUBEMAP( int i )
  40. {
  41. Assert( i >= 0 && i <= 2 );
  42. m_nCUBEMAP = i;
  43. #ifdef _DEBUG
  44. m_bCUBEMAP = true;
  45. #endif
  46. }
  47. void SetCUBEMAP( bool i )
  48. {
  49. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  50. m_nCUBEMAP = i ? 1 : 0;
  51. #ifdef _DEBUG
  52. m_bCUBEMAP = true;
  53. #endif
  54. }
  55. private:
  56. int m_nSEAMLESS;
  57. #ifdef _DEBUG
  58. bool m_bSEAMLESS;
  59. #endif
  60. public:
  61. void SetSEAMLESS( int i )
  62. {
  63. Assert( i >= 0 && i <= 1 );
  64. m_nSEAMLESS = i;
  65. #ifdef _DEBUG
  66. m_bSEAMLESS = true;
  67. #endif
  68. }
  69. void SetSEAMLESS( bool i )
  70. {
  71. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  72. m_nSEAMLESS = i ? 1 : 0;
  73. #ifdef _DEBUG
  74. m_bSEAMLESS = true;
  75. #endif
  76. }
  77. private:
  78. int m_nTHICKPAINT;
  79. #ifdef _DEBUG
  80. bool m_bTHICKPAINT;
  81. #endif
  82. public:
  83. void SetTHICKPAINT( int i )
  84. {
  85. Assert( i >= 0 && i <= 1 );
  86. m_nTHICKPAINT = i;
  87. #ifdef _DEBUG
  88. m_bTHICKPAINT = true;
  89. #endif
  90. }
  91. void SetTHICKPAINT( bool i )
  92. {
  93. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  94. m_nTHICKPAINT = i ? 1 : 0;
  95. #ifdef _DEBUG
  96. m_bTHICKPAINT = true;
  97. #endif
  98. }
  99. private:
  100. int m_nDOPIXELFOG;
  101. #ifdef _DEBUG
  102. bool m_bDOPIXELFOG;
  103. #endif
  104. public:
  105. void SetDOPIXELFOG( int i )
  106. {
  107. Assert( i >= 0 && i <= 0 );
  108. m_nDOPIXELFOG = i;
  109. #ifdef _DEBUG
  110. m_bDOPIXELFOG = true;
  111. #endif
  112. }
  113. void SetDOPIXELFOG( bool i )
  114. {
  115. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  116. m_nDOPIXELFOG = i ? 1 : 0;
  117. #ifdef _DEBUG
  118. m_bDOPIXELFOG = true;
  119. #endif
  120. }
  121. public:
  122. // CONSTRUCTOR
  123. lightmappedpaint_ps20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  124. {
  125. #ifdef _DEBUG
  126. m_bBUMPMAP = false;
  127. #endif // _DEBUG
  128. m_nBUMPMAP = 0;
  129. #ifdef _DEBUG
  130. m_bCUBEMAP = false;
  131. #endif // _DEBUG
  132. m_nCUBEMAP = 0;
  133. #ifdef _DEBUG
  134. m_bSEAMLESS = false;
  135. #endif // _DEBUG
  136. m_nSEAMLESS = 0;
  137. #ifdef _DEBUG
  138. m_bTHICKPAINT = false;
  139. #endif // _DEBUG
  140. m_nTHICKPAINT = 0;
  141. #ifdef _DEBUG
  142. m_bDOPIXELFOG = true;
  143. #endif // _DEBUG
  144. m_nDOPIXELFOG = 0 ;
  145. }
  146. int GetIndex()
  147. {
  148. // Asserts to make sure that we aren't using any skipped combinations.
  149. // Asserts to make sure that we are setting all of the combination vars.
  150. #ifdef _DEBUG
  151. bool bAllStaticVarsDefined = m_bBUMPMAP && m_bCUBEMAP && m_bSEAMLESS && m_bTHICKPAINT && m_bDOPIXELFOG;
  152. Assert( bAllStaticVarsDefined );
  153. #endif // _DEBUG
  154. return ( 8 * m_nBUMPMAP ) + ( 24 * m_nCUBEMAP ) + ( 72 * m_nSEAMLESS ) + ( 144 * m_nTHICKPAINT ) + ( 288 * m_nDOPIXELFOG ) + 0;
  155. }
  156. };
  157. #define shaderStaticTest_lightmappedpaint_ps20 psh_forgot_to_set_static_BUMPMAP + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_SEAMLESS + psh_forgot_to_set_static_THICKPAINT + 0
  158. class lightmappedpaint_ps20_Dynamic_Index
  159. {
  160. private:
  161. int m_nFASTPATHENVMAPCONTRAST;
  162. #ifdef _DEBUG
  163. bool m_bFASTPATHENVMAPCONTRAST;
  164. #endif
  165. public:
  166. void SetFASTPATHENVMAPCONTRAST( int i )
  167. {
  168. Assert( i >= 0 && i <= 1 );
  169. m_nFASTPATHENVMAPCONTRAST = i;
  170. #ifdef _DEBUG
  171. m_bFASTPATHENVMAPCONTRAST = true;
  172. #endif
  173. }
  174. void SetFASTPATHENVMAPCONTRAST( bool i )
  175. {
  176. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  177. m_nFASTPATHENVMAPCONTRAST = i ? 1 : 0;
  178. #ifdef _DEBUG
  179. m_bFASTPATHENVMAPCONTRAST = true;
  180. #endif
  181. }
  182. private:
  183. int m_nFASTPATH;
  184. #ifdef _DEBUG
  185. bool m_bFASTPATH;
  186. #endif
  187. public:
  188. void SetFASTPATH( int i )
  189. {
  190. Assert( i >= 0 && i <= 1 );
  191. m_nFASTPATH = i;
  192. #ifdef _DEBUG
  193. m_bFASTPATH = true;
  194. #endif
  195. }
  196. void SetFASTPATH( bool i )
  197. {
  198. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  199. m_nFASTPATH = i ? 1 : 0;
  200. #ifdef _DEBUG
  201. m_bFASTPATH = true;
  202. #endif
  203. }
  204. private:
  205. int m_nPIXELFOGTYPE;
  206. #ifdef _DEBUG
  207. bool m_bPIXELFOGTYPE;
  208. #endif
  209. public:
  210. void SetPIXELFOGTYPE( int i )
  211. {
  212. Assert( i >= 0 && i <= 1 );
  213. m_nPIXELFOGTYPE = i;
  214. #ifdef _DEBUG
  215. m_bPIXELFOGTYPE = true;
  216. #endif
  217. }
  218. void SetPIXELFOGTYPE( bool i )
  219. {
  220. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  221. m_nPIXELFOGTYPE = i ? 1 : 0;
  222. #ifdef _DEBUG
  223. m_bPIXELFOGTYPE = true;
  224. #endif
  225. }
  226. public:
  227. // CONSTRUCTOR
  228. lightmappedpaint_ps20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  229. {
  230. #ifdef _DEBUG
  231. m_bFASTPATHENVMAPCONTRAST = false;
  232. #endif // _DEBUG
  233. m_nFASTPATHENVMAPCONTRAST = 0;
  234. #ifdef _DEBUG
  235. m_bFASTPATH = false;
  236. #endif // _DEBUG
  237. m_nFASTPATH = 0;
  238. #ifdef _DEBUG
  239. m_bPIXELFOGTYPE = true;
  240. #endif // _DEBUG
  241. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  242. }
  243. int GetIndex()
  244. {
  245. // Asserts to make sure that we aren't using any skipped combinations.
  246. // Asserts to make sure that we are setting all of the combination vars.
  247. #ifdef _DEBUG
  248. bool bAllDynamicVarsDefined = m_bFASTPATHENVMAPCONTRAST && m_bFASTPATH && m_bPIXELFOGTYPE;
  249. Assert( bAllDynamicVarsDefined );
  250. #endif // _DEBUG
  251. return ( 1 * m_nFASTPATHENVMAPCONTRAST ) + ( 2 * m_nFASTPATH ) + ( 4 * m_nPIXELFOGTYPE ) + 0;
  252. }
  253. };
  254. #define shaderDynamicTest_lightmappedpaint_ps20 psh_forgot_to_set_dynamic_FASTPATHENVMAPCONTRAST + psh_forgot_to_set_dynamic_FASTPATH + 0
  255. static const ShaderComboInformation_t s_DynamicComboArray_lightmappedpaint_ps20[3] =
  256. {
  257. { "FASTPATHENVMAPCONTRAST", 0, 1 },
  258. { "FASTPATH", 0, 1 },
  259. { "PIXELFOGTYPE", 0, 1 },
  260. };
  261. static const ShaderComboInformation_t s_StaticComboArray_lightmappedpaint_ps20[5] =
  262. {
  263. { "BUMPMAP", 0, 2 },
  264. { "CUBEMAP", 0, 2 },
  265. { "SEAMLESS", 0, 1 },
  266. { "THICKPAINT", 0, 1 },
  267. { "DOPIXELFOG", 0, 0 },
  268. };
  269. static const ShaderComboSemantics_t lightmappedpaint_ps20_combos =
  270. {
  271. "lightmappedpaint_ps20", s_DynamicComboArray_lightmappedpaint_ps20, 3, s_StaticComboArray_lightmappedpaint_ps20, 5
  272. };
  273. class ConstructMe_lightmappedpaint_ps20
  274. {
  275. public:
  276. ConstructMe_lightmappedpaint_ps20()
  277. {
  278. GetShaderDLL()->AddShaderComboInformation( &lightmappedpaint_ps20_combos );
  279. }
  280. };
  281. static ConstructMe_lightmappedpaint_ps20 s_ConstructMe_lightmappedpaint_ps20;