//Underwater distortion.
// ---- Created with 3Dmigoto v1.3.6 on Sat Mar 17 18:03:13 2018

cbuffer VS_CONSTANT_BUFFER : register(b0)
{
  float4x4 mOTP : packoffset(c0);
  float4 vTC0ScaleOffset : packoffset(c4);
  float DynamicUnderwaterBlurScale : packoffset(c5);
}



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


void main(
  float3 v0 : POSITION0,
  float3 v1 : NORMAL0,
  float4 v2 : COLOR0,
  float2 v3 : TEXCOORD0,
  out float4 o0 : SV_POSITION0,
  out float3 o1 : TEXCOORD0)
{
  float4 r0;
  uint4 bitmask, uiDest;
  float4 fDest;

  float4 res = StereoParams.Load(int3(2,0,0));
  float4 iniparams7 = IniParams.Load(int2(7,0));
  
  r0.xyzw = mOTP._m01_m11_m21_m31 * v0.yyyy;
  r0.xyzw = mOTP._m00_m10_m20_m30 * v0.xxxx + r0.xyzw;
  r0.xyzw = mOTP._m02_m12_m22_m32 * v0.zzzz + r0.xyzw;
  r0.xyzw = mOTP._m03_m13_m23_m33 + r0.xyzw;
  o0.z = r0.w + -r0.z;
  o0.xyw = float3(1,-1,1) * r0.xyw;
  r0.x = 10 * DynamicUnderwaterBlurScale;
  r0.x = sin(r0.x);
  o1.z = 0.0199999996 * r0.x;
  //o1.xy = v3.xy * vTC0ScaleOffset.xy + vTC0ScaleOffset.zw;
  o1.x = (v3.x * vTC0ScaleOffset.x + vTC0ScaleOffset.z)*iniparams7.y;
  o1.y = (v3.y * vTC0ScaleOffset.y + vTC0ScaleOffset.w);
  if (iniparams7.y==0)
  {
	o0=0;
	o1=0;
  }
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.6 on Sat Mar 17 18:03:13 2018
//
//
// Buffer Definitions:
//
// cbuffer VS_CONSTANT_BUFFER
// {
//
//   float4x4 mOTP;                     // Offset:    0 Size:    64
//   float4 vTC0ScaleOffset;            // Offset:   64 Size:    16
//   float DynamicUnderwaterBlurScale;  // Offset:   80 Size:     4
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// VS_CONSTANT_BUFFER                cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyz         0     NONE   float   xyz
// NORMAL                   0   xyz         1     NONE   float
// COLOR                    0   xyzw        2     NONE   float
// TEXCOORD                 0   xy          3     NONE   float   xy
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xyz         1     NONE   float   xyz
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[6], immediateIndexed
dcl_input v0.xyz
dcl_input v3.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyz
dcl_temps 1
mul r0.xyzw, v0.yyyy, cb0[1].xyzw
mad r0.xyzw, cb0[0].xyzw, v0.xxxx, r0.xyzw
mad r0.xyzw, cb0[2].xyzw, v0.zzzz, r0.xyzw
add r0.xyzw, r0.xyzw, cb0[3].xyzw
add o0.z, -r0.z, r0.w
mul o0.xyw, r0.xyxw, l(1.000000, -1.000000, 0.000000, 1.000000)
mul r0.x, cb0[5].x, l(10.000000)
sincos r0.x, null, r0.x
mul o1.z, r0.x, l(0.020000)
mad o1.xy, v3.xyxx, cb0[4].xyxx, cb0[4].zwzz
ret
// Approximately 11 instruction slots used

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