update controller FFI Platform checks
This commit is contained in:
@@ -40,10 +40,10 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
throw Exception("Unknown method channel invocation ${call.method}");
|
throw Exception("Unknown method channel invocation ${call.method}");
|
||||||
});
|
});
|
||||||
late DynamicLibrary dl;
|
late DynamicLibrary dl;
|
||||||
if(Platform.isIOS || Platform.isMacOS ||Platform.isWindows) {
|
if (Platform.isIOS || Platform.isMacOS || Platform.isWindows) {
|
||||||
dl = DynamicLibrary.process();
|
dl = DynamicLibrary.process();
|
||||||
} else {
|
} else {
|
||||||
dl = DynamicLibrary.open("libpolyvox_filament.so");
|
dl = DynamicLibrary.open("libpolyvox_filament_android.so");
|
||||||
}
|
}
|
||||||
_lib = NativeLibrary(dl);
|
_lib = NativeLibrary(dl);
|
||||||
}
|
}
|
||||||
@@ -111,14 +111,17 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
await _channel.invokeMethod("createTexture", [size.width, size.height]);
|
await _channel.invokeMethod("createTexture", [size.width, size.height]);
|
||||||
var flutterTextureId = textures[0];
|
var flutterTextureId = textures[0];
|
||||||
_textureId = flutterTextureId;
|
_textureId = flutterTextureId;
|
||||||
|
|
||||||
|
// void* on iOS (pointer to pixel buffer), void* on Android (pointer to native window), null on Windows/macOS
|
||||||
var surfaceAddress = textures[1] as int? ?? 0;
|
var surfaceAddress = textures[1] as int? ?? 0;
|
||||||
|
|
||||||
// null on iOS, void* on MacOS, GLuid on Android/Windows/Linux
|
// null on iOS/Android, void* on MacOS (pointer to metal texture), GLuid on Windows/Linux
|
||||||
var nativeTexture = textures[2] as int? ?? 0;
|
var nativeTexture = textures[2] as int? ?? 0;
|
||||||
|
|
||||||
var driver = nullptr.cast<Void>();
|
var driver = nullptr.cast<Void>();
|
||||||
if(Platform.isWindows) {
|
if (Platform.isWindows) {
|
||||||
driver = Pointer<Void>.fromAddress(await _channel.invokeMethod("getDriverPlatform"));
|
driver = Pointer<Void>.fromAddress(
|
||||||
|
await _channel.invokeMethod("getDriverPlatform"));
|
||||||
}
|
}
|
||||||
|
|
||||||
var renderCallbackResult = await _channel.invokeMethod("getRenderCallback");
|
var renderCallbackResult = await _channel.invokeMethod("getRenderCallback");
|
||||||
@@ -129,6 +132,7 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
Pointer<Void>.fromAddress(renderCallbackResult[1]);
|
Pointer<Void>.fromAddress(renderCallbackResult[1]);
|
||||||
|
|
||||||
var sharedContext = await _channel.invokeMethod("getSharedContext");
|
var sharedContext = await _channel.invokeMethod("getSharedContext");
|
||||||
|
print("Got shared context : $sharedContext");
|
||||||
var loader = await _channel.invokeMethod("getResourceLoaderWrapper");
|
var loader = await _channel.invokeMethod("getResourceLoaderWrapper");
|
||||||
|
|
||||||
_viewer = _lib.create_filament_viewer_ffi(
|
_viewer = _lib.create_filament_viewer_ffi(
|
||||||
|
|||||||
Reference in New Issue
Block a user