mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-11 00:31:28 -05:00
132 lines
2.7 KiB
Text
132 lines
2.7 KiB
Text
struct v2f_img {
|
|
vec4 pos;
|
|
vec2 uv;
|
|
};
|
|
uniform sampler2D _MainTex;
|
|
uniform sampler2D _CameraDepthNormalsTexture;
|
|
vec3 DecodeViewNormalStereo (
|
|
in vec4 enc4_1
|
|
)
|
|
{
|
|
vec3 n_2;
|
|
float g_3;
|
|
vec3 nn_4;
|
|
float kScale_5;
|
|
float tmpvar_6;
|
|
tmpvar_6 = 1.7777;
|
|
kScale_5 = tmpvar_6;
|
|
vec3 tmpvar_7;
|
|
tmpvar_7.z = 0.0;
|
|
tmpvar_7.x = (2.0 * kScale_5);
|
|
tmpvar_7.y = (2.0 * kScale_5);
|
|
vec3 tmpvar_8;
|
|
tmpvar_8.z = 1.0;
|
|
tmpvar_8.x = -(kScale_5);
|
|
tmpvar_8.y = -(kScale_5);
|
|
vec3 tmpvar_9;
|
|
tmpvar_9 = ((enc4_1.xyz * tmpvar_7) + tmpvar_8);
|
|
nn_4 = tmpvar_9;
|
|
float tmpvar_10;
|
|
tmpvar_10 = dot (nn_4.xyz, nn_4.xyz);
|
|
float tmpvar_11;
|
|
tmpvar_11 = (2.0 / tmpvar_10);
|
|
g_3 = tmpvar_11;
|
|
vec2 tmpvar_12;
|
|
tmpvar_12 = (g_3 * nn_4.xy);
|
|
n_2.xy = tmpvar_12.xy.xy;
|
|
float tmpvar_13;
|
|
tmpvar_13 = (g_3 - 1.0);
|
|
n_2.z = vec3(tmpvar_13).z;
|
|
return n_2;
|
|
}
|
|
|
|
float DecodeFloatRG (
|
|
in vec2 enc_14
|
|
)
|
|
{
|
|
vec2 kDecodeDot_15;
|
|
vec2 tmpvar_16;
|
|
tmpvar_16 = vec2(1.0, 0.00392157);
|
|
kDecodeDot_15 = tmpvar_16;
|
|
float tmpvar_17;
|
|
tmpvar_17 = dot (enc_14, kDecodeDot_15);
|
|
return tmpvar_17;
|
|
}
|
|
|
|
void DecodeDepthNormal (
|
|
in vec4 enc_18,
|
|
out float depth_19,
|
|
out vec3 normal_20
|
|
)
|
|
{
|
|
float tmpvar_21;
|
|
tmpvar_21 = DecodeFloatRG (enc_18.zw);
|
|
float tmpvar_22;
|
|
tmpvar_22 = tmpvar_21;
|
|
depth_19 = tmpvar_22;
|
|
vec3 tmpvar_23;
|
|
tmpvar_23 = DecodeViewNormalStereo (enc_18);
|
|
vec3 tmpvar_24;
|
|
tmpvar_24 = tmpvar_23;
|
|
normal_20 = tmpvar_24;
|
|
}
|
|
|
|
vec4 frag (
|
|
in v2f_img i_25
|
|
)
|
|
{
|
|
vec4 col_26;
|
|
vec3 n_27;
|
|
float z_28;
|
|
vec4 depth_29;
|
|
vec4 tex_30;
|
|
vec4 tmpvar_31;
|
|
tmpvar_31 = texture2D (_MainTex, i_25.uv);
|
|
vec4 tmpvar_32;
|
|
tmpvar_32 = tmpvar_31;
|
|
tex_30 = tmpvar_32;
|
|
vec4 tmpvar_33;
|
|
tmpvar_33 = texture2D (_CameraDepthNormalsTexture, i_25.uv);
|
|
vec4 tmpvar_34;
|
|
tmpvar_34 = tmpvar_33;
|
|
depth_29 = tmpvar_34;
|
|
DecodeDepthNormal (depth_29, z_28, n_27);
|
|
float tmpvar_35;
|
|
tmpvar_35 = z_28;
|
|
col_26.x = tmpvar_35;
|
|
float tmpvar_36;
|
|
tmpvar_36 = ((n_27.x * 0.5) + 0.5);
|
|
col_26.y = vec2(tmpvar_36).y;
|
|
float tmpvar_37;
|
|
tmpvar_37 = ((n_27.y * 0.5) + 0.5);
|
|
col_26.z = vec3(tmpvar_37).z;
|
|
float tmpvar_38;
|
|
tmpvar_38 = tex_30.w;
|
|
col_26.w = vec4(tmpvar_38).w;
|
|
return col_26;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_img xlt_i_39;
|
|
vec4 xl_retval_40;
|
|
vec4 tmpvar_41;
|
|
tmpvar_41 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_i_39.pos = tmpvar_41;
|
|
vec2 tmpvar_42;
|
|
tmpvar_42 = gl_TexCoord[0].xy;
|
|
vec2 tmpvar_43;
|
|
tmpvar_43 = tmpvar_42;
|
|
xlt_i_39.uv = tmpvar_43;
|
|
vec4 tmpvar_44;
|
|
tmpvar_44 = frag (xlt_i_39);
|
|
vec4 tmpvar_45;
|
|
tmpvar_45 = tmpvar_44;
|
|
xl_retval_40 = tmpvar_45;
|
|
vec4 tmpvar_46;
|
|
tmpvar_46 = xl_retval_40.xyzw;
|
|
vec4 tmpvar_47;
|
|
tmpvar_47 = tmpvar_46;
|
|
gl_FragData[0] = tmpvar_47;
|
|
}
|
|
|