//trees
// ---- Created with 3Dmigoto v1.3.16 on Thu Jul 23 01:56:10 2020

cbuffer SceneConstants : register(b0)
{
  row_major float4x4 g_matrixV : packoffset(c0);
  row_major float4x4 g_matrixP : packoffset(c4);
  row_major float4x4 g_matrixVP : packoffset(c8);
  float3 g_cameraPosition : packoffset(c12);
  float g_time : packoffset(c12.w);
  float3 g_sunDirection : packoffset(c13);
  float g_parallaxScale : packoffset(c13.w);
  float2 g_shadowDepthScale : packoffset(c14);
  float g_vtScale : packoffset(c14.z);
  float gp_shadowDrawDistance : packoffset(c14.w);
  float4 paddingSC2 : packoffset(c15);
}

cbuffer constants : register(b1)
{
  float4 viewUpLeft : packoffset(c0);
  float4 gv_WindInfo2 : packoffset(c1);
  float3 gv_WindInfo1 : packoffset(c2);
  float expFactor : packoffset(c2.w);
  float4 exportAddress : packoffset(c3);
  float4 exportOffset : packoffset(c4);
}



// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


void main(
  float3 v0 : POSITION0,
  float4 v1 : POSITIONB0,
  float4 v2 : POSITIONC0,
  float4 v3 : POSITIOND0,
  float4 v4 : POSITIONE0,
  float4 v5 : POSITIONF0,
  float3 v6 : POSITIONG0,
  float4 v7 : POSITIONH0,
  out float4 o0 : POS0,
  out float4 o1 : POS1,
  out float4 o2 : POS2,
  out float4 o3 : POS3,
  out float4 o4 : POS4)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = 1;
  r0.yz = gv_WindInfo2.xx * r0.xx + v6.xz;
  r0.yz = v7.ww + r0.yz;
  r0.yz = float2(0.300000012,0.949999988) * r0.yz;
  r0.y = sin(r0.y);
  r0.z = cos(r0.z);
  r1.x = -r0.y * r0.z + 1;
  r0.y = r0.y * r0.z;
  r0.w = v2.w;
  r0.zw = gv_WindInfo2.zw * r0.xw;
  r0.x = -gv_WindInfo2.y * r0.x + 1;
  r1.yzw = v7.xyz * r0.xxx;
  r1.yzw = r1.yzw * r0.yyy;
  r0.x = r0.z * r1.x + r0.y;
  r0.yzw = r1.yzw * r0.www + v0.xyz;
  r1.xyz = gv_WindInfo1.xyz * v2.www;
  r1.xyz = r1.xyz * r0.xxx;
  r0.x = dot(v7.xyz, v7.xyz);
  r0.x = sqrt(r0.x);
  r0.xyz = r1.xyz * r0.xxx + r0.yzw;
  r0.xyz = v6.xyz + r0.xyz;
  r1.xyz = g_matrixV._m10_m11_m12 * r0.yyy;
  r0.xyw = r0.xxx * g_matrixV._m00_m01_m02 + r1.xyz;
  r0.xyz = r0.zzz * g_matrixV._m20_m21_m22 + r0.xyw;
  r0.xyz = g_matrixV._m30_m31_m32 + r0.xyz;
  r1.xyzw = g_matrixP._m10_m11_m12_m13 * r0.yyyy;
  r1.xyzw = r0.xxxx * g_matrixP._m00_m01_m02_m03 + r1.xyzw;
  r1.xyzw = r0.zzzz * g_matrixP._m20_m21_m22_m23 + r1.xyzw;
  r1.xyzw = g_matrixP._m30_m31_m32_m33 + r1.xyzw;

float4 stereo = StereoParams.Load(0);
r1.x += stereo.x*(r1.w - stereo.y);

  o0.xyz = r1.xyz / r1.www;
  r1.xyzw = viewUpLeft.xyzw * v1.zzww;
  r0.xyw = g_matrixP._m10_m11_m13 * r1.www;
  r0.xyw = r1.zzz * g_matrixP._m00_m01_m03 + r0.xyw;
  r0.xyw = r0.zzz * g_matrixP._m20_m21_m23 + r0.xyw;
  r0.xyw = g_matrixP._m30_m31_m33 + r0.xyw;
  r0.xy = r0.xy / r0.ww;
  o0.w = r0.x;
  o1.w = r0.y;
  r0.xyw = v2.xyz * float3(2,2,2) + float3(-1,-1,-1);
  r2.xyz = g_matrixV._m10_m11_m12 * r0.yyy;
  r2.xyz = r0.xxx * g_matrixV._m00_m01_m02 + r2.xyz;
  r0.xyw = r0.www * g_matrixV._m20_m21_m22 + r2.xyz;
  o1.xyz = r0.xyw;
  o2.xyzw = float4(4,2,1,1) * v4.xyzw;
  r1.yzw = g_matrixP._m10_m11_m13 * r1.yyy;
  r1.xyz = r1.xxx * g_matrixP._m00_m01_m03 + r1.yzw;
  r1.xyz = r0.zzz * g_matrixP._m20_m21_m23 + r1.xyz;
  r2.xyz = g_matrixP._m20_m21_m23 * r0.zzz;
  r2.xyz = v1.zzz * g_matrixP._m10_m11_m13 + r2.xyz;
  r2.xyz = g_matrixP._m30_m31_m33 + r2.xyz;
  r2.xy = r2.xy / r2.zz;
  r1.xyz = g_matrixP._m30_m31_m33 + r1.xyz;
  r1.xy = r1.xy / r1.zz;
  r1.zw = r2.xy + -r1.xy;
  r1.xy = expFactor * r1.zw + r1.xy;
  o3.z = r1.x;
  o4.w = r1.y;
  o3.xy = v1.xy;
  o3.w = 255 * v5.w;
  r0.z = 1 + g_sunDirection.z;
  r0.z = 0.5 * r0.z;
  r0.z = r0.z * r0.z;
  r0.x = dot(g_sunDirection.xyz, r0.xyw);
  r0.xy = float2(1,1) + r0.xw;
  r0.x = 0.5 * r0.x;
  r0.z = r0.z * r0.z + -r0.x;
  r0.x = r0.z * 0.5 + r0.x;
  r0.x = r0.y * r0.x;
  r0.x = 0.5 * r0.x;
  r0.yzw = v5.xyz + -v3.xyz;
  o4.xyz = r0.xxx * r0.yzw + v3.xyz;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
//   using 3Dmigoto v1.3.16 on Thu Jul 23 01:56:10 2020
//
//
// Buffer Definitions:
//
// cbuffer SceneConstants
// {
//
//   row_major float4x4 g_matrixV;      // Offset:    0 Size:    64
//   row_major float4x4 g_matrixP;      // Offset:   64 Size:    64
//   row_major float4x4 g_matrixVP;     // Offset:  128 Size:    64 [unused]
//   float3 g_cameraPosition;           // Offset:  192 Size:    12 [unused]
//   float g_time;                      // Offset:  204 Size:     4 [unused]
//   float3 g_sunDirection;             // Offset:  208 Size:    12
//   float g_parallaxScale;             // Offset:  220 Size:     4 [unused]
//   float2 g_shadowDepthScale;         // Offset:  224 Size:     8 [unused]
//   float g_vtScale;                   // Offset:  232 Size:     4 [unused]
//   float gp_shadowDrawDistance;       // Offset:  236 Size:     4 [unused]
//   float4 paddingSC2;                 // Offset:  240 Size:    16 [unused]
//
// }
//
// cbuffer constants
// {
//
//   float4 viewUpLeft;                 // Offset:    0 Size:    16
//   float4 gv_WindInfo2;               // Offset:   16 Size:    16
//   float3 gv_WindInfo1;               // Offset:   32 Size:    12
//   float expFactor;                   // Offset:   44 Size:     4
//   float4 exportAddress;              // Offset:   48 Size:    16 [unused]
//   float4 exportOffset;               // Offset:   64 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// SceneConstants                    cbuffer      NA          NA    0        1
// constants                         cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyz         0     NONE   float   xyz
// POSITIONB                0   xyzw        1     NONE   float   xyzw
// POSITIONC                0   xyzw        2     NONE   float   xyzw
// POSITIOND                0   xyzw        3     NONE   float   xyz
// POSITIONE                0   xyzw        4     NONE   float   xyzw
// POSITIONF                0   xyzw        5     NONE   float   xyzw
// POSITIONG                0   xyz         6     NONE   float   xyz
// POSITIONH                0   xyzw        7     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POS                      0   xyzw        0     NONE   float   xyzw
// POS                      1   xyzw        1     NONE   float   xyzw
// POS                      2   xyzw        2     NONE   float   xyzw
// POS                      3   xyzw        3     NONE   float   xyzw
// POS                      4   xyzw        4     NONE   float   xyzw
//
vs_4_1
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[14], immediateIndexed
dcl_constantbuffer cb1[3], immediateIndexed
dcl_input v0.xyz
dcl_input v1.xyzw
dcl_input v2.xyzw
dcl_input v3.xyz
dcl_input v4.xyzw
dcl_input v5.xyzw
dcl_input v6.xyz
dcl_input v7.xyzw
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_temps 3
mov r0.x, l(1.000000)
mad r0.yz, cb1[1].xxxx, r0.xxxx, v6.xxzx
add r0.yz, r0.yyzy, v7.wwww
mul r0.yz, r0.yyzy, l(0.000000, 0.300000, 0.950000, 0.000000)
sincos r0.y, null, r0.y
sincos null, r0.z, r0.z
mad r1.x, -r0.y, r0.z, l(1.000000)
mul r0.y, r0.z, r0.y
mov r0.w, v2.w
mul r0.zw, r0.xxxw, cb1[1].zzzw
mad r0.x, -cb1[1].y, r0.x, l(1.000000)
mul r1.yzw, r0.xxxx, v7.xxyz
mul r1.yzw, r0.yyyy, r1.yyzw
mad r0.x, r0.z, r1.x, r0.y
mad r0.yzw, r1.yyzw, r0.wwww, v0.xxyz
mul r1.xyz, v2.wwww, cb1[2].xyzx
mul r1.xyz, r0.xxxx, r1.xyzx
dp3 r0.x, v7.xyzx, v7.xyzx
sqrt r0.x, r0.x
mad r0.xyz, r1.xyzx, r0.xxxx, r0.yzwy
add r0.xyz, r0.xyzx, v6.xyzx
mul r1.xyz, r0.yyyy, cb0[1].xyzx
mad r0.xyw, r0.xxxx, cb0[0].xyxz, r1.xyxz
mad r0.xyz, r0.zzzz, cb0[2].xyzx, r0.xywx
add r0.xyz, r0.xyzx, cb0[3].xyzx
mul r1.xyzw, r0.yyyy, cb0[5].xyzw
mad r1.xyzw, r0.xxxx, cb0[4].xyzw, r1.xyzw
mad r1.xyzw, r0.zzzz, cb0[6].xyzw, r1.xyzw
add r1.xyzw, r1.xyzw, cb0[7].xyzw
div o0.xyz, r1.xyzx, r1.wwww
mul r1.xyzw, v1.zzww, cb1[0].xyzw
mul r0.xyw, r1.wwww, cb0[5].xyxw
mad r0.xyw, r1.zzzz, cb0[4].xyxw, r0.xyxw
mad r0.xyw, r0.zzzz, cb0[6].xyxw, r0.xyxw
add r0.xyw, r0.xyxw, cb0[7].xyxw
div r0.xy, r0.xyxx, r0.wwww
mov o0.w, r0.x
mov o1.w, r0.y
mad r0.xyw, v2.xyxz, l(2.000000, 2.000000, 0.000000, 2.000000), l(-1.000000, -1.000000, 0.000000, -1.000000)
mul r2.xyz, r0.yyyy, cb0[1].xyzx
mad r2.xyz, r0.xxxx, cb0[0].xyzx, r2.xyzx
mad r0.xyw, r0.wwww, cb0[2].xyxz, r2.xyxz
mov o1.xyz, r0.xywx
mul o2.xyzw, v4.xyzw, l(4.000000, 2.000000, 1.000000, 1.000000)
mul r1.yzw, r1.yyyy, cb0[5].xxyw
mad r1.xyz, r1.xxxx, cb0[4].xywx, r1.yzwy
mad r1.xyz, r0.zzzz, cb0[6].xywx, r1.xyzx
mul r2.xyz, r0.zzzz, cb0[6].xywx
mad r2.xyz, v1.zzzz, cb0[5].xywx, r2.xyzx
add r2.xyz, r2.xyzx, cb0[7].xywx
div r2.xy, r2.xyxx, r2.zzzz
add r1.xyz, r1.xyzx, cb0[7].xywx
div r1.xy, r1.xyxx, r1.zzzz
add r1.zw, -r1.xxxy, r2.xxxy
mad r1.xy, cb1[2].wwww, r1.zwzz, r1.xyxx
mov o3.z, r1.x
mov o4.w, r1.y
mov o3.xy, v1.xyxx
mul o3.w, v5.w, l(255.000000)
add r0.z, cb0[13].z, l(1.000000)
mul r0.z, r0.z, l(0.500000)
mul r0.z, r0.z, r0.z
dp3 r0.x, cb0[13].xyzx, r0.xywx
add r0.xy, r0.xwxx, l(1.000000, 1.000000, 0.000000, 0.000000)
mul r0.x, r0.x, l(0.500000)
mad r0.z, r0.z, r0.z, -r0.x
mad r0.x, r0.z, l(0.500000), r0.x
mul r0.x, r0.x, r0.y
mul r0.x, r0.x, l(0.500000)
add r0.yzw, -v3.xxyz, v5.xxyz
mad o4.xyz, r0.xxxx, r0.yzwy, v3.xyzx
ret
// Approximately 72 instruction slots used

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
