//
// Generated by Microsoft (R) D3DX9 Shader Compiler 9.08.299.0000
//
//   vsa shaderdump19/PRECIP000.vso /Fcshaderdump19/PRECIP000.vso.dis
//
//
// Parameters:
//
float3 EyePosition : register(c8);
float3 MaxPos : register(c11);
float3 MinPos : register(c10);
float3 Params : register(c12);
float3 Velocity : register(c9);
row_major float4x4 WorldViewProj : register(c0);
float4 TESR_PrecipitationsData : register(c14);
//
//
// Registers:
//
//   Name          Reg   Size
//   ------------- ----- ----
//   WorldViewProj[0] const_0        1
//   WorldViewProj[1] const_1        1
//   WorldViewProj[2] const_2        1
//   WorldViewProj[3] const_3        1
//   EyePosition   const_8       1
//   Velocity      const_9       1
//   MinPos        const_10      1
//   MaxPos        const_11      1
//   Params        const_12      1
//


// Structures:

struct VS_INPUT {
    float4 position : POSITION;
    float4 texcoord_0 : TEXCOORD0;
    float4 texcoord_1 : TEXCOORD1;
};

struct VS_OUTPUT {
    float4 position : POSITION;
    float4 color_0 : COLOR0;
    float2 texcoord_0 : TEXCOORD0;
};

// Code:

VS_OUTPUT main(VS_INPUT IN) {
    VS_OUTPUT OUT;

#define	sqr(v)			((v) * (v))

    float4 const_4 = {0, -1, 1, 0.5};
    float2 eye1;
    float3 q13;
    float3 q4;
    float3 q6;
    float4 r0;
    float4 r1;
    float3 r3;
    float3 r4;
	float3 t0;
	
	const_4.z = TESR_PrecipitationsData.z;
	t0 = IN.texcoord_1.xyz;
	t0.xy = t0.xy * TESR_PrecipitationsData.x;
    q13.xyz = MaxPos.xyz - MinPos.xyz;
    r3.z = IN.position.z;
    q4.xyz = (((TESR_PrecipitationsData.y * Params.x * Velocity.xyz) + t0) - MinPos.xyz) / q13.xyz;
    q6.xyz = q13.xyz * (q4.xyz == 0 ? frac(abs(q4.xyz)) : -frac(abs(q4.xyz)));
    r4.xyz = (0 < Velocity.xyz ? (abs(q6.xyz) + MinPos.xyz) : (MaxPos.xyz - abs(q6.xyz)));
    eye1.xy = r4.xy - EyePosition.xy;
    r1.xy = sqr(eye1.xy);
    r1.xz = normalize(eye1.xy);
    r1.yw = r1.z * const_4.yx;
    r0.xyz = r1.zxw * const_4.yzz;
    r1.xy = r0.xy / sqrt(dot(r1.yxw, r0.xyz));
    r0.w = r1.x;
    r3.y = dot(r1.yzw, IN.position.xyz);
    r3.x = dot(r0.wyz, IN.position.xyz);
    r0.xyz = r4.xyz + r3.xyz;
    OUT.color_0.a = sqr(1 - length((((-0.5 * abs(q13.xyz)) + MaxPos.xyz) - r4.xyz) / abs(q13.xyz)));
    OUT.color_0.rgb = 1;
    r0.w = 1;
    OUT.position.xyzw = mul(WorldViewProj, r0.xyzw);
    OUT.texcoord_0.xy = IN.texcoord_0.xy;

    return OUT;
};

// approximately 52 instruction slots used
