getCameraViewMatrix method

  1. @override
Future<Matrix4> getCameraViewMatrix()
override

Get the camera's view matrix. See Camera.h for more details.

Implementation

@override
Future<Matrix4> getCameraViewMatrix() async {
  final ptr = _module._malloc(16 * 8) as JSNumber;
  _module.ccall("get_camera_view_matrix", "void",
      ["void*".toJS, "double*".toJS].toJS, [_viewer!, ptr].toJS, null);
  final matrix = Matrix4.zero();
  for (int i = 0; i < 16; i++) {
    matrix[i] = (_module.getValue((ptr.toDartInt + (i * 8)).toJS, "double")
            as JSNumber)
        .toDartDouble;
  }
  _module._free(ptr);
  return matrix;
}