16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 03:09:18 +02:00

out of bounds in normals calculation

This commit is contained in:
VB
2017-03-05 22:22:06 +01:00
parent 84f54db12e
commit 6f74ecc439

View File

@@ -206,8 +206,14 @@ void TGroundNode::InitNormals()
}
if (Vertices[i].Normal == vector3(0, 0, 0))
Vertices[i].Normal = (n1 + n2) / 2;
if (Vertices[i + 1].Normal == vector3(0, 0, 0))
Vertices[i + 1].Normal = n2;
if (i + 1 < iNumVerts)
{
if (Vertices[i + 1].Normal == vector3(0, 0, 0))
Vertices[i + 1].Normal = n2;
}
else
WriteLog("odd number of vertices, normals may be wrong!");
break;
case GL_TRIANGLE_FAN: