summaryrefslogtreecommitdiffstats
path: root/res/effectlib/funcsampleNormalTexture.glsllib
blob: 552112a952eabd4b7f48216c49362b3e33c6be9e (plain)
1
2
3
4
5
6
vec3 sampleNormalTexture(in sampler2D sampler, in float factor, in vec2 texCoord, in vec3 tangent,
                         in vec3 binormal, in vec3 normal)
{
    vec3 tsNormal = 2.0 * texture(sampler, texCoord).xyz - 1.0;
    return mix(normal, normalize(tsNormal.x * tangent - tsNormal.y * binormal + tsNormal.z * normal), factor);
}