mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 02:55:36 -05:00
96 lines
2.1 KiB
Text
96 lines
2.1 KiB
Text
|
struct v2f {
|
||
|
vec4 vertex;
|
||
|
vec4 uvgrab;
|
||
|
vec2 uvbump;
|
||
|
vec2 uvmain;
|
||
|
};
|
||
|
uniform sampler2D _MainTex;
|
||
|
uniform vec4 _GrabTexture_TexelSize;
|
||
|
uniform sampler2D _GrabTexture;
|
||
|
uniform sampler2D _BumpMap;
|
||
|
uniform float _BumpAmt;
|
||
|
vec4 UnpackNormal (
|
||
|
in vec4 packednormal_1
|
||
|
)
|
||
|
{
|
||
|
vec4 normal_2;
|
||
|
vec2 tmpvar_3;
|
||
|
tmpvar_3 = ((packednormal_1.wy * 2.0) - 1.0);
|
||
|
normal_2.xy = tmpvar_3.xy.xy;
|
||
|
float tmpvar_4;
|
||
|
tmpvar_4 = sqrt (((1.0 - (normal_2.x * normal_2.x)) - (normal_2.y * normal_2.y)));
|
||
|
float tmpvar_5;
|
||
|
tmpvar_5 = tmpvar_4;
|
||
|
normal_2.z = vec3(tmpvar_5).z;
|
||
|
return normal_2;
|
||
|
}
|
||
|
|
||
|
vec4 frag (
|
||
|
in v2f i_6
|
||
|
)
|
||
|
{
|
||
|
vec4 tint_7;
|
||
|
vec4 col_8;
|
||
|
vec2 offset_9;
|
||
|
vec2 bump_10;
|
||
|
vec4 tmpvar_11;
|
||
|
tmpvar_11 = texture2D (_BumpMap, i_6.uvbump);
|
||
|
vec4 tmpvar_12;
|
||
|
tmpvar_12 = UnpackNormal (tmpvar_11);
|
||
|
vec2 tmpvar_13;
|
||
|
tmpvar_13 = tmpvar_12.xy;
|
||
|
bump_10 = tmpvar_13;
|
||
|
vec2 tmpvar_14;
|
||
|
tmpvar_14 = ((bump_10 * _BumpAmt) * _GrabTexture_TexelSize.xy);
|
||
|
offset_9 = tmpvar_14;
|
||
|
vec2 tmpvar_15;
|
||
|
tmpvar_15 = ((offset_9 * i_6.uvgrab.z) + i_6.uvgrab.xy);
|
||
|
i_6.uvgrab.xy = tmpvar_15.xy.xy;
|
||
|
vec4 tmpvar_16;
|
||
|
tmpvar_16 = texture2DProj (_GrabTexture, i_6.uvgrab);
|
||
|
vec4 tmpvar_17;
|
||
|
tmpvar_17 = tmpvar_16;
|
||
|
col_8 = tmpvar_17;
|
||
|
vec4 tmpvar_18;
|
||
|
tmpvar_18 = texture2D (_MainTex, i_6.uvmain);
|
||
|
vec4 tmpvar_19;
|
||
|
tmpvar_19 = tmpvar_18;
|
||
|
tint_7 = tmpvar_19;
|
||
|
return (col_8 * tint_7);
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f xlt_i_20;
|
||
|
vec4 xl_retval_21;
|
||
|
vec4 tmpvar_22;
|
||
|
tmpvar_22 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_i_20.vertex = tmpvar_22;
|
||
|
vec4 tmpvar_23;
|
||
|
tmpvar_23 = gl_TexCoord[0].xyzw;
|
||
|
vec4 tmpvar_24;
|
||
|
tmpvar_24 = tmpvar_23;
|
||
|
xlt_i_20.uvgrab = tmpvar_24;
|
||
|
vec2 tmpvar_25;
|
||
|
tmpvar_25 = gl_TexCoord[1].xy;
|
||
|
vec2 tmpvar_26;
|
||
|
tmpvar_26 = tmpvar_25;
|
||
|
xlt_i_20.uvbump = tmpvar_26;
|
||
|
vec2 tmpvar_27;
|
||
|
tmpvar_27 = gl_TexCoord[2].xy;
|
||
|
vec2 tmpvar_28;
|
||
|
tmpvar_28 = tmpvar_27;
|
||
|
xlt_i_20.uvmain = tmpvar_28;
|
||
|
vec4 tmpvar_29;
|
||
|
tmpvar_29 = frag (xlt_i_20);
|
||
|
vec4 tmpvar_30;
|
||
|
tmpvar_30 = tmpvar_29;
|
||
|
xl_retval_21 = tmpvar_30;
|
||
|
vec4 tmpvar_31;
|
||
|
tmpvar_31 = xl_retval_21.xyzw;
|
||
|
vec4 tmpvar_32;
|
||
|
tmpvar_32 = tmpvar_31;
|
||
|
gl_FragData[0] = tmpvar_32;
|
||
|
}
|
||
|
|