I'm reading from the FBX format and I'm using Bones to animate an object, and I'm at the point where I have to decide on the code that actually moves the vertexes.
So far I thought on two methods:
Create a bone class that has an array of XYZ and an array of vertexes addresses and the weight. The array of XYZ (and rotations' values) will be filled from their positions/rotations at every frame. My model object will have an array of this bones class, and at each call I'll update the vertexes by multiplying the bones' XYZ for the vertexes, something like:
for(int i = 0; i < object->bonesCount; i++)
{
for(int j = 0; j < object->bones[i]->vertexesCount; j++)
{
object->bones[i]->vertex[j].xyz *= object->bones[i].xyz; //plus rotation
}
}
And the second method is having an array of vertexes * amount of frames, I do something like the above code and I save each vertexes' positions at every frame in the array, so I don't have to call the loop above (I think it might impact performance), but I'd have much more arrays to work with.
So my questions are, (1) which is the best approach for this, and (2) is there another method I didn't think of? Any info related to this is appreciated, as I have nothing done yet and I'm still elaborating on how it should be before I start coding (I try to avoid doing the first thing I come up with so there's less chances of needing to recode it later).
Thanks!