//Orb outside effect. Affected by convergence too much.
// ---- Created with 3Dmigoto v1.3.6 on Fri Mar 16 21:46:06 2018

//cbuffer VS_CONSTANT_BUFFER : register(b0)
//{
//  float4x4 mOTP : packoffset(c0);
//}
cbuffer cb0 : register(b0)
{
  float4 cb0[50];
}

cbuffer cb13 : register(b13)
{
  float4 cb13[50];
}

// 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 float4 o1 : COLOR0,
  out float2 o2 : TEXCOORD0)
{
  float4 r0;
  uint4 bitmask, uiDest;
  float4 fDest;

  float4 stereo = StereoParams.Load(0);
  float4 iniparams = IniParams.Load(0);
  float4 iniparams1 = IniParams.Load(int2(1,0));
  float4 iniparams3 = IniParams.Load(int2(3,0));
  
  r0.xyz = cb0[1].xyzw * v0.yyy;
  r0.xyz = cb0[0].xyzw * v0.xxx + r0.xyz;
  r0.xyz = cb0[2].xyzw * v0.zzz + r0.xyz;
  r0.xyz = cb0[3].xyzw + r0.xyz;
  
  if (r0.z>=0.000001 || r0.z<=-0.000001) {
	  if (cb13[11].x>0.1560 && cb13[11].x<0.1563) {
	    v0.x+=stereo.x*(0-stereo.y*(1-r0.z)*0.025);
	  } else {
	    v0.x+=stereo.x*(0-stereo.y*(1-r0.z)*0.0125);
	  }
  }
  
  r0.xyz = cb0[1].xyzw * v0.yyy;
  r0.xyz = cb0[0].xyzw * v0.xxx + r0.xyz;
  r0.xyz = cb0[2].xyzw * v0.zzz + r0.xyz;
  r0.xyz = cb0[3].xyzw + r0.xyz;
  r0.w = 1 + -r0.z;
  r0.w = 1 / r0.w;
  r0.xy = r0.xy * r0.ww;
  o0.z = -r0.z * r0.w + r0.w;
  o0.w = r0.w;
  o0.xy = float2(1,-1) * r0.xy;
  
  //Same as Convergence=0 outside.
  o0.x+=stereo.x*stereo.y;
  
  if (r0.z<0.000001 && r0.z>-0.000001)
  {
	o0.x+=stereo.x*iniparams.x;
	o0.x=o0.x*iniparams.y;
  }
  //o0.x+=stereo.x*stereo.y*r0.z*iniparams1.x;
  o1.xyzw = v2.xyzw;
  o2.xy = v3.xy;
  //Sword image fix.
  if (iniparams3.z==2)
  {
	//o2.x+=stereo.x*0.5;
	o2.x+=stereo.x*(1-(1-r0.z)*stereo.y*0.0125)*0.5;
  }
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.6 on Fri Mar 16 21:46:06 2018
//
//
// Buffer Definitions:
//
// cbuffer VS_CONSTANT_BUFFER
// {
//
//   float4x4 mOTP;                     // Offset:    0 Size:    64
//
// }
//
//
// 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   xyzw
// TEXCOORD                 0   xy          3     NONE   float   xy
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// COLOR                    0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 0   xy          2     NONE   float   xy
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[4], immediateIndexed
dcl_input v0.xyz
dcl_input v2.xyzw
dcl_input v3.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xy
dcl_temps 1
mul r0.xyz, v0.yyyy, cb0[1].xyzx
mad r0.xyz, cb0[0].xyzx, v0.xxxx, r0.xyzx
mad r0.xyz, cb0[2].xyzx, v0.zzzz, r0.xyzx
add r0.xyz, r0.xyzx, cb0[3].xyzx
add r0.w, -r0.z, l(1.000000)
div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
mul r0.xy, r0.wwww, r0.xyxx
mad o0.z, -r0.z, r0.w, r0.w
mov o0.w, r0.w
mul o0.xy, r0.xyxx, l(1.000000, -1.000000, 0.000000, 0.000000)
mov o1.xyzw, v2.xyzw
mov o2.xy, v3.xyxx
ret
// Approximately 13 instruction slots used

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