diff --git a/.gitattributes b/.gitattributes
index cb63127d..6209cb5d 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,12 +1,160 @@
-*.a filter=lfs diff=lfs merge=lfs -text
-*.lib filter=lfs diff=lfs merge=lfs -text
-*.dll filter=lfs diff=lfs merge=lfs -text
-*.pdb filter=lfs diff=lfs merge=lfs -text
-*.png filter=lfs diff=lfs merge=lfs -text
-*.jpg filter=lfs diff=lfs merge=lfs -text
-*.uberz filter=lfs diff=lfs merge=lfs -text
-*.bin filter=lfs diff=lfs merge=lfs -text
-*.ktx filter=lfs diff=lfs merge=lfs -text
-*.blend filter=lfs diff=lfs merge=lfs -text
-*.gltf filter=lfs diff=lfs merge=lfs -text
-*.glb filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libbackendtest_combined.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libfilabridge.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libgltfio_core.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libibl-lite.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libcamutils.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libgeometry_combined.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libbackend.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libuberarchive.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libbasis_transcoder.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libgeometry.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libmikktspace.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libzstd.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libcivetweb.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libsdl2.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libmeshoptimizer.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libmathio.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libbasis_transcoder.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libfilament-iblprefilter.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libmatdbg_combined.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libspirv-cross-msl.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libtinyexr.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libzstd.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libshaders.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libSPIRV-Tools.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libgeometry.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libimageio.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libOGLCompiler.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libSPIRV-Tools-diff.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libfilamat_combined.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libfilameshio.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libmathio.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libshaders.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libassimp.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libmatlang.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libibl.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libmikktspace.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libmatdbg_combined.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/swift/DartFilamentTexture.h filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libfilamat_combined.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libfilament.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libibl.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libstb.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libuberzlib.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libbasis_encoder.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libimgui.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libdracodec.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libimageio.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libfilament.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libstb.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libbackend_test.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libgetopt.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libgtest.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libfilabridge.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libmatdbg_resources.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libuberarchive.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libfilaflat.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libSPIRV.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libpng.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libvkshaders.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libutils.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libimage.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libmatdbg_resources.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libsuzanne-resources.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libfilamat_lite.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libgeometry_combined.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libshaders.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libsmol-v.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libmath.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libgeometry.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libmeshoptimizer.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libpng16.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libbenchmark_main.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libbluegl.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libuberzlib.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/swift/build.sh filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libdracodec.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libibl.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libktxreader.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libbluegl.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libfilaflat.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libpng.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libbluevk.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libfilaflat.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libfilamat.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libglslang.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libcivetweb.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libktxreader.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libbenchmark.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libgltf-demo-resources.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libgltfio_core.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libSPIRV-Tools-lint.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libdracodec.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libfilagui.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libmikktspace.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libsample-resources.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libOSDependent.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libspirv-cross-glsl.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libgltfio.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libimage.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libpng.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libgltfio.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libmatdbg.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libspirv-cross-core.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libstb.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libfilamat.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libfilamat_lite.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libfilamat.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libviewer.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libutils.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libvkshaders.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libcamutils.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libbackend.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libfilagui.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libmath.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libviewer.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/swift/libdartfilamenttexture.dylib filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libfilament-iblprefilter.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libuberzlib.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libutils.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libviewer.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libfilamat_lite.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libfilameshio.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libcivetweb.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libbasis_transcoder.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libSPIRV-Tools-link.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libvkshaders.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libz.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libbluevk.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libtinyexr.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libzstd.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libcamutils.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libfilabridge.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libmatdbg.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libimage.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libsmol-v.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libgltfio_core.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libsmol-v.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libfilament-iblprefilter.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libfilament.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libmeshoptimizer.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libbackend.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libibl-lite.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/libktxreader.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libfilameshio.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/swift filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libtinyexr.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libSPIRV-Tools-reduce.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/macos/debug/libuberarchive.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libibl-lite.a filter=lfs diff=lfs merge=lfs -text
+dart_filament/native/lib/ios/libimageio.a filter=lfs diff=lfs merge=lfs -text
+materials/Makefile filter=lfs diff=lfs merge=lfs -text
+materials/gizmo.filamat filter=lfs diff=lfs merge=lfs -text
+materials/gizmo.mat filter=lfs diff=lfs merge=lfs -text
+materials/image.filamat filter=lfs diff=lfs merge=lfs -text
+materials/image.mat filter=lfs diff=lfs merge=lfs -text
+materials/unlit_fade.mat filter=lfs diff=lfs merge=lfs -text
+materials/unlit_opaque.mat filter=lfs diff=lfs merge=lfs -text
diff --git a/.gitignore b/.gitignore
index 9dcd4503..69e4aca4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
+.dart_tool
+**/.dart_tool
.vscode
-macos/src
-macos/include
-.DS_Store
\ No newline at end of file
+.DS_Store
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 64f6b95d..00000000
--- a/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-# building on MacOS, we currently just delete the macos/include
-# and macos/src directories and copy from iOS
-sync-macos: FORCE
- rm -rf ${current_dir}macos/include ${current_dir}macos/src
- cp -R ${current_dir}ios/include ${current_dir}macos
- cp -R ${current_dir}ios/src ${current_dir}macos
-
-# We compile a small set of custom materials for various helpers (background image, gizmo, etc)
-# You must specify the `FILAMENT_PATH` environment variable, either the path /out/release
-# eg: FILAMENT_PATH=/path/to/filament/out/release/bin make materials
-#
-materials: FORCE
- @echo "Using Filament build from ${FILAMENT_PATH}"
- ${FILAMENT_PATH}/matc -a opengl -a metal -o materials/image.filamat materials/image.mat
- $(FILAMENT_PATH)/resgen -c -p image -x ios/include/material/ materials/image.filamat
- $(FILAMENT_PATH)/matc -a opengl -a metal -o materials/gizmo.filamat materials/gizmo.mat
- $(FILAMENT_PATH)/resgen -c -p gizmo -x ios/include/material/ materials/gizmo.filamat
- #rm materials/*.filamat
-
-FORCE: ;
-
diff --git a/ARCHITECTURE.md b/dart_filament/ARCHITECTURE.md
similarity index 100%
rename from ARCHITECTURE.md
rename to dart_filament/ARCHITECTURE.md
diff --git a/CHANGELOG.md b/dart_filament/CHANGELOG.md
similarity index 100%
rename from CHANGELOG.md
rename to dart_filament/CHANGELOG.md
diff --git a/dart_filament/README.md b/dart_filament/README.md
new file mode 100644
index 00000000..3b29ae9c
--- /dev/null
+++ b/dart_filament/README.md
@@ -0,0 +1,449 @@
+# Flutter Filament
+
+Cross-platform, 3D PBR rendering and animation for [Flutter](https://github.com/google/filament).
+
+Wraps the [the Filament rendering library](https://github.com/google/filament).
+
+Powers the [Polyvox](https://polyvox.app) and [odd-io](https://github.com/odd-io/) engines.
+
+This is still in beta: bugs/missing features are to be expected.
+
+https://github.com/nmfisher/flutter_filament/assets/7238578/abaed1c8-c97b-4999-97b2-39e85e0fa7dd
+
+
+|Feature|Supported|
+|---|---|
+|Platforms|✅ iOS (arm64)
✅ MacOS (arm64)
✅ Android (arm64)
✅ Windows (x64) (>= 10)
⚠️ Linux (x64 - broken)
⚠️ Web (planned)|
+|Formats|✅ glb
⚠️ glTF (partial - see Known Issues)|
+|Texture support|✅ PNG
✅ JPEG
✅ KTX
⚠️ KTX2 (planned)|
+|Camera movement|✅ Desktop (mouse)
✅ Mobile (swipe/pinch)|
+|Animation|✅ Embedded glTF skinning animations
✅ Embedded glTF morph animations
✅ Runtime/dynamic morph animations
⚠️ Runtime/dynamic skinning animations
+|Entity manipulation|✅ Viewport selection
⚠️ Entity/transform parenting (planned)
⚠️ Transform manipulation (mouse/gesture to rotate/translate/scale object) (partial)
⚠️ Runtime material changes (planned)|
+
+Special thanks to [odd-io](https://github.com/odd-io/) for sponsoring work on supporting Windows, raycasting, testing and documentation.
+
+PRs are welcome but please create a placeholder PR to discuss before writing any code. This will help with feature planning, avoid clashes with existing work and keep the project structure consistent.
+
+## Getting Started
+
+This package requires Flutter >= `3.16.0-0.2.pre`, so you will need to first switch to the `beta` channel:
+
+```
+flutter channel beta
+flutter upgrade
+```
+There are specific issues with earlier versions on Windows/MacOS (mobile should actually be fine, so if you want to experiment on your own you're free to remove the minimum version from `pubspec.yaml`).
+
+Next, clone this repository and pull the latest binaries from Git LFS:
+
+```
+cd $HOME
+git clone && cd flutter_filament
+git lfs pull
+```
+
+(this step won't be needed after the plugin is published to pub.dev).
+
+> You *do not need to build Filament yourself*. The repository is bundled with all necessary headers/static libraries (`windows/lib`, `ios/lib`, `macos/lib` and `linux/lib`) and the Flutter plugin has been configured to link at build time.
+
+Run the example project to check:
+
+```
+cd example && flutter run -d
+```
+
+To use the plugin in your own project, add the plugin to your pubspec.yaml:
+
+```
+name: your_project
+description: Your project
+...
+dependencies:
+ flutter:
+ sdk: flutter
+ flutter_filament:
+ path:
+```
+
+## Basic Usage
+
+See the `example` project for a complete sample that incorporates many of the below steps, and more.
+
+### Creating the viewport widget and controller
+
+Create an instance of `FilamentControllerFFI` somewhere in your app where it will not be garbage collected until you no longer need a rendering canvas:
+
+```
+class MyApp extends StatelessWidget {
+
+ final _filamentController = FilamentControllerFFI();
+ ...
+}
+
+```
+
+This is a relatively lightweight object, however its constructor will load/bind symbols from the native library. This may momentarily block the UI, so you may wish to structure your app so that this is hidden behind a static widget until it is available.
+
+Next, create an instance of `FilamentWidget` in the widget hierarchy where you want the rendering canvas to appear. This can be sized as large or as small as you want. On most platforms, Flutter widgets can be positioned above or below the `FilamentWidget`.
+
+```
+class MyApp extends StatelessWidget {
+
+ final _filamentController = FilamentControllerFFI();
+
+ @override
+ Widget build(BuildContext context) {
+ return MaterialApp(
+ color: Colors.white,
+ home: Scaffold(backgroundColor: Colors.white, body: Stack(children:[
+ Container(color:Colors.green, height:100, width:100),
+ Positioned.fill(top:100, left:100child:FilamentWidget(controller:_filamentController)),
+ Positioned(right:0, bottom:0, child:Container(color:Colors.purple, height:100, width:100))
+ ])));
+ }
+}
+```
+
+When a `FilamentWidget` is added to the widget hierarchy:
+1) by default a Container will be rendered with solid red. If you want to change this, pass a widget as the `initial` paramer to the `FilamentWidget` constructor.
+2) on the second frame, `FilamentWidget` will pass its dimensions/pixel ratio to the `FilamentController`
+3) You can then call `createViewer` to create:
+ * the rendering surface (on most platforms, a backing texture that will be registered with Flutter for use in a `Texture` widget)
+ * a rendering thread
+ * a `FilamentViewer` and an `SceneManager`, which will allow you to load assets/cameras/lighting/etc via the `FilamentController`
+4) after an indeterminate number of frames, `FilamentController` will notify `FilamentWidget` when a rendering surface is available the viewport
+5) `FilamentWidget` will replace the default `initial` Widget with the viewport (which will initially be solid black or white, depending on your platform).
+
+IMPORTANT: there *will* be a delay between adding a `FilamentWidget`, calling `createViewer` and the actual rendering viewport becoming available. This is why we fill `FilamentWidget` with red - to make it abundantly clear that you need to handle this asynchronous delay appropriately. Once `createViewer` has completed, the viewport is available for rendering.
+
+> Currently, the `initial` widget will also be displayed whenever the viewport is resized (including changing orientation on mobile and drag-to-resize on desktop). You probably want to change this from the default red.
+
+Congratulations! You now have a scene. It's completely empty, so you probably want to add something visible.
+
+### Load a background
+
+You probably want to set a background for your scene. You can load a skybox:
+```
+await _filamentController.loadSkybox("assets/default_env/default_env_skybox.ktx)
+```
+
+or a static background image:
+
+```
+await _filamentController.setBackgroundImage("assets/background.ktx)
+```
+
+or a solid background color:
+
+```
+await _filamentController.setBackgroundColor(0.0, 1.0, 0.0, 1.0); // solid green
+```
+
+At this point, you might not see any change in the viewport. This is because the FilamentController will only actually render into the viewport once `render` has been called.
+
+By default, the FilamentController will only render into the viewport by manually calling `render()` on the FilamentController. This is to avoid needlessly running a render loop when there is nothing to display.
+
+```
+await _filamentController.render()
+```
+
+You should now see your background displayed in the scene. To automatically render at 60fps, call `setRendering`:
+```
+await _filamentController.setRendering(true);
+```
+
+### Load an asset
+
+To add a glTF asset to the scene, call `loadGlb()` on `FilamentController` with the Flutter asset path to your .glb file.
+
+For example, if your `pubspec.yaml` looks like this:
+```
+flutter:
+ assets:
+ - assets/models/bob.glb
+```
+
+Then you would call the following
+```
+var entity = await _filamentController.loadGlb("assets/models/bob.glb");
+```
+You can also pass a URI to indicate that the glTF file should be loaded from the filesystem:
+```
+var entity = await _filamentController.loadGlb("file:///tmp/bob.glb");
+```
+
+The return type `FilamentEntity` is simply an integer handle that be used to manipulate the entity in the scene. For example, to remove the asset:
+```
+await _filamentController.removeEntity(entity);
+entity = null;
+```
+> Removing an entity from the scene will invalidate the corresponding `FilamentEntity` handle, so ensure you don't retain any references to it after calling `removeEntity` or `clearEntities`. Removing one `FilamentEntity` does not invalidate/change any other `FilamentEntity` handles; you can continue to safely manipulate these via the `FilamentController`.
+
+### Lighting
+
+You should now see your object in the viewport, but since we haven't added a light, this will be solid black.
+
+Add an image-based light from a KTX file:
+
+```
+await _filamentController.loadIbl("assets/default_env/default_env_ibl.ktx");
+```
+
+You can also add dynamic lights:
+
+```
+var sun = await _filamentController.addLight(
+```
+
+### Manipulating entity transforms
+
+To set the world space position of the asset:
+```
+_filamentController.setPositon(entity, 1.0, 1.0, 1.0);
+```
+
+On desktop, you can also click any renderable object in the viewport to retrieve its associated FilamentEntity (see below).
+
+### Camera movement
+
+To enable mouse/swipe navigation through the scene, wrap the `FilamentWidget` inside a `FilamentGestureDetector`:
+
+```
+class MyApp extends StatelessWidget {
+
+ final _filamentController = FilamentControllerFFI();
+
+ @override
+ Widget build(BuildContext context) {
+ return MaterialApp(
+ color: Colors.white,
+ home: Scaffold(backgroundColor: Colors.white, body: Stack(children:[
+ Positioned.fill(child:FilamentGestureDetector(
+ controller: _filamentController,
+ child:FilamentWidget(
+ controller:_filamentController
+ ))),
+ Positioned(right:0, bottom:0, child:Container(color:Colors.purple, height:100, width:100))
+ ])));
+ }
+}
+```
+
+On desktop:
+1) hold the middle mouse button and move the mouse to rotate the camera
+2) hold the left mouse button and move the mouse to pan the camera
+3) scroll up/down with the scrollwheel to zoom in/out.
+
+On mobile:
+1) swipe with your finger to pan the camera
+2) double tap the viewport, then swipe with your finger to rotate the camera (double-tap again to return to pan)
+3) pinch with two fingers in/out to zoom in/out.
+
+### Changing the active camera
+
+Every scene has a default camera. Whenever you rotate/pan/zoom the viewport, you are moving the default camera.
+
+If you have added an entity to the scene that contains one or more camera nodes, you can change the active scene camera to one of those camera nodes.
+
+```
+var asset = await _filamentController.loadGlb("assets/some_asset_with_camera.glb");
+await _filamentController.setCamera(asset, "Camera.002"); // pass the node name to load a specific camera under that entity node
+await _filamentController.setCamera(asset, null); // pass null to load the first camera found under that entity
+```
+
+### Picking entities
+
+On desktop, left-clicking an object in the viewport will retrieve the FilamentEntity for the top-most renderable instance at that cursor position (if any).
+
+Note this is an asynchronous operation, so you will need to subscribe to the [pickResult] stream on your [FilamentController] to do something with the result.
+
+```
+class MyApp extends StatefulWidget {
+ ...
+}
+
+
+class _MyAppState extends State {
+
+ final _filamentController = FilamentControllerFFI();
+
+ @override
+ void initState() {
+ _filamentController.pickResult.listen((FilamentEntity filamentEntity) async {
+ var entityName = _filamentController.getNameForEntity(filamentEntity);
+ await showDialog(builder:(ctx) {
+ return Container(child:Text("You clicked $entityName"));
+ });
+ });
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return MaterialApp(
+ color: Colors.white,
+ home: Scaffold(backgroundColor: Colors.white, body: Stack(children:[
+ Positioned.fill(child:FilamentGestureDetector(
+ controller: _filamentController,
+ child:FilamentWidget(
+ controller:_filamentController
+ ))),
+ ])));
+ }
+}
+```
+
+## Advanced Usage
+
+If you want to work with custom materials, you will need some (basic knowledge of the underlying Filament library)[https://google.github.io/filament/Materials.html#compilingmaterials].
+
+Things to keep in mind:
+- You must compile materials with the correct version of Filament (see the table above). Keep in mind that versions may not be identical across platforms so you may need multiple uberz files for multiple platforms.
+
+e.g. the lit_opaque.uberz file has been created from a Filament build:
+
+```
+cd out/cmake-android-release-aarch64/libs/gltfio
+uberz -TSHADINGMODEL=lit -TBLENDING=opaque -o lit_opaque_43.uberz lit_opaque
+```
+
+(note that the number in the filename corresponds to the Material version, not the Filament version. Not every Filament version requires a new Material version).
+
+## Footguns
+
+### Stripping in release mode
+
+If you build your app in release mode, you will need to ensure that "Dead Strip" is set to false.
+
+This is because we only invoke the library at runtime via FFI, so at link time these symbols are otherwise treated as redundant.
+
+### Animations when backgrounded
+
+Don't call playAnimation when the app is in the background (i.e inactive/hidden). This will queue, but not start, an animation, and eventually this will overflow the command buffer when the app is foregrounded/resumed.
+
+If you have some kind of looping animation in your app code, make sure it pauses while the app is backgrounded.
+
+
+
+## Versioning
+
+||Android|iOS|MacOS|Windows|Linux|WebGL|
+|---|---|---|---|---|---||
+|Filament|v1.43.1 (arm64/armeabi-v7a/x86/x86_64)|v1.43.1* (arm64)|v1.43.1 (arm64)|v1.32.4 (x86_64)|TODO**|TODO***|
+|Flutter||3.15.0-15.2.pre|3.15.0-15.2.pre|3.15.0-15.2.pre
+
+* iOS release build has a skybox bug so the debug versions are currently shipped on iOS
+** (Waiting for https://github.com/google/filament/issues/7078 to be resolved before upgrading, not sure exactly when the bug was introduced but it was somewhere between v1.32.4 and v1.40.0)
+*** Texture widget not currently supported on web in Flutter.
+
+
+## Testing
+
+We automate testing by running the example project on actual iOS/Android/MacOS/Windows devices and executing various operations.
+
+Eventually we want to compare screenshots after each operation to a set of goldens for every platform.
+
+Currently this is only possible on iOS (see https://github.com/flutter/flutter/issues/123063 and https://github.com/flutter/flutter/issues/127306).
+
+To re-generate the golden screenshots for a given device:
+
+```
+./regenerate_goldens.sh
+```
+To run the tests and compare against those goldens:
+```
+./compare_goldens.sh
+```
+
+The results will depend on the actual device used to generate the golden, therefore if you are using a different device (which is likely), your results may not be the same. This is expected.
+
+# Building Filament from source
+
+```
+git clone git@github.com:nmfisher/filament.git && cd filament
+```
+
+## Android/iOS/MacOS
+
+```
+git checkout flutter-filament-ios-android-macos
+./build.sh -p release
+```
+
+## Windows
+
+To support embedding GPU textures in Flutter (rather than copying to a CPU pixel buffer on every frame), we need to build a slightly customized version of Filament that uses GLES on Windows (rather than the default, which uses OpenGL).
+
+Separately, we also force the Filament gltfio library to load assets via in-memory buffers, rather than the filesystem. This is simply a convenience so we don't have to use different logic for gltf resource loading across platforms.
+
+```
+git checkout flutter-filament-windows
+mkdir out && cd out
+"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --build . --target gltf_viewer --config Debug
+```
+
+Building notes:
+On Android/iOS, we remove -fno-exceptions from CMakeLists.txt
+
+Project structure:
+- most shared code/headers under ios/src (because I still can't get podspec to build a target with symlinks or relative paths)
+- building on MacOS, we currently just delete the macos/include and macos/src directories and copy from iOS (for same reason),
+e.g.
+
+```
+make sync-macos
+```
+
+- Note also need to specifically build imageio/png/tinyexr
+- if release build, then need to comment out -fno-exceptions
+
+# Linux specific
+
+(Fedora 34)
+Building Filament:
+env LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/11/ CC=clang CXX=clang++ CXX_FLAGS="-v" LD_FLAGS="-v" FILAMENT_REQUIRES_CXXABI=true ./build.sh -c release
+
+Running example project:
+export PKG_CONFIG_PATH=/usr/lib/pkgconfig/:/usr/lib64/pkgconfig/ CPLUS_INCLUDE_PATH=/usr/include/gtk-3.0/:/usr/include/pango-1.0/:/usr/include/harfbuzz:/usr/include/cairo/:/usr/include/gdk-pixbuf-2.0/:/usr/include/atk-1.0/
+
+Web:
+
+EMCC_CFLAGS="-Wno-missing-field-initializers -Wno-deprecated-literal-operator -fPIC" ./build.sh -c -p webgl -i debug
+
+EMCC_CFLAGS="-I/Users/nickfisher/Documents/filament/libs/utils/include -I/Users/nickfisher/Documents/filament/libs/image/include -I/Users/nickfisher/Documents/filament/libs/math/include -I../../..//third_party/basisu/encoder/ -I../../..//third_party/libpng/ -I../../..//third_party/tinyexr/ -fPIC" emmake make
+
+
+## Materials
+
+We use a single material (no lighting and no transparency) for background images:
+
+```
+make generate-background-material
+```
+
+# Known issues
+
+## Windows
+
+Loading a glTF (but NOT a glb) may crash due to a race condition between uploading resource data to GPU memory and being freed on the host side. This has been fixed in recent versions of Filament, but other bugs on Windows prevent upgrading. Only workaround is to load a .glb file.
+
+## Android
+In release mode, you must add the following to your `app/build.gradle`:
+
+```
+ buildTypes {
+ release {
+ ...
+ shrinkResources false
+ minifyEnabled false
+ }
+ }
+...
+dependencies {
+ ....
+ implementation 'net.java.dev.jna:jna:5.10.0@aar'
+}
+```
+
+# Thanks
+
+- https://github.com/alexmercerind/flutter-windows-ANGLE-OpenGL-ES
\ No newline at end of file
diff --git a/dart_filament/example_cli/.gitignore b/dart_filament/example_cli/.gitignore
new file mode 100644
index 00000000..3a857904
--- /dev/null
+++ b/dart_filament/example_cli/.gitignore
@@ -0,0 +1,3 @@
+# https://dart.dev/guides/libraries/private-files
+# Created by `dart pub`
+.dart_tool/
diff --git a/dart_filament/example_cli/CHANGELOG.md b/dart_filament/example_cli/CHANGELOG.md
new file mode 100644
index 00000000..effe43c8
--- /dev/null
+++ b/dart_filament/example_cli/CHANGELOG.md
@@ -0,0 +1,3 @@
+## 1.0.0
+
+- Initial version.
diff --git a/dart_filament/example_cli/README.md b/dart_filament/example_cli/README.md
new file mode 100644
index 00000000..3816eca3
--- /dev/null
+++ b/dart_filament/example_cli/README.md
@@ -0,0 +1,2 @@
+A sample command-line application with an entrypoint in `bin/`, library code
+in `lib/`, and example unit test in `test/`.
diff --git a/dart_filament/example_cli/analysis_options.yaml b/dart_filament/example_cli/analysis_options.yaml
new file mode 100644
index 00000000..dee8927a
--- /dev/null
+++ b/dart_filament/example_cli/analysis_options.yaml
@@ -0,0 +1,30 @@
+# This file configures the static analysis results for your project (errors,
+# warnings, and lints).
+#
+# This enables the 'recommended' set of lints from `package:lints`.
+# This set helps identify many issues that may lead to problems when running
+# or consuming Dart code, and enforces writing Dart using a single, idiomatic
+# style and format.
+#
+# If you want a smaller set of lints you can change this to specify
+# 'package:lints/core.yaml'. These are just the most critical lints
+# (the recommended set includes the core lints).
+# The core lints are also what is used by pub.dev for scoring packages.
+
+include: package:lints/recommended.yaml
+
+# Uncomment the following section to specify additional rules.
+
+# linter:
+# rules:
+# - camel_case_types
+
+# analyzer:
+# exclude:
+# - path/to/excluded/files/**
+
+# For more information about the core and recommended set of lints, see
+# https://dart.dev/go/core-lints
+
+# For additional information about configuring this file, see
+# https://dart.dev/guides/language/analysis-options
diff --git a/dart_filament/example_cli/bin/example_cli.dart b/dart_filament/example_cli/bin/example_cli.dart
new file mode 100644
index 00000000..4933dedc
--- /dev/null
+++ b/dart_filament/example_cli/bin/example_cli.dart
@@ -0,0 +1,42 @@
+import 'dart:ffi';
+import 'dart:io';
+import 'package:dart_filament/dart_filament/swift/swift_bindings.g.dart';
+import 'package:dart_filament/dart_filament/utils/dart_resources.dart';
+import 'package:ffi/ffi.dart';
+import 'package:dart_filament/dart_filament.dart';
+import 'package:dart_filament/dart_filament/dart_filament.g.dart';
+
+void main() async {
+ var testDir = File(Platform.script.toFilePath()).parent.path;
+ final lib = DartFilamentTexture1(DynamicLibrary.open(
+ '../native/lib/macos/swift/libdartfilamenttexture.dylib'));
+ final object = DartFilamentTexture.new1(lib);
+ object.initWithWidth_height_(500, 500);
+
+ final resourceLoader = calloc(1);
+ var loadToOut = NativeCallable<
+ Void Function(Pointer,
+ Pointer)>.listener(DartResourceLoader.loadResource);
+
+ resourceLoader.ref.loadToOut = loadToOut.nativeFunction;
+ var freeResource = NativeCallable.listener(
+ DartResourceLoader.freeResource);
+ resourceLoader.ref.freeResource = freeResource.nativeFunction;
+
+ var viewer = FilamentViewer(resourceLoader: resourceLoader);
+
+ await viewer.initialized;
+ await viewer.createSwapChain(500, 500);
+ await viewer.createRenderTarget(500, 500, object.metalTextureAddress);
+ await viewer.updateViewportAndCameraProjection(500, 500);
+
+ var outDir = Directory("$testDir/skybox");
+ outDir.createSync();
+ await viewer.setRecordingOutputDirectory(outDir.path);
+ await viewer.setRecording(true);
+ await viewer.loadSkybox(
+ "file:///$testDir/../../../flutter_filament/example/assets/default_env/default_env_skybox.ktx");
+ await Future.delayed(Duration(milliseconds: 16));
+ await viewer.render();
+ await viewer.dispose();
+}
diff --git a/dart_filament/example_cli/bin/output_000000.png b/dart_filament/example_cli/bin/output_000000.png
new file mode 100644
index 00000000..51bfaab1
Binary files /dev/null and b/dart_filament/example_cli/bin/output_000000.png differ
diff --git a/dart_filament/example_cli/bin/skybox/output_000008.png b/dart_filament/example_cli/bin/skybox/output_000008.png
new file mode 100644
index 00000000..656ea930
Binary files /dev/null and b/dart_filament/example_cli/bin/skybox/output_000008.png differ
diff --git a/dart_filament/example_cli/pubspec.lock b/dart_filament/example_cli/pubspec.lock
new file mode 100644
index 00000000..3ccd55bc
--- /dev/null
+++ b/dart_filament/example_cli/pubspec.lock
@@ -0,0 +1,484 @@
+# Generated by pub
+# See https://dart.dev/tools/pub/glossary#lockfile
+packages:
+ _fe_analyzer_shared:
+ dependency: transitive
+ description:
+ name: _fe_analyzer_shared
+ sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7"
+ url: "https://pub.dev"
+ source: hosted
+ version: "67.0.0"
+ analyzer:
+ dependency: transitive
+ description:
+ name: analyzer
+ sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d"
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.4.1"
+ animation_tools_dart:
+ dependency: transitive
+ description:
+ name: animation_tools_dart
+ sha256: c4bc4096d43227b573345a3ea3cb26c3af47a70af31cd7d7d3a5b7c99e33d615
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.0.2"
+ args:
+ dependency: transitive
+ description:
+ name: args
+ sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.5.0"
+ async:
+ dependency: transitive
+ description:
+ name: async
+ sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.11.0"
+ boolean_selector:
+ dependency: transitive
+ description:
+ name: boolean_selector
+ sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.1.1"
+ cli_config:
+ dependency: transitive
+ description:
+ name: cli_config
+ sha256: ac20a183a07002b700f0c25e61b7ee46b23c309d76ab7b7640a028f18e4d99ec
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.2.0"
+ cli_util:
+ dependency: transitive
+ description:
+ name: cli_util
+ sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.4.1"
+ collection:
+ dependency: transitive
+ description:
+ name: collection
+ sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.18.0"
+ convert:
+ dependency: transitive
+ description:
+ name: convert
+ sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592"
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.1.1"
+ coverage:
+ dependency: transitive
+ description:
+ name: coverage
+ sha256: "8acabb8306b57a409bf4c83522065672ee13179297a6bb0cb9ead73948df7c76"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.7.2"
+ crypto:
+ dependency: transitive
+ description:
+ name: crypto
+ sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.0.3"
+ dart_filament:
+ dependency: "direct main"
+ description:
+ path: ".."
+ relative: true
+ source: path
+ version: "0.5.0"
+ ffi:
+ dependency: "direct main"
+ description:
+ name: ffi
+ sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.1.2"
+ ffigen:
+ dependency: "direct dev"
+ description:
+ name: ffigen
+ sha256: dead012f29db2be71ea152458f5eab600de98fbc244e01088ae6bf2616bceca7
+ url: "https://pub.dev"
+ source: hosted
+ version: "11.0.0"
+ file:
+ dependency: transitive
+ description:
+ name: file
+ sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
+ url: "https://pub.dev"
+ source: hosted
+ version: "7.0.0"
+ frontend_server_client:
+ dependency: transitive
+ description:
+ name: frontend_server_client
+ sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694
+ url: "https://pub.dev"
+ source: hosted
+ version: "4.0.0"
+ glob:
+ dependency: transitive
+ description:
+ name: glob
+ sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.1.2"
+ http_multi_server:
+ dependency: transitive
+ description:
+ name: http_multi_server
+ sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b"
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.2.1"
+ http_parser:
+ dependency: transitive
+ description:
+ name: http_parser
+ sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
+ url: "https://pub.dev"
+ source: hosted
+ version: "4.0.2"
+ io:
+ dependency: transitive
+ description:
+ name: io
+ sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.0.4"
+ js:
+ dependency: transitive
+ description:
+ name: js
+ sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.7.1"
+ lints:
+ dependency: "direct dev"
+ description:
+ name: lints
+ sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.0.0"
+ logging:
+ dependency: transitive
+ description:
+ name: logging
+ sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.2.0"
+ matcher:
+ dependency: transitive
+ description:
+ name: matcher
+ sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.12.16+1"
+ meta:
+ dependency: transitive
+ description:
+ name: meta
+ sha256: "25dfcaf170a0190f47ca6355bdd4552cb8924b430512ff0cafb8db9bd41fe33b"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.14.0"
+ mime:
+ dependency: transitive
+ description:
+ name: mime
+ sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.0.5"
+ native_assets_cli:
+ dependency: "direct dev"
+ description:
+ name: native_assets_cli
+ sha256: "9c1b67ccf85ec9282f34e5348ae78dcb7da2c7dc965c0265306477d977853a0d"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.5.4"
+ native_toolchain_c:
+ dependency: "direct dev"
+ description:
+ name: native_toolchain_c
+ sha256: "1b1b86f47570378d0003f0d949fbb03b637ec9d2dcbcf698a16f7cbffb3a945c"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.4.1"
+ node_preamble:
+ dependency: transitive
+ description:
+ name: node_preamble
+ sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.0.2"
+ package_config:
+ dependency: transitive
+ description:
+ name: package_config
+ sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.1.0"
+ path:
+ dependency: transitive
+ description:
+ name: path
+ sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.9.0"
+ plugin_platform_interface:
+ dependency: transitive
+ description:
+ name: plugin_platform_interface
+ sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.1.8"
+ pool:
+ dependency: transitive
+ description:
+ name: pool
+ sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.5.1"
+ pub_semver:
+ dependency: transitive
+ description:
+ name: pub_semver
+ sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.1.4"
+ quiver:
+ dependency: transitive
+ description:
+ name: quiver
+ sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.2.1"
+ shelf:
+ dependency: transitive
+ description:
+ name: shelf
+ sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.4.1"
+ shelf_packages_handler:
+ dependency: transitive
+ description:
+ name: shelf_packages_handler
+ sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e"
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.0.2"
+ shelf_static:
+ dependency: transitive
+ description:
+ name: shelf_static
+ sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.1.2"
+ shelf_web_socket:
+ dependency: transitive
+ description:
+ name: shelf_web_socket
+ sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.0.4"
+ source_map_stack_trace:
+ dependency: transitive
+ description:
+ name: source_map_stack_trace
+ sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.1.1"
+ source_maps:
+ dependency: transitive
+ description:
+ name: source_maps
+ sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.10.12"
+ source_span:
+ dependency: transitive
+ description:
+ name: source_span
+ sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.10.0"
+ stack_trace:
+ dependency: transitive
+ description:
+ name: stack_trace
+ sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.11.1"
+ stream_channel:
+ dependency: transitive
+ description:
+ name: stream_channel
+ sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.1.2"
+ string_scanner:
+ dependency: transitive
+ description:
+ name: string_scanner
+ sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.2.0"
+ term_glyph:
+ dependency: transitive
+ description:
+ name: term_glyph
+ sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.2.1"
+ test:
+ dependency: "direct dev"
+ description:
+ name: test
+ sha256: d72b538180efcf8413cd2e4e6fcc7ae99c7712e0909eb9223f9da6e6d0ef715f
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.25.4"
+ test_api:
+ dependency: transitive
+ description:
+ name: test_api
+ sha256: "2419f20b0c8677b2d67c8ac4d1ac7372d862dc6c460cdbb052b40155408cd794"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.7.1"
+ test_core:
+ dependency: transitive
+ description:
+ name: test_core
+ sha256: "4d070a6bc36c1c4e89f20d353bfd71dc30cdf2bd0e14349090af360a029ab292"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.6.2"
+ tuple:
+ dependency: transitive
+ description:
+ name: tuple
+ sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.0.2"
+ typed_data:
+ dependency: transitive
+ description:
+ name: typed_data
+ sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.3.2"
+ vector_math:
+ dependency: transitive
+ description:
+ name: vector_math
+ sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.1.4"
+ vm_service:
+ dependency: transitive
+ description:
+ name: vm_service
+ sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
+ url: "https://pub.dev"
+ source: hosted
+ version: "14.2.1"
+ watcher:
+ dependency: transitive
+ description:
+ name: watcher
+ sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.1.0"
+ web:
+ dependency: transitive
+ description:
+ name: web
+ sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.5.1"
+ web_socket_channel:
+ dependency: transitive
+ description:
+ name: web_socket_channel
+ sha256: "58c6666b342a38816b2e7e50ed0f1e261959630becd4c879c4f26bfa14aa5a42"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.4.5"
+ webkit_inspection_protocol:
+ dependency: transitive
+ description:
+ name: webkit_inspection_protocol
+ sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.2.1"
+ yaml:
+ dependency: transitive
+ description:
+ name: yaml
+ sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5"
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.1.2"
+ yaml_edit:
+ dependency: transitive
+ description:
+ name: yaml_edit
+ sha256: c566f4f804215d84a7a2c377667f546c6033d5b34b4f9e60dfb09d17c4e97826
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.2.0"
+sdks:
+ dart: ">=3.5.0-76.0.dev <4.0.0"
diff --git a/dart_filament/example_cli/pubspec.yaml b/dart_filament/example_cli/pubspec.yaml
new file mode 100644
index 00000000..9b126493
--- /dev/null
+++ b/dart_filament/example_cli/pubspec.yaml
@@ -0,0 +1,20 @@
+name: example_cli
+description: A sample command-line application.
+version: 1.0.0
+# repository: https://github.com/my_org/my_repo
+
+environment:
+ sdk: ^3.5.0-76.0.dev
+
+# Add regular dependencies here.
+dependencies:
+ dart_filament:
+ path: ../
+ ffi:
+
+dev_dependencies:
+ ffigen: ^11.0.0
+ lints: ^3.0.0
+ test: ^1.24.0
+ native_assets_cli: ^0.5.0
+ native_toolchain_c: ^0.4.0
diff --git a/dart_filament/example_cli/test/example_cli_test.dart b/dart_filament/example_cli/test/example_cli_test.dart
new file mode 100644
index 00000000..900e362a
--- /dev/null
+++ b/dart_filament/example_cli/test/example_cli_test.dart
@@ -0,0 +1,8 @@
+import 'package:example_cli/example_cli.dart';
+import 'package:test/test.dart';
+
+void main() {
+ test('calculate', () {
+ expect(calculate(), 42);
+ });
+}
diff --git a/dart_filament/hook/build.dart b/dart_filament/hook/build.dart
new file mode 100644
index 00000000..a32bd0c6
--- /dev/null
+++ b/dart_filament/hook/build.dart
@@ -0,0 +1,93 @@
+// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:io';
+
+import 'package:logging/logging.dart';
+import 'package:native_assets_cli/native_assets_cli.dart';
+import 'package:native_toolchain_c/native_toolchain_c.dart';
+
+void main(List args) async {
+ await build(args, (config, output) async {
+ var platform = config.targetOS.toString().toLowerCase();
+ var libDir = "${config.packageRoot.toFilePath()}/native/lib/$platform/";
+
+ final packageName = config.packageName;
+
+ final sources = Directory("${config.packageRoot.toFilePath()}/native/src")
+ .listSync(recursive: true)
+ .whereType()
+ .map((f) => f.path)
+ .toList();
+ sources.addAll([
+ "${config.packageRoot.toFilePath()}/native/include/material/gizmo.c",
+ "${config.packageRoot.toFilePath()}/native/include/material/image.c",
+ ]);
+
+ final cbuilder = CBuilder.library(
+ name: packageName,
+ language: Language.cpp,
+ assetName: 'dart_filament.dart',
+ sources: sources,
+ includes: ['native/include', 'native/include/filament'],
+ flags: [
+ '-mmacosx-version-min=13.0',
+ '-std=c++17',
+ '-framework',
+ 'Foundation',
+ '-framework',
+ 'CoreVideo',
+ '-framework',
+ 'Cocoa',
+ '-framework',
+ 'Metal',
+ "-lfilament",
+ "-lbackend",
+ "-lfilameshio",
+ "-lviewer",
+ "-lfilamat",
+ "-lgeometry",
+ "-lutils",
+ "-lfilabridge",
+ "-lgltfio_core",
+ "-lfilament-iblprefilter",
+ "-limage",
+ "-limageio",
+ "-ltinyexr",
+ "-lgltfio_core",
+ "-lfilaflat",
+ "-ldracodec",
+ "-libl",
+ "-lktxreader",
+ "-lpng",
+ "-lz",
+ "-lstb",
+ "-luberzlib",
+ "-lsmol-v",
+ "-luberarchive",
+ "-lzstd",
+ "-lstdc++",
+ "-lbluegl",
+ "-lbluevk",
+ "-lbasis_transcoder",
+ "-L$libDir",
+ "-force_load",
+ "$libDir/libbackend.a",
+ "-force_load",
+ "$libDir/libktxreader.a",
+ "-force_load",
+ "$libDir/libvkshaders.a",
+ ],
+ dartBuildFiles: ['hook/build.dart'],
+ );
+
+ await cbuilder.run(
+ buildConfig: config,
+ buildOutput: output,
+ logger: Logger('')
+ ..level = Level.ALL
+ ..onRecord.listen((record) => print(record.message)),
+ );
+ });
+}
diff --git a/dart_filament/lib/dart_filament.dart b/dart_filament/lib/dart_filament.dart
new file mode 100644
index 00000000..f14bb692
--- /dev/null
+++ b/dart_filament/lib/dart_filament.dart
@@ -0,0 +1,7 @@
+library filament_dart;
+
+export 'dart_filament/abstract_filament_viewer.dart';
+export 'dart_filament/filament_viewer_impl.dart';
+export 'dart_filament/dart_filament.g.dart';
+
+export 'dart_filament/entities/entity_transform_controller.dart';
diff --git a/lib/filament/filament_controller.dart b/dart_filament/lib/dart_filament/abstract_filament_viewer.dart
similarity index 86%
rename from lib/filament/filament_controller.dart
rename to dart_filament/lib/dart_filament/abstract_filament_viewer.dart
index 8dd4a112..efc98c14 100644
--- a/lib/filament/filament_controller.dart
+++ b/dart_filament/lib/dart_filament/abstract_filament_viewer.dart
@@ -1,18 +1,12 @@
-// ignore_for_file: constant_identifier_names
-
import 'dart:async';
-import 'dart:typed_data';
-import 'dart:ui' as ui;
+import 'dart:ffi';
import 'package:animation_tools_dart/animation_tools_dart.dart';
-import 'package:flutter/widgets.dart';
+import 'package:dart_filament/dart_filament/entities/filament_entity.dart';
+import 'package:dart_filament/dart_filament/entities/gizmo.dart';
-import 'package:flutter_filament/filament/entities/gizmo.dart';
import 'package:vector_math/vector_math_64.dart';
-import 'package:animation_tools_dart/animation_tools_dart.dart';
-
-// a handle that can be safely passed back to the rendering layer to manipulate an Entity
-typedef FilamentEntity = int;
+typedef RenderCallback = Pointer)>>;
// "picking" means clicking/tapping on the viewport, and unprojecting the X/Y coordinate to determine whether any renderable entities were present at those coordinates.
typedef FilamentPickResult = ({FilamentEntity entity, double x, double y});
@@ -44,27 +38,7 @@ class TextureDetails {
{required this.textureId, required this.width, required this.height});
}
-abstract class FilamentController {
- ///
- /// A [ValueNotifier] to indicate whether a FilamentViewer is currently available.
- /// (FilamentViewer is a C++ type, hence why it is not referenced) here.
- /// Call [createViewer]/[destroyViewer] to create/destroy a FilamentViewer.
- ///
- ValueNotifier get hasViewer;
-
- ///
- /// Whether a Flutter Texture widget should be inserted into the widget hierarchy.
- /// This will be false on certain platforms where we use a transparent window underlay.
- /// Used internally by [FilamentWidget]; you probably don't need to access this property directly.
- ///
- bool get requiresTextureWidget;
-
- ///
- /// The Flutter texture ID and dimensions for current texture in use.
- /// This is only used by [FilamentWidget]; you shouldn't need to access directly yourself.
- ///
- final textureDetails = ValueNotifier(null);
-
+abstract class AbstractFilamentViewer {
///
/// The result(s) of calling [pick] (see below).
/// This may be a broadcast stream, so you should ensure you have subscribed to this stream before calling [pick].
@@ -93,41 +67,9 @@ abstract class FilamentController {
Future setFrameRate(int framerate);
///
- /// Destroys the viewer and all backing textures. You can leave the FilamentWidget in the hierarchy after this is called, but you will need to manually call [createViewer] to
+ /// Destroys/disposes the viewer (including the entire scene). You cannot use the viewer after calling this method.
///
- Future destroy();
-
- ///
- /// Destroys the viewer only, leaving the texture intact. You probably want to call [destroy] instead of this; [destroyViewer] is exposed mostly for lifecycle changes which are handled by FilamentWidget.
- ///
- Future destroyViewer();
-
- ///
- /// Destroys the specified backing texture. You probably want to call [destroy] instead of this; this is exposed mostly for lifecycle changes which are handled by FilamentWidget.
- ///
- Future destroyTexture();
-
- ///
- /// Create a FilamentViewer. Must be called at least one frame after a [FilamentWidget] has been inserted into the rendering hierarchy.
- ///
- /// Before a FilamentViewer is created, the FilamentWidget will only contain an empty Container (by default, with a solid red background).
- /// FilamentWidget will then call [setDimensions] with dimensions/pixel ratio of the viewport
- /// Calling [createViewer] will then dispatch a request to the native platform to create a hardware texture (Metal on iOS, OpenGL on Linux, GLES on Android and Windows) and a FilamentViewer (the main interface for manipulating the 3D scene) .
- /// [FilamentWidget] will be notified that a texture is available and will replace the empty Container with a Texture widget
- ///
- Future createViewer();
-
- ///
- /// Sets the dimensions of the viewport and pixel ratio (obtained from [MediaQuery]) to be used the next time [resize] or [createViewer] is called.
- /// This is called by FilamentWidget; you shouldn't need to invoke this manually.
- ///
- Future setDimensions(ui.Rect rect, double pixelRatio);
-
- ///
- /// Resize the viewport & backing texture to the current dimensions (as last set by [setDimensions]).
- /// This is called by FilamentWidget; you shouldn't need to invoke this manually.
- ///
- Future resize();
+ Future dispose();
///
/// Set the background image to [path] (which should have a file extension .png, .jpg, or .ktx).
@@ -151,7 +93,7 @@ abstract class FilamentController {
///
/// Sets the color for the background plane (positioned at the maximum depth, i.e. behind all other objects including the skybox).
///
- Future setBackgroundColor(Color color);
+ Future setBackgroundColor(double r, double g, double b, double alpha);
///
/// Load a skybox from [skyboxPath] (which must be a .ktx file)
@@ -380,7 +322,7 @@ abstract class FilamentController {
///
/// Sets the current scene camera to the glTF camera under [name] in [entity].
///
- Future setCameraFov(double degrees);
+ Future setCameraFov(double degrees, double width, double height);
///
/// Sets the tone mapping (requires postprocessing).
@@ -487,8 +429,8 @@ abstract class FilamentController {
///
/// Sets the `baseColorFactor` property for the material at index [materialIndex] in [entity] under node [meshName] to [color].
///
- Future setMaterialColor(
- FilamentEntity entity, String meshName, int materialIndex, Color color);
+ Future setMaterialColor(FilamentEntity entity, String meshName,
+ int materialIndex, double r, double g, double b, double a);
///
/// Scale [entity] to fit within the unit cube.
@@ -703,5 +645,5 @@ abstract class Scene {
///
/// The transform gizmo.
///
- Gizmo get gizmo;
+ Future get gizmo;
}
diff --git a/dart_filament/lib/dart_filament/dart_filament.g.dart b/dart_filament/lib/dart_filament/dart_filament.g.dart
new file mode 100644
index 00000000..4a490655
--- /dev/null
+++ b/dart_filament/lib/dart_filament/dart_filament.g.dart
@@ -0,0 +1,1705 @@
+// AUTO GENERATED FILE, DO NOT EDIT.
+//
+// Generated by `package:ffigen`.
+// ignore_for_file: type=lint
+import 'dart:ffi' as ffi;
+
+@ffi.Native<
+ ffi.Pointer Function(
+ ffi.Pointer,
+ ffi.Pointer,
+ ffi.Pointer,
+ ffi.Pointer)>(
+ symbol: 'create_filament_viewer',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external ffi.Pointer create_filament_viewer(
+ ffi.Pointer context,
+ ffi.Pointer loader,
+ ffi.Pointer platform,
+ ffi.Pointer uberArchivePath,
+);
+
+@ffi.Native)>(
+ symbol: 'destroy_filament_viewer',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void destroy_filament_viewer(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native Function(ffi.Pointer)>(
+ symbol: 'get_scene_manager',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external ffi.Pointer get_scene_manager(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native<
+ ffi.Void Function(
+ ffi.Pointer, ffi.IntPtr, ffi.Uint32, ffi.Uint32)>(
+ symbol: 'create_render_target',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void create_render_target(
+ ffi.Pointer viewer,
+ int texture,
+ int width,
+ int height,
+);
+
+@ffi.Native)>(
+ symbol: 'clear_background_image',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void clear_background_image(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native<
+ ffi.Void Function(
+ ffi.Pointer, ffi.Pointer, ffi.Bool)>(
+ symbol: 'set_background_image',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void set_background_image(
+ ffi.Pointer viewer,
+ ffi.Pointer path,
+ bool fillHeight,
+);
+
+@ffi.Native<
+ ffi.Void Function(
+ ffi.Pointer, ffi.Float, ffi.Float, ffi.Bool)>(
+ symbol: 'set_background_image_position',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void set_background_image_position(
+ ffi.Pointer viewer,
+ double x,
+ double y,
+ bool clamp,
+);
+
+@ffi.Native<
+ ffi.Void Function(
+ ffi.Pointer, ffi.Float, ffi.Float, ffi.Float, ffi.Float)>(
+ symbol: 'set_background_color',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void set_background_color(
+ ffi.Pointer viewer,
+ double r,
+ double g,
+ double b,
+ double a,
+);
+
+@ffi.Native, ffi.Int)>(
+ symbol: 'set_tone_mapping',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void set_tone_mapping(
+ ffi.Pointer viewer,
+ int toneMapping,
+);
+
+@ffi.Native, ffi.Float)>(
+ symbol: 'set_bloom', assetId: 'package:dart_filament/dart_filament.dart')
+external void set_bloom(
+ ffi.Pointer viewer,
+ double strength,
+);
+
+@ffi.Native, ffi.Pointer)>(
+ symbol: 'load_skybox', assetId: 'package:dart_filament/dart_filament.dart')
+external void load_skybox(
+ ffi.Pointer viewer,
+ ffi.Pointer skyboxPath,
+);
+
+@ffi.Native<
+ ffi.Void Function(
+ ffi.Pointer, ffi.Pointer, ffi.Float)>(
+ symbol: 'load_ibl', assetId: 'package:dart_filament/dart_filament.dart')
+external void load_ibl(
+ ffi.Pointer viewer,
+ ffi.Pointer iblPath,
+ double intensity,
+);
+
+@ffi.Native, ffi.Pointer)>(
+ symbol: 'rotate_ibl', assetId: 'package:dart_filament/dart_filament.dart')
+external void rotate_ibl(
+ ffi.Pointer viewer,
+ ffi.Pointer rotationMatrix,
+);
+
+@ffi.Native)>(
+ symbol: 'remove_skybox',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void remove_skybox(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native)>(
+ symbol: 'remove_ibl', assetId: 'package:dart_filament/dart_filament.dart')
+external void remove_ibl(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native<
+ EntityId Function(
+ ffi.Pointer,
+ ffi.Uint8,
+ ffi.Float,
+ ffi.Float,
+ ffi.Float,
+ ffi.Float,
+ ffi.Float,
+ ffi.Float,
+ ffi.Float,
+ ffi.Float,
+ ffi.Bool)>(
+ symbol: 'add_light', assetId: 'package:dart_filament/dart_filament.dart')
+external int add_light(
+ ffi.Pointer viewer,
+ int type,
+ double colour,
+ double intensity,
+ double posX,
+ double posY,
+ double posZ,
+ double dirX,
+ double dirY,
+ double dirZ,
+ bool shadows,
+);
+
+@ffi.Native, EntityId)>(
+ symbol: 'remove_light', assetId: 'package:dart_filament/dart_filament.dart')
+external void remove_light(
+ ffi.Pointer viewer,
+ int entityId,
+);
+
+@ffi.Native)>(
+ symbol: 'clear_lights', assetId: 'package:dart_filament/dart_filament.dart')
+external void clear_lights(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native<
+ EntityId Function(
+ ffi.Pointer, ffi.Pointer, ffi.Int)>(
+ symbol: 'load_glb', assetId: 'package:dart_filament/dart_filament.dart')
+external int load_glb(
+ ffi.Pointer sceneManager,
+ ffi.Pointer assetPath,
+ int numInstances,
+);
+
+@ffi.Native<
+ EntityId Function(
+ ffi.Pointer, ffi.Pointer, ffi.Size)>(
+ symbol: 'load_glb_from_buffer',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external int load_glb_from_buffer(
+ ffi.Pointer sceneManager,
+ ffi.Pointer data,
+ int length,
+);
+
+@ffi.Native<
+ EntityId Function(ffi.Pointer, ffi.Pointer,
+ ffi.Pointer)>(
+ symbol: 'load_gltf', assetId: 'package:dart_filament/dart_filament.dart')
+external int load_gltf(
+ ffi.Pointer sceneManager,
+ ffi.Pointer assetPath,
+ ffi.Pointer relativePath,
+);
+
+@ffi.Native, EntityId)>(
+ symbol: 'create_instance',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external int create_instance(
+ ffi.Pointer sceneManager,
+ int id,
+);
+
+@ffi.Native, EntityId)>(
+ symbol: 'get_instance_count',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external int get_instance_count(
+ ffi.Pointer sceneManager,
+ int entityId,
+);
+
+@ffi.Native<
+ ffi.Void Function(
+ ffi.Pointer, EntityId, ffi.Pointer)>(
+ symbol: 'get_instances',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void get_instances(
+ ffi.Pointer sceneManager,
+ int entityId,
+ ffi.Pointer out,
+);
+
+@ffi.Native)>(
+ symbol: 'set_main_camera',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void set_main_camera(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native)>(
+ symbol: 'get_main_camera',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external int get_main_camera(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native<
+ ffi.Bool Function(
+ ffi.Pointer, EntityId, ffi.Pointer)>(
+ symbol: 'set_camera', assetId: 'package:dart_filament/dart_filament.dart')
+external bool set_camera(
+ ffi.Pointer viewer,
+ int asset,
+ ffi.Pointer nodeName,
+);
+
+@ffi.Native, ffi.Bool)>(
+ symbol: 'set_view_frustum_culling',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void set_view_frustum_culling(
+ ffi.Pointer viewer,
+ bool enabled,
+);
+
+@ffi.Native<
+ ffi.Void Function(
+ ffi.Pointer,
+ ffi.Uint64,
+ ffi.Pointer,
+ ffi.Pointer<
+ ffi.NativeFunction<
+ ffi.Void Function(ffi.Pointer buf, ffi.Size size,
+ ffi.Pointer data)>>,
+ ffi.Pointer)>(
+ symbol: 'render', assetId: 'package:dart_filament/dart_filament.dart')
+external void render(
+ ffi.Pointer viewer,
+ int frameTimeInNanos,
+ ffi.Pointer pixelBuffer,
+ ffi.Pointer<
+ ffi.NativeFunction<
+ ffi.Void Function(ffi.Pointer buf, ffi.Size size,
+ ffi.Pointer data)>>
+ callback,
+ ffi.Pointer data,
+);
+
+@ffi.Native<
+ ffi.Void Function(ffi.Pointer, ffi.Pointer,
+ ffi.Uint32, ffi.Uint32)>(
+ symbol: 'create_swap_chain',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void create_swap_chain(
+ ffi.Pointer viewer,
+ ffi.Pointer window,
+ int width,
+ int height,
+);
+
+@ffi.Native)>(
+ symbol: 'destroy_swap_chain',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void destroy_swap_chain(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native, ffi.Float)>(
+ symbol: 'set_frame_interval',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void set_frame_interval(
+ ffi.Pointer viewer,
+ double interval,
+);
+
+@ffi.Native<
+ ffi.Void Function(
+ ffi.Pointer, ffi.Uint32, ffi.Uint32, ffi.Float)>(
+ symbol: 'update_viewport_and_camera_projection',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void update_viewport_and_camera_projection(
+ ffi.Pointer viewer,
+ int width,
+ int height,
+ double scaleFactor,
+);
+
+@ffi.Native)>(
+ symbol: 'scroll_begin', assetId: 'package:dart_filament/dart_filament.dart')
+external void scroll_begin(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native<
+ ffi.Void Function(
+ ffi.Pointer, ffi.Float, ffi.Float, ffi.Float)>(
+ symbol: 'scroll_update',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void scroll_update(
+ ffi.Pointer viewer,
+ double x,
+ double y,
+ double z,
+);
+
+@ffi.Native)>(
+ symbol: 'scroll_end', assetId: 'package:dart_filament/dart_filament.dart')
+external void scroll_end(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native<
+ ffi.Void Function(
+ ffi.Pointer, ffi.Float, ffi.Float, ffi.Bool)>(
+ symbol: 'grab_begin', assetId: 'package:dart_filament/dart_filament.dart')
+external void grab_begin(
+ ffi.Pointer viewer,
+ double x,
+ double y,
+ bool pan,
+);
+
+@ffi.Native, ffi.Float, ffi.Float)>(
+ symbol: 'grab_update', assetId: 'package:dart_filament/dart_filament.dart')
+external void grab_update(
+ ffi.Pointer viewer,
+ double x,
+ double y,
+);
+
+@ffi.Native)>(
+ symbol: 'grab_end', assetId: 'package:dart_filament/dart_filament.dart')
+external void grab_end(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native<
+ ffi.Void Function(ffi.Pointer, EntityId,
+ ffi.Pointer, ffi.Pointer, ffi.Int)>(
+ symbol: 'apply_weights',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void apply_weights(
+ ffi.Pointer sceneManager,
+ int asset,
+ ffi.Pointer entityName,
+ ffi.Pointer weights,
+ int count,
+);
+
+@ffi.Native<
+ ffi.Bool Function(
+ ffi.Pointer, EntityId, ffi.Pointer, ffi.Int)>(
+ symbol: 'set_morph_target_weights',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external bool set_morph_target_weights(
+ ffi.Pointer sceneManager,
+ int asset,
+ ffi.Pointer morphData,
+ int numWeights,
+);
+
+@ffi.Native<
+ ffi.Bool Function(
+ ffi.Pointer,
+ EntityId,
+ ffi.Pointer,
+ ffi.Pointer,
+ ffi.Int,
+ ffi.Int,
+ ffi.Float)>(
+ symbol: 'set_morph_animation',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external bool set_morph_animation(
+ ffi.Pointer sceneManager,
+ int asset,
+ ffi.Pointer morphData,
+ ffi.Pointer morphIndices,
+ int numMorphTargets,
+ int numFrames,
+ double frameLengthInMs,
+);
+
+@ffi.Native, EntityId)>(
+ symbol: 'reset_to_rest_pose',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void reset_to_rest_pose(
+ ffi.Pointer sceneManager,
+ int asset,
+);
+
+@ffi.Native<
+ ffi.Void Function(
+ ffi.Pointer,
+ EntityId,
+ ffi.Pointer,
+ ffi.Int,
+ ffi.Pointer,
+ ffi.Pointer>,
+ ffi.Int,
+ ffi.Float,
+ ffi.Bool)>(
+ symbol: 'add_bone_animation',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void add_bone_animation(
+ ffi.Pointer sceneManager,
+ int asset,
+ ffi.Pointer frameData,
+ int numFrames,
+ ffi.Pointer boneName,
+ ffi.Pointer> meshNames,
+ int numMeshTargets,
+ double frameLengthInMs,
+ bool isModelSpace,
+);
+
+@ffi.Native<
+ ffi.Bool Function(
+ ffi.Pointer,
+ EntityId,
+ ffi.Pointer,
+ ffi.Pointer,
+ ffi.Pointer)>(
+ symbol: 'set_bone_transform',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external bool set_bone_transform(
+ ffi.Pointer sceneManager,
+ int asset,
+ ffi.Pointer entityName,
+ ffi.Pointer transform,
+ ffi.Pointer boneName,
+);
+
+@ffi.Native<
+ ffi.Void Function(ffi.Pointer, EntityId, ffi.Int, ffi.Bool,
+ ffi.Bool, ffi.Bool, ffi.Float)>(
+ symbol: 'play_animation',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void play_animation(
+ ffi.Pointer sceneManager,
+ int asset,
+ int index,
+ bool loop,
+ bool reverse,
+ bool replaceActive,
+ double crossfade,
+);
+
+@ffi.Native<
+ ffi.Void Function(ffi.Pointer, EntityId, ffi.Int, ffi.Int)>(
+ symbol: 'set_animation_frame',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void set_animation_frame(
+ ffi.Pointer sceneManager,
+ int asset,
+ int animationIndex,
+ int animationFrame,
+);
+
+@ffi.Native, EntityId, ffi.Int)>(
+ symbol: 'stop_animation',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void stop_animation(
+ ffi.Pointer sceneManager,
+ int asset,
+ int index,
+);
+
+@ffi.Native, EntityId)>(
+ symbol: 'get_animation_count',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external int get_animation_count(
+ ffi.Pointer sceneManager,
+ int asset,
+);
+
+@ffi.Native<
+ ffi.Void Function(
+ ffi.Pointer, EntityId, ffi.Pointer, ffi.Int)>(
+ symbol: 'get_animation_name',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void get_animation_name(
+ ffi.Pointer sceneManager,
+ int asset,
+ ffi.Pointer outPtr,
+ int index,
+);
+
+@ffi.Native, EntityId, ffi.Int)>(
+ symbol: 'get_animation_duration',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external double get_animation_duration(
+ ffi.Pointer sceneManager,
+ int asset,
+ int index,
+);
+
+@ffi.Native<
+ ffi.Void Function(ffi.Pointer, EntityId,
+ ffi.Pointer, ffi.Pointer, ffi.Int)>(
+ symbol: 'get_morph_target_name',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void get_morph_target_name(
+ ffi.Pointer sceneManager,
+ int asset,
+ ffi.Pointer meshName,
+ ffi.Pointer outPtr,
+ int index,
+);
+
+@ffi.Native<
+ ffi.Int Function(
+ ffi.Pointer, EntityId, ffi.Pointer)>(
+ symbol: 'get_morph_target_name_count',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external int get_morph_target_name_count(
+ ffi.Pointer sceneManager,
+ int asset,
+ ffi.Pointer meshName,
+);
+
+@ffi.Native, EntityId)>(
+ symbol: 'remove_entity',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void remove_entity(
+ ffi.Pointer viewer,
+ int asset,
+);
+
+@ffi.Native)>(
+ symbol: 'clear_entities',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void clear_entities(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native<
+ ffi.Bool Function(
+ ffi.Pointer,
+ EntityId,
+ ffi.Pointer,
+ ffi.Int,
+ ffi.Float,
+ ffi.Float,
+ ffi.Float,
+ ffi.Float)>(
+ symbol: 'set_material_color',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external bool set_material_color(
+ ffi.Pointer sceneManager,
+ int asset,
+ ffi.Pointer meshName,
+ int materialIndex,
+ double r,
+ double g,
+ double b,
+ double a,
+);
+
+@ffi.Native, EntityId)>(
+ symbol: 'transform_to_unit_cube',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void transform_to_unit_cube(
+ ffi.Pointer sceneManager,
+ int asset,
+);
+
+@ffi.Native<
+ ffi.Void Function(ffi.Pointer, EntityId, ffi.Float, ffi.Float,
+ ffi.Float, ffi.Bool)>(
+ symbol: 'queue_position_update',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void queue_position_update(
+ ffi.Pointer sceneManager,
+ int asset,
+ double x,
+ double y,
+ double z,
+ bool relative,
+);
+
+@ffi.Native<
+ ffi.Void Function(ffi.Pointer, EntityId, ffi.Float, ffi.Float,
+ ffi.Float, ffi.Float, ffi.Float, ffi.Bool)>(
+ symbol: 'queue_rotation_update',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void queue_rotation_update(
+ ffi.Pointer sceneManager,
+ int asset,
+ double rads,
+ double x,
+ double y,
+ double z,
+ double w,
+ bool relative,
+);
+
+@ffi.Native<
+ ffi.Void Function(
+ ffi.Pointer, EntityId, ffi.Float, ffi.Float, ffi.Float)>(
+ symbol: 'set_position', assetId: 'package:dart_filament/dart_filament.dart')
+external void set_position(
+ ffi.Pointer sceneManager,
+ int asset,
+ double x,
+ double y,
+ double z,
+);
+
+@ffi.Native<
+ ffi.Void Function(ffi.Pointer, EntityId, ffi.Float, ffi.Float,
+ ffi.Float, ffi.Float, ffi.Float)>(
+ symbol: 'set_rotation', assetId: 'package:dart_filament/dart_filament.dart')
+external void set_rotation(
+ ffi.Pointer sceneManager,
+ int asset,
+ double rads,
+ double x,
+ double y,
+ double z,
+ double w,
+);
+
+@ffi.Native, EntityId, ffi.Float)>(
+ symbol: 'set_scale', assetId: 'package:dart_filament/dart_filament.dart')
+external void set_scale(
+ ffi.Pointer sceneManager,
+ int asset,
+ double scale,
+);
+
+@ffi.Native, EntityId)>(
+ symbol: 'move_camera_to_asset',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void move_camera_to_asset(
+ ffi.Pointer viewer,
+ int asset,
+);
+
+@ffi.Native<
+ ffi.Void Function(
+ ffi.Pointer, ffi.Float, ffi.Float, ffi.Float)>(
+ symbol: 'set_camera_exposure',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void set_camera_exposure(
+ ffi.Pointer viewer,
+ double aperture,
+ double shutterSpeed,
+ double sensitivity,
+);
+
+@ffi.Native<
+ ffi.Void Function(
+ ffi.Pointer, ffi.Float, ffi.Float, ffi.Float)>(
+ symbol: 'set_camera_position',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void set_camera_position(
+ ffi.Pointer viewer,
+ double x,
+ double y,
+ double z,
+);
+
+@ffi.Native)>(
+ symbol: 'get_camera_position',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void get_camera_position(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native<
+ ffi.Void Function(
+ ffi.Pointer, ffi.Float, ffi.Float, ffi.Float, ffi.Float)>(
+ symbol: 'set_camera_rotation',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void set_camera_rotation(
+ ffi.Pointer viewer,
+ double w,
+ double x,
+ double y,
+ double z,
+);
+
+@ffi.Native, ffi.Pointer)>(
+ symbol: 'set_camera_model_matrix',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void set_camera_model_matrix(
+ ffi.Pointer viewer,
+ ffi.Pointer matrix,
+);
+
+@ffi.Native Function(ffi.Pointer)>(
+ symbol: 'get_camera_model_matrix',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external ffi.Pointer get_camera_model_matrix(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native Function(ffi.Pointer)>(
+ symbol: 'get_camera_view_matrix',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external ffi.Pointer get_camera_view_matrix(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native Function(ffi.Pointer)>(
+ symbol: 'get_camera_projection_matrix',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external ffi.Pointer get_camera_projection_matrix(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native<
+ ffi.Void Function(ffi.Pointer, ffi.Pointer,
+ ffi.Double, ffi.Double)>(
+ symbol: 'set_camera_projection_matrix',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void set_camera_projection_matrix(
+ ffi.Pointer viewer,
+ ffi.Pointer matrix,
+ double near,
+ double far,
+);
+
+@ffi.Native, ffi.Double, ffi.Double)>(
+ symbol: 'set_camera_culling',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external void set_camera_culling(
+ ffi.Pointer viewer,
+ double near,
+ double far,
+);
+
+@ffi.Native)>(
+ symbol: 'get_camera_culling_near',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external double get_camera_culling_near(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native)>(
+ symbol: 'get_camera_culling_far',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external double get_camera_culling_far(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native Function(ffi.Pointer)>(
+ symbol: 'get_camera_culling_projection_matrix',
+ assetId: 'package:dart_filament/dart_filament.dart')
+external ffi.Pointer get_camera_culling_projection_matrix(
+ ffi.Pointer viewer,
+);
+
+@ffi.Native Function(ffi.Pointer