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.

235 lines
6.1 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  3. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  4. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  5. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  6. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  7. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  8. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  9. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  10. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  11. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  12. #include "shaderlib/cshader.h"
  13. class lightmappedreflective_ps20b_Static_Index
  14. {
  15. private:
  16. int m_nBASETEXTURE;
  17. #ifdef _DEBUG
  18. bool m_bBASETEXTURE;
  19. #endif
  20. public:
  21. void SetBASETEXTURE( int i )
  22. {
  23. Assert( i >= 0 && i <= 1 );
  24. m_nBASETEXTURE = i;
  25. #ifdef _DEBUG
  26. m_bBASETEXTURE = true;
  27. #endif
  28. }
  29. void SetBASETEXTURE( bool i )
  30. {
  31. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  32. m_nBASETEXTURE = i ? 1 : 0;
  33. #ifdef _DEBUG
  34. m_bBASETEXTURE = true;
  35. #endif
  36. }
  37. private:
  38. int m_nREFLECT;
  39. #ifdef _DEBUG
  40. bool m_bREFLECT;
  41. #endif
  42. public:
  43. void SetREFLECT( int i )
  44. {
  45. Assert( i >= 0 && i <= 1 );
  46. m_nREFLECT = i;
  47. #ifdef _DEBUG
  48. m_bREFLECT = true;
  49. #endif
  50. }
  51. void SetREFLECT( bool i )
  52. {
  53. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  54. m_nREFLECT = i ? 1 : 0;
  55. #ifdef _DEBUG
  56. m_bREFLECT = true;
  57. #endif
  58. }
  59. private:
  60. int m_nREFRACT;
  61. #ifdef _DEBUG
  62. bool m_bREFRACT;
  63. #endif
  64. public:
  65. void SetREFRACT( int i )
  66. {
  67. Assert( i >= 0 && i <= 1 );
  68. m_nREFRACT = i;
  69. #ifdef _DEBUG
  70. m_bREFRACT = true;
  71. #endif
  72. }
  73. void SetREFRACT( bool i )
  74. {
  75. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  76. m_nREFRACT = i ? 1 : 0;
  77. #ifdef _DEBUG
  78. m_bREFRACT = true;
  79. #endif
  80. }
  81. private:
  82. int m_nENVMAPMASK;
  83. #ifdef _DEBUG
  84. bool m_bENVMAPMASK;
  85. #endif
  86. public:
  87. void SetENVMAPMASK( int i )
  88. {
  89. Assert( i >= 0 && i <= 1 );
  90. m_nENVMAPMASK = i;
  91. #ifdef _DEBUG
  92. m_bENVMAPMASK = true;
  93. #endif
  94. }
  95. void SetENVMAPMASK( bool i )
  96. {
  97. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  98. m_nENVMAPMASK = i ? 1 : 0;
  99. #ifdef _DEBUG
  100. m_bENVMAPMASK = true;
  101. #endif
  102. }
  103. public:
  104. // CONSTRUCTOR
  105. lightmappedreflective_ps20b_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  106. {
  107. #ifdef _DEBUG
  108. m_bBASETEXTURE = false;
  109. #endif // _DEBUG
  110. m_nBASETEXTURE = 0;
  111. #ifdef _DEBUG
  112. m_bREFLECT = false;
  113. #endif // _DEBUG
  114. m_nREFLECT = 0;
  115. #ifdef _DEBUG
  116. m_bREFRACT = false;
  117. #endif // _DEBUG
  118. m_nREFRACT = 0;
  119. #ifdef _DEBUG
  120. m_bENVMAPMASK = false;
  121. #endif // _DEBUG
  122. m_nENVMAPMASK = 0;
  123. }
  124. int GetIndex()
  125. {
  126. // Asserts to make sure that we aren't using any skipped combinations.
  127. // Asserts to make sure that we are setting all of the combination vars.
  128. #ifdef _DEBUG
  129. bool bAllStaticVarsDefined = m_bBASETEXTURE && m_bREFLECT && m_bREFRACT && m_bENVMAPMASK;
  130. Assert( bAllStaticVarsDefined );
  131. #endif // _DEBUG
  132. return ( 2 * m_nBASETEXTURE ) + ( 4 * m_nREFLECT ) + ( 8 * m_nREFRACT ) + ( 16 * m_nENVMAPMASK ) + 0;
  133. }
  134. };
  135. #define shaderStaticTest_lightmappedreflective_ps20b psh_forgot_to_set_static_BASETEXTURE + psh_forgot_to_set_static_REFLECT + psh_forgot_to_set_static_REFRACT + psh_forgot_to_set_static_ENVMAPMASK + 0
  136. class lightmappedreflective_ps20b_Dynamic_Index
  137. {
  138. private:
  139. int m_nPIXELFOGTYPE;
  140. #ifdef _DEBUG
  141. bool m_bPIXELFOGTYPE;
  142. #endif
  143. public:
  144. void SetPIXELFOGTYPE( int i )
  145. {
  146. Assert( i >= 0 && i <= 1 );
  147. m_nPIXELFOGTYPE = i;
  148. #ifdef _DEBUG
  149. m_bPIXELFOGTYPE = true;
  150. #endif
  151. }
  152. void SetPIXELFOGTYPE( bool i )
  153. {
  154. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  155. m_nPIXELFOGTYPE = i ? 1 : 0;
  156. #ifdef _DEBUG
  157. m_bPIXELFOGTYPE = true;
  158. #endif
  159. }
  160. private:
  161. int m_nWRITE_DEPTH_TO_DESTALPHA;
  162. #ifdef _DEBUG
  163. bool m_bWRITE_DEPTH_TO_DESTALPHA;
  164. #endif
  165. public:
  166. void SetWRITE_DEPTH_TO_DESTALPHA( int i )
  167. {
  168. Assert( i >= 0 && i <= 0 );
  169. m_nWRITE_DEPTH_TO_DESTALPHA = i;
  170. #ifdef _DEBUG
  171. m_bWRITE_DEPTH_TO_DESTALPHA = true;
  172. #endif
  173. }
  174. void SetWRITE_DEPTH_TO_DESTALPHA( bool i )
  175. {
  176. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  177. m_nWRITE_DEPTH_TO_DESTALPHA = i ? 1 : 0;
  178. #ifdef _DEBUG
  179. m_bWRITE_DEPTH_TO_DESTALPHA = true;
  180. #endif
  181. }
  182. public:
  183. // CONSTRUCTOR
  184. lightmappedreflective_ps20b_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  185. {
  186. #ifdef _DEBUG
  187. m_bPIXELFOGTYPE = true;
  188. #endif // _DEBUG
  189. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  190. #ifdef _DEBUG
  191. m_bWRITE_DEPTH_TO_DESTALPHA = false;
  192. #endif // _DEBUG
  193. m_nWRITE_DEPTH_TO_DESTALPHA = 0;
  194. }
  195. int GetIndex()
  196. {
  197. // Asserts to make sure that we aren't using any skipped combinations.
  198. // Asserts to make sure that we are setting all of the combination vars.
  199. #ifdef _DEBUG
  200. bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE && m_bWRITE_DEPTH_TO_DESTALPHA;
  201. Assert( bAllDynamicVarsDefined );
  202. #endif // _DEBUG
  203. return ( 1 * m_nPIXELFOGTYPE ) + ( 2 * m_nWRITE_DEPTH_TO_DESTALPHA ) + 0;
  204. }
  205. };
  206. #define shaderDynamicTest_lightmappedreflective_ps20b psh_forgot_to_set_dynamic_WRITE_DEPTH_TO_DESTALPHA + 0
  207. static const ShaderComboInformation_t s_DynamicComboArray_lightmappedreflective_ps20b[2] =
  208. {
  209. { "PIXELFOGTYPE", 0, 1 },
  210. { "WRITE_DEPTH_TO_DESTALPHA", 0, 0 },
  211. };
  212. static const ShaderComboInformation_t s_StaticComboArray_lightmappedreflective_ps20b[4] =
  213. {
  214. { "BASETEXTURE", 0, 1 },
  215. { "REFLECT", 0, 1 },
  216. { "REFRACT", 0, 1 },
  217. { "ENVMAPMASK", 0, 1 },
  218. };
  219. static const ShaderComboSemantics_t lightmappedreflective_ps20b_combos =
  220. {
  221. "lightmappedreflective_ps20b", s_DynamicComboArray_lightmappedreflective_ps20b, 2, s_StaticComboArray_lightmappedreflective_ps20b, 4
  222. };
  223. class ConstructMe_lightmappedreflective_ps20b
  224. {
  225. public:
  226. ConstructMe_lightmappedreflective_ps20b()
  227. {
  228. GetShaderDLL()->AddShaderComboInformation( &lightmappedreflective_ps20b_combos );
  229. }
  230. };
  231. static ConstructMe_lightmappedreflective_ps20b s_ConstructMe_lightmappedreflective_ps20b;