updateNormals method

void updateNormals()

Compute the normals of the faces. Will save in the .normals array.

Implementation

void updateNormals() {
  // Generate normals
  //final normals = faceNormals;
  faceNormals = [];
  final n = _computeNormalsN;
  for (int i = 0; i < indices.length / 3; i++) {
    final i3 = i * 3;

    final a = indices[i3];
    final b = indices[i3 + 1];
    final c = indices[i3 + 2];

    getVertex(a, _va);
    getVertex(b, _vb);
    getVertex(c, _vc);

    Trimesh.computeNormal(_vb, _va, _vc, n);
    faceNormals.addAll([n.x,n.y,n.z]);
  }
}