generateVertexPositions method
- @override
override
Implementation
@override
void generateVertexPositions(Vector3List positions, Uint16List indices) {
int i = 0;
// Top
for (int x = 0; x <= _segments; ++x) {
final double u = x / _segments;
positions[i++] = new Vector3(_topRadius * math.cos(u * math.pi * 2.0),
_height * 0.5, _topRadius * math.sin(u * math.pi * 2.0));
}
// Bottom
for (int x = 0; x <= _segments; ++x) {
final double u = x / _segments;
positions[i++] = new Vector3(_bottomRadius * math.cos(u * math.pi * 2.0),
_height * -0.5, _bottomRadius * math.sin(u * math.pi * 2.0));
}
// Top cap
for (int x = 0; x < _segments; ++x) {
final double u = x / _segments;
positions[i++] = new Vector3(_topRadius * math.cos(u * math.pi * 2.0),
_height * 0.5, _topRadius * math.sin(u * math.pi * 2.0));
}
// Bottom cap
for (int x = 0; x < _segments; ++x) {
final double u = x / _segments;
positions[i++] = new Vector3(_bottomRadius * math.cos(u * math.pi * 2.0),
_height * -0.5, _bottomRadius * math.sin(u * math.pi * 2.0));
}
}