}
private static void createCaps(Vertex[][] segments, double circ, double halfLength) {
Vertex[] refCrossSection = createUnitCrossSection(0, 0, halfLength, 16, 0);
Vertex center = new Vertex(new Vector3d(0, 0, halfLength), new Vector3f(0, 0, 1), new Vector2f(0.5f, 0.5f));
Vertex[] refCoords = new Vertex[refCrossSection.length * 4];
int index = 0;
for (int i = 0; i < refCrossSection.length; i++) {
refCoords[index] = new Vertex(center);
refCoords[index + 1] = new Vertex(refCrossSection[i]);
int next = i + 1;
if(next >= refCrossSection.length - 1) {
next = 0;
}
refCoords[index + 2] = new Vertex(refCrossSection[next]);
refCoords[index + 3] = new Vertex(center);
index += 4;
}
createSegmentsForDirections(segments, circ, halfLength, refCoords);