From f34cac0dabf2e017c9b5c5fa8e0dfc8e0e7fdaeb Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Tue, 3 Oct 2023 13:16:18 +0800 Subject: [PATCH 1/3] update gitattributes --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index cf8c95fa..a9fb6d26 100644 --- a/.gitattributes +++ b/.gitattributes @@ -542,3 +542,4 @@ web/lib/libimage.a filter=lfs diff=lfs merge=lfs -text web/lib/libshaders.a filter=lfs diff=lfs merge=lfs -text assets/materials.uberz filter=lfs diff=lfs merge=lfs -text assets/materials_ios_arm64.uberz filter=lfs diff=lfs merge=lfs -text +ios/lib/libmikktspace.a filter=lfs diff=lfs merge=lfs -text From 90e1de2e67bdb5cf918a8d076cc937c57b488ede Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Tue, 3 Oct 2023 13:46:09 +0800 Subject: [PATCH 2/3] increase Kotlin version --- android/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 7525c936..50a2d237 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,7 +2,7 @@ group 'app.polyvox.filament' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.6.0' + ext.kotlin_version = '1.6.20' repositories { google() mavenCentral() @@ -59,7 +59,7 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile 'net.java.dev.jna:jna:5.10.0@aar' + implementation 'net.java.dev.jna:jna:5.10.0@aar' implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2" } From d24a6135d5402862dd0f3f5796274bb5c79e4e97 Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Tue, 3 Oct 2023 14:22:04 +0800 Subject: [PATCH 3/3] remove FilamentController size property to abstract and make all methods return Futures --- lib/filament_controller.dart | 59 +++++++++++++++++--------------- lib/filament_controller_ffi.dart | 1 - 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/lib/filament_controller.dart b/lib/filament_controller.dart index 9cfebe5d..d720929f 100644 --- a/lib/filament_controller.dart +++ b/lib/filament_controller.dart @@ -13,6 +13,9 @@ const FilamentEntity FILAMENT_ASSET_ERROR = 0; enum ToneMapper { ACES, FILMIC, LINEAR } abstract class FilamentController { + // the current target size of the viewport, in logical pixels + ui.Size size = ui.Size.zero; + Stream get textureId; Future get isReadyForScene; Future setRendering(bool render); @@ -101,7 +104,7 @@ abstract class FilamentController { /// [morphWeights] is a list of doubles in frame-major format. /// Each frame is [numWeights] in length, and each entry is the weight to be applied to the morph target located at that index in the mesh primitive at that frame. /// - void setMorphAnimationData( + Future setMorphAnimationData( FilamentEntity asset, MorphAnimationData animation); /// @@ -110,39 +113,39 @@ abstract class FilamentController { /// Each frame is [numWeights] in length, and each entry is the weight to be applied to the morph target located at that index in the mesh primitive at that frame. /// for now we only allow animating a single bone (though multiple skinned targets are supported) /// - void setBoneAnimation(FilamentEntity asset, BoneAnimationData animation); - void removeAsset(FilamentEntity asset); - void clearAssets(); - void zoomBegin(); - void zoomUpdate(double z); - void zoomEnd(); - void playAnimation(FilamentEntity asset, int index, + Future setBoneAnimation(FilamentEntity asset, BoneAnimationData animation); + Future removeAsset(FilamentEntity asset); + Future clearAssets(); + Future zoomBegin(); + Future zoomUpdate(double z); + Future zoomEnd(); + Future playAnimation(FilamentEntity asset, int index, {bool loop = false, bool reverse = false, bool replaceActive = true, double crossfade = 0.0}); - void setAnimationFrame(FilamentEntity asset, int index, int animationFrame); - void stopAnimation(FilamentEntity asset, int animationIndex); - void setCamera(FilamentEntity asset, String? name); - void setToneMapping(ToneMapper mapper); - void setBloom(double bloom); - void setCameraFocalLength(double focalLength); - void setCameraFocusDistance(double focusDistance); - void setCameraPosition(double x, double y, double z); - void moveCameraToAsset(FilamentEntity asset); - void setViewFrustumCulling(bool enabled); - void setCameraExposure( + Future setAnimationFrame(FilamentEntity asset, int index, int animationFrame); + Future stopAnimation(FilamentEntity asset, int animationIndex); + Future setCamera(FilamentEntity asset, String? name); + Future setToneMapping(ToneMapper mapper); + Future setBloom(double bloom); + Future setCameraFocalLength(double focalLength); + Future setCameraFocusDistance(double focusDistance); + Future setCameraPosition(double x, double y, double z); + Future moveCameraToAsset(FilamentEntity asset); + Future setViewFrustumCulling(bool enabled); + Future setCameraExposure( double aperture, double shutterSpeed, double sensitivity); - void setCameraRotation(double rads, double x, double y, double z); - void setCameraModelMatrix(List matrix); + Future setCameraRotation(double rads, double x, double y, double z); + Future setCameraModelMatrix(List matrix); - void setMaterialColor( + Future setMaterialColor( FilamentEntity asset, String meshName, int materialIndex, Color color); - void transformToUnitCube(FilamentEntity asset); - void setPosition(FilamentEntity asset, double x, double y, double z); - void setScale(FilamentEntity asset, double scale); - void setRotation( + Future transformToUnitCube(FilamentEntity asset); + Future setPosition(FilamentEntity asset, double x, double y, double z); + Future setScale(FilamentEntity asset, double scale); + Future setRotation( FilamentEntity asset, double rads, double x, double y, double z); - void hide(FilamentEntity asset, String meshName); - void reveal(FilamentEntity asset, String meshName); + Future hide(FilamentEntity asset, String meshName); + Future reveal(FilamentEntity asset, String meshName); } diff --git a/lib/filament_controller_ffi.dart b/lib/filament_controller_ffi.dart index f9304825..9c2f35a0 100644 --- a/lib/filament_controller_ffi.dart +++ b/lib/filament_controller_ffi.dart @@ -14,7 +14,6 @@ class FilamentControllerFFI extends FilamentController { late MethodChannel _channel = MethodChannel("app.polyvox.filament/event"); double _pixelRatio = 1.0; - ui.Size size = ui.Size.zero; int? _textureId; final _textureIdController = StreamController.broadcast();