1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
//========= 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
|