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.

208 lines
5.3 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 portal_ps20b_Static_Index
  14. {
  15. private:
  16. int m_nHASALPHAMASK;
  17. #ifdef _DEBUG
  18. bool m_bHASALPHAMASK;
  19. #endif
  20. public:
  21. void SetHASALPHAMASK( int i )
  22. {
  23. Assert( i >= 0 && i <= 1 );
  24. m_nHASALPHAMASK = i;
  25. #ifdef _DEBUG
  26. m_bHASALPHAMASK = true;
  27. #endif
  28. }
  29. void SetHASALPHAMASK( bool i )
  30. {
  31. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  32. m_nHASALPHAMASK = i ? 1 : 0;
  33. #ifdef _DEBUG
  34. m_bHASALPHAMASK = true;
  35. #endif
  36. }
  37. private:
  38. int m_nHASSTATICTEXTURE;
  39. #ifdef _DEBUG
  40. bool m_bHASSTATICTEXTURE;
  41. #endif
  42. public:
  43. void SetHASSTATICTEXTURE( int i )
  44. {
  45. Assert( i >= 0 && i <= 1 );
  46. m_nHASSTATICTEXTURE = i;
  47. #ifdef _DEBUG
  48. m_bHASSTATICTEXTURE = true;
  49. #endif
  50. }
  51. void SetHASSTATICTEXTURE( bool i )
  52. {
  53. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  54. m_nHASSTATICTEXTURE = i ? 1 : 0;
  55. #ifdef _DEBUG
  56. m_bHASSTATICTEXTURE = true;
  57. #endif
  58. }
  59. public:
  60. // CONSTRUCTOR
  61. portal_ps20b_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  62. {
  63. #ifdef _DEBUG
  64. m_bHASALPHAMASK = false;
  65. #endif // _DEBUG
  66. m_nHASALPHAMASK = 0;
  67. #ifdef _DEBUG
  68. m_bHASSTATICTEXTURE = false;
  69. #endif // _DEBUG
  70. m_nHASSTATICTEXTURE = 0;
  71. }
  72. int GetIndex()
  73. {
  74. // Asserts to make sure that we aren't using any skipped combinations.
  75. // Asserts to make sure that we are setting all of the combination vars.
  76. #ifdef _DEBUG
  77. bool bAllStaticVarsDefined = m_bHASALPHAMASK && m_bHASSTATICTEXTURE;
  78. Assert( bAllStaticVarsDefined );
  79. #endif // _DEBUG
  80. return ( 4 * m_nHASALPHAMASK ) + ( 8 * m_nHASSTATICTEXTURE ) + 0;
  81. }
  82. };
  83. #define shaderStaticTest_portal_ps20b psh_forgot_to_set_static_HASALPHAMASK + psh_forgot_to_set_static_HASSTATICTEXTURE + 0
  84. class portal_ps20b_Dynamic_Index
  85. {
  86. private:
  87. int m_nADDSTATIC;
  88. #ifdef _DEBUG
  89. bool m_bADDSTATIC;
  90. #endif
  91. public:
  92. void SetADDSTATIC( int i )
  93. {
  94. Assert( i >= 0 && i <= 1 );
  95. m_nADDSTATIC = i;
  96. #ifdef _DEBUG
  97. m_bADDSTATIC = true;
  98. #endif
  99. }
  100. void SetADDSTATIC( bool i )
  101. {
  102. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  103. m_nADDSTATIC = i ? 1 : 0;
  104. #ifdef _DEBUG
  105. m_bADDSTATIC = true;
  106. #endif
  107. }
  108. private:
  109. int m_nD_NVIDIA_STEREO;
  110. #ifdef _DEBUG
  111. bool m_bD_NVIDIA_STEREO;
  112. #endif
  113. public:
  114. void SetD_NVIDIA_STEREO( int i )
  115. {
  116. Assert( i >= 0 && i <= 0 );
  117. m_nD_NVIDIA_STEREO = i;
  118. #ifdef _DEBUG
  119. m_bD_NVIDIA_STEREO = true;
  120. #endif
  121. }
  122. void SetD_NVIDIA_STEREO( bool i )
  123. {
  124. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  125. m_nD_NVIDIA_STEREO = i ? 1 : 0;
  126. #ifdef _DEBUG
  127. m_bD_NVIDIA_STEREO = true;
  128. #endif
  129. }
  130. private:
  131. int m_nPIXELFOGTYPE;
  132. #ifdef _DEBUG
  133. bool m_bPIXELFOGTYPE;
  134. #endif
  135. public:
  136. void SetPIXELFOGTYPE( int i )
  137. {
  138. Assert( i >= 0 && i <= 1 );
  139. m_nPIXELFOGTYPE = i;
  140. #ifdef _DEBUG
  141. m_bPIXELFOGTYPE = true;
  142. #endif
  143. }
  144. void SetPIXELFOGTYPE( bool i )
  145. {
  146. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  147. m_nPIXELFOGTYPE = i ? 1 : 0;
  148. #ifdef _DEBUG
  149. m_bPIXELFOGTYPE = true;
  150. #endif
  151. }
  152. public:
  153. // CONSTRUCTOR
  154. portal_ps20b_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  155. {
  156. #ifdef _DEBUG
  157. m_bADDSTATIC = false;
  158. #endif // _DEBUG
  159. m_nADDSTATIC = 0;
  160. #ifdef _DEBUG
  161. m_bD_NVIDIA_STEREO = false;
  162. #endif // _DEBUG
  163. m_nD_NVIDIA_STEREO = 0;
  164. #ifdef _DEBUG
  165. m_bPIXELFOGTYPE = true;
  166. #endif // _DEBUG
  167. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  168. }
  169. int GetIndex()
  170. {
  171. // Asserts to make sure that we aren't using any skipped combinations.
  172. // Asserts to make sure that we are setting all of the combination vars.
  173. #ifdef _DEBUG
  174. bool bAllDynamicVarsDefined = m_bADDSTATIC && m_bD_NVIDIA_STEREO && m_bPIXELFOGTYPE;
  175. Assert( bAllDynamicVarsDefined );
  176. #endif // _DEBUG
  177. return ( 1 * m_nADDSTATIC ) + ( 2 * m_nD_NVIDIA_STEREO ) + ( 2 * m_nPIXELFOGTYPE ) + 0;
  178. }
  179. };
  180. #define shaderDynamicTest_portal_ps20b psh_forgot_to_set_dynamic_ADDSTATIC + psh_forgot_to_set_dynamic_D_NVIDIA_STEREO + 0
  181. static const ShaderComboInformation_t s_DynamicComboArray_portal_ps20b[3] =
  182. {
  183. { "ADDSTATIC", 0, 1 },
  184. { "D_NVIDIA_STEREO", 0, 0 },
  185. { "PIXELFOGTYPE", 0, 1 },
  186. };
  187. static const ShaderComboInformation_t s_StaticComboArray_portal_ps20b[2] =
  188. {
  189. { "HASALPHAMASK", 0, 1 },
  190. { "HASSTATICTEXTURE", 0, 1 },
  191. };
  192. static const ShaderComboSemantics_t portal_ps20b_combos =
  193. {
  194. "portal_ps20b", s_DynamicComboArray_portal_ps20b, 3, s_StaticComboArray_portal_ps20b, 2
  195. };
  196. class ConstructMe_portal_ps20b
  197. {
  198. public:
  199. ConstructMe_portal_ps20b()
  200. {
  201. GetShaderDLL()->AddShaderComboInformation( &portal_ps20b_combos );
  202. }
  203. };
  204. static ConstructMe_portal_ps20b s_ConstructMe_portal_ps20b;