I have filled arrays with the Bone and BoneReference classes below. How would you fill your arrays given this data? The following was my first, unsuccessful attempt (I don't understand how the data is arranged in your arrays, and I assumed that mesh_size is maxTriangles).
float[][] weights = new float[maxTriangles][Skeleton.MAX_JOINTS_PER_VERTEX];//Skeleton.MAX_JOINTS_PER_VERTEX IS 4
short[][] jointIndices = new short[maxTriangles][Skeleton.MAX_JOINTS_PER_VERTEX];
for (int y = 0; y < weights[0].length; y++) {
for (int x = 0; x < weights.length; x++) {
weights[x][y] = boneRefs.get(x).vertexWeight;
jointIndices[x][y] = boneRefs.get(x).vertexIndexReference;
}
}
class Bone {
protected String name;
protected SimpleVector position;
protected Matrix transform;
protected int index, parentIndex;
public Bone(String name, SimpleVector position, Matrix transform, int index, int parentIndex) {
this.name = name;
this.position = position;
this.transform = transform;
this.index = index;
this.parentIndex = parentIndex;
}
}
class BoneReference {
public short vertexIndexReference;
public short boneIndexReference;
public float vertexWeight;
public BoneReference(short vertexIndexReference, short boneIndexReference, float vertexWeight) {
this.vertexIndexReference = vertexIndexReference;
this.boneIndexReference = boneIndexReference;
this.vertexWeight = vertexWeight;
}
}