add option to record to PNGs (inc background threadpool for encoding)

This commit is contained in:
Nick Fisher
2023-11-20 15:28:55 +08:00
parent a96309bd77
commit 5c1be3d047
9 changed files with 112 additions and 27 deletions

View File

@@ -492,4 +492,10 @@ abstract class FilamentController {
///
Future<FilamentEntity> getChildEntity(
FilamentEntity parent, String childName);
///
/// If [recording] is set to true, each frame the framebuffer/texture will be written to /tmp/output_*.png.
/// This will impact performance; handle with care.
///
Future setRecording(bool recording);
}

View File

@@ -1207,4 +1207,9 @@ class FilamentControllerFFI extends FilamentController {
calloc.free(childNamePtr);
}
}
@override
Future setRecording(bool recording) async {
set_recording(_viewer!, recording);
}
}

View File

@@ -746,6 +746,13 @@ external int find_child_entity_by_name(
ffi.Pointer<ffi.Char> name,
);
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Bool)>(
symbol: 'set_recording', assetId: 'flutter_filament_plugin')
external void set_recording(
ffi.Pointer<ffi.Void> viewer,
bool recording,
);
@ffi.Native<ffi.Void Function()>(
symbol: 'ios_dummy', assetId: 'flutter_filament_plugin')
external void ios_dummy();