mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-12 09:11:18 -05:00
217 lines
4.5 KiB
Text
217 lines
4.5 KiB
Text
struct v2f_img {
|
|
vec4 pos;
|
|
vec2 uv;
|
|
};
|
|
uniform vec4 _BlurOffsets[8];
|
|
uniform sampler2D _MainTex;
|
|
uniform vec4 unity_ShadowBlurParams;
|
|
float xll_saturate (
|
|
in float x_1
|
|
)
|
|
{
|
|
float tmpvar_2;
|
|
tmpvar_2 = clamp (x_1, 0.0, 1.0);
|
|
return tmpvar_2;
|
|
}
|
|
|
|
vec2 xll_saturate (
|
|
in vec2 x_3
|
|
)
|
|
{
|
|
vec2 tmpvar_4;
|
|
tmpvar_4 = clamp (x_3, 0.0, 1.0);
|
|
return tmpvar_4;
|
|
}
|
|
|
|
vec3 xll_saturate (
|
|
in vec3 x_5
|
|
)
|
|
{
|
|
vec3 tmpvar_6;
|
|
tmpvar_6 = clamp (x_5, 0.0, 1.0);
|
|
return tmpvar_6;
|
|
}
|
|
|
|
vec4 xll_saturate (
|
|
in vec4 x_7
|
|
)
|
|
{
|
|
vec4 tmpvar_8;
|
|
tmpvar_8 = clamp (x_7, 0.0, 1.0);
|
|
return tmpvar_8;
|
|
}
|
|
|
|
mat2 xll_saturate (
|
|
in mat2 m_9
|
|
)
|
|
{
|
|
vec2 tmpvar_10;
|
|
tmpvar_10 = clamp (m_9[0], 0.0, 1.0);
|
|
vec2 tmpvar_11;
|
|
tmpvar_11 = clamp (m_9[1], 0.0, 1.0);
|
|
mat2 tmpvar_12;
|
|
vec2 tmpvar_13;
|
|
tmpvar_13 = tmpvar_10;
|
|
tmpvar_12[0] = tmpvar_13;
|
|
vec2 tmpvar_14;
|
|
tmpvar_14 = tmpvar_11;
|
|
tmpvar_12[1] = tmpvar_14;
|
|
return tmpvar_12;
|
|
}
|
|
|
|
mat3 xll_saturate (
|
|
in mat3 m_15
|
|
)
|
|
{
|
|
vec3 tmpvar_16;
|
|
tmpvar_16 = clamp (m_15[0], 0.0, 1.0);
|
|
vec3 tmpvar_17;
|
|
tmpvar_17 = clamp (m_15[1], 0.0, 1.0);
|
|
vec3 tmpvar_18;
|
|
tmpvar_18 = clamp (m_15[2], 0.0, 1.0);
|
|
mat3 tmpvar_19;
|
|
vec3 tmpvar_20;
|
|
tmpvar_20 = tmpvar_16;
|
|
tmpvar_19[0] = tmpvar_20;
|
|
vec3 tmpvar_21;
|
|
tmpvar_21 = tmpvar_17;
|
|
tmpvar_19[1] = tmpvar_21;
|
|
vec3 tmpvar_22;
|
|
tmpvar_22 = tmpvar_18;
|
|
tmpvar_19[2] = tmpvar_22;
|
|
return tmpvar_19;
|
|
}
|
|
|
|
mat4 xll_saturate (
|
|
in mat4 m_23
|
|
)
|
|
{
|
|
vec4 tmpvar_24;
|
|
tmpvar_24 = clamp (m_23[0], 0.0, 1.0);
|
|
vec4 tmpvar_25;
|
|
tmpvar_25 = clamp (m_23[1], 0.0, 1.0);
|
|
vec4 tmpvar_26;
|
|
tmpvar_26 = clamp (m_23[2], 0.0, 1.0);
|
|
vec4 tmpvar_27;
|
|
tmpvar_27 = clamp (m_23[3], 0.0, 1.0);
|
|
mat4 tmpvar_28;
|
|
vec4 tmpvar_29;
|
|
tmpvar_29 = tmpvar_24;
|
|
tmpvar_28[0] = tmpvar_29;
|
|
vec4 tmpvar_30;
|
|
tmpvar_30 = tmpvar_25;
|
|
tmpvar_28[1] = tmpvar_30;
|
|
vec4 tmpvar_31;
|
|
tmpvar_31 = tmpvar_26;
|
|
tmpvar_28[2] = tmpvar_31;
|
|
vec4 tmpvar_32;
|
|
tmpvar_32 = tmpvar_27;
|
|
tmpvar_28[3] = tmpvar_32;
|
|
return tmpvar_28;
|
|
}
|
|
|
|
vec4 frag (
|
|
in v2f_img i_33
|
|
)
|
|
{
|
|
float shadow_34;
|
|
float diff_35;
|
|
float sampleDist_36;
|
|
vec4 sample_37;
|
|
int i_1_38;
|
|
float diffTolerance_39;
|
|
float radius_40;
|
|
float dist_41;
|
|
vec4 mask_42;
|
|
vec4 coord_43;
|
|
int tmpvar_44;
|
|
tmpvar_44 = 0;
|
|
i_1_38 = tmpvar_44;
|
|
vec4 tmpvar_45;
|
|
tmpvar_45.zw = vec2(0.0, 0.0);
|
|
tmpvar_45.xy = i_33.uv.xy;
|
|
vec4 tmpvar_46;
|
|
tmpvar_46 = tmpvar_45;
|
|
coord_43 = tmpvar_46;
|
|
vec4 tmpvar_47;
|
|
tmpvar_47 = texture2D (_MainTex, coord_43.xy);
|
|
vec4 tmpvar_48;
|
|
tmpvar_48 = tmpvar_47;
|
|
mask_42 = tmpvar_48;
|
|
float tmpvar_49;
|
|
tmpvar_49 = (mask_42.z + (mask_42.w / 255.0));
|
|
dist_41 = tmpvar_49;
|
|
float tmpvar_50;
|
|
tmpvar_50 = xll_saturate ((unity_ShadowBlurParams.y / (1.0 - dist_41)));
|
|
float tmpvar_51;
|
|
tmpvar_51 = tmpvar_50;
|
|
radius_40 = tmpvar_51;
|
|
float tmpvar_52;
|
|
tmpvar_52 = unity_ShadowBlurParams.x;
|
|
diffTolerance_39 = tmpvar_52;
|
|
vec2 tmpvar_53;
|
|
tmpvar_53 = (mask_42.xy * diffTolerance_39);
|
|
mask_42.xy = tmpvar_53.xy.xy;
|
|
while (true) {
|
|
if (!((i_1_38 < 8))) {
|
|
break;
|
|
};
|
|
vec4 tmpvar_54;
|
|
tmpvar_54 = texture2D (_MainTex, (coord_43 + (radius_40 * _BlurOffsets[i_1_38])).xy);
|
|
vec4 tmpvar_55;
|
|
tmpvar_55 = tmpvar_54;
|
|
sample_37 = tmpvar_55;
|
|
float tmpvar_56;
|
|
tmpvar_56 = (sample_37.z + (sample_37.w / 255.0));
|
|
sampleDist_36 = tmpvar_56;
|
|
float tmpvar_57;
|
|
tmpvar_57 = (dist_41 - sampleDist_36);
|
|
diff_35 = tmpvar_57;
|
|
float tmpvar_58;
|
|
tmpvar_58 = abs (diff_35);
|
|
float tmpvar_59;
|
|
tmpvar_59 = xll_saturate ((diffTolerance_39 - tmpvar_58));
|
|
float tmpvar_60;
|
|
tmpvar_60 = tmpvar_59;
|
|
diff_35 = tmpvar_60;
|
|
vec2 tmpvar_61;
|
|
tmpvar_61 = (mask_42.xy + (diff_35 * sample_37.xy));
|
|
mask_42.xy = tmpvar_61.xy.xy;
|
|
int _post_incdec_tmp_62;
|
|
_post_incdec_tmp_62 = i_1_38;
|
|
int tmpvar_63;
|
|
tmpvar_63 = (i_1_38 + 1);
|
|
i_1_38 = tmpvar_63;
|
|
};
|
|
float tmpvar_64;
|
|
tmpvar_64 = (mask_42.x / mask_42.y);
|
|
shadow_34 = tmpvar_64;
|
|
vec4 tmpvar_65;
|
|
tmpvar_65 = vec4(shadow_34);
|
|
return tmpvar_65;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_img xlt_i_66;
|
|
vec4 xl_retval_67;
|
|
vec4 tmpvar_68;
|
|
tmpvar_68 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_i_66.pos = tmpvar_68;
|
|
vec2 tmpvar_69;
|
|
tmpvar_69 = gl_TexCoord[0].xy;
|
|
vec2 tmpvar_70;
|
|
tmpvar_70 = tmpvar_69;
|
|
xlt_i_66.uv = tmpvar_70;
|
|
vec4 tmpvar_71;
|
|
tmpvar_71 = frag (xlt_i_66);
|
|
vec4 tmpvar_72;
|
|
tmpvar_72 = tmpvar_71;
|
|
xl_retval_67 = tmpvar_72;
|
|
vec4 tmpvar_73;
|
|
tmpvar_73 = xl_retval_67.xyzw;
|
|
vec4 tmpvar_74;
|
|
tmpvar_74 = tmpvar_73;
|
|
gl_FragData[0] = tmpvar_74;
|
|
}
|
|
|