palette method
The palette of skin skin for nodeMatrices (from evaluate): per
joint, the top three rows of jointMatrix · inverseBind
(kPaletteFloats floats), into out from offset.
Implementation
void palette(
int skin,
Float32List nodeMatrices,
Float32List out, [
int offset = 0,
]) {
final data = model.skins[skin];
final ibm = data.inverseBindMatrices;
for (var j = 0; j < data.joints.length; j++) {
final n = data.joints[j] * 16;
final b = j * 16;
final o = offset + j * kPaletteFloats;
// Row r of (N · B): sum over k of N[k*4 + r] * B[c*4 + k], for column c.
for (var r = 0; r < 3; r++) {
for (var c = 0; c < 4; c++) {
out[o + r * 4 + c] =
nodeMatrices[n + r] * ibm[b + c * 4] +
nodeMatrices[n + 4 + r] * ibm[b + c * 4 + 1] +
nodeMatrices[n + 8 + r] * ibm[b + c * 4 + 2] +
nodeMatrices[n + 12 + r] * ibm[b + c * 4 + 3];
}
}
}
}