mirror of https://github.com/OpenMW/openmw.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
418 B
Plaintext
15 lines
418 B
Plaintext
1 year ago
|
varying mat3 normalToViewMatrix;
|
||
|
|
||
|
mat3 generateTangentSpace(vec4 tangent, vec3 normal)
|
||
|
{
|
||
|
vec3 normalizedNormal = normalize(normal);
|
||
|
vec3 normalizedTangent = normalize(tangent.xyz);
|
||
|
vec3 binormal = cross(normalizedTangent, normalizedNormal) * tangent.w;
|
||
|
return mat3(normalizedTangent, binormal, normalizedNormal);
|
||
|
}
|
||
|
|
||
|
vec3 normalToView(vec3 normal)
|
||
|
{
|
||
|
return normalize(normalToViewMatrix * normal);
|
||
|
}
|