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.
 
 
 
 
 
 

54 lines
1.5 KiB

#include "common_fog_vs_fxc.h"
#include "common_vs_fxc.h"
static const int g_FogType = DOWATERFOG;
struct VS_INPUT
{
float4 vPos : POSITION;
float4 vTexCoord0 : TEXCOORD0;
float4 colorAlpha : COLOR; // Used only for vertex alpha currently.
};
struct VS_OUTPUT
{
float4 projPos : POSITION; // Projection-space position
#if !defined( _X360 ) && !defined( SHADER_MODEL_VS_3_0 )
float fog : FOG;
#endif
float2 baseTexCoord : TEXCOORD0; // Base texture coordinate
float4 worldPos_projPosZ : TEXCOORD1; // Necessary for water fog dest alpha
float flAlpha : TEXCOORD2;
};
VS_OUTPUT main( const VS_INPUT v )
{
VS_OUTPUT o = ( VS_OUTPUT )0;
float4 projPos;
float3 worldPos;
// Need to use SkinPosition() to guarantee consistency with other shaders on X360.
// The function uses [isolate] properly and simply does a mul4x3 if skinning is set to 'false'.
SkinPosition( false, float4( v.vPos.xyz, 1 ), 0, 0, worldPos );
projPos = mul( float4( worldPos, 1 ), cViewProj );
#ifdef _PS3
// Account for OpenGL's flipped y coordinate and expanded z range [-1,1] instead of [0,1]
projPos.y = -projPos.y;
projPos.z = 2.0f * projPos.z - projPos.w;
#endif // _PS3
o.projPos = projPos;
#if !defined( _X360 ) && !defined( SHADER_MODEL_VS_3_0 )
o.fog = CalcFixedFunctionFog( worldPos, g_FogType );
#endif
o.worldPos_projPosZ = float4( worldPos, projPos.z );
o.baseTexCoord.xy = v.vTexCoord0.xy;
o.flAlpha = v.colorAlpha.a;
return o;
}