//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.67 on Mon Jan 01 13:11:46 2018
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float4x4 g_mCloudsShadowsSpace;    // Offset:    0 Size:    64 [unused]
//   float4 g_vCloudsShadowDesc;        // Offset:   64 Size:    16 [unused]
//   float4 g_vDitherSettings;          // Offset:   80 Size:    16 [unused]
//   float4 specColor;                  // Offset:   96 Size:    16 [unused]
//   float4 ControlData;                // Offset:  112 Size:    16 [unused]
//   float4 difColor;                   // Offset:  128 Size:    16 [unused]
//   float4 ambient;                    // Offset:  144 Size:    16 [unused]
//   float4 g_vDefLightDir;             // Offset:  160 Size:    16
//   float4 g_vDefLightColor;           // Offset:  176 Size:    16 [unused]
//   float4 g_vDefSpecColor;            // Offset:  192 Size:    16 [unused]
//   uint CS_FRONT;                     // Offset:  208 Size:     4 [unused]
//      = 0x00000000 
//   uint CS_RIGHT;                     // Offset:  212 Size:     4 [unused]
//      = 0x00000001 
//   uint CS_BACK;                      // Offset:  216 Size:     4 [unused]
//      = 0x00000002 
//   uint CS_LEFT;                      // Offset:  220 Size:     4 [unused]
//      = 0x00000003 
//   uint CS_TOP;                       // Offset:  224 Size:     4 [unused]
//      = 0x00000004 
//   uint CS_BOTTOM;                    // Offset:  228 Size:     4 [unused]
//      = 0x00000005 
//   float4 g_vAmbientSettings;         // Offset:  240 Size:    16 [unused]
//   
//   struct
//   {
//       
//       float4 vDesc;                  // Offset:  256
//       float4 vFogLayerPlane;         // Offset:  272
//       float4 vFogLayerColor;         // Offset:  288
//       float4 vFogLayerSettings;      // Offset:  304
//       float4 vFogColor;              // Offset:  320
//       float4 vFogDistance;           // Offset:  336
//
//   } g_FogDesc;                       // Offset:  256 Size:    96
//   float4 GrayK;                      // Offset:  352 Size:    16 [unused]
//      = 0x3eaa7efa 0x3eaa7efa 0x3eaa7efa 0x00000000 
//   float4x4 viewproj;                 // Offset:  368 Size:    64
//   float4 g_vCamPos;                  // Offset:  432 Size:    16
//   float4 UVSize;                     // Offset:  448 Size:    16 [unused]
//   float4 PIConst;                    // Offset:  464 Size:    16 [unused]
//      = 0x40c90e56 0x3e22fabe 0x3f22f41b 0x3fc91687 
//   float4 Threshold;                  // Offset:  480 Size:    16
//   float4 g_vExclusionMask;           // Offset:  496 Size:    16 [unused]
//      = 0x3f800000 0x3f800000 0x3f800000 0x3f800000 
//   float4 Constraints;                // Offset:  512 Size:    16
//   float4 GlobalOffset;               // Offset:  528 Size:    16
//   float4 SunData;                    // Offset:  544 Size:    16 [unused]
//   float4 Mask[4];                    // Offset:  560 Size:    64 [unused]
//      = 0x00000000 0x00000000 0x00000000 0x3f800000 
//        0x00000000 0x00000000 0x3f800000 0x00000000 
//        0x00000000 0x3f800000 0x00000000 0x00000000 
//        0x3f800000 0x00000000 0x00000000 0x00000000 
//
// }
//
// cbuffer CBFBDData
// {
//
//   float4 g_vGetFaceData;             // Offset:    0 Size:    16
//   float4 g_vMaskCoord;               // Offset:   16 Size:    16
//   float4 g_vNormalsCoord;            // Offset:   32 Size:    16 [unused]
//   float4 g_avTreeCenter[64];         // Offset:   48 Size:  1024
//   float4 g_avFaceK[64];              // Offset: 1072 Size:  1024
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// $Globals                          cbuffer      NA          NA    0        1
// CBFBDData                         cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// POSITION                 1   xyzw        1     NONE   float      w
// POSITION                 2   xyzw        2     NONE   float       
// TEXCOORD                 0   xy          3     NONE   float       
// TEXCOORD                 1   xy          4     NONE   float       
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xy          1     NONE   float   xy  
// TEXCOORD                 1     zw        1     NONE   float     zw
// TEXCOORD                 2   xyzw        2     NONE   float   xyzw
// COLOR                    0   xyzw        3     NONE   float   xyzw
//
vs_4_0
dcl_constantbuffer cb0[34], immediateIndexed
dcl_constantbuffer cb1[131], dynamicIndexed
dcl_input v0.xyzw
dcl_input v1.w
dcl_output_siv o0.xyzw, position
dcl_output o1.xy
dcl_output o1.zw
dcl_output o2.xyzw
dcl_output o3.xyzw
// dcl_temps updated : previous = dcl_temps 4
dcl_temps 7
// added 3dmigoto declaration
dcl_resource_texture1d (float,float,float,float) t120
ld_indexable(texture1d)(float,float,float,float) r5.xyzw, l(0, 0, 0, 0), t120.xyzw
mov r6.x, r5.w
mov r6.y, r5.w
mov r6.zw, l(1.0, 1.0)
// end of 3dmigoto declaration
mad r0.x, v0.w, l(0.500000), l(0.000100)
round_ni r0.x, r0.x
ftou r0.y, r0.x
mad r0.x, r0.x, l(2.000000), l(0.500000)
lt r0.x, r0.x, v0.w
movc r0.xz, r0.xxxx, cb1[r0.y + 3].zzwz, cb1[r0.y + 3].xxyx
mov r0.y, l(0)
mad r1.xyz, v0.xyzx, l(1.500000, 1.500000, 1.500000, 0.000000), r0.xyzx
add r0.w, cb1[0].x, l(-1.000000)
max r2.xyz, r1.zzxz, l(1.000000, 1.000000, 1.000000, 0.000000)
min r2.xyz, r0.wwww, r2.xyzx
mad r3.xyz, r2.xyzx, cb1[0].wwww, l(0.000100, 0.000100, 0.000100, 0.000000)
round_ni r3.xyz, r3.xyzx
mad r0.w, r3.x, cb1[0].y, r3.z
add r2.x, r0.w, r0.w
mad r2.y, -r3.y, cb1[0].z, r2.y
add r2.z, -r2.z, cb1[0].z
mad r2.z, r3.z, cb1[0].z, r2.z
lt r2.y, r2.z, r2.y
if_nz r2.y
  mad r2.x, r0.w, l(2.000000), l(1.000000)
endif 
mad r2.xy, r2.xxxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(1.000100, 0.000100, 0.000000, 0.000000)
ftou r2.xy, r2.xyxx
add r0.w, -r1.x, cb1[r2.x + 67].x
mad r0.w, cb1[r2.y + 67].x, r0.w, cb1[r2.y + 67].z
add r2.x, r1.z, -cb1[r2.x + 67].y
mad r0.w, cb1[r2.y + 67].y, r2.x, r0.w
add r2.xyz, r0.xyzx, cb0[33].xyzx
add r2.w, r0.w, r2.y
add r2.xyz, -r2.xwzx, cb0[27].xyzx
dp3 r0.y, r2.xyzx, r2.xyzx
sqrt r0.y, r0.y
lt r2.x, cb0[32].y, r0.y
lt r2.y, r0.y, cb0[32].x
or r2.x, r2.y, r2.x
if_nz r2.x
  mov r2.xyz, l(0,0,0,0)
else 
  add r1.w, r0.w, r1.y
  add r2.xyz, r1.xwzx, cb0[33].xyzx
endif 
mov r2.w, l(1.000000)
// replacing matrix usage :dp4 o0.x, r2.xyzw, cb0[23].xyzw
dp4 r4.x, r2.xyzw, cb0[23].xyzw
mul o0.x, r4.x, r6.x
// replacing matrix usage :dp4 o0.y, r2.xyzw, cb0[24].xyzw
dp4 r4.y, r2.xyzw, cb0[24].xyzw
mul o0.y, r4.y, r6.y
dp4 o0.z, r2.xyzw, cb0[25].xyzw
dp4 o0.w, r2.xyzw, cb0[26].xyzw
mul_sat r0.w, v1.w, l(0.050000)
mov_sat r1.x, -cb0[10].y
mul o3.xzw, r0.wwww, r1.xxxx
add r0.w, r0.y, -cb0[32].x
mul_sat r0.w, r0.w, cb0[32].w
rsq r0.w, r0.w
div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
add r0.y, r0.y, -cb0[30].x
mad_sat r0.y, -r0.y, cb0[30].y, l(1.000000)
mul o3.y, r0.y, r0.w
lt r0.y, cb0[32].x, l(-1.000000)
if_nz r0.y
  mov o2.xyzw, l(0,0,0,0)
else 
  add r1.xyz, r2.xyzx, -cb0[27].xyzx
  dp3 r0.y, r1.xyzx, r1.xyzx
  sqrt r0.y, r0.y
  mul r0.y, r0.y, cb0[21].x
  min r0.y, r0.y, l(1.000000)
  dp4 r0.w, r2.xyzw, cb0[17].xyzw
  add r1.xyz, -r2.xyzx, cb0[27].xyzx
  ge r1.w, cb0[16].z, l(0.000000)
  if_nz r1.w
    lt r1.w, r0.w, -cb0[19].y
    if_nz r1.w
      mov r0.w, -cb0[19].y
    endif 
    ge r1.w, r0.w, l(0.000000)
    if_nz r1.w
      mov r1.w, l(0)
      mov r2.xy, l(0,-1,0,0)
    else 
      dp3 r2.z, r1.xyzx, r1.xyzx
      rsq r2.z, r2.z
      mul r3.xyz, r1.xyzx, r2.zzzz
      dp3 r2.z, cb0[17].xyzx, r3.xyzx
      lt r2.w, l(0.000100), |r2.z|
      if_nz r2.w
        div r2.z, l(1.000000, 1.000000, 1.000000, 1.000000), r2.z
        add r2.w, -r0.w, cb0[16].z
        mul r3.x, r2.z, cb0[16].z
        mad r2.x, r2.w, r2.z, -r3.x
      else 
        mov r2.x, l(0)
      endif 
      lt r2.y, r2.x, l(0.000100)
      if_nz r2.y
        mov r1.w, l(0)
      endif 
    endif 
    if_z r2.y
      mul r2.x, r2.x, cb0[19].x
      mul r2.x, r2.x, l(1.44254541)
      exp r2.x, r2.x
      div r2.x, l(1.000000, 1.000000, 1.000000, 1.000000), r2.x
      add r1.w, -r2.x, l(1.000000)
    endif 
  else 
    ge r0.w, r0.w, l(0.000000)
    if_nz r0.w
      dp3 r0.w, r1.xyzx, r1.xyzx
      rsq r0.w, r0.w
      mul r2.xyz, r0.wwww, r1.xyzx
      dp3 r0.w, cb0[17].xyzx, r2.xyzx
      lt r2.x, l(0.000100), |r0.w|
      if_nz r2.x
        div r0.w, cb0[16].z, r0.w
      endif 
      lt r2.x, r0.w, l(0.000100)
      if_nz r2.x
        mov r1.w, l(0)
      endif 
    else 
      dp3 r1.x, r1.xyzx, r1.xyzx
      sqrt r0.w, r1.x
      mov r2.x, l(0)
    endif 
    if_z r2.x
      mul r0.w, r0.w, cb0[19].x
      mul r0.w, r0.w, l(1.44254541)
      exp r0.w, r0.w
      div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
      add r1.w, r0.w, l(-1.000000)
      mov r1.w, -r1.w
    endif 
  endif 
  dp3 r0.w, cb0[20].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  lt r0.w, l(0.001000), r0.w
  lt r1.x, r0.y, cb0[16].x
  if_nz r1.x
    mul r1.x, r0.y, cb0[16].y
    div r1.x, r1.x, cb0[16].x
  else 
    add r1.yz, -cb0[16].yyxy, l(0.000000, 1.000000, 1.000000, 0.000000)
    add r2.x, r0.y, -cb0[16].x
    mul r1.y, r1.y, r2.x
    div r1.y, r1.y, r1.z
    add r1.x, r1.y, cb0[16].y
  endif 
  mul r1.xyz, r1.xxxx, cb0[20].xyzx
  log r1.xyz, r1.xyzx
  mul r1.xyz, r1.xyzx, cb0[20].wwww
  exp r1.xyz, r1.xyzx
  mul r1.xyz, r1.xyzx, l(-1.442695, -1.442695, -1.442695, 0.000000)
  exp r1.xyz, r1.xyzx
  add r1.xyz, -r1.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  lt r2.x, l(0.800000), r0.y
  and r0.w, r0.w, r2.x
  if_nz r0.w
    add r0.y, r0.y, l(-0.800000)
    mul r0.y, r0.y, l(5.000000)
    add r2.xyz, -r1.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
    mad r1.xyz, r0.yyyy, r2.xyzx, r1.xyzx
  endif 
  add r0.y, cb0[21].w, l(-0.250000)
  add r0.y, r0.y, r0.y
  dp3 r0.w, r1.xyzx, l(0.333300, 0.333300, 0.333300, 0.000000)
  add r2.xyz, -r1.xyzx, r0.wwww
  mad o2.xyz, r0.yyyy, r2.xyzx, r1.xyzx
  mov o2.w, |r1.w|
endif 
mul_sat o1.xy, v0.xzxx, l(1000.000000, 1000.000000, 0.000000, 0.000000)
mul r0.x, r0.x, cb1[1].w
mad o1.z, r0.x, cb1[1].z, cb1[1].y
mad r0.x, -r0.z, cb1[1].w, l(1.000000)
mad o1.w, r0.x, cb1[1].z, cb1[1].x
ret 
// Approximately 174 instruction slots used
