mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
128 lines
2.4 KiB
Text
128 lines
2.4 KiB
Text
struct v2f {
|
|
vec4 pos;
|
|
vec2 uv;
|
|
vec4 nz;
|
|
};
|
|
uniform float _Cutoff;
|
|
uniform sampler2D _MainTex;
|
|
void xll_clip (
|
|
in float x_1
|
|
)
|
|
{
|
|
if ((x_1 < 0.0)) {
|
|
discard;
|
|
};
|
|
}
|
|
|
|
vec2 EncodeViewNormalStereo (
|
|
in vec3 n_2
|
|
)
|
|
{
|
|
vec2 enc_3;
|
|
float kScale_4;
|
|
float tmpvar_5;
|
|
tmpvar_5 = 1.7777;
|
|
kScale_4 = tmpvar_5;
|
|
vec2 tmpvar_6;
|
|
tmpvar_6 = (n_2.xy / (n_2.z + 1.0));
|
|
enc_3 = tmpvar_6;
|
|
vec2 tmpvar_7;
|
|
tmpvar_7 = (enc_3 / kScale_4);
|
|
enc_3 = tmpvar_7;
|
|
vec2 tmpvar_8;
|
|
tmpvar_8 = ((enc_3 * 0.5) + 0.5);
|
|
enc_3 = tmpvar_8;
|
|
return enc_3;
|
|
}
|
|
|
|
vec2 EncodeFloatRG (
|
|
in float v_9
|
|
)
|
|
{
|
|
vec2 enc_10;
|
|
float kEncodeBit_11;
|
|
vec2 kEncodeMul_12;
|
|
vec2 tmpvar_13;
|
|
tmpvar_13 = vec2(1.0, 255.0);
|
|
kEncodeMul_12 = tmpvar_13;
|
|
float tmpvar_14;
|
|
tmpvar_14 = 0.00392157;
|
|
kEncodeBit_11 = tmpvar_14;
|
|
vec2 tmpvar_15;
|
|
tmpvar_15 = (kEncodeMul_12 * v_9);
|
|
enc_10 = tmpvar_15;
|
|
vec2 tmpvar_16;
|
|
tmpvar_16 = fract (enc_10);
|
|
vec2 tmpvar_17;
|
|
tmpvar_17 = tmpvar_16;
|
|
enc_10 = tmpvar_17;
|
|
float tmpvar_18;
|
|
tmpvar_18 = (enc_10.x - (enc_10.y * kEncodeBit_11));
|
|
enc_10.x = tmpvar_18;
|
|
return enc_10;
|
|
}
|
|
|
|
vec4 EncodeDepthNormal (
|
|
in float depth_19,
|
|
in vec3 normal_20
|
|
)
|
|
{
|
|
vec4 enc_21;
|
|
vec2 tmpvar_22;
|
|
tmpvar_22 = EncodeViewNormalStereo (normal_20);
|
|
vec2 tmpvar_23;
|
|
tmpvar_23 = tmpvar_22;
|
|
enc_21.xy = tmpvar_23.xy.xy;
|
|
vec2 tmpvar_24;
|
|
tmpvar_24 = EncodeFloatRG (depth_19);
|
|
vec2 tmpvar_25;
|
|
tmpvar_25 = tmpvar_24;
|
|
enc_21.zw = tmpvar_25.xxxy.zw;
|
|
return enc_21;
|
|
}
|
|
|
|
vec4 frag (
|
|
in v2f i_26
|
|
)
|
|
{
|
|
vec4 texcol_27;
|
|
vec4 tmpvar_28;
|
|
tmpvar_28 = texture2D (_MainTex, i_26.uv);
|
|
vec4 tmpvar_29;
|
|
tmpvar_29 = tmpvar_28;
|
|
texcol_27 = tmpvar_29;
|
|
xll_clip ((texcol_27.w - _Cutoff));
|
|
vec4 tmpvar_30;
|
|
tmpvar_30 = EncodeDepthNormal (i_26.nz.w, i_26.nz.xyz);
|
|
return tmpvar_30;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f xlt_i_31;
|
|
vec4 xl_retval_32;
|
|
vec4 tmpvar_33;
|
|
tmpvar_33 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_i_31.pos = tmpvar_33;
|
|
vec2 tmpvar_34;
|
|
tmpvar_34 = gl_TexCoord[0].xy;
|
|
vec2 tmpvar_35;
|
|
tmpvar_35 = tmpvar_34;
|
|
xlt_i_31.uv = tmpvar_35;
|
|
vec4 tmpvar_36;
|
|
tmpvar_36 = gl_TexCoord[1].xyzw;
|
|
vec4 tmpvar_37;
|
|
tmpvar_37 = tmpvar_36;
|
|
xlt_i_31.nz = tmpvar_37;
|
|
vec4 tmpvar_38;
|
|
tmpvar_38 = frag (xlt_i_31);
|
|
vec4 tmpvar_39;
|
|
tmpvar_39 = tmpvar_38;
|
|
xl_retval_32 = tmpvar_39;
|
|
vec4 tmpvar_40;
|
|
tmpvar_40 = xl_retval_32.xyzw;
|
|
vec4 tmpvar_41;
|
|
tmpvar_41 = tmpvar_40;
|
|
gl_FragData[0] = tmpvar_41;
|
|
}
|
|
|