getInverseBindMatrix method

  1. @override
Future<Matrix4> getInverseBindMatrix(
  1. ThermionEntity parent,
  2. int boneIndex, {
  3. int skinIndex = 0,
})
override

Gets the inverse bind (pose) matrix for the bone. Note that parent must be the ThermionEntity returned by loadGlb/loadGltf, not any other method (getChildEntity etc). This is because all joint information is internally stored with the parent entity.

Implementation

@override
Future<Matrix4> getInverseBindMatrix(ThermionEntity parent, int boneIndex,
    {int skinIndex = 0}) async {
  final ptr = _module._malloc(16 * 4) as JSNumber;
  _module.ccall(
      "get_inverse_bind_matrix",
      "void",
      ["void*".toJS, "int".toJS, "int".toJS, "int".toJS, "float*".toJS].toJS,
      [_sceneManager!, parent.toJS, skinIndex.toJS, boneIndex.toJS, ptr].toJS,
      null);
  final matrix = _matrixFromPtr(ptr);
  _module._free(ptr);
  return matrix;
}