68 lines
1.6 KiB
Plaintext
68 lines
1.6 KiB
Plaintext
#include "common_fog_vs_fxc.h"
|
|
|
|
#include "common_vs_fxc.h"
|
|
|
|
static const int g_FogType = DOWATERFOG;
|
|
|
|
const float4 cShaderConst0 : register( SHADER_SPECIFIC_CONST_0 );
|
|
const float4 cShaderConst1 : register( SHADER_SPECIFIC_CONST_1 );
|
|
|
|
struct VS_INPUT
|
|
{
|
|
float4 vPos : POSITION;
|
|
float4 vTexCoord0 : TEXCOORD0;
|
|
float4 vTexCoord1 : TEXCOORD1;
|
|
float2 vTexCoord2 : TEXCOORD2;
|
|
|
|
float4 vColor : COLOR0;
|
|
};
|
|
|
|
struct VS_OUTPUT
|
|
{
|
|
float4 vProjPos : POSITION;
|
|
float2 vTexCoord0 : TEXCOORD0;
|
|
float2 vTexCoord1 : TEXCOORD1;
|
|
float2 vTexCoord2 : TEXCOORD2;
|
|
float2 vTexCoord3 : TEXCOORD3;
|
|
|
|
float4 worldPos_projPosZ : TEXCOORD4; // Necessary for pixel fog
|
|
|
|
float4 vColor : COLOR0;
|
|
|
|
#if !defined( _X360 ) && !defined( SHADER_MODEL_VS_3_0 )
|
|
float fog : FOG;
|
|
#endif
|
|
};
|
|
|
|
|
|
VS_OUTPUT main( const VS_INPUT v )
|
|
{
|
|
VS_OUTPUT o = ( VS_OUTPUT )0;
|
|
|
|
float3 worldPos;
|
|
worldPos = mul( v.vPos, cModel[0] );
|
|
o.vProjPos = mul( float4( worldPos, 1 ), cViewProj );
|
|
o.worldPos_projPosZ = float4( worldPos.xyz, o.vProjPos.z );
|
|
|
|
#if !defined( _X360 ) && !defined( SHADER_MODEL_VS_3_0 )
|
|
o.fog = CalcFixedFunctionFog( worldPos, g_FogType );
|
|
#endif
|
|
|
|
|
|
// Compute the texture coordinates given the offset between
|
|
// each bumped lightmap
|
|
float2 offset;
|
|
offset.x = v.vTexCoord2.x;
|
|
offset.y = 0.0f;
|
|
|
|
o.vTexCoord0.x = dot( v.vTexCoord0, cShaderConst0 );
|
|
o.vTexCoord0.y = dot( v.vTexCoord0, cShaderConst1 );
|
|
|
|
o.vTexCoord1 = offset + v.vTexCoord1.xy;
|
|
o.vTexCoord2 = (offset * 2.0) + v.vTexCoord1.xy;
|
|
o.vTexCoord3 = (offset * 3.0) + v.vTexCoord1.xy;
|
|
|
|
o.vColor = v.vColor;
|
|
|
|
return o;
|
|
} |