// HUD - Exp bar and waypoint marker
cbuffer cb0 : register(b0)
{
  float4 cb0[6];
}




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

void main(
  float4 v0 : ATTRIBUTE3,
  float4 v1 : ATTRIBUTE0,
  out float4 o0 : ATTRIBUTE3,
  out float4 o1 : ATTRIBUTE4,
  out float4 o2 : ATTRIBUTE5,
  out float2 o3 : ATTRIBUTE6,
  out float4 o4 : SV_Position0)
{
  o0.xyzw = v0.xyzw;
  o1.xyzw = cb0[0].xyzw;
  o2.xyzw = cb0[1].xyzw;
  o3.x = dot(v1.xyzw, cb0[4].xyzw);
  o3.y = dot(v1.xyzw, cb0[5].xyzw);
  o4.x = dot(v1.xyzw, cb0[2].xyzw);
  o4.y = dot(v1.xyzw, cb0[3].xyzw);
  o4.zw = float2(0,1);
  
float4 stereo = StereoParams.Load(0);
float4 params = IniParams.Load(0);
float tex_filter = IniParams.Load(0).y;
float driving = IniParams.Load(uint2(2,0)).y;
float crosshair = IniParams.Load(uint2(4,0)).z;
float gameplay = IniParams.Load(uint2(5,0)).z;

// Check for waypoint texture
if(gameplay && tex_filter)
{
	// If in minimap location use static depth
	if(((o4.x > 0.6 && o4.y > 0.4) || o4.y < -0.8) || crosshair != 1)
		o4.x += stereo.x * params.z;
	
	// In game world use 3D depth
	else
	{
		o4.x += adjust_from_depth_buffer(0,0);
		// o4.x += adjust_from_depth_buffer(o4.x,o4.y - 0.3);
		
	}
}

else if(gameplay && crosshair == 1 && o4.x > -0.4 && o4.x < 0.4 && o4.y > -0.4 && o4.y < 0.4)
	o4.x += adjust_from_depth_buffer(0,0);

// All other elements
else
{
	o4.x += stereo.x * params.z;
}

  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.16 on Sun Sep 15 22:12:24 2019
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// ATTRIBUTE                3   xyzw        0     NONE   float   xyzw
// ATTRIBUTE                0   xyzw        1     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// ATTRIBUTE                3   xyzw        0     NONE   float   xyzw
// ATTRIBUTE                4   xyzw        1     NONE   float   xyzw
// ATTRIBUTE                5   xyzw        2     NONE   float   xyzw
// ATTRIBUTE                6   xy          3     NONE   float   xy
// SV_Position              0   xyzw        4      POS   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[6], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyzw
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xy
dcl_output_siv o4.xyzw, position
mov o0.xyzw, v0.xyzw
mov o1.xyzw, cb0[0].xyzw
mov o2.xyzw, cb0[1].xyzw
dp4 o3.x, v1.xyzw, cb0[4].xyzw
dp4 o3.y, v1.xyzw, cb0[5].xyzw
dp4 o4.x, v1.xyzw, cb0[2].xyzw
dp4 o4.y, v1.xyzw, cb0[3].xyzw
mov o4.zw, l(0,0,0,1.000000)
ret
// Approximately 0 instruction slots used

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