add explicit render platform channel method

This commit is contained in:
Nick Fisher
2022-09-06 19:35:46 +10:00
parent 449c6ed9bd
commit 00284ae7e3
2 changed files with 12 additions and 1 deletions

View File

@@ -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<Any?>
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");
}

View File

@@ -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);
}