// Blue detections on enemies - Disable

cbuffer cVSScene : register(b2)
{

  struct
  {
    float4x4 m_projectionView;
    float4x4 m_projection;
    float4x4 m_view;
    float4x4 m_shadowProjection;
    float4x4 m_shadowProjection2;
    float4 m_eyepos;
    float4 m_projectionParam;
    float4 m_viewportSize;
    float4 m_exposure;
    float4 m_fogParam[3];
    float4 m_fogColor;
    float4 m_cameraCenterOffset;
    float4 m_shadowMapResolutions;
  } g_vsScene : packoffset(c0);

}

cbuffer cVSObject : register(b5)
{

  struct
  {
    float4x4 m_viewWorld;
    float4x4 m_world;
    float4 m_useWeightCount;
    float4 m_localParam[4];
  } g_vsObject : packoffset(c0);

}

cbuffer VSBones : register(b6)
{

  struct
  {
    float4x3 m_boneMatrices[32];
  } g_vsBone : packoffset(c0);


  struct
  {
    float4x3 m_boneMatrices[32];
  } g_vsPrevBone : packoffset(c96);

}



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


void main( 
  float4 v0 : POSITION0,
  float4 v1 : NORMAL0,
  float4 v2 : COLOR0,
  float4 v3 : TANGENT0,
  uint4 v4 : BLENDINDICES0,
  float4 v5 : BLENDWEIGHT0,
  out float4 o0 : TEXCOORD1,
  out float4 o1 : TEXCOORD2,
  out float3 o2 : TEXCOORD3,
  out float4 o3 : SV_Position0)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = cmp(g_vsObject.m_useWeightCount.x != 0.000000);
  if (r0.x != 0) {
    r0.xyzw = (int4)v4.xyzw * int4(3,3,3,3);
    r1.xyzw = g_vsBone.m_boneMatrices[v4.y]._m00_m10_m20_m30 * v5.yyyy;
    r2.xyzw = g_vsBone.m_boneMatrices[v4.y]._m01_m11_m21_m31 * v5.yyyy;
    r3.xyzw = g_vsBone.m_boneMatrices[v4.y]._m02_m12_m22_m32 * v5.yyyy;
    r1.xyzw = g_vsBone.m_boneMatrices[v4.x]._m00_m10_m20_m30 * v5.xxxx + r1.xyzw;
    r2.xyzw = g_vsBone.m_boneMatrices[v4.x]._m01_m11_m21_m31 * v5.xxxx + r2.xyzw;
    r3.xyzw = g_vsBone.m_boneMatrices[v4.x]._m02_m12_m22_m32 * v5.xxxx + r3.xyzw;
    r1.xyzw = g_vsBone.m_boneMatrices[v4.z]._m00_m10_m20_m30 * v5.zzzz + r1.xyzw;
    r2.xyzw = g_vsBone.m_boneMatrices[v4.z]._m01_m11_m21_m31 * v5.zzzz + r2.xyzw;
    r3.xyzw = g_vsBone.m_boneMatrices[v4.z]._m02_m12_m22_m32 * v5.zzzz + r3.xyzw;
    r1.xyzw = g_vsBone.m_boneMatrices[v4.w]._m00_m10_m20_m30 * v5.wwww + r1.xyzw;
    r2.xyzw = g_vsBone.m_boneMatrices[v4.w]._m01_m11_m21_m31 * v5.wwww + r2.xyzw;
    r0.xyzw = g_vsBone.m_boneMatrices[v4.w]._m02_m12_m22_m32 * v5.wwww + r3.xyzw;
    r3.x = dot(v0.xyzw, r1.xyzw);
    r3.y = dot(v0.xyzw, r2.xyzw);
    r3.z = dot(v0.xyzw, r0.xyzw);
    r1.x = dot(v1.xyz, r1.xyz);
    r1.y = dot(v1.xyz, r2.xyz);
    r1.z = dot(v1.xyz, r0.xyz);
  } else {
    r3.xyz = v0.xyz;
    r1.xyz = v1.xyz;
  }
  o1.x = dot(r1.xyz, g_vsObject.m_world._m00_m10_m20);
  o1.y = dot(r1.xyz, g_vsObject.m_world._m01_m11_m21);
  o1.z = dot(r1.xyz, g_vsObject.m_world._m02_m12_m22);
  r3.w = v0.w;
  r0.x = dot(r3.xyzw, g_vsObject.m_viewWorld._m00_m10_m20_m30);
  r0.y = dot(r3.xyzw, g_vsObject.m_viewWorld._m01_m11_m21_m31);
  r0.z = dot(r3.xyzw, g_vsObject.m_viewWorld._m02_m12_m22_m32);
  r0.w = dot(r3.xyzw, g_vsObject.m_viewWorld._m03_m13_m23_m33);
  
  float4 stereo = StereoParams.Load(0);
  //r0.x += stereo.x * (r0.w - stereo.y);
  
  o3.x = dot(r0.xyzw, g_vsScene.m_projection._m00_m10_m20_m30);
  o3.y = dot(r0.xyzw, g_vsScene.m_projection._m01_m11_m21_m31);
  o3.z = dot(r0.xyzw, g_vsScene.m_projection._m02_m12_m22_m32);
  
  r0.x = dot(r0.xyzw, g_vsScene.m_projection._m03_m13_m23_m33);
  o2.x = dot(r3.xyzw, g_vsObject.m_world._m00_m10_m20_m30);
  o2.y = dot(r3.xyzw, g_vsObject.m_world._m01_m11_m21_m31);
  o2.z = dot(r3.xyzw, g_vsObject.m_world._m02_m12_m22_m32);
  o0.x = r0.x * g_vsScene.m_fogParam[0].x + g_vsScene.m_fogParam[0].y;
  o3.w = r0.x;
  o0.y = r0.x;
  
  o1 = 0;
  
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.25 on Wed Jan 20 14:47:05 2016
//
//
// Buffer Definitions: 
//
// cbuffer cVSScene
// {
//
//   struct VSScene
//   {
//       
//       float4x4 m_projectionView;     // Offset:    0
//       float4x4 m_projection;         // Offset:   64
//       float4x4 m_view;               // Offset:  128
//       float4x4 m_shadowProjection;   // Offset:  192
//       float4x4 m_shadowProjection2;  // Offset:  256
//       float4 m_eyepos;               // Offset:  320
//       float4 m_projectionParam;      // Offset:  336
//       float4 m_viewportSize;         // Offset:  352
//       float4 m_exposure;             // Offset:  368
//       float4 m_fogParam[3];          // Offset:  384
//       float4 m_fogColor;             // Offset:  432
//       float4 m_cameraCenterOffset;   // Offset:  448
//       float4 m_shadowMapResolutions; // Offset:  464
//
//   } g_vsScene;                       // Offset:    0 Size:   480
//
// }
//
// cbuffer cVSObject
// {
//
//   struct VSObject
//   {
//       
//       float4x4 m_viewWorld;          // Offset:    0
//       float4x4 m_world;              // Offset:   64
//       float4 m_useWeightCount;       // Offset:  128
//       float4 m_localParam[4];        // Offset:  144
//
//   } g_vsObject;                      // Offset:    0 Size:   208
//
// }
//
// cbuffer VSBones
// {
//
//   struct VSBone
//   {
//       
//       float4x3 m_boneMatrices[32];   // Offset:    0
//
//   } g_vsBone;                        // Offset:    0 Size:  1536
//   
//   struct VSBone
//   {
//       
//       float4x3 m_boneMatrices[32];   // Offset: 1536
//
//   } g_vsPrevBone;                    // Offset: 1536 Size:  1536 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// cVSScene                          cbuffer      NA          NA    2        1
// cVSObject                         cbuffer      NA          NA    5        1
// VSBones                           cbuffer      NA          NA    6        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// NORMAL                   0   xyzw        1     NONE   float   xyz 
// COLOR                    0   xyzw        2     NONE   float       
// TANGENT                  0   xyzw        3     NONE   float       
// BLENDINDICES             0   xyzw        4     NONE    uint   xyzw
// BLENDWEIGHT              0   xyzw        5     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 1   xy          0     NONE   float   xy  
// TEXCOORD                 2   xyz         1     NONE   float   xyz 
// TEXCOORD                 3   xyz         2     NONE   float   xyz 
// SV_Position              0   xyzw        3      POS   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb2[25], immediateIndexed
dcl_constantbuffer cb5[9], immediateIndexed
dcl_constantbuffer cb6[96], dynamicIndexed
dcl_input v0.xyzw
dcl_input v1.xyz
dcl_input v4.xyzw
dcl_input v5.xyzw
dcl_output o0.xy
dcl_output o1.xyz
dcl_output o2.xyz
dcl_output_siv o3.xyzw, position
dcl_temps 4
ne r0.x, cb5[8].x, l(0.000000)
if_nz r0.x
  imul null, r0.xyzw, v4.xyzw, l(3, 3, 3, 3)
  mul r1.xyzw, v5.yyyy, cb6[r0.y + 0].xyzw
  mul r2.xyzw, v5.yyyy, cb6[r0.y + 1].xyzw
  mul r3.xyzw, v5.yyyy, cb6[r0.y + 2].xyzw
  mad r1.xyzw, cb6[r0.x + 0].xyzw, v5.xxxx, r1.xyzw
  mad r2.xyzw, cb6[r0.x + 1].xyzw, v5.xxxx, r2.xyzw
  mad r3.xyzw, cb6[r0.x + 2].xyzw, v5.xxxx, r3.xyzw
  mad r1.xyzw, cb6[r0.z + 0].xyzw, v5.zzzz, r1.xyzw
  mad r2.xyzw, cb6[r0.z + 1].xyzw, v5.zzzz, r2.xyzw
  mad r3.xyzw, cb6[r0.z + 2].xyzw, v5.zzzz, r3.xyzw
  mad r1.xyzw, cb6[r0.w + 0].xyzw, v5.wwww, r1.xyzw
  mad r2.xyzw, cb6[r0.w + 1].xyzw, v5.wwww, r2.xyzw
  mad r0.xyzw, cb6[r0.w + 2].xyzw, v5.wwww, r3.xyzw
  dp4 r3.x, v0.xyzw, r1.xyzw
  dp4 r3.y, v0.xyzw, r2.xyzw
  dp4 r3.z, v0.xyzw, r0.xyzw
  dp3 r1.x, v1.xyzx, r1.xyzx
  dp3 r1.y, v1.xyzx, r2.xyzx
  dp3 r1.z, v1.xyzx, r0.xyzx
else 
  mov r3.xyz, v0.xyzx
  mov r1.xyz, v1.xyzx
endif 
dp3 o1.x, r1.xyzx, cb5[4].xyzx
dp3 o1.y, r1.xyzx, cb5[5].xyzx
dp3 o1.z, r1.xyzx, cb5[6].xyzx
mov r3.w, v0.w
dp4 r0.x, r3.xyzw, cb5[0].xyzw
dp4 r0.y, r3.xyzw, cb5[1].xyzw
dp4 r0.z, r3.xyzw, cb5[2].xyzw
dp4 r0.w, r3.xyzw, cb5[3].xyzw
dp4 o3.x, r0.xyzw, cb2[4].xyzw
dp4 o3.y, r0.xyzw, cb2[5].xyzw
dp4 o3.z, r0.xyzw, cb2[6].xyzw
dp4 r0.x, r0.xyzw, cb2[7].xyzw
dp4 o2.x, r3.xyzw, cb5[4].xyzw
dp4 o2.y, r3.xyzw, cb5[5].xyzw
dp4 o2.z, r3.xyzw, cb5[6].xyzw
mad o0.x, r0.x, cb2[24].x, cb2[24].y
mov o3.w, r0.x
mov o0.y, r0.x
ret 
// Approximately 44 instruction slots used

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