//Water heatwave to stereoize (entering STEM cutscene) 2.
// ---- Created with 3Dmigoto v1.3.16 on Sat Oct  2 10:02:38 2021

cbuffer vblock : register(b0)
{
  float4 globalvieworigin : packoffset(c0);
  float4 viewmatrixz : packoffset(c1);
  float4 particlevsparm0 : packoffset(c2);
  float4 projectionmatrixz : packoffset(c3);
  float4 mvpmatrixx : packoffset(c4);
  float4 mvpmatrixy : packoffset(c5);
  float4 mvpmatrixw : packoffset(c6);
  float4 mvpmatrixz : packoffset(c7);
  float4 projectionmatrixx : packoffset(c8);
}



// 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 : TEXCOORD3,
  out float4 o0 : COLOR0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD1,
  out float4 o3 : TEXCOORD2,
  out float4 o4 : SV_Position0)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;
  
  float4 stereo = StereoParams.Load(0);
  
  o0.xyzw = v2.xyzw;
  r0.x = cmp(particlevsparm0.x != 0.000000);
  r1.y = 1;
  r2.y = projectionmatrixz.w;
  r3.xyz = -globalvieworigin.xyz + v0.xyz;
  r3.w = v0.w;
  r1.x = dot(r3.xyzw, viewmatrixz.xyzw);
  r0.y = particlevsparm0.x + r1.x;
  r0.y = r1.x * r0.y;
  r0.y = particlevsparm0.x / r0.y;
  r0.y = particlevsparm0.y * r0.y;
  r0.z = cmp(r1.x == 0.000000);
  r0.y = r0.z ? -0 : -r0.y;
  r2.x = projectionmatrixz.z + r0.y;
  r1.z = dot(r1.xy, r2.xy);
  r1.x = dot(r3.xyzw, mvpmatrixx.xyzw);
  r1.y = dot(r3.xyzw, mvpmatrixy.xyzw);
  r1.w = dot(r3.xyzw, mvpmatrixw.xyzw);
  r2.z = dot(r3.xyzw, mvpmatrixz.xyzw);
  r2.xyw = r1.xyw;
  r0.xyzw = r0.xxxx ? r1.xyzw : r2.xyzw;
  r1.x = 10 * projectionmatrixx.x;
  r1.x = r1.x / r0.w;
  o1.z = min(1, abs(r1.x));
  r1.xy = v1.xy;
  r1.w = 0;
  o1.xyw = r1.xyw;
  o2.yw = r1.yw;
  r1.x = -0.498039216 + v3.z;
  r1.x = r1.x / v3.x;
  o2.x = v1.x + r1.x;
  o2.z = v3.y;
  o3.xyzw = r0.xyzw;
  o4.xyzw = r0.xyzw;
  o4.x+=stereo.x*(o4.w-stereo.y);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.16 on Sat Oct  2 10:02:38 2021
//
//
// Buffer Definitions:
//
// cbuffer vblock
// {
//
//   float4 globalvieworigin;           // Offset:    0 Size:    16
//   float4 viewmatrixz;                // Offset:   16 Size:    16
//   float4 particlevsparm0;            // Offset:   32 Size:    16
//   float4 projectionmatrixz;          // Offset:   48 Size:    16
//   float4 mvpmatrixx;                 // Offset:   64 Size:    16
//   float4 mvpmatrixy;                 // Offset:   80 Size:    16
//   float4 mvpmatrixw;                 // Offset:   96 Size:    16
//   float4 mvpmatrixz;                 // Offset:  112 Size:    16
//   float4 projectionmatrixx;          // Offset:  128 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// vblock                            cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE   float   xy
// COLOR                    0   xyzw        2     NONE   float   xyzw
// TEXCOORD                 3   xyzw        3     NONE   float   xyz
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// COLOR                    0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
// SV_Position              0   xyzw        4      POS   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[9], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xy
dcl_input v2.xyzw
dcl_input v3.xyz
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output_siv o4.xyzw, position
dcl_temps 4
mov o0.xyzw, v2.xyzw
ne r0.x, cb0[2].x, l(0.000000)
mov r1.y, l(1.000000)
mov r2.y, cb0[3].w
add r3.xyz, v0.xyzx, -cb0[0].xyzx
mov r3.w, v0.w
dp4 r1.x, r3.xyzw, cb0[1].xyzw
add r0.y, r1.x, cb0[2].x
mul r0.y, r0.y, r1.x
div r0.y, cb0[2].x, r0.y
mul r0.y, r0.y, cb0[2].y
eq r0.z, r1.x, l(0.000000)
movc r0.y, r0.z, l(-0.000000), -r0.y
add r2.x, r0.y, cb0[3].z
dp2 r1.z, r1.xyxx, r2.xyxx
dp4 r1.x, r3.xyzw, cb0[4].xyzw
dp4 r1.y, r3.xyzw, cb0[5].xyzw
dp4 r1.w, r3.xyzw, cb0[6].xyzw
dp4 r2.z, r3.xyzw, cb0[7].xyzw
mov r2.xyw, r1.xyxw
movc r0.xyzw, r0.xxxx, r1.xyzw, r2.xyzw
mul r1.x, cb0[8].x, l(10.000000)
div r1.x, r1.x, r0.w
min o1.z, |r1.x|, l(1.000000)
mov r1.xy, v1.xyxx
mov r1.w, l(0)
mov o1.xyw, r1.xyxw
mov o2.yw, r1.yyyw
add r1.x, v3.z, l(-0.498039216)
div r1.x, r1.x, v3.x
add o2.x, r1.x, v1.x
mov o2.z, v3.y
mov o3.xyzw, r0.xyzw
mov o4.xyzw, r0.xyzw
ret
// Approximately 35 instruction slots used

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