mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
96 lines
2 KiB
Text
96 lines
2 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
|
||
|
)
|
||
|
{
|
||
|
vec4 normal;
|
||
|
vec2 tmpvar_1;
|
||
|
tmpvar_1 = ((packednormal.wy * 2.0) - 1.0);
|
||
|
normal.xy = tmpvar_1.xy.xy;
|
||
|
float tmpvar_2;
|
||
|
tmpvar_2 = sqrt (((1.0 - (normal.x * normal.x)) - (normal.y * normal.y)));
|
||
|
float tmpvar_3;
|
||
|
tmpvar_3 = tmpvar_2;
|
||
|
normal.z = vec3(tmpvar_3).z;
|
||
|
return normal;
|
||
|
}
|
||
|
|
||
|
vec4 frag (
|
||
|
in v2f i
|
||
|
)
|
||
|
{
|
||
|
vec4 tint;
|
||
|
vec4 col;
|
||
|
vec2 offset;
|
||
|
vec2 bump;
|
||
|
vec4 tmpvar_1;
|
||
|
tmpvar_1 = texture2D (_BumpMap, i.uvbump);
|
||
|
vec4 tmpvar_2;
|
||
|
tmpvar_2 = UnpackNormal (tmpvar_1);
|
||
|
vec2 tmpvar_3;
|
||
|
tmpvar_3 = tmpvar_2.xy;
|
||
|
bump = tmpvar_3;
|
||
|
vec2 tmpvar_4;
|
||
|
tmpvar_4 = ((bump * _BumpAmt) * _GrabTexture_TexelSize.xy);
|
||
|
offset = tmpvar_4;
|
||
|
vec2 tmpvar_5;
|
||
|
tmpvar_5 = ((offset * i.uvgrab.z) + i.uvgrab.xy);
|
||
|
i.uvgrab.xy = tmpvar_5.xy.xy;
|
||
|
vec4 tmpvar_6;
|
||
|
tmpvar_6 = texture2DProj (_GrabTexture, i.uvgrab);
|
||
|
vec4 tmpvar_7;
|
||
|
tmpvar_7 = tmpvar_6;
|
||
|
col = tmpvar_7;
|
||
|
vec4 tmpvar_8;
|
||
|
tmpvar_8 = texture2D (_MainTex, i.uvmain);
|
||
|
vec4 tmpvar_9;
|
||
|
tmpvar_9 = tmpvar_8;
|
||
|
tint = tmpvar_9;
|
||
|
return (col * tint);
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f xlt_i;
|
||
|
vec4 xl_retval;
|
||
|
vec4 tmpvar_1;
|
||
|
tmpvar_1 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_i.vertex = tmpvar_1;
|
||
|
vec4 tmpvar_2;
|
||
|
tmpvar_2 = gl_TexCoord[0].xyzw;
|
||
|
vec4 tmpvar_3;
|
||
|
tmpvar_3 = tmpvar_2;
|
||
|
xlt_i.uvgrab = tmpvar_3;
|
||
|
vec2 tmpvar_4;
|
||
|
tmpvar_4 = gl_TexCoord[1].xy;
|
||
|
vec2 tmpvar_5;
|
||
|
tmpvar_5 = tmpvar_4;
|
||
|
xlt_i.uvbump = tmpvar_5;
|
||
|
vec2 tmpvar_6;
|
||
|
tmpvar_6 = gl_TexCoord[2].xy;
|
||
|
vec2 tmpvar_7;
|
||
|
tmpvar_7 = tmpvar_6;
|
||
|
xlt_i.uvmain = tmpvar_7;
|
||
|
vec4 tmpvar_8;
|
||
|
tmpvar_8 = frag (xlt_i);
|
||
|
vec4 tmpvar_9;
|
||
|
tmpvar_9 = tmpvar_8;
|
||
|
xl_retval = tmpvar_9;
|
||
|
vec4 tmpvar_10;
|
||
|
tmpvar_10 = xl_retval.xyzw;
|
||
|
vec4 tmpvar_11;
|
||
|
tmpvar_11 = tmpvar_10;
|
||
|
gl_FragData[0] = tmpvar_11;
|
||
|
}
|
||
|
|