normalizeSkinWeights method
void
normalizeSkinWeights()
Normalizes the skin weights.
Implementation
void normalizeSkinWeights() {
final vector = Vector4.identity();
final skinWeight = geometry!.attributes["skinWeight"];
for (int i = 0, l = skinWeight.count; i < l; i++) {
vector.fromBuffer( skinWeight, i );
final scale = 1.0 / vector.manhattanLength();
if (scale != double.infinity) {
vector.scale(scale);
}
else {
vector.setValues(1, 0, 0, 0); // do something reasonable
}
skinWeight.setXYZW(i, vector.x.toDouble(), vector.y.toDouble(), vector.z.toDouble(), vector.w.toDouble());
}
}