generateVertexTexCoords method Null safety

  1. @override
void generateVertexTexCoords(
  1. Vector2List texCoords,
  2. Vector3List positions,
  3. Uint16List indices
)
override

Implementation

@override
void generateVertexTexCoords(
    Vector2List texCoords, Vector3List positions, Uint16List indices) {
  final v = Vector2(0.5, 0.5);
  texCoords[0] = v;
  var index = 1;
  for (var i = 0; i <= _segments; i++) {
    final position = positions[index];
    final x = (position.x / (_radius + 1.0)) * 0.5;
    final y = (position.z / (_radius + 1.0)) * 0.5;
    v
      ..x = x + 0.5
      ..y = y + 0.5;
    texCoords[index] = v;
    index++;
  }
  assert(index == vertexCount);
}