mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
73 lines
1.3 KiB
Text
73 lines
1.3 KiB
Text
|
struct v2f_img {
|
||
|
vec4 pos;
|
||
|
vec2 uv;
|
||
|
};
|
||
|
uniform vec4 _ZBufferParams;
|
||
|
uniform sampler2D _MainTex;
|
||
|
uniform sampler2D _CameraDepthTexture;
|
||
|
float LinearEyeDepth (
|
||
|
in float z
|
||
|
)
|
||
|
{
|
||
|
return (1.0 / ((_ZBufferParams.z * z) + _ZBufferParams.w));
|
||
|
}
|
||
|
|
||
|
vec4 frag (
|
||
|
in v2f_img i
|
||
|
)
|
||
|
{
|
||
|
vec4 col;
|
||
|
float z;
|
||
|
vec4 depth;
|
||
|
vec4 tex;
|
||
|
vec4 tmpvar_1;
|
||
|
tmpvar_1 = texture2D (_MainTex, i.uv);
|
||
|
vec4 tmpvar_2;
|
||
|
tmpvar_2 = tmpvar_1;
|
||
|
tex = tmpvar_2;
|
||
|
vec4 tmpvar_3;
|
||
|
tmpvar_3 = texture2D (_CameraDepthTexture, i.uv);
|
||
|
vec4 tmpvar_4;
|
||
|
tmpvar_4 = tmpvar_3;
|
||
|
depth = tmpvar_4;
|
||
|
float tmpvar_5;
|
||
|
tmpvar_5 = LinearEyeDepth (depth.x);
|
||
|
float tmpvar_6;
|
||
|
tmpvar_6 = (tmpvar_5 * 0.01);
|
||
|
z = tmpvar_6;
|
||
|
vec4 tmpvar_7;
|
||
|
tmpvar_7 = tex;
|
||
|
col = tmpvar_7;
|
||
|
vec2 tmpvar_8;
|
||
|
tmpvar_8 = vec2(z);
|
||
|
vec2 tmpvar_9;
|
||
|
tmpvar_9 = tmpvar_8;
|
||
|
col.xy = tmpvar_9.xy.xy;
|
||
|
return col;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f_img 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;
|
||
|
}
|
||
|
|