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.

182 lines
4.9 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $CASCADED_SHADOW_MAPPING == 0 ) && ( $DYN_CSM_ENABLED == 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. // 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 cs_grass_ps30_Static_Index
  15. {
  16. private:
  17. int m_nCASCADED_SHADOW_MAPPING;
  18. #ifdef _DEBUG
  19. bool m_bCASCADED_SHADOW_MAPPING;
  20. #endif
  21. public:
  22. void SetCASCADED_SHADOW_MAPPING( int i )
  23. {
  24. Assert( i >= 0 && i <= 1 );
  25. m_nCASCADED_SHADOW_MAPPING = i;
  26. #ifdef _DEBUG
  27. m_bCASCADED_SHADOW_MAPPING = true;
  28. #endif
  29. }
  30. void SetCASCADED_SHADOW_MAPPING( bool i )
  31. {
  32. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  33. m_nCASCADED_SHADOW_MAPPING = i ? 1 : 0;
  34. #ifdef _DEBUG
  35. m_bCASCADED_SHADOW_MAPPING = true;
  36. #endif
  37. }
  38. private:
  39. int m_nCSM_MODE;
  40. #ifdef _DEBUG
  41. bool m_bCSM_MODE;
  42. #endif
  43. public:
  44. void SetCSM_MODE( int i )
  45. {
  46. Assert( i >= 0 && i <= 3 );
  47. m_nCSM_MODE = i;
  48. #ifdef _DEBUG
  49. m_bCSM_MODE = true;
  50. #endif
  51. }
  52. void SetCSM_MODE( bool i )
  53. {
  54. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 3 );
  55. m_nCSM_MODE = i ? 1 : 0;
  56. #ifdef _DEBUG
  57. m_bCSM_MODE = true;
  58. #endif
  59. }
  60. public:
  61. // CONSTRUCTOR
  62. cs_grass_ps30_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  63. {
  64. #ifdef _DEBUG
  65. m_bCASCADED_SHADOW_MAPPING = false;
  66. #endif // _DEBUG
  67. m_nCASCADED_SHADOW_MAPPING = 0;
  68. #ifdef _DEBUG
  69. m_bCSM_MODE = false;
  70. #endif // _DEBUG
  71. m_nCSM_MODE = 0;
  72. }
  73. int GetIndex()
  74. {
  75. // Asserts to make sure that we aren't using any skipped combinations.
  76. // Asserts to make sure that we are setting all of the combination vars.
  77. #ifdef _DEBUG
  78. bool bAllStaticVarsDefined = m_bCASCADED_SHADOW_MAPPING && m_bCSM_MODE;
  79. Assert( bAllStaticVarsDefined );
  80. #endif // _DEBUG
  81. return ( 4 * m_nCASCADED_SHADOW_MAPPING ) + ( 8 * m_nCSM_MODE ) + 0;
  82. }
  83. };
  84. #define shaderStaticTest_cs_grass_ps30 psh_forgot_to_set_static_CASCADED_SHADOW_MAPPING + psh_forgot_to_set_static_CSM_MODE + 0
  85. class cs_grass_ps30_Dynamic_Index
  86. {
  87. private:
  88. int m_nDYN_CSM_ENABLED;
  89. #ifdef _DEBUG
  90. bool m_bDYN_CSM_ENABLED;
  91. #endif
  92. public:
  93. void SetDYN_CSM_ENABLED( int i )
  94. {
  95. Assert( i >= 0 && i <= 1 );
  96. m_nDYN_CSM_ENABLED = i;
  97. #ifdef _DEBUG
  98. m_bDYN_CSM_ENABLED = true;
  99. #endif
  100. }
  101. void SetDYN_CSM_ENABLED( bool i )
  102. {
  103. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  104. m_nDYN_CSM_ENABLED = i ? 1 : 0;
  105. #ifdef _DEBUG
  106. m_bDYN_CSM_ENABLED = true;
  107. #endif
  108. }
  109. private:
  110. int m_nPIXELFOGTYPE;
  111. #ifdef _DEBUG
  112. bool m_bPIXELFOGTYPE;
  113. #endif
  114. public:
  115. void SetPIXELFOGTYPE( int i )
  116. {
  117. Assert( i >= 0 && i <= 1 );
  118. m_nPIXELFOGTYPE = i;
  119. #ifdef _DEBUG
  120. m_bPIXELFOGTYPE = true;
  121. #endif
  122. }
  123. void SetPIXELFOGTYPE( bool i )
  124. {
  125. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  126. m_nPIXELFOGTYPE = i ? 1 : 0;
  127. #ifdef _DEBUG
  128. m_bPIXELFOGTYPE = true;
  129. #endif
  130. }
  131. public:
  132. // CONSTRUCTOR
  133. cs_grass_ps30_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  134. {
  135. #ifdef _DEBUG
  136. m_bDYN_CSM_ENABLED = false;
  137. #endif // _DEBUG
  138. m_nDYN_CSM_ENABLED = 0;
  139. #ifdef _DEBUG
  140. m_bPIXELFOGTYPE = true;
  141. #endif // _DEBUG
  142. m_nPIXELFOGTYPE = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  143. }
  144. int GetIndex()
  145. {
  146. // Asserts to make sure that we aren't using any skipped combinations.
  147. // Asserts to make sure that we are setting all of the combination vars.
  148. #ifdef _DEBUG
  149. bool bAllDynamicVarsDefined = m_bDYN_CSM_ENABLED && m_bPIXELFOGTYPE;
  150. Assert( bAllDynamicVarsDefined );
  151. #endif // _DEBUG
  152. return ( 1 * m_nDYN_CSM_ENABLED ) + ( 2 * m_nPIXELFOGTYPE ) + 0;
  153. }
  154. };
  155. #define shaderDynamicTest_cs_grass_ps30 psh_forgot_to_set_dynamic_DYN_CSM_ENABLED + 0
  156. static const ShaderComboInformation_t s_DynamicComboArray_cs_grass_ps30[2] =
  157. {
  158. { "DYN_CSM_ENABLED", 0, 1 },
  159. { "PIXELFOGTYPE", 0, 1 },
  160. };
  161. static const ShaderComboInformation_t s_StaticComboArray_cs_grass_ps30[2] =
  162. {
  163. { "CASCADED_SHADOW_MAPPING", 0, 1 },
  164. { "CSM_MODE", 0, 3 },
  165. };
  166. static const ShaderComboSemantics_t cs_grass_ps30_combos =
  167. {
  168. "cs_grass_ps30", s_DynamicComboArray_cs_grass_ps30, 2, s_StaticComboArray_cs_grass_ps30, 2
  169. };
  170. class ConstructMe_cs_grass_ps30
  171. {
  172. public:
  173. ConstructMe_cs_grass_ps30()
  174. {
  175. GetShaderDLL()->AddShaderComboInformation( &cs_grass_ps30_combos );
  176. }
  177. };
  178. static ConstructMe_cs_grass_ps30 s_ConstructMe_cs_grass_ps30;