normalizeSkinWeights method

void normalizeSkinWeights()

Implementation

void normalizeSkinWeights() {
  var vector = Vector4.init();

  var skinWeight = geometry!.attributes["skinWeight"];

  for (var i = 0, l = skinWeight.count; i < l; i++) {
    vector.fromBufferAttribute(skinWeight, i);

    var scale = 1.0 / vector.manhattanLength();

    if (scale != double.infinity) {
      vector.multiplyScalar(scale);
    } else {
      vector.set(1, 0, 0, 0); // do something reasonable

    }

    skinWeight.setXYZW(i, vector.x.toDouble(), vector.y.toDouble(), vector.z.toDouble(), vector.w.toDouble());
  }
}