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.

209 lines
5.4 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $FLASHLIGHT != 0 ) && ( $NUM_LIGHTS > 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. // 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. #include "shaderlib/cshader.h"
  14. class eye_refract_ps20_Static_Index
  15. {
  16. private:
  17. int m_nFLASHLIGHT;
  18. #ifdef _DEBUG
  19. bool m_bFLASHLIGHT;
  20. #endif
  21. public:
  22. void SetFLASHLIGHT( int i )
  23. {
  24. Assert( i >= 0 && i <= 1 );
  25. m_nFLASHLIGHT = i;
  26. #ifdef _DEBUG
  27. m_bFLASHLIGHT = true;
  28. #endif
  29. }
  30. void SetFLASHLIGHT( bool i )
  31. {
  32. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  33. m_nFLASHLIGHT = i ? 1 : 0;
  34. #ifdef _DEBUG
  35. m_bFLASHLIGHT = true;
  36. #endif
  37. }
  38. private:
  39. int m_nLIGHTWARPTEXTURE;
  40. #ifdef _DEBUG
  41. bool m_bLIGHTWARPTEXTURE;
  42. #endif
  43. public:
  44. void SetLIGHTWARPTEXTURE( int i )
  45. {
  46. Assert( i >= 0 && i <= 1 );
  47. m_nLIGHTWARPTEXTURE = i;
  48. #ifdef _DEBUG
  49. m_bLIGHTWARPTEXTURE = true;
  50. #endif
  51. }
  52. void SetLIGHTWARPTEXTURE( bool i )
  53. {
  54. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  55. m_nLIGHTWARPTEXTURE = i ? 1 : 0;
  56. #ifdef _DEBUG
  57. m_bLIGHTWARPTEXTURE = true;
  58. #endif
  59. }
  60. private:
  61. int m_nWORLD_NORMAL;
  62. #ifdef _DEBUG
  63. bool m_bWORLD_NORMAL;
  64. #endif
  65. public:
  66. void SetWORLD_NORMAL( int i )
  67. {
  68. Assert( i >= 0 && i <= 0 );
  69. m_nWORLD_NORMAL = i;
  70. #ifdef _DEBUG
  71. m_bWORLD_NORMAL = true;
  72. #endif
  73. }
  74. void SetWORLD_NORMAL( bool i )
  75. {
  76. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  77. m_nWORLD_NORMAL = i ? 1 : 0;
  78. #ifdef _DEBUG
  79. m_bWORLD_NORMAL = true;
  80. #endif
  81. }
  82. public:
  83. // CONSTRUCTOR
  84. eye_refract_ps20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  85. {
  86. #ifdef _DEBUG
  87. m_bFLASHLIGHT = false;
  88. #endif // _DEBUG
  89. m_nFLASHLIGHT = 0;
  90. #ifdef _DEBUG
  91. m_bLIGHTWARPTEXTURE = false;
  92. #endif // _DEBUG
  93. m_nLIGHTWARPTEXTURE = 0;
  94. #ifdef _DEBUG
  95. m_bWORLD_NORMAL = false;
  96. #endif // _DEBUG
  97. m_nWORLD_NORMAL = 0;
  98. }
  99. int GetIndex()
  100. {
  101. // Asserts to make sure that we aren't using any skipped combinations.
  102. // Asserts to make sure that we are setting all of the combination vars.
  103. #ifdef _DEBUG
  104. bool bAllStaticVarsDefined = m_bFLASHLIGHT && m_bLIGHTWARPTEXTURE && m_bWORLD_NORMAL;
  105. Assert( bAllStaticVarsDefined );
  106. #endif // _DEBUG
  107. return ( 6 * m_nFLASHLIGHT ) + ( 12 * m_nLIGHTWARPTEXTURE ) + ( 24 * m_nWORLD_NORMAL ) + 0;
  108. }
  109. };
  110. #define shaderStaticTest_eye_refract_ps20 psh_forgot_to_set_static_FLASHLIGHT + psh_forgot_to_set_static_LIGHTWARPTEXTURE + psh_forgot_to_set_static_WORLD_NORMAL + 0
  111. class eye_refract_ps20_Dynamic_Index
  112. {
  113. private:
  114. int m_nPIXELFOGTYPE;
  115. #ifdef _DEBUG
  116. bool m_bPIXELFOGTYPE;
  117. #endif
  118. public:
  119. void SetPIXELFOGTYPE( int i )
  120. {
  121. Assert( i >= 0 && i <= 1 );
  122. m_nPIXELFOGTYPE = i;
  123. #ifdef _DEBUG
  124. m_bPIXELFOGTYPE = true;
  125. #endif
  126. }
  127. void SetPIXELFOGTYPE( bool i )
  128. {
  129. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  130. m_nPIXELFOGTYPE = i ? 1 : 0;
  131. #ifdef _DEBUG
  132. m_bPIXELFOGTYPE = true;
  133. #endif
  134. }
  135. private:
  136. int m_nNUM_LIGHTS;
  137. #ifdef _DEBUG
  138. bool m_bNUM_LIGHTS;
  139. #endif
  140. public:
  141. void SetNUM_LIGHTS( int i )
  142. {
  143. Assert( i >= 0 && i <= 2 );
  144. m_nNUM_LIGHTS = i;
  145. #ifdef _DEBUG
  146. m_bNUM_LIGHTS = true;
  147. #endif
  148. }
  149. void SetNUM_LIGHTS( bool i )
  150. {
  151. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  152. m_nNUM_LIGHTS = i ? 1 : 0;
  153. #ifdef _DEBUG
  154. m_bNUM_LIGHTS = true;
  155. #endif
  156. }
  157. public:
  158. // CONSTRUCTOR
  159. eye_refract_ps20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  160. {
  161. #ifdef _DEBUG
  162. m_bPIXELFOGTYPE = true;
  163. #endif // _DEBUG
  164. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  165. #ifdef _DEBUG
  166. m_bNUM_LIGHTS = false;
  167. #endif // _DEBUG
  168. m_nNUM_LIGHTS = 0;
  169. }
  170. int GetIndex()
  171. {
  172. // Asserts to make sure that we aren't using any skipped combinations.
  173. // Asserts to make sure that we are setting all of the combination vars.
  174. #ifdef _DEBUG
  175. bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE && m_bNUM_LIGHTS;
  176. Assert( bAllDynamicVarsDefined );
  177. #endif // _DEBUG
  178. return ( 1 * m_nPIXELFOGTYPE ) + ( 2 * m_nNUM_LIGHTS ) + 0;
  179. }
  180. };
  181. #define shaderDynamicTest_eye_refract_ps20 psh_forgot_to_set_dynamic_NUM_LIGHTS + 0
  182. static const ShaderComboInformation_t s_DynamicComboArray_eye_refract_ps20[2] =
  183. {
  184. { "PIXELFOGTYPE", 0, 1 },
  185. { "NUM_LIGHTS", 0, 2 },
  186. };
  187. static const ShaderComboInformation_t s_StaticComboArray_eye_refract_ps20[3] =
  188. {
  189. { "FLASHLIGHT", 0, 1 },
  190. { "LIGHTWARPTEXTURE", 0, 1 },
  191. { "WORLD_NORMAL", 0, 0 },
  192. };
  193. static const ShaderComboSemantics_t eye_refract_ps20_combos =
  194. {
  195. "eye_refract_ps20", s_DynamicComboArray_eye_refract_ps20, 2, s_StaticComboArray_eye_refract_ps20, 3
  196. };
  197. class ConstructMe_eye_refract_ps20
  198. {
  199. public:
  200. ConstructMe_eye_refract_ps20()
  201. {
  202. GetShaderDLL()->AddShaderComboInformation( &eye_refract_ps20_combos );
  203. }
  204. };
  205. static ConstructMe_eye_refract_ps20 s_ConstructMe_eye_refract_ps20;