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.

231 lines
5.5 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $STAGE != 2 ) && ( $TINTED == 1 )
  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 portal_refract_ps20b_Static_Index
  10. {
  11. private:
  12. int m_nSTAGE;
  13. #ifdef _DEBUG
  14. bool m_bSTAGE;
  15. #endif
  16. public:
  17. void SetSTAGE( int i )
  18. {
  19. Assert( i >= 0 && i <= 2 );
  20. m_nSTAGE = i;
  21. #ifdef _DEBUG
  22. m_bSTAGE = true;
  23. #endif
  24. }
  25. void SetSTAGE( bool i )
  26. {
  27. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  28. m_nSTAGE = i ? 1 : 0;
  29. #ifdef _DEBUG
  30. m_bSTAGE = true;
  31. #endif
  32. }
  33. private:
  34. int m_nTINTED;
  35. #ifdef _DEBUG
  36. bool m_bTINTED;
  37. #endif
  38. public:
  39. void SetTINTED( int i )
  40. {
  41. Assert( i >= 0 && i <= 1 );
  42. m_nTINTED = i;
  43. #ifdef _DEBUG
  44. m_bTINTED = true;
  45. #endif
  46. }
  47. void SetTINTED( bool i )
  48. {
  49. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  50. m_nTINTED = i ? 1 : 0;
  51. #ifdef _DEBUG
  52. m_bTINTED = true;
  53. #endif
  54. }
  55. private:
  56. int m_nSHADER_SRGB_READ;
  57. #ifdef _DEBUG
  58. bool m_bSHADER_SRGB_READ;
  59. #endif
  60. public:
  61. void SetSHADER_SRGB_READ( int i )
  62. {
  63. Assert( i >= 0 && i <= 1 );
  64. m_nSHADER_SRGB_READ = i;
  65. #ifdef _DEBUG
  66. m_bSHADER_SRGB_READ = true;
  67. #endif
  68. }
  69. void SetSHADER_SRGB_READ( bool i )
  70. {
  71. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  72. m_nSHADER_SRGB_READ = i ? 1 : 0;
  73. #ifdef _DEBUG
  74. m_bSHADER_SRGB_READ = true;
  75. #endif
  76. }
  77. private:
  78. int m_nDOPIXELFOG;
  79. #ifdef _DEBUG
  80. bool m_bDOPIXELFOG;
  81. #endif
  82. public:
  83. void SetDOPIXELFOG( int i )
  84. {
  85. Assert( i >= 0 && i <= 1 );
  86. m_nDOPIXELFOG = i;
  87. #ifdef _DEBUG
  88. m_bDOPIXELFOG = true;
  89. #endif
  90. }
  91. void SetDOPIXELFOG( bool i )
  92. {
  93. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  94. m_nDOPIXELFOG = i ? 1 : 0;
  95. #ifdef _DEBUG
  96. m_bDOPIXELFOG = true;
  97. #endif
  98. }
  99. public:
  100. // CONSTRUCTOR
  101. portal_refract_ps20b_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  102. {
  103. #ifdef _DEBUG
  104. m_bSTAGE = false;
  105. #endif // _DEBUG
  106. m_nSTAGE = 0;
  107. #ifdef _DEBUG
  108. m_bTINTED = false;
  109. #endif // _DEBUG
  110. m_nTINTED = 0;
  111. #ifdef _DEBUG
  112. m_bSHADER_SRGB_READ = false;
  113. #endif // _DEBUG
  114. m_nSHADER_SRGB_READ = 0;
  115. #ifdef _DEBUG
  116. m_bDOPIXELFOG = true;
  117. #endif // _DEBUG
  118. m_nDOPIXELFOG = !IS_FLAG_SET( MATERIAL_VAR_VERTEXFOG ) ? 1 : 0 ;
  119. }
  120. int GetIndex()
  121. {
  122. // Asserts to make sure that we aren't using any skipped combinations.
  123. // Asserts to make sure that we are setting all of the combination vars.
  124. #ifdef _DEBUG
  125. bool bAllStaticVarsDefined = m_bSTAGE && m_bTINTED && m_bSHADER_SRGB_READ && m_bDOPIXELFOG;
  126. Assert( bAllStaticVarsDefined );
  127. #endif // _DEBUG
  128. return ( 4 * m_nSTAGE ) + ( 12 * m_nTINTED ) + ( 24 * m_nSHADER_SRGB_READ ) + ( 48 * m_nDOPIXELFOG ) + 0;
  129. }
  130. };
  131. #define shaderStaticTest_portal_refract_ps20b psh_forgot_to_set_static_STAGE + psh_forgot_to_set_static_TINTED + psh_forgot_to_set_static_SHADER_SRGB_READ + 0
  132. class portal_refract_ps20b_Dynamic_Index
  133. {
  134. private:
  135. int m_nD_NVIDIA_STEREO;
  136. #ifdef _DEBUG
  137. bool m_bD_NVIDIA_STEREO;
  138. #endif
  139. public:
  140. void SetD_NVIDIA_STEREO( int i )
  141. {
  142. Assert( i >= 0 && i <= 1 );
  143. m_nD_NVIDIA_STEREO = i;
  144. #ifdef _DEBUG
  145. m_bD_NVIDIA_STEREO = true;
  146. #endif
  147. }
  148. void SetD_NVIDIA_STEREO( bool i )
  149. {
  150. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  151. m_nD_NVIDIA_STEREO = i ? 1 : 0;
  152. #ifdef _DEBUG
  153. m_bD_NVIDIA_STEREO = true;
  154. #endif
  155. }
  156. private:
  157. int m_nPIXELFOGTYPE;
  158. #ifdef _DEBUG
  159. bool m_bPIXELFOGTYPE;
  160. #endif
  161. public:
  162. void SetPIXELFOGTYPE( int i )
  163. {
  164. Assert( i >= 0 && i <= 1 );
  165. m_nPIXELFOGTYPE = i;
  166. #ifdef _DEBUG
  167. m_bPIXELFOGTYPE = true;
  168. #endif
  169. }
  170. void SetPIXELFOGTYPE( bool i )
  171. {
  172. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  173. m_nPIXELFOGTYPE = i ? 1 : 0;
  174. #ifdef _DEBUG
  175. m_bPIXELFOGTYPE = true;
  176. #endif
  177. }
  178. public:
  179. // CONSTRUCTOR
  180. portal_refract_ps20b_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  181. {
  182. #ifdef _DEBUG
  183. m_bD_NVIDIA_STEREO = false;
  184. #endif // _DEBUG
  185. m_nD_NVIDIA_STEREO = 0;
  186. #ifdef _DEBUG
  187. m_bPIXELFOGTYPE = true;
  188. #endif // _DEBUG
  189. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  190. }
  191. int GetIndex()
  192. {
  193. // Asserts to make sure that we aren't using any skipped combinations.
  194. // Asserts to make sure that we are setting all of the combination vars.
  195. #ifdef _DEBUG
  196. bool bAllDynamicVarsDefined = m_bD_NVIDIA_STEREO && m_bPIXELFOGTYPE;
  197. Assert( bAllDynamicVarsDefined );
  198. #endif // _DEBUG
  199. return ( 1 * m_nD_NVIDIA_STEREO ) + ( 2 * m_nPIXELFOGTYPE ) + 0;
  200. }
  201. };
  202. #define shaderDynamicTest_portal_refract_ps20b psh_forgot_to_set_dynamic_D_NVIDIA_STEREO + 0
  203. static const ShaderComboInformation_t s_DynamicComboArray_portal_refract_ps20b[2] =
  204. {
  205. { "D_NVIDIA_STEREO", 0, 1 },
  206. { "PIXELFOGTYPE", 0, 1 },
  207. };
  208. static const ShaderComboInformation_t s_StaticComboArray_portal_refract_ps20b[4] =
  209. {
  210. { "STAGE", 0, 2 },
  211. { "TINTED", 0, 1 },
  212. { "SHADER_SRGB_READ", 0, 1 },
  213. { "DOPIXELFOG", 0, 1 },
  214. };
  215. static const ShaderComboSemantics_t portal_refract_ps20b_combos =
  216. {
  217. "portal_refract_ps20b", s_DynamicComboArray_portal_refract_ps20b, 2, s_StaticComboArray_portal_refract_ps20b, 4
  218. };
  219. class ConstructMe_portal_refract_ps20b
  220. {
  221. public:
  222. ConstructMe_portal_refract_ps20b()
  223. {
  224. GetShaderDLL()->AddShaderComboInformation( &portal_refract_ps20b_combos );
  225. }
  226. };
  227. static ConstructMe_portal_refract_ps20b s_ConstructMe_portal_refract_ps20b;