//Light Halo
cbuffer _Globals : register(b4)
{
  float2 gm_vTextureSizeInv : packoffset(c0);
  float3 ColorModulate_01_Color2 : packoffset(c1);
  float4 Multiply_01_V2 : packoffset(c2);
  float VSObjectNearDistanceKill_01_KillDistance : packoffset(c3);
  float VSDistanceFade_01_InStartDistance : packoffset(c3.y);
  float VSDistanceFade_01_InEndDistance : packoffset(c3.z);
  float VSDistanceFade_01_OutStartDistance : packoffset(c3.w);
  float VSDistanceFade_01_OutEndDistance : packoffset(c4);
  float VSDistanceFade_01_StartAngle : packoffset(c4.y);
  float VSDistanceFade_01_EndAngle : packoffset(c4.z);
}

cbuffer _cbPerObject : register(b0)
{

  struct
  {
    row_major float4x4 go_mObjectToView;
    float4 go_vPosScale;
    float4 go_vPosBias;
    float4 go_vTexScaleBias;
    float4 go_vObjectId;
  } cbPerObject : packoffset(c0);

}

cbuffer _cbSharedPerViewData : register(b1)
{

  struct
  {
    row_major float4x4 mProjection;
    row_major float4x4 mViewToViewport;
    row_major float4x4 mViewToWorld;
    float4 vViewRemap;
    float4 vViewDepthRemap;
    float4 vEyeVectorUL;
    float4 vEyeVectorLR;
    float4 v4ShadowRange;
    float4 vViewSpaceUpVector;
    float4 vGlobalLitFactor;
    float4 vViewportSize;
    float4 vEngineTime;
    float4 vShaderColor0;
    float4 vShaderColor1;
    float4 vShaderColor2;
    float4 vShaderColor3;
    float4 vShaderColor4;
    float4 vClipPlane;
  } cbSharedPerViewData : packoffset(c0);

}

Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main( 
  float4 v0 : POSITION0,
  float4 v1 : NORMAL0,
  float4 v2 : COLOR0,
  float4 v3 : TANGENT0,
  float4 v4 : BINORMAL0,
  float2 v5 : TEXCOORD0,
  out float4 o0 : SV_POSITION0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD1,
  out float4 o3 : TEXCOORD2)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyz = cbPerObject.go_vPosScale.xyz * v0.xyz + cbPerObject.go_vPosBias.xyz;
  r1.xyzw = cbPerObject.go_mObjectToView._m20_m21_m22_m23 * r0.zzzz + cbPerObject.go_mObjectToView._m30_m31_m32_m33;
  r1.xyzw = cbPerObject.go_mObjectToView._m00_m01_m02_m03 * r0.xxxx + r1.xyzw;
  r0.xyzw = cbPerObject.go_mObjectToView._m10_m11_m12_m13 * r0.yyyy + r1.xyzw;
  r1.y = cbPerObject.go_mObjectToView._m02;
  r1.z = cbPerObject.go_mObjectToView._m12;
  r2.xy = cbPerObject.go_vPosScale.xy * abs(r1.yz);
  r1.w = r2.x + r2.y;
  r1.x = cbPerObject.go_mObjectToView._m22;
  r1.w = cbPerObject.go_vPosScale.z * abs(r1.x) + r1.w;
  r2.x = dot(cbPerObject.go_vPosBias.zxy, r1.xyz);
  r2.x = cbPerObject.go_mObjectToView._m32 + r2.x;
  r1.w = r2.x + r1.w;
  r2.xy = -r1.ww;
  r1.w = r2.y < VSObjectNearDistanceKill_01_KillDistance;
  r0.xyzw = r1.wwww ? float4(0,0,0,1) : r0.xyzw;
  r3.xyzw = cbSharedPerViewData.mProjection._m10_m11_m12_m13 * r0.yyyy;
  r3.xyzw = r0.xxxx * cbSharedPerViewData.mProjection._m00_m01_m02_m03 + r3.xyzw;
  r3.xyzw = r0.zzzz * cbSharedPerViewData.mProjection._m20_m21_m22_m23 + r3.xyzw;
  o0.xyzw = r0.wwww * cbSharedPerViewData.mProjection._m30_m31_m32_m33 + r3.xyzw;
  
  float4 stereo = StereoParams.Load(0);
  r3.x -= stereo.x * (r3.w - stereo.y);
  
  //o1.xyzw = r0.xyzw;
  o1.xyzw = r3.xyzw;
  
  r0.xyz = float3(-0.5,-0.5,-0.5) + v1.zxy;
  r0.xyz = r1.xyz * r0.xyz;
  r0.xy = r0.xy + r0.xy;
  r0.x = r0.x + r0.y;
  r0.x = r0.z * 2 + r0.x;
  r2.z = min(1, abs(r0.x));
  r0.x = -VSDistanceFade_01_InStartDistance;
  r0.yz = -VSDistanceFade_01_OutEndDistance;
  r1.xyz = r2.xyz + r0.xyz;
  r2.xy = VSDistanceFade_01_InEndDistance + r0.xy;
  r2.z = VSDistanceFade_01_StartAngle + r0.z;
  r0.xyz = float3(1,1,1) / r2.xyz;
  r0.xyz = saturate(r1.xyz * r0.xyz);
  r0.x = r0.x * r0.y;
  r0.x = r0.x * r0.z;
  o2.xyzw = v2.xyzw * r0.xxxx;
  o3.xy = cbPerObject.go_vTexScaleBias.xy * v5.xy + cbPerObject.go_vTexScaleBias.zw;
  o3.zw = float2(0,0);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
//   using 3Dmigoto v1.2.9 on Thu Dec 17 13:14:43 2015
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float2 gm_vTextureSizeInv;         // Offset:    0 Size:     8 [unused]
//   float3 ColorModulate_01_Color2;    // Offset:   16 Size:    12 [unused]
//   float4 Multiply_01_V2;             // Offset:   32 Size:    16 [unused]
//   float VSObjectNearDistanceKill_01_KillDistance;// Offset:   48 Size:     4
//   float VSDistanceFade_01_InStartDistance;// Offset:   52 Size:     4
//   float VSDistanceFade_01_InEndDistance;// Offset:   56 Size:     4
//   float VSDistanceFade_01_OutStartDistance;// Offset:   60 Size:     4
//   float VSDistanceFade_01_OutEndDistance;// Offset:   64 Size:     4
//   float VSDistanceFade_01_StartAngle;// Offset:   68 Size:     4
//   float VSDistanceFade_01_EndAngle;  // Offset:   72 Size:     4
//
// }
//
// cbuffer _cbPerObject
// {
//
//   struct
//   {
//       
//       row_major float4x4 go_mObjectToView;// Offset:    0
//       float4 go_vPosScale;           // Offset:   64
//       float4 go_vPosBias;            // Offset:   80
//       float4 go_vTexScaleBias;       // Offset:   96
//       float4 go_vObjectId;           // Offset:  112
//
//   } cbPerObject;                     // Offset:    0 Size:   128
//
// }
//
// cbuffer _cbSharedPerViewData
// {
//
//   struct
//   {
//       
//       row_major float4x4 mProjection;// Offset:    0
//       row_major float4x4 mViewToViewport;// Offset:   64
//       row_major float4x4 mViewToWorld;// Offset:  128
//       float4 vViewRemap;             // Offset:  192
//       float4 vViewDepthRemap;        // Offset:  208
//       float4 vEyeVectorUL;           // Offset:  224
//       float4 vEyeVectorLR;           // Offset:  240
//       float4 v4ShadowRange;          // Offset:  256
//       float4 vViewSpaceUpVector;     // Offset:  272
//       float4 vGlobalLitFactor;       // Offset:  288
//       float4 vViewportSize;          // Offset:  304
//       float4 vEngineTime;            // Offset:  320
//       float4 vShaderColor0;          // Offset:  336
//       float4 vShaderColor1;          // Offset:  352
//       float4 vShaderColor2;          // Offset:  368
//       float4 vShaderColor3;          // Offset:  384
//       float4 vShaderColor4;          // Offset:  400
//       float4 vClipPlane;             // Offset:  416
//
//   } cbSharedPerViewData;             // Offset:    0 Size:   432
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// _cbPerObject                      cbuffer      NA          NA    0        1
// _cbSharedPerViewData              cbuffer      NA          NA    1        1
// $Globals                          cbuffer      NA          NA    4        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyz 
// NORMAL                   0   xyzw        1     NONE   float   xyz 
// COLOR                    0   xyzw        2     NONE   float   xyzw
// TANGENT                  0   xyzw        3     NONE   float       
// BINORMAL                 0   xyzw        4     NONE   float       
// TEXCOORD                 0   xy          5     NONE   float   xy  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
//
vs_4_0
dcl_constantbuffer cb4[5], immediateIndexed
dcl_constantbuffer cb0[7], immediateIndexed
dcl_constantbuffer cb1[4], immediateIndexed
dcl_input v0.xyz
dcl_input v1.xyz
dcl_input v2.xyzw
dcl_input v5.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_temps 4
mad r0.xyz, cb0[4].xyzx, v0.xyzx, cb0[5].xyzx
mad r1.xyzw, cb0[2].xyzw, r0.zzzz, cb0[3].xyzw
mad r1.xyzw, cb0[0].xyzw, r0.xxxx, r1.xyzw
mad r0.xyzw, cb0[1].xyzw, r0.yyyy, r1.xyzw
mov r1.y, cb0[0].z
mov r1.z, cb0[1].z
mul r2.xy, |r1.yzyy|, cb0[4].xyxx
add r1.w, r2.y, r2.x
mov r1.x, cb0[2].z
mad r1.w, cb0[4].z, |r1.x|, r1.w
dp3 r2.x, cb0[5].zxyz, r1.xyzx
add r2.x, r2.x, cb0[3].z
add r1.w, r1.w, r2.x
mov r2.xy, -r1.wwww
lt r1.w, r2.y, cb4[3].x
movc r0.xyzw, r1.wwww, l(0,0,0,1.000000), r0.xyzw
mul r3.xyzw, r0.yyyy, cb1[1].xyzw
mad r3.xyzw, r0.xxxx, cb1[0].xyzw, r3.xyzw
mad r3.xyzw, r0.zzzz, cb1[2].xyzw, r3.xyzw
mad o0.xyzw, r0.wwww, cb1[3].xyzw, r3.xyzw
mov o1.xyzw, r0.xyzw
add r0.xyz, v1.zxyz, l(-0.500000, -0.500000, -0.500000, 0.000000)
mul r0.xyz, r0.xyzx, r1.xyzx
add r0.xy, r0.xyxx, r0.xyxx
add r0.x, r0.y, r0.x
mad r0.x, r0.z, l(2.000000), r0.x
min r2.z, |r0.x|, l(1.000000)
mov r0.x, -cb4[3].y
mov r0.yz, -cb4[4].xxzx
add r1.xyz, r0.xyzx, r2.xyzx
add r2.xy, r0.xyxx, cb4[3].zwzz
add r2.z, r0.z, cb4[4].y
div r0.xyz, l(1.000000, 1.000000, 1.000000, 1.000000), r2.xyzx
mul_sat r0.xyz, r0.xyzx, r1.xyzx
mul r0.x, r0.y, r0.x
mul r0.x, r0.z, r0.x
mul o2.xyzw, r0.xxxx, v2.xyzw
mad o3.xy, cb0[6].xyxx, v5.xyxx, cb0[6].zwzz
mov o3.zw, l(0,0,0,0)
ret 
// Approximately 40 instruction slots used

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