mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-11 00:31:28 -05:00
51 lines
906 B
Text
51 lines
906 B
Text
|
struct v2f {
|
||
|
vec4 pos;
|
||
|
vec2 uv;
|
||
|
};
|
||
|
uniform vec4 _ZBufferParams;
|
||
|
uniform sampler2D _CameraDepthTexture;
|
||
|
float Linear01Depth (
|
||
|
in float z
|
||
|
)
|
||
|
{
|
||
|
return (1.0 / ((_ZBufferParams.x * z) + _ZBufferParams.y));
|
||
|
}
|
||
|
|
||
|
vec4 frag (
|
||
|
in v2f i
|
||
|
)
|
||
|
{
|
||
|
vec4 tmpvar_1;
|
||
|
tmpvar_1 = texture2D (_CameraDepthTexture, i.uv);
|
||
|
float tmpvar_2;
|
||
|
tmpvar_2 = Linear01Depth (tmpvar_1.x);
|
||
|
vec4 tmpvar_3;
|
||
|
tmpvar_3 = vec4((1.0 - tmpvar_2));
|
||
|
return tmpvar_3;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f xlt_i;
|
||
|
vec4 xl_retval;
|
||
|
vec4 tmpvar_1;
|
||
|
tmpvar_1 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_i.pos = tmpvar_1;
|
||
|
vec2 tmpvar_2;
|
||
|
tmpvar_2 = gl_TexCoord[0].xy;
|
||
|
vec2 tmpvar_3;
|
||
|
tmpvar_3 = tmpvar_2;
|
||
|
xlt_i.uv = tmpvar_3;
|
||
|
vec4 tmpvar_4;
|
||
|
tmpvar_4 = frag (xlt_i);
|
||
|
vec4 tmpvar_5;
|
||
|
tmpvar_5 = tmpvar_4;
|
||
|
xl_retval = tmpvar_5;
|
||
|
vec4 tmpvar_6;
|
||
|
tmpvar_6 = xl_retval.xyzw;
|
||
|
vec4 tmpvar_7;
|
||
|
tmpvar_7 = tmpvar_6;
|
||
|
gl_FragData[0] = tmpvar_7;
|
||
|
}
|
||
|
|