mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
18 lines
515 B
Text
18 lines
515 B
Text
uniform sampler2D _BumpMap;
|
|
void main ()
|
|
{
|
|
vec4 res;
|
|
vec3 viewN;
|
|
vec4 normal;
|
|
normal.xy = ((texture2D (_BumpMap, gl_TexCoord[0].xy).wy * 2.0) - 1.0);
|
|
normal.z = sqrt (((1.0 - (normal.x * normal.x)) - (normal.y * normal.y)));
|
|
vec3 tmpvar_1;
|
|
tmpvar_1 = normal.xyz;
|
|
viewN.x = dot (gl_TexCoord[1].xyz, tmpvar_1);
|
|
viewN.y = dot (gl_TexCoord[2].xyz, tmpvar_1);
|
|
viewN.z = dot (gl_TexCoord[3].xyz, tmpvar_1);
|
|
res.xyz = ((viewN * vec3(0.5, 0.5, -0.5)) + 0.5);
|
|
res.w = 0.0;
|
|
gl_FragData[0] = res;
|
|
}
|
|
|