getCameraPosition method

  1. @override
Future<Vector3> getCameraPosition()
override

Get the camera position in world space.

Implementation

@override
Future<Vector3> getCameraPosition() async {
  final ptr = _module._malloc(3 * 8) as JSNumber;
  _module.ccall("get_camera_position", "void",
      ["void*".toJS, "void*".toJS].toJS, [_viewer!, ptr].toJS, null);
  final pos = Vector3(
      (_module.getValue(ptr.toDartInt.toJS, "double") as JSNumber)
          .toDartDouble,
      (_module.getValue((ptr.toDartInt + 8).toJS, "double") as JSNumber)
          .toDartDouble,
      (_module.getValue((ptr.toDartInt + 16).toJS, "double") as JSNumber)
          .toDartDouble);
  _module._free(ptr);
  return pos;
}