generateVertexTexCoords method

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

Implementation

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