//Specular VS 1. Water.
// ---- Created with 3Dmigoto v1.3.16 on Fri Sep 02 19:32:57 2022

cbuffer perMaterialBuffer : register(b0)
{
  float4 g_commonParam : packoffset(c0);
  float4 g_fogColor : packoffset(c1);
  float4 g_fogParam : packoffset(c2);
  float4 g_ambientColor : packoffset(c3);
  row_major float4x4 g_matWorldViewProj : packoffset(c4);
  row_major float4x4 g_matWorld : packoffset(c8);
  row_major float4x4 g_matWorldInvTrans : packoffset(c12);
  float4 g_eyePos : packoffset(c16);
  float4 g_uvOffset0 : packoffset(c17);
  float4 g_uvOffset1 : packoffset(c18);
  float4 g_waterColor : packoffset(c19);
  float4 g_waterParam : packoffset(c20);
}



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


void main(
  float4 v0 : POSITION0,
  float3 v1 : NORMAL0,
  float4 v2 : COLOR0,
  float4 v3 : TEXCOORD0,
  float2 v4 : TEXCOORD1,
  float3 v5 : TANGENT0,
  float3 v6 : BINORMAL0,
  out float4 o0 : SV_Position0,
  out float3 o1 : TEXCOORD0,
  out float p1 : TEXCOORD7,
  out float4 o2 : TEXCOORD1,
  out float4 o3 : TEXCOORD2,
  out float4 o4 : TEXCOORD3,
  out float4 o5 : TEXCOORD4,
  out float4 o6 : TEXCOORD5,
  out float4 o7 : TEXCOORD6)
{
  float4 r0;
  uint4 bitmask, uiDest;
  float4 fDest;
  
  float4 stereo = StereoParams.Load(0);
  
  r0.xyzw = g_matWorldViewProj._m10_m11_m12_m13 * v0.yyyy;
  r0.xyzw = v0.xxxx * g_matWorldViewProj._m00_m01_m02_m03 + r0.xyzw;
  r0.xyzw = v0.zzzz * g_matWorldViewProj._m20_m21_m22_m23 + r0.xyzw;
  r0.xyzw = v0.wwww * g_matWorldViewProj._m30_m31_m32_m33 + r0.xyzw;
  o0.xyzw = r0.xyzw;
  r0.x = g_fogParam.y + -r0.w;
  r0.y = g_fogParam.y + -g_fogParam.x;
  r0.x = saturate(r0.x / r0.y);
  r0.x = r0.x * g_fogParam.z + -g_fogParam.z;
  p1.x = 1 + r0.x;
  r0.xyz = g_matWorldInvTrans._m10_m11_m12 * v1.yyy;
  r0.xyz = v1.xxx * g_matWorldInvTrans._m00_m01_m02 + r0.xyz;
  r0.xyz = v1.zzz * g_matWorldInvTrans._m20_m21_m22 + r0.xyz;
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  o1.xyz = r0.xyz * r0.www;
  o2.xy = v3.xy;
  o2.zw = v4.xy;
  r0.xyz = g_matWorldInvTrans._m10_m11_m12 * v5.yyy;
  r0.xyz = v5.xxx * g_matWorldInvTrans._m00_m01_m02 + r0.xyz;
  o3.xyz = v5.zzz * g_matWorldInvTrans._m20_m21_m22 + r0.xyz;
  r0.xyz = g_matWorldInvTrans._m10_m11_m12 * v6.yyy;
  r0.xyz = v6.xxx * g_matWorldInvTrans._m00_m01_m02 + r0.xyz;
  o4.xyz = v6.zzz * g_matWorldInvTrans._m20_m21_m22 + r0.xyz;
  r0.xyz = g_matWorld._m10_m11_m12 * v0.yyy;
  r0.xyz = v0.xxx * g_matWorld._m00_m01_m02 + r0.xyz;
  r0.xyz = v0.zzz * g_matWorld._m20_m21_m22 + r0.xyz;
  r0.xyz = v0.www * g_matWorld._m30_m31_m32 + r0.xyz;
  
  float fov = g_matWorldViewProj._m00*g_matWorldViewProj._m00+g_matWorldViewProj._m10*g_matWorldViewProj._m10+g_matWorldViewProj._m20*g_matWorldViewProj._m20;
  r0.xyz-=stereo.x*stereo.y*g_matWorldViewProj._m00_m10_m20/fov;
  
  o5.xyz = -g_eyePos.xyz + r0.xyz;
  
  o6.xyz = r0.xyz;
  o6.w = 0;
  o7.xyz = g_ambientColor.xyz * v2.xyz;
  o7.w = v2.w;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.16 on Fri Sep 02 19:32:57 2022
//
//
// Buffer Definitions:
//
// cbuffer perMaterialBuffer
// {
//
//   float4 g_commonParam;              // Offset:    0 Size:    16 [unused]
//   float4 g_fogColor;                 // Offset:   16 Size:    16 [unused]
//   float4 g_fogParam;                 // Offset:   32 Size:    16
//   float4 g_ambientColor;             // Offset:   48 Size:    16
//   row_major float4x4 g_matWorldViewProj;// Offset:   64 Size:    64
//   row_major float4x4 g_matWorld;     // Offset:  128 Size:    64
//   row_major float4x4 g_matWorldInvTrans;// Offset:  192 Size:    64
//   float4 g_eyePos;                   // Offset:  256 Size:    16
//   float4 g_uvOffset0;                // Offset:  272 Size:    16 [unused]
//   float4 g_uvOffset1;                // Offset:  288 Size:    16 [unused]
//   float4 g_waterColor;               // Offset:  304 Size:    16 [unused]
//   float4 g_waterParam;               // Offset:  320 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// perMaterialBuffer                 cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// NORMAL                   0   xyz         1     NONE   float   xyz
// COLOR                    0   xyzw        2     NONE   float   xyzw
// TEXCOORD                 0   xy          3     NONE   float   xy
// TEXCOORD                 1   xy          4     NONE   float   xy
// TANGENT                  0   xyz         5     NONE   float   xyz
// BINORMAL                 0   xyz         6     NONE   float   xyz
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xyz         1     NONE   float   xyz
// TEXCOORD                 7      w        1     NONE   float      w
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyz         3     NONE   float   xyz
// TEXCOORD                 3   xyz         4     NONE   float   xyz
// TEXCOORD                 4   xyz         5     NONE   float   xyz
// TEXCOORD                 5   xyzw        6     NONE   float   xyzw
// TEXCOORD                 6   xyzw        7     NONE   float   xyzw
//
vs_4_0
dcl_constantbuffer cb0[17], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyz
dcl_input v2.xyzw
dcl_input v3.xy
dcl_input v4.xy
dcl_input v5.xyz
dcl_input v6.xyz
dcl_output_siv o0.xyzw, position
dcl_output o1.xyz
dcl_output o1.w
dcl_output o2.xyzw
dcl_output o3.xyz
dcl_output o4.xyz
dcl_output o5.xyz
dcl_output o6.xyzw
dcl_output o7.xyzw
dcl_temps 1
mul r0.xyzw, v0.yyyy, cb0[5].xyzw
mad r0.xyzw, v0.xxxx, cb0[4].xyzw, r0.xyzw
mad r0.xyzw, v0.zzzz, cb0[6].xyzw, r0.xyzw
mad r0.xyzw, v0.wwww, cb0[7].xyzw, r0.xyzw
mov o0.xyzw, r0.xyzw
add r0.x, -r0.w, cb0[2].y
add r0.y, -cb0[2].x, cb0[2].y
div_sat r0.x, r0.x, r0.y
mad r0.x, r0.x, cb0[2].z, -cb0[2].z
add o1.w, r0.x, l(1.000000)
mul r0.xyz, v1.yyyy, cb0[13].xyzx
mad r0.xyz, v1.xxxx, cb0[12].xyzx, r0.xyzx
mad r0.xyz, v1.zzzz, cb0[14].xyzx, r0.xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul o1.xyz, r0.wwww, r0.xyzx
mov o2.xy, v3.xyxx
mov o2.zw, v4.xxxy
mul r0.xyz, v5.yyyy, cb0[13].xyzx
mad r0.xyz, v5.xxxx, cb0[12].xyzx, r0.xyzx
mad o3.xyz, v5.zzzz, cb0[14].xyzx, r0.xyzx
mul r0.xyz, v6.yyyy, cb0[13].xyzx
mad r0.xyz, v6.xxxx, cb0[12].xyzx, r0.xyzx
mad o4.xyz, v6.zzzz, cb0[14].xyzx, r0.xyzx
mul r0.xyz, v0.yyyy, cb0[9].xyzx
mad r0.xyz, v0.xxxx, cb0[8].xyzx, r0.xyzx
mad r0.xyz, v0.zzzz, cb0[10].xyzx, r0.xyzx
mad r0.xyz, v0.wwww, cb0[11].xyzx, r0.xyzx
add o5.xyz, r0.xyzx, -cb0[16].xyzx
mov o6.xyz, r0.xyzx
mov o6.w, l(0)
mul o7.xyz, v2.xyzx, cb0[3].xyzx
mov o7.w, v2.w
ret
// Approximately 34 instruction slots used

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