mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-11 08:41:31 -05:00
97 lines
2.2 KiB
Text
97 lines
2.2 KiB
Text
|
struct v2f {
|
||
|
vec4 pos;
|
||
|
vec2 uv;
|
||
|
vec2 uvg;
|
||
|
vec2 uvs;
|
||
|
};
|
||
|
uniform sampler2D _ScratchTex;
|
||
|
uniform sampler2D _MainTex;
|
||
|
uniform vec4 _Intensity;
|
||
|
uniform sampler2D _GrainTex;
|
||
|
vec4 frag (
|
||
|
in v2f i_1
|
||
|
)
|
||
|
{
|
||
|
vec3 scratch_2;
|
||
|
vec3 grain_3;
|
||
|
vec3 yuv_4;
|
||
|
vec4 col_5;
|
||
|
vec4 tmpvar_6;
|
||
|
tmpvar_6 = texture2D (_MainTex, i_1.uv);
|
||
|
vec4 tmpvar_7;
|
||
|
tmpvar_7 = tmpvar_6;
|
||
|
col_5 = tmpvar_7;
|
||
|
float tmpvar_8;
|
||
|
tmpvar_8 = dot (col_5.xyz, vec3(0.299, 0.587, 0.114));
|
||
|
float tmpvar_9;
|
||
|
tmpvar_9 = tmpvar_8;
|
||
|
yuv_4.x = tmpvar_9;
|
||
|
float tmpvar_10;
|
||
|
tmpvar_10 = ((col_5.z - yuv_4.x) * 0.492);
|
||
|
yuv_4.y = vec2(tmpvar_10).y;
|
||
|
float tmpvar_11;
|
||
|
tmpvar_11 = ((col_5.x - yuv_4.x) * 0.877);
|
||
|
yuv_4.z = vec3(tmpvar_11).z;
|
||
|
vec4 tmpvar_12;
|
||
|
tmpvar_12 = texture2D (_GrainTex, i_1.uvg);
|
||
|
vec3 tmpvar_13;
|
||
|
tmpvar_13 = ((tmpvar_12.xyz * 2.0) - 1.0);
|
||
|
grain_3 = tmpvar_13;
|
||
|
vec3 tmpvar_14;
|
||
|
tmpvar_14 = (yuv_4.xyz + (grain_3 * _Intensity.x));
|
||
|
yuv_4 = tmpvar_14.xyz.xyz;
|
||
|
float tmpvar_15;
|
||
|
tmpvar_15 = ((yuv_4.z * 1.14) + yuv_4.x);
|
||
|
col_5.x = tmpvar_15;
|
||
|
float tmpvar_16;
|
||
|
tmpvar_16 = (((yuv_4.z * -(0.581)) + (yuv_4.y * -(0.395))) + yuv_4.x);
|
||
|
col_5.y = vec2(tmpvar_16).y;
|
||
|
float tmpvar_17;
|
||
|
tmpvar_17 = ((yuv_4.y * 2.032) + yuv_4.x);
|
||
|
col_5.z = vec3(tmpvar_17).z;
|
||
|
vec4 tmpvar_18;
|
||
|
tmpvar_18 = texture2D (_ScratchTex, i_1.uvs);
|
||
|
vec3 tmpvar_19;
|
||
|
tmpvar_19 = ((tmpvar_18.xyz * 2.0) - 1.0);
|
||
|
scratch_2 = tmpvar_19;
|
||
|
vec3 tmpvar_20;
|
||
|
tmpvar_20 = (col_5.xyz + (scratch_2 * _Intensity.y));
|
||
|
col_5.xyz = tmpvar_20.xyz.xyz;
|
||
|
return col_5;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f xlt_i_21;
|
||
|
vec4 xl_retval_22;
|
||
|
vec4 tmpvar_23;
|
||
|
tmpvar_23 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_i_21.pos = tmpvar_23;
|
||
|
vec2 tmpvar_24;
|
||
|
tmpvar_24 = gl_TexCoord[0].xy;
|
||
|
vec2 tmpvar_25;
|
||
|
tmpvar_25 = tmpvar_24;
|
||
|
xlt_i_21.uv = tmpvar_25;
|
||
|
vec2 tmpvar_26;
|
||
|
tmpvar_26 = gl_TexCoord[1].xy;
|
||
|
vec2 tmpvar_27;
|
||
|
tmpvar_27 = tmpvar_26;
|
||
|
xlt_i_21.uvg = tmpvar_27;
|
||
|
vec2 tmpvar_28;
|
||
|
tmpvar_28 = gl_TexCoord[2].xy;
|
||
|
vec2 tmpvar_29;
|
||
|
tmpvar_29 = tmpvar_28;
|
||
|
xlt_i_21.uvs = tmpvar_29;
|
||
|
vec4 tmpvar_30;
|
||
|
tmpvar_30 = frag (xlt_i_21);
|
||
|
vec4 tmpvar_31;
|
||
|
tmpvar_31 = tmpvar_30;
|
||
|
xl_retval_22 = tmpvar_31;
|
||
|
vec4 tmpvar_32;
|
||
|
tmpvar_32 = xl_retval_22.xyzw;
|
||
|
vec4 tmpvar_33;
|
||
|
tmpvar_33 = tmpvar_32;
|
||
|
gl_FragData[0] = tmpvar_33;
|
||
|
}
|
||
|
|