mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 02:55:36 -05:00
279 lines
8.5 KiB
Text
279 lines
8.5 KiB
Text
#extension GL_ARB_shader_texture_lod : enable
|
|
varying vec2 xlv_TEXCOORD0;
|
|
uniform vec4 _MainTex_TexelSize;
|
|
uniform sampler2D _MainTex;
|
|
void main ()
|
|
{
|
|
vec3 tmpvar_1;
|
|
int i;
|
|
bool doneP;
|
|
bool doneN;
|
|
float lumaEndP;
|
|
float lumaEndN;
|
|
vec2 offNP;
|
|
vec2 posP;
|
|
vec2 posN;
|
|
float gradientN;
|
|
float lengthSign;
|
|
float lumaS;
|
|
float lumaN;
|
|
doneN = bool(0);
|
|
doneP = bool(0);
|
|
i = 0;
|
|
vec4 tmpvar_2;
|
|
tmpvar_2.zw = vec2(0.0, 0.0);
|
|
tmpvar_2.xy = (xlv_TEXCOORD0 + (vec2(0.0, -1.0) * _MainTex_TexelSize.xy));
|
|
vec4 tmpvar_3;
|
|
tmpvar_3 = texture2DLod (_MainTex, tmpvar_2.xy, 0.0);
|
|
vec4 tmpvar_4;
|
|
tmpvar_4.zw = vec2(0.0, 0.0);
|
|
tmpvar_4.xy = (xlv_TEXCOORD0 + (vec2(-1.0, 0.0) * _MainTex_TexelSize.xy));
|
|
vec4 tmpvar_5;
|
|
tmpvar_5 = texture2DLod (_MainTex, tmpvar_4.xy, 0.0);
|
|
vec4 tmpvar_6;
|
|
tmpvar_6.zw = vec2(0.0, 0.0);
|
|
tmpvar_6.xy = xlv_TEXCOORD0;
|
|
vec4 tmpvar_7;
|
|
tmpvar_7 = texture2DLod (_MainTex, tmpvar_6.xy, 0.0);
|
|
vec4 tmpvar_8;
|
|
tmpvar_8.zw = vec2(0.0, 0.0);
|
|
tmpvar_8.xy = (xlv_TEXCOORD0 + (vec2(1.0, 0.0) * _MainTex_TexelSize.xy));
|
|
vec4 tmpvar_9;
|
|
tmpvar_9 = texture2DLod (_MainTex, tmpvar_8.xy, 0.0);
|
|
vec4 tmpvar_10;
|
|
tmpvar_10.zw = vec2(0.0, 0.0);
|
|
tmpvar_10.xy = (xlv_TEXCOORD0 + (vec2(0.0, 1.0) * _MainTex_TexelSize.xy));
|
|
vec4 tmpvar_11;
|
|
tmpvar_11 = texture2DLod (_MainTex, tmpvar_10.xy, 0.0);
|
|
float tmpvar_12;
|
|
tmpvar_12 = ((tmpvar_3.y * 1.96321) + tmpvar_3.x);
|
|
lumaN = tmpvar_12;
|
|
float tmpvar_13;
|
|
tmpvar_13 = ((tmpvar_5.y * 1.96321) + tmpvar_5.x);
|
|
float tmpvar_14;
|
|
tmpvar_14 = ((tmpvar_7.y * 1.96321) + tmpvar_7.x);
|
|
float tmpvar_15;
|
|
tmpvar_15 = ((tmpvar_9.y * 1.96321) + tmpvar_9.x);
|
|
float tmpvar_16;
|
|
tmpvar_16 = ((tmpvar_11.y * 1.96321) + tmpvar_11.x);
|
|
lumaS = tmpvar_16;
|
|
float tmpvar_17;
|
|
tmpvar_17 = max (tmpvar_14, max (max (tmpvar_12, tmpvar_13), max (tmpvar_16, tmpvar_15)));
|
|
float tmpvar_18;
|
|
tmpvar_18 = (tmpvar_17 - min (tmpvar_14, min (min (tmpvar_12, tmpvar_13), min (tmpvar_16, tmpvar_15))));
|
|
float tmpvar_19;
|
|
tmpvar_19 = max (0.0625, (tmpvar_17 * 0.125));
|
|
if ((tmpvar_18 < tmpvar_19)) {
|
|
tmpvar_1 = tmpvar_7.xyz;
|
|
} else {
|
|
float tmpvar_20;
|
|
tmpvar_20 = min (0.75, (max (0.0, ((abs ((((((tmpvar_12 + tmpvar_13) + tmpvar_15) + tmpvar_16) * 0.25) - tmpvar_14)) / tmpvar_18) - 0.25)) * 1.33333));
|
|
vec4 tmpvar_21;
|
|
tmpvar_21.zw = vec2(0.0, 0.0);
|
|
tmpvar_21.xy = (xlv_TEXCOORD0 + (vec2(-1.0, -1.0) * _MainTex_TexelSize.xy));
|
|
vec4 tmpvar_22;
|
|
tmpvar_22 = texture2DLod (_MainTex, tmpvar_21.xy, 0.0);
|
|
vec4 tmpvar_23;
|
|
tmpvar_23.zw = vec2(0.0, 0.0);
|
|
tmpvar_23.xy = (xlv_TEXCOORD0 + (vec2(1.0, -1.0) * _MainTex_TexelSize.xy));
|
|
vec4 tmpvar_24;
|
|
tmpvar_24 = texture2DLod (_MainTex, tmpvar_23.xy, 0.0);
|
|
vec4 tmpvar_25;
|
|
tmpvar_25.zw = vec2(0.0, 0.0);
|
|
tmpvar_25.xy = (xlv_TEXCOORD0 + (vec2(-1.0, 1.0) * _MainTex_TexelSize.xy));
|
|
vec4 tmpvar_26;
|
|
tmpvar_26 = texture2DLod (_MainTex, tmpvar_25.xy, 0.0);
|
|
vec4 tmpvar_27;
|
|
tmpvar_27.zw = vec2(0.0, 0.0);
|
|
tmpvar_27.xy = (xlv_TEXCOORD0 + _MainTex_TexelSize.xy);
|
|
vec4 tmpvar_28;
|
|
tmpvar_28 = texture2DLod (_MainTex, tmpvar_27.xy, 0.0);
|
|
vec3 tmpvar_29;
|
|
tmpvar_29 = ((((((tmpvar_3.xyz + tmpvar_5.xyz) + tmpvar_7.xyz) + tmpvar_9.xyz) + tmpvar_11.xyz) + (((tmpvar_22.xyz + tmpvar_24.xyz) + tmpvar_26.xyz) + tmpvar_28.xyz)) * vec3(0.111111, 0.111111, 0.111111));
|
|
float tmpvar_30;
|
|
tmpvar_30 = ((tmpvar_22.y * 1.96321) + tmpvar_22.x);
|
|
float tmpvar_31;
|
|
tmpvar_31 = ((tmpvar_24.y * 1.96321) + tmpvar_24.x);
|
|
float tmpvar_32;
|
|
tmpvar_32 = ((tmpvar_26.y * 1.96321) + tmpvar_26.x);
|
|
float tmpvar_33;
|
|
tmpvar_33 = ((tmpvar_28.y * 1.96321) + tmpvar_28.x);
|
|
bool tmpvar_34;
|
|
tmpvar_34 = (((abs ((((0.25 * tmpvar_30) + (-(0.5) * tmpvar_13)) + (0.25 * tmpvar_32))) + abs ((((0.5 * tmpvar_12) + (-(1.0) * tmpvar_14)) + (0.5 * tmpvar_16)))) + abs ((((0.25 * tmpvar_31) + (-(0.5) * tmpvar_15)) + (0.25 * tmpvar_33)))) >= ((abs ((((0.25 * tmpvar_30) + (-(0.5) * tmpvar_12)) + (0.25 * tmpvar_31))) + abs ((((0.5 * tmpvar_13) + (-(1.0) * tmpvar_14)) + (0.5 * tmpvar_15)))) + abs ((((0.25 * tmpvar_32) + (-(0.5) * tmpvar_16)) + (0.25 * tmpvar_33)))));
|
|
float tmpvar_35;
|
|
if (tmpvar_34) {
|
|
tmpvar_35 = -(_MainTex_TexelSize.y);
|
|
} else {
|
|
tmpvar_35 = -(_MainTex_TexelSize.x);
|
|
};
|
|
lengthSign = tmpvar_35;
|
|
if (!(tmpvar_34)) {
|
|
lumaN = tmpvar_13;
|
|
};
|
|
if (!(tmpvar_34)) {
|
|
lumaS = tmpvar_15;
|
|
};
|
|
float tmpvar_36;
|
|
tmpvar_36 = abs ((lumaN - tmpvar_14));
|
|
gradientN = tmpvar_36;
|
|
float tmpvar_37;
|
|
tmpvar_37 = abs ((lumaS - tmpvar_14));
|
|
lumaN = ((lumaN + tmpvar_14) * 0.5);
|
|
float tmpvar_38;
|
|
tmpvar_38 = ((lumaS + tmpvar_14) * 0.5);
|
|
lumaS = tmpvar_38;
|
|
bool tmpvar_39;
|
|
tmpvar_39 = (tmpvar_36 >= tmpvar_37);
|
|
if (!(tmpvar_39)) {
|
|
lumaN = tmpvar_38;
|
|
};
|
|
if (!(tmpvar_39)) {
|
|
gradientN = tmpvar_37;
|
|
};
|
|
if (!(tmpvar_39)) {
|
|
lengthSign = (tmpvar_35 * -1.0);
|
|
};
|
|
float tmpvar_40;
|
|
if (tmpvar_34) {
|
|
tmpvar_40 = 0.0;
|
|
} else {
|
|
tmpvar_40 = (lengthSign * 0.5);
|
|
};
|
|
posN.x = (xlv_TEXCOORD0.x + tmpvar_40);
|
|
float tmpvar_41;
|
|
if (tmpvar_34) {
|
|
tmpvar_41 = (lengthSign * 0.5);
|
|
} else {
|
|
tmpvar_41 = 0.0;
|
|
};
|
|
posN.y = (xlv_TEXCOORD0.y + tmpvar_41);
|
|
gradientN = (gradientN * 0.25);
|
|
posP = posN;
|
|
vec2 tmpvar_42;
|
|
if (tmpvar_34) {
|
|
vec2 tmpvar_43;
|
|
tmpvar_43.y = 0.0;
|
|
tmpvar_43.x = _MainTex_TexelSize.x;
|
|
tmpvar_42 = tmpvar_43;
|
|
} else {
|
|
vec2 tmpvar_44;
|
|
tmpvar_44.x = 0.0;
|
|
tmpvar_44.y = _MainTex_TexelSize.y;
|
|
tmpvar_42 = tmpvar_44;
|
|
};
|
|
lumaEndN = lumaN;
|
|
lumaEndP = lumaN;
|
|
posN = (posN + (tmpvar_42 * vec2(-2.0, -2.0)));
|
|
posP = (posP + (tmpvar_42 * vec2(2.0, 2.0)));
|
|
offNP = (tmpvar_42 * vec2(3.0, 3.0));
|
|
while (true) {
|
|
if ((i >= 4)) {
|
|
break;
|
|
};
|
|
if (!(doneN)) {
|
|
vec4 tmpvar_45;
|
|
tmpvar_45 = texture2DGradARB (_MainTex, posN, offNP, offNP);
|
|
lumaEndN = ((tmpvar_45.y * 1.96321) + tmpvar_45.x);
|
|
};
|
|
if (!(doneP)) {
|
|
vec4 tmpvar_46;
|
|
tmpvar_46 = texture2DGradARB (_MainTex, posP, offNP, offNP);
|
|
lumaEndP = ((tmpvar_46.y * 1.96321) + tmpvar_46.x);
|
|
};
|
|
bool tmpvar_47;
|
|
if (doneN) {
|
|
tmpvar_47 = bool(1);
|
|
} else {
|
|
tmpvar_47 = (abs ((lumaEndN - lumaN)) >= gradientN);
|
|
};
|
|
doneN = tmpvar_47;
|
|
bool tmpvar_48;
|
|
if (doneP) {
|
|
tmpvar_48 = bool(1);
|
|
} else {
|
|
tmpvar_48 = (abs ((lumaEndP - lumaN)) >= gradientN);
|
|
};
|
|
doneP = tmpvar_48;
|
|
bool tmpvar_49;
|
|
if (tmpvar_47) {
|
|
tmpvar_49 = tmpvar_48;
|
|
} else {
|
|
tmpvar_49 = bool(0);
|
|
};
|
|
if (tmpvar_49) {
|
|
break;
|
|
};
|
|
if (!(tmpvar_47)) {
|
|
posN = (posN - offNP);
|
|
};
|
|
if (!(tmpvar_48)) {
|
|
posP = (posP + offNP);
|
|
};
|
|
i = (i + 1);
|
|
};
|
|
float tmpvar_50;
|
|
if (tmpvar_34) {
|
|
tmpvar_50 = (xlv_TEXCOORD0.x - posN.x);
|
|
} else {
|
|
tmpvar_50 = (xlv_TEXCOORD0.y - posN.y);
|
|
};
|
|
float tmpvar_51;
|
|
if (tmpvar_34) {
|
|
tmpvar_51 = (posP.x - xlv_TEXCOORD0.x);
|
|
} else {
|
|
tmpvar_51 = (posP.y - xlv_TEXCOORD0.y);
|
|
};
|
|
bool tmpvar_52;
|
|
tmpvar_52 = (tmpvar_50 < tmpvar_51);
|
|
float tmpvar_53;
|
|
if (tmpvar_52) {
|
|
tmpvar_53 = lumaEndN;
|
|
} else {
|
|
tmpvar_53 = lumaEndP;
|
|
};
|
|
lumaEndN = tmpvar_53;
|
|
if ((((tmpvar_14 - lumaN) < 0.0) == ((tmpvar_53 - lumaN) < 0.0))) {
|
|
lengthSign = 0.0;
|
|
};
|
|
float tmpvar_54;
|
|
tmpvar_54 = (tmpvar_51 + tmpvar_50);
|
|
float tmpvar_55;
|
|
if (tmpvar_52) {
|
|
tmpvar_55 = tmpvar_50;
|
|
} else {
|
|
tmpvar_55 = tmpvar_51;
|
|
};
|
|
float tmpvar_56;
|
|
tmpvar_56 = ((0.5 + (tmpvar_55 * (-1.0 / tmpvar_54))) * lengthSign);
|
|
float tmpvar_57;
|
|
if (tmpvar_34) {
|
|
tmpvar_57 = 0.0;
|
|
} else {
|
|
tmpvar_57 = tmpvar_56;
|
|
};
|
|
float tmpvar_58;
|
|
if (tmpvar_34) {
|
|
tmpvar_58 = tmpvar_56;
|
|
} else {
|
|
tmpvar_58 = 0.0;
|
|
};
|
|
vec2 tmpvar_59;
|
|
tmpvar_59.x = (xlv_TEXCOORD0.x + tmpvar_57);
|
|
tmpvar_59.y = (xlv_TEXCOORD0.y + tmpvar_58);
|
|
vec4 tmpvar_60;
|
|
tmpvar_60.zw = vec2(0.0, 0.0);
|
|
tmpvar_60.xy = tmpvar_59;
|
|
vec4 tmpvar_61;
|
|
tmpvar_61 = texture2DLod (_MainTex, tmpvar_60.xy, 0.0);
|
|
vec3 tmpvar_62;
|
|
tmpvar_62.x = -(tmpvar_20);
|
|
tmpvar_62.y = -(tmpvar_20);
|
|
tmpvar_62.z = -(tmpvar_20);
|
|
tmpvar_1 = ((tmpvar_62 * tmpvar_61.xyz) + ((tmpvar_29 * vec3(tmpvar_20)) + tmpvar_61.xyz));
|
|
};
|
|
vec4 tmpvar_63;
|
|
tmpvar_63.w = 0.0;
|
|
tmpvar_63.xyz = tmpvar_1;
|
|
gl_FragData[0] = tmpvar_63;
|
|
}
|
|
|