1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2024-12-22 17:47:38 +08:00

Added bloom shader and screenspace effect helpers as examples for the SDK.

This commit is contained in:
Joe Ludwig 2013-07-30 15:10:15 -07:00
parent e4acadd6b1
commit e38213b8fe
13 changed files with 658 additions and 0 deletions

View File

@ -0,0 +1,90 @@
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose:
//
// $NoKeywords: $
//===========================================================================//
#include "BaseVSShader.h"
#include "SDK_screenspaceeffect_vs20.inc"
#include "SDK_Bloom_ps20.inc"
#include "SDK_Bloom_ps20b.inc"
BEGIN_VS_SHADER_FLAGS( SDK_Bloom, "Help for Bloom", SHADER_NOT_EDITABLE )
BEGIN_SHADER_PARAMS
SHADER_PARAM( FBTEXTURE, SHADER_PARAM_TYPE_TEXTURE, "_rt_FullFrameFB", "" )
SHADER_PARAM( BLURTEXTURE, SHADER_PARAM_TYPE_TEXTURE, "_rt_SmallHDR0", "" )
END_SHADER_PARAMS
SHADER_INIT
{
if( params[FBTEXTURE]->IsDefined() )
{
LoadTexture( FBTEXTURE );
}
if( params[BLURTEXTURE]->IsDefined() )
{
LoadTexture( BLURTEXTURE );
}
}
SHADER_FALLBACK
{
// Requires DX9 + above
if ( g_pHardwareConfig->GetDXSupportLevel() < 90 )
{
Assert( 0 );
return "Wireframe";
}
return 0;
}
SHADER_DRAW
{
SHADOW_STATE
{
pShaderShadow->EnableDepthWrites( false );
pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
pShaderShadow->EnableTexture( SHADER_SAMPLER1, true );
int fmt = VERTEX_POSITION;
pShaderShadow->VertexShaderVertexFormat( fmt, 1, 0, 0 );
// Pre-cache shaders
DECLARE_STATIC_VERTEX_SHADER( sdk_screenspaceeffect_vs20 );
SET_STATIC_VERTEX_SHADER( sdk_screenspaceeffect_vs20 );
if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
{
DECLARE_STATIC_PIXEL_SHADER( sdk_bloom_ps20b );
SET_STATIC_PIXEL_SHADER( sdk_bloom_ps20b );
}
else
{
DECLARE_STATIC_PIXEL_SHADER( sdk_bloom_ps20 );
SET_STATIC_PIXEL_SHADER( sdk_bloom_ps20 );
}
}
DYNAMIC_STATE
{
BindTexture( SHADER_SAMPLER0, FBTEXTURE, -1 );
BindTexture( SHADER_SAMPLER1, BLURTEXTURE, -1 );
DECLARE_DYNAMIC_VERTEX_SHADER( sdk_screenspaceeffect_vs20 );
SET_DYNAMIC_VERTEX_SHADER( sdk_screenspaceeffect_vs20 );
if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
{
DECLARE_DYNAMIC_PIXEL_SHADER( sdk_bloom_ps20b );
SET_DYNAMIC_PIXEL_SHADER( sdk_bloom_ps20b );
}
else
{
DECLARE_DYNAMIC_PIXEL_SHADER( sdk_bloom_ps20 );
SET_DYNAMIC_PIXEL_SHADER( sdk_bloom_ps20 );
}
}
Draw();
}
END_SHADER

View File

@ -0,0 +1,21 @@
// STATIC: "CONVERT_TO_SRGB" "0..1" [ps20b][= g_pHardwareConfig->NeedsShaderSRGBConversion()] [PC]
// STATIC: "CONVERT_TO_SRGB" "0..0" [= 0] [XBOX]
#define HDRTYPE HDR_TYPE_NONE
#include "common_ps_fxc.h"
sampler FBSampler : register( s0 );
sampler BlurSampler : register( s1 );
struct PS_INPUT
{
float2 texCoord : TEXCOORD0;
};
float4 main( PS_INPUT i ) : COLOR
{
float4 fbSample = tex2D( FBSampler, i.texCoord );
float4 blurSample = tex2D( BlurSampler, i.texCoord );
return FinalOutput( float4( fbSample + blurSample.rgb * blurSample.a * MAX_HDR_OVERBRIGHT, 1.0f ), 0, PIXEL_FOG_TYPE_NONE, TONEMAP_SCALE_NONE );
}

View File

@ -0,0 +1,18 @@
//======= Copyright © 1996-2006, Valve Corporation, All rights reserved. ======
#define CONVERT_TO_SRGB 0
#include "common_ps_fxc.h"
sampler TexSampler : register( s0 );
struct PS_INPUT
{
HALF2 baseTexCoord : TEXCOORD0; // Base texture coordinate
};
float4 main( PS_INPUT i ) : COLOR
{
float4 result = tex2D( TexSampler, i.baseTexCoord );
result.a = 1.0f;
return result; //FinalOutput( result, 0, PIXEL_FOG_TYPE_NONE, TONEMAP_SCALE_NONE );
}

View File

@ -0,0 +1,23 @@
//======= Copyright © 1996-2006, Valve Corporation, All rights reserved. ======
#define CONVERT_TO_SRGB 0
#include "common_ps_fxc.h"
sampler TexSampler : register( s0 );
struct PS_INPUT
{
HALF2 baseTexCoord : TEXCOORD0; // Base texture coordinate
#if defined( _X360 ) //matching pixel shader inputs to vertex shader outputs to avoid shader patches
float2 ZeroTexCoord : TEXCOORD1;
float2 bloomTexCoord : TEXCOORD2;
#endif
};
float4 main( PS_INPUT i ) : COLOR
{
float4 result = tex2D( TexSampler, i.baseTexCoord );
result.a = 1.0f;
return result; //FinalOutput( result, 0, PIXEL_FOG_TYPE_NONE, TONEMAP_SCALE_NONE );
}

View File

@ -0,0 +1,47 @@
//========= Copyright © 1996-2006, Valve Corporation, All rights reserved. ============//
// STATIC: "X360APPCHOOSER" "0..1" [= 0]
#include "common_vs_fxc.h"
struct VS_INPUT
{
float3 vPos : POSITION;
float2 vBaseTexCoord : TEXCOORD0;
#if X360APPCHOOSER
float4 vColor : COLOR0;
#endif
};
struct VS_OUTPUT
{
float4 projPos : POSITION;
float2 baseTexCoord : TEXCOORD0;
float2 ZeroTexCoord : TEXCOORD1;
float2 bloomTexCoord : TEXCOORD2;
#if X360APPCHOOSER
float4 vColor : TEXCOORD3;
#endif
};
float4 Texel_Sizes : register (SHADER_SPECIFIC_CONST_0);
VS_OUTPUT main( const VS_INPUT v )
{
VS_OUTPUT o = ( VS_OUTPUT )0;
o.projPos = float4( v.vPos, 1.0f );
o.baseTexCoord = v.vBaseTexCoord;
o.ZeroTexCoord=float2(0,0);
o.bloomTexCoord.x=v.vBaseTexCoord.x+Texel_Sizes.z;
o.bloomTexCoord.y=v.vBaseTexCoord.y+Texel_Sizes.w;
#if X360APPCHOOSER
o.vColor.rgba = v.vColor.rgba;
o.projPos.xyzw = mul( float4( v.vPos.xyz, 1.0f ), cModelViewProj );
#endif
return o;
}

View File

@ -0,0 +1,33 @@
#include "shaderlib/cshader.h"
class sdk_bloom_ps20_Static_Index
{
public:
sdk_bloom_ps20_Static_Index( )
{
}
int GetIndex()
{
// Asserts to make sure that we aren't using any skipped combinations.
// Asserts to make sure that we are setting all of the combination vars.
#ifdef _DEBUG
#endif // _DEBUG
return 0;
}
};
#define shaderStaticTest_sdk_bloom_ps20 0
class sdk_bloom_ps20_Dynamic_Index
{
public:
sdk_bloom_ps20_Dynamic_Index()
{
}
int GetIndex()
{
// Asserts to make sure that we aren't using any skipped combinations.
// Asserts to make sure that we are setting all of the combination vars.
#ifdef _DEBUG
#endif // _DEBUG
return 0;
}
};
#define shaderDynamicTest_sdk_bloom_ps20 0

View File

@ -0,0 +1,60 @@
#include "shaderlib/cshader.h"
class sdk_bloom_ps20b_Static_Index
{
private:
int m_nCONVERT_TO_SRGB;
#ifdef _DEBUG
bool m_bCONVERT_TO_SRGB;
#endif
public:
void SetCONVERT_TO_SRGB( int i )
{
Assert( i >= 0 && i <= 1 );
m_nCONVERT_TO_SRGB = i;
#ifdef _DEBUG
m_bCONVERT_TO_SRGB = true;
#endif
}
void SetCONVERT_TO_SRGB( bool i )
{
m_nCONVERT_TO_SRGB = i ? 1 : 0;
#ifdef _DEBUG
m_bCONVERT_TO_SRGB = true;
#endif
}
public:
sdk_bloom_ps20b_Static_Index( )
{
#ifdef _DEBUG
m_bCONVERT_TO_SRGB = true;
#endif // _DEBUG
m_nCONVERT_TO_SRGB = g_pHardwareConfig->NeedsShaderSRGBConversion();
}
int GetIndex()
{
// Asserts to make sure that we aren't using any skipped combinations.
// Asserts to make sure that we are setting all of the combination vars.
#ifdef _DEBUG
bool bAllStaticVarsDefined = m_bCONVERT_TO_SRGB;
Assert( bAllStaticVarsDefined );
#endif // _DEBUG
return ( 1 * m_nCONVERT_TO_SRGB ) + 0;
}
};
#define shaderStaticTest_sdk_bloom_ps20b 0
class sdk_bloom_ps20b_Dynamic_Index
{
public:
sdk_bloom_ps20b_Dynamic_Index()
{
}
int GetIndex()
{
// Asserts to make sure that we aren't using any skipped combinations.
// Asserts to make sure that we are setting all of the combination vars.
#ifdef _DEBUG
#endif // _DEBUG
return 0;
}
};
#define shaderDynamicTest_sdk_bloom_ps20b 0

View File

@ -0,0 +1,33 @@
#include "shaderlib/cshader.h"
class sdk_bloomadd_ps20_Static_Index
{
public:
sdk_bloomadd_ps20_Static_Index( )
{
}
int GetIndex()
{
// Asserts to make sure that we aren't using any skipped combinations.
// Asserts to make sure that we are setting all of the combination vars.
#ifdef _DEBUG
#endif // _DEBUG
return 0;
}
};
#define shaderStaticTest_sdk_bloomadd_ps20 0
class sdk_bloomadd_ps20_Dynamic_Index
{
public:
sdk_bloomadd_ps20_Dynamic_Index()
{
}
int GetIndex()
{
// Asserts to make sure that we aren't using any skipped combinations.
// Asserts to make sure that we are setting all of the combination vars.
#ifdef _DEBUG
#endif // _DEBUG
return 0;
}
};
#define shaderDynamicTest_sdk_bloomadd_ps20 0

View File

@ -0,0 +1,33 @@
#include "shaderlib/cshader.h"
class sdk_bloomadd_ps20b_Static_Index
{
public:
sdk_bloomadd_ps20b_Static_Index( )
{
}
int GetIndex()
{
// Asserts to make sure that we aren't using any skipped combinations.
// Asserts to make sure that we are setting all of the combination vars.
#ifdef _DEBUG
#endif // _DEBUG
return 0;
}
};
#define shaderStaticTest_sdk_bloomadd_ps20b 0
class sdk_bloomadd_ps20b_Dynamic_Index
{
public:
sdk_bloomadd_ps20b_Dynamic_Index()
{
}
int GetIndex()
{
// Asserts to make sure that we aren't using any skipped combinations.
// Asserts to make sure that we are setting all of the combination vars.
#ifdef _DEBUG
#endif // _DEBUG
return 0;
}
};
#define shaderDynamicTest_sdk_bloomadd_ps20b 0

View File

@ -0,0 +1,60 @@
#include "shaderlib/cshader.h"
class sdk_screenspaceeffect_vs20_Static_Index
{
private:
int m_nX360APPCHOOSER;
#ifdef _DEBUG
bool m_bX360APPCHOOSER;
#endif
public:
void SetX360APPCHOOSER( int i )
{
Assert( i >= 0 && i <= 1 );
m_nX360APPCHOOSER = i;
#ifdef _DEBUG
m_bX360APPCHOOSER = true;
#endif
}
void SetX360APPCHOOSER( bool i )
{
m_nX360APPCHOOSER = i ? 1 : 0;
#ifdef _DEBUG
m_bX360APPCHOOSER = true;
#endif
}
public:
sdk_screenspaceeffect_vs20_Static_Index( )
{
#ifdef _DEBUG
m_bX360APPCHOOSER = true;
#endif // _DEBUG
m_nX360APPCHOOSER = 0;
}
int GetIndex()
{
// Asserts to make sure that we aren't using any skipped combinations.
// Asserts to make sure that we are setting all of the combination vars.
#ifdef _DEBUG
bool bAllStaticVarsDefined = m_bX360APPCHOOSER;
Assert( bAllStaticVarsDefined );
#endif // _DEBUG
return ( 1 * m_nX360APPCHOOSER ) + 0;
}
};
#define shaderStaticTest_sdk_screenspaceeffect_vs20 0
class sdk_screenspaceeffect_vs20_Dynamic_Index
{
public:
sdk_screenspaceeffect_vs20_Dynamic_Index()
{
}
int GetIndex()
{
// Asserts to make sure that we aren't using any skipped combinations.
// Asserts to make sure that we are setting all of the combination vars.
#ifdef _DEBUG
#endif // _DEBUG
return 0;
}
};
#define shaderDynamicTest_sdk_screenspaceeffect_vs20 0

View File

@ -53,6 +53,9 @@ $Project
$File "example_model_dx9.cpp"
$File "example_model_dx9_helper.cpp"
$File "Bloom.cpp"
$File "screenspace_general.cpp"
}
$Folder "Header Files"

View File

@ -0,0 +1,232 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "BaseVSShader.h"
#include "SDK_screenspaceeffect_vs20.inc"
DEFINE_FALLBACK_SHADER( SDK_screenspace_general, SDK_screenspace_general_dx9 )
BEGIN_VS_SHADER_FLAGS( SDK_screenspace_general_dx9, "Help for screenspace_general", SHADER_NOT_EDITABLE )
BEGIN_SHADER_PARAMS
SHADER_PARAM( C0_X,SHADER_PARAM_TYPE_FLOAT,"0","")
SHADER_PARAM( C0_Y,SHADER_PARAM_TYPE_FLOAT,"0","")
SHADER_PARAM( C0_Z,SHADER_PARAM_TYPE_FLOAT,"0","")
SHADER_PARAM( C0_W,SHADER_PARAM_TYPE_FLOAT,"0","")
SHADER_PARAM( C1_X,SHADER_PARAM_TYPE_FLOAT,"0","")
SHADER_PARAM( C1_Y,SHADER_PARAM_TYPE_FLOAT,"0","")
SHADER_PARAM( C1_Z,SHADER_PARAM_TYPE_FLOAT,"0","")
SHADER_PARAM( C1_W,SHADER_PARAM_TYPE_FLOAT,"0","")
SHADER_PARAM( C2_X,SHADER_PARAM_TYPE_FLOAT,"0","")
SHADER_PARAM( C2_Y,SHADER_PARAM_TYPE_FLOAT,"0","")
SHADER_PARAM( C2_Z,SHADER_PARAM_TYPE_FLOAT,"0","")
SHADER_PARAM( C2_W,SHADER_PARAM_TYPE_FLOAT,"0","")
SHADER_PARAM( C3_X,SHADER_PARAM_TYPE_FLOAT,"0","")
SHADER_PARAM( C3_Y,SHADER_PARAM_TYPE_FLOAT,"0","")
SHADER_PARAM( C3_Z,SHADER_PARAM_TYPE_FLOAT,"0","")
SHADER_PARAM( C3_W,SHADER_PARAM_TYPE_FLOAT,"0","")
SHADER_PARAM( PIXSHADER, SHADER_PARAM_TYPE_STRING, "", "Name of the pixel shader to use" )
SHADER_PARAM( DISABLE_COLOR_WRITES,SHADER_PARAM_TYPE_INTEGER,"0","")
SHADER_PARAM( ALPHATESTED,SHADER_PARAM_TYPE_FLOAT,"0","")
SHADER_PARAM( TEXTURE1, SHADER_PARAM_TYPE_TEXTURE, "", "" )
SHADER_PARAM( TEXTURE2, SHADER_PARAM_TYPE_TEXTURE, "", "" )
SHADER_PARAM( TEXTURE3, SHADER_PARAM_TYPE_TEXTURE, "", "" )
SHADER_PARAM( LINEARREAD_BASETEXTURE, SHADER_PARAM_TYPE_INTEGER, "0", "" )
SHADER_PARAM( LINEARREAD_TEXTURE1, SHADER_PARAM_TYPE_INTEGER, "0", "" )
SHADER_PARAM( LINEARREAD_TEXTURE2, SHADER_PARAM_TYPE_INTEGER, "0", "" )
SHADER_PARAM( LINEARREAD_TEXTURE3, SHADER_PARAM_TYPE_INTEGER, "0", "" )
SHADER_PARAM( LINEARWRITE,SHADER_PARAM_TYPE_INTEGER,"0","")
SHADER_PARAM( X360APPCHOOSER, SHADER_PARAM_TYPE_INTEGER, "0", "Needed for movies in 360 launcher" )
END_SHADER_PARAMS
SHADER_INIT
{
if ( params[BASETEXTURE]->IsDefined() )
{
LoadTexture( BASETEXTURE );
}
if ( params[TEXTURE1]->IsDefined() )
{
LoadTexture( TEXTURE1 );
}
if ( params[TEXTURE2]->IsDefined() )
{
LoadTexture( TEXTURE2 );
}
if ( params[TEXTURE3]->IsDefined() )
{
LoadTexture( TEXTURE3 );
}
}
SHADER_FALLBACK
{
if ( g_pHardwareConfig->GetDXSupportLevel() < 90 )
{
return "screenspace_general_dx8";
}
return 0;
}
SHADER_DRAW
{
SHADOW_STATE
{
pShaderShadow->EnableDepthWrites( false );
if (params[BASETEXTURE]->IsDefined())
{
pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
ITexture *txtr=params[BASETEXTURE]->GetTextureValue();
ImageFormat fmt=txtr->GetImageFormat();
if ((fmt==IMAGE_FORMAT_RGBA16161616F) || (fmt==IMAGE_FORMAT_RGBA16161616))
pShaderShadow->EnableSRGBRead(SHADER_SAMPLER0,false);
else
pShaderShadow->EnableSRGBRead(SHADER_SAMPLER0, !params[LINEARREAD_BASETEXTURE]->IsDefined() || !params[LINEARREAD_BASETEXTURE]->GetIntValue() );
}
if (params[TEXTURE1]->IsDefined())
{
pShaderShadow->EnableTexture( SHADER_SAMPLER1, true );
ITexture *txtr=params[TEXTURE1]->GetTextureValue();
ImageFormat fmt=txtr->GetImageFormat();
if ((fmt==IMAGE_FORMAT_RGBA16161616F) || (fmt==IMAGE_FORMAT_RGBA16161616))
pShaderShadow->EnableSRGBRead(SHADER_SAMPLER1,false);
else
pShaderShadow->EnableSRGBRead(SHADER_SAMPLER1, !params[LINEARREAD_TEXTURE1]->IsDefined() || !params[LINEARREAD_TEXTURE1]->GetIntValue() );
}
if (params[TEXTURE2]->IsDefined())
{
pShaderShadow->EnableTexture( SHADER_SAMPLER2, true );
ITexture *txtr=params[TEXTURE2]->GetTextureValue();
ImageFormat fmt=txtr->GetImageFormat();
if ((fmt==IMAGE_FORMAT_RGBA16161616F) || (fmt==IMAGE_FORMAT_RGBA16161616))
pShaderShadow->EnableSRGBRead(SHADER_SAMPLER2,false);
else
pShaderShadow->EnableSRGBRead(SHADER_SAMPLER2, !params[LINEARREAD_TEXTURE2]->IsDefined() || !params[LINEARREAD_TEXTURE2]->GetIntValue() );
}
if (params[TEXTURE3]->IsDefined())
{
pShaderShadow->EnableTexture( SHADER_SAMPLER3, true );
ITexture *txtr=params[TEXTURE3]->GetTextureValue();
ImageFormat fmt=txtr->GetImageFormat();
if ((fmt==IMAGE_FORMAT_RGBA16161616F) || (fmt==IMAGE_FORMAT_RGBA16161616))
pShaderShadow->EnableSRGBRead(SHADER_SAMPLER3,false);
else
pShaderShadow->EnableSRGBRead(SHADER_SAMPLER3, !params[LINEARREAD_TEXTURE3]->IsDefined() || !params[LINEARREAD_TEXTURE3]->GetIntValue() );
}
int fmt = VERTEX_POSITION;
if ( IS_PARAM_DEFINED( X360APPCHOOSER ) && ( params[X360APPCHOOSER]->GetIntValue() ) )
{
fmt |= VERTEX_COLOR;
EnableAlphaBlending( SHADER_BLEND_SRC_ALPHA, SHADER_BLEND_ONE_MINUS_SRC_ALPHA );
}
pShaderShadow->VertexShaderVertexFormat( fmt, 1, 0, 0 );
// maybe convert from linear to gamma on write.
bool srgb_write=true;
if (params[LINEARWRITE]->GetFloatValue())
srgb_write=false;
pShaderShadow->EnableSRGBWrite( srgb_write );
// Pre-cache shaders
DECLARE_STATIC_VERTEX_SHADER( sdk_screenspaceeffect_vs20 );
SET_STATIC_VERTEX_SHADER_COMBO( X360APPCHOOSER, IS_PARAM_DEFINED( X360APPCHOOSER ) ? params[X360APPCHOOSER]->GetIntValue() : 0 );
vsh_forgot_to_set_static_X360APPCHOOSER = 0; // This is a dirty workaround to the shortcut [= 0] in the fxc
SET_STATIC_VERTEX_SHADER( sdk_screenspaceeffect_vs20 );
if (params[DISABLE_COLOR_WRITES]->GetIntValue())
{
pShaderShadow->EnableColorWrites(false);
}
// if (params[ALPHATESTED]->GetFloatValue())
{
pShaderShadow->EnableAlphaTest(true);
pShaderShadow->AlphaFunc(SHADER_ALPHAFUNC_GREATER,0.0);
}
if ( IS_FLAG_SET(MATERIAL_VAR_ADDITIVE) )
{
EnableAlphaBlending( SHADER_BLEND_ONE, SHADER_BLEND_ONE );
}
if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
{
const char *szPixelShader = params[PIXSHADER]->GetStringValue();
size_t iLength = Q_strlen( szPixelShader );
if( (iLength > 5) && (Q_stricmp( &szPixelShader[iLength - 5], "_ps20" ) == 0) ) //detect if it's trying to load a ps20 shader
{
//replace it with the ps20b shader
char *szNewName = (char *)stackalloc( sizeof( char ) * (iLength + 2) );
memcpy( szNewName, szPixelShader, sizeof( char ) * iLength );
szNewName[iLength] = 'b';
szNewName[iLength + 1] = '\0';
pShaderShadow->SetPixelShader( szNewName, 0 );
}
else
{
pShaderShadow->SetPixelShader( params[PIXSHADER]->GetStringValue(), 0 );
}
}
else
{
pShaderShadow->SetPixelShader( params[PIXSHADER]->GetStringValue(), 0 );
}
}
DYNAMIC_STATE
{
if (params[BASETEXTURE]->IsDefined())
{
BindTexture( SHADER_SAMPLER0, BASETEXTURE, -1 );
}
if (params[TEXTURE1]->IsDefined())
{
BindTexture( SHADER_SAMPLER1, TEXTURE1, -1 );
}
if (params[TEXTURE2]->IsDefined())
{
BindTexture( SHADER_SAMPLER2, TEXTURE2, -1 );
}
if (params[TEXTURE3]->IsDefined())
{
BindTexture( SHADER_SAMPLER3, TEXTURE3, -1 );
}
float c0[]={
params[C0_X]->GetFloatValue(),
params[C0_Y]->GetFloatValue(),
params[C0_Z]->GetFloatValue(),
params[C0_W]->GetFloatValue(),
params[C1_X]->GetFloatValue(),
params[C1_Y]->GetFloatValue(),
params[C1_Z]->GetFloatValue(),
params[C1_W]->GetFloatValue(),
params[C2_X]->GetFloatValue(),
params[C2_Y]->GetFloatValue(),
params[C2_Z]->GetFloatValue(),
params[C2_W]->GetFloatValue(),
params[C3_X]->GetFloatValue(),
params[C3_Y]->GetFloatValue(),
params[C3_Z]->GetFloatValue(),
params[C3_W]->GetFloatValue()
};
pShaderAPI->SetPixelShaderConstant( 0, c0, ARRAYSIZE(c0)/4 );
float eyePos[4];
pShaderAPI->GetWorldSpaceCameraPosition( eyePos );
pShaderAPI->SetPixelShaderConstant( 10, eyePos, 1 );
pShaderAPI->SetVertexShaderIndex( 0 );
pShaderAPI->SetPixelShaderIndex( 0 );
DECLARE_DYNAMIC_VERTEX_SHADER( sdk_screenspaceeffect_vs20 );
SET_DYNAMIC_VERTEX_SHADER( sdk_screenspaceeffect_vs20 );
}
Draw();
}
END_SHADER

View File

@ -9,3 +9,8 @@
example_model_ps20b.fxc
example_model_vs20.fxc
SDK_Bloom_ps2x.fxc
SDK_screenspaceeffect_vs20.fxc
SDK_bloomadd_ps2x.fxc