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.

201 lines
4.5 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $DOWATERFOG == 0 ) && ( $DOPIXELFOG && $HARDWAREFOGBLEND )
  3. // ( $DOWATERFOG == 0 ) && ( $HARDWAREFOGBLEND == 0 ) && ( $DOPIXELFOG == 0 )
  4. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  5. #include "shaderlib/cshader.h"
  6. class writez_vs20_Static_Index
  7. {
  8. private:
  9. int m_nDOPIXELFOG;
  10. #ifdef _DEBUG
  11. bool m_bDOPIXELFOG;
  12. #endif
  13. public:
  14. void SetDOPIXELFOG( int i )
  15. {
  16. Assert( i >= 0 && i <= 1 );
  17. m_nDOPIXELFOG = i;
  18. #ifdef _DEBUG
  19. m_bDOPIXELFOG = true;
  20. #endif
  21. }
  22. void SetDOPIXELFOG( bool i )
  23. {
  24. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  25. m_nDOPIXELFOG = i ? 1 : 0;
  26. #ifdef _DEBUG
  27. m_bDOPIXELFOG = true;
  28. #endif
  29. }
  30. private:
  31. int m_nHARDWAREFOGBLEND;
  32. #ifdef _DEBUG
  33. bool m_bHARDWAREFOGBLEND;
  34. #endif
  35. public:
  36. void SetHARDWAREFOGBLEND( int i )
  37. {
  38. Assert( i >= 0 && i <= 0 );
  39. m_nHARDWAREFOGBLEND = i;
  40. #ifdef _DEBUG
  41. m_bHARDWAREFOGBLEND = true;
  42. #endif
  43. }
  44. void SetHARDWAREFOGBLEND( bool i )
  45. {
  46. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  47. m_nHARDWAREFOGBLEND = i ? 1 : 0;
  48. #ifdef _DEBUG
  49. m_bHARDWAREFOGBLEND = true;
  50. #endif
  51. }
  52. public:
  53. // CONSTRUCTOR
  54. writez_vs20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  55. {
  56. #ifdef _DEBUG
  57. m_bDOPIXELFOG = true;
  58. #endif // _DEBUG
  59. m_nDOPIXELFOG = g_pHardwareConfig->SupportsPixelShaders_2_b() ;
  60. #ifdef _DEBUG
  61. m_bHARDWAREFOGBLEND = true;
  62. #endif // _DEBUG
  63. m_nHARDWAREFOGBLEND = 0 ;
  64. }
  65. int GetIndex()
  66. {
  67. // Asserts to make sure that we aren't using any skipped combinations.
  68. // Asserts to make sure that we are setting all of the combination vars.
  69. #ifdef _DEBUG
  70. bool bAllStaticVarsDefined = m_bDOPIXELFOG && m_bHARDWAREFOGBLEND;
  71. Assert( bAllStaticVarsDefined );
  72. #endif // _DEBUG
  73. return ( 8 * m_nDOPIXELFOG ) + ( 16 * m_nHARDWAREFOGBLEND ) + 0;
  74. }
  75. };
  76. #define shaderStaticTest_writez_vs20 0
  77. class writez_vs20_Dynamic_Index
  78. {
  79. private:
  80. int m_nSKINNING;
  81. #ifdef _DEBUG
  82. bool m_bSKINNING;
  83. #endif
  84. public:
  85. void SetSKINNING( int i )
  86. {
  87. Assert( i >= 0 && i <= 1 );
  88. m_nSKINNING = i;
  89. #ifdef _DEBUG
  90. m_bSKINNING = true;
  91. #endif
  92. }
  93. void SetSKINNING( bool i )
  94. {
  95. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  96. m_nSKINNING = i ? 1 : 0;
  97. #ifdef _DEBUG
  98. m_bSKINNING = true;
  99. #endif
  100. }
  101. private:
  102. int m_nCOMPRESSED_VERTS;
  103. #ifdef _DEBUG
  104. bool m_bCOMPRESSED_VERTS;
  105. #endif
  106. public:
  107. void SetCOMPRESSED_VERTS( int i )
  108. {
  109. Assert( i >= 0 && i <= 1 );
  110. m_nCOMPRESSED_VERTS = i;
  111. #ifdef _DEBUG
  112. m_bCOMPRESSED_VERTS = true;
  113. #endif
  114. }
  115. void SetCOMPRESSED_VERTS( bool i )
  116. {
  117. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  118. m_nCOMPRESSED_VERTS = i ? 1 : 0;
  119. #ifdef _DEBUG
  120. m_bCOMPRESSED_VERTS = true;
  121. #endif
  122. }
  123. private:
  124. int m_nDOWATERFOG;
  125. #ifdef _DEBUG
  126. bool m_bDOWATERFOG;
  127. #endif
  128. public:
  129. void SetDOWATERFOG( int i )
  130. {
  131. Assert( i >= 0 && i <= 1 );
  132. m_nDOWATERFOG = i;
  133. #ifdef _DEBUG
  134. m_bDOWATERFOG = true;
  135. #endif
  136. }
  137. void SetDOWATERFOG( bool i )
  138. {
  139. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  140. m_nDOWATERFOG = i ? 1 : 0;
  141. #ifdef _DEBUG
  142. m_bDOWATERFOG = true;
  143. #endif
  144. }
  145. public:
  146. // CONSTRUCTOR
  147. writez_vs20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  148. {
  149. #ifdef _DEBUG
  150. m_bSKINNING = false;
  151. #endif // _DEBUG
  152. m_nSKINNING = 0;
  153. #ifdef _DEBUG
  154. m_bCOMPRESSED_VERTS = false;
  155. #endif // _DEBUG
  156. m_nCOMPRESSED_VERTS = 0;
  157. #ifdef _DEBUG
  158. m_bDOWATERFOG = true;
  159. #endif // _DEBUG
  160. m_nDOWATERFOG = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  161. }
  162. int GetIndex()
  163. {
  164. // Asserts to make sure that we aren't using any skipped combinations.
  165. // Asserts to make sure that we are setting all of the combination vars.
  166. #ifdef _DEBUG
  167. bool bAllDynamicVarsDefined = m_bSKINNING && m_bCOMPRESSED_VERTS && m_bDOWATERFOG;
  168. Assert( bAllDynamicVarsDefined );
  169. #endif // _DEBUG
  170. return ( 1 * m_nSKINNING ) + ( 2 * m_nCOMPRESSED_VERTS ) + ( 4 * m_nDOWATERFOG ) + 0;
  171. }
  172. };
  173. #define shaderDynamicTest_writez_vs20 vsh_forgot_to_set_dynamic_SKINNING + vsh_forgot_to_set_dynamic_COMPRESSED_VERTS + 0
  174. static const ShaderComboInformation_t s_DynamicComboArray_writez_vs20[3] =
  175. {
  176. { "SKINNING", 0, 1 },
  177. { "COMPRESSED_VERTS", 0, 1 },
  178. { "DOWATERFOG", 0, 1 },
  179. };
  180. static const ShaderComboInformation_t s_StaticComboArray_writez_vs20[2] =
  181. {
  182. { "DOPIXELFOG", 0, 1 },
  183. { "HARDWAREFOGBLEND", 0, 0 },
  184. };
  185. static const ShaderComboSemantics_t writez_vs20_combos =
  186. {
  187. "writez_vs20", s_DynamicComboArray_writez_vs20, 3, s_StaticComboArray_writez_vs20, 2
  188. };
  189. class ConstructMe_writez_vs20
  190. {
  191. public:
  192. ConstructMe_writez_vs20()
  193. {
  194. GetShaderDLL()->AddShaderComboInformation( &writez_vs20_combos );
  195. }
  196. };
  197. static ConstructMe_writez_vs20 s_ConstructMe_writez_vs20;