Files
cool-source-archive/materialsystem/stdshadersdx11/sprite_vs40.fxc
Totterynine 2773eae4d7 shaderapidx11
use -dxlevel 110 to use it
2021-09-22 18:56:56 +05:00

69 lines
1.6 KiB
Plaintext

// STATIC: "VERTEXCOLOR" "0..1"
// STATIC: "SRGB" "0..1"
// DYNAMIC: "DOWATERFOG" "0..1"
#include "common_cbuffers_fxc.h"
CBUFFER_PERMODEL(register(b0)) // model matrix
CBUFFER_PERFRAME(register(b1)) // view matrix
CBUFFER_PERSCENE(register(b2)) // proj matrix
#include "common_vs_fxc.h"
static const int g_FogType = DOWATERFOG;
static const bool g_bVertexColor = VERTEXCOLOR ? true : false;
struct VS_INPUT
{
// This is all of the stuff that we ever use.
float4 vPos : POSITION;
float4 vColor : COLOR0;
// make these float2's and stick the [n n 0 1] in the dot math.
float4 vTexCoord0 : TEXCOORD0;
};
struct VS_OUTPUT
{
float4 projPos : SV_POSITION; // Projection-space position
HALF2 baseTexCoord : TEXCOORD0; // Base texture coordinate
float4 color : TEXCOORD2; // Vertex color (from lighting or unlit)
float4 worldPos_projPosZ : TEXCOORD7; // Necessary for pixel fog
float3 eyeSpacePos : TEXCOORD3;
};
VS_OUTPUT main( const VS_INPUT v )
{
VS_OUTPUT o = ( VS_OUTPUT )0;
float3 worldPos;
worldPos = mul4x3( v.vPos, cModelMatrix );
matrix viewProj = mul(cViewMatrix, cProjMatrix);
// Transform into projection space
float4 projPos = mul( float4( worldPos, 1 ), viewProj );
o.projPos = projPos;
o.eyeSpacePos = mul(float4(worldPos, 1), cViewMatrix).xyz;
o.worldPos_projPosZ = float4( worldPos.xyz, projPos.z );
if ( g_bVertexColor )
{
// Assume that this is unlitgeneric if you are using vertex color.
#if SRGB
o.color.rgba = GammaToLinear( v.vColor.rgba );
#else
o.color.rgba = v.vColor.rgba;
#endif
}
// Base texture coordinates
o.baseTexCoord.xy = v.vTexCoord0.xy;
return o;
}