generateVertexPositions method

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

Implementation

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

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

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