ThermionViewerFFI constructor

ThermionViewerFFI({
  1. RenderCallback? renderCallback,
  2. Pointer<Void>? renderCallbackOwner,
  3. required Pointer<Void> resourceLoader,
  4. Pointer<Void>? driver,
  5. Pointer<Void>? sharedContext,
  6. String? uberArchivePath,
})

This controller uses platform channels to bridge Dart with the C/C++ code for the Filament API. Setting up the context/texture (since this is platform-specific) and the render ticker are platform-specific; all other methods are passed through by the platform channel to the methods specified in ThermionFlutterApi.h.

Implementation

ThermionViewerFFI(
    {RenderCallback? renderCallback,
    Pointer<Void>? renderCallbackOwner,
    required this.resourceLoader,
    Pointer<Void>? driver,
    Pointer<Void>? sharedContext,
    this.uberArchivePath}) {
  this._renderCallbackOwner = renderCallbackOwner ?? nullptr;
  this._renderCallback = renderCallback ?? nullptr;
  this._driver = driver ?? nullptr;
  this._sharedContext = sharedContext ?? nullptr;
  try {
    _onPickResultCallable =
        NativeCallable<Void Function(Int entityId, Int x, Int y)>.listener(
            _onPickResult);
  } catch (err) {
    _logger.severe(
        "Failed to set pick result callback. This is expected if running on web/wasm");
  }
  _initialize();
}