diff --git a/ios/include/PolyvoxFilamentFFIApi.h b/ios/include/PolyvoxFilamentFFIApi.h index 35f4ece0..c6ce69d8 100644 --- a/ios/include/PolyvoxFilamentFFIApi.h +++ b/ios/include/PolyvoxFilamentFFIApi.h @@ -81,7 +81,6 @@ FLUTTER_PLUGIN_EXPORT void set_animation_frame_ffi(void* const assetManager, Ent FLUTTER_PLUGIN_EXPORT void stop_animation_ffi(void* const assetManager, EntityId asset, int index); FLUTTER_PLUGIN_EXPORT int get_animation_count_ffi(void* const assetManager, EntityId asset); FLUTTER_PLUGIN_EXPORT void get_animation_name_ffi(void* const assetManager, EntityId asset, char *const outPtr, int index); -FLUTTER_PLUGIN_EXPORT float get_animation_duration_ffi(void* const assetManager, EntityId asset, int index); FLUTTER_PLUGIN_EXPORT void get_morph_target_name_ffi(void* const assetManager, EntityId asset, const char *meshName, char *const outPtr, int index); FLUTTER_PLUGIN_EXPORT int get_morph_target_name_count_ffi(void* const assetManager, EntityId asset, const char *meshName); diff --git a/lib/filament_controller_ffi.dart b/lib/filament_controller_ffi.dart index d56d3ae8..79068193 100644 --- a/lib/filament_controller_ffi.dart +++ b/lib/filament_controller_ffi.dart @@ -71,6 +71,7 @@ class FilamentControllerFFI extends FilamentController { @override void setPixelRatio(double ratio) { _pixelRatio = ratio; + print("Set pixel ratio to $ratio"); } @override @@ -105,6 +106,8 @@ class FilamentControllerFFI extends FilamentController { } size = ui.Size(width * _pixelRatio, height * _pixelRatio); + print("Creating viewer with size $size"); + var textures = await _channel.invokeMethod("createTexture", [size.width, size.height]); var flutterTextureId = textures[0]; @@ -145,14 +148,18 @@ class FilamentControllerFFI extends FilamentController { } _lib.create_swap_chain_ffi( - _viewer!, Pointer.fromAddress(surfaceAddress), width, height); + _viewer!, + Pointer.fromAddress(surfaceAddress), + size.width.toInt(), + size.height.toInt()); if (nativeTexture != 0) { assert(surfaceAddress == 0); - _lib.create_render_target(_viewer!, nativeTexture, width, height); + _lib.create_render_target( + _viewer!, nativeTexture, size.width.toInt(), size.height.toInt()); } _lib.update_viewport_and_camera_projection_ffi( - _viewer!, width, height, 1.0); + _viewer!, size.width.toInt(), size.height.toInt(), 1.0); _assetManager = _lib.get_asset_manager(_viewer!); @@ -165,11 +172,12 @@ class FilamentControllerFFI extends FilamentController { Future resize(int width, int height, {double scaleFactor = 1.0}) async { _resizing = true; setRendering(false); - _textureId = await _channel.invokeMethod( - "resize", [width * _pixelRatio, height * _pixelRatio, scaleFactor]); + size = ui.Size(width * _pixelRatio, height * _pixelRatio); + _textureId = await _channel + .invokeMethod("resize", [size.width, size.height, scaleFactor]); _textureIdController.add(_textureId); _lib.update_viewport_and_camera_projection_ffi( - _viewer!, width, height, scaleFactor); + _viewer!, size.width.toInt(), size.height.toInt(), scaleFactor); _resizing = false; setRendering(true); } @@ -448,7 +456,7 @@ class FilamentControllerFFI extends FilamentController { throw Exception("No viewer available, ignoring"); } var duration = - _lib.get_animation_duration_ffi(_assetManager!, asset, animationIndex); + _lib.get_animation_duration(_assetManager!, asset, animationIndex); return duration; }