generateVertexNormals method

  1. @override
void generateVertexNormals(
  1. Vector3List normals,
  2. Vector3List positions,
  3. Uint16List indices
)
override

Implementation

@override
void generateVertexNormals(
    Vector3List normals, Vector3List positions, Uint16List indices) {
  var i = 0;
  for (var y = 0; y <= _latSegments; ++y) {
    final v = y / _latSegments;
    final sv = math.sin(v * math.pi);
    final cv = math.cos(v * math.pi);

    for (var x = 0; x <= _lonSegments; ++x) {
      final u = x / _lonSegments;

      normals[i++] = Vector3(math.cos(u * math.pi * 2.0) * sv, cv,
          math.sin(u * math.pi * 2.0) * sv);
    }
  }
}