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.7 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( CROSSHAIR_MODE == 1 ) && ( LIGHTING_PREVIEW > 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 unlittwotexture_ps20b_Static_Index
  15. {
  16. private:
  17. int m_nTRANSLUCENT;
  18. #ifdef _DEBUG
  19. bool m_bTRANSLUCENT;
  20. #endif
  21. public:
  22. void SetTRANSLUCENT( int i )
  23. {
  24. Assert( i >= 0 && i <= 1 );
  25. m_nTRANSLUCENT = i;
  26. #ifdef _DEBUG
  27. m_bTRANSLUCENT = true;
  28. #endif
  29. }
  30. void SetTRANSLUCENT( bool i )
  31. {
  32. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  33. m_nTRANSLUCENT = i ? 1 : 0;
  34. #ifdef _DEBUG
  35. m_bTRANSLUCENT = true;
  36. #endif
  37. }
  38. private:
  39. int m_nLIGHTING_PREVIEW;
  40. #ifdef _DEBUG
  41. bool m_bLIGHTING_PREVIEW;
  42. #endif
  43. public:
  44. void SetLIGHTING_PREVIEW( int i )
  45. {
  46. Assert( i >= 0 && i <= 3 );
  47. m_nLIGHTING_PREVIEW = i;
  48. #ifdef _DEBUG
  49. m_bLIGHTING_PREVIEW = true;
  50. #endif
  51. }
  52. void SetLIGHTING_PREVIEW( bool i )
  53. {
  54. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 3 );
  55. m_nLIGHTING_PREVIEW = i ? 1 : 0;
  56. #ifdef _DEBUG
  57. m_bLIGHTING_PREVIEW = true;
  58. #endif
  59. }
  60. private:
  61. int m_nCROSSHAIR_MODE;
  62. #ifdef _DEBUG
  63. bool m_bCROSSHAIR_MODE;
  64. #endif
  65. public:
  66. void SetCROSSHAIR_MODE( int i )
  67. {
  68. Assert( i >= 0 && i <= 1 );
  69. m_nCROSSHAIR_MODE = i;
  70. #ifdef _DEBUG
  71. m_bCROSSHAIR_MODE = true;
  72. #endif
  73. }
  74. void SetCROSSHAIR_MODE( bool i )
  75. {
  76. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  77. m_nCROSSHAIR_MODE = i ? 1 : 0;
  78. #ifdef _DEBUG
  79. m_bCROSSHAIR_MODE = true;
  80. #endif
  81. }
  82. public:
  83. // CONSTRUCTOR
  84. unlittwotexture_ps20b_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  85. {
  86. #ifdef _DEBUG
  87. m_bTRANSLUCENT = false;
  88. #endif // _DEBUG
  89. m_nTRANSLUCENT = 0;
  90. #ifdef _DEBUG
  91. m_bLIGHTING_PREVIEW = false;
  92. #endif // _DEBUG
  93. m_nLIGHTING_PREVIEW = 0;
  94. #ifdef _DEBUG
  95. m_bCROSSHAIR_MODE = false;
  96. #endif // _DEBUG
  97. m_nCROSSHAIR_MODE = 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_bTRANSLUCENT && m_bLIGHTING_PREVIEW && m_bCROSSHAIR_MODE;
  105. Assert( bAllStaticVarsDefined );
  106. #endif // _DEBUG
  107. return ( 4 * m_nTRANSLUCENT ) + ( 8 * m_nLIGHTING_PREVIEW ) + ( 32 * m_nCROSSHAIR_MODE ) + 0;
  108. }
  109. };
  110. #define shaderStaticTest_unlittwotexture_ps20b psh_forgot_to_set_static_TRANSLUCENT + psh_forgot_to_set_static_LIGHTING_PREVIEW + psh_forgot_to_set_static_CROSSHAIR_MODE + 0
  111. class unlittwotexture_ps20b_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_nWRITE_DEPTH_TO_DESTALPHA;
  137. #ifdef _DEBUG
  138. bool m_bWRITE_DEPTH_TO_DESTALPHA;
  139. #endif
  140. public:
  141. void SetWRITE_DEPTH_TO_DESTALPHA( int i )
  142. {
  143. Assert( i >= 0 && i <= 1 );
  144. m_nWRITE_DEPTH_TO_DESTALPHA = i;
  145. #ifdef _DEBUG
  146. m_bWRITE_DEPTH_TO_DESTALPHA = true;
  147. #endif
  148. }
  149. void SetWRITE_DEPTH_TO_DESTALPHA( bool i )
  150. {
  151. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  152. m_nWRITE_DEPTH_TO_DESTALPHA = i ? 1 : 0;
  153. #ifdef _DEBUG
  154. m_bWRITE_DEPTH_TO_DESTALPHA = true;
  155. #endif
  156. }
  157. public:
  158. // CONSTRUCTOR
  159. unlittwotexture_ps20b_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_bWRITE_DEPTH_TO_DESTALPHA = false;
  167. #endif // _DEBUG
  168. m_nWRITE_DEPTH_TO_DESTALPHA = 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_bWRITE_DEPTH_TO_DESTALPHA;
  176. Assert( bAllDynamicVarsDefined );
  177. #endif // _DEBUG
  178. return ( 1 * m_nPIXELFOGTYPE ) + ( 2 * m_nWRITE_DEPTH_TO_DESTALPHA ) + 0;
  179. }
  180. };
  181. #define shaderDynamicTest_unlittwotexture_ps20b psh_forgot_to_set_dynamic_WRITE_DEPTH_TO_DESTALPHA + 0
  182. static const ShaderComboInformation_t s_DynamicComboArray_unlittwotexture_ps20b[2] =
  183. {
  184. { "PIXELFOGTYPE", 0, 1 },
  185. { "WRITE_DEPTH_TO_DESTALPHA", 0, 1 },
  186. };
  187. static const ShaderComboInformation_t s_StaticComboArray_unlittwotexture_ps20b[3] =
  188. {
  189. { "TRANSLUCENT", 0, 1 },
  190. { "LIGHTING_PREVIEW", 0, 3 },
  191. { "CROSSHAIR_MODE", 0, 1 },
  192. };
  193. static const ShaderComboSemantics_t unlittwotexture_ps20b_combos =
  194. {
  195. "unlittwotexture_ps20b", s_DynamicComboArray_unlittwotexture_ps20b, 2, s_StaticComboArray_unlittwotexture_ps20b, 3
  196. };
  197. class ConstructMe_unlittwotexture_ps20b
  198. {
  199. public:
  200. ConstructMe_unlittwotexture_ps20b()
  201. {
  202. GetShaderDLL()->AddShaderComboInformation( &unlittwotexture_ps20b_combos );
  203. }
  204. };
  205. static ConstructMe_unlittwotexture_ps20b s_ConstructMe_unlittwotexture_ps20b;