Fix model normals being distorted by MODELDEF scaling.

This commit is contained in:
Marisa Kirisame 2020-12-12 00:00:31 +01:00 committed by Christoph Oelckers
parent a02654339b
commit fd07183585

View file

@ -80,13 +80,13 @@ void main()
#ifdef HAS_UNIFORM_VERTEX_DATA #ifdef HAS_UNIFORM_VERTEX_DATA
if ((useVertexData & 2) == 0) if ((useVertexData & 2) == 0)
vWorldNormal = NormalModelMatrix * vec4(uVertexNormal.xyz, 1.0); vWorldNormal = NormalModelMatrix * vec4(normalize(uVertexNormal.xyz), 1.0);
else else
vWorldNormal = NormalModelMatrix * vec4(normalize(mix(aNormal.xyz, aNormal2.xyz, uInterpolationFactor)), 1.0); vWorldNormal = NormalModelMatrix * vec4(normalize(mix(aNormal.xyz, aNormal2.xyz, uInterpolationFactor)), 1.0);
#else #else
vWorldNormal = NormalModelMatrix * vec4(normalize(mix(aNormal.xyz, aNormal2.xyz, uInterpolationFactor)), 1.0); vWorldNormal = NormalModelMatrix * vec4(normalize(mix(aNormal.xyz, aNormal2.xyz, uInterpolationFactor)), 1.0);
#endif #endif
vEyeNormal = NormalViewMatrix * vWorldNormal; vEyeNormal = NormalViewMatrix * vec4(normalize(vWorldNormal.xyz), 1.0);
#endif #endif
#ifdef SPHEREMAP #ifdef SPHEREMAP