//
// Generated by Microsoft (R) D3DX9 Shader Compiler 9.08.299.0000
//
//   vsa shaderdump19/PRECIP003.vso /Fcshaderdump19/PRECIP003.vso.dis
//
//
// Parameters:
//
float3 CameraUp : register(c13);
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
//   CameraUp      const_13      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	PI			3.14159274
#define	anglei(v)		(((v) + PI) / (2 * PI))
#define	angler(v)		(((v) * (2 * PI)) - PI)
#define	fracr(v)		angler(frac(anglei(v)))	// signed modulo % PI
#define	sqr(v)			((v) * (v))

    const float4 const_5 = {0, (1.0 / (PI * 2)), 0.5, 1};
    const int4 const_6 = {-1, 0, 1, 0};

    float3 eye11;
    float q0;
    float3 q19;
    float3 q2;
    float3 q20;
    float3 q5;
    float3 q7;
    float4 r0;
	float3 t0;
	
	t0 = IN.texcoord_1.xyz;
	t0.xy = t0.xy * TESR_PrecipitationsData.x;
    q0 = fracr((Params.z * Params.x) + IN.texcoord_1.x);
    r0.y = sin(q0);
    r0.x = cos(q0);
    r0.w = dot(r0.xxy * const_5.wxw, IN.position.xyz);
    q20.xyz = MaxPos.xyz - MinPos.xyz;
    q5.xyz = (((TESR_PrecipitationsData.y * Params.x * Velocity.xyz) + t0) - MinPos.xyz) / q20.xyz;
    q7.xyz = q20.xyz * (q5.xyz == 0 ? frac(abs(q5.xyz)) : -frac(abs(q5.xyz)));
    q2.xyz = (0 < Velocity.xyz ? (abs(q7.xyz) + MinPos.xyz) : (MaxPos.xyz - abs(q7.xyz)));
    eye11.xyz = normalize(EyePosition.xyz - q2.xyz);
    q19.xyz = (r0.w * normalize(cross(CameraUp.xyz, eye11.xyz))) + (eye11.xyz * IN.position.y);
    r0.xyz = q2.xyz + ((dot(r0.yxx * const_6.xyz, IN.position.xyz) * CameraUp.xyz) + q19.xyz);
    OUT.color_0.a = sqr(1 - length((((-0.5 * abs(q20.xyz)) + MaxPos.xyz) - q2.xyz) / abs(q20.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 60 instruction slots used
