From 00284ae7e374ca1ec15cb04bb2e915602216d0ec Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Tue, 6 Sep 2022 19:35:46 +1000 Subject: [PATCH] add explicit render platform channel method --- .../kotlin/app/polyvox/filament/PolyvoxFilamentPlugin.kt | 7 ++++++- lib/filament_controller.dart | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/android/src/main/kotlin/app/polyvox/filament/PolyvoxFilamentPlugin.kt b/android/src/main/kotlin/app/polyvox/filament/PolyvoxFilamentPlugin.kt index 55cf7f10..0b8eafa7 100644 --- a/android/src/main/kotlin/app/polyvox/filament/PolyvoxFilamentPlugin.kt +++ b/android/src/main/kotlin/app/polyvox/filament/PolyvoxFilamentPlugin.kt @@ -215,6 +215,12 @@ class PolyvoxFilamentPlugin: FlutterPlugin, MethodCallHandler, ActivityAware { result.success(null) } } + "render" -> { + executor.execute { + _lib.render(_viewer!!, 0) + result.success(null) + } + } "setRendering" -> { _render = call.arguments as Boolean result.success(null) @@ -480,7 +486,6 @@ class PolyvoxFilamentPlugin: FlutterPlugin, MethodCallHandler, ActivityAware { val args = call.arguments as ArrayList val x = (args[0] as Double).toFloat() val y = (args[1] as Double).toFloat() - Log.v(TAG, "panUpdate ${x} ${y}") _lib.grab_update(_viewer!!, x, y) result.success("OK"); } diff --git a/lib/filament_controller.dart b/lib/filament_controller.dart index ccfd5cbb..76861c39 100644 --- a/lib/filament_controller.dart +++ b/lib/filament_controller.dart @@ -15,6 +15,7 @@ abstract class FilamentController { Future createTextureViewer(int width, int height, { double devicePixelRatio = 1}); Future setFrameRate(int framerate); Future setRendering(bool render); + Future render(); Future resize(int width, int height, { double devicePixelRatio = 1, double contentScaleFactor=1}); Future setBackgroundImage(String path); @@ -111,6 +112,10 @@ class PolyvoxFilamentController extends FilamentController { await _channel.invokeMethod("setRendering", render); } + Future render() async { + await _channel.invokeMethod("render"); + } + Future setFrameRate(int framerate) async { await _channel.invokeMethod("setFrameInterval", 1/ framerate); } @@ -241,6 +246,7 @@ class PolyvoxFilamentController extends FilamentController { } Future removeAsset(FilamentAsset asset) async { + print("Removing asset : $asset"); await _channel.invokeMethod("removeAsset", asset); }