mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
72 lines
1.4 KiB
Text
72 lines
1.4 KiB
Text
struct v2f_img {
|
|
vec4 pos;
|
|
vec2 uv;
|
|
};
|
|
uniform vec4 _ZBufferParams;
|
|
uniform sampler2D _MainTex;
|
|
uniform sampler2D _CameraDepthTexture;
|
|
float LinearEyeDepth (
|
|
in float z_1
|
|
)
|
|
{
|
|
return (1.0 / ((_ZBufferParams.z * z_1) + _ZBufferParams.w));
|
|
}
|
|
|
|
vec4 frag (
|
|
in v2f_img i_2
|
|
)
|
|
{
|
|
vec4 col_3;
|
|
float z_4;
|
|
vec4 depth_5;
|
|
vec4 tex_6;
|
|
vec4 tmpvar_7;
|
|
tmpvar_7 = texture2D (_MainTex, i_2.uv);
|
|
vec4 tmpvar_8;
|
|
tmpvar_8 = tmpvar_7;
|
|
tex_6 = tmpvar_8;
|
|
vec4 tmpvar_9;
|
|
tmpvar_9 = texture2D (_CameraDepthTexture, i_2.uv);
|
|
vec4 tmpvar_10;
|
|
tmpvar_10 = tmpvar_9;
|
|
depth_5 = tmpvar_10;
|
|
float tmpvar_11;
|
|
tmpvar_11 = LinearEyeDepth (depth_5.x);
|
|
float tmpvar_12;
|
|
tmpvar_12 = (tmpvar_11 * 0.01);
|
|
z_4 = tmpvar_12;
|
|
vec4 tmpvar_13;
|
|
tmpvar_13 = tex_6;
|
|
col_3 = tmpvar_13;
|
|
vec2 tmpvar_14;
|
|
tmpvar_14 = vec2(z_4);
|
|
vec2 tmpvar_15;
|
|
tmpvar_15 = tmpvar_14;
|
|
col_3.xy = tmpvar_15.xy.xy;
|
|
return col_3;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_img xlt_i_16;
|
|
vec4 xl_retval_17;
|
|
vec4 tmpvar_18;
|
|
tmpvar_18 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_i_16.pos = tmpvar_18;
|
|
vec2 tmpvar_19;
|
|
tmpvar_19 = gl_TexCoord[0].xy;
|
|
vec2 tmpvar_20;
|
|
tmpvar_20 = tmpvar_19;
|
|
xlt_i_16.uv = tmpvar_20;
|
|
vec4 tmpvar_21;
|
|
tmpvar_21 = frag (xlt_i_16);
|
|
vec4 tmpvar_22;
|
|
tmpvar_22 = tmpvar_21;
|
|
xl_retval_17 = tmpvar_22;
|
|
vec4 tmpvar_23;
|
|
tmpvar_23 = xl_retval_17.xyzw;
|
|
vec4 tmpvar_24;
|
|
tmpvar_24 = tmpvar_23;
|
|
gl_FragData[0] = tmpvar_24;
|
|
}
|
|
|