generateVertexPositions method Null safety

  1. @override
void generateVertexPositions(
  1. Vector3List positions,
  2. Uint16List indices
)
override

Implementation

@override
void generateVertexPositions(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;

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