As you know, Egon, I'm writing that JSON-serialized file format. Right now, I'm working on the vertex animations. I've stored the frames in a file. The current version of the method looks like the following. But the trouble now is that the only idea I have is to clone the only Mesh instance I have and distort it with a vertex controller. But that doesn't really seem right to me.
public static Object3D loadVertexAnimated(String fileName) {
NoBonesImporter jImporter = new NoBonesImporter();
ArrayList<ArrayList> objects = jImporter.getList(fileName);
ArrayList<NoBoneAnimation> importedAnimations = jImporter.getAnimations(fileName);
Object3D[] list = Object3D[objects.size()];
for (int i = 0; i < objects.size(); i++) {
ArrayList<ArrayList> theObject = objects.get(i);
ArrayList<ArrayList> importedVertices = theObject.get(0);
ArrayList<ArrayList> importedUVs = theObject.get(1);
ArrayList<ArrayList> importedFaces = theObject.get(2);
float[] coordinates = makeCoordinates(importedVertices);
float[] uvs = makeUVs(importedUVs);
int[] indices = makeIndices(importedFaces);
Object3D anObject = new Object3D(coordinates, uvs, indices,0);
list[i] = anObject;
}
int numTriangles = importedVertices.size(), numFrames = importedAnimations.size();
for (i = 0; i < numFrames; i++) {
tmp.clearObject();
int frame = i;
Object3D anObject = list[i];
Mesh aMesh = anObject.getMesh();
NoBoneAnimation anAnimation = animations.get(i);
String name = anAnimation.name;
int numFrames = anAnimation.frames.size();
Animation animation = new Animation(numFrames);
for (ArrayList<ArrayList> importedVertices: anAnimation.frames) {
// Create a new mesh with vertex controller?
SimpleVector[] vertices = SimpleVector[importedVertices.size()];
for (int j = 0; j < vertices.length; j++) {
SimpleVector v = new SimpleVector(vert.get(0), vert.get(1), vert.get(2));
vertices[j] = v;
}
animation.addKeyFrame(...);
}
}
Object3D anObject = makeAnimated3D(pose, objectsBonesReferences.get(i), theObject);
}