computeFlatVertexNormals method

dynamic computeFlatVertexNormals()

Implementation

computeFlatVertexNormals() {
  computeFaceNormals();

  for (var f = 0, fl = faces.length; f < fl; f++) {
    var face = faces[f];

    var vertexNormals = face.vertexNormals;

    if (vertexNormals.length == 3) {
      vertexNormals[0].copy(face.normal);
      vertexNormals[1].copy(face.normal);
      vertexNormals[2].copy(face.normal);
    } else {
      vertexNormals[0] = face.normal.clone();
      vertexNormals[1] = face.normal.clone();
      vertexNormals[2] = face.normal.clone();
    }
  }

  if (faces.isNotEmpty) {
    normalsNeedUpdate = true;
  }
}