generateIndices method Null safety
- Uint16List indices
override
Implementation
@override
void generateIndices(Uint16List indices) {
var i = 0;
// Sides
var base1 = 0;
final base2 = _segments + 1;
for (var x = 0; x < _segments; ++x) {
indices[i++] = base1 + x;
indices[i++] = base1 + x + 1;
indices[i++] = base2 + x;
indices[i++] = base1 + x + 1;
indices[i++] = base2 + x + 1;
indices[i++] = base2 + x;
}
// Top cap
base1 = (_segments + 1) * 2;
for (var x = 1; x < _segments - 1; ++x) {
indices[i++] = base1;
indices[i++] = base1 + x + 1;
indices[i++] = base1 + x;
}
// Bottom cap
base1 = (_segments + 1) * 2 + _segments;
for (var x = 1; x < _segments - 1; ++x) {
indices[i++] = base1;
indices[i++] = base1 + x;
indices[i++] = base1 + x + 1;
}
}