mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-06-08 03:42:09 +03:00
This should include the latest version of every shader that was in the 2007 SDK. It also includes a smattering of debug shaders, both VR distortion shaders, and other assorted shaders that will hopefully be useful. None of these new files are included in the game shader DLL project. If you need to modify one of these shaders for use in your mod you will need to rename it so that you don't collide with the version of that shader that lives in stdshader_dx9.dll.
55 lines
1.1 KiB
Plaintext
55 lines
1.1 KiB
Plaintext
// DYNAMIC: "COMPRESSED_VERTS" "0..1"
|
|
// DYNAMIC: "DOWATERFOG" "0..1"
|
|
// DYNAMIC: "SKINNING" "0..1"
|
|
|
|
#include "common_vs_fxc.h"
|
|
|
|
static const int g_FogType = DOWATERFOG;
|
|
static const bool g_bSkinning = SKINNING ? true : false;
|
|
|
|
|
|
struct VS_INPUT
|
|
{
|
|
float4 vPos : POSITION;
|
|
float4 vBoneWeights : BLENDWEIGHT;
|
|
float4 vBoneIndices : BLENDINDICES;
|
|
float4 vNormal : NORMAL;
|
|
};
|
|
|
|
struct VS_OUTPUT
|
|
{
|
|
float4 vProjPos : POSITION;
|
|
|
|
float4 vDiffuse : COLOR0;
|
|
|
|
float4 fogFactorW : COLOR1;
|
|
|
|
#if !defined( _X360 )
|
|
float fog : FOG;
|
|
#endif
|
|
};
|
|
|
|
|
|
VS_OUTPUT main( const VS_INPUT v )
|
|
{
|
|
VS_OUTPUT o = ( VS_OUTPUT )0;
|
|
|
|
float3 vObjNormal;
|
|
DecompressVertex_Normal( v.vNormal, vObjNormal );
|
|
|
|
float3 worldPos, worldNormal;
|
|
SkinPositionAndNormal( g_bSkinning, v.vPos, vObjNormal, v.vBoneWeights, v.vBoneIndices, worldPos, worldNormal );
|
|
|
|
o.vProjPos = mul( float4( worldPos, 1 ), cViewProj );
|
|
|
|
o.fogFactorW = CalcFog( worldPos, o.vProjPos, g_FogType );
|
|
#if !defined( _X360 )
|
|
o.fog = o.fogFactorW;
|
|
#endif
|
|
|
|
// stick the normal in the color channel
|
|
o.vDiffuse.rgb = worldNormal;
|
|
o.vDiffuse.a = 1.0f;
|
|
|
|
return o;
|
|
} |