mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
46 lines
1.2 KiB
Text
46 lines
1.2 KiB
Text
uniform sampler2D _CameraDepthTexture;
|
|
uniform sampler2D _CameraNormalsTexture;
|
|
uniform vec4 _ZBufferParams;
|
|
void main ()
|
|
{
|
|
vec2 tmpvar_1;
|
|
tmpvar_1 = gl_TexCoord[0].xy;
|
|
vec4 n_2;
|
|
vec4 tmpvar_3;
|
|
tmpvar_3 = texture2D (_CameraNormalsTexture, tmpvar_1);
|
|
n_2.w = tmpvar_3.w;
|
|
float tmpvar_4;
|
|
tmpvar_4 = (1.0/(((_ZBufferParams.x * texture2D (_CameraDepthTexture, tmpvar_1).x) + _ZBufferParams.y)));
|
|
n_2.xyz = ((tmpvar_3.xyz * 2.0) - 1.0);
|
|
n_2.z = -(n_2.z);
|
|
vec4 tmpvar_5;
|
|
if ((tmpvar_4 < 0.999985)) {
|
|
vec4 enc_6;
|
|
vec2 enc_7;
|
|
enc_7 = (n_2.xy / (n_2.z + 1.0));
|
|
enc_7 = (enc_7 / 1.7777);
|
|
enc_7 = ((enc_7 * 0.5) + 0.5);
|
|
enc_6.xy = enc_7;
|
|
vec2 enc_8;
|
|
enc_8 = (vec2(1.0, 255.0) * tmpvar_4);
|
|
vec2 tmpvar_9;
|
|
tmpvar_9 = fract(enc_8);
|
|
enc_8.y = tmpvar_9.y;
|
|
enc_8.x = (tmpvar_9.x - (tmpvar_9.y * 0.00392157));
|
|
enc_6.zw = enc_8;
|
|
tmpvar_5 = enc_6;
|
|
} else {
|
|
tmpvar_5 = vec4(0.5, 0.5, 1.0, 1.0);
|
|
};
|
|
gl_FragData[0] = tmpvar_5;
|
|
}
|
|
|
|
|
|
// stats: 17 alu 2 tex 1 flow
|
|
// inputs: 1
|
|
// #0: gl_TexCoord (high float) 4x1 [1] loc 4
|
|
// uniforms: 1 (total size: 0)
|
|
// #0: _ZBufferParams (high float) 4x1 [-1]
|
|
// textures: 2
|
|
// #0: _CameraDepthTexture (high 2d) 0x0 [-1]
|
|
// #1: _CameraNormalsTexture (high 2d) 0x0 [-1]
|