mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
116 lines
2.6 KiB
Text
116 lines
2.6 KiB
Text
struct v2f {
|
|
vec4 pos;
|
|
float fog;
|
|
vec2 bumpuv[2];
|
|
vec3 viewDir;
|
|
};
|
|
varying vec4 xlv_FOG;
|
|
uniform vec4 _horizonColor;
|
|
uniform sampler2D _ColorControl;
|
|
uniform sampler2D _BumpMap;
|
|
vec4 UnpackNormal (
|
|
in vec4 packednormal_1
|
|
)
|
|
{
|
|
vec4 normal_2;
|
|
vec2 tmpvar_3;
|
|
tmpvar_3 = ((packednormal_1.wy * 2.0) - 1.0);
|
|
normal_2.xy = tmpvar_3.xy.xy;
|
|
float tmpvar_4;
|
|
tmpvar_4 = sqrt (((1.0 - (normal_2.x * normal_2.x)) - (normal_2.y * normal_2.y)));
|
|
float tmpvar_5;
|
|
tmpvar_5 = tmpvar_4;
|
|
normal_2.z = vec3(tmpvar_5).z;
|
|
return normal_2;
|
|
}
|
|
|
|
vec4 frag (
|
|
in v2f i_6
|
|
)
|
|
{
|
|
vec4 col_7;
|
|
vec4 water_8;
|
|
float fresnel_9;
|
|
vec3 bump_10;
|
|
vec3 bump2_11;
|
|
vec3 bump1_12;
|
|
vec4 tmpvar_13;
|
|
tmpvar_13 = texture2D (_BumpMap, i_6.bumpuv[0]);
|
|
vec4 tmpvar_14;
|
|
tmpvar_14 = UnpackNormal (tmpvar_13);
|
|
vec3 tmpvar_15;
|
|
tmpvar_15 = tmpvar_14.xyz;
|
|
bump1_12 = tmpvar_15;
|
|
vec4 tmpvar_16;
|
|
tmpvar_16 = texture2D (_BumpMap, i_6.bumpuv[1]);
|
|
vec4 tmpvar_17;
|
|
tmpvar_17 = UnpackNormal (tmpvar_16);
|
|
vec3 tmpvar_18;
|
|
tmpvar_18 = tmpvar_17.xyz;
|
|
bump2_11 = tmpvar_18;
|
|
vec3 tmpvar_19;
|
|
tmpvar_19 = ((bump1_12 + bump2_11) * 0.5);
|
|
bump_10 = tmpvar_19;
|
|
float tmpvar_20;
|
|
tmpvar_20 = dot (i_6.viewDir, bump_10);
|
|
float tmpvar_21;
|
|
tmpvar_21 = tmpvar_20;
|
|
fresnel_9 = tmpvar_21;
|
|
vec2 tmpvar_22;
|
|
tmpvar_22.x = fresnel_9;
|
|
tmpvar_22.y = fresnel_9;
|
|
vec4 tmpvar_23;
|
|
tmpvar_23 = texture2D (_ColorControl, tmpvar_22);
|
|
vec4 tmpvar_24;
|
|
tmpvar_24 = tmpvar_23;
|
|
water_8 = tmpvar_24;
|
|
vec3 tmpvar_25;
|
|
tmpvar_25 = vec3(water_8.w);
|
|
vec3 tmpvar_26;
|
|
tmpvar_26 = mix (water_8.xyz, _horizonColor.xyz, tmpvar_25);
|
|
vec3 tmpvar_27;
|
|
tmpvar_27 = tmpvar_26;
|
|
col_7.xyz = tmpvar_27.xyz.xyz;
|
|
float tmpvar_28;
|
|
tmpvar_28 = _horizonColor.w;
|
|
col_7.w = vec4(tmpvar_28).w;
|
|
return col_7;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f xlt_i_29;
|
|
vec4 xl_retval_30;
|
|
vec4 tmpvar_31;
|
|
tmpvar_31 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_i_29.pos = tmpvar_31;
|
|
float tmpvar_32;
|
|
tmpvar_32 = xlv_FOG.x;
|
|
xlt_i_29.fog = tmpvar_32;
|
|
vec2 tmpvar_33;
|
|
tmpvar_33 = gl_TexCoord[0].xy;
|
|
vec2 tmpvar_34;
|
|
tmpvar_34 = tmpvar_33;
|
|
xlt_i_29.bumpuv[0] = tmpvar_34;
|
|
vec2 tmpvar_35;
|
|
tmpvar_35 = gl_TexCoord[1].xy;
|
|
vec2 tmpvar_36;
|
|
tmpvar_36 = tmpvar_35;
|
|
xlt_i_29.bumpuv[1] = tmpvar_36;
|
|
vec3 tmpvar_37;
|
|
tmpvar_37 = gl_TexCoord[2].xyz;
|
|
vec3 tmpvar_38;
|
|
tmpvar_38 = tmpvar_37;
|
|
xlt_i_29.viewDir = tmpvar_38;
|
|
vec4 tmpvar_39;
|
|
tmpvar_39 = frag (xlt_i_29);
|
|
vec4 tmpvar_40;
|
|
tmpvar_40 = tmpvar_39;
|
|
xl_retval_30 = tmpvar_40;
|
|
vec4 tmpvar_41;
|
|
tmpvar_41 = xl_retval_30.xyzw;
|
|
vec4 tmpvar_42;
|
|
tmpvar_42 = tmpvar_41;
|
|
gl_FragData[0] = tmpvar_42;
|
|
}
|
|
|