mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 02:55:36 -05:00
76 lines
1.5 KiB
Text
76 lines
1.5 KiB
Text
|
struct v2f_img {
|
||
|
vec4 pos;
|
||
|
vec2 uv;
|
||
|
};
|
||
|
uniform sampler2D _RampTex;
|
||
|
uniform float _RampOffset;
|
||
|
uniform sampler2D _MainTex;
|
||
|
float Luminance (
|
||
|
in vec3 c_1
|
||
|
)
|
||
|
{
|
||
|
float tmpvar_2;
|
||
|
tmpvar_2 = dot (c_1, vec3(0.22, 0.707, 0.071));
|
||
|
return tmpvar_2;
|
||
|
}
|
||
|
|
||
|
vec4 frag (
|
||
|
in v2f_img i_3
|
||
|
)
|
||
|
{
|
||
|
vec4 xlat_var_output_4;
|
||
|
vec2 remap_5;
|
||
|
float grayscale_6;
|
||
|
vec4 original_7;
|
||
|
vec4 tmpvar_8;
|
||
|
tmpvar_8 = texture2D (_MainTex, i_3.uv);
|
||
|
vec4 tmpvar_9;
|
||
|
tmpvar_9 = tmpvar_8;
|
||
|
original_7 = tmpvar_9;
|
||
|
float tmpvar_10;
|
||
|
tmpvar_10 = Luminance (original_7.xyz);
|
||
|
float tmpvar_11;
|
||
|
tmpvar_11 = tmpvar_10;
|
||
|
grayscale_6 = tmpvar_11;
|
||
|
vec2 tmpvar_12;
|
||
|
tmpvar_12.y = 0.5;
|
||
|
tmpvar_12.x = (grayscale_6 + _RampOffset);
|
||
|
vec2 tmpvar_13;
|
||
|
tmpvar_13 = tmpvar_12;
|
||
|
remap_5 = tmpvar_13;
|
||
|
vec4 tmpvar_14;
|
||
|
tmpvar_14 = texture2D (_RampTex, remap_5);
|
||
|
vec4 tmpvar_15;
|
||
|
tmpvar_15 = tmpvar_14;
|
||
|
xlat_var_output_4 = tmpvar_15;
|
||
|
float tmpvar_16;
|
||
|
tmpvar_16 = original_7.w;
|
||
|
xlat_var_output_4.w = vec4(tmpvar_16).w;
|
||
|
return xlat_var_output_4;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f_img xlt_i_17;
|
||
|
vec4 xl_retval_18;
|
||
|
vec4 tmpvar_19;
|
||
|
tmpvar_19 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_i_17.pos = tmpvar_19;
|
||
|
vec2 tmpvar_20;
|
||
|
tmpvar_20 = gl_TexCoord[0].xy;
|
||
|
vec2 tmpvar_21;
|
||
|
tmpvar_21 = tmpvar_20;
|
||
|
xlt_i_17.uv = tmpvar_21;
|
||
|
vec4 tmpvar_22;
|
||
|
tmpvar_22 = frag (xlt_i_17);
|
||
|
vec4 tmpvar_23;
|
||
|
tmpvar_23 = tmpvar_22;
|
||
|
xl_retval_18 = tmpvar_23;
|
||
|
vec4 tmpvar_24;
|
||
|
tmpvar_24 = xl_retval_18.xyzw;
|
||
|
vec4 tmpvar_25;
|
||
|
tmpvar_25 = tmpvar_24;
|
||
|
gl_FragData[0] = tmpvar_25;
|
||
|
}
|
||
|
|