// ---- Created with 3Dmigoto v1.2.31 on Fri Feb 26 09:41:44 2016

cbuffer PER_BATCH : register(b0)
{
  float4 _WaveFreq : packoffset(c0);
  float4 _WaveLevels : packoffset(c1);
  float4 _WaveVtxPhases : packoffset(c2);
  float4 PBAlphaTest : packoffset(c3);
  float4 _WaveInfoX : packoffset(c4);
  float4 _InstancingParams : packoffset(c5);
  float4 _WaveAmp : packoffset(c6);
}

cbuffer STATIC_INSTANCE : register(b2)
{
  row_major float3x4 ObjWorldMatrix : packoffset(c0);
  float4 BendInfo : packoffset(c3);
}

cbuffer PER_FRAME : register(b3)
{
  row_major float4x4 g_VS_ViewProjMatr : packoffset(c0);
  float4 g_VS_WorldViewPos : packoffset(c6);
  float4 g_VS_AnimGenParams : packoffset(c8);
  float4 g_VS_NearFarClipDist : packoffset(c9);
  row_major float4x4 g_VS_ViewProjZeroMatr : packoffset(c10);
}



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


void main( 
  float4 v0 : POSITION0,
  float4 v1 : TEXCOORD0,
  float4 v2 : COLOR0,
  float4 v3 : TANGENT0,
  float4 v4 : BINORMAL0,
  out float4 o0 : SV_Position0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD1,
  out float4 o3 : TEXCOORD2,
  out float3 o4 : TEXCOORD3)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = BendInfo.z * v0.z;
  r0.x = r0.x * r0.x;
  r0.xy = BendInfo.xy * r0.xx + v0.xy;
  r0.z = v0.z;
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  r0.xyz = r0.xyz * r0.www;
  r0.w = dot(v0.xyz, v0.xyz);
  r0.w = sqrt(r0.w);
  r0.xyz = r0.xyz * r0.www;
  r1.w = -g_VS_WorldViewPos.x + ObjWorldMatrix._m03;
  r1.xyz = ObjWorldMatrix._m00_m01_m02;
  r0.w = 1;
  r1.x = dot(r1.xyzw, r0.xyzw);
  r2.w = -g_VS_WorldViewPos.y + ObjWorldMatrix._m13;
  r2.xyz = ObjWorldMatrix._m10_m11_m12;
  r1.y = dot(r2.xyzw, r0.xyzw);
  r2.w = -g_VS_WorldViewPos.z + ObjWorldMatrix._m23;
  r2.xyz = ObjWorldMatrix._m20_m21_m22;
  r1.z = dot(r2.xyzw, r0.xyzw);
  r1.w = 1;
  o0.x = dot(g_VS_ViewProjZeroMatr._m00_m01_m02_m03, r1.xyzw);
  o0.y = dot(g_VS_ViewProjZeroMatr._m10_m11_m12_m13, r1.xyzw);
  o0.z = dot(g_VS_ViewProjZeroMatr._m20_m21_m22_m23, r1.xyzw);
  r0.x = dot(g_VS_ViewProjZeroMatr._m30_m31_m32_m33, r1.xyzw);
  o0.w = r0.x;
  o1.x = g_VS_NearFarClipDist.w * r0.x;
  o1.yzw = float3(0,0,0);
  o2.xy = v1.xy;
  o2.zw = PBAlphaTest.xw;
  r0.xyz = float3(9.99999997e-007,0,0) + v3.xyz;
  r1.x = dot(ObjWorldMatrix._m00_m01_m02, r0.xyz);
  r1.y = dot(ObjWorldMatrix._m10_m11_m12, r0.xyz);
  r1.z = dot(ObjWorldMatrix._m20_m21_m22, r0.xyz);
  r0.x = dot(r1.xyz, r1.xyz);
  r0.x = rsqrt(r0.x);
  o3.xyz = r1.xyz * r0.xxx;
  o3.w = v3.w;
  r0.xyz = float3(-9.99999997e-007,0,0) + v4.xyz;
  r1.x = dot(ObjWorldMatrix._m00_m01_m02, r0.xyz);
  r1.y = dot(ObjWorldMatrix._m10_m11_m12, r0.xyz);
  r1.z = dot(ObjWorldMatrix._m20_m21_m22, r0.xyz);
  r0.x = dot(r1.xyz, r1.xyz);
  r0.x = rsqrt(r0.x);
  o4.xyz = r1.xyz * r0.xxx;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.2.31 on Fri Feb 26 09:41:44 2016
//
//
// Buffer Definitions: 
//
// cbuffer PER_BATCH
// {
//
//   float4 _WaveFreq;                  // Offset:    0 Size:    16 [unused]
//   float4 _WaveLevels;                // Offset:   16 Size:    16 [unused]
//   float4 _WaveVtxPhases;             // Offset:   32 Size:    16 [unused]
//   float4 PBAlphaTest;                // Offset:   48 Size:    16
//   float4 _WaveInfoX;                 // Offset:   64 Size:    16 [unused]
//   float4 _InstancingParams;          // Offset:   80 Size:    16 [unused]
//   float4 _WaveAmp;                   // Offset:   96 Size:    16 [unused]
//
// }
//
// cbuffer STATIC_INSTANCE
// {
//
//   row_major float3x4 ObjWorldMatrix; // Offset:    0 Size:    48
//   float4 BendInfo;                   // Offset:   48 Size:    16
//
// }
//
// cbuffer PER_FRAME
// {
//
//   row_major float4x4 g_VS_ViewProjMatr;// Offset:    0 Size:    64 [unused]
//   float4 g_VS_WorldViewPos;          // Offset:   96 Size:    16
//   float4 g_VS_AnimGenParams;         // Offset:  128 Size:    16 [unused]
//   float4 g_VS_NearFarClipDist;       // Offset:  144 Size:    16
//   row_major float4x4 g_VS_ViewProjZeroMatr;// Offset:  160 Size:    64
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// PER_BATCH                         cbuffer      NA          NA    0        1
// STATIC_INSTANCE                   cbuffer      NA          NA    2        1
// PER_FRAME                         cbuffer      NA          NA    3        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyz 
// TEXCOORD                 0   xyzw        1     NONE   float   xy  
// COLOR                    0   xyzw        2     NONE   float       
// TANGENT                  0   xyzw        3     NONE   float   xyzw
// BINORMAL                 0   xyzw        4     NONE   float   xyz 
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
// TEXCOORD                 3   xyz         4     NONE   float   xyz 
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[4], immediateIndexed
dcl_constantbuffer cb2[4], immediateIndexed
dcl_constantbuffer cb3[14], immediateIndexed
dcl_input v0.xyz
dcl_input v1.xy
dcl_input v3.xyzw
dcl_input v4.xyz
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyz
dcl_temps 3
mul r0.x, v0.z, cb2[3].z
mul r0.x, r0.x, r0.x
mad r0.xy, cb2[3].xyxx, r0.xxxx, v0.xyxx
mov r0.z, v0.z
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
dp3 r0.w, v0.xyzx, v0.xyzx
sqrt r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
add r1.w, cb2[0].w, -cb3[6].x
mov r1.xyz, cb2[0].xyzx
mov r0.w, l(1.000000)
dp4 r1.x, r1.xyzw, r0.xyzw
add r2.w, cb2[1].w, -cb3[6].y
mov r2.xyz, cb2[1].xyzx
dp4 r1.y, r2.xyzw, r0.xyzw
add r2.w, cb2[2].w, -cb3[6].z
mov r2.xyz, cb2[2].xyzx
dp4 r1.z, r2.xyzw, r0.xyzw
mov r1.w, l(1.000000)
dp4 o0.x, cb3[10].xyzw, r1.xyzw
dp4 o0.y, cb3[11].xyzw, r1.xyzw
dp4 o0.z, cb3[12].xyzw, r1.xyzw
dp4 r0.x, cb3[13].xyzw, r1.xyzw
mov o0.w, r0.x
mul o1.x, r0.x, cb3[9].w
mov o1.yzw, l(0,0,0,0)
mov o2.xy, v1.xyxx
mov o2.zw, cb0[3].xxxw
add r0.xyz, v3.xyzx, l(0.000001, 0.000000, 0.000000, 0.000000)
dp3 r1.x, cb2[0].xyzx, r0.xyzx
dp3 r1.y, cb2[1].xyzx, r0.xyzx
dp3 r1.z, cb2[2].xyzx, r0.xyzx
dp3 r0.x, r1.xyzx, r1.xyzx
rsq r0.x, r0.x
mul o3.xyz, r0.xxxx, r1.xyzx
mov o3.w, v3.w
add r0.xyz, v4.xyzx, l(-0.000001, 0.000000, 0.000000, 0.000000)
dp3 r1.x, cb2[0].xyzx, r0.xyzx
dp3 r1.y, cb2[1].xyzx, r0.xyzx
dp3 r1.z, cb2[2].xyzx, r0.xyzx
dp3 r0.x, r1.xyzx, r1.xyzx
rsq r0.x, r0.x
mul o4.xyz, r0.xxxx, r1.xyzx
ret 
// Approximately 46 instruction slots used

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