// Directional lighting/sunlight - FIXED

cbuffer _Globals : register(b0)
{
  row_major float4x4 m_texgen : packoffset(c0);
}

cbuffer dynamic_transforms : register(b1)
{
  row_major float4x4 m_WVP : packoffset(c0);
  row_major float3x4 m_WV : packoffset(c4);
  row_major float3x4 m_W : packoffset(c7);
  float4 L_material : packoffset(c10);
  float4 hemi_cube_pos_faces : packoffset(c11);
  float4 hemi_cube_neg_faces : packoffset(c12);
  float4 dt_params : packoffset(c13);
}

cbuffer static_globals : register(b13)
{
  row_major float4x4 m_P : packoffset(c3);
}


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


void main( 
  float4 v0 : POSITION0,
  out float4 o0 : TEXCOORD0,
  out float4 o1 : SV_Position0)
{
  o0.x = dot(m_texgen._m00_m01_m02_m03, v0.xyzw);
  o0.y = dot(m_texgen._m10_m11_m12_m13, v0.xyzw);
  o0.z = dot(m_texgen._m20_m21_m22_m23, v0.xyzw);
  o0.w = dot(m_texgen._m30_m31_m32_m33, v0.xyzw);
  o1.x = dot(m_WVP._m00_m01_m02_m03, v0.xyzw);
  o1.y = dot(m_WVP._m10_m11_m12_m13, v0.xyzw);
  o1.z = dot(m_WVP._m20_m21_m22_m23, v0.xyzw);
  o1.w = dot(m_WVP._m30_m31_m32_m33, v0.xyzw);
  
float4 stereo = StereoParams.Load(0);
float4 params = IniParams.Load(0);
o0.x += stereo.x * (o0.w - stereo.y)/2;

  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
//   using 3Dmigoto v1.2.29 on Wed Apr 06 20:17:22 2016
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   row_major float4x4 m_texgen;       // Offset:    0 Size:    64
//
// }
//
// cbuffer dynamic_transforms
// {
//
//   row_major float4x4 m_WVP;          // Offset:    0 Size:    64
//   row_major float3x4 m_WV;           // Offset:   64 Size:    48 [unused]
//   row_major float3x4 m_W;            // Offset:  112 Size:    48 [unused]
//   float4 L_material;                 // Offset:  160 Size:    16 [unused]
//   float4 hemi_cube_pos_faces;        // Offset:  176 Size:    16 [unused]
//   float4 hemi_cube_neg_faces;        // Offset:  192 Size:    16 [unused]
//   float4 dt_params;                  // Offset:  208 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// $Globals                          cbuffer      NA          NA    0        1
// dynamic_transforms                cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xyzw        0     NONE   float   xyzw
// SV_Position              0   xyzw        1      POS   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[4], immediateIndexed
dcl_constantbuffer cb1[4], immediateIndexed
dcl_input v0.xyzw
dcl_output o0.xyzw
dcl_output_siv o1.xyzw, position
dp4 o0.x, cb0[0].xyzw, v0.xyzw
dp4 o0.y, cb0[1].xyzw, v0.xyzw
dp4 o0.z, cb0[2].xyzw, v0.xyzw
dp4 o0.w, cb0[3].xyzw, v0.xyzw
dp4 o1.x, cb1[0].xyzw, v0.xyzw
dp4 o1.y, cb1[1].xyzw, v0.xyzw
dp4 o1.z, cb1[2].xyzw, v0.xyzw
dp4 o1.w, cb1[3].xyzw, v0.xyzw
ret 
// Approximately 9 instruction slots used

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