Fix vertex lighter using stale normal data (#4917)

This commit is contained in:
Ben Staddon 2018-06-20 20:36:10 +01:00 committed by LexManos
parent fa50d98357
commit 7258beeede

View file

@ -121,14 +121,14 @@ public class VertexLighterFlat extends QuadGatheringTransformer
float[][] lightmap = quadData[lightmapIndex];
float[][] color = quadData[colorIndex];
// If all three normal values are either -1 or 0, normals must be generated
if(quadData[normalIndex][0][0] != quadData[normalIndex][0][1] ||
quadData[normalIndex][0][1] != quadData[normalIndex][0][2] ||
(quadData[normalIndex][0][0] != -1 && quadData[normalIndex][0][0] != 0))
if (dataLength[normalIndex] >= 3
&& (quadData[normalIndex][0][0] != -1
|| quadData[normalIndex][0][1] != -1
|| quadData[normalIndex][0][2] != -1))
{
normal = quadData[normalIndex];
}
else
else // normals must be generated
{
normal = new float[4][4];
Vector3f v1 = new Vector3f(position[3]);