//water reflections
// ---- Created with 3Dmigoto v0.6.164 on Wed Dec 17 16:14:41 2025
Texture2D<float4> t6 : register(t6);
Texture2D<float4> t5 : register(t5);
Texture2D<float4> t4 : register(t4);
Texture2D<float4> t3 : register(t3);
Texture2D<float4> t2 : register(t2);
Texture2D<float4> t1 : register(t1);
Texture2D<float4> t0 : register(t0);

SamplerState s6_s : register(s6);
SamplerState s5_s : register(s5);
SamplerState s4_s : register(s4);
SamplerState s3_s : register(s3);
SamplerState s2_s : register(s2);
SamplerState s1_s : register(s1);
SamplerState s0_s : register(s0);

cbuffer cb1 : register(b1)
{
  float4 cb1[1];
}

cbuffer cb0 : register(b0)
{
  float4 cb0[49];
}

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


void main(
  float4 v0 : SV_POSITION0,
  float4 v1 : TEXCOORD0,
  float4 v2 : TEXCOORD1,
  float4 v3 : TEXCOORD2,
  float4 v4 : TEXCOORD3,
  float4 v5 : TEXCOORD4,
  float4 v6 : TEXCOORD5,
  float3 v7 : TEXCOORD6,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3,r4,r5,r30;
  uint4 bitmask, uiDest;
  float4 fDest;
  
float4 s = StereoParams.Load(0);
float4 texFilter = IniParams.Load(int2(14,0));
float4 testeo = IniParams.Load(int2(90,0));



  r0.xy = v2.xy / v2.ww;
  r0.zw = r0.xy * float2(2,2) + float2(-1,-1);
  r1.xyzw = cb0[26].xyzw * r0.wwww;
  r1.xyzw = cb0[25].xyzw * r0.zzzz + r1.xyzw;
  r2.xyzw = t1.Sample(s3_s, r0.xy).xyzw;
  r1.xyzw = cb0[27].xyzw * r2.xxxx + r1.xyzw;
  r1.xyzw = cb0[28].xyzw + r1.xyzw;
  r1.xyz = r1.xyz / r1.www;
  r0.z = -v4.y + r1.y;
  r1.xyz = v4.xyz + -r1.xyz;
  r0.w = dot(r1.xyz, r1.xyz);
  r0.w = sqrt(r0.w);
  r0.w = saturate(r0.w / cb0[32].y);
  r0.z = 1 + -abs(r0.z);
  r0.z = 1 + -r0.z;
  r1.xy = saturate(r0.zz / cb0[29].xz);
  r1.xy = float2(1,1) + -r1.xy;
  r0.z = cb0[29].y * r1.x;
  r1.x = cmp(0 < r1.y);
  r1.x = (int)-r1.x;
  r1.x = saturate(r1.x);
  r1.y = 1 + -r0.w;
  r2.xyz = saturate(cb0[36].xyz * r1.yyy + r0.www);
  r0.w = cb0[31].w * r1.y;
  r1.y = cb0[33].y + -cb0[33].x;
  r3.xyz = -cb0[46].xyz + v4.xyz;
  r1.z = dot(r3.xyz, r3.xyz);
  r1.z = sqrt(r1.z);
  r1.w = -cb0[33].x + r1.z;
  r1.y = saturate(r1.w / r1.y);
  r1.y = 1 + -r1.y;
  r3.xyz = saturate(cb0[34].xyz * r1.yyy);
  r1.y = cb1[0].x * cb0[38].x;
  r4.xy = cb0[20].zw * r1.yy;
  r4.xy = v4.xz * cb0[20].xy + r4.xy;
  r4.xyzw = t0.Sample(s2_s, r4.xy).xyzw;
  r4.xy = r4.xy * float2(2,2) + float2(-1,-1);
  r0.xy = r4.xy * cb0[32].xx + r0.xy;
  r5.xyzw = t2.Sample(s4_s, r0.xy).xyzw;
  r0.xyw = r5.xyz * r0.www + r3.xyz;
  r3.xy = cb0[19].zw * r1.yy;
  r3.zw = r4.xy * cb0[29].ww + v1.xy;
  r3.xy = r3.zw * cb0[19].xy + r3.xy;
  r3.xyzw = t3.Sample(s1_s, r3.xy).xyzw;
  r0.xyz = r3.xyz * r0.zzz + r0.xyw;
  r0.xyz = float3(1,1,1) + -r0.xyz;
  r0.w = -cb0[41].x + r1.z;
  r1.w = cb0[41].y + -cb0[41].x;
  r0.w = saturate(r0.w / r1.w);
  r0.w = 1 + -r0.w;
  
   
  
  r3.xy = v3.xy / v3.ww;
  r3.z = 1 + -r3.x;
  r3.xy = r4.xy * cb0[32].ww + r3.zy;
  r3.zw = r4.xy * cb0[38].yy + v1.xy;

r30 = r3;  
r30.x += s.x *  (1 - s.y / v2.w) * 0.5;  
  
  r4.xyzw = t5.Sample(s5_s, r30.xy).xyzw;
  r4.xyz = cb0[32].zzz * r4.xyz;
  r4.xyz = saturate(r4.xyz * r0.www);
  r4.xyz = float3(1,1,1) + -r4.xyz;
  r0.xyz = -r0.xyz * r4.xyz + float3(1,1,1);
  r3.xy = cb0[18].zw * r1.yy;
  r1.yw = cb0[24].zw * r1.yy;
  r1.yw = r3.zw * cb0[24].xy + r1.yw;
  r3.xy = r3.zw * cb0[18].xy + r3.xy;
  r3.xyzw = t4.Sample(s0_s, r3.xy).xyzw;
  r4.xyzw = t6.Sample(s6_s, r1.yw).xyzw;
  r0.w = -cb0[39].x + r1.z;
  r1.y = -cb0[40].x + r1.z;
  r1.z = cb0[39].y + -cb0[39].x;
  r0.w = saturate(r0.w / r1.z);
  r0.w = 1 + -r0.w;
  r3.xyz = saturate(r3.xyz * r0.www);
  r0.xyz = r3.xyz * cb0[47].zzz + r0.xyz;
  r3.xyz = r0.xyz * r2.xyz;
  r0.xyz = -r0.xyz * r2.xyz + cb0[48].xyz;
  r0.w = cb0[40].y + -cb0[40].x;
  r0.w = saturate(r1.y / r0.w);
  r0.w = 1 + -r0.w;
  r0.w = saturate(r4.x * r0.w);
  r0.xyz = r0.www * r0.xyz + r3.xyz;
  r1.yzw = -cb0[5].xyz + cb0[4].xyz;
  r1.yzw = v1.www * r1.yzw + cb0[5].xyz;
  r1.yzw = r1.yzw + -r0.xyz;
  r1.yzw = cb0[7].xxx * r1.yzw + r0.xyz;
  r0.xyz = -r1.yzw + r0.xyz;
  r0.xyz = v1.zzz * r0.xyz + r1.yzw;
  r1.yzw = cb0[30].xyz * cb0[30].www;
  o0.xyz = saturate(r1.yzw * r1.xxx + r0.xyz);
  o0.w = cb0[31].z;
  return;
}