The Pose palette generation
The final optimization you should think about is the process of generating a matrix palette from Pose
. If you look at the Pose
class, the following bit of code converts a pose into a linear array of matrices:
void Pose::GetMatrixPalette(std::vector<mat4>& out) { Â Â Â Â unsigned int size = Size(); Â Â Â Â if (out.size() != size) { Â Â Â Â Â Â Â Â out.resize(size); Â Â Â Â } Â Â Â Â for (unsigned int i = 0; i < size; ++i) { Â Â Â Â Â Â Â Â Transform t = GetGlobalTransform(i); Â Â Â Â Â Â Â Â out[i] = transformToMat4(t); Â Â Â Â } }
By itself, this function isn't too bad, but the GetGlobalTransform
function loops through every joint all the way up the specified joints transform chain until the root joint. This means the function wastes a considerable amount of...