//========= Copyright Valve Corporation, All rights reserved. ============// // // Purpose: // // $NoKeywords: $ // //===========================================================================// #ifndef SHADERSHADOWDX10_H #define SHADERSHADOWDX10_H #ifdef _WIN32 #pragma once #endif #include "shaderapi/ishaderapi.h" #include "shaderapi/ishadershadow.h" //----------------------------------------------------------------------------- // The empty shader shadow //----------------------------------------------------------------------------- class CShaderShadowDx10 : public IShaderShadow { public: CShaderShadowDx10(); virtual ~CShaderShadowDx10(); // Sets the default *shadow* state void SetDefaultState(); // Methods related to depth buffering void DepthFunc( ShaderDepthFunc_t depthFunc ); void EnableDepthWrites( bool bEnable ); void EnableDepthTest( bool bEnable ); void EnablePolyOffset( PolygonOffsetMode_t nOffsetMode ); // Suppresses/activates color writing void EnableColorWrites( bool bEnable ); void EnableAlphaWrites( bool bEnable ); // Methods related to alpha blending void EnableBlending( bool bEnable ); void BlendFunc( ShaderBlendFactor_t srcFactor, ShaderBlendFactor_t dstFactor ); // Alpha testing void EnableAlphaTest( bool bEnable ); void AlphaFunc( ShaderAlphaFunc_t alphaFunc, float alphaRef /* [0-1] */ ); // Wireframe/filled polygons void PolyMode( ShaderPolyModeFace_t face, ShaderPolyMode_t polyMode ); // Back face culling void EnableCulling( bool bEnable ); // constant color + transparency void EnableConstantColor( bool bEnable ); // Indicates the vertex format for use with a vertex shader // The flags to pass in here come from the VertexFormatFlags_t enum // If pTexCoordDimensions is *not* specified, we assume all coordinates // are 2-dimensional void VertexShaderVertexFormat( unsigned int flags, int numTexCoords, int* pTexCoordDimensions, int userDataSize ); // Indicates we're going to light the model void EnableLighting( bool bEnable ); void EnableSpecular( bool bEnable ); // vertex blending void EnableVertexBlend( bool bEnable ); // per texture unit stuff void OverbrightValue( TextureStage_t stage, float value ); void EnableTexture( Sampler_t stage, bool bEnable ); void EnableTexGen( TextureStage_t stage, bool bEnable ); void TexGen( TextureStage_t stage, ShaderTexGenParam_t param ); // alternate method of specifying per-texture unit stuff, more flexible and more complicated // Can be used to specify different operation per channel (alpha/color)... void EnableCustomPixelPipe( bool bEnable ); void CustomTextureStages( int stageCount ); void CustomTextureOperation( TextureStage_t stage, ShaderTexChannel_t channel, ShaderTexOp_t op, ShaderTexArg_t arg1, ShaderTexArg_t arg2 ); // indicates what per-vertex data we're providing void DrawFlags( unsigned int drawFlags ); // A simpler method of dealing with alpha modulation void EnableAlphaPipe( bool bEnable ); void EnableConstantAlpha( bool bEnable ); void EnableVertexAlpha( bool bEnable ); void EnableTextureAlpha( TextureStage_t stage, bool bEnable ); // GR - Separate alpha blending void EnableBlendingSeparateAlpha( bool bEnable ); void BlendFuncSeparateAlpha( ShaderBlendFactor_t srcFactor, ShaderBlendFactor_t dstFactor ); // Sets the vertex and pixel shaders void SetVertexShader( const char *pFileName, int vshIndex ); void SetPixelShader( const char *pFileName, int pshIndex ); // Convert from linear to gamma color space on writes to frame buffer. void EnableSRGBWrite( bool bEnable ) { } void EnableSRGBRead( Sampler_t stage, bool bEnable ) { } virtual void FogMode( ShaderFogMode_t fogMode ) { } virtual void SetDiffuseMaterialSource( ShaderMaterialSource_t materialSource ) { } virtual void SetMorphFormat( MorphFormat_t flags ) { } virtual void EnableStencil( bool bEnable ) { } virtual void StencilFunc( ShaderStencilFunc_t stencilFunc ) { } virtual void StencilPassOp( ShaderStencilOp_t stencilOp ) { } virtual void StencilFailOp( ShaderStencilOp_t stencilOp ) { } virtual void StencilDepthFailOp( ShaderStencilOp_t stencilOp ) { } virtual void StencilReference( int nReference ) { } virtual void StencilMask( int nMask ) { } virtual void StencilWriteMask( int nMask ) { } virtual void DisableFogGammaCorrection( bool bDisable ) { //FIXME: empty for now. } virtual void FogMode( ShaderFogMode_t fogMode, bool bVertexFog ) { //FIXME: empty for now. } // Alpha to coverage void EnableAlphaToCoverage( bool bEnable ); void SetShadowDepthFiltering( Sampler_t stage ); // More alpha blending state void BlendOp( ShaderBlendOp_t blendOp ); void BlendOpSeparateAlpha( ShaderBlendOp_t blendOp ); bool m_IsTranslucent; bool m_IsAlphaTested; bool m_bIsDepthWriteEnabled; bool m_bUsesVertexAndPixelShaders; }; extern CShaderShadowDx10* g_pShaderShadowDx10; #endif // SHADERSHADOWDX10_H