Team Fortress 2 Source Code as on 22/4/2020
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.

175 lines
4.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #ifndef SHADERSHADOWDX10_H
  9. #define SHADERSHADOWDX10_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "shaderapi/ishaderapi.h"
  14. #include "shaderapi/ishadershadow.h"
  15. //-----------------------------------------------------------------------------
  16. // The empty shader shadow
  17. //-----------------------------------------------------------------------------
  18. class CShaderShadowDx10 : public IShaderShadow
  19. {
  20. public:
  21. CShaderShadowDx10();
  22. virtual ~CShaderShadowDx10();
  23. // Sets the default *shadow* state
  24. void SetDefaultState();
  25. // Methods related to depth buffering
  26. void DepthFunc( ShaderDepthFunc_t depthFunc );
  27. void EnableDepthWrites( bool bEnable );
  28. void EnableDepthTest( bool bEnable );
  29. void EnablePolyOffset( PolygonOffsetMode_t nOffsetMode );
  30. // Suppresses/activates color writing
  31. void EnableColorWrites( bool bEnable );
  32. void EnableAlphaWrites( bool bEnable );
  33. // Methods related to alpha blending
  34. void EnableBlending( bool bEnable );
  35. void BlendFunc( ShaderBlendFactor_t srcFactor, ShaderBlendFactor_t dstFactor );
  36. // Alpha testing
  37. void EnableAlphaTest( bool bEnable );
  38. void AlphaFunc( ShaderAlphaFunc_t alphaFunc, float alphaRef /* [0-1] */ );
  39. // Wireframe/filled polygons
  40. void PolyMode( ShaderPolyModeFace_t face, ShaderPolyMode_t polyMode );
  41. // Back face culling
  42. void EnableCulling( bool bEnable );
  43. // constant color + transparency
  44. void EnableConstantColor( bool bEnable );
  45. // Indicates the vertex format for use with a vertex shader
  46. // The flags to pass in here come from the VertexFormatFlags_t enum
  47. // If pTexCoordDimensions is *not* specified, we assume all coordinates
  48. // are 2-dimensional
  49. void VertexShaderVertexFormat( unsigned int flags,
  50. int numTexCoords, int* pTexCoordDimensions,
  51. int userDataSize );
  52. // Indicates we're going to light the model
  53. void EnableLighting( bool bEnable );
  54. void EnableSpecular( bool bEnable );
  55. // vertex blending
  56. void EnableVertexBlend( bool bEnable );
  57. // per texture unit stuff
  58. void OverbrightValue( TextureStage_t stage, float value );
  59. void EnableTexture( Sampler_t stage, bool bEnable );
  60. void EnableTexGen( TextureStage_t stage, bool bEnable );
  61. void TexGen( TextureStage_t stage, ShaderTexGenParam_t param );
  62. // alternate method of specifying per-texture unit stuff, more flexible and more complicated
  63. // Can be used to specify different operation per channel (alpha/color)...
  64. void EnableCustomPixelPipe( bool bEnable );
  65. void CustomTextureStages( int stageCount );
  66. void CustomTextureOperation( TextureStage_t stage, ShaderTexChannel_t channel,
  67. ShaderTexOp_t op, ShaderTexArg_t arg1, ShaderTexArg_t arg2 );
  68. // indicates what per-vertex data we're providing
  69. void DrawFlags( unsigned int drawFlags );
  70. // A simpler method of dealing with alpha modulation
  71. void EnableAlphaPipe( bool bEnable );
  72. void EnableConstantAlpha( bool bEnable );
  73. void EnableVertexAlpha( bool bEnable );
  74. void EnableTextureAlpha( TextureStage_t stage, bool bEnable );
  75. // GR - Separate alpha blending
  76. void EnableBlendingSeparateAlpha( bool bEnable );
  77. void BlendFuncSeparateAlpha( ShaderBlendFactor_t srcFactor, ShaderBlendFactor_t dstFactor );
  78. // Sets the vertex and pixel shaders
  79. void SetVertexShader( const char *pFileName, int vshIndex );
  80. void SetPixelShader( const char *pFileName, int pshIndex );
  81. // Convert from linear to gamma color space on writes to frame buffer.
  82. void EnableSRGBWrite( bool bEnable )
  83. {
  84. }
  85. void EnableSRGBRead( Sampler_t stage, bool bEnable )
  86. {
  87. }
  88. virtual void FogMode( ShaderFogMode_t fogMode )
  89. {
  90. }
  91. virtual void SetDiffuseMaterialSource( ShaderMaterialSource_t materialSource )
  92. {
  93. }
  94. virtual void SetMorphFormat( MorphFormat_t flags )
  95. {
  96. }
  97. virtual void EnableStencil( bool bEnable )
  98. {
  99. }
  100. virtual void StencilFunc( ShaderStencilFunc_t stencilFunc )
  101. {
  102. }
  103. virtual void StencilPassOp( ShaderStencilOp_t stencilOp )
  104. {
  105. }
  106. virtual void StencilFailOp( ShaderStencilOp_t stencilOp )
  107. {
  108. }
  109. virtual void StencilDepthFailOp( ShaderStencilOp_t stencilOp )
  110. {
  111. }
  112. virtual void StencilReference( int nReference )
  113. {
  114. }
  115. virtual void StencilMask( int nMask )
  116. {
  117. }
  118. virtual void StencilWriteMask( int nMask )
  119. {
  120. }
  121. virtual void DisableFogGammaCorrection( bool bDisable )
  122. {
  123. //FIXME: empty for now.
  124. }
  125. virtual void FogMode( ShaderFogMode_t fogMode, bool bVertexFog )
  126. {
  127. //FIXME: empty for now.
  128. }
  129. // Alpha to coverage
  130. void EnableAlphaToCoverage( bool bEnable );
  131. void SetShadowDepthFiltering( Sampler_t stage );
  132. // More alpha blending state
  133. void BlendOp( ShaderBlendOp_t blendOp );
  134. void BlendOpSeparateAlpha( ShaderBlendOp_t blendOp );
  135. bool m_IsTranslucent;
  136. bool m_IsAlphaTested;
  137. bool m_bIsDepthWriteEnabled;
  138. bool m_bUsesVertexAndPixelShaders;
  139. };
  140. extern CShaderShadowDx10* g_pShaderShadowDx10;
  141. #endif // SHADERSHADOWDX10_H