loadGltf method

  1. @override
Future<ThermionEntity> loadGltf(
  1. String path,
  2. String relativeResourcePath, {
  3. bool force = false,
})
override

Implementation

@override
Future<ThermionEntity> loadGltf(String path, String relativeResourcePath,
    {bool force = false}) async {
  final pathPtr = path.toNativeUtf8(allocator: allocator).cast<Char>();
  final relativeResourcePathPtr =
      relativeResourcePath.toNativeUtf8(allocator: allocator).cast<Char>();
  var entity = await withIntCallback((callback) => load_gltf_ffi(
      _sceneManager!, pathPtr, relativeResourcePathPtr, callback));
  allocator.free(pathPtr);
  allocator.free(relativeResourcePathPtr);
  if (entity == _FILAMENT_ASSET_ERROR) {
    throw Exception("An error occurred loading the asset at $path");
  }
  _scene!.registerEntity(entity);

  return entity;
}