// ---- Created with 3Dmigoto v1.3.16 on Sun Dec 27 18:19:12 2020

cbuffer CBufferGlobalConstant_Z : register(b0)
{

  struct
  {
    float4 c[90];
  } Global : packoffset(c0);

}

cbuffer CBufferLightConstant_Z : register(b1)
{

  struct
  {
    float4 c[3];
  } Light : packoffset(c0);

}

cbuffer CBufferObjectConstant_Z : register(b2)
{

  struct
  {
    float4 c[32];
  } Object : packoffset(c0);

}



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


void main(
  float4 v0 : POSITION0,
  float4 v1 : TANGENT0,
  float3 v2 : NORMAL0,
  float4 v3 : TEXCOORD0,
  float4 v4 : TEXCOORD8,
  out float4 o0 : SV_Position0,
  out float4 o1 : PREVIOUS_POSITION0,
  out float4 o2 : COLOR0,
  out float4 o3 : TEXCOORD0,
  out float3 o4 : TEXSPACE_NORMAL0,
  out float p4 : INSTANCE_COLOR0,
  out float3 o5 : TEXSPACE_POS0,
  out uint2 o6 : INSTANCE_INDEXES0)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.w = 1;
  r1.x = dot(Object.c[0].xyz, Object.c[0].xyz);
  r1.x = sqrt(r1.x);
  r1.yzw = Global.c[3].xyz * v3.www;
  r1.yzw = Global.c[4].xyz * v3.zzz + r1.yzw;
  r2.xyz = v0.xyz;
  r2.w = 1;
  r3.x = dot(r2.xyzw, Object.c[0].xyzw);
  r3.y = dot(r2.xyzw, Object.c[1].xyzw);
  r3.z = dot(r2.xyzw, Object.c[2].xyzw);
  r3.xyz = Global.c[35].xyz + r3.xyz;
  r0.xyz = r1.xxx * r1.yzw + r3.xyz;
  r3.xyzw = -Global.c[35].xyzw + r0.xyzw;
  o5.xyz = r0.xyz;
  r0.x = dot(r3.xyzw, Global.c[31].xyzw);
  r0.y = dot(r3.xyzw, Global.c[32].xyzw);
  r0.z = dot(r3.xyzw, Global.c[33].xyzw);
  r0.w = 1;
  o0.x = dot(r0.xyzw, Global.c[49].xyzw);
  o0.y = dot(r0.xyzw, Global.c[50].xyzw);
  o0.z = dot(r0.xyzw, Global.c[51].xyzw);
  o0.w = dot(r0.xyzw, Global.c[52].xyzw);
  r0.x = dot(r2.xyzw, Object.c[4].xyzw);
  r0.y = dot(r2.xyzw, Object.c[5].xyzw);
  r0.z = dot(r2.xyzw, Object.c[6].xyzw);
  r0.xyz = Global.c[40].xyz + r0.xyz;
  r0.xyz = r1.xxx * r1.yzw + r0.xyz;
  r0.xyz = -Global.c[40].xyz + r0.xyz;
  r0.w = 1;
  o1.x = dot(r0.xyzw, Global.c[41].xyzw);
  o1.y = dot(r0.xyzw, Global.c[42].xyzw);
  o1.z = dot(r0.xyzw, Global.c[43].xyzw);
  o1.w = dot(r0.xyzw, Global.c[44].xyzw);
  o2.xyz = v4.xyz;
  o2.w = 1;
  o3.zw = float2(0,0);
  r0.xy = v3.xy;
  r0.z = 1;
  o3.x = dot(r0.xyz, Object.c[30].xyz);
  o3.y = dot(r0.xyz, Object.c[31].xyz);
  o4.xyz = Light.c[0].xyz;
  p4.x = 0;
  o6.xy = float2(0,0);


   //Fix
  float4 stereo = StereoParams.Load(0);
  float4 iniParams = IniParams.Load(0);
  float4 iniParams2 = IniParams.Load(int2(20,0));
  
  float4 tex_filter = IniParams.Load(int2(2,0));
  
float4 Crosshairdepth = IniParams.Load(int2(21,0));




  if (tex_filter.x == 3)
    {
    //o0.x -= stereo.x * (o0.w - stereo.y) * (1 - iniParams.x );
    o0.x -= stereo.x * (o0.w - stereo.y);
    o0.x += stereo.x * iniParams.x * 30;
    //o0.x += stereo.x * iniParams.z;
    }

  if (tex_filter.x == 4)
    {
    o0.x -= stereo.x * (o0.w - stereo.y);
    o0.x += stereo.x*0.024*70.0*3.5*Crosshairdepth.x;
    //o0.x += stereo.x * iniParams.x * 40;
    }

else
{
o0.x += stereo.x*0.024*70.0*Crosshairdepth.x;
}



  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//   using 3Dmigoto v1.3.16 on Sun Dec 27 18:19:12 2020
//
//
// Buffer Definitions:
//
// cbuffer CBufferGlobalConstant_Z
// {
//
//   struct StructGlobalConstant_Z
//   {
//
//       float4 c[90];                  // Offset:    0
//
//   } Global;                          // Offset:    0 Size:  1440
//
// }
//
// cbuffer CBufferLightConstant_Z
// {
//
//   struct StructLightConstant_Z
//   {
//
//       float4 c[3];                   // Offset:    0
//
//   } Light;                           // Offset:    0 Size:    48
//
// }
//
// cbuffer CBufferObjectConstant_Z
// {
//
//   struct StructObjectConstant_Z
//   {
//
//       float4 c[32];                  // Offset:    0
//
//   } Object;                          // Offset:    0 Size:   512
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// CBufferGlobalConstant_Z           cbuffer      NA          NA    0        1
// CBufferLightConstant_Z            cbuffer      NA          NA    1        1
// CBufferObjectConstant_Z           cbuffer      NA          NA    2        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyz
// TANGENT                  0   xyzw        1     NONE   float
// NORMAL                   0   xyz         2     NONE   float
// TEXCOORD                 0   xyzw        3     NONE   float   xyzw
// TEXCOORD                 8   xyzw        4     NONE   float   xyz
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// PREVIOUS_POSITION        0   xyzw        1     NONE   float   xyzw
// COLOR                    0   xyzw        2     NONE   float   xyzw
// TEXCOORD                 0   xyzw        3     NONE   float   xyzw
// TEXSPACE_NORMAL          0   xyz         4     NONE   float   xyz
// INSTANCE_COLOR           0      w        4     NONE   float      w
// TEXSPACE_POS             0   xyz         5     NONE   float   xyz
// INSTANCE_INDEXES         0   xy          6     NONE    uint   xy
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[53], immediateIndexed
dcl_constantbuffer cb1[1], immediateIndexed
dcl_constantbuffer cb2[32], immediateIndexed
dcl_input v0.xyz
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_output o4.w
dcl_output o5.xyz
dcl_output o6.xy
dcl_temps 4
mov r0.w, l(1.000000)
dp3 r1.x, cb2[0].xyzx, cb2[0].xyzx
sqrt r1.x, r1.x
mul r1.yzw, v3.wwww, cb0[3].xxyz
mad r1.yzw, cb0[4].xxyz, v3.zzzz, r1.yyzw
mov r2.xyz, v0.xyzx
mov r2.w, l(1.000000)
dp4 r3.x, r2.xyzw, cb2[0].xyzw
dp4 r3.y, r2.xyzw, cb2[1].xyzw
dp4 r3.z, r2.xyzw, cb2[2].xyzw
add r3.xyz, r3.xyzx, cb0[35].xyzx
mad r0.xyz, r1.xxxx, r1.yzwy, r3.xyzx
add r3.xyzw, r0.xyzw, -cb0[35].xyzw
mov o5.xyz, r0.xyzx
dp4 r0.x, r3.xyzw, cb0[31].xyzw
dp4 r0.y, r3.xyzw, cb0[32].xyzw
dp4 r0.z, r3.xyzw, cb0[33].xyzw
mov r0.w, l(1.000000)
dp4 o0.x, r0.xyzw, cb0[49].xyzw
dp4 o0.y, r0.xyzw, cb0[50].xyzw
dp4 o0.z, r0.xyzw, cb0[51].xyzw
dp4 o0.w, r0.xyzw, cb0[52].xyzw
dp4 r0.x, r2.xyzw, cb2[4].xyzw
dp4 r0.y, r2.xyzw, cb2[5].xyzw
dp4 r0.z, r2.xyzw, cb2[6].xyzw
add r0.xyz, r0.xyzx, cb0[40].xyzx
mad r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
add r0.xyz, r0.xyzx, -cb0[40].xyzx
mov r0.w, l(1.000000)
dp4 o1.x, r0.xyzw, cb0[41].xyzw
dp4 o1.y, r0.xyzw, cb0[42].xyzw
dp4 o1.z, r0.xyzw, cb0[43].xyzw
dp4 o1.w, r0.xyzw, cb0[44].xyzw
mov o2.xyz, v4.xyzx
mov o2.w, l(1.000000)
mov o3.zw, l(0,0,0,0)
mov r0.xy, v3.xyxx
mov r0.z, l(1.000000)
dp3 o3.x, r0.xyzx, cb2[30].xyzx
dp3 o3.y, r0.xyzx, cb2[31].xyzx
mov o4.xyz, cb1[0].xyzx
mov o4.w, l(0)
mov o6.xy, l(0,0,0,0)
ret
// Approximately 44 instruction slots used

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