mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
50 lines
943 B
Text
50 lines
943 B
Text
struct v2f {
|
|
vec4 pos;
|
|
vec2 uv;
|
|
};
|
|
uniform sampler2D _CameraDepthTexture;
|
|
uniform vec4 _ZBufferParams;
|
|
float Linear01Depth (
|
|
in float z_1
|
|
)
|
|
{
|
|
return (1.0 / ((_ZBufferParams.x * z_1) + _ZBufferParams.y));
|
|
}
|
|
|
|
vec4 frag (
|
|
in v2f i_2
|
|
)
|
|
{
|
|
vec4 tmpvar_3;
|
|
tmpvar_3 = texture2D (_CameraDepthTexture, i_2.uv);
|
|
float tmpvar_4;
|
|
tmpvar_4 = Linear01Depth (tmpvar_3.x);
|
|
vec4 tmpvar_5;
|
|
tmpvar_5 = vec4((1.0 - tmpvar_4));
|
|
return tmpvar_5;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f xlt_i_6;
|
|
vec4 xl_retval_7;
|
|
vec4 tmpvar_8;
|
|
tmpvar_8 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_i_6.pos = tmpvar_8;
|
|
vec2 tmpvar_9;
|
|
tmpvar_9 = gl_TexCoord[0].xy;
|
|
vec2 tmpvar_10;
|
|
tmpvar_10 = tmpvar_9;
|
|
xlt_i_6.uv = tmpvar_10;
|
|
vec4 tmpvar_11;
|
|
tmpvar_11 = frag (xlt_i_6);
|
|
vec4 tmpvar_12;
|
|
tmpvar_12 = tmpvar_11;
|
|
xl_retval_7 = tmpvar_12;
|
|
vec4 tmpvar_13;
|
|
tmpvar_13 = xl_retval_7.xyzw;
|
|
vec4 tmpvar_14;
|
|
tmpvar_14 = tmpvar_13;
|
|
gl_FragData[0] = tmpvar_14;
|
|
}
|
|
|