final IndexMode indexMode = shape.getMeshData().getIndexMode(0);
final int shapeVertices = shapeBuffer.limit() / 3;
final Vector3 vector = new Vector3();
final Vector3 direction = new Vector3();
final Quaternion rotation = new Quaternion();
for (int i = 0; i < path.size(); i++) {
final ReadOnlyVector3 point = path.get(i);
shapeBuffer.rewind();
if (shapeNormalBuffer != null) {
shapeNormalBuffer.rewind();
}
int shapeVertice = 0;
do {
final ReadOnlyVector3 nextPoint = i < path.size() - 1 ? path.get(i + 1) : closed ? path.get(0) : null;
final ReadOnlyVector3 lastPoint = i > 0 ? path.get(i - 1) : null;
if (nextPoint != null) {
direction.set(nextPoint).subtractLocal(point);
} else {
direction.set(point).subtractLocal(lastPoint);
}
rotation.lookAt(direction, up);
if (shapeNormalBuffer != null && normals != null) {
vector.set(shapeNormalBuffer.get(), shapeNormalBuffer.get(), shapeNormalBuffer.get());
rotation.apply(vector, vector);
normals.put(vector.getXf());
normals.put(vector.getYf());
normals.put(vector.getZf());
}
vector.set(shapeBuffer.get(), shapeBuffer.get(), shapeBuffer.get());
rotation.apply(vector, vector);
vector.addLocal(point);
vertices.put(vector.getXf());
vertices.put(vector.getYf());
vertices.put(vector.getZf());