Ms3dSkeleton constructor

Ms3dSkeleton(
  1. List<Ms3dJoint> joints,
  2. int totalFrames, {
  3. bool absoluteKeys = false,
})

Implementation

Ms3dSkeleton(this.joints, this.totalFrames, {this.absoluteKeys = false}) {
  for (var i = 0; i < joints.length; i++) {
    final j = joints[i];
    final lb = Float32List(12);
    ms3dAngleMatrix(j.rotation, lb);
    lb[3] = j.position[0];
    lb[7] = j.position[1];
    lb[11] = j.position[2];
    final gb = Float32List(12);
    // Parents normally precede children; fall back to a lookup otherwise.
    if (j.parentIndex < 0) {
      gb.setAll(0, lb);
    } else if (j.parentIndex < i) {
      ms3dConcat(globalBind[j.parentIndex], lb, gb);
    } else {
      gb.setAll(0, lb); // fixed up below
    }
    localBind.add(lb);
    globalBind.add(gb);
    local.add(Float32List.fromList(lb));
    global.add(Float32List.fromList(gb));
    _setupTangents(j);
  }
  // Handle any joint whose parent was listed after it.
  for (var i = 0; i < joints.length; i++) {
    final p = joints[i].parentIndex;
    if (p > i) _recomputeBind(i);
  }
}