Compare commits
75 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53b8d352da | ||
|
|
2553d854e9 | ||
|
|
7f9c5a0f2d | ||
|
|
7718885781 | ||
|
|
5bf21ceaf9 | ||
|
|
d3f84f156a | ||
|
|
4fe79e3b92 | ||
|
|
2a5c863506 | ||
|
|
837a2cebc7 | ||
|
|
6ab814114e | ||
|
|
818d75b493 | ||
|
|
390b3d063b | ||
|
|
a0cdbde89f | ||
|
|
4088853705 | ||
|
|
b46cf85c83 | ||
|
|
e71f89e54f | ||
|
|
91d3894c83 | ||
|
|
6cf8e58bed | ||
|
|
025bdf662e | ||
|
|
4ebd5a6645 | ||
|
|
df4f647333 | ||
|
|
b089ddd501 | ||
|
|
57cff7fa47 | ||
|
|
450aacf0cc | ||
|
|
1a71e199aa | ||
|
|
91e50cf0ef | ||
|
|
0276c29d10 | ||
|
|
64309eeb54 | ||
|
|
504cc8ca30 | ||
|
|
28e26a722f | ||
|
|
18274ab14d | ||
|
|
1fe130d77f | ||
|
|
eada8d23bd | ||
|
|
7f107708b5 | ||
|
|
72ec72660d | ||
|
|
6bddc94b3d | ||
|
|
4eebe02f29 | ||
|
|
6327c8063b | ||
|
|
05bc5b122e | ||
|
|
d655672587 | ||
|
|
8358c0b236 | ||
|
|
80388c059d | ||
|
|
3b2d87536a | ||
|
|
1be2367b4f | ||
|
|
08ba9400d3 | ||
|
|
4d827badc4 | ||
|
|
e3408625bc | ||
|
|
78af8e12a0 | ||
|
|
5feaa57d81 | ||
|
|
5fdb420f30 | ||
|
|
f60f8eb4bd | ||
|
|
b7f50df2dc | ||
|
|
2923f5907f | ||
|
|
98bcf5d7ad | ||
|
|
79292914d2 | ||
|
|
a11be5d9ff | ||
|
|
9801fe9777 | ||
|
|
32bff81f53 | ||
|
|
8c82edd3d2 | ||
|
|
e28fb8223a | ||
|
|
135465755d | ||
|
|
d45c211ad8 | ||
|
|
1da0600c11 | ||
|
|
b68c5117b4 | ||
|
|
a37ac79b07 | ||
|
|
45576466c9 | ||
|
|
6980e5cb23 | ||
|
|
c1f8eae85e | ||
|
|
d49b43c191 | ||
|
|
cb7881af09 | ||
|
|
bc0fd6577b | ||
|
|
ba95e5e398 | ||
|
|
eeac96a396 | ||
|
|
af18f18524 | ||
|
|
efbe556d6f |
50
.gitattributes
vendored
50
.gitattributes
vendored
@@ -545,3 +545,53 @@ assets/materials_ios_arm64.uberz filter=lfs diff=lfs merge=lfs -text
|
|||||||
example/assets/shapes/ filter=lfs diff=lfs merge=lfs -text
|
example/assets/shapes/ filter=lfs diff=lfs merge=lfs -text
|
||||||
example/assets/shapes/*.* filter=lfs diff=lfs merge=lfs -text
|
example/assets/shapes/*.* filter=lfs diff=lfs merge=lfs -text
|
||||||
ios/lib/libmikktspace.a filter=lfs diff=lfs merge=lfs -text
|
ios/lib/libmikktspace.a filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/shapes/texture_test.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/BusterDrone/scene.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet/FlightHelmet_baseColor4.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet/FlightHelmet_occlusionRoughnessMetallic.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/default_env filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/BusterDrone/scene.gltf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/shapes/shapes.gltf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet/FlightHelmet_baseColor1.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet/FlightHelmet_baseColor2.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet/FlightHelmet_occlusionRoughnessMetallic2.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/BusterDrone/textures/Boden_normal.jpg filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/BusterDrone/textures/body_baseColor.jpg filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/BusterDrone/textures/body_emissive.jpg filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/BusterDrone/textures/material_baseColor.jpg filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet/FlightHelmet_occlusionRoughnessMetallic3.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/BusterDrone/textures/Boden_metallicRoughness.jpg filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet/FlightHelmet_normal.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet/FlightHelmet_normal1.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet/FlightHelmet_normal3.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet/FlightHelmet.gltf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet/FlightHelmet_occlusionRoughnessMetallic4.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet/README.md filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/background.ktx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/default_env/default_env_skybox.ktx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/shapes/shapes.blend filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/BusterDrone filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/BusterDrone/textures/material_metallicRoughness.jpg filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet/FlightHelmet_normal2.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/background.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/shapes/shapes.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/BusterDrone/textures filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/BusterDrone/textures/body_normal.jpg filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/BusterDrone/textures/material_normal.jpg filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet/FlightHelmet_baseColor.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet/FlightHelmet_normal4.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet/FlightHelmet_occlusionRoughnessMetallic1.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/default_env/default_env_ibl.ktx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/shapes/shapes.glb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/BusterDrone/textures/Boden_baseColor.jpg filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/BusterDrone/textures/body_metallicRoughness.jpg filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet/FlightHelmet.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
example/assets/FlightHelmet/FlightHelmet_baseColor3.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
assets/default.uberz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
windows/lib/**/*.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
windows/lib/Debug/angle/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
windows/lib/Debug/opengl/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
windows/lib/Release/opengl/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
windows/lib/Release/angle/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
windows/lib/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
## 0.0.1
|
## 0.5.0
|
||||||
|
|
||||||
* TODO: Describe initial release.
|
* Replaced `isReadyForScene` Future in `FilamentController` with the `Stream<bool>` `hasViewer`.
|
||||||
|
* Rendering is set to false when the app is hidden, inactive or paused; on resume, this will be set to the value it held prior to being hidden/inactive/paused.
|
||||||
|
|||||||
287
README.md
287
README.md
@@ -1,46 +1,40 @@
|
|||||||
# Flutter Filament
|
# Flutter Filament
|
||||||
|
|
||||||
Cross-platform, Physically-based rendering inside Flutter applications.
|
Cross-platform, 3D PBR rendering and animation for [Flutter](https://github.com/google/filament).
|
||||||
|
|
||||||
Flutter plugin wrapping the Filament renderer https://github.com/google/filament.
|
Wraps the [the Filament rendering library](https://github.com/google/filament).
|
||||||
|
|
||||||
Powers the Polyvox and odd-io engines.
|
Powers the [Polyvox](https://polyvox.app) and [odd-io](https://github.com/odd-io/) engines.
|
||||||
|
|
||||||
# Sponsors
|
This is still in beta: bugs/missing features are to be expected.
|
||||||
|
|
||||||
Thank you to odd-io for sponsoring work on supporting Windows, raycasting, testing and documentation.
|
https://github.com/nmfisher/polyvox_filament/assets/7238578/abaed1c8-c97b-4999-97b2-39e85e0fa7dd
|
||||||
|
|
||||||
# Overview
|
|
||||||
|
|
||||||
## Versioning
|
|Feature|Supported|
|
||||||
|
|---|---|
|
||||||
|
|Platforms|✅ iOS (arm64)<br/>✅ MacOS (arm64)<br/>✅ Android (arm64) <br/>✅ Windows (x64)<br/>⚠️ Linux (x64 - broken)<br/>⚠️ Web (planned)|
|
||||||
|
|Formats|✅ glb <br/>⚠️ glTF (partial - see Known Issues)|
|
||||||
|
|Texture support|✅ PNG <br/>✅ JPEG <br/>✅ KTX <br/>⚠️ KTX2 (planned)|
|
||||||
|
|Camera movement|✅ Desktop (mouse)<br/>✅ Mobile (swipe/pinch)|
|
||||||
|
|Animation|✅ Embedded glTF skinning animations<br/>✅ Embedded glTF morph animations<br/> ✅ Runtime/dynamic morph animations<br/> ⚠️ Runtime/dynamic skinning animations <br/>
|
||||||
|
|Entity manipulation|✅ Viewport selection<br/>⚠️ Entity/transform parenting (planned)<br/> ⚠️ Transform manipulation (mouse/gesture to rotate/translate/scale object) (partial)<br/>⚠️ 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:
|
||||||
|
|
||||||
Last tested on Flutter `3.15.0-15.2.pre`. This is on the Flutter beta channel, so run:
|
|
||||||
```
|
```
|
||||||
flutter channel beta
|
flutter channel beta
|
||||||
flutter upgrade
|
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`).
|
||||||
|
|
||||||
||Android|iOS|MacOS|Windows|Linux|WebGL
|
Next, clone this repository and pull the latest binaries from Git LFS:
|
||||||
|---|---|---|---|---|---||
|
|
||||||
|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.
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
|Feature|Supported|
|
|
||||||
|---|---|
|
|
||||||
|glTF|Y|
|
|
||||||
|glb|Y|
|
|
||||||
|
|
||||||
# Basic Setup
|
|
||||||
|
|
||||||
## Clone flutter_filament
|
|
||||||
|
|
||||||
This plugin is not yet published to pub.dev. To use in your project, simply clone the repository and pull the latest binaries from Git LFS:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
cd $HOME
|
cd $HOME
|
||||||
@@ -48,17 +42,17 @@ git clone <repo> && cd flutter_filament
|
|||||||
git lfs pull
|
git lfs pull
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
(this step won't be needed after the plugin is published to pub.dev).
|
||||||
|
|
||||||
If you want to run the example project to check:
|
> 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 <macos/windows/Your iPhone/etc>
|
cd example && flutter run -d <macos/windows/Your iPhone/etc>
|
||||||
```
|
```
|
||||||
|
|
||||||
## Add dependency
|
To use the plugin in your own project, add the plugin to your pubspec.yaml:
|
||||||
|
|
||||||
Add the plugin as a dependency in the pubspec.yaml for your application:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
name: your_project
|
name: your_project
|
||||||
@@ -71,15 +65,14 @@ dependencies:
|
|||||||
path: <path where you cloned the repository>
|
path: <path where you cloned the repository>
|
||||||
```
|
```
|
||||||
|
|
||||||
# Usage
|
## Basic Usage
|
||||||
|
|
||||||
See the `example` project for a complete sample of the below steps.
|
See the `example` project for a complete sample that incorporates many of the below steps, and more.
|
||||||
|
|
||||||
## Creating the viewport widget and controller
|
### Creating the viewport widget and controller
|
||||||
|
|
||||||
To embed a viewport in your app, create an instance of `FilamentControllerFFI` somewhere in your app:
|
Create an instance of `FilamentControllerFFI` somewhere in your app where it will not be garbage collected until you no longer need a rendering canvas:
|
||||||
|
|
||||||
e.g.
|
|
||||||
```
|
```
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
|
||||||
@@ -88,9 +81,8 @@ class MyApp extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
Constructing this object only load symbols from the native FFI library.
|
|
||||||
|
|
||||||
(Note this is not (yet) a singleton, so ensure it is placed somewhere in the widget hierachy where it will not be garbage-collected until you no longer need a rendering canvas).
|
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. Flutter widgets can be positioned above or below the `FilamentWidget`.
|
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. Flutter widgets can be positioned above or below the `FilamentWidget`.
|
||||||
|
|
||||||
@@ -115,19 +107,52 @@ class MyApp extends StatelessWidget {
|
|||||||
When a `FilamentWidget` is added to the widget hierarchy:
|
When a `FilamentWidget` is added to the widget hierarchy:
|
||||||
1) on the first frame, 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.
|
1) on the first frame, 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 retrieve its actual size and request the `FilamentController` to create:
|
2) on the second frame, `FilamentWidget` will retrieve its actual size and request the `FilamentController` to create:
|
||||||
a) the backing textures needed to insert a `Texture` widget into
|
* the backing textures needed to insert a `Texture` widget into
|
||||||
b) a rendering thread
|
* a rendering thread
|
||||||
c) a `FilamentViewer` and an `AssetManager`, which will allow you to load assets/cameras/lighting/etc via the `FilamentController`
|
* a `FilamentViewer` and an `AssetManager`, which will allow you to load assets/cameras/lighting/etc via the `FilamentController`
|
||||||
|
3) after an indeterminate number of frames, `FilamentController` will notify `FilamentWidget` when a texture is available the viewport
|
||||||
|
4) `FilamentWidget` will replace the default `initial` Widget with the viewport (which will initially be solid black or white, depending on your platform).
|
||||||
|
|
||||||
If this was successful, the viewport should turn from red to black.
|
It's important to note that there *will* be a delay between adding a `FilamentWidget` 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. You can call `await _filamentController.isReadyForScene` if you need to wait until the viewport is actually ready for rendering.
|
||||||
|
|
||||||
### 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.
|
||||||
|
|
||||||
|
### 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.
|
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.
|
||||||
|
|
||||||
To automatically render at 60fps, call `setRendering(true)` on `FilamentController`.
|
```
|
||||||
|
await _filamentController.render()
|
||||||
|
```
|
||||||
|
|
||||||
### Assets
|
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.
|
To add a glTF asset to the scene, call `loadGlb()` on `FilamentController` with the Flutter asset path to your .glb file.
|
||||||
|
|
||||||
@@ -140,19 +165,44 @@ flutter:
|
|||||||
|
|
||||||
Then you would call the following
|
Then you would call the following
|
||||||
```
|
```
|
||||||
var entity = _filamentController.loadGlb("assets/models/bob.glb");
|
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:
|
You can also pass a URI to indicate that the glTF file should be loaded from the filesystem:
|
||||||
```
|
```
|
||||||
var entity = _filamentController.loadGlb("file:///tmp/bob.glb");
|
var entity = await _filamentController.loadGlb("file:///tmp/bob.glb");
|
||||||
```
|
```
|
||||||
|
|
||||||
The returned value is an integer handle that be used to manipulate the asset (better referred to as the "entity") in the scene.
|
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:
|
||||||
|
|
||||||
E.g. to remove the asset:
|
|
||||||
```
|
```
|
||||||
_filamentController.removeAsset(entity);
|
await _filamentController.removeAsset(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 `removeAsset` or `clearAssets`. 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
|
### Camera movement
|
||||||
|
|
||||||
@@ -168,8 +218,7 @@ class MyApp extends StatelessWidget {
|
|||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
home: Scaffold(backgroundColor: Colors.white, body: Stack(children:[
|
home: Scaffold(backgroundColor: Colors.white, body: Stack(children:[
|
||||||
Container(color:Colors.green, height:100, width:100),
|
Positioned.fill(child:FilamentGestureDetector(
|
||||||
Positioned.fill(top:100, left:100,child:FilamentGestureDetector(
|
|
||||||
controller: _filamentController,
|
controller: _filamentController,
|
||||||
child:FilamentWidget(
|
child:FilamentWidget(
|
||||||
controller:_filamentController
|
controller:_filamentController
|
||||||
@@ -180,6 +229,123 @@ class MyApp extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
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<MyApp> {
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
## Releasing your app
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
## 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 <your_device_id>
|
||||||
|
```
|
||||||
|
To run the tests and compare against those goldens:
|
||||||
|
```
|
||||||
|
./compare_goldens.sh <your_device_id>
|
||||||
|
```
|
||||||
|
|
||||||
|
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
|
# Building Filament from source
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -195,9 +361,9 @@ Separately, we also force the Filament gltfio library to load assets via in-memo
|
|||||||
```
|
```
|
||||||
git checkout flutter-filament-windows
|
git checkout flutter-filament-windows
|
||||||
mkdir out && cd out
|
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:
|
Building notes:
|
||||||
On Android/iOS, we remove -fno-exceptions from CMakeLists.txt
|
On Android/iOS, we remove -fno-exceptions from CMakeLists.txt
|
||||||
|
|
||||||
@@ -231,19 +397,16 @@ EMCC_CFLAGS="-I/Users/nickfisher/Documents/filament/libs/utils/include -I/Users/
|
|||||||
|
|
||||||
## Materials
|
## Materials
|
||||||
|
|
||||||
glTF assets The default
|
We use a single material (no lighting and no transparency) for background images:
|
||||||
|
|
||||||
- there is a simple material (unlit/opaque) used for background images. This is created by:
|
|
||||||
```
|
```
|
||||||
filament/out/release/filament/bin/matc -a opengl -a metal -o materials/image.filamat materials/image.mat
|
filament/out/release/filament/bin/matc -a opengl -a metal -o materials/image.filamat materials/image.mat
|
||||||
filament/out/release/filament/bin/resgen -c -p image -x ios/include/material/ materials/image.filamat
|
filament/out/release/filament/bin/resgen -c -p image -x ios/include/material/ materials/image.filamat
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
# Known issues
|
# Known issues
|
||||||
|
|
||||||
On 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.
|
On 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.
|
This has been fixed in recent versions of Filament, but other bugs on Windows prevent upgrading.
|
||||||
|
|
||||||
Only workaround is to load a .glb file.
|
Only workaround is to load a .glb file.
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"allAbis": [
|
|
||||||
"arm64-v8a"
|
|
||||||
],
|
|
||||||
"validAbis": [
|
|
||||||
"ARM64_V8A"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
[]
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"ndkHandlerSupportedAbis": [
|
|
||||||
"ARMEABI_V7A",
|
|
||||||
"ARM64_V8A",
|
|
||||||
"X86",
|
|
||||||
"X86_64"
|
|
||||||
],
|
|
||||||
"ndkHandlerDefaultAbis": [
|
|
||||||
"ARMEABI_V7A",
|
|
||||||
"ARM64_V8A",
|
|
||||||
"X86",
|
|
||||||
"X86_64"
|
|
||||||
],
|
|
||||||
"externalNativeBuildAbiFilters": [],
|
|
||||||
"ndkConfigAbiFilters": [
|
|
||||||
"arm64-v8a"
|
|
||||||
],
|
|
||||||
"splitsFilterAbis": [],
|
|
||||||
"ideBuildOnlyTargetAbi": true
|
|
||||||
}
|
|
||||||
@@ -1,389 +0,0 @@
|
|||||||
# This is the CMakeCache file.
|
|
||||||
# For build in directory: f:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a
|
|
||||||
# It was generated by CMake: C:/Users/Nick/AppData/Local/Android/Sdk/cmake/3.18.1/bin/cmake.exe
|
|
||||||
# You can edit this file to change values found and used by cmake.
|
|
||||||
# If you do not want to change any of the values, simply exit the editor.
|
|
||||||
# If you do want to change a value, simply edit, save, and exit the editor.
|
|
||||||
# The syntax for the file is as follows:
|
|
||||||
# KEY:TYPE=VALUE
|
|
||||||
# KEY is the name of a variable in the cache.
|
|
||||||
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
|
|
||||||
# VALUE is the current value for the KEY.
|
|
||||||
|
|
||||||
########################
|
|
||||||
# EXTERNAL cache entries
|
|
||||||
########################
|
|
||||||
|
|
||||||
//No help, variable specified on the command line.
|
|
||||||
ANDROID_ABI:UNINITIALIZED=arm64-v8a
|
|
||||||
|
|
||||||
//No help, variable specified on the command line.
|
|
||||||
ANDROID_NDK:UNINITIALIZED=C:\Users\Nick\AppData\Local\Android\Sdk\ndk\25.2.9519653
|
|
||||||
|
|
||||||
//No help, variable specified on the command line.
|
|
||||||
ANDROID_PLATFORM:UNINITIALIZED=android-22
|
|
||||||
|
|
||||||
//Path to a program.
|
|
||||||
CMAKE_ADDR2LINE:FILEPATH=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-addr2line.exe
|
|
||||||
|
|
||||||
//No help, variable specified on the command line.
|
|
||||||
CMAKE_ANDROID_ARCH_ABI:UNINITIALIZED=arm64-v8a
|
|
||||||
|
|
||||||
//No help, variable specified on the command line.
|
|
||||||
CMAKE_ANDROID_NDK:UNINITIALIZED=C:\Users\Nick\AppData\Local\Android\Sdk\ndk\25.2.9519653
|
|
||||||
|
|
||||||
//Archiver
|
|
||||||
CMAKE_AR:FILEPATH=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ar.exe
|
|
||||||
|
|
||||||
//Flags used by the compiler during all build types.
|
|
||||||
CMAKE_ASM_FLAGS:STRING=
|
|
||||||
|
|
||||||
//Flags used by the compiler during debug builds.
|
|
||||||
CMAKE_ASM_FLAGS_DEBUG:STRING=
|
|
||||||
|
|
||||||
//Flags used by the compiler during release builds.
|
|
||||||
CMAKE_ASM_FLAGS_RELEASE:STRING=
|
|
||||||
|
|
||||||
//Choose the type of build, options are: None Debug Release RelWithDebInfo
|
|
||||||
// MinSizeRel ...
|
|
||||||
CMAKE_BUILD_TYPE:STRING=Debug
|
|
||||||
|
|
||||||
//LLVM archiver
|
|
||||||
CMAKE_CXX_COMPILER_AR:FILEPATH=CMAKE_CXX_COMPILER_AR-NOTFOUND
|
|
||||||
|
|
||||||
//Generate index for LLVM archive
|
|
||||||
CMAKE_CXX_COMPILER_RANLIB:FILEPATH=CMAKE_CXX_COMPILER_RANLIB-NOTFOUND
|
|
||||||
|
|
||||||
//Flags used by the compiler during all build types.
|
|
||||||
CMAKE_CXX_FLAGS:STRING=
|
|
||||||
|
|
||||||
//Flags used by the compiler during debug builds.
|
|
||||||
CMAKE_CXX_FLAGS_DEBUG:STRING=
|
|
||||||
|
|
||||||
//Flags used by the CXX compiler during MINSIZEREL builds.
|
|
||||||
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
|
|
||||||
|
|
||||||
//Flags used by the compiler during release builds.
|
|
||||||
CMAKE_CXX_FLAGS_RELEASE:STRING=
|
|
||||||
|
|
||||||
//Flags used by the CXX compiler during RELWITHDEBINFO builds.
|
|
||||||
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
|
|
||||||
|
|
||||||
//Libraries linked by default with all C++ applications.
|
|
||||||
CMAKE_CXX_STANDARD_LIBRARIES:STRING=-latomic -lm
|
|
||||||
|
|
||||||
//LLVM archiver
|
|
||||||
CMAKE_C_COMPILER_AR:FILEPATH=CMAKE_C_COMPILER_AR-NOTFOUND
|
|
||||||
|
|
||||||
//Generate index for LLVM archive
|
|
||||||
CMAKE_C_COMPILER_RANLIB:FILEPATH=CMAKE_C_COMPILER_RANLIB-NOTFOUND
|
|
||||||
|
|
||||||
//Flags used by the compiler during all build types.
|
|
||||||
CMAKE_C_FLAGS:STRING=
|
|
||||||
|
|
||||||
//Flags used by the compiler during debug builds.
|
|
||||||
CMAKE_C_FLAGS_DEBUG:STRING=
|
|
||||||
|
|
||||||
//Flags used by the C compiler during MINSIZEREL builds.
|
|
||||||
CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
|
|
||||||
|
|
||||||
//Flags used by the compiler during release builds.
|
|
||||||
CMAKE_C_FLAGS_RELEASE:STRING=
|
|
||||||
|
|
||||||
//Flags used by the C compiler during RELWITHDEBINFO builds.
|
|
||||||
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
|
|
||||||
|
|
||||||
//Libraries linked by default with all C applications.
|
|
||||||
CMAKE_C_STANDARD_LIBRARIES:STRING=-latomic -lm
|
|
||||||
|
|
||||||
//Path to a program.
|
|
||||||
CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND
|
|
||||||
|
|
||||||
//Flags used by the linker.
|
|
||||||
CMAKE_EXE_LINKER_FLAGS:STRING=
|
|
||||||
|
|
||||||
//Flags used by the linker during DEBUG builds.
|
|
||||||
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
|
|
||||||
|
|
||||||
//Flags used by the linker during MINSIZEREL builds.
|
|
||||||
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
|
|
||||||
|
|
||||||
//Flags used by the linker during RELEASE builds.
|
|
||||||
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
|
|
||||||
|
|
||||||
//Flags used by the linker during RELWITHDEBINFO builds.
|
|
||||||
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
|
||||||
|
|
||||||
//No help, variable specified on the command line.
|
|
||||||
CMAKE_EXPORT_COMPILE_COMMANDS:UNINITIALIZED=ON
|
|
||||||
|
|
||||||
//No help, variable specified on the command line.
|
|
||||||
CMAKE_FIND_ROOT_PATH:UNINITIALIZED=F:\Projects\polyvox\polyvox_filament\android\.cxx\cmake\debug\prefab\arm64-v8a\prefab
|
|
||||||
|
|
||||||
//Install path prefix, prepended onto install directories.
|
|
||||||
CMAKE_INSTALL_PREFIX:PATH=C:/Program Files (x86)/Project
|
|
||||||
|
|
||||||
//No help, variable specified on the command line.
|
|
||||||
CMAKE_LIBRARY_OUTPUT_DIRECTORY:UNINITIALIZED=F:\Projects\polyvox\polyvox_filament\example\build\polyvox_filament\intermediates\cmake\debug\obj\arm64-v8a
|
|
||||||
|
|
||||||
//Path to a program.
|
|
||||||
CMAKE_LINKER:FILEPATH=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/ld.lld.exe
|
|
||||||
|
|
||||||
//No help, variable specified on the command line.
|
|
||||||
CMAKE_MAKE_PROGRAM:UNINITIALIZED=C:\Users\Nick\AppData\Local\Android\Sdk\cmake\3.18.1\bin\ninja.exe
|
|
||||||
|
|
||||||
//Flags used by the linker during the creation of modules.
|
|
||||||
CMAKE_MODULE_LINKER_FLAGS:STRING=
|
|
||||||
|
|
||||||
//Flags used by the linker during the creation of modules during
|
|
||||||
// DEBUG builds.
|
|
||||||
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
|
|
||||||
|
|
||||||
//Flags used by the linker during the creation of modules during
|
|
||||||
// MINSIZEREL builds.
|
|
||||||
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
|
|
||||||
|
|
||||||
//Flags used by the linker during the creation of modules during
|
|
||||||
// RELEASE builds.
|
|
||||||
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
|
|
||||||
|
|
||||||
//Flags used by the linker during the creation of modules during
|
|
||||||
// RELWITHDEBINFO builds.
|
|
||||||
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
|
||||||
|
|
||||||
//Path to a program.
|
|
||||||
CMAKE_NM:FILEPATH=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-nm.exe
|
|
||||||
|
|
||||||
//Path to a program.
|
|
||||||
CMAKE_OBJCOPY:FILEPATH=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-objcopy.exe
|
|
||||||
|
|
||||||
//Path to a program.
|
|
||||||
CMAKE_OBJDUMP:FILEPATH=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-objdump.exe
|
|
||||||
|
|
||||||
//Value Computed by CMake
|
|
||||||
CMAKE_PROJECT_DESCRIPTION:STATIC=
|
|
||||||
|
|
||||||
//Value Computed by CMake
|
|
||||||
CMAKE_PROJECT_HOMEPAGE_URL:STATIC=
|
|
||||||
|
|
||||||
//Value Computed by CMake
|
|
||||||
CMAKE_PROJECT_NAME:STATIC=Project
|
|
||||||
|
|
||||||
//Ranlib
|
|
||||||
CMAKE_RANLIB:FILEPATH=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ranlib.exe
|
|
||||||
|
|
||||||
//Path to a program.
|
|
||||||
CMAKE_READELF:FILEPATH=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-readelf.exe
|
|
||||||
|
|
||||||
//Flags used by the linker during the creation of dll's.
|
|
||||||
CMAKE_SHARED_LINKER_FLAGS:STRING=
|
|
||||||
|
|
||||||
//Flags used by the linker during the creation of shared libraries
|
|
||||||
// during DEBUG builds.
|
|
||||||
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
|
|
||||||
|
|
||||||
//Flags used by the linker during the creation of shared libraries
|
|
||||||
// during MINSIZEREL builds.
|
|
||||||
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
|
|
||||||
|
|
||||||
//Flags used by the linker during the creation of shared libraries
|
|
||||||
// during RELEASE builds.
|
|
||||||
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
|
|
||||||
|
|
||||||
//Flags used by the linker during the creation of shared libraries
|
|
||||||
// during RELWITHDEBINFO builds.
|
|
||||||
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
|
||||||
|
|
||||||
//If set, runtime paths are not added when installing shared libraries,
|
|
||||||
// but are added when building.
|
|
||||||
CMAKE_SKIP_INSTALL_RPATH:BOOL=NO
|
|
||||||
|
|
||||||
//If set, runtime paths are not added when using shared libraries.
|
|
||||||
CMAKE_SKIP_RPATH:BOOL=NO
|
|
||||||
|
|
||||||
//Flags used by the linker during the creation of static libraries
|
|
||||||
// during all build types.
|
|
||||||
CMAKE_STATIC_LINKER_FLAGS:STRING=
|
|
||||||
|
|
||||||
//Flags used by the linker during the creation of static libraries
|
|
||||||
// during DEBUG builds.
|
|
||||||
CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=
|
|
||||||
|
|
||||||
//Flags used by the linker during the creation of static libraries
|
|
||||||
// during MINSIZEREL builds.
|
|
||||||
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=
|
|
||||||
|
|
||||||
//Flags used by the linker during the creation of static libraries
|
|
||||||
// during RELEASE builds.
|
|
||||||
CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=
|
|
||||||
|
|
||||||
//Flags used by the linker during the creation of static libraries
|
|
||||||
// during RELWITHDEBINFO builds.
|
|
||||||
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
|
||||||
|
|
||||||
//Strip
|
|
||||||
CMAKE_STRIP:FILEPATH=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-strip.exe
|
|
||||||
|
|
||||||
//No help, variable specified on the command line.
|
|
||||||
CMAKE_SYSTEM_NAME:UNINITIALIZED=Android
|
|
||||||
|
|
||||||
//No help, variable specified on the command line.
|
|
||||||
CMAKE_SYSTEM_VERSION:UNINITIALIZED=22
|
|
||||||
|
|
||||||
//The CMake toolchain file
|
|
||||||
CMAKE_TOOLCHAIN_FILE:FILEPATH=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/build/cmake/android.toolchain.cmake
|
|
||||||
|
|
||||||
//If this value is on, makefiles will be generated without the
|
|
||||||
// .SILENT directive, and all commands will be echoed to the console
|
|
||||||
// during the make. This is useful for debugging only. With Visual
|
|
||||||
// Studio IDE projects all commands are done without /nologo.
|
|
||||||
CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
|
|
||||||
|
|
||||||
//Value Computed by CMake
|
|
||||||
Project_BINARY_DIR:STATIC=F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a
|
|
||||||
|
|
||||||
//Value Computed by CMake
|
|
||||||
Project_SOURCE_DIR:STATIC=F:/Projects/polyvox/polyvox_filament/android
|
|
||||||
|
|
||||||
//Dependencies for the target
|
|
||||||
polyvox_filament_android_LIB_DEPENDS:STATIC=general;FILAMENT_SHADERS;general;-landroid;general;-llog;general;-lgltfio_core;general;-lfilament;general;-lbackend;general;-lgeometry;general;-lfilameshio;general;-lfilamat;general;-lfilabridge;general;-lfilament-iblprefilter;general;-lcamutils;general;-lfilaflat;general;-ldracodec;general;-libl;general;-lktxreader;general;-limageio;general;-limage;general;-lutils;general;-ltinyexr;general;-lstb;general;-lbluevk;general;-lvkshaders;general;-luberzlib;general;-lsmol-v;general;-luberarchive;general;-lmeshoptimizer;general;-lgeometry;general;-lbasis_transcoder;general;-lEGL;general;-lGLESv3;general;-lpng;general;-lz;general;-lzstd;
|
|
||||||
|
|
||||||
|
|
||||||
########################
|
|
||||||
# INTERNAL cache entries
|
|
||||||
########################
|
|
||||||
|
|
||||||
//ADVANCED property for variable: CMAKE_ADDR2LINE
|
|
||||||
CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_AR
|
|
||||||
CMAKE_AR-ADVANCED:INTERNAL=1
|
|
||||||
//This is the directory where this CMakeCache.txt was created
|
|
||||||
CMAKE_CACHEFILE_DIR:INTERNAL=f:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a
|
|
||||||
//Major version of cmake used to create the current loaded cache
|
|
||||||
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
|
|
||||||
//Minor version of cmake used to create the current loaded cache
|
|
||||||
CMAKE_CACHE_MINOR_VERSION:INTERNAL=18
|
|
||||||
//Patch version of cmake used to create the current loaded cache
|
|
||||||
CMAKE_CACHE_PATCH_VERSION:INTERNAL=1
|
|
||||||
//Path to CMake executable.
|
|
||||||
CMAKE_COMMAND:INTERNAL=C:/Users/Nick/AppData/Local/Android/Sdk/cmake/3.18.1/bin/cmake.exe
|
|
||||||
//Path to cpack program executable.
|
|
||||||
CMAKE_CPACK_COMMAND:INTERNAL=C:/Users/Nick/AppData/Local/Android/Sdk/cmake/3.18.1/bin/cpack.exe
|
|
||||||
//Path to ctest program executable.
|
|
||||||
CMAKE_CTEST_COMMAND:INTERNAL=C:/Users/Nick/AppData/Local/Android/Sdk/cmake/3.18.1/bin/ctest.exe
|
|
||||||
//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR
|
|
||||||
CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB
|
|
||||||
CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_CXX_FLAGS
|
|
||||||
CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG
|
|
||||||
CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL
|
|
||||||
CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE
|
|
||||||
CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
|
||||||
CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_CXX_STANDARD_LIBRARIES
|
|
||||||
CMAKE_CXX_STANDARD_LIBRARIES-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_C_COMPILER_AR
|
|
||||||
CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB
|
|
||||||
CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_C_FLAGS
|
|
||||||
CMAKE_C_FLAGS-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG
|
|
||||||
CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL
|
|
||||||
CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE
|
|
||||||
CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO
|
|
||||||
CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_C_STANDARD_LIBRARIES
|
|
||||||
CMAKE_C_STANDARD_LIBRARIES-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_DLLTOOL
|
|
||||||
CMAKE_DLLTOOL-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS
|
|
||||||
CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG
|
|
||||||
CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
|
|
||||||
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE
|
|
||||||
CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
|
|
||||||
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
|
||||||
//Name of external makefile project generator.
|
|
||||||
CMAKE_EXTRA_GENERATOR:INTERNAL=
|
|
||||||
//Name of generator.
|
|
||||||
CMAKE_GENERATOR:INTERNAL=Ninja
|
|
||||||
//Generator instance identifier.
|
|
||||||
CMAKE_GENERATOR_INSTANCE:INTERNAL=
|
|
||||||
//Name of generator platform.
|
|
||||||
CMAKE_GENERATOR_PLATFORM:INTERNAL=
|
|
||||||
//Name of generator toolset.
|
|
||||||
CMAKE_GENERATOR_TOOLSET:INTERNAL=
|
|
||||||
//Source directory with the top level CMakeLists.txt file for this
|
|
||||||
// project
|
|
||||||
CMAKE_HOME_DIRECTORY:INTERNAL=F:/Projects/polyvox/polyvox_filament/android
|
|
||||||
//Install .so files without execute permission.
|
|
||||||
CMAKE_INSTALL_SO_NO_EXE:INTERNAL=0
|
|
||||||
//ADVANCED property for variable: CMAKE_LINKER
|
|
||||||
CMAKE_LINKER-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS
|
|
||||||
CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG
|
|
||||||
CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
|
|
||||||
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE
|
|
||||||
CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
|
|
||||||
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_NM
|
|
||||||
CMAKE_NM-ADVANCED:INTERNAL=1
|
|
||||||
//number of local generators
|
|
||||||
CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_OBJCOPY
|
|
||||||
CMAKE_OBJCOPY-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_OBJDUMP
|
|
||||||
CMAKE_OBJDUMP-ADVANCED:INTERNAL=1
|
|
||||||
//Platform information initialized
|
|
||||||
CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_RANLIB
|
|
||||||
CMAKE_RANLIB-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_READELF
|
|
||||||
CMAKE_READELF-ADVANCED:INTERNAL=1
|
|
||||||
//Path to CMake installation.
|
|
||||||
CMAKE_ROOT:INTERNAL=C:/Users/Nick/AppData/Local/Android/Sdk/cmake/3.18.1/share/cmake-3.18
|
|
||||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS
|
|
||||||
CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG
|
|
||||||
CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
|
|
||||||
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE
|
|
||||||
CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
|
|
||||||
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH
|
|
||||||
CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_SKIP_RPATH
|
|
||||||
CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS
|
|
||||||
CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG
|
|
||||||
CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
|
|
||||||
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE
|
|
||||||
CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
|
|
||||||
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_STRIP
|
|
||||||
CMAKE_STRIP-ADVANCED:INTERNAL=1
|
|
||||||
//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE
|
|
||||||
CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1
|
|
||||||
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
set(CMAKE_C_COMPILER "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe")
|
|
||||||
set(CMAKE_C_COMPILER_ARG1 "")
|
|
||||||
set(CMAKE_C_COMPILER_ID "Clang")
|
|
||||||
set(CMAKE_C_COMPILER_VERSION "14.0.7")
|
|
||||||
set(CMAKE_C_COMPILER_VERSION_INTERNAL "")
|
|
||||||
set(CMAKE_C_COMPILER_WRAPPER "")
|
|
||||||
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "11")
|
|
||||||
set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert")
|
|
||||||
set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes")
|
|
||||||
set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros")
|
|
||||||
set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert")
|
|
||||||
|
|
||||||
set(CMAKE_C_PLATFORM_ID "")
|
|
||||||
set(CMAKE_C_SIMULATE_ID "")
|
|
||||||
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "GNU")
|
|
||||||
set(CMAKE_C_SIMULATE_VERSION "")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_AR "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ar.exe")
|
|
||||||
set(CMAKE_C_COMPILER_AR "CMAKE_C_COMPILER_AR-NOTFOUND")
|
|
||||||
set(CMAKE_RANLIB "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ranlib.exe")
|
|
||||||
set(CMAKE_C_COMPILER_RANLIB "CMAKE_C_COMPILER_RANLIB-NOTFOUND")
|
|
||||||
set(CMAKE_LINKER "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/ld.lld.exe")
|
|
||||||
set(CMAKE_MT "")
|
|
||||||
set(CMAKE_COMPILER_IS_GNUCC )
|
|
||||||
set(CMAKE_C_COMPILER_LOADED 1)
|
|
||||||
set(CMAKE_C_COMPILER_WORKS TRUE)
|
|
||||||
set(CMAKE_C_ABI_COMPILED TRUE)
|
|
||||||
set(CMAKE_COMPILER_IS_MINGW )
|
|
||||||
set(CMAKE_COMPILER_IS_CYGWIN )
|
|
||||||
if(CMAKE_COMPILER_IS_CYGWIN)
|
|
||||||
set(CYGWIN 1)
|
|
||||||
set(UNIX 1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_C_COMPILER_ENV_VAR "CC")
|
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_MINGW)
|
|
||||||
set(MINGW 1)
|
|
||||||
endif()
|
|
||||||
set(CMAKE_C_COMPILER_ID_RUN 1)
|
|
||||||
set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
|
|
||||||
set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
|
||||||
set(CMAKE_C_LINKER_PREFERENCE 10)
|
|
||||||
|
|
||||||
# Save compiler ABI information.
|
|
||||||
set(CMAKE_C_SIZEOF_DATA_PTR "8")
|
|
||||||
set(CMAKE_C_COMPILER_ABI "ELF")
|
|
||||||
set(CMAKE_C_LIBRARY_ARCHITECTURE "")
|
|
||||||
|
|
||||||
if(CMAKE_C_SIZEOF_DATA_PTR)
|
|
||||||
set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_C_COMPILER_ABI)
|
|
||||||
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_C_LIBRARY_ARCHITECTURE)
|
|
||||||
set(CMAKE_LIBRARY_ARCHITECTURE "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "")
|
|
||||||
if(CMAKE_C_CL_SHOWINCLUDES_PREFIX)
|
|
||||||
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include")
|
|
||||||
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "-l:libunwind.a;dl;c;-l:libunwind.a;dl")
|
|
||||||
set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/aarch64;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib")
|
|
||||||
set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
set(CMAKE_CXX_COMPILER "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe")
|
|
||||||
set(CMAKE_CXX_COMPILER_ARG1 "")
|
|
||||||
set(CMAKE_CXX_COMPILER_ID "Clang")
|
|
||||||
set(CMAKE_CXX_COMPILER_VERSION "14.0.7")
|
|
||||||
set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "")
|
|
||||||
set(CMAKE_CXX_COMPILER_WRAPPER "")
|
|
||||||
set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "14")
|
|
||||||
set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20")
|
|
||||||
set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters")
|
|
||||||
set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates")
|
|
||||||
set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates")
|
|
||||||
set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17")
|
|
||||||
set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20")
|
|
||||||
|
|
||||||
set(CMAKE_CXX_PLATFORM_ID "")
|
|
||||||
set(CMAKE_CXX_SIMULATE_ID "")
|
|
||||||
set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "GNU")
|
|
||||||
set(CMAKE_CXX_SIMULATE_VERSION "")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_AR "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ar.exe")
|
|
||||||
set(CMAKE_CXX_COMPILER_AR "CMAKE_CXX_COMPILER_AR-NOTFOUND")
|
|
||||||
set(CMAKE_RANLIB "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ranlib.exe")
|
|
||||||
set(CMAKE_CXX_COMPILER_RANLIB "CMAKE_CXX_COMPILER_RANLIB-NOTFOUND")
|
|
||||||
set(CMAKE_LINKER "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/ld.lld.exe")
|
|
||||||
set(CMAKE_MT "")
|
|
||||||
set(CMAKE_COMPILER_IS_GNUCXX )
|
|
||||||
set(CMAKE_CXX_COMPILER_LOADED 1)
|
|
||||||
set(CMAKE_CXX_COMPILER_WORKS TRUE)
|
|
||||||
set(CMAKE_CXX_ABI_COMPILED TRUE)
|
|
||||||
set(CMAKE_COMPILER_IS_MINGW )
|
|
||||||
set(CMAKE_COMPILER_IS_CYGWIN )
|
|
||||||
if(CMAKE_COMPILER_IS_CYGWIN)
|
|
||||||
set(CYGWIN 1)
|
|
||||||
set(UNIX 1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
|
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_MINGW)
|
|
||||||
set(MINGW 1)
|
|
||||||
endif()
|
|
||||||
set(CMAKE_CXX_COMPILER_ID_RUN 1)
|
|
||||||
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP)
|
|
||||||
set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
|
||||||
|
|
||||||
foreach (lang C OBJC OBJCXX)
|
|
||||||
if (CMAKE_${lang}_COMPILER_ID_RUN)
|
|
||||||
foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS)
|
|
||||||
list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension})
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
set(CMAKE_CXX_LINKER_PREFERENCE 30)
|
|
||||||
set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
|
|
||||||
|
|
||||||
# Save compiler ABI information.
|
|
||||||
set(CMAKE_CXX_SIZEOF_DATA_PTR "8")
|
|
||||||
set(CMAKE_CXX_COMPILER_ABI "ELF")
|
|
||||||
set(CMAKE_CXX_LIBRARY_ARCHITECTURE "")
|
|
||||||
|
|
||||||
if(CMAKE_CXX_SIZEOF_DATA_PTR)
|
|
||||||
set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ABI)
|
|
||||||
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CXX_LIBRARY_ARCHITECTURE)
|
|
||||||
set(CMAKE_LIBRARY_ARCHITECTURE "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "")
|
|
||||||
if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX)
|
|
||||||
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include")
|
|
||||||
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "c++;m;-l:libunwind.a;dl;c;-l:libunwind.a;dl")
|
|
||||||
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/aarch64;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib")
|
|
||||||
set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1,15 +0,0 @@
|
|||||||
set(CMAKE_HOST_SYSTEM "Windows-10.0.19045")
|
|
||||||
set(CMAKE_HOST_SYSTEM_NAME "Windows")
|
|
||||||
set(CMAKE_HOST_SYSTEM_VERSION "10.0.19045")
|
|
||||||
set(CMAKE_HOST_SYSTEM_PROCESSOR "AMD64")
|
|
||||||
|
|
||||||
include("C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/build/cmake/android.toolchain.cmake")
|
|
||||||
|
|
||||||
set(CMAKE_SYSTEM "Android-1")
|
|
||||||
set(CMAKE_SYSTEM_NAME "Android")
|
|
||||||
set(CMAKE_SYSTEM_VERSION "1")
|
|
||||||
set(CMAKE_SYSTEM_PROCESSOR "aarch64")
|
|
||||||
|
|
||||||
set(CMAKE_CROSSCOMPILING "TRUE")
|
|
||||||
|
|
||||||
set(CMAKE_SYSTEM_LOADED 1)
|
|
||||||
@@ -1,242 +0,0 @@
|
|||||||
The target system is: Android - 1 - aarch64
|
|
||||||
The host system is: Windows - 10.0.19045 - AMD64
|
|
||||||
Detecting C compiler ABI info compiled with the following output:
|
|
||||||
Change Dir: F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/CMakeTmp
|
|
||||||
|
|
||||||
Run Build Command(s):C:\Users\Nick\AppData\Local\Android\Sdk\cmake\3.18.1\bin\ninja.exe cmTC_ad214 && [1/2] Building C object CMakeFiles/cmTC_ad214.dir/CMakeCCompilerABI.c.o
|
|
||||||
|
|
||||||
Android (9352603, based on r450784d1) clang version 14.0.7 (https://android.googlesource.com/toolchain/llvm-project 4c603efb0cca074e9238af8b4106c30add4418f6)
|
|
||||||
|
|
||||||
Target: aarch64-none-linux-android22
|
|
||||||
|
|
||||||
Thread model: posix
|
|
||||||
|
|
||||||
InstalledDir: C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin
|
|
||||||
|
|
||||||
(in-process)
|
|
||||||
|
|
||||||
"C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe" -cc1 -triple aarch64-none-linux-android22 -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name CMakeCCompilerABI.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=non-leaf -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu generic -target-feature +neon -target-feature +v8a -target-feature +fix-cortex-a53-835769 -target-abi aapcs -fallow-half-arguments-and-returns -mllvm -treat-scalable-fixed-error-as-warning -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -v -ffunction-sections -fdata-sections -fcoverage-compilation-dir=F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/CMakeTmp -resource-dir C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7 -dependency-file "CMakeFiles\\cmTC_ad214.dir\\CMakeCCompilerABI.c.o.d" -MT CMakeFiles/cmTC_ad214.dir/CMakeCCompilerABI.c.o -sys-header-deps -D ANDROID -D _FORTIFY_SOURCE=2 -isysroot C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -internal-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include -internal-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include -internal-externc-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android -internal-externc-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/include -internal-externc-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include -Wformat -fdebug-compilation-dir=F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/CMakeTmp -ferror-limit 19 -stack-protector 2 -fno-signed-char -fgnuc-version=4.2.1 -target-feature +outline-atomics -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/cmTC_ad214.dir/CMakeCCompilerABI.c.o -x c C:/Users/Nick/AppData/Local/Android/Sdk/cmake/3.18.1/share/cmake-3.18/Modules/CMakeCCompilerABI.c
|
|
||||||
|
|
||||||
clang -cc1 version 14.0.7 based upon LLVM 14.0.7git default target x86_64-w64-windows-gnu
|
|
||||||
|
|
||||||
ignoring nonexistent directory "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/include"
|
|
||||||
|
|
||||||
#include "..." search starts here:
|
|
||||||
|
|
||||||
#include <...> search starts here:
|
|
||||||
|
|
||||||
C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include
|
|
||||||
|
|
||||||
C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include
|
|
||||||
|
|
||||||
C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android
|
|
||||||
|
|
||||||
C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include
|
|
||||||
|
|
||||||
End of search list.
|
|
||||||
|
|
||||||
[2/2] Linking C executable cmTC_ad214
|
|
||||||
|
|
||||||
Android (9352603, based on r450784d1) clang version 14.0.7 (https://android.googlesource.com/toolchain/llvm-project 4c603efb0cca074e9238af8b4106c30add4418f6)
|
|
||||||
|
|
||||||
Target: aarch64-none-linux-android22
|
|
||||||
|
|
||||||
Thread model: posix
|
|
||||||
|
|
||||||
InstalledDir: C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin
|
|
||||||
|
|
||||||
"C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/ld" --sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -pie -EL --fix-cortex-a53-843419 --warn-shared-textrel -z now -z relro -z max-page-size=4096 --hash-style=both --enable-new-dtags --eh-frame-hdr -m aarch64linux -dynamic-linker /system/bin/linker64 -o cmTC_ad214 C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22/crtbegin_dynamic.o -LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/aarch64 -LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22 -LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android -LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib --build-id=sha1 --no-rosegment --fatal-warnings --no-undefined CMakeFiles/cmTC_ad214.dir/CMakeCCompilerABI.c.o C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/libclang_rt.builtins-aarch64-android.a -l:libunwind.a -ldl -lc C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/libclang_rt.builtins-aarch64-android.a -l:libunwind.a -ldl C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22/crtend_android.o
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Parsed C implicit include dir info from above output: rv=done
|
|
||||||
found start of include info
|
|
||||||
found start of implicit include info
|
|
||||||
add: [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include]
|
|
||||||
add: [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include]
|
|
||||||
add: [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android]
|
|
||||||
add: [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include]
|
|
||||||
end of search list found
|
|
||||||
collapse include dir [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include] ==> [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include]
|
|
||||||
collapse include dir [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include] ==> [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include]
|
|
||||||
collapse include dir [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android] ==> [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android]
|
|
||||||
collapse include dir [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include] ==> [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include]
|
|
||||||
implicit include dirs: [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include]
|
|
||||||
|
|
||||||
|
|
||||||
Parsed C implicit link information from above output:
|
|
||||||
link line regex: [^( *|.*[/\])(ld\.lld\.exe|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)]
|
|
||||||
ignore line: [Change Dir: F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/CMakeTmp]
|
|
||||||
ignore line: []
|
|
||||||
ignore line: [Run Build Command(s):C:\Users\Nick\AppData\Local\Android\Sdk\cmake\3.18.1\bin\ninja.exe cmTC_ad214 && [1/2] Building C object CMakeFiles/cmTC_ad214.dir/CMakeCCompilerABI.c.o]
|
|
||||||
ignore line: [Android (9352603 based on r450784d1) clang version 14.0.7 (https://android.googlesource.com/toolchain/llvm-project 4c603efb0cca074e9238af8b4106c30add4418f6)]
|
|
||||||
ignore line: [Target: aarch64-none-linux-android22]
|
|
||||||
ignore line: [Thread model: posix]
|
|
||||||
ignore line: [InstalledDir: C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin]
|
|
||||||
ignore line: [ (in-process)]
|
|
||||||
ignore line: [ "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe" -cc1 -triple aarch64-none-linux-android22 -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name CMakeCCompilerABI.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=non-leaf -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu generic -target-feature +neon -target-feature +v8a -target-feature +fix-cortex-a53-835769 -target-abi aapcs -fallow-half-arguments-and-returns -mllvm -treat-scalable-fixed-error-as-warning -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -v -ffunction-sections -fdata-sections -fcoverage-compilation-dir=F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/CMakeTmp -resource-dir C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7 -dependency-file "CMakeFiles\\cmTC_ad214.dir\\CMakeCCompilerABI.c.o.d" -MT CMakeFiles/cmTC_ad214.dir/CMakeCCompilerABI.c.o -sys-header-deps -D ANDROID -D _FORTIFY_SOURCE=2 -isysroot C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -internal-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include -internal-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include -internal-externc-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android -internal-externc-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/include -internal-externc-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include -Wformat -fdebug-compilation-dir=F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/CMakeTmp -ferror-limit 19 -stack-protector 2 -fno-signed-char -fgnuc-version=4.2.1 -target-feature +outline-atomics -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/cmTC_ad214.dir/CMakeCCompilerABI.c.o -x c C:/Users/Nick/AppData/Local/Android/Sdk/cmake/3.18.1/share/cmake-3.18/Modules/CMakeCCompilerABI.c]
|
|
||||||
ignore line: [clang -cc1 version 14.0.7 based upon LLVM 14.0.7git default target x86_64-w64-windows-gnu]
|
|
||||||
ignore line: [ignoring nonexistent directory "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/include"]
|
|
||||||
ignore line: [#include "..." search starts here:]
|
|
||||||
ignore line: [#include <...> search starts here:]
|
|
||||||
ignore line: [ C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include]
|
|
||||||
ignore line: [ C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include]
|
|
||||||
ignore line: [ C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android]
|
|
||||||
ignore line: [ C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include]
|
|
||||||
ignore line: [End of search list.]
|
|
||||||
ignore line: [[2/2] Linking C executable cmTC_ad214]
|
|
||||||
ignore line: [Android (9352603 based on r450784d1) clang version 14.0.7 (https://android.googlesource.com/toolchain/llvm-project 4c603efb0cca074e9238af8b4106c30add4418f6)]
|
|
||||||
ignore line: [Target: aarch64-none-linux-android22]
|
|
||||||
ignore line: [Thread model: posix]
|
|
||||||
ignore line: [InstalledDir: C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin]
|
|
||||||
link line: [ "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/ld" --sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -pie -EL --fix-cortex-a53-843419 --warn-shared-textrel -z now -z relro -z max-page-size=4096 --hash-style=both --enable-new-dtags --eh-frame-hdr -m aarch64linux -dynamic-linker /system/bin/linker64 -o cmTC_ad214 C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22/crtbegin_dynamic.o -LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/aarch64 -LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22 -LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android -LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib --build-id=sha1 --no-rosegment --fatal-warnings --no-undefined CMakeFiles/cmTC_ad214.dir/CMakeCCompilerABI.c.o C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/libclang_rt.builtins-aarch64-android.a -l:libunwind.a -ldl -lc C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/libclang_rt.builtins-aarch64-android.a -l:libunwind.a -ldl C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22/crtend_android.o]
|
|
||||||
arg [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/ld] ==> ignore
|
|
||||||
arg [--sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot] ==> ignore
|
|
||||||
arg [-pie] ==> ignore
|
|
||||||
arg [-EL] ==> ignore
|
|
||||||
arg [--fix-cortex-a53-843419] ==> ignore
|
|
||||||
arg [--warn-shared-textrel] ==> ignore
|
|
||||||
arg [-znow] ==> ignore
|
|
||||||
arg [-zrelro] ==> ignore
|
|
||||||
arg [-zmax-page-size=4096] ==> ignore
|
|
||||||
arg [--hash-style=both] ==> ignore
|
|
||||||
arg [--enable-new-dtags] ==> ignore
|
|
||||||
arg [--eh-frame-hdr] ==> ignore
|
|
||||||
arg [-m] ==> ignore
|
|
||||||
arg [aarch64linux] ==> ignore
|
|
||||||
arg [-dynamic-linker] ==> ignore
|
|
||||||
arg [/system/bin/linker64] ==> ignore
|
|
||||||
arg [-o] ==> ignore
|
|
||||||
arg [cmTC_ad214] ==> ignore
|
|
||||||
arg [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22/crtbegin_dynamic.o] ==> ignore
|
|
||||||
arg [-LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/aarch64] ==> dir [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/aarch64]
|
|
||||||
arg [-LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22] ==> dir [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22]
|
|
||||||
arg [-LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android] ==> dir [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android]
|
|
||||||
arg [-LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib] ==> dir [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib]
|
|
||||||
arg [--build-id=sha1] ==> ignore
|
|
||||||
arg [--no-rosegment] ==> ignore
|
|
||||||
arg [--fatal-warnings] ==> ignore
|
|
||||||
arg [--no-undefined] ==> ignore
|
|
||||||
arg [CMakeFiles/cmTC_ad214.dir/CMakeCCompilerABI.c.o] ==> ignore
|
|
||||||
arg [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/libclang_rt.builtins-aarch64-android.a] ==> lib [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/libclang_rt.builtins-aarch64-android.a]
|
|
||||||
arg [-l:libunwind.a] ==> lib [-l:libunwind.a]
|
|
||||||
arg [-ldl] ==> lib [dl]
|
|
||||||
arg [-lc] ==> lib [c]
|
|
||||||
arg [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/libclang_rt.builtins-aarch64-android.a] ==> lib [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/libclang_rt.builtins-aarch64-android.a]
|
|
||||||
arg [-l:libunwind.a] ==> lib [-l:libunwind.a]
|
|
||||||
arg [-ldl] ==> lib [dl]
|
|
||||||
arg [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22/crtend_android.o] ==> ignore
|
|
||||||
remove lib [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/libclang_rt.builtins-aarch64-android.a]
|
|
||||||
remove lib [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/libclang_rt.builtins-aarch64-android.a]
|
|
||||||
collapse library dir [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/aarch64] ==> [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/aarch64]
|
|
||||||
collapse library dir [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22] ==> [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22]
|
|
||||||
collapse library dir [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android] ==> [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android]
|
|
||||||
collapse library dir [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib] ==> [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib]
|
|
||||||
implicit libs: [-l:libunwind.a;dl;c;-l:libunwind.a;dl]
|
|
||||||
implicit dirs: [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/aarch64;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib]
|
|
||||||
implicit fwks: []
|
|
||||||
|
|
||||||
|
|
||||||
Detecting CXX compiler ABI info compiled with the following output:
|
|
||||||
Change Dir: F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/CMakeTmp
|
|
||||||
|
|
||||||
Run Build Command(s):C:\Users\Nick\AppData\Local\Android\Sdk\cmake\3.18.1\bin\ninja.exe cmTC_1c8e8 && [1/2] Building CXX object CMakeFiles/cmTC_1c8e8.dir/CMakeCXXCompilerABI.cpp.o
|
|
||||||
|
|
||||||
Android (9352603, based on r450784d1) clang version 14.0.7 (https://android.googlesource.com/toolchain/llvm-project 4c603efb0cca074e9238af8b4106c30add4418f6)
|
|
||||||
|
|
||||||
Target: aarch64-none-linux-android22
|
|
||||||
|
|
||||||
Thread model: posix
|
|
||||||
|
|
||||||
InstalledDir: C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin
|
|
||||||
|
|
||||||
(in-process)
|
|
||||||
|
|
||||||
"C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe" -cc1 -triple aarch64-none-linux-android22 -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name CMakeCXXCompilerABI.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=non-leaf -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu generic -target-feature +neon -target-feature +v8a -target-feature +fix-cortex-a53-835769 -target-abi aapcs -fallow-half-arguments-and-returns -mllvm -treat-scalable-fixed-error-as-warning -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -v -ffunction-sections -fdata-sections -fcoverage-compilation-dir=F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/CMakeTmp -resource-dir C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7 -dependency-file "CMakeFiles\\cmTC_1c8e8.dir\\CMakeCXXCompilerABI.cpp.o.d" -MT CMakeFiles/cmTC_1c8e8.dir/CMakeCXXCompilerABI.cpp.o -sys-header-deps -D ANDROID -D _FORTIFY_SOURCE=2 -isysroot C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -internal-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1 -internal-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include -internal-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include -internal-externc-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android -internal-externc-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/include -internal-externc-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include -Wformat -fdeprecated-macro -fdebug-compilation-dir=F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/CMakeTmp -ferror-limit 19 -stack-protector 2 -fno-signed-char -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -target-feature +outline-atomics -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/cmTC_1c8e8.dir/CMakeCXXCompilerABI.cpp.o -x c++ C:/Users/Nick/AppData/Local/Android/Sdk/cmake/3.18.1/share/cmake-3.18/Modules/CMakeCXXCompilerABI.cpp
|
|
||||||
|
|
||||||
clang -cc1 version 14.0.7 based upon LLVM 14.0.7git default target x86_64-w64-windows-gnu
|
|
||||||
|
|
||||||
ignoring nonexistent directory "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/include"
|
|
||||||
|
|
||||||
#include "..." search starts here:
|
|
||||||
|
|
||||||
#include <...> search starts here:
|
|
||||||
|
|
||||||
C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1
|
|
||||||
|
|
||||||
C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include
|
|
||||||
|
|
||||||
C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include
|
|
||||||
|
|
||||||
C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android
|
|
||||||
|
|
||||||
C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include
|
|
||||||
|
|
||||||
End of search list.
|
|
||||||
|
|
||||||
[2/2] Linking CXX executable cmTC_1c8e8
|
|
||||||
|
|
||||||
Android (9352603, based on r450784d1) clang version 14.0.7 (https://android.googlesource.com/toolchain/llvm-project 4c603efb0cca074e9238af8b4106c30add4418f6)
|
|
||||||
|
|
||||||
Target: aarch64-none-linux-android22
|
|
||||||
|
|
||||||
Thread model: posix
|
|
||||||
|
|
||||||
InstalledDir: C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin
|
|
||||||
|
|
||||||
"C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/ld" --sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -pie -EL --fix-cortex-a53-843419 --warn-shared-textrel -z now -z relro -z max-page-size=4096 --hash-style=both --enable-new-dtags --eh-frame-hdr -m aarch64linux -dynamic-linker /system/bin/linker64 -o cmTC_1c8e8 C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22/crtbegin_dynamic.o -LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/aarch64 -LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22 -LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android -LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib --build-id=sha1 --no-rosegment --fatal-warnings --no-undefined CMakeFiles/cmTC_1c8e8.dir/CMakeCXXCompilerABI.cpp.o -Bstatic -lc++ -Bdynamic -lm C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/libclang_rt.builtins-aarch64-android.a -l:libunwind.a -ldl -lc C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/libclang_rt.builtins-aarch64-android.a -l:libunwind.a -ldl C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22/crtend_android.o
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Parsed CXX implicit include dir info from above output: rv=done
|
|
||||||
found start of include info
|
|
||||||
found start of implicit include info
|
|
||||||
add: [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1]
|
|
||||||
add: [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include]
|
|
||||||
add: [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include]
|
|
||||||
add: [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android]
|
|
||||||
add: [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include]
|
|
||||||
end of search list found
|
|
||||||
collapse include dir [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1] ==> [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1]
|
|
||||||
collapse include dir [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include] ==> [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include]
|
|
||||||
collapse include dir [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include] ==> [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include]
|
|
||||||
collapse include dir [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android] ==> [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android]
|
|
||||||
collapse include dir [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include] ==> [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include]
|
|
||||||
implicit include dirs: [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android;C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include]
|
|
||||||
|
|
||||||
|
|
||||||
Parsed CXX implicit link information from above output:
|
|
||||||
link line regex: [^( *|.*[/\])(ld\.lld\.exe|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)]
|
|
||||||
ignore line: [Change Dir: F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/CMakeTmp]
|
|
||||||
ignore line: []
|
|
||||||
ignore line: [Run Build Command(s):C:\Users\Nick\AppData\Local\Android\Sdk\cmake\3.18.1\bin\ninja.exe cmTC_1c8e8 && [1/2] Building CXX object CMakeFiles/cmTC_1c8e8.dir/CMakeCXXCompilerABI.cpp.o]
|
|
||||||
ignore line: [Android (9352603 based on r450784d1) clang version 14.0.7 (https://android.googlesource.com/toolchain/llvm-project 4c603efb0cca074e9238af8b4106c30add4418f6)]
|
|
||||||
ignore line: [Target: aarch64-none-linux-android22]
|
|
||||||
ignore line: [Thread model: posix]
|
|
||||||
ignore line: [InstalledDir: C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin]
|
|
||||||
ignore line: [ (in-process)]
|
|
||||||
ignore line: [ "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe" -cc1 -triple aarch64-none-linux-android22 -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name CMakeCXXCompilerABI.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=non-leaf -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu generic -target-feature +neon -target-feature +v8a -target-feature +fix-cortex-a53-835769 -target-abi aapcs -fallow-half-arguments-and-returns -mllvm -treat-scalable-fixed-error-as-warning -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -v -ffunction-sections -fdata-sections -fcoverage-compilation-dir=F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/CMakeTmp -resource-dir C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7 -dependency-file "CMakeFiles\\cmTC_1c8e8.dir\\CMakeCXXCompilerABI.cpp.o.d" -MT CMakeFiles/cmTC_1c8e8.dir/CMakeCXXCompilerABI.cpp.o -sys-header-deps -D ANDROID -D _FORTIFY_SOURCE=2 -isysroot C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -internal-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1 -internal-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include -internal-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include -internal-externc-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android -internal-externc-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/include -internal-externc-isystem C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include -Wformat -fdeprecated-macro -fdebug-compilation-dir=F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/CMakeTmp -ferror-limit 19 -stack-protector 2 -fno-signed-char -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -target-feature +outline-atomics -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/cmTC_1c8e8.dir/CMakeCXXCompilerABI.cpp.o -x c++ C:/Users/Nick/AppData/Local/Android/Sdk/cmake/3.18.1/share/cmake-3.18/Modules/CMakeCXXCompilerABI.cpp]
|
|
||||||
ignore line: [clang -cc1 version 14.0.7 based upon LLVM 14.0.7git default target x86_64-w64-windows-gnu]
|
|
||||||
ignore line: [ignoring nonexistent directory "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/include"]
|
|
||||||
ignore line: [#include "..." search starts here:]
|
|
||||||
ignore line: [#include <...> search starts here:]
|
|
||||||
ignore line: [ C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1]
|
|
||||||
ignore line: [ C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include]
|
|
||||||
ignore line: [ C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/local/include]
|
|
||||||
ignore line: [ C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android]
|
|
||||||
ignore line: [ C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include]
|
|
||||||
ignore line: [End of search list.]
|
|
||||||
ignore line: [[2/2] Linking CXX executable cmTC_1c8e8]
|
|
||||||
ignore line: [Android (9352603 based on r450784d1) clang version 14.0.7 (https://android.googlesource.com/toolchain/llvm-project 4c603efb0cca074e9238af8b4106c30add4418f6)]
|
|
||||||
ignore line: [Target: aarch64-none-linux-android22]
|
|
||||||
ignore line: [Thread model: posix]
|
|
||||||
ignore line: [InstalledDir: C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin]
|
|
||||||
link line: [ "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/ld" --sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -pie -EL --fix-cortex-a53-843419 --warn-shared-textrel -z now -z relro -z max-page-size=4096 --hash-style=both --enable-new-dtags --eh-frame-hdr -m aarch64linux -dynamic-linker /system/bin/linker64 -o cmTC_1c8e8 C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22/crtbegin_dynamic.o -LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/aarch64 -LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22 -LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android -LC:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib --build-id=sha1 --no-rosegment --fatal-warnings --no-undefined CMakeFiles/cmTC_1c8e8.dir/CMakeCXXCompilerABI.cpp.o -Bstatic -lc++ -Bdynamic -lm C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/libclang_rt.builtins-aarch64-android.a -l:libunwind.a -ldl -lc C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/lib/linux/libclang_rt.builtins-aarch64-android.a -l:libunwind.a -ldl C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/22/crtend_android.o]
|
|
||||||
arg [C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/ld] ==> ignore
|
|
||||||
arg [--sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot] ==> ignore
|
|
||||||
arg [-pie] ==> ignore
|
|
||||||
arg [-EL] ==> ignore
|
|
||||||
arg [--fix-cortex-a53-843419] ==> ignore
|
|
||||||
arg [--warn-shared-textrel] ==> ignore
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/polyvox_filament_android.dir
|
|
||||||
F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/FILAMENT_SHADERS.dir
|
|
||||||
F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/edit_cache.dir
|
|
||||||
F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/rebuild_cache.dir
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# This file is generated by cmake for dependency checking of the CMakeCache.txt file
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
# CMAKE generated file: DO NOT EDIT!
|
|
||||||
# Generated by "Ninja" Generator, CMake Version 3.18
|
|
||||||
|
|
||||||
# This file contains all the rules used to get the outputs files
|
|
||||||
# built from the input files.
|
|
||||||
# It is included in the main 'build.ninja'.
|
|
||||||
|
|
||||||
# =============================================================================
|
|
||||||
# Project: Project
|
|
||||||
# Configurations: Debug
|
|
||||||
# =============================================================================
|
|
||||||
# =============================================================================
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
# Rule for compiling CXX files.
|
|
||||||
|
|
||||||
rule CXX_COMPILER__polyvox_filament_android_Debug
|
|
||||||
depfile = $DEP_FILE
|
|
||||||
deps = gcc
|
|
||||||
command = C:\Users\Nick\AppData\Local\Android\Sdk\ndk\25.2.9519653\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android22 --sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in
|
|
||||||
description = Building CXX object $out
|
|
||||||
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
# Rule for linking CXX shared library.
|
|
||||||
|
|
||||||
rule CXX_SHARED_LIBRARY_LINKER__polyvox_filament_android_Debug
|
|
||||||
command = cmd.exe /C "$PRE_LINK && C:\Users\Nick\AppData\Local\Android\Sdk\ndk\25.2.9519653\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android22 --sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC $LANGUAGE_COMPILE_FLAGS $ARCH_FLAGS $LINK_FLAGS -shared $SONAME_FLAG$SONAME -o $TARGET_FILE $in $LINK_PATH $LINK_LIBRARIES && $POST_BUILD"
|
|
||||||
description = Linking CXX shared library $TARGET_FILE
|
|
||||||
restat = $RESTAT
|
|
||||||
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
# Rule for compiling C files.
|
|
||||||
|
|
||||||
rule C_COMPILER__FILAMENT_SHADERS_Debug
|
|
||||||
depfile = $DEP_FILE
|
|
||||||
deps = gcc
|
|
||||||
command = C:\Users\Nick\AppData\Local\Android\Sdk\ndk\25.2.9519653\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe --target=aarch64-none-linux-android22 --sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in
|
|
||||||
description = Building C object $out
|
|
||||||
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
# Rule for linking C shared library.
|
|
||||||
|
|
||||||
rule C_SHARED_LIBRARY_LINKER__FILAMENT_SHADERS_Debug
|
|
||||||
command = cmd.exe /C "$PRE_LINK && C:\Users\Nick\AppData\Local\Android\Sdk\ndk\25.2.9519653\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe --target=aarch64-none-linux-android22 --sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC $LANGUAGE_COMPILE_FLAGS $ARCH_FLAGS $LINK_FLAGS -shared $SONAME_FLAG$SONAME -o $TARGET_FILE $in $LINK_PATH $LINK_LIBRARIES && $POST_BUILD"
|
|
||||||
description = Linking C shared library $TARGET_FILE
|
|
||||||
restat = $RESTAT
|
|
||||||
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
# Rule for running custom commands.
|
|
||||||
|
|
||||||
rule CUSTOM_COMMAND
|
|
||||||
command = $COMMAND
|
|
||||||
description = $DESC
|
|
||||||
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
# Rule for re-running cmake.
|
|
||||||
|
|
||||||
rule RERUN_CMAKE
|
|
||||||
command = C:\Users\Nick\AppData\Local\Android\Sdk\cmake\3.18.1\bin\cmake.exe --regenerate-during-build -SF:\Projects\polyvox\polyvox_filament\android -BF:\Projects\polyvox\polyvox_filament\android\.cxx\cmake\debug\arm64-v8a
|
|
||||||
description = Re-running CMake...
|
|
||||||
generator = 1
|
|
||||||
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
# Rule for cleaning all built files.
|
|
||||||
|
|
||||||
rule CLEAN
|
|
||||||
command = C:\Users\Nick\AppData\Local\Android\Sdk\cmake\3.18.1\bin\ninja.exe $FILE_ARG -t clean $TARGETS
|
|
||||||
description = Cleaning all built files...
|
|
||||||
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
# Rule for printing all primary targets available.
|
|
||||||
|
|
||||||
rule HELP
|
|
||||||
command = C:\Users\Nick\AppData\Local\Android\Sdk\cmake\3.18.1\bin\ninja.exe -t targets
|
|
||||||
description = All primary targets available:
|
|
||||||
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
{
|
|
||||||
"stringTable": {
|
|
||||||
"0": "F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a",
|
|
||||||
"1": "--target=aarch64-none-linux-android22 --sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Dpolyvox_filament_android_EXPORTS -I../../../../../ios/src -I../../../../../ios/include -I../../../../../ios/include/stb -I../../../../src/main/cpp -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -std=c++17 -fno-limit-debug-info -fPIC",
|
|
||||||
"2": "--target=aarch64-none-linux-android22 --sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -DFILAMENT_SHADERS_EXPORTS -I../../../../../ios/src -I../../../../../ios/include -I../../../../../ios/include/stb -I../../../../src/main/cpp -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fno-limit-debug-info -fPIC"
|
|
||||||
},
|
|
||||||
"buildFiles": [
|
|
||||||
"F:\\Projects\\polyvox\\polyvox_filament\\android\\CMakeLists.txt",
|
|
||||||
"C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\build\\cmake\\android.toolchain.cmake",
|
|
||||||
"C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\build\\cmake\\android-legacy.toolchain.cmake",
|
|
||||||
"C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\build\\cmake\\platforms.cmake",
|
|
||||||
"C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\build\\cmake\\compiler_id.cmake"
|
|
||||||
],
|
|
||||||
"cleanCommands": [
|
|
||||||
"C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\cmake\\3.18.1\\bin\\ninja.exe -C \"F:\\Projects\\polyvox\\polyvox_filament\\android\\.cxx\\cmake\\debug\\arm64-v8a\" clean"
|
|
||||||
],
|
|
||||||
"buildTargetsCommand": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\cmake\\3.18.1\\bin\\ninja.exe -C \"F:\\Projects\\polyvox\\polyvox_filament\\android\\.cxx\\cmake\\debug\\arm64-v8a\" {LIST_OF_TARGETS_TO_BUILD}",
|
|
||||||
"libraries": {
|
|
||||||
"polyvox_filament_android-Debug-arm64-v8a": {
|
|
||||||
"buildCommand": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\cmake\\3.18.1\\bin\\ninja.exe -C \"F:\\Projects\\polyvox\\polyvox_filament\\android\\.cxx\\cmake\\debug\\arm64-v8a\" polyvox_filament_android",
|
|
||||||
"buildType": "debug",
|
|
||||||
"toolchain": "387160768",
|
|
||||||
"abi": "arm64-v8a",
|
|
||||||
"artifactName": "polyvox_filament_android",
|
|
||||||
"files": [
|
|
||||||
{
|
|
||||||
"src": "F:\\Projects\\polyvox\\polyvox_filament\\ios\\src\\PolyvoxFilamentApi.cpp",
|
|
||||||
"flagsOrdinal": 1,
|
|
||||||
"workingDirectoryOrdinal": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "F:\\Projects\\polyvox\\polyvox_filament\\android\\src\\main\\cpp\\FilamentAndroid.cpp",
|
|
||||||
"flagsOrdinal": 1,
|
|
||||||
"workingDirectoryOrdinal": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "F:\\Projects\\polyvox\\polyvox_filament\\ios\\src\\AssetManager.cpp",
|
|
||||||
"flagsOrdinal": 1,
|
|
||||||
"workingDirectoryOrdinal": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "F:\\Projects\\polyvox\\polyvox_filament\\ios\\src\\FilamentViewer.cpp",
|
|
||||||
"flagsOrdinal": 1,
|
|
||||||
"workingDirectoryOrdinal": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "F:\\Projects\\polyvox\\polyvox_filament\\ios\\src\\StreamBufferAdapter.cpp",
|
|
||||||
"flagsOrdinal": 1,
|
|
||||||
"workingDirectoryOrdinal": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "F:\\Projects\\polyvox\\polyvox_filament\\ios\\src\\TimeIt.cpp",
|
|
||||||
"flagsOrdinal": 1,
|
|
||||||
"workingDirectoryOrdinal": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"headers": [],
|
|
||||||
"output": "F:\\Projects\\polyvox\\polyvox_filament\\example\\build\\polyvox_filament\\intermediates\\cmake\\debug\\obj\\arm64-v8a\\libpolyvox_filament_android.so",
|
|
||||||
"runtimeFiles": [
|
|
||||||
"F:\\Projects\\polyvox\\polyvox_filament\\example\\build\\polyvox_filament\\intermediates\\cmake\\debug\\obj\\arm64-v8a\\libFILAMENT_SHADERS.so"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"FILAMENT_SHADERS-Debug-arm64-v8a": {
|
|
||||||
"buildCommand": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\cmake\\3.18.1\\bin\\ninja.exe -C \"F:\\Projects\\polyvox\\polyvox_filament\\android\\.cxx\\cmake\\debug\\arm64-v8a\" FILAMENT_SHADERS",
|
|
||||||
"buildType": "debug",
|
|
||||||
"toolchain": "387160768",
|
|
||||||
"abi": "arm64-v8a",
|
|
||||||
"artifactName": "FILAMENT_SHADERS",
|
|
||||||
"files": [
|
|
||||||
{
|
|
||||||
"src": "F:\\Projects\\polyvox\\polyvox_filament\\ios\\include\\material\\image.c",
|
|
||||||
"flagsOrdinal": 2,
|
|
||||||
"workingDirectoryOrdinal": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "F:\\Projects\\polyvox\\polyvox_filament\\ios\\include\\material\\unlit_opaque.c",
|
|
||||||
"flagsOrdinal": 2,
|
|
||||||
"workingDirectoryOrdinal": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"headers": [],
|
|
||||||
"output": "F:\\Projects\\polyvox\\polyvox_filament\\example\\build\\polyvox_filament\\intermediates\\cmake\\debug\\obj\\arm64-v8a\\libFILAMENT_SHADERS.so",
|
|
||||||
"runtimeFiles": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"toolchains": {
|
|
||||||
"387160768": {
|
|
||||||
"cCompilerExecutable": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\clang.exe",
|
|
||||||
"cppCompilerExecutable": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\clang++.exe"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"cFileExtensions": [
|
|
||||||
"c"
|
|
||||||
],
|
|
||||||
"cppFileExtensions": [
|
|
||||||
"cpp"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
{
|
|
||||||
"buildFiles": [
|
|
||||||
"F:\\Projects\\polyvox\\polyvox_filament\\android\\CMakeLists.txt",
|
|
||||||
"C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\build\\cmake\\android.toolchain.cmake",
|
|
||||||
"C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\build\\cmake\\android-legacy.toolchain.cmake",
|
|
||||||
"C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\build\\cmake\\platforms.cmake",
|
|
||||||
"C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\build\\cmake\\compiler_id.cmake"
|
|
||||||
],
|
|
||||||
"cleanCommands": [
|
|
||||||
"C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\cmake\\3.18.1\\bin\\ninja.exe -C \"F:\\Projects\\polyvox\\polyvox_filament\\android\\.cxx\\cmake\\debug\\arm64-v8a\" clean"
|
|
||||||
],
|
|
||||||
"buildTargetsCommand": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\cmake\\3.18.1\\bin\\ninja.exe -C \"F:\\Projects\\polyvox\\polyvox_filament\\android\\.cxx\\cmake\\debug\\arm64-v8a\" {LIST_OF_TARGETS_TO_BUILD}",
|
|
||||||
"libraries": {
|
|
||||||
"polyvox_filament_android-Debug-arm64-v8a": {
|
|
||||||
"artifactName": "polyvox_filament_android",
|
|
||||||
"buildCommand": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\cmake\\3.18.1\\bin\\ninja.exe -C \"F:\\Projects\\polyvox\\polyvox_filament\\android\\.cxx\\cmake\\debug\\arm64-v8a\" polyvox_filament_android",
|
|
||||||
"abi": "arm64-v8a",
|
|
||||||
"output": "F:\\Projects\\polyvox\\polyvox_filament\\example\\build\\polyvox_filament\\intermediates\\cmake\\debug\\obj\\arm64-v8a\\libpolyvox_filament_android.so",
|
|
||||||
"runtimeFiles": [
|
|
||||||
"F:\\Projects\\polyvox\\polyvox_filament\\example\\build\\polyvox_filament\\intermediates\\cmake\\debug\\obj\\arm64-v8a\\libFILAMENT_SHADERS.so"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"FILAMENT_SHADERS-Debug-arm64-v8a": {
|
|
||||||
"artifactName": "FILAMENT_SHADERS",
|
|
||||||
"buildCommand": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\cmake\\3.18.1\\bin\\ninja.exe -C \"F:\\Projects\\polyvox\\polyvox_filament\\android\\.cxx\\cmake\\debug\\arm64-v8a\" FILAMENT_SHADERS",
|
|
||||||
"abi": "arm64-v8a",
|
|
||||||
"output": "F:\\Projects\\polyvox\\polyvox_filament\\example\\build\\polyvox_filament\\intermediates\\cmake\\debug\\obj\\arm64-v8a\\libFILAMENT_SHADERS.so",
|
|
||||||
"runtimeFiles": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,21 +0,0 @@
|
|||||||
Executable : C:\Users\Nick\AppData\Local\Android\Sdk\cmake\3.18.1\bin\cmake.exe
|
|
||||||
arguments :
|
|
||||||
-HF:\Projects\polyvox\polyvox_filament\android
|
|
||||||
-DCMAKE_FIND_ROOT_PATH=F:\Projects\polyvox\polyvox_filament\android\.cxx\cmake\debug\prefab\arm64-v8a\prefab
|
|
||||||
-DCMAKE_BUILD_TYPE=Debug
|
|
||||||
-DCMAKE_TOOLCHAIN_FILE=C:\Users\Nick\AppData\Local\Android\Sdk\ndk\25.2.9519653\build\cmake\android.toolchain.cmake
|
|
||||||
-DANDROID_ABI=arm64-v8a
|
|
||||||
-DANDROID_NDK=C:\Users\Nick\AppData\Local\Android\Sdk\ndk\25.2.9519653
|
|
||||||
-DANDROID_PLATFORM=android-22
|
|
||||||
-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a
|
|
||||||
-DCMAKE_ANDROID_NDK=C:\Users\Nick\AppData\Local\Android\Sdk\ndk\25.2.9519653
|
|
||||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
|
||||||
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=F:\Projects\polyvox\polyvox_filament\example\build\polyvox_filament\intermediates\cmake\debug\obj\arm64-v8a
|
|
||||||
-DCMAKE_MAKE_PROGRAM=C:\Users\Nick\AppData\Local\Android\Sdk\cmake\3.18.1\bin\ninja.exe
|
|
||||||
-DCMAKE_SYSTEM_NAME=Android
|
|
||||||
-DCMAKE_SYSTEM_VERSION=22
|
|
||||||
-BF:\Projects\polyvox\polyvox_filament\android\.cxx\cmake\debug\arm64-v8a
|
|
||||||
-GNinja
|
|
||||||
jvmArgs :
|
|
||||||
|
|
||||||
Build command args:
|
|
||||||
@@ -1,205 +0,0 @@
|
|||||||
{
|
|
||||||
"abi": "ARM64_V8A",
|
|
||||||
"abiPlatformVersion": 22,
|
|
||||||
"buildSettings": {
|
|
||||||
"environmentVariables": []
|
|
||||||
},
|
|
||||||
"cmake": {
|
|
||||||
"cmakeArtifactsBaseFolder": "F:\\Projects\\polyvox\\polyvox_filament\\android\\.cxx\\cmake\\debug\\arm64-v8a",
|
|
||||||
"cmakeServerLogFile": "F:\\Projects\\polyvox\\polyvox_filament\\android\\.cxx\\cmake\\debug\\arm64-v8a\\cmake_server_log.txt",
|
|
||||||
"cmakeWrappingBaseFolder": "F:\\Projects\\polyvox\\polyvox_filament\\android\\.cxx\\cxx\\debug\\arm64-v8a",
|
|
||||||
"effectiveConfiguration": {
|
|
||||||
"name": "traditional-android-studio-cmake-environment",
|
|
||||||
"description": "Composite reified CMakeSettings configuration",
|
|
||||||
"generator": "Ninja",
|
|
||||||
"inheritEnvironments": [
|
|
||||||
"ndk"
|
|
||||||
],
|
|
||||||
"buildRoot": "F:\\Projects\\polyvox\\polyvox_filament\\android\\.cxx\\cmake\\debug\\arm64-v8a",
|
|
||||||
"cmakeToolchain": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\build\\cmake\\android.toolchain.cmake",
|
|
||||||
"cmakeExecutable": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\cmake\\3.18.1\\bin\\cmake.exe",
|
|
||||||
"variables": [
|
|
||||||
{
|
|
||||||
"name": "CMAKE_FIND_ROOT_PATH",
|
|
||||||
"value": "F:\\Projects\\polyvox\\polyvox_filament\\android\\.cxx\\cmake\\debug\\prefab\\arm64-v8a\\prefab"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "CMAKE_BUILD_TYPE",
|
|
||||||
"value": "Debug"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "CMAKE_TOOLCHAIN_FILE",
|
|
||||||
"value": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\build\\cmake\\android.toolchain.cmake"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ANDROID_ABI",
|
|
||||||
"value": "arm64-v8a"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ANDROID_NDK",
|
|
||||||
"value": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ANDROID_PLATFORM",
|
|
||||||
"value": "android-22"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "CMAKE_ANDROID_ARCH_ABI",
|
|
||||||
"value": "arm64-v8a"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "CMAKE_ANDROID_NDK",
|
|
||||||
"value": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "CMAKE_EXPORT_COMPILE_COMMANDS",
|
|
||||||
"value": "ON"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "CMAKE_LIBRARY_OUTPUT_DIRECTORY",
|
|
||||||
"value": "F:\\Projects\\polyvox\\polyvox_filament\\example\\build\\polyvox_filament\\intermediates\\cmake\\debug\\obj\\arm64-v8a"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "CMAKE_MAKE_PROGRAM",
|
|
||||||
"value": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\cmake\\3.18.1\\bin\\ninja.exe"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "CMAKE_SYSTEM_NAME",
|
|
||||||
"value": "Android"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "CMAKE_SYSTEM_VERSION",
|
|
||||||
"value": "22"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"cxxBuildFolder": "F:\\Projects\\polyvox\\polyvox_filament\\android\\.cxx\\cmake\\debug\\arm64-v8a",
|
|
||||||
"info": {
|
|
||||||
"abi": "ARM64_V8A",
|
|
||||||
"bitness": 64,
|
|
||||||
"deprecated": false,
|
|
||||||
"default": true
|
|
||||||
},
|
|
||||||
"originalCxxBuildFolder": "F:\\Projects\\polyvox\\polyvox_filament\\android\\.cxx\\cmake\\debug\\arm64-v8a",
|
|
||||||
"variant": {
|
|
||||||
"buildSystemArgumentList": [],
|
|
||||||
"buildTargetSet": [],
|
|
||||||
"implicitBuildTargetSet": [],
|
|
||||||
"cFlagsList": [],
|
|
||||||
"cmakeSettingsConfiguration": "android-gradle-plugin-predetermined-name",
|
|
||||||
"cppFlagsList": [],
|
|
||||||
"isDebuggableEnabled": true,
|
|
||||||
"module": {
|
|
||||||
"buildSystem": "CMAKE",
|
|
||||||
"cmake": {
|
|
||||||
"cmakeExe": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\cmake\\3.18.1\\bin\\cmake.exe",
|
|
||||||
"minimumCmakeVersion": "3.18.1",
|
|
||||||
"ninjaExe": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\cmake\\3.18.1\\bin\\ninja.exe"
|
|
||||||
},
|
|
||||||
"cmakeToolchainFile": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\build\\cmake\\android.toolchain.cmake",
|
|
||||||
"cxxFolder": "F:\\Projects\\polyvox\\polyvox_filament\\android\\.cxx",
|
|
||||||
"gradleModulePathName": ":polyvox_filament",
|
|
||||||
"intermediatesFolder": "F:\\Projects\\polyvox\\polyvox_filament\\example\\build\\polyvox_filament\\intermediates",
|
|
||||||
"makeFile": "F:\\Projects\\polyvox\\polyvox_filament\\android\\CMakeLists.txt",
|
|
||||||
"moduleBuildFile": "F:\\Projects\\polyvox\\polyvox_filament\\android\\build.gradle",
|
|
||||||
"moduleRootFolder": "F:\\Projects\\polyvox\\polyvox_filament\\android",
|
|
||||||
"ndkDefaultAbiList": [
|
|
||||||
"ARMEABI_V7A",
|
|
||||||
"ARM64_V8A",
|
|
||||||
"X86",
|
|
||||||
"X86_64"
|
|
||||||
],
|
|
||||||
"ndkFolder": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653",
|
|
||||||
"ndkMetaAbiList": [
|
|
||||||
{
|
|
||||||
"abi": "ARMEABI_V7A",
|
|
||||||
"bitness": 32,
|
|
||||||
"deprecated": false,
|
|
||||||
"default": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"abi": "ARM64_V8A",
|
|
||||||
"bitness": 64,
|
|
||||||
"deprecated": false,
|
|
||||||
"default": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"abi": "X86",
|
|
||||||
"bitness": 32,
|
|
||||||
"deprecated": false,
|
|
||||||
"default": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"abi": "X86_64",
|
|
||||||
"bitness": 64,
|
|
||||||
"deprecated": false,
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"ndkMetaPlatforms": {
|
|
||||||
"min": 19,
|
|
||||||
"max": 33,
|
|
||||||
"aliases": {
|
|
||||||
"20": 19,
|
|
||||||
"25": 24,
|
|
||||||
"J": 16,
|
|
||||||
"J-MR1": 17,
|
|
||||||
"J-MR2": 18,
|
|
||||||
"K": 19,
|
|
||||||
"L": 21,
|
|
||||||
"L-MR1": 22,
|
|
||||||
"M": 23,
|
|
||||||
"N": 24,
|
|
||||||
"N-MR1": 24,
|
|
||||||
"O": 26,
|
|
||||||
"O-MR1": 27,
|
|
||||||
"P": 28,
|
|
||||||
"Q": 29,
|
|
||||||
"R": 30,
|
|
||||||
"S": 31,
|
|
||||||
"Sv2": 32,
|
|
||||||
"Tiramisu": 33
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ndkSupportedAbiList": [
|
|
||||||
"ARMEABI_V7A",
|
|
||||||
"ARM64_V8A",
|
|
||||||
"X86",
|
|
||||||
"X86_64"
|
|
||||||
],
|
|
||||||
"ndkDefaultStl": "LIBCXX_STATIC",
|
|
||||||
"ndkVersion": "25.2.9519653",
|
|
||||||
"project": {
|
|
||||||
"compilerSettingsCacheFolder": "F:\\Projects\\polyvox\\polyvox_filament\\example\\android\\.cxx",
|
|
||||||
"cxxFolder": "F:\\Projects\\polyvox\\polyvox_filament\\example\\android\\.cxx",
|
|
||||||
"isBuildOnlyTargetAbiEnabled": true,
|
|
||||||
"isCmakeBuildCohabitationEnabled": false,
|
|
||||||
"isNativeCompilerSettingsCacheEnabled": false,
|
|
||||||
"rootBuildGradleFolder": "F:\\Projects\\polyvox\\polyvox_filament\\example\\android",
|
|
||||||
"sdkFolder": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk",
|
|
||||||
"isPrefabEnabled": false
|
|
||||||
},
|
|
||||||
"splitsAbiFilterSet": [],
|
|
||||||
"stlSharedObjectMap": {
|
|
||||||
"LIBCXX_SHARED": {
|
|
||||||
"ARMEABI_V7A": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\lib\\arm-linux-androideabi\\libc++_shared.so",
|
|
||||||
"ARM64_V8A": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\lib\\aarch64-linux-android\\libc++_shared.so",
|
|
||||||
"X86": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\lib\\i686-linux-android\\libc++_shared.so",
|
|
||||||
"X86_64": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\lib\\x86_64-linux-android\\libc++_shared.so"
|
|
||||||
},
|
|
||||||
"LIBCXX_STATIC": {},
|
|
||||||
"NONE": {},
|
|
||||||
"SYSTEM": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"objFolder": "F:\\Projects\\polyvox\\polyvox_filament\\example\\build\\polyvox_filament\\intermediates\\cmake\\debug\\obj",
|
|
||||||
"variantName": "debug",
|
|
||||||
"validAbiList": [
|
|
||||||
"ARM64_V8A"
|
|
||||||
],
|
|
||||||
"prefabDirectory": "F:\\Projects\\polyvox\\polyvox_filament\\android\\.cxx\\cmake\\debug\\prefab",
|
|
||||||
"prefabPackageDirectoryList": []
|
|
||||||
},
|
|
||||||
"prefabFolder": "F:\\Projects\\polyvox\\polyvox_filament\\android\\.cxx\\cmake\\debug\\prefab\\arm64-v8a"
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
CMake Warning (dev) in CMakeLists.txt:
|
|
||||||
No project() command is present. The top-level CMakeLists.txt file must
|
|
||||||
contain a literal, direct call to the project() command. Add a line of
|
|
||||||
code such as
|
|
||||||
|
|
||||||
project(ProjectName)
|
|
||||||
|
|
||||||
near the top of the file, but after cmake_minimum_required().
|
|
||||||
|
|
||||||
CMake is pretending there is a "project(Project)" command on the first
|
|
||||||
line.
|
|
||||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
|
||||||
|
|
||||||
CMake Warning at C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/build/cmake/android-legacy.toolchain.cmake:418 (message):
|
|
||||||
An old version of CMake is being used that cannot automatically detect
|
|
||||||
compiler attributes. Compiler identification is being bypassed. Some
|
|
||||||
values may be wrong or missing. Update to CMake 3.19 or newer to use
|
|
||||||
CMake's built-in compiler identification.
|
|
||||||
Call Stack (most recent call first):
|
|
||||||
C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/build/cmake/android.toolchain.cmake:54 (include)
|
|
||||||
C:/Users/Nick/AppData/Local/Android/Sdk/cmake/3.18.1/share/cmake-3.18/Modules/CMakeDetermineSystem.cmake:93 (include)
|
|
||||||
|
|
||||||
|
|
||||||
Detecting C compiler ABI info
|
|
||||||
CMake Warning at C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/build/cmake/android-legacy.toolchain.cmake:418 (message):
|
|
||||||
An old version of CMake is being used that cannot automatically detect
|
|
||||||
compiler attributes. Compiler identification is being bypassed. Some
|
|
||||||
values may be wrong or missing. Update to CMake 3.19 or newer to use
|
|
||||||
CMake's built-in compiler identification.
|
|
||||||
Call Stack (most recent call first):
|
|
||||||
C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/build/cmake/android.toolchain.cmake:54 (include)
|
|
||||||
F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/3.18.1-g262b901-dirty/CMakeSystem.cmake:6 (include)
|
|
||||||
F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)
|
|
||||||
|
|
||||||
|
|
||||||
Detecting C compiler ABI info - done
|
|
||||||
Check for working C compiler: C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - skipped
|
|
||||||
Detecting C compile features
|
|
||||||
Detecting C compile features - done
|
|
||||||
Detecting CXX compiler ABI info
|
|
||||||
CMake Warning at C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/build/cmake/android-legacy.toolchain.cmake:418 (message):
|
|
||||||
An old version of CMake is being used that cannot automatically detect
|
|
||||||
compiler attributes. Compiler identification is being bypassed. Some
|
|
||||||
values may be wrong or missing. Update to CMake 3.19 or newer to use
|
|
||||||
CMake's built-in compiler identification.
|
|
||||||
Call Stack (most recent call first):
|
|
||||||
C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/build/cmake/android.toolchain.cmake:54 (include)
|
|
||||||
F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/3.18.1-g262b901-dirty/CMakeSystem.cmake:6 (include)
|
|
||||||
F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)
|
|
||||||
|
|
||||||
|
|
||||||
Detecting CXX compiler ABI info - done
|
|
||||||
Check for working CXX compiler: C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - skipped
|
|
||||||
Detecting CXX compile features
|
|
||||||
Detecting CXX compile features - done
|
|
||||||
Configuring done
|
|
||||||
CMake Deprecation Warning:
|
|
||||||
The 'cmake-server(7)' is deprecated. Please port clients to use the
|
|
||||||
'cmake-file-api(7)' instead.
|
|
||||||
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
# Install script for directory: F:/Projects/polyvox/polyvox_filament/android
|
|
||||||
|
|
||||||
# Set the install prefix
|
|
||||||
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
|
|
||||||
set(CMAKE_INSTALL_PREFIX "C:/Program Files (x86)/Project")
|
|
||||||
endif()
|
|
||||||
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
|
|
||||||
|
|
||||||
# Set the install configuration name.
|
|
||||||
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
|
|
||||||
if(BUILD_TYPE)
|
|
||||||
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
|
|
||||||
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
|
|
||||||
else()
|
|
||||||
set(CMAKE_INSTALL_CONFIG_NAME "Debug")
|
|
||||||
endif()
|
|
||||||
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Set the component getting installed.
|
|
||||||
if(NOT CMAKE_INSTALL_COMPONENT)
|
|
||||||
if(COMPONENT)
|
|
||||||
message(STATUS "Install component: \"${COMPONENT}\"")
|
|
||||||
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
|
|
||||||
else()
|
|
||||||
set(CMAKE_INSTALL_COMPONENT)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Install shared libraries without execute permission?
|
|
||||||
if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
|
|
||||||
set(CMAKE_INSTALL_SO_NO_EXE "0")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Is this installation the result of a crosscompile?
|
|
||||||
if(NOT DEFINED CMAKE_CROSSCOMPILING)
|
|
||||||
set(CMAKE_CROSSCOMPILING "TRUE")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Set default install directory permissions.
|
|
||||||
if(NOT DEFINED CMAKE_OBJDUMP)
|
|
||||||
set(CMAKE_OBJDUMP "C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-objdump.exe")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_INSTALL_COMPONENT)
|
|
||||||
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
|
|
||||||
else()
|
|
||||||
set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
|
|
||||||
"${CMAKE_INSTALL_MANIFEST_FILES}")
|
|
||||||
file(WRITE "F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a/${CMAKE_INSTALL_MANIFEST}"
|
|
||||||
"${CMAKE_INSTALL_MANIFEST_CONTENT}")
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,42 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"directory": "F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a",
|
|
||||||
"command": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\clang++.exe --target=aarch64-none-linux-android22 --sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Dpolyvox_filament_android_EXPORTS -I../../../../../ios/src -I../../../../../ios/include -I../../../../../ios/include/stb -I../../../../src/main/cpp -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -std=c++17 -fno-limit-debug-info -fPIC -o CMakeFiles\\polyvox_filament_android.dir\\F_\\Projects\\polyvox\\polyvox_filament\\ios\\src\\PolyvoxFilamentApi.cpp.o -c F:\\Projects\\polyvox\\polyvox_filament\\ios\\src\\PolyvoxFilamentApi.cpp",
|
|
||||||
"file": "F:\\Projects\\polyvox\\polyvox_filament\\ios\\src\\PolyvoxFilamentApi.cpp"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"directory": "F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a",
|
|
||||||
"command": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\clang++.exe --target=aarch64-none-linux-android22 --sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Dpolyvox_filament_android_EXPORTS -I../../../../../ios/src -I../../../../../ios/include -I../../../../../ios/include/stb -I../../../../src/main/cpp -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -std=c++17 -fno-limit-debug-info -fPIC -o CMakeFiles\\polyvox_filament_android.dir\\src\\main\\cpp\\FilamentAndroid.cpp.o -c F:\\Projects\\polyvox\\polyvox_filament\\android\\src\\main\\cpp\\FilamentAndroid.cpp",
|
|
||||||
"file": "F:/Projects/polyvox/polyvox_filament/android/src/main/cpp/FilamentAndroid.cpp"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"directory": "F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a",
|
|
||||||
"command": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\clang++.exe --target=aarch64-none-linux-android22 --sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Dpolyvox_filament_android_EXPORTS -I../../../../../ios/src -I../../../../../ios/include -I../../../../../ios/include/stb -I../../../../src/main/cpp -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -std=c++17 -fno-limit-debug-info -fPIC -o CMakeFiles\\polyvox_filament_android.dir\\F_\\Projects\\polyvox\\polyvox_filament\\ios\\src\\AssetManager.cpp.o -c F:\\Projects\\polyvox\\polyvox_filament\\ios\\src\\AssetManager.cpp",
|
|
||||||
"file": "F:\\Projects\\polyvox\\polyvox_filament\\ios\\src\\AssetManager.cpp"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"directory": "F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a",
|
|
||||||
"command": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\clang++.exe --target=aarch64-none-linux-android22 --sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Dpolyvox_filament_android_EXPORTS -I../../../../../ios/src -I../../../../../ios/include -I../../../../../ios/include/stb -I../../../../src/main/cpp -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -std=c++17 -fno-limit-debug-info -fPIC -o CMakeFiles\\polyvox_filament_android.dir\\F_\\Projects\\polyvox\\polyvox_filament\\ios\\src\\FilamentViewer.cpp.o -c F:\\Projects\\polyvox\\polyvox_filament\\ios\\src\\FilamentViewer.cpp",
|
|
||||||
"file": "F:\\Projects\\polyvox\\polyvox_filament\\ios\\src\\FilamentViewer.cpp"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"directory": "F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a",
|
|
||||||
"command": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\clang++.exe --target=aarch64-none-linux-android22 --sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Dpolyvox_filament_android_EXPORTS -I../../../../../ios/src -I../../../../../ios/include -I../../../../../ios/include/stb -I../../../../src/main/cpp -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -std=c++17 -fno-limit-debug-info -fPIC -o CMakeFiles\\polyvox_filament_android.dir\\F_\\Projects\\polyvox\\polyvox_filament\\ios\\src\\StreamBufferAdapter.cpp.o -c F:\\Projects\\polyvox\\polyvox_filament\\ios\\src\\StreamBufferAdapter.cpp",
|
|
||||||
"file": "F:\\Projects\\polyvox\\polyvox_filament\\ios\\src\\StreamBufferAdapter.cpp"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"directory": "F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a",
|
|
||||||
"command": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\clang++.exe --target=aarch64-none-linux-android22 --sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Dpolyvox_filament_android_EXPORTS -I../../../../../ios/src -I../../../../../ios/include -I../../../../../ios/include/stb -I../../../../src/main/cpp -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -std=c++17 -fno-limit-debug-info -fPIC -o CMakeFiles\\polyvox_filament_android.dir\\F_\\Projects\\polyvox\\polyvox_filament\\ios\\src\\TimeIt.cpp.o -c F:\\Projects\\polyvox\\polyvox_filament\\ios\\src\\TimeIt.cpp",
|
|
||||||
"file": "F:\\Projects\\polyvox\\polyvox_filament\\ios\\src\\TimeIt.cpp"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"directory": "F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a",
|
|
||||||
"command": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\clang.exe --target=aarch64-none-linux-android22 --sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -DFILAMENT_SHADERS_EXPORTS -I../../../../../ios/src -I../../../../../ios/include -I../../../../../ios/include/stb -I../../../../src/main/cpp -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fno-limit-debug-info -fPIC -o CMakeFiles\\FILAMENT_SHADERS.dir\\F_\\Projects\\polyvox\\polyvox_filament\\ios\\include\\material\\image.c.o -c F:\\Projects\\polyvox\\polyvox_filament\\ios\\include\\material\\image.c",
|
|
||||||
"file": "F:\\Projects\\polyvox\\polyvox_filament\\ios\\include\\material\\image.c"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"directory": "F:/Projects/polyvox/polyvox_filament/android/.cxx/cmake/debug/arm64-v8a",
|
|
||||||
"command": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\clang.exe --target=aarch64-none-linux-android22 --sysroot=C:/Users/Nick/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -DFILAMENT_SHADERS_EXPORTS -I../../../../../ios/src -I../../../../../ios/include -I../../../../../ios/include/stb -I../../../../src/main/cpp -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fno-limit-debug-info -fPIC -o CMakeFiles\\FILAMENT_SHADERS.dir\\F_\\Projects\\polyvox\\polyvox_filament\\ios\\include\\material\\unlit_opaque.c.o -c F:\\Projects\\polyvox\\polyvox_filament\\ios\\include\\material\\unlit_opaque.c",
|
|
||||||
"file": "F:\\Projects\\polyvox\\polyvox_filament\\ios\\include\\material\\unlit_opaque.c"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"enabled": false,
|
|
||||||
"packages": []
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"ndk": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653",
|
|
||||||
"revision": {
|
|
||||||
"mMajor": 25,
|
|
||||||
"mMinor": 2,
|
|
||||||
"mMicro": 9519653,
|
|
||||||
"mPreview": 0,
|
|
||||||
"mPrecision": "MICRO",
|
|
||||||
"mPreviewSeparator": " "
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"level": "INFO",
|
|
||||||
"message": "android.ndkVersion from module build.gradle is [25.2.9519653]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"level": "INFO",
|
|
||||||
"message": "android.ndkPath from module build.gradle is not set"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"level": "INFO",
|
|
||||||
"message": "ndk.dir in local.properties is not set"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"level": "INFO",
|
|
||||||
"message": "Not considering ANDROID_NDK_HOME because support was removed after deprecation period."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"level": "INFO",
|
|
||||||
"message": "sdkFolder is C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"ndkVersionFromDsl": "25.2.9519653",
|
|
||||||
"sdkFolder": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk",
|
|
||||||
"sideBySideNdkFolderNames": [
|
|
||||||
"19.2.5345600",
|
|
||||||
"21.1.6352462",
|
|
||||||
"21.4.7075529",
|
|
||||||
"22.0.7026061",
|
|
||||||
"22.1.7171670",
|
|
||||||
"23.0.7599858",
|
|
||||||
"23.1.7779620",
|
|
||||||
"23.2.8568313",
|
|
||||||
"24.0.8215888",
|
|
||||||
"25.2.9519653"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"ndk": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653",
|
|
||||||
"revision": {
|
|
||||||
"mMajor": 25,
|
|
||||||
"mMinor": 2,
|
|
||||||
"mMicro": 9519653,
|
|
||||||
"mPreview": 0,
|
|
||||||
"mPrecision": "MICRO",
|
|
||||||
"mPreviewSeparator": " "
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"level": "INFO",
|
|
||||||
"message": "android.ndkVersion from module build.gradle is [25.2.9519653]"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"level": "INFO",
|
|
||||||
"message": "android.ndkPath from module build.gradle is not set"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"level": "INFO",
|
|
||||||
"message": "ndk.dir in local.properties is not set"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"level": "INFO",
|
|
||||||
"message": "Not considering ANDROID_NDK_HOME because support was removed after deprecation period."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"level": "INFO",
|
|
||||||
"message": "sdkFolder is C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"level": "INFO",
|
|
||||||
"message": "Folder C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653 does not exist. Ignoring."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"level": "INFO",
|
|
||||||
"message": "Folder C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk-bundle does not exist. Ignoring."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"level": "INFO",
|
|
||||||
"message": "No NDK was found. Trying to download it now."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"level": "INFO",
|
|
||||||
"message": "NDK 25.2.9519653 was downloaded to C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653. Using that."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"ndkVersionFromDsl": "25.2.9519653",
|
|
||||||
"sdkFolder": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk",
|
|
||||||
"sideBySideNdkFolderNames": [
|
|
||||||
"19.2.5345600",
|
|
||||||
"21.1.6352462",
|
|
||||||
"21.4.7075529",
|
|
||||||
"22.0.7026061",
|
|
||||||
"22.1.7171670",
|
|
||||||
"23.0.7599858",
|
|
||||||
"23.1.7779620",
|
|
||||||
"23.2.8568313",
|
|
||||||
"24.0.8215888"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -15,6 +15,8 @@ add_library(polyvox_filament_android SHARED
|
|||||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/FilamentViewer.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/FilamentViewer.cpp"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/StreamBufferAdapter.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/StreamBufferAdapter.cpp"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/TimeIt.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/TimeIt.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/camutils/Manipulator.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/camutils/Bookmark.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(FILAMENT_SHADERS SHARED
|
add_library(FILAMENT_SHADERS SHARED
|
||||||
|
|||||||
@@ -98,20 +98,24 @@ class PolyvoxFilamentPlugin: FlutterPlugin, MethodCallHandler, ActivityAware, Lo
|
|||||||
if(path!!.startsWith("file://")) {
|
if(path!!.startsWith("file://")) {
|
||||||
data = File(path!!.substring(6)).readBytes()
|
data = File(path!!.substring(6)).readBytes()
|
||||||
} else {
|
} else {
|
||||||
|
var assetPath = path
|
||||||
|
if(assetPath.startsWith("asset://")) {
|
||||||
|
assetPath = assetPath!!.substring(8)
|
||||||
|
}
|
||||||
val loader = FlutterInjector.instance().flutterLoader()
|
val loader = FlutterInjector.instance().flutterLoader()
|
||||||
val key = loader.getLookupKeyForAsset(path)
|
val key = loader.getLookupKeyForAsset(assetPath)
|
||||||
val hotReloadPath = HotReloadPathHelper.getAssetPath(key, activity.getPackageName())
|
val hotReloadPath = HotReloadPathHelper.getAssetPath(key, activity.getPackageName())
|
||||||
if (hotReloadPath != null) {
|
if (hotReloadPath != null) {
|
||||||
data = File(hotReloadPath).readBytes()
|
data = File(hotReloadPath).readBytes()
|
||||||
} else {
|
} else {
|
||||||
Log.i("polyvox_filament", "Loading resource from main asset bundle")
|
Log.i("polyvox_filament", "Loading resource from main asset bundle at ${assetPath}")
|
||||||
|
|
||||||
val assetManager: AssetManager = activity.assets
|
val assetManager: AssetManager = activity.assets
|
||||||
try {
|
try {
|
||||||
data = assetManager.open(key).readBytes()
|
data = assetManager.open(key).readBytes()
|
||||||
Log.i("polyvox_filament", "Loaded ${data.size} bytes")
|
Log.i("polyvox_filament", "Loaded ${data.size} bytes")
|
||||||
} catch (e:Exception) {
|
} catch (e:Exception) {
|
||||||
Log.e("polyvox_filament", "Failed to open asset at ${path}", null)
|
Log.e("polyvox_filament", "Failed to open asset at ${assetPath}", null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,6 +201,7 @@ class PolyvoxFilamentPlugin: FlutterPlugin, MethodCallHandler, ActivityAware, Lo
|
|||||||
_surfaceTextureEntry!!.release();
|
_surfaceTextureEntry!!.release();
|
||||||
_surface = null
|
_surface = null
|
||||||
_surfaceTextureEntry = null
|
_surfaceTextureEntry = null
|
||||||
|
result.success(true)
|
||||||
}
|
}
|
||||||
"resize" -> {
|
"resize" -> {
|
||||||
val args = call.arguments as List<Any>
|
val args = call.arguments as List<Any>
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:5bf3d1e3dcfeb6d5e37ff5d95d6981564ecd86bf7b94089c1be9312c7ebed45c
|
|
||||||
size 201793
|
|
||||||
30
example/.gitattributes
vendored
Normal file
30
example/.gitattributes
vendored
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
assets/lit_opaque_43.uberz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
assets/BusterDrone filter=lfs diff=lfs merge=lfs -text
|
||||||
|
assets/FlightHelmet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
assets/lit_opaque_32.uberz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
windows/lib/**/*.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/12_Settonemappingtolinear.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/3_loadIBL.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/6_zoomin.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/13_Movecameratoasset.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/14_movecamerato.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/7_rotate.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/9_transformtounitcube.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/0_fresh.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/10_setshapespositionto.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/2_loadskybox.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/4_Renderingfalse.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/8_pan.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/11_Disablefrustumculling.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/15_setcameratofirstcamerainshapesGLB.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/1_createviewerdefaultubershader.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/5_loadshapesGLB.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/16_resize.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/3_loadskybox.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/4_loadIBL.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/19_resize.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/17_resize.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/2_Renderingfalse.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/18_resize.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
integration_test/goldens/ios/diffs filter=lfs diff=lfs merge=lfs -text
|
||||||
2
example/.gitignore
vendored
2
example/.gitignore
vendored
@@ -44,3 +44,5 @@ app.*.map.json
|
|||||||
/android/app/debug
|
/android/app/debug
|
||||||
/android/app/profile
|
/android/app/profile
|
||||||
/android/app/release
|
/android/app/release
|
||||||
|
|
||||||
|
/android/.cxx/**/*
|
||||||
|
|||||||
2
example/android/.gitignore
vendored
2
example/android/.gitignore
vendored
@@ -6,6 +6,8 @@ gradle-wrapper.jar
|
|||||||
/local.properties
|
/local.properties
|
||||||
GeneratedPluginRegistrant.java
|
GeneratedPluginRegistrant.java
|
||||||
|
|
||||||
|
.cxx/
|
||||||
|
|
||||||
# Remember to never publicly share your keystore.
|
# Remember to never publicly share your keystore.
|
||||||
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
|
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
|
||||||
key.properties
|
key.properties
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 572 KiB After Width: | Height: | Size: 131 B |
3
example/assets/lit_opaque_43.uberz
Normal file
3
example/assets/lit_opaque_43.uberz
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:cded95729bd217f86db59866042260dd8049bbff25bbde8fb52f37bd605653fa
|
||||||
|
size 212643
|
||||||
9
example/compare_goldens.sh
Normal file
9
example/compare_goldens.sh
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
device=$1
|
||||||
|
if [ -z "$device" ]; then
|
||||||
|
echo "Usage: $0 <device_id>"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f integration_test/goldens/{ios,macos,windows,android}/diffs/*.png
|
||||||
|
flutter drive --driver=test_driver/integration_test.dart -d $1 --target=integration_test/plugin_integration_test.dart
|
||||||
3
example/integration_test/goldens/ios/0_fresh.png
Normal file
3
example/integration_test/goldens/ios/0_fresh.png
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:ec2a9627f23ffe07750323c25afa78c6c7fcb7d26b5ed36d119363ced0b60f29
|
||||||
|
size 258304
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:53256c9443c6d36edfb8c1234711173c847126e888d714151ae026c57495fe6b
|
||||||
|
size 1875814
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:b0c715cadbf84c2161099e8373a404c7d6dbb093faf4157aa0e0aa3825c28217
|
||||||
|
size 1868778
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:56a431b561db7038ad7fe92d025fc2fe2806dfa2cf68c29a0380c3cbd2b66fb5
|
||||||
|
size 1742539
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:14193a392baf348f77895ca7bfb8cee160407c762d03c01bf1f7b5b771a9b1ab
|
||||||
|
size 2282401
|
||||||
3
example/integration_test/goldens/ios/14_movecamerato.png
Normal file
3
example/integration_test/goldens/ios/14_movecamerato.png
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:77badd0b2a59122949e497297052064c403006272daa4488db43e492d60093e2
|
||||||
|
size 1959141
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:bdf63e19e5a992f2c848cf71b55ceddf8930d6a9368c9b3adcc13e7c478c7146
|
||||||
|
size 1889777
|
||||||
3
example/integration_test/goldens/ios/16_resize.png
Normal file
3
example/integration_test/goldens/ios/16_resize.png
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:651c19434ae3753488eb840695955b98db9d66a20b79bee1e21b3384c2358025
|
||||||
|
size 1609541
|
||||||
3
example/integration_test/goldens/ios/17_resize.png
Normal file
3
example/integration_test/goldens/ios/17_resize.png
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:f11462c0fdf30d101b6ed6c430734adcf6451818f3c7824126c8423014836773
|
||||||
|
size 2060944
|
||||||
3
example/integration_test/goldens/ios/18_resize.png
Normal file
3
example/integration_test/goldens/ios/18_resize.png
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:beb941d33777ad2e1d6ef3704ba6a63b3a5608ca885a516a1c9e807a31b533fc
|
||||||
|
size 1608407
|
||||||
3
example/integration_test/goldens/ios/19_resize.png
Normal file
3
example/integration_test/goldens/ios/19_resize.png
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:2bcae11fd2eb593c419a62731e1799f7340408b28ad56575fab5f79db608ae17
|
||||||
|
size 2062339
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:dc3b3c5e0678a5b71728cea8961925e6c0fb44a59340aa2d77d4ea92a24cc7d6
|
||||||
|
size 316763
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:6dbbb518a86c546f188134c1d369762664f188dd6b9a38ec13963b6187cb4b25
|
||||||
|
size 1456648
|
||||||
3
example/integration_test/goldens/ios/3_loadskybox.png
Normal file
3
example/integration_test/goldens/ios/3_loadskybox.png
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:2d7951418e5875da7c7ed8dea482dbf1cbe81a42b47d255db7f1b6e11c16a193
|
||||||
|
size 1876507
|
||||||
3
example/integration_test/goldens/ios/4_loadIBL.png
Normal file
3
example/integration_test/goldens/ios/4_loadIBL.png
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:80cd11f5be75012cfdf953569e409a355826ca23af35feba41aac78f0e3d35d8
|
||||||
|
size 1874857
|
||||||
3
example/integration_test/goldens/ios/5_loadshapesGLB.png
Normal file
3
example/integration_test/goldens/ios/5_loadshapesGLB.png
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:e605bb18426ea657b9352ecca51f0b55daac904b15dba3afdcffc412a445548a
|
||||||
|
size 1941423
|
||||||
3
example/integration_test/goldens/ios/6_zoomin.png
Normal file
3
example/integration_test/goldens/ios/6_zoomin.png
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:c026e8723922a6c56ab8e28f99a29805c53627ff5a659971590c95d89d7ac6bd
|
||||||
|
size 1940845
|
||||||
3
example/integration_test/goldens/ios/7_rotate.png
Normal file
3
example/integration_test/goldens/ios/7_rotate.png
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:fffa285edd2c5474e16475cafc67d2519e000b74178ce1a0f8d88229827cfabf
|
||||||
|
size 1937116
|
||||||
3
example/integration_test/goldens/ios/8_pan.png
Normal file
3
example/integration_test/goldens/ios/8_pan.png
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:1db7a2f831d83e75e42dfe4f0547e9ed1f171152f45103e8f250d2b52ee3a8e1
|
||||||
|
size 1937776
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:00c70e7e77b98e4e72d0dde82482066096ebd502d25cccfada9cb87de332ecac
|
||||||
|
size 1941844
|
||||||
@@ -1,25 +1,158 @@
|
|||||||
// This is a basic Flutter integration test.
|
import 'dart:async';
|
||||||
//
|
import 'dart:io';
|
||||||
// Since integration tests run in a full Flutter application, they can interact
|
import 'dart:ui';
|
||||||
// with the host side of a plugin implementation, unlike Dart unit tests.
|
|
||||||
//
|
|
||||||
// For more information about Flutter integration tests, please see
|
|
||||||
// https://docs.flutter.dev/cookbook/testing/integration/introduction
|
|
||||||
|
|
||||||
|
|
||||||
|
import 'package:flutter/gestures.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:integration_test/integration_test.dart';
|
import 'package:integration_test/integration_test.dart';
|
||||||
|
import 'package:polyvox_filament/widgets/filament_widget.dart';
|
||||||
import 'package:polyvox_filament/polyvox_filament.dart';
|
import '../lib/main.dart' as app;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized()
|
||||||
|
as IntegrationTestWidgetsFlutterBinding;
|
||||||
|
|
||||||
testWidgets('getPlatformVersion test', (WidgetTester tester) async {
|
late String platformIdentifier;
|
||||||
final PolyvoxFilament plugin = PolyvoxFilament();
|
if (Platform.isIOS) {
|
||||||
final String? version = await plugin.getPlatformVersion();
|
platformIdentifier = "ios";
|
||||||
// The version string depends on the host platform running the test, so
|
} else if (Platform.isAndroid) {
|
||||||
// just assert that some non-empty string is returned.
|
platformIdentifier = "android";
|
||||||
expect(version?.isNotEmpty, true);
|
} else if (Platform.isMacOS) {
|
||||||
|
platformIdentifier = "macos";
|
||||||
|
} else if (Platform.isWindows) {
|
||||||
|
platformIdentifier = "windows";
|
||||||
|
} else if (Platform.isLinux) {
|
||||||
|
platformIdentifier = "linux";
|
||||||
|
} else {
|
||||||
|
throw Exception("Unexpected platform");
|
||||||
|
}
|
||||||
|
|
||||||
|
int _counter = 0;
|
||||||
|
|
||||||
|
Future _snapshot(WidgetTester tester, String label,
|
||||||
|
[int seconds = 0]) async {
|
||||||
|
await tester.pumpAndSettle(Duration(milliseconds: 16));
|
||||||
|
for (int i = 0; i < seconds; i++) {
|
||||||
|
await Future.delayed(Duration(seconds: 1));
|
||||||
|
await tester.pumpAndSettle(Duration(milliseconds: 16));
|
||||||
|
}
|
||||||
|
await tester.pumpAndSettle(Duration(milliseconds: 16));
|
||||||
|
var screenshotPath = '$platformIdentifier/${_counter}_$label';
|
||||||
|
if (Platform.isIOS) {
|
||||||
|
// this is currently hanging on Android
|
||||||
|
// see https://github.com/flutter/flutter/issues/127306
|
||||||
|
// it is also not yet implemented on Windows or MacOS
|
||||||
|
await binding.convertFlutterSurfaceToImage();
|
||||||
|
final bytes = await binding.takeScreenshot(screenshotPath);
|
||||||
|
}
|
||||||
|
_counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future tap(WidgetTester tester, String label, [int seconds = 0]) async {
|
||||||
|
var target = find.text(label).first;
|
||||||
|
await tester.dragUntilVisible(
|
||||||
|
target,
|
||||||
|
find.byType(SingleChildScrollView),
|
||||||
|
// widget you want to scroll
|
||||||
|
const Offset(0, 500), // delta to move
|
||||||
|
duration: Duration(milliseconds: 10));
|
||||||
|
await tester.tap(target);
|
||||||
|
await _snapshot(
|
||||||
|
tester, label.replaceAll(RegExp("[ -:]"), ""), seconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> pumpUntilFound(
|
||||||
|
WidgetTester tester,
|
||||||
|
Finder finder, {
|
||||||
|
Duration timeout = const Duration(seconds: 30),
|
||||||
|
}) async {
|
||||||
|
bool timerDone = false;
|
||||||
|
final timer = Timer(
|
||||||
|
timeout, () => throw TimeoutException("Pump until has timed out"));
|
||||||
|
while (timerDone != true) {
|
||||||
|
await tester.pump();
|
||||||
|
|
||||||
|
final found = tester.any(finder);
|
||||||
|
if (found) {
|
||||||
|
timerDone = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
timer.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
testWidgets('test', (WidgetTester tester) async {
|
||||||
|
app.main();
|
||||||
|
await pumpUntilFound(tester, find.byType(app.ExampleWidget));
|
||||||
|
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
await _snapshot(tester, "fresh");
|
||||||
|
|
||||||
|
await tap(tester, "create viewer (default ubershader)", 4);
|
||||||
|
|
||||||
|
await tap(tester, "Rendering: false", 2);
|
||||||
|
|
||||||
|
await tap(tester, "load skybox", 2);
|
||||||
|
await tap(tester, "load IBL", 2);
|
||||||
|
await tap(tester, "load shapes GLB", 2);
|
||||||
|
|
||||||
|
final Offset pointerLocation =
|
||||||
|
tester.getCenter(find.byType(FilamentWidget));
|
||||||
|
TestPointer testPointer = TestPointer(1, PointerDeviceKind.mouse);
|
||||||
|
|
||||||
|
// scroll/zoom
|
||||||
|
testPointer.hover(pointerLocation);
|
||||||
|
await tester.sendEventToBinding(testPointer.scroll(const Offset(0.0, 1.0)));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
await tester.sendEventToBinding(testPointer.scroll(const Offset(0.0, 1.0)));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
await _snapshot(tester, "zoomin");
|
||||||
|
|
||||||
|
// rotate
|
||||||
|
testPointer =
|
||||||
|
TestPointer(1, PointerDeviceKind.mouse, null, kTertiaryButton);
|
||||||
|
testPointer.hover(pointerLocation);
|
||||||
|
await tester.sendEventToBinding(testPointer.down(pointerLocation));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
await tester.sendEventToBinding(
|
||||||
|
testPointer.move(pointerLocation + Offset(10.0, 10.0)));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
await tester.sendEventToBinding(
|
||||||
|
testPointer.move(pointerLocation + Offset(20.0, 20.0)));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
await tester.sendEventToBinding(testPointer.up());
|
||||||
|
|
||||||
|
await _snapshot(tester, "rotate", 2);
|
||||||
|
|
||||||
|
// pan
|
||||||
|
testPointer = TestPointer(1, PointerDeviceKind.mouse, null, kPrimaryButton);
|
||||||
|
testPointer.hover(pointerLocation);
|
||||||
|
await tester.sendEventToBinding(testPointer.down(pointerLocation));
|
||||||
|
await tester
|
||||||
|
.sendEventToBinding(testPointer.move(pointerLocation + Offset(0, 1.0)));
|
||||||
|
|
||||||
|
for (int i = 0; i < 60; i++) {
|
||||||
|
await tester.sendEventToBinding(testPointer
|
||||||
|
.move(pointerLocation + Offset(i.toDouble() * 2, i.toDouble() * 2)));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
}
|
||||||
|
await tester.sendEventToBinding(testPointer.up());
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
await _snapshot(tester, "pan");
|
||||||
|
|
||||||
|
await tap(tester, "transform to unit cube");
|
||||||
|
await tap(tester, "set shapes position to 1, 1, -1");
|
||||||
|
await tap(tester, "Disable frustum culling");
|
||||||
|
await tap(tester, "Set tone mapping to linear");
|
||||||
|
await tap(tester, "Move camera to asset");
|
||||||
|
await tap(tester, "move camera to 1, 1, -1");
|
||||||
|
await tap(tester, 'set camera to first camera in shapes GLB');
|
||||||
|
|
||||||
|
await tap(tester, 'resize', 1);
|
||||||
|
await tap(tester, 'resize', 1);
|
||||||
|
await tap(tester, 'resize', 1);
|
||||||
|
await tap(tester, 'resize', 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,34 @@
|
|||||||
PODS:
|
PODS:
|
||||||
- Flutter (1.0.0)
|
- Flutter (1.0.0)
|
||||||
|
- integration_test (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- path_provider_foundation (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- FlutterMacOS
|
||||||
- polyvox_filament (0.0.1):
|
- polyvox_filament (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- Flutter (from `Flutter`)
|
- Flutter (from `Flutter`)
|
||||||
|
- integration_test (from `.symlinks/plugins/integration_test/ios`)
|
||||||
|
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||||
- polyvox_filament (from `.symlinks/plugins/polyvox_filament/ios`)
|
- polyvox_filament (from `.symlinks/plugins/polyvox_filament/ios`)
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
Flutter:
|
Flutter:
|
||||||
:path: Flutter
|
:path: Flutter
|
||||||
|
integration_test:
|
||||||
|
:path: ".symlinks/plugins/integration_test/ios"
|
||||||
|
path_provider_foundation:
|
||||||
|
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
||||||
polyvox_filament:
|
polyvox_filament:
|
||||||
:path: ".symlinks/plugins/polyvox_filament/ios"
|
:path: ".symlinks/plugins/polyvox_filament/ios"
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||||
polyvox_filament: 99047b2e0d56e073f5db603dd6152a1598c2a345
|
integration_test: 13825b8a9334a850581300559b8839134b124670
|
||||||
|
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
|
||||||
|
polyvox_filament: 35fece7761e74c973afd80fe3aa0ca225eaace32
|
||||||
|
|
||||||
PODFILE CHECKSUM: 7adbc9d59f05e1b01f554ea99b6c79e97f2214a2
|
PODFILE CHECKSUM: 7adbc9d59f05e1b01f554ea99b6c79e97f2214a2
|
||||||
|
|
||||||
|
|||||||
@@ -138,6 +138,7 @@
|
|||||||
97C146EC1CF9000F007C117D /* Resources */,
|
97C146EC1CF9000F007C117D /* Resources */,
|
||||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||||
|
F9FAB8A67CF505858CCDA424 /* [CP] Embed Pods Frameworks */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
@@ -249,6 +250,23 @@
|
|||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||||
};
|
};
|
||||||
|
F9FAB8A67CF505858CCDA424 /* [CP] Embed Pods Frameworks */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputFileListPaths = (
|
||||||
|
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||||
|
);
|
||||||
|
name = "[CP] Embed Pods Frameworks";
|
||||||
|
outputFileListPaths = (
|
||||||
|
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||||
|
showEnvVarsInLog = 0;
|
||||||
|
};
|
||||||
/* End PBXShellScriptBuildPhase section */
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
@@ -343,6 +361,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||||
|
DEAD_CODE_STRIPPING = NO;
|
||||||
DEVELOPMENT_TEAM = TM2B4SJXNJ;
|
DEVELOPMENT_TEAM = TM2B4SJXNJ;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -354,6 +373,8 @@
|
|||||||
OTHER_CFLAGS = "-fvisibility=default";
|
OTHER_CFLAGS = "-fvisibility=default";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = app.polyvox.example;
|
PRODUCT_BUNDLE_IDENTIFIER = app.polyvox.example;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
STRIP_INSTALLED_PRODUCT = NO;
|
||||||
|
STRIP_STYLE = "non-global";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
@@ -479,6 +500,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||||
|
DEAD_CODE_STRIPPING = NO;
|
||||||
DEVELOPMENT_TEAM = TM2B4SJXNJ;
|
DEVELOPMENT_TEAM = TM2B4SJXNJ;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -490,6 +512,8 @@
|
|||||||
OTHER_CFLAGS = "-fvisibility=default";
|
OTHER_CFLAGS = "-fvisibility=default";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = app.polyvox.example;
|
PRODUCT_BUNDLE_IDENTIFIER = app.polyvox.example;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
STRIP_INSTALLED_PRODUCT = NO;
|
||||||
|
STRIP_STYLE = "non-global";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
@@ -505,6 +529,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||||
|
DEAD_CODE_STRIPPING = NO;
|
||||||
DEVELOPMENT_TEAM = TM2B4SJXNJ;
|
DEVELOPMENT_TEAM = TM2B4SJXNJ;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -516,6 +541,8 @@
|
|||||||
OTHER_CFLAGS = "-fvisibility=default";
|
OTHER_CFLAGS = "-fvisibility=default";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = app.polyvox.example;
|
PRODUCT_BUNDLE_IDENTIFIER = app.polyvox.example;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
STRIP_INSTALLED_PRODUCT = NO;
|
||||||
|
STRIP_STYLE = "non-global";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -5,11 +6,11 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:polyvox_filament/filament_controller.dart';
|
import 'package:polyvox_filament/filament_controller.dart';
|
||||||
import 'package:polyvox_filament/animations/bone_animation_data.dart';
|
import 'package:polyvox_filament/animations/bone_animation_data.dart';
|
||||||
import 'package:polyvox_filament/filament_controller_ffi.dart';
|
import 'package:polyvox_filament/filament_controller_ffi.dart';
|
||||||
import 'package:polyvox_filament/filament_gesture_detector.dart';
|
|
||||||
import 'package:polyvox_filament/filament_widget.dart';
|
|
||||||
import 'package:polyvox_filament/animations/animation_builder.dart';
|
import 'package:polyvox_filament/animations/animation_builder.dart';
|
||||||
|
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
import 'package:polyvox_filament/widgets/filament_gesture_detector.dart';
|
||||||
|
import 'package:polyvox_filament/widgets/filament_widget.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
@@ -40,250 +41,337 @@ class ExampleWidget extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ExampleWidgetState extends State<ExampleWidget> {
|
class _ExampleWidgetState extends State<ExampleWidget> {
|
||||||
final _filamentController = FilamentControllerFFI();
|
FilamentController? _filamentController;
|
||||||
|
|
||||||
FilamentEntity? _shapes;
|
FilamentEntity? _shapes;
|
||||||
FilamentEntity? _flightHelmet;
|
FilamentEntity? _flightHelmet;
|
||||||
List<String>? _animations;
|
List<String>? _animations;
|
||||||
FilamentEntity? _light;
|
FilamentEntity? _light;
|
||||||
|
|
||||||
|
StreamSubscription? _pickResultListener;
|
||||||
|
String? picked;
|
||||||
|
|
||||||
final weights = List.filled(255, 0.0);
|
final weights = List.filled(255, 0.0);
|
||||||
|
|
||||||
bool _loop = false;
|
bool _loop = false;
|
||||||
bool _vertical = false;
|
EdgeInsets _viewportMargin = EdgeInsets.zero;
|
||||||
|
|
||||||
|
bool _readyForScene = false;
|
||||||
|
|
||||||
bool _rendering = false;
|
bool _rendering = false;
|
||||||
int _framerate = 60;
|
int _framerate = 60;
|
||||||
|
bool _postProcessing = true;
|
||||||
bool _initialized = false;
|
|
||||||
|
|
||||||
bool _coneHidden = false;
|
bool _coneHidden = false;
|
||||||
bool _frustumCulling = true;
|
bool _frustumCulling = true;
|
||||||
|
|
||||||
|
StreamSubscription? _hasViewerListener;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void dispose() {
|
||||||
getApplicationSupportDirectory().then((dir) {
|
super.dispose();
|
||||||
print(dir);
|
_pickResultListener?.cancel();
|
||||||
});
|
_hasViewerListener?.cancel();
|
||||||
super.initState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _item(void Function() onTap, String text) {
|
Widget _item(void Function() onTap, String text) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: onTap,
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
onTap();
|
||||||
|
});
|
||||||
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
||||||
child: Text(text)));
|
child: Text(text)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _createController({String? uberArchivePath}) {
|
||||||
|
_filamentController =
|
||||||
|
FilamentControllerFFI(uberArchivePath: uberArchivePath);
|
||||||
|
_filamentController!.pickResult.listen((entityId) {
|
||||||
|
setState(() {
|
||||||
|
picked = _filamentController!.getNameForEntity(entityId!);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
_hasViewerListener =
|
||||||
|
_filamentController!.hasViewer.listen((bool hasViewer) {
|
||||||
|
setState(() {
|
||||||
|
_readyForScene = hasViewer;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var children = [
|
var children = <Widget>[];
|
||||||
_item(() {
|
|
||||||
_filamentController.render();
|
|
||||||
}, "render"),
|
|
||||||
_item(() {
|
|
||||||
setState(() {
|
|
||||||
_rendering = !_rendering;
|
|
||||||
_filamentController.setRendering(_rendering);
|
|
||||||
});
|
|
||||||
}, "Rendering: $_rendering "),
|
|
||||||
_item(() {
|
|
||||||
setState(() {
|
|
||||||
_framerate = _framerate == 60 ? 30 : 60;
|
|
||||||
_filamentController.setFrameRate(_framerate);
|
|
||||||
});
|
|
||||||
}, "$_framerate fps"),
|
|
||||||
_item(() {
|
|
||||||
_filamentController.setBackgroundColor(Color(0xFF73C9FA));
|
|
||||||
}, "set background color"),
|
|
||||||
_item(() {
|
|
||||||
_filamentController.setBackgroundImage('assets/background.ktx');
|
|
||||||
}, "load background image"),
|
|
||||||
_item(() {
|
|
||||||
_filamentController.setBackgroundImage('assets/background.ktx',
|
|
||||||
fillHeight: true);
|
|
||||||
}, "load background image (fill height)"),
|
|
||||||
_item(() {
|
|
||||||
_filamentController
|
|
||||||
.loadSkybox('assets/default_env/default_env_skybox.ktx');
|
|
||||||
}, 'load skybox'),
|
|
||||||
_item(() {
|
|
||||||
_filamentController.loadIbl('assets/default_env/default_env_ibl.ktx');
|
|
||||||
}, 'load IBL'),
|
|
||||||
_item(
|
|
||||||
() {
|
|
||||||
_filamentController.removeSkybox();
|
|
||||||
},
|
|
||||||
'remove skybox',
|
|
||||||
),
|
|
||||||
_item(() async {
|
|
||||||
_shapes = await _filamentController.loadGlb('assets/shapes/shapes.glb');
|
|
||||||
_animations = await _filamentController.getAnimationNames(_shapes!);
|
|
||||||
setState(() {});
|
|
||||||
}, 'load shapes GLB'),
|
|
||||||
_item(() async {
|
|
||||||
if (_coneHidden) {
|
|
||||||
_filamentController.reveal(_shapes!, "Cone");
|
|
||||||
} else {
|
|
||||||
_filamentController.hide(_shapes!, "Cone");
|
|
||||||
}
|
|
||||||
setState(() {
|
|
||||||
_coneHidden = !_coneHidden;
|
|
||||||
});
|
|
||||||
}, _coneHidden ? 'show cone' : 'hide cone'),
|
|
||||||
_item(() async {
|
|
||||||
if (_shapes != null) {
|
|
||||||
_filamentController.removeAsset(_shapes!);
|
|
||||||
}
|
|
||||||
_shapes =
|
|
||||||
await _filamentController.loadGltf('assets/shapes/shapes.gltf', 'assets/shapes');
|
|
||||||
}, 'load shapes GLTF'),
|
|
||||||
_item(() async {
|
|
||||||
_filamentController.transformToUnitCube(_shapes!);
|
|
||||||
}, 'transform to unit cube'),
|
|
||||||
_item(() async {
|
|
||||||
_filamentController.setPosition(_shapes!, 1.0, 1.0, -1.0);
|
|
||||||
}, 'set shapes position to 1, 1, -1'),
|
|
||||||
_item(() async {
|
|
||||||
_filamentController.setPosition(_shapes!, 1.0, 1.0, -1.0);
|
|
||||||
}, 'move camera to shapes position'),
|
|
||||||
_item(() async {
|
|
||||||
var frameData = Float32List.fromList(
|
|
||||||
List<double>.generate(120, (i) => i / 120).expand((x) {
|
|
||||||
var vals = List<double>.filled(7, x);
|
|
||||||
vals[3] = 1.0;
|
|
||||||
// vals[4] = 0;
|
|
||||||
vals[5] = 0;
|
|
||||||
vals[6] = 0;
|
|
||||||
return vals;
|
|
||||||
}).toList());
|
|
||||||
|
|
||||||
_filamentController.setBoneAnimation(
|
if (_filamentController == null) {
|
||||||
_shapes!,
|
children.addAll([
|
||||||
BoneAnimationData(
|
_item(() {
|
||||||
"Bone.001", ["Cube.001"], frameData, 1000.0 / 60.0));
|
_createController();
|
||||||
// ,
|
}, "create viewer (default ubershader)"),
|
||||||
// "Bone.001",
|
_item(() {
|
||||||
// "Cube.001",
|
_createController(
|
||||||
// BoneTransform([Vec3(x: 0, y: 0.0, z: 0.0)],
|
uberArchivePath: Platform.isWindows
|
||||||
// [Quaternion(x: 1, y: 1, z: 1, w: 1)]));
|
? "assets/lit_opaque_32.uberz"
|
||||||
}, 'construct bone animation'),
|
: "assets/lit_opaque_43.uberz");
|
||||||
_item(() async {
|
}, "create viewer (custom ubershader - lit opaque only)"),
|
||||||
_filamentController.removeAsset(_shapes!);
|
]);
|
||||||
_shapes = null;
|
|
||||||
}, 'remove shapes'),
|
|
||||||
_item(() async {
|
|
||||||
_filamentController.clearAssets();
|
|
||||||
_shapes = null;
|
|
||||||
}, 'clear all assets'),
|
|
||||||
_item(() async {
|
|
||||||
var names =
|
|
||||||
await _filamentController.getMorphTargetNames(_shapes!, "Cylinder");
|
|
||||||
await showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (ctx) {
|
|
||||||
return Container(
|
|
||||||
height: 100,
|
|
||||||
width: 100,
|
|
||||||
color: Colors.white,
|
|
||||||
child: Text(names.join(",")));
|
|
||||||
});
|
|
||||||
}, "show morph target names for Cylinder"),
|
|
||||||
_item(() {
|
|
||||||
_filamentController.setMorphTargetWeights(
|
|
||||||
_shapes!, "Cylinder", List.filled(4, 1.0));
|
|
||||||
}, "set Cylinder morph weights to 1"),
|
|
||||||
_item(() {
|
|
||||||
_filamentController.setMorphTargetWeights(
|
|
||||||
_shapes!, "Cylinder", List.filled(4, 0.0));
|
|
||||||
}, "set Cylinder morph weights to 0.0"),
|
|
||||||
_item(() async {
|
|
||||||
var morphs =
|
|
||||||
await _filamentController.getMorphTargetNames(_shapes!, "Cylinder");
|
|
||||||
final animation = AnimationBuilder(
|
|
||||||
availableMorphs: morphs, framerate: 30, meshName: "Cylinder")
|
|
||||||
.setDuration(4)
|
|
||||||
.setMorphTargets(["Key 1", "Key 2"])
|
|
||||||
.interpolateMorphWeights(0, 4, 0, 1)
|
|
||||||
.build();
|
|
||||||
_filamentController.setMorphAnimationData(_shapes!, animation);
|
|
||||||
}, "animate cylinder morph weights #1 and #2"),
|
|
||||||
_item(() async {
|
|
||||||
var morphs =
|
|
||||||
await _filamentController.getMorphTargetNames(_shapes!, "Cylinder");
|
|
||||||
final animation = AnimationBuilder(
|
|
||||||
availableMorphs: morphs, framerate: 30, meshName: "Cylinder")
|
|
||||||
.setDuration(4)
|
|
||||||
.setMorphTargets(["Key 3", "Key 4"])
|
|
||||||
.interpolateMorphWeights(0, 4, 0, 1)
|
|
||||||
.build();
|
|
||||||
_filamentController.setMorphAnimationData(_shapes!, animation);
|
|
||||||
}, "animate cylinder morph weights #3 and #4"),
|
|
||||||
_item(() async {
|
|
||||||
var morphs =
|
|
||||||
await _filamentController.getMorphTargetNames(_shapes!, "Cube");
|
|
||||||
final animation = AnimationBuilder(
|
|
||||||
availableMorphs: morphs, framerate: 30, meshName: "Cube")
|
|
||||||
.setDuration(4)
|
|
||||||
.setMorphTargets(["Key 1", "Key 2"])
|
|
||||||
.interpolateMorphWeights(0, 4, 0, 1)
|
|
||||||
.build();
|
|
||||||
_filamentController.setMorphAnimationData(_shapes!, animation);
|
|
||||||
}, "animate shapes morph weights #1 and #2"),
|
|
||||||
_item(() {
|
|
||||||
_filamentController.setMaterialColor(_shapes!, "Cone", 0, Colors.purple);
|
|
||||||
}, "set cone material color to purple"),
|
|
||||||
_item(() {
|
|
||||||
_loop = !_loop;
|
|
||||||
setState(() {});
|
|
||||||
}, "toggle animation looping ${_loop ? "OFF" : "ON"}")
|
|
||||||
];
|
|
||||||
if (_animations != null) {
|
|
||||||
children.addAll(_animations!.map((a) => _item(() {
|
|
||||||
_filamentController.playAnimation(_shapes!, _animations!.indexOf(a),
|
|
||||||
replaceActive: true, crossfade: 0.5, loop: _loop);
|
|
||||||
}, "play animation ${_animations!.indexOf(a)} (replace/fade)")));
|
|
||||||
children.addAll(_animations!.map((a) => _item(() {
|
|
||||||
_filamentController.playAnimation(_shapes!, _animations!.indexOf(a),
|
|
||||||
replaceActive: false, loop: _loop);
|
|
||||||
}, "play animation ${_animations!.indexOf(a)} (noreplace)")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
children.add(_item(() {
|
if (_readyForScene) {
|
||||||
_filamentController.setToneMapping(ToneMapper.LINEAR);
|
children.addAll([
|
||||||
}, "Set tone mapping to linear"));
|
_item(() {
|
||||||
|
_filamentController!.destroy();
|
||||||
|
_filamentController = null;
|
||||||
|
}, "destroy viewer/texture"),
|
||||||
|
_item(() {
|
||||||
|
_filamentController!.render();
|
||||||
|
}, "render"),
|
||||||
|
_item(() {
|
||||||
|
setState(() {
|
||||||
|
_rendering = !_rendering;
|
||||||
|
_filamentController!.setRendering(_rendering);
|
||||||
|
});
|
||||||
|
}, "Rendering: $_rendering"),
|
||||||
|
_item(() {
|
||||||
|
setState(() {
|
||||||
|
_framerate = _framerate == 60 ? 30 : 60;
|
||||||
|
_filamentController!.setFrameRate(_framerate);
|
||||||
|
});
|
||||||
|
}, "$_framerate fps"),
|
||||||
|
_item(() {
|
||||||
|
_filamentController!.setBackgroundColor(Color(0xFF73C9FA));
|
||||||
|
}, "set background color"),
|
||||||
|
_item(() {
|
||||||
|
_filamentController!.setBackgroundImage('assets/background.ktx');
|
||||||
|
}, "load background image"),
|
||||||
|
_item(() {
|
||||||
|
_filamentController!
|
||||||
|
.setBackgroundImage('assets/background.ktx', fillHeight: true);
|
||||||
|
}, "load background image (fill height)"),
|
||||||
|
_item(() {
|
||||||
|
_filamentController!
|
||||||
|
.loadSkybox('assets/default_env/default_env_skybox.ktx');
|
||||||
|
}, 'load skybox'),
|
||||||
|
_item(() {
|
||||||
|
_filamentController!
|
||||||
|
.loadIbl('assets/default_env/default_env_ibl.ktx');
|
||||||
|
}, 'load IBL'),
|
||||||
|
_item(() async {
|
||||||
|
_light = await _filamentController!
|
||||||
|
.addLight(1, 6500, 150000, 0, 1, 0, 0, -1, 0, true);
|
||||||
|
}, "add directional light"),
|
||||||
|
_item(() async {
|
||||||
|
await _filamentController!.clearLights();
|
||||||
|
}, "clear lights"),
|
||||||
|
_item(() {
|
||||||
|
setState(() {
|
||||||
|
_postProcessing = !_postProcessing;
|
||||||
|
});
|
||||||
|
_filamentController!.setPostProcessing(_postProcessing);
|
||||||
|
}, "${_postProcessing ? "Disable" : "Enable"} postprocessing"),
|
||||||
|
_item(
|
||||||
|
() {
|
||||||
|
_filamentController!.removeSkybox();
|
||||||
|
},
|
||||||
|
'remove skybox',
|
||||||
|
),
|
||||||
|
_item(() async {
|
||||||
|
_shapes =
|
||||||
|
await _filamentController!.loadGlb('assets/shapes/shapes.glb');
|
||||||
|
_animations = await _filamentController!.getAnimationNames(_shapes!);
|
||||||
|
setState(() {});
|
||||||
|
}, 'load shapes GLB'),
|
||||||
|
_item(() async {
|
||||||
|
_animations = await _filamentController!.setCamera(_shapes!, null);
|
||||||
|
setState(() {});
|
||||||
|
}, 'set camera to first camera in shapes GLB'),
|
||||||
|
_item(() async {
|
||||||
|
if (_coneHidden) {
|
||||||
|
_filamentController!.reveal(_shapes!, "Cone");
|
||||||
|
} else {
|
||||||
|
_filamentController!.hide(_shapes!, "Cone");
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
_coneHidden = !_coneHidden;
|
||||||
|
});
|
||||||
|
}, _coneHidden ? 'show cone' : 'hide cone'),
|
||||||
|
_item(() async {
|
||||||
|
if (_shapes != null) {
|
||||||
|
_filamentController!.removeAsset(_shapes!);
|
||||||
|
}
|
||||||
|
_shapes = await _filamentController!
|
||||||
|
.loadGltf('assets/shapes/shapes.gltf', 'assets/shapes');
|
||||||
|
}, 'load shapes GLTF'),
|
||||||
|
_item(() async {
|
||||||
|
_filamentController!.transformToUnitCube(_shapes!);
|
||||||
|
}, 'transform to unit cube'),
|
||||||
|
_item(() async {
|
||||||
|
_filamentController!.setPosition(_shapes!, 1.0, 1.0, -1.0);
|
||||||
|
}, 'set shapes position to 1, 1, -1'),
|
||||||
|
_item(() async {
|
||||||
|
_filamentController!.setCameraPosition(1.0, 1.0, -1.0);
|
||||||
|
}, 'move camera to 1, 1, -1'),
|
||||||
|
_item(() async {
|
||||||
|
var frameData = Float32List.fromList(
|
||||||
|
List<double>.generate(120, (i) => i / 120).expand((x) {
|
||||||
|
var vals = List<double>.filled(7, x);
|
||||||
|
vals[3] = 1.0;
|
||||||
|
// vals[4] = 0;
|
||||||
|
vals[5] = 0;
|
||||||
|
vals[6] = 0;
|
||||||
|
return vals;
|
||||||
|
}).toList());
|
||||||
|
|
||||||
children.add(_item(() {
|
_filamentController!.setBoneAnimation(
|
||||||
_filamentController.moveCameraToAsset(_shapes!);
|
_shapes!,
|
||||||
}, "Move camera to asset"));
|
BoneAnimationData(
|
||||||
|
"Bone.001", ["Cube.001"], frameData, 1000.0 / 60.0));
|
||||||
|
// ,
|
||||||
|
// "Bone.001",
|
||||||
|
// "Cube.001",
|
||||||
|
// BoneTransform([Vec3(x: 0, y: 0.0, z: 0.0)],
|
||||||
|
// [Quaternion(x: 1, y: 1, z: 1, w: 1)]));
|
||||||
|
}, 'construct bone animation'),
|
||||||
|
_item(() async {
|
||||||
|
_filamentController!.removeAsset(_shapes!);
|
||||||
|
_shapes = null;
|
||||||
|
}, 'remove shapes'),
|
||||||
|
_item(() async {
|
||||||
|
_filamentController!.clearAssets();
|
||||||
|
_shapes = null;
|
||||||
|
}, 'clear all assets'),
|
||||||
|
_item(() async {
|
||||||
|
var names = await _filamentController!
|
||||||
|
.getMorphTargetNames(_shapes!, "Cylinder");
|
||||||
|
await showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (ctx) {
|
||||||
|
return Container(
|
||||||
|
height: 100,
|
||||||
|
width: 100,
|
||||||
|
color: Colors.white,
|
||||||
|
child: Text(names.join(",")));
|
||||||
|
});
|
||||||
|
}, "show morph target names for Cylinder"),
|
||||||
|
_item(() {
|
||||||
|
_filamentController!
|
||||||
|
.setMorphTargetWeights(_shapes!, "Cylinder", List.filled(4, 1.0));
|
||||||
|
}, "set Cylinder morph weights to 1"),
|
||||||
|
_item(() {
|
||||||
|
_filamentController!
|
||||||
|
.setMorphTargetWeights(_shapes!, "Cylinder", List.filled(4, 0.0));
|
||||||
|
}, "set Cylinder morph weights to 0.0"),
|
||||||
|
_item(() async {
|
||||||
|
var morphs = await _filamentController!
|
||||||
|
.getMorphTargetNames(_shapes!, "Cylinder");
|
||||||
|
final animation = AnimationBuilder(
|
||||||
|
availableMorphs: morphs, framerate: 30, meshName: "Cylinder")
|
||||||
|
.setDuration(4)
|
||||||
|
.setMorphTargets(["Key 1", "Key 2"])
|
||||||
|
.interpolateMorphWeights(0, 4, 0, 1)
|
||||||
|
.build();
|
||||||
|
_filamentController!.setMorphAnimationData(_shapes!, animation);
|
||||||
|
}, "animate cylinder morph weights #1 and #2"),
|
||||||
|
_item(() async {
|
||||||
|
var morphs = await _filamentController!
|
||||||
|
.getMorphTargetNames(_shapes!, "Cylinder");
|
||||||
|
final animation = AnimationBuilder(
|
||||||
|
availableMorphs: morphs, framerate: 30, meshName: "Cylinder")
|
||||||
|
.setDuration(4)
|
||||||
|
.setMorphTargets(["Key 3", "Key 4"])
|
||||||
|
.interpolateMorphWeights(0, 4, 0, 1)
|
||||||
|
.build();
|
||||||
|
_filamentController!.setMorphAnimationData(_shapes!, animation);
|
||||||
|
}, "animate cylinder morph weights #3 and #4"),
|
||||||
|
_item(() async {
|
||||||
|
var morphs =
|
||||||
|
await _filamentController!.getMorphTargetNames(_shapes!, "Cube");
|
||||||
|
final animation = AnimationBuilder(
|
||||||
|
availableMorphs: morphs, framerate: 30, meshName: "Cube")
|
||||||
|
.setDuration(4)
|
||||||
|
.setMorphTargets(["Key 1", "Key 2"])
|
||||||
|
.interpolateMorphWeights(0, 4, 0, 1)
|
||||||
|
.build();
|
||||||
|
_filamentController!.setMorphAnimationData(_shapes!, animation);
|
||||||
|
}, "animate shapes morph weights #1 and #2"),
|
||||||
|
_item(() {
|
||||||
|
_filamentController!
|
||||||
|
.setMaterialColor(_shapes!, "Cone", 0, Colors.purple);
|
||||||
|
}, "set cone material color to purple"),
|
||||||
|
_item(() {
|
||||||
|
_loop = !_loop;
|
||||||
|
setState(() {});
|
||||||
|
}, "toggle animation looping ${_loop ? "OFF" : "ON"}"),
|
||||||
|
_item(() {
|
||||||
|
setState(() {
|
||||||
|
_viewportMargin = _viewportMargin == EdgeInsets.zero
|
||||||
|
? EdgeInsets.all(50)
|
||||||
|
: EdgeInsets.zero;
|
||||||
|
});
|
||||||
|
}, "resize")
|
||||||
|
]);
|
||||||
|
if (_animations != null) {
|
||||||
|
children.addAll(_animations!.map((a) => _item(() {
|
||||||
|
_filamentController!.playAnimation(
|
||||||
|
_shapes!, _animations!.indexOf(a),
|
||||||
|
replaceActive: true, crossfade: 0.5, loop: _loop);
|
||||||
|
}, "play animation ${_animations!.indexOf(a)} (replace/fade)")));
|
||||||
|
children.addAll(_animations!.map((a) => _item(() {
|
||||||
|
_filamentController!.playAnimation(
|
||||||
|
_shapes!, _animations!.indexOf(a),
|
||||||
|
replaceActive: false, loop: _loop);
|
||||||
|
}, "play animation ${_animations!.indexOf(a)} (noreplace)")));
|
||||||
|
}
|
||||||
|
|
||||||
children.add(_item(() {
|
children.add(_item(() {
|
||||||
setState(() {
|
_filamentController!.setToneMapping(ToneMapper.LINEAR);
|
||||||
_frustumCulling = !_frustumCulling;
|
}, "Set tone mapping to linear"));
|
||||||
});
|
|
||||||
|
|
||||||
_filamentController.setViewFrustumCulling(_frustumCulling);
|
children.add(_item(() {
|
||||||
}, "${_frustumCulling ? "Disable" : "Enable"} frustum culling"));
|
_filamentController!.moveCameraToAsset(_shapes!);
|
||||||
|
}, "Move camera to asset"));
|
||||||
|
|
||||||
|
children.add(_item(() {
|
||||||
|
setState(() {
|
||||||
|
_frustumCulling = !_frustumCulling;
|
||||||
|
});
|
||||||
|
_filamentController!.setViewFrustumCulling(_frustumCulling);
|
||||||
|
}, "${_frustumCulling ? "Disable" : "Enable"} frustum culling"));
|
||||||
|
}
|
||||||
return Stack(children: [
|
return Stack(children: [
|
||||||
Positioned.fill(
|
_filamentController != null
|
||||||
child: FilamentGestureDetector(
|
? Positioned.fill(
|
||||||
showControlOverlay: true,
|
child: Padding(
|
||||||
controller: _filamentController,
|
padding: _viewportMargin,
|
||||||
child: FilamentWidget(
|
child: FilamentGestureDetector(
|
||||||
controller: _filamentController,
|
showControlOverlay: true,
|
||||||
))),
|
controller: _filamentController!,
|
||||||
|
child: FilamentWidget(
|
||||||
|
controller: _filamentController!,
|
||||||
|
))))
|
||||||
|
: Container(),
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: 0,
|
right: 50,
|
||||||
left: 0,
|
top: 50,
|
||||||
right: 0,
|
child: Text(picked ?? "",
|
||||||
height: 200,
|
style: const TextStyle(color: Colors.green, fontSize: 24))),
|
||||||
child: Container(
|
Align(
|
||||||
color: Colors.white,
|
alignment: Alignment.bottomCenter,
|
||||||
child: SingleChildScrollView(
|
child: OrientationBuilder(builder: (ctx, orientation) {
|
||||||
child: Wrap(children: children
|
return Container(
|
||||||
// _item(24 () async { 'rotate by pi around Y axis'),
|
alignment: Alignment.bottomCenter,
|
||||||
|
height: orientation == Orientation.landscape ? 100 : 200,
|
||||||
|
color: Colors.white.withOpacity(0.75),
|
||||||
|
child: SingleChildScrollView(child: Wrap(children: children)));
|
||||||
|
}))
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// _item(24 () async { 'rotate by pi around Y axis'),
|
||||||
// _item(5 () async { 'load flight helmet'),
|
// _item(5 () async { 'load flight helmet'),
|
||||||
|
|
||||||
// _item(7 () async { 'set all weights to 1'),
|
// _item(7 () async { 'set all weights to 1'),
|
||||||
@@ -314,35 +402,31 @@ class _ExampleWidgetState extends State<ExampleWidget> {
|
|||||||
// _item(30 () async { 'remove light'),
|
// _item(30 () async { 'remove light'),
|
||||||
// _item(31 () async { 'clear all lights'),
|
// _item(31 () async { 'clear all lights'),
|
||||||
// _item(32 () async { 'set camera model matrix'),
|
// _item(32 () async { 'set camera model matrix'),
|
||||||
)))),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// case -1:
|
// case -1:
|
||||||
|
|
||||||
// break;
|
// break;
|
||||||
// case -2:
|
// case -2:
|
||||||
// _filamentController.render();
|
// _filamentController!.render();
|
||||||
// break;
|
// break;
|
||||||
// case -4:
|
// case -4:
|
||||||
// setState(() {
|
// setState(() {
|
||||||
// _rendering = !_rendering;
|
// _rendering = !_rendering;
|
||||||
// _filamentController.setRendering(_rendering);
|
// _filamentController!.setRendering(_rendering);
|
||||||
// });
|
// });
|
||||||
// break;
|
// break;
|
||||||
// case -5:
|
// case -5:
|
||||||
// setState(() {
|
// setState(() {
|
||||||
// _framerate = _framerate == 60 ? 30 : 60;
|
// _framerate = _framerate == 60 ? 30 : 60;
|
||||||
// _filamentController.setFrameRate(_framerate);
|
// _filamentController!.setFrameRate(_framerate);
|
||||||
// });
|
// });
|
||||||
// break;
|
// break;
|
||||||
// case -6:
|
// case -6:
|
||||||
// _filamentController.setBackgroundColor(Color(0xFF73C9FA));
|
// _filamentController!.setBackgroundColor(Color(0xFF73C9FA));
|
||||||
// break;
|
// break;
|
||||||
|
|
||||||
// case 5:
|
// case 5:
|
||||||
// _flightHelmet ??= await _filamentController.loadGltf(
|
// _flightHelmet ??= await _filamentController!.loadGltf(
|
||||||
// 'assets/FlightHelmet/FlightHelmet.gltf', 'assets/FlightHelmet');
|
// 'assets/FlightHelmet/FlightHelmet.gltf', 'assets/FlightHelmet');
|
||||||
// break;
|
// break;
|
||||||
|
|
||||||
@@ -352,14 +436,14 @@ class _ExampleWidgetState extends State<ExampleWidget> {
|
|||||||
// });
|
// });
|
||||||
// break;
|
// break;
|
||||||
// case 14:
|
// case 14:
|
||||||
// _filamentController.setCamera(_shapes!, "Camera_Orientation");
|
// _filamentController!.setCamera(_shapes!, "Camera_Orientation");
|
||||||
// break;
|
// break;
|
||||||
// case 15:
|
// case 15:
|
||||||
|
|
||||||
// break;
|
// break;
|
||||||
// case 17:
|
// case 17:
|
||||||
// var animationNames =
|
// var animationNames =
|
||||||
// await _filamentController.getAnimationNames(_shapes!);
|
// await _filamentController!.getAnimationNames(_shapes!);
|
||||||
|
|
||||||
// await showDialog(
|
// await showDialog(
|
||||||
// context: context,
|
// context: context,
|
||||||
@@ -373,17 +457,17 @@ class _ExampleWidgetState extends State<ExampleWidget> {
|
|||||||
|
|
||||||
// break;
|
// break;
|
||||||
// case 18:
|
// case 18:
|
||||||
// _filamentController.panStart(1, 1);
|
// _filamentController!.panStart(1, 1);
|
||||||
// _filamentController.panUpdate(1, 2);
|
// _filamentController!.panUpdate(1, 2);
|
||||||
// _filamentController.panEnd();
|
// _filamentController!.panEnd();
|
||||||
// break;
|
// break;
|
||||||
// case 19:
|
// case 19:
|
||||||
// _filamentController.panStart(1, 1);
|
// _filamentController!.panStart(1, 1);
|
||||||
// _filamentController.panUpdate(0, 0);
|
// _filamentController!.panUpdate(0, 0);
|
||||||
// _filamentController.panEnd();
|
// _filamentController!.panEnd();
|
||||||
// break;
|
// break;
|
||||||
// case 20:
|
// case 20:
|
||||||
// _filamentController.clearAssets();
|
// _filamentController!.clearAssets();
|
||||||
// break;
|
// break;
|
||||||
// case 21:
|
// case 21:
|
||||||
// break;
|
// break;
|
||||||
@@ -392,36 +476,28 @@ class _ExampleWidgetState extends State<ExampleWidget> {
|
|||||||
// case 23:
|
// case 23:
|
||||||
// break;
|
// break;
|
||||||
// case 24:
|
// case 24:
|
||||||
// _filamentController.setRotation(_shapes!, pi / 2, 0.0, 1.0, 0.0);
|
// _filamentController!.setRotation(_shapes!, pi / 2, 0.0, 1.0, 0.0);
|
||||||
// break;
|
|
||||||
// case 25:
|
|
||||||
// setState(() {
|
|
||||||
// _vertical = !_vertical;
|
|
||||||
// });
|
|
||||||
// break;
|
// break;
|
||||||
// case 26:
|
// case 26:
|
||||||
// _filamentController.setCameraPosition(0, 0, 3);
|
// _filamentController!.setCameraPosition(0, 0, 3);
|
||||||
// _filamentController.setCameraRotation(0, 0, 1, 0);
|
// _filamentController!.setCameraRotation(0, 0, 1, 0);
|
||||||
// break;
|
// break;
|
||||||
// case 27:
|
// case 27:
|
||||||
// _framerate = _framerate == 60 ? 30 : 60;
|
// _framerate = _framerate == 60 ? 30 : 60;
|
||||||
// _filamentController.setFrameRate(_framerate);
|
// _filamentController!.setFrameRate(_framerate);
|
||||||
// break;
|
// break;
|
||||||
// case 28:
|
// case 28:
|
||||||
// _filamentController.setBackgroundImagePosition(25, 25);
|
// _filamentController!.setBackgroundImagePosition(25, 25);
|
||||||
// break;
|
|
||||||
// case 29:
|
|
||||||
// _light = await _filamentController.addLight(
|
|
||||||
// 1, 6500, 15000000, 0, 1, 0, 0, -1, 0, true);
|
|
||||||
// break;
|
// break;
|
||||||
|
|
||||||
// case 30:
|
// case 30:
|
||||||
// if (_light != null) {
|
// if (_light != null) {
|
||||||
// _filamentController.removeLight(_light!);
|
// _filamentController!.removeLight(_light!);
|
||||||
// _light = null;
|
// _light = null;
|
||||||
// }
|
// }
|
||||||
// break;
|
// break;
|
||||||
// case 31:
|
// case 31:
|
||||||
// _filamentController.clearLights();
|
|
||||||
// break;
|
// break;
|
||||||
// case 32:
|
// case 32:
|
||||||
|
|
||||||
@@ -432,8 +508,8 @@ class _ExampleWidgetState extends State<ExampleWidget> {
|
|||||||
// break;
|
// break;
|
||||||
// case 34:
|
// case 34:
|
||||||
// var duration =
|
// var duration =
|
||||||
// await _filamentController.getAnimationDuration(_shapes!, 0);
|
// await _filamentController!.getAnimationDuration(_shapes!, 0);
|
||||||
// _filamentController.playAnimation(_shapes!, 0,
|
// _filamentController!.playAnimation(_shapes!, 0,
|
||||||
// loop: false, crossfade: 0.5);
|
// loop: false, crossfade: 0.5);
|
||||||
// await Future.delayed(
|
// await Future.delayed(
|
||||||
// Duration(milliseconds: (duration * 1000.0).toInt()));
|
// Duration(milliseconds: (duration * 1000.0).toInt()));
|
||||||
@@ -449,13 +525,13 @@ class _ExampleWidgetState extends State<ExampleWidget> {
|
|||||||
// // });
|
// // });
|
||||||
// break;
|
// break;
|
||||||
// case 35:
|
// case 35:
|
||||||
// _filamentController.playAnimation(_shapes!, 1,
|
// _filamentController!.playAnimation(_shapes!, 1,
|
||||||
// loop: false, crossfade: 0.5);
|
// loop: false, crossfade: 0.5);
|
||||||
// break;
|
// break;
|
||||||
// case 36:
|
// case 36:
|
||||||
// _filamentController.playAnimation(_shapes!, 2,
|
// _filamentController!.playAnimation(_shapes!, 2,
|
||||||
// loop: false, crossfade: 0.5);
|
// loop: false, crossfade: 0.5);
|
||||||
// break;
|
// break;
|
||||||
// case 37:
|
// case 37:
|
||||||
// _filamentController.stopAnimation(_shapes!, 0);
|
// _filamentController!.stopAnimation(_shapes!, 0);
|
||||||
// break;
|
// break;
|
||||||
|
|||||||
@@ -1,21 +1,28 @@
|
|||||||
PODS:
|
PODS:
|
||||||
- FlutterMacOS (1.0.0)
|
- FlutterMacOS (1.0.0)
|
||||||
|
- path_provider_foundation (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- FlutterMacOS
|
||||||
- polyvox_filament (0.0.1):
|
- polyvox_filament (0.0.1):
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- FlutterMacOS (from `Flutter/ephemeral`)
|
- FlutterMacOS (from `Flutter/ephemeral`)
|
||||||
|
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
|
||||||
- polyvox_filament (from `Flutter/ephemeral/.symlinks/plugins/polyvox_filament/macos`)
|
- polyvox_filament (from `Flutter/ephemeral/.symlinks/plugins/polyvox_filament/macos`)
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
FlutterMacOS:
|
FlutterMacOS:
|
||||||
:path: Flutter/ephemeral
|
:path: Flutter/ephemeral
|
||||||
|
path_provider_foundation:
|
||||||
|
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin
|
||||||
polyvox_filament:
|
polyvox_filament:
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/polyvox_filament/macos
|
:path: Flutter/ephemeral/.symlinks/plugins/polyvox_filament/macos
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
|
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
|
||||||
polyvox_filament: 59a161de3df49c867bc2003d4ff73b8a304d2feb
|
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
|
||||||
|
polyvox_filament: 410c2b06ba59f1182e2fa4338b583903631fb95f
|
||||||
|
|
||||||
PODFILE CHECKSUM: 9cc8fc8fc62b1d9a89fd6f974ad4157b35254030
|
PODFILE CHECKSUM: 9cc8fc8fc62b1d9a89fd6f974ad4157b35254030
|
||||||
|
|
||||||
|
|||||||
@@ -575,6 +575,7 @@
|
|||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MACOSX_DEPLOYMENT_TARGET = 13;
|
MACOSX_DEPLOYMENT_TARGET = 13;
|
||||||
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
};
|
};
|
||||||
@@ -723,6 +724,7 @@
|
|||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MACOSX_DEPLOYMENT_TARGET = 13;
|
MACOSX_DEPLOYMENT_TARGET = 13;
|
||||||
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>com.apple.security.app-sandbox</key>
|
<key>com.apple.security.app-sandbox</key>
|
||||||
<true/>
|
<false/>
|
||||||
<key>com.apple.security.cs.allow-jit</key>
|
<key>com.apple.security.cs.allow-jit</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>com.apple.security.network.server</key>
|
<key>com.apple.security.network.server</key>
|
||||||
|
|||||||
@@ -28,5 +28,7 @@
|
|||||||
<string>MainMenu</string>
|
<string>MainMenu</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
<string>NSApplication</string>
|
<string>NSApplication</string>
|
||||||
|
<key>com.apple.security.app-sandbox</key>
|
||||||
|
<false/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ description: Demonstrates how to use the polyvox_filament plugin.
|
|||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.12.0 <4.0.0"
|
sdk: ">=3.0.0 <4.0.0"
|
||||||
|
|
||||||
# Dependencies specify other packages that your package needs in order to work.
|
# Dependencies specify other packages that your package needs in order to work.
|
||||||
# To automatically upgrade your package dependencies to the latest versions
|
# To automatically upgrade your package dependencies to the latest versions
|
||||||
@@ -26,7 +26,11 @@ dependencies:
|
|||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
integration_test:
|
||||||
|
sdk: flutter
|
||||||
flutter_lints: ^1.0.0
|
flutter_lints: ^1.0.0
|
||||||
|
crypto:
|
||||||
|
image_compare: ^1.1.2
|
||||||
|
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
|
|||||||
8
example/regenerate_goldens.sh
Normal file
8
example/regenerate_goldens.sh
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
device=$1
|
||||||
|
if [ -z "$device" ]; then
|
||||||
|
echo "Usage: $0 <device_id>"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
rm -f integration_test/goldens/{ios,macos,windows,android}/*.png
|
||||||
|
flutter drive --driver=test_driver/integration_test_update_goldens.dart -d $1 --target=integration_test/plugin_integration_test.dart
|
||||||
58
example/test_driver/integration_test.dart
Normal file
58
example/test_driver/integration_test.dart
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:integration_test/integration_test_driver_extended.dart';
|
||||||
|
import 'package:image_compare/image_compare.dart';
|
||||||
|
|
||||||
|
Future<void> main() async {
|
||||||
|
await integrationDriver(
|
||||||
|
onScreenshot: (
|
||||||
|
String screenshotName,
|
||||||
|
List<int> screenshotBytes, [
|
||||||
|
Map<String, Object?>? args,
|
||||||
|
]) async {
|
||||||
|
final dir = screenshotName.split("/")[0];
|
||||||
|
final name = screenshotName.split("/")[1];
|
||||||
|
final File golden = await File('integration_test/goldens/$dir/$name.png');
|
||||||
|
|
||||||
|
if (!golden.existsSync()) {
|
||||||
|
throw Exception(
|
||||||
|
"Golden image ${golden.path} doesn't exist yet. Make sure you have run integraton_test_update_goldens.dart first");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await compareImages(
|
||||||
|
src1: screenshotBytes,
|
||||||
|
src2: golden.readAsBytesSync(),
|
||||||
|
algorithm: ChiSquareDistanceHistogram());
|
||||||
|
|
||||||
|
print(result);
|
||||||
|
|
||||||
|
// TODO - it would be preferable to use Flutter's GoldenFileComparator here, e.g.
|
||||||
|
//
|
||||||
|
// ```var comparator = LocalFileComparator(testImage.uri);
|
||||||
|
// comparator.compare(imageBytes, golden)
|
||||||
|
// comparator.getFailureFile(failure, golden, basedir)
|
||||||
|
// var result = await comparator.compare(
|
||||||
|
// Uint8List.fromList(screenshotBytes), golden.uri);
|
||||||
|
// if (!result.passed) {
|
||||||
|
// for (var key in result.diffs!.keys) {
|
||||||
|
// var byteData = await result.diffs![key]!.toByteData();
|
||||||
|
// File('integration_test/goldens/$dir/diffs/$name.png')
|
||||||
|
// .writeAsBytesSync(
|
||||||
|
// byteData!.buffer.asUint8List(byteData!.offsetInBytes));
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
// }```
|
||||||
|
// but this is only available via a Flutter shell which is currently unavailable (this script is run as a plain Dart file I guess).
|
||||||
|
// let's revisit if/when this changes
|
||||||
|
// see https://github.com/flutter/flutter/issues/51890 and https://github.com/flutter/flutter/issues/103222
|
||||||
|
|
||||||
|
if (result > 0.005) {
|
||||||
|
File('integration_test/goldens/$dir/diffs/$name.png')
|
||||||
|
.writeAsBytesSync(screenshotBytes);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
22
example/test_driver/integration_test_update_goldens.dart
Normal file
22
example/test_driver/integration_test_update_goldens.dart
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
import 'package:crypto/crypto.dart';
|
||||||
|
import 'package:integration_test/integration_test_driver_extended.dart';
|
||||||
|
|
||||||
|
Future<void> main() async {
|
||||||
|
await integrationDriver(
|
||||||
|
onScreenshot: (
|
||||||
|
String screenshotName,
|
||||||
|
List<int> screenshotBytes, [
|
||||||
|
Map<String, Object?>? args,
|
||||||
|
]) async {
|
||||||
|
final dir = screenshotName.split("/")[0];
|
||||||
|
final name = screenshotName.split("/")[1];
|
||||||
|
final File image = await File('integration_test/goldens/$dir/$name.png')
|
||||||
|
.create(recursive: true);
|
||||||
|
|
||||||
|
image.writeAsBytesSync(screenshotBytes);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -187,6 +187,7 @@ public class SwiftPolyvoxFilamentPlugin: NSObject, FlutterPlugin, FlutterTexture
|
|||||||
}
|
}
|
||||||
self.flutterTextureId = nil
|
self.flutterTextureId = nil
|
||||||
self.pixelBuffer = nil
|
self.pixelBuffer = nil
|
||||||
|
result(true)
|
||||||
case "resize":
|
case "resize":
|
||||||
let args = call.arguments as! [Any]
|
let args = call.arguments as! [Any]
|
||||||
let width = UInt32(args[0] as! Int64)
|
let width = UInt32(args[0] as! Int64)
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ namespace polyvox {
|
|||||||
class AssetManager {
|
class AssetManager {
|
||||||
public:
|
public:
|
||||||
AssetManager(const ResourceLoaderWrapper* const loader,
|
AssetManager(const ResourceLoaderWrapper* const loader,
|
||||||
NameComponentManager *ncm,
|
NameComponentManager* ncm,
|
||||||
Engine *engine,
|
Engine* engine,
|
||||||
Scene *scene);
|
Scene* scene,
|
||||||
|
const char* uberArchivePath);
|
||||||
~AssetManager();
|
~AssetManager();
|
||||||
EntityId loadGltf(const char* uri, const char* relativeResourcePath);
|
EntityId loadGltf(const char* uri, const char* relativeResourcePath);
|
||||||
EntityId loadGlb(const char* uri, bool unlit);
|
EntityId loadGlb(const char* uri, bool unlit);
|
||||||
@@ -69,6 +70,7 @@ namespace polyvox {
|
|||||||
void setAnimationFrame(EntityId entity, int animationIndex, int animationFrame);
|
void setAnimationFrame(EntityId entity, int animationIndex, int animationFrame);
|
||||||
bool hide(EntityId entity, const char* meshName);
|
bool hide(EntityId entity, const char* meshName);
|
||||||
bool reveal(EntityId entity, const char* meshName);
|
bool reveal(EntityId entity, const char* meshName);
|
||||||
|
const char* getNameForEntity(EntityId entityId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AssetLoader* _assetLoader = nullptr;
|
AssetLoader* _assetLoader = nullptr;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace polyvox {
|
|||||||
|
|
||||||
class FilamentViewer {
|
class FilamentViewer {
|
||||||
public:
|
public:
|
||||||
FilamentViewer(const void* context, const ResourceLoaderWrapper* const resourceLoaderWrapper, void* const platform=nullptr);
|
FilamentViewer(const void* context, const ResourceLoaderWrapper* const resourceLoaderWrapper, void* const platform=nullptr, const char* uberArchivePath=nullptr);
|
||||||
~FilamentViewer();
|
~FilamentViewer();
|
||||||
|
|
||||||
void setToneMapping(ToneMapping toneMapping);
|
void setToneMapping(ToneMapping toneMapping);
|
||||||
@@ -106,6 +106,9 @@ namespace polyvox {
|
|||||||
int32_t addLight(LightManager::Type t, float colour, float intensity, float posX, float posY, float posZ, float dirX, float dirY, float dirZ, bool shadows);
|
int32_t addLight(LightManager::Type t, float colour, float intensity, float posX, float posY, float posZ, float dirX, float dirY, float dirZ, bool shadows);
|
||||||
void removeLight(EntityId entityId);
|
void removeLight(EntityId entityId);
|
||||||
void clearLights();
|
void clearLights();
|
||||||
|
void setPostProcessing(bool enabled);
|
||||||
|
|
||||||
|
void pick(uint32_t x, uint32_t y, EntityId* entityId);
|
||||||
|
|
||||||
AssetManager* const getAssetManager() {
|
AssetManager* const getAssetManager() {
|
||||||
return (AssetManager* const) _assetManager;
|
return (AssetManager* const) _assetManager;
|
||||||
@@ -174,7 +177,7 @@ namespace polyvox {
|
|||||||
void loadPngTexture(string path, ResourceBuffer data);
|
void loadPngTexture(string path, ResourceBuffer data);
|
||||||
void loadTextureFromPath(string path);
|
void loadTextureFromPath(string path);
|
||||||
|
|
||||||
|
Manipulator<double>* _manipulator = nullptr;
|
||||||
void _createManipulator();
|
void _createManipulator();
|
||||||
uint32_t _lastFrameTimeInNanos;
|
uint32_t _lastFrameTimeInNanos;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
typedef int32_t EntityId;
|
typedef int32_t EntityId;
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT const void* create_filament_viewer(const void* const context, const ResourceLoaderWrapper* const loader, void* const platform);
|
FLUTTER_PLUGIN_EXPORT const void* create_filament_viewer(const void* const context, const ResourceLoaderWrapper* const loader, void* const platform, const char* uberArchivePath);
|
||||||
FLUTTER_PLUGIN_EXPORT void destroy_filament_viewer(const void* const viewer);
|
FLUTTER_PLUGIN_EXPORT void destroy_filament_viewer(const void* const viewer);
|
||||||
FLUTTER_PLUGIN_EXPORT ResourceLoaderWrapper* make_resource_loader(LoadFilamentResourceFromOwner loadFn, FreeFilamentResourceFromOwner freeFn, void* owner);
|
FLUTTER_PLUGIN_EXPORT ResourceLoaderWrapper* make_resource_loader(LoadFilamentResourceFromOwner loadFn, FreeFilamentResourceFromOwner freeFn, void* owner);
|
||||||
FLUTTER_PLUGIN_EXPORT void* get_asset_manager(const void* const viewer);
|
FLUTTER_PLUGIN_EXPORT void* get_asset_manager(const void* const viewer);
|
||||||
@@ -150,6 +150,9 @@ FLUTTER_PLUGIN_EXPORT void set_camera_focal_length(const void* const viewer, flo
|
|||||||
FLUTTER_PLUGIN_EXPORT void set_camera_focus_distance(const void* const viewer, float focusDistance);
|
FLUTTER_PLUGIN_EXPORT void set_camera_focus_distance(const void* const viewer, float focusDistance);
|
||||||
FLUTTER_PLUGIN_EXPORT int hide_mesh(void* assetManager, EntityId asset, const char* meshName);
|
FLUTTER_PLUGIN_EXPORT int hide_mesh(void* assetManager, EntityId asset, const char* meshName);
|
||||||
FLUTTER_PLUGIN_EXPORT int reveal_mesh(void* assetManager, EntityId asset, const char* meshName);
|
FLUTTER_PLUGIN_EXPORT int reveal_mesh(void* assetManager, EntityId asset, const char* meshName);
|
||||||
|
FLUTTER_PLUGIN_EXPORT void set_post_processing(void* const viewer, bool enabled);
|
||||||
|
FLUTTER_PLUGIN_EXPORT void pick(void* const viewer, int x, int y, EntityId* entityId);
|
||||||
|
FLUTTER_PLUGIN_EXPORT const char* get_name_for_entity(void* const assetManager, const EntityId entityId);
|
||||||
FLUTTER_PLUGIN_EXPORT void ios_dummy();
|
FLUTTER_PLUGIN_EXPORT void ios_dummy();
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#ifndef _POLYVOX_FILAMENT_FFI_API_H
|
#ifndef _POLYVOX_FILAMENT_FFI_API_H
|
||||||
#define _POLYVOX_FILAMENT_FFI_API_H
|
#define _POLYVOX_FILAMENT_FFI_API_H
|
||||||
|
|
||||||
|
#include "PolyvoxFilamentApi.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@@ -10,14 +12,13 @@ extern "C" {
|
|||||||
/// The intention is that calling one of these methods will call its respective method in PolyvoxFilamentApi.h, but wrapped in some kind of thread runner to ensure thread safety.
|
/// The intention is that calling one of these methods will call its respective method in PolyvoxFilamentApi.h, but wrapped in some kind of thread runner to ensure thread safety.
|
||||||
///
|
///
|
||||||
|
|
||||||
#include "PolyvoxFilamentApi.h"
|
|
||||||
|
|
||||||
typedef int32_t EntityId;
|
typedef int32_t EntityId;
|
||||||
typedef void (*FilamentRenderCallback)(void* const owner);
|
typedef void (*FilamentRenderCallback)(void* const owner);
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void* const create_filament_viewer_ffi(void* const context, void* const platform, const ResourceLoaderWrapper* const loader, void (*renderCallback)(void* const renderCallbackOwner), void* const renderCallbackOwner);
|
FLUTTER_PLUGIN_EXPORT void* const create_filament_viewer_ffi(void* const context, void* const platform, const char* uberArchivePath, const ResourceLoaderWrapper* const loader, void (*renderCallback)(void* const renderCallbackOwner), void* const renderCallbackOwner);
|
||||||
FLUTTER_PLUGIN_EXPORT void create_swap_chain_ffi(void* const viewer, void* const surface, uint32_t width, uint32_t height);
|
FLUTTER_PLUGIN_EXPORT void create_swap_chain_ffi(void* const viewer, void* const surface, uint32_t width, uint32_t height);
|
||||||
FLUTTER_PLUGIN_EXPORT void create_render_target_ffi(void* const viewer, uint32_t nativeTextureId, uint32_t width, uint32_t height);
|
FLUTTER_PLUGIN_EXPORT void destroy_swap_chain_ffi(void* const viewer);
|
||||||
|
FLUTTER_PLUGIN_EXPORT void create_render_target_ffi(void* const viewer, intptr_t nativeTextureId, uint32_t width, uint32_t height);
|
||||||
FLUTTER_PLUGIN_EXPORT void destroy_filament_viewer_ffi(void* const viewer);
|
FLUTTER_PLUGIN_EXPORT void destroy_filament_viewer_ffi(void* const viewer);
|
||||||
FLUTTER_PLUGIN_EXPORT void render_ffi(void* const viewer);
|
FLUTTER_PLUGIN_EXPORT void render_ffi(void* const viewer);
|
||||||
FLUTTER_PLUGIN_EXPORT FilamentRenderCallback make_render_callback_fn_pointer(FilamentRenderCallback);
|
FLUTTER_PLUGIN_EXPORT FilamentRenderCallback make_render_callback_fn_pointer(FilamentRenderCallback);
|
||||||
@@ -81,10 +82,10 @@ 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 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 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 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 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);
|
FLUTTER_PLUGIN_EXPORT int get_morph_target_name_count_ffi(void* const assetManager, EntityId asset, const char *meshName);
|
||||||
|
FLUTTER_PLUGIN_EXPORT void set_post_processing_ffi(void* const viewer, bool enabled);
|
||||||
|
FLUTTER_PLUGIN_EXPORT void pick_ffi(void* const viewer, int x, int y, EntityId* entityId);
|
||||||
FLUTTER_PLUGIN_EXPORT void ios_dummy_ffi();
|
FLUTTER_PLUGIN_EXPORT void ios_dummy_ffi();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ extern "C" {
|
|||||||
#if defined(__cplusplus) && !defined(__ANDROID__) && !defined(__APPLE__)
|
#if defined(__cplusplus) && !defined(__ANDROID__) && !defined(__APPLE__)
|
||||||
ResourceBuffer(const void* const data, const int32_t size, const int32_t id) : data(data), size(size), id(id) {};
|
ResourceBuffer(const void* const data, const int32_t size, const int32_t id) : data(data), size(size), id(id) {};
|
||||||
ResourceBuffer(const ResourceBuffer& rb) : data(rb.data), size(rb.size), id(rb.id) { };
|
ResourceBuffer(const ResourceBuffer& rb) : data(rb.data), size(rb.size), id(rb.id) { };
|
||||||
ResourceBuffer(const ResourceBuffer&& rb) : data(rb.data), size(rb.size), id(rb.id) { };
|
ResourceBuffer(const ResourceBuffer&& rb) noexcept : data(rb.data), size(rb.size), id(rb.id) { };
|
||||||
ResourceBuffer& operator=(const ResourceBuffer& other) = delete;
|
ResourceBuffer& operator=(const ResourceBuffer& other) = delete;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ A new flutter plugin project.
|
|||||||
s.license = { :file => '../LICENSE' }
|
s.license = { :file => '../LICENSE' }
|
||||||
s.author = { 'Your Company' => 'email@example.com' }
|
s.author = { 'Your Company' => 'email@example.com' }
|
||||||
s.source = { :path => '.' }
|
s.source = { :path => '.' }
|
||||||
s.source_files = 'Classes/*', 'src/*', 'src/ios/*', 'include/filament/*', 'include/*', 'include/material/*.c'
|
s.source_files = 'Classes/*', 'src/*', "src/camutils/*", 'src/ios/*', 'include/filament/*', 'include/*', 'include/material/*.c'
|
||||||
s.public_header_files = 'include/SwiftPolyvoxFilamentPlugin-Bridging-Header.h', 'include/PolyvoxFilamentApi.h', 'include/PolyvoxFilamentFFIApi.h', 'include/ResourceBuffer.hpp', 'include/Log.hpp'
|
s.public_header_files = 'include/SwiftPolyvoxFilamentPlugin-Bridging-Header.h', 'include/PolyvoxFilamentApi.h', 'include/PolyvoxFilamentFFIApi.h', 'include/ResourceBuffer.hpp', 'include/Log.hpp'
|
||||||
s.dependency 'Flutter'
|
s.dependency 'Flutter'
|
||||||
s.platform = :ios, '12.1'
|
s.platform = :ios, '12.1'
|
||||||
@@ -26,7 +26,7 @@ A new flutter plugin project.
|
|||||||
'OTHER_CFLAGS' => '"-fvisibility=default" "$(inherited)"',
|
'OTHER_CFLAGS' => '"-fvisibility=default" "$(inherited)"',
|
||||||
'USER_HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/include" "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/include/filament" "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/src" "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/src/image" "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/src/shaders" "$(inherited)"',
|
'USER_HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/include" "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/include/filament" "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/src" "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/src/image" "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/src/shaders" "$(inherited)"',
|
||||||
'ALWAYS_SEARCH_USER_PATHS' => 'YES',
|
'ALWAYS_SEARCH_USER_PATHS' => 'YES',
|
||||||
"OTHER_LDFLAGS" => '-lfilament -lbackend -lfilameshio -lviewer -lfilamat -lgeometry -lutils -lfilabridge -lgltfio_core -lfilament-iblprefilter -limage -limageio -ltinyexr -lcamutils -lgltfio_core -lfilaflat -ldracodec -libl -lktxreader -lpng -lpng16 -lz -lstb -luberzlib -lsmol-v -luberarchive -lzstd -lstdc++',
|
"OTHER_LDFLAGS" => '-lfilament -lbackend -lfilameshio -lviewer -lfilamat -lgeometry -lutils -lfilabridge -lgltfio_core -lfilament-iblprefilter -limage -limageio -ltinyexr -lgltfio_core -lfilaflat -ldracodec -libl -lktxreader -lpng -lpng16 -lz -lstb -luberzlib -lsmol-v -luberarchive -lzstd -lstdc++',
|
||||||
'LIBRARY_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/lib" "$(inherited)"',
|
'LIBRARY_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/lib" "$(inherited)"',
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ A new flutter plugin project.
|
|||||||
'OTHER_CFLAGS' => '"-fvisibility=default" "$(inherited)"',
|
'OTHER_CFLAGS' => '"-fvisibility=default" "$(inherited)"',
|
||||||
'USER_HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/include" "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/include/filament" "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/src" "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/src/image" "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/src/shaders" "$(inherited)"',
|
'USER_HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/include" "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/include/filament" "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/src" "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/src/image" "${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/src/shaders" "$(inherited)"',
|
||||||
'ALWAYS_SEARCH_USER_PATHS' => 'YES',
|
'ALWAYS_SEARCH_USER_PATHS' => 'YES',
|
||||||
"OTHER_LDFLAGS" => '-lfilament -lbackend -lfilameshio -lviewer -lfilamat -lgeometry -lutils -lfilabridge -lgltfio_core -lfilament-iblprefilter -limage -limageio -ltinyexr -lcamutils -lgltfio_core -lfilaflat -ldracodec -libl -lktxreader -lpng -lpng16 -lz -lstb -luberzlib -lsmol-v -luberarchive -lzstd -lstdc++',
|
"OTHER_LDFLAGS" => '-lfilament -lbackend -lfilameshio -lviewer -lfilamat -lgeometry -lutils -lfilabridge -lgltfio_core -lfilament-iblprefilter -limage -limageio -ltinyexr -lgltfio_core -lfilaflat -ldracodec -libl -lktxreader -lpng -lpng16 -lz -lstb -luberzlib -lsmol-v -luberarchive -lzstd -lstdc++',
|
||||||
'LIBRARY_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/lib" "$(inherited)"',
|
'LIBRARY_SEARCH_PATHS' => '"${PODS_ROOT}/../.symlinks/plugins/polyvox_filament/ios/lib" "$(inherited)"',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,9 +38,10 @@ using namespace filament;
|
|||||||
using namespace filament::gltfio;
|
using namespace filament::gltfio;
|
||||||
|
|
||||||
AssetManager::AssetManager(const ResourceLoaderWrapper* const resourceLoaderWrapper,
|
AssetManager::AssetManager(const ResourceLoaderWrapper* const resourceLoaderWrapper,
|
||||||
NameComponentManager *ncm,
|
NameComponentManager* ncm,
|
||||||
Engine *engine,
|
Engine* engine,
|
||||||
Scene *scene)
|
Scene* scene,
|
||||||
|
const char* uberArchivePath)
|
||||||
: _resourceLoaderWrapper(resourceLoaderWrapper),
|
: _resourceLoaderWrapper(resourceLoaderWrapper),
|
||||||
_ncm(ncm),
|
_ncm(ncm),
|
||||||
_engine(engine),
|
_engine(engine),
|
||||||
@@ -52,15 +53,17 @@ _scene(scene) {
|
|||||||
_gltfResourceLoader = new ResourceLoader({.engine = _engine,
|
_gltfResourceLoader = new ResourceLoader({.engine = _engine,
|
||||||
.normalizeSkinningWeights = true });
|
.normalizeSkinningWeights = true });
|
||||||
|
|
||||||
// TODO - allow passing uberz archive
|
if(uberArchivePath) {
|
||||||
// e.g. auto uberArchivePath = "packages/polyvox_filament/assets/default.uberz"
|
auto uberdata = resourceLoaderWrapper->load(uberArchivePath);
|
||||||
// auto uberdata = resourceLoaderWrapper->load(uberArchivePath);
|
if (!uberdata.data) {
|
||||||
// if (!uberdata.data) {
|
Log("Failed to load ubershader material. This is fatal.");
|
||||||
// Log("Failed to load ubershader material. This is fatal.");
|
}
|
||||||
// }
|
_ubershaderProvider = gltfio::createUbershaderProvider(_engine, uberdata.data, uberdata.size);
|
||||||
// _ubershaderProvider = gltfio::createUbershaderProvider(_engine, uberdata.data, uberdata.size);
|
resourceLoaderWrapper->free(uberdata);
|
||||||
_ubershaderProvider = gltfio::createUbershaderProvider(
|
} else {
|
||||||
|
_ubershaderProvider = gltfio::createUbershaderProvider(
|
||||||
_engine, UBERARCHIVE_DEFAULT_DATA, UBERARCHIVE_DEFAULT_SIZE);
|
_engine, UBERARCHIVE_DEFAULT_DATA, UBERARCHIVE_DEFAULT_SIZE);
|
||||||
|
}
|
||||||
Log("Created ubershader provider.");
|
Log("Created ubershader provider.");
|
||||||
|
|
||||||
EntityManager &em = EntityManager::get();
|
EntityManager &em = EntityManager::get();
|
||||||
@@ -943,6 +946,16 @@ size_t AssetManager::getLightEntityCount(EntityId entity) const noexcept {
|
|||||||
return asset.mAsset->getLightEntityCount();
|
return asset.mAsset->getLightEntityCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* AssetManager::getNameForEntity(EntityId entityId) {
|
||||||
|
const auto& entity = Entity::import(entityId);
|
||||||
|
auto nameInstance = _ncm->getInstance(entity);
|
||||||
|
if(!nameInstance.isValid()) {
|
||||||
|
Log("Failed to find name instance for entity ID %d", entityId);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return _ncm->getName(nameInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace polyvox
|
} // namespace polyvox
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -15,8 +15,8 @@ extern "C" {
|
|||||||
|
|
||||||
#include "PolyvoxFilamentApi.h"
|
#include "PolyvoxFilamentApi.h"
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT const void* create_filament_viewer(const void* context, const ResourceLoaderWrapper* const loader, void* const platform) {
|
FLUTTER_PLUGIN_EXPORT const void* create_filament_viewer(const void* context, const ResourceLoaderWrapper* const loader, void* const platform, const char* uberArchivePath) {
|
||||||
return (const void*) new FilamentViewer(context, loader, platform);
|
return (const void*) new FilamentViewer(context, loader, platform, uberArchivePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT ResourceLoaderWrapper* make_resource_loader(LoadFilamentResourceFromOwner loadFn, FreeFilamentResourceFromOwner freeFn, void* const owner) {
|
FLUTTER_PLUGIN_EXPORT ResourceLoaderWrapper* make_resource_loader(LoadFilamentResourceFromOwner loadFn, FreeFilamentResourceFromOwner freeFn, void* const owner) {
|
||||||
@@ -43,32 +43,32 @@ extern "C" {
|
|||||||
((FilamentViewer*)viewer)->setBackgroundImage(path, fillHeight);
|
((FilamentViewer*)viewer)->setBackgroundImage(path, fillHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void set_background_image_position(const void* const viewer, float x, float y, bool clamp) {
|
FLUTTER_PLUGIN_EXPORT void set_background_image_position(const void* const viewer, float x, float y, bool clamp) {
|
||||||
((FilamentViewer*)viewer)->setBackgroundImagePosition(x, y, clamp);
|
((FilamentViewer*)viewer)->setBackgroundImagePosition(x, y, clamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void set_tone_mapping(const void* const viewer, int toneMapping) {
|
FLUTTER_PLUGIN_EXPORT void set_tone_mapping(const void* const viewer, int toneMapping) {
|
||||||
((FilamentViewer*)viewer)->setToneMapping((ToneMapping)toneMapping);
|
((FilamentViewer*)viewer)->setToneMapping((ToneMapping)toneMapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void set_bloom(const void* const viewer, float strength) {
|
FLUTTER_PLUGIN_EXPORT void set_bloom(const void* const viewer, float strength) {
|
||||||
Log("Setting bloom to %f", strength);
|
Log("Setting bloom to %f", strength);
|
||||||
((FilamentViewer*)viewer)->setBloom(strength);
|
((FilamentViewer*)viewer)->setBloom(strength);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void load_skybox(const void* const viewer, const char* skyboxPath) {
|
FLUTTER_PLUGIN_EXPORT void load_skybox(const void* const viewer, const char* skyboxPath) {
|
||||||
((FilamentViewer*)viewer)->loadSkybox(skyboxPath);
|
((FilamentViewer*)viewer)->loadSkybox(skyboxPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void load_ibl(const void* const viewer, const char* iblPath, float intensity) {
|
FLUTTER_PLUGIN_EXPORT void load_ibl(const void* const viewer, const char* iblPath, float intensity) {
|
||||||
((FilamentViewer*)viewer)->loadIbl(iblPath, intensity);
|
((FilamentViewer*)viewer)->loadIbl(iblPath, intensity);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void remove_skybox(const void* const viewer) {
|
FLUTTER_PLUGIN_EXPORT void remove_skybox(const void* const viewer) {
|
||||||
((FilamentViewer*)viewer)->removeSkybox();
|
((FilamentViewer*)viewer)->removeSkybox();
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void remove_ibl(const void* const viewer) {
|
FLUTTER_PLUGIN_EXPORT void remove_ibl(const void* const viewer) {
|
||||||
((FilamentViewer*)viewer)->removeIbl();
|
((FilamentViewer*)viewer)->removeIbl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,11 +76,11 @@ extern "C" {
|
|||||||
return ((FilamentViewer*)viewer)->addLight((LightManager::Type)type, colour, intensity, posX, posY, posZ, dirX, dirY, dirZ, shadows);
|
return ((FilamentViewer*)viewer)->addLight((LightManager::Type)type, colour, intensity, posX, posY, posZ, dirX, dirY, dirZ, shadows);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void remove_light(const void* const viewer, int32_t entityId) {
|
FLUTTER_PLUGIN_EXPORT void remove_light(const void* const viewer, int32_t entityId) {
|
||||||
((FilamentViewer*)viewer)->removeLight(entityId);
|
((FilamentViewer*)viewer)->removeLight(entityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void clear_lights(const void* const viewer) {
|
FLUTTER_PLUGIN_EXPORT void clear_lights(const void* const viewer) {
|
||||||
((FilamentViewer*)viewer)->clearLights();
|
((FilamentViewer*)viewer)->clearLights();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,27 +104,27 @@ extern "C" {
|
|||||||
((FilamentViewer*)viewer)->moveCameraToAsset(asset);
|
((FilamentViewer*)viewer)->moveCameraToAsset(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void set_camera_focus_distance(const void* const viewer, float distance) {
|
FLUTTER_PLUGIN_EXPORT void set_camera_focus_distance(const void* const viewer, float distance) {
|
||||||
((FilamentViewer*)viewer)->setCameraFocusDistance(distance);
|
((FilamentViewer*)viewer)->setCameraFocusDistance(distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void set_camera_exposure(const void* const viewer, float aperture, float shutterSpeed, float sensitivity) {
|
FLUTTER_PLUGIN_EXPORT void set_camera_exposure(const void* const viewer, float aperture, float shutterSpeed, float sensitivity) {
|
||||||
((FilamentViewer*)viewer)->setCameraExposure(aperture, shutterSpeed, sensitivity);
|
((FilamentViewer*)viewer)->setCameraExposure(aperture, shutterSpeed, sensitivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void set_camera_position(const void* const viewer, float x, float y, float z) {
|
FLUTTER_PLUGIN_EXPORT void set_camera_position(const void* const viewer, float x, float y, float z) {
|
||||||
((FilamentViewer*)viewer)->setCameraPosition(x, y, z);
|
((FilamentViewer*)viewer)->setCameraPosition(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void set_camera_rotation(const void* const viewer, float rads, float x, float y, float z) {
|
FLUTTER_PLUGIN_EXPORT void set_camera_rotation(const void* const viewer, float rads, float x, float y, float z) {
|
||||||
((FilamentViewer*)viewer)->setCameraRotation(rads, x, y, z);
|
((FilamentViewer*)viewer)->setCameraRotation(rads, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void set_camera_model_matrix(const void* const viewer, const float* const matrix) {
|
FLUTTER_PLUGIN_EXPORT void set_camera_model_matrix(const void* const viewer, const float* const matrix) {
|
||||||
((FilamentViewer*)viewer)->setCameraModelMatrix(matrix);
|
((FilamentViewer*)viewer)->setCameraModelMatrix(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void set_camera_focal_length(const void* const viewer, float focalLength) {
|
FLUTTER_PLUGIN_EXPORT void set_camera_focal_length(const void* const viewer, float focalLength) {
|
||||||
((FilamentViewer*)viewer)->setCameraFocalLength(focalLength);
|
((FilamentViewer*)viewer)->setCameraFocalLength(focalLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,46 +137,46 @@ extern "C" {
|
|||||||
((FilamentViewer*)viewer)->render(frameTimeInNanos, pixelBuffer, callback, data);
|
((FilamentViewer*)viewer)->render(frameTimeInNanos, pixelBuffer, callback, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void set_frame_interval(
|
FLUTTER_PLUGIN_EXPORT void set_frame_interval(
|
||||||
const void* const viewer,
|
const void* const viewer,
|
||||||
float frameInterval
|
float frameInterval
|
||||||
) {
|
) {
|
||||||
((FilamentViewer*)viewer)->setFrameInterval(frameInterval);
|
((FilamentViewer*)viewer)->setFrameInterval(frameInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void destroy_swap_chain(const void* const viewer) {
|
FLUTTER_PLUGIN_EXPORT void destroy_swap_chain(const void* const viewer) {
|
||||||
((FilamentViewer*)viewer)->destroySwapChain();
|
((FilamentViewer*)viewer)->destroySwapChain();
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void create_swap_chain(const void* const viewer, const void* const window, uint32_t width, uint32_t height) {
|
FLUTTER_PLUGIN_EXPORT void create_swap_chain(const void* const viewer, const void* const window, uint32_t width, uint32_t height) {
|
||||||
((FilamentViewer*)viewer)->createSwapChain(window, width, height);
|
((FilamentViewer*)viewer)->createSwapChain(window, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void update_viewport_and_camera_projection(const void* const viewer, uint32_t width, uint32_t height, float scaleFactor) {
|
FLUTTER_PLUGIN_EXPORT void update_viewport_and_camera_projection(const void* const viewer, uint32_t width, uint32_t height, float scaleFactor) {
|
||||||
return ((FilamentViewer*)viewer)->updateViewportAndCameraProjection(width, height, scaleFactor);
|
return ((FilamentViewer*)viewer)->updateViewportAndCameraProjection(width, height, scaleFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void scroll_update(const void* const viewer, float x, float y, float delta) {
|
FLUTTER_PLUGIN_EXPORT void scroll_update(const void* const viewer, float x, float y, float delta) {
|
||||||
((FilamentViewer*)viewer)->scrollUpdate(x, y, delta);
|
((FilamentViewer*)viewer)->scrollUpdate(x, y, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void scroll_begin(const void* const viewer) {
|
FLUTTER_PLUGIN_EXPORT void scroll_begin(const void* const viewer) {
|
||||||
((FilamentViewer*)viewer)->scrollBegin();
|
((FilamentViewer*)viewer)->scrollBegin();
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void scroll_end(const void* const viewer) {
|
FLUTTER_PLUGIN_EXPORT void scroll_end(const void* const viewer) {
|
||||||
((FilamentViewer*)viewer)->scrollEnd();
|
((FilamentViewer*)viewer)->scrollEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void grab_begin(const void* const viewer, float x, float y, bool pan) {
|
FLUTTER_PLUGIN_EXPORT void grab_begin(const void* const viewer, float x, float y, bool pan) {
|
||||||
((FilamentViewer*)viewer)->grabBegin(x, y, pan);
|
((FilamentViewer*)viewer)->grabBegin(x, y, pan);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void grab_update(const void* const viewer, float x, float y) {
|
FLUTTER_PLUGIN_EXPORT void grab_update(const void* const viewer, float x, float y) {
|
||||||
((FilamentViewer*)viewer)->grabUpdate(x, y);
|
((FilamentViewer*)viewer)->grabUpdate(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void grab_end(const void* const viewer) {
|
FLUTTER_PLUGIN_EXPORT void grab_end(const void* const viewer) {
|
||||||
((FilamentViewer*)viewer)->grabEnd();
|
((FilamentViewer*)viewer)->grabEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ extern "C" {
|
|||||||
return (void*)((FilamentViewer*)viewer)->getAssetManager();
|
return (void*)((FilamentViewer*)viewer)->getAssetManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void apply_weights(
|
FLUTTER_PLUGIN_EXPORT void apply_weights(
|
||||||
void* assetManager,
|
void* assetManager,
|
||||||
EntityId asset,
|
EntityId asset,
|
||||||
const char* const entityName,
|
const char* const entityName,
|
||||||
@@ -193,7 +193,7 @@ extern "C" {
|
|||||||
// ((AssetManager*)assetManager)->setMorphTargetWeights(asset, entityName, weights, count);
|
// ((AssetManager*)assetManager)->setMorphTargetWeights(asset, entityName, weights, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void set_morph_target_weights(
|
FLUTTER_PLUGIN_EXPORT void set_morph_target_weights(
|
||||||
void* assetManager,
|
void* assetManager,
|
||||||
EntityId asset,
|
EntityId asset,
|
||||||
const char* const entityName,
|
const char* const entityName,
|
||||||
@@ -232,7 +232,7 @@ extern "C" {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void set_bone_animation(
|
FLUTTER_PLUGIN_EXPORT void set_bone_animation(
|
||||||
void* assetManager,
|
void* assetManager,
|
||||||
EntityId asset,
|
EntityId asset,
|
||||||
const float* const frameData,
|
const float* const frameData,
|
||||||
@@ -254,6 +254,10 @@ extern "C" {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FLUTTER_PLUGIN_EXPORT void set_post_processing(void* const viewer, bool enabled) {
|
||||||
|
((FilamentViewer*)viewer)->setPostProcessing(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// void set_bone_transform(
|
// void set_bone_transform(
|
||||||
@@ -284,7 +288,7 @@ extern "C" {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void play_animation(
|
FLUTTER_PLUGIN_EXPORT void play_animation(
|
||||||
void* assetManager,
|
void* assetManager,
|
||||||
EntityId asset,
|
EntityId asset,
|
||||||
int index,
|
int index,
|
||||||
@@ -295,7 +299,7 @@ extern "C" {
|
|||||||
((AssetManager*)assetManager)->playAnimation(asset, index, loop, reverse, replaceActive, crossfade);
|
((AssetManager*)assetManager)->playAnimation(asset, index, loop, reverse, replaceActive, crossfade);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void set_animation_frame(
|
FLUTTER_PLUGIN_EXPORT void set_animation_frame(
|
||||||
void* assetManager,
|
void* assetManager,
|
||||||
EntityId asset,
|
EntityId asset,
|
||||||
int animationIndex,
|
int animationIndex,
|
||||||
@@ -315,7 +319,7 @@ extern "C" {
|
|||||||
return (int)names->size();
|
return (int)names->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void get_animation_name(
|
FLUTTER_PLUGIN_EXPORT void get_animation_name(
|
||||||
void* assetManager,
|
void* assetManager,
|
||||||
EntityId asset,
|
EntityId asset,
|
||||||
char* const outPtr,
|
char* const outPtr,
|
||||||
@@ -331,17 +335,17 @@ extern "C" {
|
|||||||
return (int)names->size();
|
return (int)names->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void get_morph_target_name(void* assetManager, EntityId asset, const char* meshName, char* const outPtr, int index ) {
|
FLUTTER_PLUGIN_EXPORT void get_morph_target_name(void* assetManager, EntityId asset, const char* meshName, char* const outPtr, int index ) {
|
||||||
unique_ptr<vector<string>> names = ((AssetManager*)assetManager)->getMorphTargetNames(asset, meshName);
|
unique_ptr<vector<string>> names = ((AssetManager*)assetManager)->getMorphTargetNames(asset, meshName);
|
||||||
string name = names->at(index);
|
string name = names->at(index);
|
||||||
strcpy(outPtr, name.c_str());
|
strcpy(outPtr, name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void remove_asset(const void* const viewer, EntityId asset) {
|
FLUTTER_PLUGIN_EXPORT void remove_asset(const void* const viewer, EntityId asset) {
|
||||||
((FilamentViewer*)viewer)->removeAsset(asset);
|
((FilamentViewer*)viewer)->removeAsset(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void clear_assets(const void* const viewer) {
|
FLUTTER_PLUGIN_EXPORT void clear_assets(const void* const viewer) {
|
||||||
((FilamentViewer*)viewer)->clearAssets();
|
((FilamentViewer*)viewer)->clearAssets();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,35 +353,44 @@ extern "C" {
|
|||||||
return ((AssetManager*)assetManager)->setMaterialColor(asset, meshName, materialIndex, r, g, b, a);
|
return ((AssetManager*)assetManager)->setMaterialColor(asset, meshName, materialIndex, r, g, b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void transform_to_unit_cube(void* assetManager, EntityId asset) {
|
FLUTTER_PLUGIN_EXPORT void transform_to_unit_cube(void* assetManager, EntityId asset) {
|
||||||
((AssetManager*)assetManager)->transformToUnitCube(asset);
|
((AssetManager*)assetManager)->transformToUnitCube(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void set_position(void* assetManager, EntityId asset, float x, float y, float z) {
|
FLUTTER_PLUGIN_EXPORT void set_position(void* assetManager, EntityId asset, float x, float y, float z) {
|
||||||
((AssetManager*)assetManager)->setPosition(asset, x, y, z);
|
((AssetManager*)assetManager)->setPosition(asset, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void set_rotation(void* assetManager, EntityId asset, float rads, float x, float y, float z) {
|
FLUTTER_PLUGIN_EXPORT void set_rotation(void* assetManager, EntityId asset, float rads, float x, float y, float z) {
|
||||||
((AssetManager*)assetManager)->setRotation(asset, rads, x, y, z);
|
((AssetManager*)assetManager)->setRotation(asset, rads, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void set_scale(void* assetManager, EntityId asset, float scale) {
|
FLUTTER_PLUGIN_EXPORT void set_scale(void* assetManager, EntityId asset, float scale) {
|
||||||
((AssetManager*)assetManager)->setScale(asset, scale);
|
((AssetManager*)assetManager)->setScale(asset, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void stop_animation(void* assetManager, EntityId asset, int index) {
|
FLUTTER_PLUGIN_EXPORT void stop_animation(void* assetManager, EntityId asset, int index) {
|
||||||
((AssetManager*)assetManager)->stopAnimation(asset, index);
|
((AssetManager*)assetManager)->stopAnimation(asset, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
int hide_mesh(void* assetManager, EntityId asset, const char* meshName) {
|
FLUTTER_PLUGIN_EXPORT int hide_mesh(void* assetManager, EntityId asset, const char* meshName) {
|
||||||
return ((AssetManager*)assetManager)->hide(asset, meshName);
|
return ((AssetManager*)assetManager)->hide(asset, meshName);
|
||||||
}
|
}
|
||||||
|
|
||||||
int reveal_mesh(void* assetManager, EntityId asset, const char* meshName) {
|
FLUTTER_PLUGIN_EXPORT int reveal_mesh(void* assetManager, EntityId asset, const char* meshName) {
|
||||||
return ((AssetManager*)assetManager)->reveal(asset, meshName);
|
return ((AssetManager*)assetManager)->reveal(asset, meshName);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void ios_dummy() {
|
|
||||||
|
FLUTTER_PLUGIN_EXPORT void pick(void* const viewer, int x, int y, EntityId* entityId) {
|
||||||
|
((FilamentViewer*)viewer)->pick(static_cast<uint32_t>(x), static_cast<uint32_t>(y), static_cast<int32_t*>(entityId));
|
||||||
|
}
|
||||||
|
|
||||||
|
FLUTTER_PLUGIN_EXPORT const char* get_name_for_entity(void* const assetManager, const EntityId entityId) {
|
||||||
|
return ((AssetManager*)assetManager)->getNameForEntity(entityId);
|
||||||
|
}
|
||||||
|
|
||||||
|
FLUTTER_PLUGIN_EXPORT void ios_dummy() {
|
||||||
Log("Dummy called");
|
Log("Dummy called");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,412 +2,446 @@
|
|||||||
#include "PolyvoxFilamentFFIApi.h"
|
#include "PolyvoxFilamentFFIApi.h"
|
||||||
|
|
||||||
#include "FilamentViewer.hpp"
|
#include "FilamentViewer.hpp"
|
||||||
#include "filament/LightManager.h"
|
|
||||||
#include "Log.hpp"
|
#include "Log.hpp"
|
||||||
#include "ThreadPool.hpp"
|
#include "ThreadPool.hpp"
|
||||||
|
#include "filament/LightManager.h"
|
||||||
|
|
||||||
#include <thread>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <mutex>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
using namespace polyvox;
|
using namespace polyvox;
|
||||||
|
|
||||||
class RenderLoop
|
class RenderLoop {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
explicit RenderLoop()
|
explicit RenderLoop() {
|
||||||
{
|
_t = new std::thread([this]() {
|
||||||
_t = new std::thread([this]()
|
while (!_stop) {
|
||||||
{
|
{
|
||||||
while(!_stop) {
|
if (_rendering) {
|
||||||
if(_rendering) {
|
doRender();
|
||||||
doRender();
|
}
|
||||||
}
|
}
|
||||||
std::function<void()> task;
|
std::function<void()> task;
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(_access);
|
std::unique_lock<std::mutex> lock(_access);
|
||||||
if(_tasks.empty()) {
|
if (_tasks.empty()) {
|
||||||
_cond.wait_for(lock, std::chrono::duration<float, std::milli>(_frameIntervalInMilliseconds));
|
_cond.wait_for(lock, std::chrono::duration<float, std::milli>(
|
||||||
continue;
|
_frameIntervalInMilliseconds));
|
||||||
}
|
continue;
|
||||||
task = std::move(_tasks.front());
|
}
|
||||||
_tasks.pop_front();
|
task = std::move(_tasks.front());
|
||||||
}
|
_tasks.pop_front();
|
||||||
task();
|
}
|
||||||
} });
|
task();
|
||||||
}
|
}
|
||||||
~RenderLoop()
|
});
|
||||||
{
|
}
|
||||||
_stop = true;
|
~RenderLoop() {
|
||||||
_t->join();
|
_stop = true;
|
||||||
}
|
_t->join();
|
||||||
|
}
|
||||||
|
|
||||||
void* const createViewer(
|
void *const createViewer(void *const context, void *const platform,
|
||||||
void* const context,
|
const char *uberArchivePath,
|
||||||
void* const platform,
|
const ResourceLoaderWrapper *const loader,
|
||||||
const ResourceLoaderWrapper* const loader,
|
void (*renderCallback)(void *), void *const owner) {
|
||||||
void (*renderCallback)(void*), void* const owner
|
_renderCallback = renderCallback;
|
||||||
) {
|
_renderCallbackOwner = owner;
|
||||||
_renderCallback = renderCallback;
|
std::packaged_task<FilamentViewer *()> lambda([&]() mutable {
|
||||||
_renderCallbackOwner = owner;
|
std::thread::id this_id = std::this_thread::get_id();
|
||||||
std::packaged_task<FilamentViewer*()> lambda([&]() mutable
|
return new FilamentViewer(context, loader, platform, uberArchivePath);
|
||||||
{
|
});
|
||||||
return new FilamentViewer(context, loader, platform);
|
auto fut = add_task(lambda);
|
||||||
});
|
fut.wait();
|
||||||
auto fut = add_task(lambda);
|
_viewer = fut.get();
|
||||||
fut.wait();
|
return (void *const)_viewer;
|
||||||
_viewer = fut.get();
|
}
|
||||||
return (void* const)_viewer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setRendering(bool rendering)
|
void destroyViewer() {
|
||||||
{
|
std::packaged_task<void()> lambda([&]() mutable {
|
||||||
_rendering = rendering;
|
_rendering = false;
|
||||||
}
|
destroy_filament_viewer(_viewer);
|
||||||
|
_viewer = nullptr;
|
||||||
|
});
|
||||||
|
auto fut = add_task(lambda);
|
||||||
|
fut.wait();
|
||||||
|
}
|
||||||
|
|
||||||
void doRender()
|
void setRendering(bool rendering) {
|
||||||
{
|
std::packaged_task<void()> lambda(
|
||||||
render(_viewer, 0, nullptr, nullptr, nullptr);
|
[&]() mutable { this->_rendering = rendering; });
|
||||||
_renderCallback(_renderCallbackOwner);
|
auto fut = add_task(lambda);
|
||||||
}
|
fut.wait();
|
||||||
|
}
|
||||||
|
|
||||||
void setFrameIntervalInMilliseconds(float frameIntervalInMilliseconds) {
|
void doRender() {
|
||||||
_frameIntervalInMilliseconds = frameIntervalInMilliseconds;
|
render(_viewer, 0, nullptr, nullptr, nullptr);
|
||||||
}
|
_renderCallback(_renderCallbackOwner);
|
||||||
|
}
|
||||||
|
|
||||||
template <class Rt>
|
void setFrameIntervalInMilliseconds(float frameIntervalInMilliseconds) {
|
||||||
auto add_task(std::packaged_task<Rt()> &pt) -> std::future<Rt>
|
_frameIntervalInMilliseconds = frameIntervalInMilliseconds;
|
||||||
{
|
}
|
||||||
std::unique_lock<std::mutex> lock(_access);
|
|
||||||
auto ret = pt.get_future();
|
template <class Rt>
|
||||||
_tasks.push_back([pt = std::make_shared<std::packaged_task<Rt()>>(std::move(pt))]
|
auto add_task(std::packaged_task<Rt()> &pt) -> std::future<Rt> {
|
||||||
{ (*pt)(); });
|
std::unique_lock<std::mutex> lock(_access);
|
||||||
_cond.notify_one();
|
auto ret = pt.get_future();
|
||||||
return ret;
|
_tasks.push_back([pt = std::make_shared<std::packaged_task<Rt()>>(
|
||||||
}
|
std::move(pt))] { (*pt)(); });
|
||||||
|
_cond.notify_one();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _stop = false;
|
bool _stop = false;
|
||||||
bool _rendering = false;
|
bool _rendering = false;
|
||||||
float _frameIntervalInMilliseconds = 1000.0 / 60.0;
|
float _frameIntervalInMilliseconds = 1000.0 / 60.0;
|
||||||
std::mutex _access;
|
std::mutex _access;
|
||||||
FilamentViewer *_viewer = nullptr;
|
FilamentViewer *_viewer = nullptr;
|
||||||
void (*_renderCallback)(void* const) = nullptr;
|
void (*_renderCallback)(void *const) = nullptr;
|
||||||
void *_renderCallbackOwner = nullptr;
|
void *_renderCallbackOwner = nullptr;
|
||||||
std::thread *_t = nullptr;
|
std::thread *_t = nullptr;
|
||||||
std::condition_variable _cond;
|
std::condition_variable _cond;
|
||||||
std::deque<std::function<void()>> _tasks;
|
std::deque<std::function<void()>> _tasks;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
|
|
||||||
static RenderLoop *_rl;
|
static RenderLoop *_rl;
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void* const create_filament_viewer_ffi(
|
FLUTTER_PLUGIN_EXPORT void *const create_filament_viewer_ffi(
|
||||||
void* const context,
|
void *const context, void *const platform, const char *uberArchivePath,
|
||||||
void* const platform,
|
const ResourceLoaderWrapper *const loader,
|
||||||
const ResourceLoaderWrapper* const loader,
|
void (*renderCallback)(void *const renderCallbackOwner),
|
||||||
void (*renderCallback)(void* const renderCallbackOwner),
|
void *const renderCallbackOwner) {
|
||||||
void* const renderCallbackOwner) {
|
if (!_rl) {
|
||||||
if (!_rl)
|
_rl = new RenderLoop();
|
||||||
{
|
}
|
||||||
_rl = new RenderLoop();
|
return _rl->createViewer(context, platform, uberArchivePath, loader,
|
||||||
}
|
renderCallback, renderCallbackOwner);
|
||||||
return _rl->createViewer(context, platform, loader, renderCallback, renderCallbackOwner);
|
}
|
||||||
}
|
|
||||||
|
FLUTTER_PLUGIN_EXPORT void destroy_filament_viewer_ffi(void *const viewer) {
|
||||||
FLUTTER_PLUGIN_EXPORT void create_swap_chain_ffi(void* const viewer, void* const surface, uint32_t width, uint32_t height)
|
_rl->destroyViewer();
|
||||||
{
|
}
|
||||||
Log("Creating swapchain %dx%d", width, height);
|
|
||||||
std::packaged_task<void()> lambda([&]() mutable
|
FLUTTER_PLUGIN_EXPORT void create_swap_chain_ffi(void *const viewer,
|
||||||
{
|
void *const surface,
|
||||||
create_swap_chain(viewer, surface, width, height);
|
uint32_t width,
|
||||||
});
|
uint32_t height) {
|
||||||
auto fut = _rl->add_task(lambda);
|
Log("Creating swapchain %dx%d", width, height);
|
||||||
fut.wait();
|
std::packaged_task<void()> lambda(
|
||||||
}
|
[&]() mutable { create_swap_chain(viewer, surface, width, height); });
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
FLUTTER_PLUGIN_EXPORT void create_render_target_ffi(void* const viewer, uint32_t nativeTextureId, uint32_t width, uint32_t height)
|
fut.wait();
|
||||||
{
|
}
|
||||||
std::packaged_task<void()> lambda([&]() mutable
|
|
||||||
{ create_render_target(viewer, nativeTextureId, width, height); });
|
FLUTTER_PLUGIN_EXPORT void destroy_swap_chain_ffi(void *const viewer) {
|
||||||
auto fut = _rl->add_task(lambda);
|
Log("Destroying swapchain");
|
||||||
fut.wait();
|
std::packaged_task<void()> lambda(
|
||||||
}
|
[&]() mutable {
|
||||||
|
destroy_swap_chain(viewer);
|
||||||
FLUTTER_PLUGIN_EXPORT void update_viewport_and_camera_projection_ffi(void* const viewer, const uint32_t width, const uint32_t height, const float scaleFactor)
|
});
|
||||||
{
|
auto fut = _rl->add_task(lambda);
|
||||||
Log("Update viewport %dx%d", width, height);
|
fut.wait();
|
||||||
std::packaged_task<void()> lambda([&]() mutable
|
}
|
||||||
{
|
|
||||||
update_viewport_and_camera_projection(viewer, width, height, scaleFactor);
|
FLUTTER_PLUGIN_EXPORT void create_render_target_ffi(void *const viewer,
|
||||||
});
|
intptr_t nativeTextureId,
|
||||||
auto fut = _rl->add_task(lambda);
|
uint32_t width,
|
||||||
fut.wait();
|
uint32_t height) {
|
||||||
}
|
std::packaged_task<void()> lambda([&]() mutable {
|
||||||
|
create_render_target(viewer, nativeTextureId, width, height);
|
||||||
FLUTTER_PLUGIN_EXPORT void set_rendering_ffi(void* const viewer, bool rendering)
|
});
|
||||||
{
|
auto fut = _rl->add_task(lambda);
|
||||||
if (!_rl)
|
fut.wait();
|
||||||
{
|
}
|
||||||
Log("No render loop!"); // PANIC?
|
|
||||||
}
|
FLUTTER_PLUGIN_EXPORT void update_viewport_and_camera_projection_ffi(
|
||||||
else
|
void *const viewer, const uint32_t width, const uint32_t height,
|
||||||
{
|
const float scaleFactor) {
|
||||||
if (rendering)
|
Log("Update viewport %dx%d", width, height);
|
||||||
{
|
std::packaged_task<void()> lambda([&]() mutable {
|
||||||
Log("Set rendering to true");
|
update_viewport_and_camera_projection(viewer, width, height, scaleFactor);
|
||||||
}
|
});
|
||||||
else
|
auto fut = _rl->add_task(lambda);
|
||||||
{
|
fut.wait();
|
||||||
Log("Set rendering to false");
|
}
|
||||||
}
|
|
||||||
_rl->setRendering(rendering);
|
FLUTTER_PLUGIN_EXPORT void set_rendering_ffi(void *const viewer,
|
||||||
}
|
bool rendering) {
|
||||||
}
|
if (!_rl) {
|
||||||
|
Log("No render loop!"); // PANIC?
|
||||||
FLUTTER_PLUGIN_EXPORT void set_frame_interval_ffi(float frameIntervalInMilliseconds) {
|
} else {
|
||||||
_rl->setFrameIntervalInMilliseconds(frameIntervalInMilliseconds);
|
if (rendering) {
|
||||||
}
|
Log("Set rendering to true");
|
||||||
|
} else {
|
||||||
FLUTTER_PLUGIN_EXPORT void render_ffi(void* const viewer)
|
Log("Set rendering to false");
|
||||||
{
|
}
|
||||||
std::packaged_task<void()> lambda([&]() mutable
|
_rl->setRendering(rendering);
|
||||||
{
|
}
|
||||||
_rl->doRender();
|
}
|
||||||
});
|
|
||||||
auto fut = _rl->add_task(lambda);
|
FLUTTER_PLUGIN_EXPORT void
|
||||||
fut.wait();
|
set_frame_interval_ffi(float frameIntervalInMilliseconds) {
|
||||||
}
|
_rl->setFrameIntervalInMilliseconds(frameIntervalInMilliseconds);
|
||||||
|
}
|
||||||
FLUTTER_PLUGIN_EXPORT void set_background_color_ffi(void* const viewer, const float r, const float g, const float b, const float a)
|
|
||||||
{
|
FLUTTER_PLUGIN_EXPORT void render_ffi(void *const viewer) {
|
||||||
std::packaged_task<void()> lambda([&]() mutable
|
std::packaged_task<void()> lambda([&]() mutable { _rl->doRender(); });
|
||||||
{ set_background_color(viewer, r, g, b, a); });
|
auto fut = _rl->add_task(lambda);
|
||||||
auto fut = _rl->add_task(lambda);
|
fut.wait();
|
||||||
fut.wait();
|
}
|
||||||
}
|
|
||||||
|
FLUTTER_PLUGIN_EXPORT void
|
||||||
FLUTTER_PLUGIN_EXPORT EntityId load_gltf_ffi(void* const assetManager, const char *path, const char *relativeResourcePath)
|
set_background_color_ffi(void *const viewer, const float r, const float g,
|
||||||
{
|
const float b, const float a) {
|
||||||
std::packaged_task<EntityId()> lambda([&]() mutable
|
std::packaged_task<void()> lambda(
|
||||||
{ return load_gltf(assetManager, path, relativeResourcePath); });
|
[&]() mutable { set_background_color(viewer, r, g, b, a); });
|
||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
fut.wait();
|
fut.wait();
|
||||||
return fut.get();
|
}
|
||||||
}
|
|
||||||
|
FLUTTER_PLUGIN_EXPORT EntityId load_gltf_ffi(void *const assetManager,
|
||||||
FLUTTER_PLUGIN_EXPORT EntityId load_glb_ffi(void* const assetManager, const char *path, bool unlit)
|
const char *path,
|
||||||
{
|
const char *relativeResourcePath) {
|
||||||
std::packaged_task<EntityId()> lambda([&]() mutable
|
std::packaged_task<EntityId()> lambda([&]() mutable {
|
||||||
{ return load_glb(assetManager, path, unlit); });
|
return load_gltf(assetManager, path, relativeResourcePath);
|
||||||
auto fut = _rl->add_task(lambda);
|
});
|
||||||
fut.wait();
|
auto fut = _rl->add_task(lambda);
|
||||||
return fut.get();
|
fut.wait();
|
||||||
}
|
return fut.get();
|
||||||
|
}
|
||||||
FLUTTER_PLUGIN_EXPORT void clear_background_image_ffi(void* const viewer)
|
|
||||||
{
|
FLUTTER_PLUGIN_EXPORT EntityId load_glb_ffi(void *const assetManager,
|
||||||
std::packaged_task<void()> lambda([&]
|
const char *path, bool unlit) {
|
||||||
{
|
std::packaged_task<EntityId()> lambda(
|
||||||
clear_background_image(viewer);
|
[&]() mutable { return load_glb(assetManager, path, unlit); });
|
||||||
});
|
auto fut = _rl->add_task(lambda);
|
||||||
auto fut = _rl->add_task(lambda);
|
fut.wait();
|
||||||
fut.wait();
|
return fut.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
FLUTTER_PLUGIN_EXPORT void set_background_image_ffi(void* const viewer, const char *path, bool fillHeight)
|
FLUTTER_PLUGIN_EXPORT void clear_background_image_ffi(void *const viewer) {
|
||||||
{
|
std::packaged_task<void()> lambda([&] { clear_background_image(viewer); });
|
||||||
std::packaged_task<void()> lambda([&]
|
auto fut = _rl->add_task(lambda);
|
||||||
{
|
fut.wait();
|
||||||
set_background_image(viewer, path, fillHeight);
|
}
|
||||||
});
|
|
||||||
auto fut = _rl->add_task(lambda);
|
FLUTTER_PLUGIN_EXPORT void set_background_image_ffi(void *const viewer,
|
||||||
fut.wait();
|
const char *path,
|
||||||
}
|
bool fillHeight) {
|
||||||
FLUTTER_PLUGIN_EXPORT void set_background_image_position_ffi(void* const viewer, float x, float y, bool clamp)
|
std::packaged_task<void()> lambda(
|
||||||
{
|
[&] { set_background_image(viewer, path, fillHeight); });
|
||||||
std::packaged_task<void()> lambda([&]
|
auto fut = _rl->add_task(lambda);
|
||||||
{ set_background_image_position(viewer, x, y, clamp); });
|
fut.wait();
|
||||||
auto fut = _rl->add_task(lambda);
|
}
|
||||||
fut.wait();
|
FLUTTER_PLUGIN_EXPORT void set_background_image_position_ffi(void *const viewer,
|
||||||
}
|
float x, float y,
|
||||||
FLUTTER_PLUGIN_EXPORT void set_tone_mapping_ffi(void* const viewer, int toneMapping)
|
bool clamp) {
|
||||||
{
|
std::packaged_task<void()> lambda(
|
||||||
std::packaged_task<void()> lambda([&]
|
[&] { set_background_image_position(viewer, x, y, clamp); });
|
||||||
{ set_tone_mapping(viewer, toneMapping); });
|
auto fut = _rl->add_task(lambda);
|
||||||
auto fut = _rl->add_task(lambda);
|
fut.wait();
|
||||||
fut.wait();
|
}
|
||||||
}
|
FLUTTER_PLUGIN_EXPORT void set_tone_mapping_ffi(void *const viewer,
|
||||||
FLUTTER_PLUGIN_EXPORT void set_bloom_ffi(void* const viewer, float strength)
|
int toneMapping) {
|
||||||
{
|
std::packaged_task<void()> lambda(
|
||||||
std::packaged_task<void()> lambda([&]
|
[&] { set_tone_mapping(viewer, toneMapping); });
|
||||||
{ set_bloom(viewer, strength); });
|
auto fut = _rl->add_task(lambda);
|
||||||
auto fut = _rl->add_task(lambda);
|
fut.wait();
|
||||||
fut.wait();
|
}
|
||||||
}
|
FLUTTER_PLUGIN_EXPORT void set_bloom_ffi(void *const viewer, float strength) {
|
||||||
FLUTTER_PLUGIN_EXPORT void load_skybox_ffi(void* const viewer, const char *skyboxPath)
|
std::packaged_task<void()> lambda([&] { set_bloom(viewer, strength); });
|
||||||
{
|
auto fut = _rl->add_task(lambda);
|
||||||
std::packaged_task<void()> lambda([&]
|
fut.wait();
|
||||||
{ load_skybox(viewer, skyboxPath); });
|
}
|
||||||
auto fut = _rl->add_task(lambda);
|
FLUTTER_PLUGIN_EXPORT void load_skybox_ffi(void *const viewer,
|
||||||
fut.wait();
|
const char *skyboxPath) {
|
||||||
}
|
std::packaged_task<void()> lambda([&] { load_skybox(viewer, skyboxPath); });
|
||||||
FLUTTER_PLUGIN_EXPORT void load_ibl_ffi(void* const viewer, const char *iblPath, float intensity)
|
auto fut = _rl->add_task(lambda);
|
||||||
{
|
fut.wait();
|
||||||
std::packaged_task<void()> lambda([&]
|
}
|
||||||
{ load_ibl(viewer, iblPath, intensity); });
|
FLUTTER_PLUGIN_EXPORT void load_ibl_ffi(void *const viewer, const char *iblPath,
|
||||||
auto fut = _rl->add_task(lambda);
|
float intensity) {
|
||||||
fut.wait();
|
std::packaged_task<void()> lambda(
|
||||||
}
|
[&] { load_ibl(viewer, iblPath, intensity); });
|
||||||
FLUTTER_PLUGIN_EXPORT void remove_skybox_ffi(void* const viewer)
|
auto fut = _rl->add_task(lambda);
|
||||||
{
|
fut.wait();
|
||||||
std::packaged_task<void()> lambda([&]
|
}
|
||||||
{ remove_skybox(viewer); });
|
FLUTTER_PLUGIN_EXPORT void remove_skybox_ffi(void *const viewer) {
|
||||||
auto fut = _rl->add_task(lambda);
|
std::packaged_task<void()> lambda([&] { remove_skybox(viewer); });
|
||||||
fut.wait();
|
auto fut = _rl->add_task(lambda);
|
||||||
}
|
fut.wait();
|
||||||
FLUTTER_PLUGIN_EXPORT void remove_ibl_ffi(void* const viewer)
|
}
|
||||||
{
|
|
||||||
std::packaged_task<void()> lambda([&]
|
FLUTTER_PLUGIN_EXPORT void remove_ibl_ffi(void *const viewer) {
|
||||||
{ remove_ibl(viewer); });
|
std::packaged_task<void()> lambda([&] { remove_ibl(viewer); });
|
||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
fut.wait();
|
fut.wait();
|
||||||
}
|
}
|
||||||
EntityId add_light_ffi(void* const viewer, uint8_t type, float colour, float intensity, float posX, float posY, float posZ, float dirX, float dirY, float dirZ, bool shadows)
|
|
||||||
{
|
EntityId add_light_ffi(void *const viewer, uint8_t type, float colour,
|
||||||
std::packaged_task<EntityId()> lambda([&]
|
float intensity, float posX, float posY, float posZ,
|
||||||
{ return add_light(viewer, type, colour, intensity, posX, posY, posZ, dirX, dirY, dirZ, shadows); });
|
float dirX, float dirY, float dirZ, bool shadows) {
|
||||||
auto fut = _rl->add_task(lambda);
|
std::packaged_task<EntityId()> lambda([&] {
|
||||||
fut.wait();
|
return add_light(viewer, type, colour, intensity, posX, posY, posZ, dirX,
|
||||||
return fut.get();
|
dirY, dirZ, shadows);
|
||||||
}
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
FLUTTER_PLUGIN_EXPORT void remove_light_ffi(void* const viewer, EntityId entityId)
|
fut.wait();
|
||||||
{
|
return fut.get();
|
||||||
std::packaged_task<void()> lambda([&]
|
}
|
||||||
{ remove_light(viewer, entityId); });
|
|
||||||
auto fut = _rl->add_task(lambda);
|
FLUTTER_PLUGIN_EXPORT void remove_light_ffi(void *const viewer,
|
||||||
fut.wait();
|
EntityId entityId) {
|
||||||
}
|
std::packaged_task<void()> lambda([&] { remove_light(viewer, entityId); });
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
FLUTTER_PLUGIN_EXPORT void clear_lights_ffi(void* const viewer)
|
fut.wait();
|
||||||
{
|
}
|
||||||
std::packaged_task<void()> lambda([&]
|
|
||||||
{ clear_lights(viewer); });
|
FLUTTER_PLUGIN_EXPORT void clear_lights_ffi(void *const viewer) {
|
||||||
auto fut = _rl->add_task(lambda);
|
std::packaged_task<void()> lambda([&] { clear_lights(viewer); });
|
||||||
fut.wait();
|
auto fut = _rl->add_task(lambda);
|
||||||
}
|
fut.wait();
|
||||||
|
}
|
||||||
FLUTTER_PLUGIN_EXPORT void remove_asset_ffi(void* const viewer, EntityId asset)
|
|
||||||
{
|
FLUTTER_PLUGIN_EXPORT void remove_asset_ffi(void *const viewer,
|
||||||
std::packaged_task<void()> lambda([&]
|
EntityId asset) {
|
||||||
{ remove_asset(viewer, asset); });
|
std::packaged_task<void()> lambda([&] { remove_asset(viewer, asset); });
|
||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
fut.wait();
|
fut.wait();
|
||||||
}
|
}
|
||||||
FLUTTER_PLUGIN_EXPORT void clear_assets_ffi(void* const viewer)
|
FLUTTER_PLUGIN_EXPORT void clear_assets_ffi(void *const viewer) {
|
||||||
{
|
std::packaged_task<void()> lambda([&] { clear_assets(viewer); });
|
||||||
std::packaged_task<void()> lambda([&]
|
auto fut = _rl->add_task(lambda);
|
||||||
{ clear_assets(viewer); });
|
fut.wait();
|
||||||
auto fut = _rl->add_task(lambda);
|
}
|
||||||
fut.wait();
|
|
||||||
}
|
FLUTTER_PLUGIN_EXPORT bool set_camera_ffi(void *const viewer, EntityId asset,
|
||||||
|
const char *nodeName) {
|
||||||
FLUTTER_PLUGIN_EXPORT bool set_camera_ffi(void* const viewer, EntityId asset, const char *nodeName)
|
std::packaged_task<bool()> lambda(
|
||||||
{
|
[&] { return set_camera(viewer, asset, nodeName); });
|
||||||
std::packaged_task<bool()> lambda([&]
|
auto fut = _rl->add_task(lambda);
|
||||||
{ return set_camera(viewer, asset, nodeName); });
|
fut.wait();
|
||||||
auto fut = _rl->add_task(lambda);
|
return fut.get();
|
||||||
fut.wait();
|
}
|
||||||
return fut.get();
|
|
||||||
}
|
FLUTTER_PLUGIN_EXPORT void set_bone_animation_ffi(
|
||||||
|
void *assetManager, EntityId asset, const float *const frameData,
|
||||||
FLUTTER_PLUGIN_EXPORT void set_bone_animation_ffi(
|
int numFrames, int numBones, const char **const boneNames,
|
||||||
void *assetManager,
|
const char **const meshName, int numMeshTargets, float frameLengthInMs) {
|
||||||
EntityId asset,
|
std::packaged_task<void()> lambda([&] {
|
||||||
const float *const frameData,
|
set_bone_animation(assetManager, asset, frameData, numFrames, numBones,
|
||||||
int numFrames,
|
boneNames, meshName, numMeshTargets, frameLengthInMs);
|
||||||
int numBones,
|
});
|
||||||
const char **const boneNames,
|
auto fut = _rl->add_task(lambda);
|
||||||
const char **const meshName,
|
fut.wait();
|
||||||
int numMeshTargets,
|
}
|
||||||
float frameLengthInMs)
|
|
||||||
{
|
FLUTTER_PLUGIN_EXPORT void
|
||||||
std::packaged_task<void()> lambda([&]
|
get_morph_target_name_ffi(void *assetManager, EntityId asset,
|
||||||
{ set_bone_animation(
|
const char *meshName, char *const outPtr, int index) {
|
||||||
assetManager, asset, frameData, numFrames, numBones,
|
std::packaged_task<void()> lambda([&] {
|
||||||
boneNames, meshName, numMeshTargets, frameLengthInMs); });
|
get_morph_target_name(assetManager, asset, meshName, outPtr, index);
|
||||||
auto fut = _rl->add_task(lambda);
|
});
|
||||||
fut.wait();
|
auto fut = _rl->add_task(lambda);
|
||||||
}
|
fut.wait();
|
||||||
|
}
|
||||||
FLUTTER_PLUGIN_EXPORT void get_morph_target_name_ffi(void *assetManager, EntityId asset, const char *meshName, char *const outPtr, int index)
|
|
||||||
{
|
FLUTTER_PLUGIN_EXPORT int
|
||||||
std::packaged_task<void()> lambda([&]
|
get_morph_target_name_count_ffi(void *assetManager, EntityId asset,
|
||||||
{ get_morph_target_name(assetManager, asset, meshName, outPtr, index); });
|
const char *meshName) {
|
||||||
auto fut = _rl->add_task(lambda);
|
std::packaged_task<int()> lambda([&] {
|
||||||
fut.wait();
|
return get_morph_target_name_count(assetManager, asset, meshName);
|
||||||
}
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
FLUTTER_PLUGIN_EXPORT int get_morph_target_name_count_ffi(void *assetManager, EntityId asset, const char *meshName)
|
fut.wait();
|
||||||
{
|
return fut.get();
|
||||||
std::packaged_task<int()> lambda([&]
|
}
|
||||||
{ return get_morph_target_name_count(assetManager, asset, meshName); });
|
|
||||||
auto fut = _rl->add_task(lambda);
|
void set_morph_target_weights_ffi(void *const assetManager, EntityId asset,
|
||||||
fut.wait();
|
const char *const entityName,
|
||||||
return fut.get();
|
const float *const morphData,
|
||||||
}
|
int numWeights) {
|
||||||
|
// TODO
|
||||||
void set_morph_target_weights_ffi(
|
}
|
||||||
void* const assetManager,
|
|
||||||
EntityId asset,
|
FLUTTER_PLUGIN_EXPORT void play_animation_ffi(void *const assetManager,
|
||||||
const char *const entityName,
|
EntityId asset, int index,
|
||||||
const float *const morphData,
|
bool loop, bool reverse,
|
||||||
int numWeights)
|
bool replaceActive,
|
||||||
{
|
float crossfade) {
|
||||||
// TODO
|
std::packaged_task<void()> lambda([&] {
|
||||||
}
|
play_animation(assetManager, asset, index, loop, reverse, replaceActive,
|
||||||
|
crossfade);
|
||||||
void play_animation_ffi(void* const assetManager, EntityId asset, int index, bool loop, bool reverse, bool replaceActive, float crossfade)
|
});
|
||||||
{
|
auto fut = _rl->add_task(lambda);
|
||||||
std::packaged_task<void()> lambda([&]
|
fut.wait();
|
||||||
{ play_animation(assetManager, asset, index, loop, reverse, replaceActive, crossfade); });
|
}
|
||||||
auto fut = _rl->add_task(lambda);
|
|
||||||
fut.wait();
|
FLUTTER_PLUGIN_EXPORT void set_animation_frame_ffi(void *const assetManager,
|
||||||
}
|
EntityId asset,
|
||||||
void set_animation_frame_ffi(void* const assetManager, EntityId asset, int animationIndex, int animationFrame)
|
int animationIndex,
|
||||||
{
|
int animationFrame) {
|
||||||
std::packaged_task<void()> lambda([&]
|
std::packaged_task<void()> lambda([&] {
|
||||||
{ set_animation_frame(assetManager, asset, animationIndex, animationFrame); });
|
set_animation_frame(assetManager, asset, animationIndex, animationFrame);
|
||||||
auto fut = _rl->add_task(lambda);
|
});
|
||||||
fut.wait();
|
auto fut = _rl->add_task(lambda);
|
||||||
}
|
fut.wait();
|
||||||
void stop_animation_ffi(void* const assetManager, EntityId asset, int index)
|
}
|
||||||
{
|
|
||||||
std::packaged_task<void()> lambda([&]
|
FLUTTER_PLUGIN_EXPORT void stop_animation_ffi(void *const assetManager,
|
||||||
{ stop_animation(assetManager, asset, index); });
|
EntityId asset, int index) {
|
||||||
auto fut = _rl->add_task(lambda);
|
std::packaged_task<void()> lambda(
|
||||||
fut.wait();
|
[&] { stop_animation(assetManager, asset, index); });
|
||||||
}
|
auto fut = _rl->add_task(lambda);
|
||||||
int get_animation_count_ffi(void* const assetManager, EntityId asset)
|
fut.wait();
|
||||||
{
|
}
|
||||||
std::packaged_task<int()> lambda([&]
|
|
||||||
{ return get_animation_count(assetManager, asset); });
|
FLUTTER_PLUGIN_EXPORT int get_animation_count_ffi(void *const assetManager,
|
||||||
auto fut = _rl->add_task(lambda);
|
EntityId asset) {
|
||||||
fut.wait();
|
std::packaged_task<int()> lambda(
|
||||||
return fut.get();
|
[&] { return get_animation_count(assetManager, asset); });
|
||||||
}
|
auto fut = _rl->add_task(lambda);
|
||||||
void get_animation_name_ffi(void* const assetManager, EntityId asset, char *const outPtr, int index)
|
fut.wait();
|
||||||
{
|
return fut.get();
|
||||||
std::packaged_task<void()> lambda([&] {
|
}
|
||||||
get_animation_name(assetManager, asset, outPtr, index);
|
FLUTTER_PLUGIN_EXPORT void get_animation_name_ffi(void *const assetManager,
|
||||||
});
|
EntityId asset,
|
||||||
auto fut = _rl->add_task(lambda);
|
char *const outPtr,
|
||||||
fut.wait();
|
int index) {
|
||||||
}
|
std::packaged_task<void()> lambda(
|
||||||
|
[&] { get_animation_name(assetManager, asset, outPtr, index); });
|
||||||
FLUTTER_PLUGIN_EXPORT void ios_dummy_ffi() {
|
auto fut = _rl->add_task(lambda);
|
||||||
Log("Dummy called");
|
fut.wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FLUTTER_PLUGIN_EXPORT void set_post_processing_ffi(void *const viewer,
|
||||||
|
bool enabled) {
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[&] { set_post_processing(viewer, enabled); });
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
fut.wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
FLUTTER_PLUGIN_EXPORT void pick_ffi(void *const viewer, int x, int y,
|
||||||
|
EntityId *entityId) {
|
||||||
|
std::packaged_task<void()> lambda([&] { pick(viewer, x, y, entityId); });
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
fut.wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
FLUTTER_PLUGIN_EXPORT const char *
|
||||||
|
get_name_for_entity_ffi(void *const assetManager, const EntityId entityId) {
|
||||||
|
std::packaged_task<const char *()> lambda(
|
||||||
|
[&] { return get_name_for_entity(assetManager, entityId); });
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
fut.wait();
|
||||||
|
return fut.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
FLUTTER_PLUGIN_EXPORT void ios_dummy_ffi() { Log("Dummy called"); }
|
||||||
}
|
}
|
||||||
|
|||||||
98
ios/src/camutils/Bookmark.cpp
Normal file
98
ios/src/camutils/Bookmark.cpp
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <camutils/Bookmark.h>
|
||||||
|
#include <camutils/Manipulator.h>
|
||||||
|
|
||||||
|
#include <math/scalar.h>
|
||||||
|
#include <math/vec3.h>
|
||||||
|
|
||||||
|
using namespace filament::math;
|
||||||
|
|
||||||
|
namespace filament {
|
||||||
|
namespace camutils {
|
||||||
|
|
||||||
|
template <typename FLOAT>
|
||||||
|
Bookmark<FLOAT> Bookmark<FLOAT>::interpolate(Bookmark<FLOAT> a, Bookmark<FLOAT> b, double t) {
|
||||||
|
Bookmark<FLOAT> result;
|
||||||
|
using float3 = filament::math::vec3<FLOAT>;
|
||||||
|
|
||||||
|
if (a.mode == Mode::MAP) {
|
||||||
|
assert(b.mode == Mode::MAP);
|
||||||
|
const double rho = sqrt(2.0);
|
||||||
|
const double rho2 = 2, rho4 = 4;
|
||||||
|
const double ux0 = a.map.center.x, uy0 = a.map.center.y, w0 = a.map.extent;
|
||||||
|
const double ux1 = b.map.center.x, uy1 = b.map.center.y, w1 = b.map.extent;
|
||||||
|
const double dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, d1 = sqrt(d2);
|
||||||
|
const double b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2.0 * w0 * rho2 * d1);
|
||||||
|
const double b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2.0 * w1 * rho2 * d1);
|
||||||
|
const double r0 = log(sqrt(b0 * b0 + 1.0) - b0);
|
||||||
|
const double r1 = log(sqrt(b1 * b1 + 1) - b1);
|
||||||
|
const double dr = r1 - r0;
|
||||||
|
const int valid = !std::isnan(dr) && dr != 0;
|
||||||
|
const double S = (valid ? dr : log(w1 / w0)) / rho;
|
||||||
|
const double s = t * S;
|
||||||
|
|
||||||
|
// This performs Van Wijk interpolation to animate between two waypoints on a map.
|
||||||
|
if (valid) {
|
||||||
|
const double coshr0 = cosh(r0);
|
||||||
|
const double u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
|
||||||
|
Bookmark<FLOAT> result;
|
||||||
|
result.map.center.x = ux0 + u * dx;
|
||||||
|
result.map.center.y = uy0 + u * dy;
|
||||||
|
result.map.extent = w0 * coshr0 / cosh(rho * s + r0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For degenerate cases, fall back to a simplified interpolation method.
|
||||||
|
result.map.center.x = ux0 + t * dx;
|
||||||
|
result.map.center.y = uy0 + t * dy;
|
||||||
|
result.map.extent = w0 * exp(rho * s);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(b.mode == Mode::ORBIT);
|
||||||
|
result.orbit.phi = lerp(a.orbit.phi, b.orbit.phi, FLOAT(t));
|
||||||
|
result.orbit.theta = lerp(a.orbit.theta, b.orbit.theta, FLOAT(t));
|
||||||
|
result.orbit.distance = lerp(a.orbit.distance, b.orbit.distance, FLOAT(t));
|
||||||
|
result.orbit.pivot = lerp(a.orbit.pivot, b.orbit.pivot, float3(t));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uses the Van Wijk method to suggest a duration for animating between two waypoints on a map.
|
||||||
|
// This does not have units, so just use it as a multiplier.
|
||||||
|
template <typename FLOAT>
|
||||||
|
double Bookmark<FLOAT>::duration(Bookmark<FLOAT> a, Bookmark<FLOAT> b) {
|
||||||
|
assert(a.mode == Mode::ORBIT && b.mode == Mode::ORBIT);
|
||||||
|
const double rho = sqrt(2.0);
|
||||||
|
const double rho2 = 2, rho4 = 4;
|
||||||
|
const double ux0 = a.map.center.x, uy0 = a.map.center.y, w0 = a.map.extent;
|
||||||
|
const double ux1 = b.map.center.x, uy1 = b.map.center.y, w1 = b.map.extent;
|
||||||
|
const double dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, d1 = sqrt(d2);
|
||||||
|
const double b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2.0 * w0 * rho2 * d1);
|
||||||
|
const double b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2.0 * w1 * rho2 * d1);
|
||||||
|
const double r0 = log(sqrt(b0 * b0 + 1.0) - b0);
|
||||||
|
const double r1 = log(sqrt(b1 * b1 + 1) - b1);
|
||||||
|
const double dr = r1 - r0;
|
||||||
|
const int valid = !std::isnan(dr) && dr != 0;
|
||||||
|
const double S = (valid ? dr : log(w1 / w0)) / rho;
|
||||||
|
return fabs(S);
|
||||||
|
}
|
||||||
|
|
||||||
|
template class Bookmark<float>;
|
||||||
|
|
||||||
|
} // namespace camutils
|
||||||
|
} // namespace filament
|
||||||
206
ios/src/camutils/FreeFlightManipulator.h
Normal file
206
ios/src/camutils/FreeFlightManipulator.h
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CAMUTILS_FREEFLIGHT_MANIPULATOR_H
|
||||||
|
#define CAMUTILS_FREEFLIGHT_MANIPULATOR_H
|
||||||
|
|
||||||
|
#include <camutils/Manipulator.h>
|
||||||
|
|
||||||
|
#include <math/scalar.h>
|
||||||
|
#include <math/mat3.h>
|
||||||
|
#include <math/mat4.h>
|
||||||
|
#include <math/quat.h>
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
namespace filament {
|
||||||
|
namespace camutils {
|
||||||
|
|
||||||
|
using namespace filament::math;
|
||||||
|
|
||||||
|
template<typename FLOAT>
|
||||||
|
class FreeFlightManipulator : public Manipulator<FLOAT> {
|
||||||
|
public:
|
||||||
|
using vec2 = filament::math::vec2<FLOAT>;
|
||||||
|
using vec3 = filament::math::vec3<FLOAT>;
|
||||||
|
using vec4 = filament::math::vec4<FLOAT>;
|
||||||
|
using Bookmark = filament::camutils::Bookmark<FLOAT>;
|
||||||
|
using Base = Manipulator<FLOAT>;
|
||||||
|
using Config = typename Base::Config;
|
||||||
|
|
||||||
|
FreeFlightManipulator(Mode mode, const Config& props) : Base(mode, props) {
|
||||||
|
setProperties(props);
|
||||||
|
Base::mEye = Base::mProps.flightStartPosition;
|
||||||
|
const auto pitch = Base::mProps.flightStartPitch;
|
||||||
|
const auto yaw = Base::mProps.flightStartYaw;
|
||||||
|
mTargetEuler = {pitch, yaw};
|
||||||
|
updateTarget(pitch, yaw);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setProperties(const Config& props) override {
|
||||||
|
Config resolved = props;
|
||||||
|
|
||||||
|
if (resolved.flightPanSpeed == vec2(0, 0)) {
|
||||||
|
resolved.flightPanSpeed = vec2(0.01, 0.01);
|
||||||
|
}
|
||||||
|
if (resolved.flightMaxSpeed == 0.0) {
|
||||||
|
resolved.flightMaxSpeed = 10.0;
|
||||||
|
}
|
||||||
|
if (resolved.flightSpeedSteps == 0) {
|
||||||
|
resolved.flightSpeedSteps = 80;
|
||||||
|
}
|
||||||
|
|
||||||
|
Base::setProperties(resolved);
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateTarget(FLOAT pitch, FLOAT yaw) {
|
||||||
|
Base::mTarget = Base::mEye + (mat3::eulerZYX(0, yaw, pitch) * vec3(0.0, 0.0, -1.0));
|
||||||
|
}
|
||||||
|
|
||||||
|
void grabBegin(int x, int y, bool strafe) override {
|
||||||
|
mGrabWin = {x, y};
|
||||||
|
mGrabbing = true;
|
||||||
|
mGrabEuler = mTargetEuler;
|
||||||
|
}
|
||||||
|
|
||||||
|
void grabUpdate(int x, int y) override {
|
||||||
|
if (!mGrabbing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const vec2 del = mGrabWin - vec2{x, y};
|
||||||
|
|
||||||
|
const auto& grabPitch = mGrabEuler.x;
|
||||||
|
const auto& grabYaw = mGrabEuler.y;
|
||||||
|
auto& pitch = mTargetEuler.x;
|
||||||
|
auto& yaw = mTargetEuler.y;
|
||||||
|
|
||||||
|
constexpr double EPSILON = 0.001;
|
||||||
|
|
||||||
|
auto panSpeed = Base::mProps.flightPanSpeed;
|
||||||
|
constexpr FLOAT minPitch = (-F_PI_2 + EPSILON);
|
||||||
|
constexpr FLOAT maxPitch = ( F_PI_2 - EPSILON);
|
||||||
|
pitch = clamp(grabPitch + del.y * -panSpeed.y, minPitch, maxPitch);
|
||||||
|
yaw = fmod(grabYaw + del.x * panSpeed.x, 2.0 * F_PI);
|
||||||
|
|
||||||
|
updateTarget(pitch, yaw);
|
||||||
|
}
|
||||||
|
|
||||||
|
void grabEnd() override {
|
||||||
|
mGrabbing = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyDown(typename Base::Key key) override {
|
||||||
|
mKeyDown[(int) key] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyUp(typename Base::Key key) override {
|
||||||
|
mKeyDown[(int) key] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void scroll(int x, int y, FLOAT scrolldelta) override {
|
||||||
|
const FLOAT halfSpeedSteps = Base::mProps.flightSpeedSteps / 2;
|
||||||
|
mScrollWheel = clamp(mScrollWheel + scrolldelta, -halfSpeedSteps, halfSpeedSteps);
|
||||||
|
// Normalize the scroll position from -1 to 1 and calculate the move speed, in world
|
||||||
|
// units per second.
|
||||||
|
mScrollPositionNormalized = (mScrollWheel + halfSpeedSteps) / halfSpeedSteps - 1.0;
|
||||||
|
mMoveSpeed = pow(Base::mProps.flightMaxSpeed, mScrollPositionNormalized);
|
||||||
|
}
|
||||||
|
|
||||||
|
void update(FLOAT deltaTime) override {
|
||||||
|
vec3 forceLocal { 0.0, 0.0, 0.0 };
|
||||||
|
|
||||||
|
if (mKeyDown[(int) Base::Key::FORWARD]) {
|
||||||
|
forceLocal += vec3{ 0.0, 0.0, -1.0 };
|
||||||
|
}
|
||||||
|
if (mKeyDown[(int) Base::Key::LEFT]) {
|
||||||
|
forceLocal += vec3{ -1.0, 0.0, 0.0 };
|
||||||
|
}
|
||||||
|
if (mKeyDown[(int) Base::Key::BACKWARD]) {
|
||||||
|
forceLocal += vec3{ 0.0, 0.0, 1.0 };
|
||||||
|
}
|
||||||
|
if (mKeyDown[(int) Base::Key::RIGHT]) {
|
||||||
|
forceLocal += vec3{ 1.0, 0.0, 0.0 };
|
||||||
|
}
|
||||||
|
|
||||||
|
const mat4 orientation = mat4::lookAt(Base::mEye, Base::mTarget, Base::mProps.upVector);
|
||||||
|
vec3 forceWorld = (orientation * vec4{ forceLocal, 0.0f }).xyz;
|
||||||
|
|
||||||
|
if (mKeyDown[(int) Base::Key::UP]) {
|
||||||
|
forceWorld += vec3{ 0.0, 1.0, 0.0 };
|
||||||
|
}
|
||||||
|
if (mKeyDown[(int) Base::Key::DOWN]) {
|
||||||
|
forceWorld += vec3{ 0.0, -1.0, 0.0 };
|
||||||
|
}
|
||||||
|
|
||||||
|
forceWorld *= mMoveSpeed;
|
||||||
|
|
||||||
|
const auto dampingFactor = Base::mProps.flightMoveDamping;
|
||||||
|
if (dampingFactor == 0.0) {
|
||||||
|
// Without damping, we simply treat the force as our velocity.
|
||||||
|
mEyeVelocity = forceWorld;
|
||||||
|
} else {
|
||||||
|
// The dampingFactor acts as "friction", which acts upon the camera in the direction
|
||||||
|
// opposite its velocity.
|
||||||
|
// Force is also multiplied by the dampingFactor, to "make up" for the friction.
|
||||||
|
// This ensures that the max velocity still approaches mMoveSpeed;
|
||||||
|
vec3 velocityDelta = (forceWorld - mEyeVelocity) * dampingFactor;
|
||||||
|
mEyeVelocity += velocityDelta * deltaTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
const vec3 positionDelta = mEyeVelocity * deltaTime;
|
||||||
|
|
||||||
|
Base::mEye += positionDelta;
|
||||||
|
Base::mTarget += positionDelta;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bookmark getCurrentBookmark() const override {
|
||||||
|
Bookmark bookmark;
|
||||||
|
bookmark.flight.position = Base::mEye;
|
||||||
|
bookmark.flight.pitch = mTargetEuler.x;
|
||||||
|
bookmark.flight.yaw = mTargetEuler.y;
|
||||||
|
return bookmark;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bookmark getHomeBookmark() const override {
|
||||||
|
Bookmark bookmark;
|
||||||
|
bookmark.flight.position = Base::mProps.flightStartPosition;
|
||||||
|
bookmark.flight.pitch = Base::mProps.flightStartPitch;
|
||||||
|
bookmark.flight.yaw = Base::mProps.flightStartYaw;
|
||||||
|
return bookmark;
|
||||||
|
}
|
||||||
|
|
||||||
|
void jumpToBookmark(const Bookmark& bookmark) override {
|
||||||
|
Base::mEye = bookmark.flight.position;
|
||||||
|
updateTarget(bookmark.flight.pitch, bookmark.flight.yaw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
vec2 mGrabWin;
|
||||||
|
vec2 mTargetEuler; // (pitch, yaw)
|
||||||
|
vec2 mGrabEuler; // (pitch, yaw)
|
||||||
|
bool mKeyDown[(int) Base::Key::COUNT] = {false};
|
||||||
|
bool mGrabbing = false;
|
||||||
|
FLOAT mScrollWheel = 0.0f;
|
||||||
|
FLOAT mScrollPositionNormalized = 0.0f;
|
||||||
|
FLOAT mMoveSpeed = 1.0f;
|
||||||
|
vec3 mEyeVelocity;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace camutils
|
||||||
|
} // namespace filament
|
||||||
|
|
||||||
|
#endif /* CAMUTILS_FREEFLIGHT_MANIPULATOR_H */
|
||||||
324
ios/src/camutils/Manipulator.cpp
Normal file
324
ios/src/camutils/Manipulator.cpp
Normal file
@@ -0,0 +1,324 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <camutils/Manipulator.h>
|
||||||
|
|
||||||
|
#include <math/scalar.h>
|
||||||
|
|
||||||
|
#include "FreeFlightManipulator.h"
|
||||||
|
#include "MapManipulator.h"
|
||||||
|
#include "OrbitManipulator.h"
|
||||||
|
|
||||||
|
using namespace filament::math;
|
||||||
|
|
||||||
|
namespace filament {
|
||||||
|
namespace camutils {
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::viewport(int width, int height) {
|
||||||
|
details.viewport[0] = width;
|
||||||
|
details.viewport[1] = height;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::targetPosition(FLOAT x, FLOAT y, FLOAT z) {
|
||||||
|
details.targetPosition = {x, y, z};
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::upVector(FLOAT x, FLOAT y, FLOAT z) {
|
||||||
|
details.upVector = {x, y, z};
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::zoomSpeed(FLOAT val) {
|
||||||
|
details.zoomSpeed = val;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::orbitHomePosition(FLOAT x, FLOAT y, FLOAT z) {
|
||||||
|
details.orbitHomePosition = {x, y, z};
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::orbitSpeed(FLOAT x, FLOAT y) {
|
||||||
|
details.orbitSpeed = {x, y};
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::fovDirection(Fov fov) {
|
||||||
|
details.fovDirection = fov;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::fovDegrees(FLOAT degrees) {
|
||||||
|
details.fovDegrees = degrees;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::farPlane(FLOAT distance) {
|
||||||
|
details.farPlane = distance;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::mapExtent(FLOAT worldWidth, FLOAT worldHeight) {
|
||||||
|
details.mapExtent = {worldWidth, worldHeight};
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::mapMinDistance(FLOAT mindist) {
|
||||||
|
details.mapMinDistance = mindist;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::flightStartPosition(FLOAT x, FLOAT y, FLOAT z) {
|
||||||
|
details.flightStartPosition = {x, y, z};
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::flightStartOrientation(FLOAT pitch, FLOAT yaw) {
|
||||||
|
details.flightStartPitch = pitch;
|
||||||
|
details.flightStartYaw = yaw;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::flightMaxMoveSpeed(FLOAT maxSpeed) {
|
||||||
|
details.flightMaxSpeed = maxSpeed;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::flightSpeedSteps(int steps) {
|
||||||
|
details.flightSpeedSteps = steps;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::flightPanSpeed(FLOAT x, FLOAT y) {
|
||||||
|
details.flightPanSpeed = {x, y};
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::flightMoveDamping(FLOAT damping) {
|
||||||
|
details.flightMoveDamping = damping;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::groundPlane(FLOAT a, FLOAT b, FLOAT c, FLOAT d) {
|
||||||
|
details.groundPlane = {a, b, c, d};
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT> typename
|
||||||
|
Manipulator<FLOAT>::Builder& Manipulator<FLOAT>::Builder::raycastCallback(RayCallback cb, void* userdata) {
|
||||||
|
details.raycastCallback = cb;
|
||||||
|
details.raycastUserdata = userdata;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT>
|
||||||
|
Manipulator<FLOAT>* Manipulator<FLOAT>::Builder::build(Mode mode) {
|
||||||
|
switch (mode) {
|
||||||
|
case Mode::FREE_FLIGHT:
|
||||||
|
return new FreeFlightManipulator<FLOAT>(mode, details);
|
||||||
|
case Mode::MAP:
|
||||||
|
return new MapManipulator<FLOAT>(mode, details);
|
||||||
|
case Mode::ORBIT:
|
||||||
|
return new OrbitManipulator<FLOAT>(mode, details);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT>
|
||||||
|
Manipulator<FLOAT>::Manipulator(Mode mode, const Config& props) : mMode(mode) {
|
||||||
|
setProperties(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT>
|
||||||
|
void Manipulator<FLOAT>::setProperties(const Config& props) {
|
||||||
|
mProps = props;
|
||||||
|
|
||||||
|
if (mProps.zoomSpeed == FLOAT(0)) {
|
||||||
|
mProps.zoomSpeed = 0.01;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mProps.upVector == vec3(0)) {
|
||||||
|
mProps.upVector = vec3(0, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mProps.fovDegrees == FLOAT(0)) {
|
||||||
|
mProps.fovDegrees = 33;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mProps.farPlane == FLOAT(0)) {
|
||||||
|
mProps.farPlane = 5000;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mProps.mapExtent == vec2(0)) {
|
||||||
|
mProps.mapExtent = vec2(512);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT>
|
||||||
|
void Manipulator<FLOAT>::setViewport(int width, int height) {
|
||||||
|
Config props = mProps;
|
||||||
|
props.viewport[0] = width;
|
||||||
|
props.viewport[1] = height;
|
||||||
|
setProperties(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT>
|
||||||
|
void Manipulator<FLOAT>::getLookAt(vec3* eyePosition, vec3* targetPosition, vec3* upward) const {
|
||||||
|
*targetPosition = mTarget;
|
||||||
|
*eyePosition = mEye;
|
||||||
|
const vec3 gaze = normalize(mTarget - mEye);
|
||||||
|
const vec3 right = cross(gaze, mProps.upVector);
|
||||||
|
*upward = cross(right, gaze);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename FLOAT>
|
||||||
|
static bool raycastPlane(const filament::math::vec3<FLOAT>& origin,
|
||||||
|
const filament::math::vec3<FLOAT>& dir, FLOAT* t, void* userdata) {
|
||||||
|
using vec3 = filament::math::vec3<FLOAT>;
|
||||||
|
using vec4 = filament::math::vec4<FLOAT>;
|
||||||
|
auto props = (const typename Manipulator<FLOAT>::Config*) userdata;
|
||||||
|
const vec4 plane = props->groundPlane;
|
||||||
|
const vec3 n = vec3(plane[0], plane[1], plane[2]);
|
||||||
|
const vec3 p0 = n * plane[3];
|
||||||
|
const FLOAT denom = -dot(n, dir);
|
||||||
|
if (denom > 1e-6) {
|
||||||
|
const vec3 p0l0 = p0 - origin;
|
||||||
|
*t = dot(p0l0, n) / -denom;
|
||||||
|
return *t >= 0;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT>
|
||||||
|
void Manipulator<FLOAT>::getRay(int x, int y, vec3* porigin, vec3* pdir) const {
|
||||||
|
const vec3 gaze = normalize(mTarget - mEye);
|
||||||
|
const vec3 right = normalize(cross(gaze, mProps.upVector));
|
||||||
|
const vec3 upward = cross(right, gaze);
|
||||||
|
const FLOAT width = mProps.viewport[0];
|
||||||
|
const FLOAT height = mProps.viewport[1];
|
||||||
|
const FLOAT fov = mProps.fovDegrees * F_PI / 180.0;
|
||||||
|
|
||||||
|
// Remap the grid coordinate into [-1, +1] and shift it to the pixel center.
|
||||||
|
const FLOAT u = 2.0 * (0.5 + x) / width - 1.0;
|
||||||
|
const FLOAT v = 2.0 * (0.5 + y) / height - 1.0;
|
||||||
|
|
||||||
|
// Compute the tangent of the field-of-view angle as well as the aspect ratio.
|
||||||
|
const FLOAT tangent = tan(fov / 2.0);
|
||||||
|
const FLOAT aspect = width / height;
|
||||||
|
|
||||||
|
// Adjust the gaze so it goes through the pixel of interest rather than the grid center.
|
||||||
|
vec3 dir = gaze;
|
||||||
|
if (mProps.fovDirection == Fov::VERTICAL) {
|
||||||
|
dir += right * tangent * u * aspect;
|
||||||
|
dir += upward * tangent * v;
|
||||||
|
} else {
|
||||||
|
dir += right * tangent * u;
|
||||||
|
dir += upward * tangent * v / aspect;
|
||||||
|
}
|
||||||
|
dir = normalize(dir);
|
||||||
|
|
||||||
|
*porigin = mEye;
|
||||||
|
*pdir = dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT>
|
||||||
|
bool Manipulator<FLOAT>::raycast(int x, int y, vec3* result) const {
|
||||||
|
vec3 origin, dir;
|
||||||
|
getRay(x, y, &origin, &dir);
|
||||||
|
|
||||||
|
// Choose either the user's callback function or the plane intersector.
|
||||||
|
auto callback = mProps.raycastCallback;
|
||||||
|
auto fallback = raycastPlane<FLOAT>;
|
||||||
|
void* userdata = mProps.raycastUserdata;
|
||||||
|
if (!callback) {
|
||||||
|
callback = fallback;
|
||||||
|
userdata = (void*) &mProps;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the ray misses, then try the fallback function.
|
||||||
|
FLOAT t;
|
||||||
|
if (!callback(mEye, dir, &t, userdata)) {
|
||||||
|
if (callback == fallback || !fallback(mEye, dir, &t, (void*) &mProps)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*result = mEye + dir * t;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT>
|
||||||
|
filament::math::vec3<FLOAT> Manipulator<FLOAT>::raycastFarPlane(int x, int y) const {
|
||||||
|
const filament::math::vec3<FLOAT> gaze = normalize(mTarget - mEye);
|
||||||
|
const vec3 right = cross(gaze, mProps.upVector);
|
||||||
|
const vec3 upward = cross(right, gaze);
|
||||||
|
const FLOAT width = mProps.viewport[0];
|
||||||
|
const FLOAT height = mProps.viewport[1];
|
||||||
|
const FLOAT fov = mProps.fovDegrees * math::F_PI / 180.0;
|
||||||
|
|
||||||
|
// Remap the grid coordinate into [-1, +1] and shift it to the pixel center.
|
||||||
|
const FLOAT u = 2.0 * (0.5 + x) / width - 1.0;
|
||||||
|
const FLOAT v = 2.0 * (0.5 + y) / height - 1.0;
|
||||||
|
|
||||||
|
// Compute the tangent of the field-of-view angle as well as the aspect ratio.
|
||||||
|
const FLOAT tangent = tan(fov / 2.0);
|
||||||
|
const FLOAT aspect = width / height;
|
||||||
|
|
||||||
|
// Adjust the gaze so it goes through the pixel of interest rather than the grid center.
|
||||||
|
vec3 dir = gaze;
|
||||||
|
if (mProps.fovDirection == Fov::VERTICAL) {
|
||||||
|
dir += right * tangent * u * aspect;
|
||||||
|
dir += upward * tangent * v;
|
||||||
|
} else {
|
||||||
|
dir += right * tangent * u;
|
||||||
|
dir += upward * tangent * v / aspect;
|
||||||
|
}
|
||||||
|
return mEye + dir * mProps.farPlane;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FLOAT>
|
||||||
|
void Manipulator<FLOAT>::keyDown(Manipulator<FLOAT>::Key key) { }
|
||||||
|
|
||||||
|
template <typename FLOAT>
|
||||||
|
void Manipulator<FLOAT>::keyUp(Manipulator<FLOAT>::Key key) { }
|
||||||
|
|
||||||
|
template <typename FLOAT>
|
||||||
|
void Manipulator<FLOAT>::update(FLOAT deltaTime) { }
|
||||||
|
|
||||||
|
template class Manipulator<float>;
|
||||||
|
template class Manipulator<double>;
|
||||||
|
|
||||||
|
} // namespace camutils
|
||||||
|
} // namespace filament
|
||||||
197
ios/src/camutils/MapManipulator.h
Normal file
197
ios/src/camutils/MapManipulator.h
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CAMUTILS_MAP_MANIPULATOR_H
|
||||||
|
#define CAMUTILS_MAP_MANIPULATOR_H
|
||||||
|
|
||||||
|
#include <camutils/Manipulator.h>
|
||||||
|
|
||||||
|
#include <math/vec3.h>
|
||||||
|
|
||||||
|
namespace filament {
|
||||||
|
namespace camutils {
|
||||||
|
|
||||||
|
template<typename FLOAT>
|
||||||
|
class MapManipulator : public Manipulator<FLOAT> {
|
||||||
|
public:
|
||||||
|
using vec2 = math::vec2<FLOAT>;
|
||||||
|
using vec3 = math::vec3<FLOAT>;
|
||||||
|
using vec4 = math::vec4<FLOAT>;
|
||||||
|
using Bookmark = filament::camutils::Bookmark<FLOAT>;
|
||||||
|
using Base = Manipulator<FLOAT>;
|
||||||
|
using Config = typename Manipulator<FLOAT>::Config;
|
||||||
|
|
||||||
|
MapManipulator(Mode mode, const Config& props) : Manipulator<FLOAT>(mode, props) {
|
||||||
|
const FLOAT width = Base::mProps.mapExtent.x;
|
||||||
|
const FLOAT height = Base::mProps.mapExtent.y;
|
||||||
|
const bool horiz = Base::mProps.fovDirection == Fov::HORIZONTAL;
|
||||||
|
const vec3 targetToEye = Base::mProps.groundPlane.xyz;
|
||||||
|
const FLOAT halfExtent = (horiz ? width : height) / 2.0;
|
||||||
|
const FLOAT fov = Base::mProps.fovDegrees * math::F_PI / 180.0;
|
||||||
|
const FLOAT distance = halfExtent / tan(fov / 2.0);
|
||||||
|
Base::mTarget = Base::mProps.targetPosition;
|
||||||
|
Base::mEye = Base::mTarget + distance * targetToEye;
|
||||||
|
}
|
||||||
|
|
||||||
|
void grabBegin(int x, int y, bool strafe) override {
|
||||||
|
if (strafe || !Base::raycast(x, y, &mGrabScene)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mGrabFar = Base::raycastFarPlane(x, y);
|
||||||
|
mGrabEye = Base::mEye;
|
||||||
|
mGrabTarget = Base::mTarget;
|
||||||
|
mGrabbing = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void grabUpdate(int x, int y) override {
|
||||||
|
if (mGrabbing) {
|
||||||
|
const FLOAT ulen = distance(mGrabScene, mGrabEye);
|
||||||
|
const FLOAT vlen = distance(mGrabFar, mGrabScene);
|
||||||
|
const vec3 translation = (mGrabFar - Base::raycastFarPlane(x, y)) * ulen / vlen;
|
||||||
|
const vec3 eyePosition = mGrabEye + translation;
|
||||||
|
const vec3 targetPosition = mGrabTarget + translation;
|
||||||
|
moveWithConstraints(eyePosition, targetPosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void grabEnd() override {
|
||||||
|
mGrabbing = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void scroll(int x, int y, FLOAT scrolldelta) override {
|
||||||
|
vec3 grabScene;
|
||||||
|
if (!Base::raycast(x, y, &grabScene)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the direction of travel for the dolly. We do not normalize since it
|
||||||
|
// is desirable to move faster when further away from the targetPosition.
|
||||||
|
vec3 u = grabScene - Base::mEye;
|
||||||
|
|
||||||
|
// Prevent getting stuck when zooming in.
|
||||||
|
if (scrolldelta < 0) {
|
||||||
|
const FLOAT distanceToSurface = length(u);
|
||||||
|
if (distanceToSurface < Base::mProps.zoomSpeed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
u *= -scrolldelta * Base::mProps.zoomSpeed;
|
||||||
|
|
||||||
|
const vec3 eyePosition = Base::mEye + u;
|
||||||
|
const vec3 targetPosition = Base::mTarget + u;
|
||||||
|
moveWithConstraints(eyePosition, targetPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bookmark getCurrentBookmark() const override {
|
||||||
|
const vec3 dir = normalize(Base::mTarget - Base::mEye);
|
||||||
|
|
||||||
|
FLOAT distance;
|
||||||
|
raycastPlane(Base::mEye, dir, &distance);
|
||||||
|
|
||||||
|
const FLOAT fov = Base::mProps.fovDegrees * math::F_PI / 180.0;
|
||||||
|
const FLOAT halfExtent = distance * tan(fov / 2.0);
|
||||||
|
|
||||||
|
vec3 targetPosition = Base::mEye + dir * distance;
|
||||||
|
|
||||||
|
const vec3 targetToEye = Base::mProps.groundPlane.xyz;
|
||||||
|
const vec3 uvec = cross(Base::mProps.upVector, targetToEye);
|
||||||
|
const vec3 vvec = cross(targetToEye, uvec);
|
||||||
|
const vec3 centerToTarget = targetPosition - Base::mProps.targetPosition;
|
||||||
|
|
||||||
|
Bookmark bookmark;
|
||||||
|
bookmark.mode = Mode::MAP;
|
||||||
|
bookmark.map.extent = halfExtent * 2.0;
|
||||||
|
bookmark.map.center.x = dot(uvec, centerToTarget);
|
||||||
|
bookmark.map.center.y = dot(vvec, centerToTarget);
|
||||||
|
|
||||||
|
bookmark.orbit.theta = 0;
|
||||||
|
bookmark.orbit.phi = 0;
|
||||||
|
bookmark.orbit.pivot = Base::mProps.targetPosition +
|
||||||
|
uvec * bookmark.map.center.x +
|
||||||
|
vvec * bookmark.map.center.y;
|
||||||
|
bookmark.orbit.distance = halfExtent / tan(fov / 2.0);
|
||||||
|
|
||||||
|
return bookmark;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bookmark getHomeBookmark() const override {
|
||||||
|
const FLOAT fov = Base::mProps.fovDegrees * math::F_PI / 180.0;
|
||||||
|
const FLOAT width = Base::mProps.mapExtent.x;
|
||||||
|
const FLOAT height = Base::mProps.mapExtent.y;
|
||||||
|
const bool horiz = Base::mProps.fovDirection == Fov::HORIZONTAL;
|
||||||
|
|
||||||
|
Bookmark bookmark;
|
||||||
|
bookmark.mode = Mode::MAP;
|
||||||
|
bookmark.map.extent = horiz ? width : height;
|
||||||
|
bookmark.map.center.x = 0;
|
||||||
|
bookmark.map.center.y = 0;
|
||||||
|
|
||||||
|
bookmark.orbit.theta = 0;
|
||||||
|
bookmark.orbit.phi = 0;
|
||||||
|
bookmark.orbit.pivot = Base::mTarget;
|
||||||
|
bookmark.orbit.distance = 0.5 * bookmark.map.extent / tan(fov / 2.0);
|
||||||
|
|
||||||
|
// TODO: Add optional boundary constraints here.
|
||||||
|
|
||||||
|
return bookmark;
|
||||||
|
}
|
||||||
|
|
||||||
|
void jumpToBookmark(const Bookmark& bookmark) override {
|
||||||
|
const vec3 targetToEye = Base::mProps.groundPlane.xyz;
|
||||||
|
const FLOAT halfExtent = bookmark.map.extent / 2.0;
|
||||||
|
const FLOAT fov = Base::mProps.fovDegrees * math::F_PI / 180.0;
|
||||||
|
const FLOAT distance = halfExtent / tan(fov / 2.0);
|
||||||
|
vec3 uvec = cross(Base::mProps.upVector, targetToEye);
|
||||||
|
vec3 vvec = cross(targetToEye, uvec);
|
||||||
|
uvec = normalize(uvec) * bookmark.map.center.x;
|
||||||
|
vvec = normalize(vvec) * bookmark.map.center.y;
|
||||||
|
Base::mTarget = Base::mProps.targetPosition + uvec + vvec;
|
||||||
|
Base::mEye = Base::mTarget + distance * targetToEye;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool raycastPlane(const vec3& origin, const vec3& dir, FLOAT* t) const {
|
||||||
|
const vec4 plane = Base::mProps.groundPlane;
|
||||||
|
const vec3 n = vec3(plane[0], plane[1], plane[2]);
|
||||||
|
const vec3 p0 = n * plane[3];
|
||||||
|
const FLOAT denom = -dot(n, dir);
|
||||||
|
if (denom > 1e-6) {
|
||||||
|
const vec3 p0l0 = p0 - origin;
|
||||||
|
*t = dot(p0l0, n) / -denom;
|
||||||
|
return *t >= 0;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void moveWithConstraints(vec3 eye, vec3 targetPosition) {
|
||||||
|
Base::mEye = eye;
|
||||||
|
Base::mTarget = targetPosition;
|
||||||
|
// TODO: Add optional boundary constraints here.
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool mGrabbing = false;
|
||||||
|
vec3 mGrabScene;
|
||||||
|
vec3 mGrabFar;
|
||||||
|
vec3 mGrabEye;
|
||||||
|
vec3 mGrabTarget;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace camutils
|
||||||
|
} // namespace filament
|
||||||
|
|
||||||
|
#endif /* CAMUTILS_MAP_MANIPULATOR_H */
|
||||||
201
ios/src/camutils/OrbitManipulator.h
Normal file
201
ios/src/camutils/OrbitManipulator.h
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CAMUTILS_ORBIT_MANIPULATOR_H
|
||||||
|
#define CAMUTILS_ORBIT_MANIPULATOR_H
|
||||||
|
|
||||||
|
#include <camutils/Manipulator.h>
|
||||||
|
|
||||||
|
#include <math/scalar.h>
|
||||||
|
|
||||||
|
#define MAX_PHI (F_PI / 2.0 - 0.001)
|
||||||
|
|
||||||
|
namespace filament {
|
||||||
|
namespace camutils {
|
||||||
|
|
||||||
|
using namespace filament::math;
|
||||||
|
|
||||||
|
template<typename FLOAT>
|
||||||
|
class OrbitManipulator : public Manipulator<FLOAT> {
|
||||||
|
public:
|
||||||
|
using vec2 = filament::math::vec2<FLOAT>;
|
||||||
|
using vec3 = filament::math::vec3<FLOAT>;
|
||||||
|
using vec4 = filament::math::vec4<FLOAT>;
|
||||||
|
using Bookmark = filament::camutils::Bookmark<FLOAT>;
|
||||||
|
using Base = Manipulator<FLOAT>;
|
||||||
|
using Config = typename Base::Config;
|
||||||
|
|
||||||
|
enum GrabState { INACTIVE, ORBITING, PANNING };
|
||||||
|
|
||||||
|
OrbitManipulator(Mode mode, const Config& props) : Base(mode, props) {
|
||||||
|
setProperties(props);
|
||||||
|
Base::mEye = Base::mProps.orbitHomePosition;
|
||||||
|
mPivot = Base::mTarget = Base::mProps.targetPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setProperties(const Config& props) override {
|
||||||
|
Config resolved = props;
|
||||||
|
|
||||||
|
if (resolved.orbitHomePosition == vec3(0)) {
|
||||||
|
resolved.orbitHomePosition = vec3(0, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resolved.orbitSpeed == vec2(0)) {
|
||||||
|
resolved.orbitSpeed = vec2(0.01);
|
||||||
|
}
|
||||||
|
|
||||||
|
// By default, place the ground plane so that it aligns with the targetPosition position.
|
||||||
|
// This is used only when PANNING.
|
||||||
|
if (resolved.groundPlane == vec4(0)) {
|
||||||
|
const FLOAT d = length(resolved.targetPosition);
|
||||||
|
const vec3 n = normalize(resolved.orbitHomePosition - resolved.targetPosition);
|
||||||
|
resolved.groundPlane = vec4(n, -d);
|
||||||
|
}
|
||||||
|
|
||||||
|
Base::setProperties(resolved);
|
||||||
|
}
|
||||||
|
|
||||||
|
void grabBegin(int x, int y, bool strafe) override {
|
||||||
|
mGrabState = strafe ? PANNING : ORBITING;
|
||||||
|
mGrabPivot = mPivot;
|
||||||
|
mGrabEye = Base::mEye;
|
||||||
|
mGrabTarget = Base::mTarget;
|
||||||
|
mGrabBookmark = getCurrentBookmark();
|
||||||
|
mGrabWinX = x;
|
||||||
|
mGrabWinY = y;
|
||||||
|
mGrabFar = Base::raycastFarPlane(x, y);
|
||||||
|
Base::raycast(x, y, &mGrabScene);
|
||||||
|
}
|
||||||
|
|
||||||
|
void grabUpdate(int x, int y) override {
|
||||||
|
const int delx = mGrabWinX - x;
|
||||||
|
const int dely = mGrabWinY - y;
|
||||||
|
|
||||||
|
if (mGrabState == ORBITING) {
|
||||||
|
Bookmark bookmark = getCurrentBookmark();
|
||||||
|
|
||||||
|
const FLOAT theta = delx * Base::mProps.orbitSpeed.x;
|
||||||
|
const FLOAT phi = dely * Base::mProps.orbitSpeed.y;
|
||||||
|
const FLOAT maxPhi = MAX_PHI;
|
||||||
|
|
||||||
|
bookmark.orbit.phi = clamp(mGrabBookmark.orbit.phi + phi, -maxPhi, +maxPhi);
|
||||||
|
bookmark.orbit.theta = mGrabBookmark.orbit.theta + theta;
|
||||||
|
|
||||||
|
jumpToBookmark(bookmark);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mGrabState == PANNING) {
|
||||||
|
const FLOAT ulen = distance(mGrabScene, mGrabEye);
|
||||||
|
const FLOAT vlen = distance(mGrabFar, mGrabScene);
|
||||||
|
const vec3 translation = (mGrabFar - Base::raycastFarPlane(x, y)) * ulen / vlen;
|
||||||
|
mPivot = mGrabPivot + translation;
|
||||||
|
Base::mEye = mGrabEye + translation;
|
||||||
|
Base::mTarget = mGrabTarget + translation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void grabEnd() override {
|
||||||
|
mGrabState = INACTIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void scroll(int x, int y, FLOAT scrolldelta) override {
|
||||||
|
const vec3 gaze = normalize(Base::mTarget - Base::mEye);
|
||||||
|
const vec3 movement = gaze * Base::mProps.zoomSpeed * -scrolldelta;
|
||||||
|
const vec3 v0 = mPivot - Base::mEye;
|
||||||
|
Base::mEye += movement;
|
||||||
|
Base::mTarget += movement;
|
||||||
|
const vec3 v1 = mPivot - Base::mEye;
|
||||||
|
|
||||||
|
// Check if the camera has moved past the point of interest.
|
||||||
|
if (dot(v0, v1) < 0) {
|
||||||
|
mFlipped = !mFlipped;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Bookmark getCurrentBookmark() const override {
|
||||||
|
Bookmark bookmark;
|
||||||
|
bookmark.mode = Mode::ORBIT;
|
||||||
|
const vec3 pivotToEye = Base::mEye - mPivot;
|
||||||
|
const FLOAT d = length(pivotToEye);
|
||||||
|
const FLOAT x = pivotToEye.x / d;
|
||||||
|
const FLOAT y = pivotToEye.y / d;
|
||||||
|
const FLOAT z = pivotToEye.z / d;
|
||||||
|
|
||||||
|
bookmark.orbit.phi = asin(y);
|
||||||
|
bookmark.orbit.theta = atan2(x, z);
|
||||||
|
bookmark.orbit.distance = mFlipped ? -d : d;
|
||||||
|
bookmark.orbit.pivot = mPivot;
|
||||||
|
|
||||||
|
const FLOAT fov = Base::mProps.fovDegrees * math::F_PI / 180.0;
|
||||||
|
const FLOAT halfExtent = d * tan(fov / 2.0);
|
||||||
|
const vec3 targetToEye = Base::mProps.groundPlane.xyz;
|
||||||
|
const vec3 uvec = cross(Base::mProps.upVector, targetToEye);
|
||||||
|
const vec3 vvec = cross(targetToEye, uvec);
|
||||||
|
const vec3 centerToTarget = mPivot - Base::mProps.targetPosition;
|
||||||
|
|
||||||
|
bookmark.map.extent = halfExtent * 2;
|
||||||
|
bookmark.map.center.x = dot(uvec, centerToTarget);
|
||||||
|
bookmark.map.center.y = dot(vvec, centerToTarget);
|
||||||
|
|
||||||
|
return bookmark;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bookmark getHomeBookmark() const override {
|
||||||
|
Bookmark bookmark;
|
||||||
|
bookmark.mode = Mode::ORBIT;
|
||||||
|
bookmark.orbit.phi = FLOAT(0);
|
||||||
|
bookmark.orbit.theta = FLOAT(0);
|
||||||
|
bookmark.orbit.pivot = Base::mProps.targetPosition;
|
||||||
|
bookmark.orbit.distance = distance(Base::mProps.targetPosition, Base::mProps.orbitHomePosition);
|
||||||
|
|
||||||
|
const FLOAT fov = Base::mProps.fovDegrees * math::F_PI / 180.0;
|
||||||
|
const FLOAT halfExtent = bookmark.orbit.distance * tan(fov / 2.0);
|
||||||
|
|
||||||
|
bookmark.map.extent = halfExtent * 2;
|
||||||
|
bookmark.map.center.x = 0;
|
||||||
|
bookmark.map.center.y = 0;
|
||||||
|
|
||||||
|
return bookmark;
|
||||||
|
}
|
||||||
|
|
||||||
|
void jumpToBookmark(const Bookmark& bookmark) override {
|
||||||
|
mPivot = bookmark.orbit.pivot;
|
||||||
|
const FLOAT x = sin(bookmark.orbit.theta) * cos(bookmark.orbit.phi);
|
||||||
|
const FLOAT y = sin(bookmark.orbit.phi);
|
||||||
|
const FLOAT z = cos(bookmark.orbit.theta) * cos(bookmark.orbit.phi);
|
||||||
|
Base::mEye = mPivot + vec3(x, y, z) * abs(bookmark.orbit.distance);
|
||||||
|
mFlipped = bookmark.orbit.distance < 0;
|
||||||
|
Base::mTarget = Base::mEye + vec3(x, y, z) * (mFlipped ? 1.0 : -1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
GrabState mGrabState = INACTIVE;
|
||||||
|
bool mFlipped = false;
|
||||||
|
vec3 mGrabPivot;
|
||||||
|
vec3 mGrabScene;
|
||||||
|
vec3 mGrabFar;
|
||||||
|
vec3 mGrabEye;
|
||||||
|
vec3 mGrabTarget;
|
||||||
|
Bookmark mGrabBookmark;
|
||||||
|
int mGrabWinX;
|
||||||
|
int mGrabWinY;
|
||||||
|
vec3 mPivot;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace camutils
|
||||||
|
} // namespace filament
|
||||||
|
|
||||||
|
#endif /* CAMUTILS_ORBIT_MANIPULATOR_H */
|
||||||
@@ -1,159 +0,0 @@
|
|||||||
// import 'dart:async';
|
|
||||||
|
|
||||||
// import 'package:flutter/gestures.dart';
|
|
||||||
// import 'package:flutter/material.dart';
|
|
||||||
// import 'filament_controller.dart';
|
|
||||||
// import 'filament_widget.dart';
|
|
||||||
|
|
||||||
// enum GestureType { RotateCamera, PanCamera, PanBackground }
|
|
||||||
|
|
||||||
// class AvatarGestureDetector extends StatefulWidget {
|
|
||||||
// final AvatarInstance controller;
|
|
||||||
// final bool showControls;
|
|
||||||
|
|
||||||
// const AvatarGestureDetector({
|
|
||||||
// Key? key,
|
|
||||||
// required this.controller,
|
|
||||||
// this.showControls = false,
|
|
||||||
// }) : super(key: key);
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// State<StatefulWidget> createState() => _AvatarGestureDetectorState();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// class _AvatarGestureDetectorState extends State<AvatarGestureDetector> {
|
|
||||||
// GestureType gestureType = GestureType.PanCamera;
|
|
||||||
|
|
||||||
// final _icons = {
|
|
||||||
// GestureType.PanBackground: Icons.image,
|
|
||||||
// GestureType.PanCamera: Icons.pan_tool,
|
|
||||||
// GestureType.RotateCamera: Icons.rotate_90_degrees_ccw
|
|
||||||
// };
|
|
||||||
|
|
||||||
// // to avoid duplicating code for pan/rotate (panStart, panUpdate, panEnd, rotateStart, rotateUpdate etc)
|
|
||||||
// // we have only a single function for start/update/end.
|
|
||||||
// // when the gesture type is changed, these properties are updated to point to the correct function.
|
|
||||||
// late Future Function(double x, double y) _functionStart;
|
|
||||||
// late Future Function(double x, double y) _functionUpdate;
|
|
||||||
// late Future Function() _functionEnd;
|
|
||||||
|
|
||||||
// double _lastScale = 0;
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// void initState() {
|
|
||||||
// _setFunction();
|
|
||||||
// super.initState();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void _setFunction() {
|
|
||||||
// switch (gestureType) {
|
|
||||||
// case GestureType.RotateCamera:
|
|
||||||
// _functionStart = widget.controller.rotateStart;
|
|
||||||
// _functionUpdate = widget.controller.rotateUpdate;
|
|
||||||
// _functionEnd = widget.controller.rotateEnd;
|
|
||||||
// break;
|
|
||||||
// case GestureType.PanCamera:
|
|
||||||
// _functionStart = widget.controller.panStart;
|
|
||||||
// _functionUpdate = widget.controller.panUpdate;
|
|
||||||
// _functionEnd = widget.controller.panEnd;
|
|
||||||
// break;
|
|
||||||
// // TODO
|
|
||||||
// case GestureType.PanBackground:
|
|
||||||
// _functionStart = (x, y) async {};
|
|
||||||
// _functionUpdate = (x, y) async {};
|
|
||||||
// _functionEnd = () async {};
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// void didUpdateWidget(AvatarGestureDetector oldWidget) {
|
|
||||||
// if (widget.showControls != oldWidget.showControls) {
|
|
||||||
// setState(() {});
|
|
||||||
// }
|
|
||||||
|
|
||||||
// super.didUpdateWidget(oldWidget);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Timer? _scrollTimer;
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return Stack(children: [
|
|
||||||
// Positioned.fill(
|
|
||||||
// // pinch zoom on mobile
|
|
||||||
// // couldn't find any equivalent for pointerCount in Listener so we use two widgets:
|
|
||||||
// // - outer is a GestureDetector only for pinch zoom
|
|
||||||
// // - inner is a Listener for all other gestures
|
|
||||||
// child: GestureDetector(
|
|
||||||
// // onScaleStart: (d) async {
|
|
||||||
// // if (d.pointerCount == 2) {
|
|
||||||
// // await widget.controller.zoomEnd();
|
|
||||||
// // await widget.controller.zoomBegin();
|
|
||||||
// // }
|
|
||||||
// // },
|
|
||||||
// // onScaleEnd: (d) async {
|
|
||||||
// // if (d.pointerCount == 2) {
|
|
||||||
// // _lastScale = 0;
|
|
||||||
// // await widget.controller.zoomEnd();
|
|
||||||
// // }
|
|
||||||
// // },
|
|
||||||
// // onScaleUpdate: (d) async {
|
|
||||||
// // if (d.pointerCount == 2) {
|
|
||||||
// // if (_lastScale != 0) {
|
|
||||||
// // await widget.controller
|
|
||||||
// // .zoomUpdate(100 * (_lastScale - d.scale));
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
// // _lastScale = d.scale;
|
|
||||||
// // },
|
|
||||||
// child: Listener(
|
|
||||||
// onPointerSignal: (pointerSignal) async {
|
|
||||||
// // scroll-wheel zoom on desktop
|
|
||||||
// if (pointerSignal is PointerScrollEvent) {
|
|
||||||
// _scrollTimer?.cancel();
|
|
||||||
// await widget.controller.zoomBegin();
|
|
||||||
// await widget.controller.zoomUpdate(
|
|
||||||
// pointerSignal.scrollDelta.dy > 0 ? 10 : -10);
|
|
||||||
// _scrollTimer = Timer(Duration(milliseconds: 100), () {
|
|
||||||
// widget.controller.zoomEnd();
|
|
||||||
// _scrollTimer = null;
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// print(pointerSignal);
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// onPointerPanZoomStart: (pzs) {},
|
|
||||||
// onPointerDown: (d) async {
|
|
||||||
// await _functionStart(
|
|
||||||
// d.localPosition.dx, d.localPosition.dy);
|
|
||||||
// },
|
|
||||||
// onPointerMove: (d) async {
|
|
||||||
// await _functionUpdate(
|
|
||||||
// d.localPosition.dx, d.localPosition.dy);
|
|
||||||
// },
|
|
||||||
// onPointerUp: (d) async {
|
|
||||||
// await _functionEnd();
|
|
||||||
// },
|
|
||||||
// child: widget.child))),
|
|
||||||
// widget.showControls
|
|
||||||
// ? Align(
|
|
||||||
// alignment: Alignment.bottomRight,
|
|
||||||
// child: GestureDetector(
|
|
||||||
// onTap: () {
|
|
||||||
// setState(() {
|
|
||||||
// var curIdx = GestureType.values.indexOf(gestureType);
|
|
||||||
// var nextIdx = curIdx == GestureType.values.length - 1
|
|
||||||
// ? 0
|
|
||||||
// : curIdx + 1;
|
|
||||||
// gestureType = GestureType.values[nextIdx];
|
|
||||||
// _setFunction();
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// child: Container(
|
|
||||||
// padding: const EdgeInsets.all(50),
|
|
||||||
// child: Icon(_icons[gestureType], color: Colors.green)),
|
|
||||||
// ))
|
|
||||||
// : Container()
|
|
||||||
// ]);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
@@ -1,62 +1,163 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:ffi';
|
|
||||||
import 'dart:io';
|
|
||||||
import 'dart:ui' as ui;
|
import 'dart:ui' as ui;
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:polyvox_filament/animations/bone_animation_data.dart';
|
import 'package:polyvox_filament/animations/bone_animation_data.dart';
|
||||||
import 'package:polyvox_filament/animations/morph_animation_data.dart';
|
import 'package:polyvox_filament/animations/morph_animation_data.dart';
|
||||||
import 'package:polyvox_filament/generated_bindings.dart';
|
|
||||||
|
|
||||||
typedef FilamentEntity = int;
|
typedef FilamentEntity = int;
|
||||||
const FilamentEntity FILAMENT_ASSET_ERROR = 0;
|
|
||||||
|
|
||||||
enum ToneMapper { ACES, FILMIC, LINEAR }
|
enum ToneMapper { ACES, FILMIC, LINEAR }
|
||||||
|
|
||||||
abstract class FilamentController {
|
class TextureDetails {
|
||||||
// the current target size of the viewport, in logical pixels
|
final int textureId;
|
||||||
ui.Size size = ui.Size.zero;
|
final int width;
|
||||||
|
final int height;
|
||||||
|
|
||||||
Stream<int?> get textureId;
|
TextureDetails(
|
||||||
Future get isReadyForScene;
|
{required this.textureId, required this.width, required this.height});
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class FilamentController {
|
||||||
|
///
|
||||||
|
/// 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.
|
||||||
|
///
|
||||||
|
TextureDetails? get textureDetails;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// A stream to indicate whether a FilamentViewer is available.
|
||||||
|
/// [FilamentWidget] will (asynchronously) create a [FilamentViewer] after being inserted into the widget hierarchy;
|
||||||
|
/// listen to this stream beforehand to perform any work necessary once the viewer is available.
|
||||||
|
/// [FilamentWidget] may also destroy/recreate the viewer on certain lifecycle events (e.g. backgrounding a mobile app);
|
||||||
|
/// listen for any corresponding [false]/[true] events to perform related work.
|
||||||
|
/// Note this is not a broadcast stream; only one listener can be registered and events will be buffered.
|
||||||
|
///
|
||||||
|
Stream<bool> get hasViewer;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// 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].
|
||||||
|
/// If [pick] is called without an active subscription to this stream, the results will be silently discarded.
|
||||||
|
///
|
||||||
|
Stream<FilamentEntity?> get pickResult;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Whether the controller is currently rendering at [framerate].
|
||||||
|
///
|
||||||
|
bool get rendering;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Set to true to continuously render the scene at the framerate specified by [setFrameRate] (60 fps by default).
|
||||||
|
///
|
||||||
Future setRendering(bool render);
|
Future setRendering(bool render);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Render a single frame.
|
||||||
|
///
|
||||||
Future render();
|
Future render();
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Sets the framerate for continuous rendering when [setRendering] is enabled.
|
||||||
|
///
|
||||||
Future setFrameRate(int framerate);
|
Future setFrameRate(int framerate);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Called by FilamentGestureDetector to set the pixel ratio (obtained from [MediaQuery]) before creating the texture/viewport.
|
||||||
|
/// You may call this yourself if you want to increase/decrease the pixel density of the viewport, but calling this method won't do anything on its own.
|
||||||
|
/// You will need to manually recreate the texture/viewer afterwards.
|
||||||
|
///
|
||||||
void setPixelRatio(double ratio);
|
void setPixelRatio(double ratio);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// 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
|
||||||
|
///
|
||||||
|
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();
|
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();
|
Future destroyTexture();
|
||||||
|
|
||||||
///
|
///
|
||||||
/// You can insert a Filament viewport into the Flutter rendering hierarchy as follows:
|
/// Called by [FilamentWidget]; you generally will not need to call this yourself.
|
||||||
|
/// To recap, you can create a viewport is created in the Flutter rendering hierarchy by:
|
||||||
/// 1) Create a FilamentController
|
/// 1) Create a FilamentController
|
||||||
/// 2) Insert a FilamentWidget into the rendering tree, passing this instance of FilamentController
|
/// 2) Insert a FilamentWidget into the rendering tree, passing your FilamentController
|
||||||
/// 3) Initially, the FilamentWidget will only contain an empty Container (by default, with a solid red background).
|
/// 3) Initially, the FilamentWidget will only contain an empty Container (by default, with a solid red background).
|
||||||
/// This widget will render a single frame to get its actual size, then will itself call [createViewer]. You do not need to call [createViewer] yourself.
|
/// This widget will render a single frame to get its actual size, then will itself call [createViewer]. You do not need to call [createViewer] yourself.
|
||||||
/// This will 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) .
|
/// This will 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) .
|
||||||
/// 4) The FilamentController will notify FilamentWidget that a texture is available
|
/// 4) The FilamentController will notify FilamentWidget that a texture is available
|
||||||
/// 5) The FilamentWidget will replace the empty Container with a Texture widget
|
/// 5) The FilamentWidget will replace the empty Container with a Texture widget
|
||||||
/// If you need to wait until a FilamentViewer has been created, [await] the [isReadyForScene] Future.
|
/// If you need to wait until a FilamentViewer has been created, listen to the [viewer] stream.
|
||||||
|
///
|
||||||
|
void createViewer(int width, int height);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Resize the viewport & backing texture.
|
||||||
|
/// This is called by FilamentWidget; you shouldn't need to invoke this manually.
|
||||||
///
|
///
|
||||||
Future createViewer(int width, int height);
|
|
||||||
Future resize(int width, int height, {double scaleFactor = 1.0});
|
Future resize(int width, int height, {double scaleFactor = 1.0});
|
||||||
|
|
||||||
Future clearBackgroundImage();
|
///
|
||||||
|
/// Set the background image to [path] (which should have a file extension .png, .jpg, or .ktx).
|
||||||
|
/// This will be rendered at the maximum depth (i.e. behind all other objects including the skybox).
|
||||||
|
/// If [fillHeight] is false, the image will be rendered at its original size. Note this may cause issues with pixel density so be sure to specify the correct resolution
|
||||||
|
/// If [fillHeight] is true, the image will be stretched/compressed to fit the height of the viewport.
|
||||||
|
///
|
||||||
Future setBackgroundImage(String path, {bool fillHeight = false});
|
Future setBackgroundImage(String path, {bool fillHeight = false});
|
||||||
|
|
||||||
Future setBackgroundColor(Color color);
|
///
|
||||||
|
/// Moves the background image to the relative offset from the origin (bottom-left) specified by [x] and [y].
|
||||||
|
/// If [clamp] is true, the image cannot be positioned outside the bounds of the viewport.
|
||||||
|
///
|
||||||
Future setBackgroundImagePosition(double x, double y, {bool clamp = false});
|
Future setBackgroundImagePosition(double x, double y, {bool clamp = false});
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Removes the background image.
|
||||||
|
///
|
||||||
|
Future clearBackgroundImage();
|
||||||
|
|
||||||
|
///
|
||||||
|
/// 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);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Load a skybox from [skyboxPath] (which must be a .ktx file)
|
||||||
|
///
|
||||||
Future loadSkybox(String skyboxPath);
|
Future loadSkybox(String skyboxPath);
|
||||||
Future loadIbl(String lightingPath, {double intensity = 30000});
|
|
||||||
|
///
|
||||||
|
/// Removes the skybox from the scene.
|
||||||
|
///
|
||||||
Future removeSkybox();
|
Future removeSkybox();
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Loads an image-based light from the specified path at the given intensity.
|
||||||
|
/// Only one IBL can be active at any given time; if an IBL has already been loaded, it will be replaced.
|
||||||
|
///
|
||||||
|
Future loadIbl(String lightingPath, {double intensity = 30000});
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Removes the image-based light from the scene.
|
||||||
|
///
|
||||||
Future removeIbl();
|
Future removeIbl();
|
||||||
|
|
||||||
// copied from LightManager.h
|
///
|
||||||
// enum class Type : uint8_t {
|
/// Adds a dynamic light to the scene.
|
||||||
// SUN, //!< Directional light that also draws a sun's disk in the sky.
|
/// copied from filament LightManager.h
|
||||||
// DIRECTIONAL, //!< Directional light, emits light in a given direction.
|
/// enum class Type : uint8_t {
|
||||||
// POINT, //!< Point light, emits light from a position, in all directions.
|
/// SUN, //!< Directional light that also draws a sun's disk in the sky.
|
||||||
// FOCUSED_SPOT, //!< Physically correct spot light.
|
/// DIRECTIONAL, //!< Directional light, emits light in a given direction.
|
||||||
// SPOT, //!< Spot light with coupling of outer cone and illumination disabled.
|
/// POINT, //!< Point light, emits light from a position, in all directions.
|
||||||
// };
|
/// FOCUSED_SPOT, //!< Physically correct spot light.
|
||||||
|
/// SPOT, //!< Spot light with coupling of outer cone and illumination disabled.
|
||||||
|
/// };
|
||||||
Future<FilamentEntity> addLight(
|
Future<FilamentEntity> addLight(
|
||||||
int type,
|
int type,
|
||||||
double colour,
|
double colour,
|
||||||
@@ -68,44 +169,73 @@ abstract class FilamentController {
|
|||||||
double dirY,
|
double dirY,
|
||||||
double dirZ,
|
double dirZ,
|
||||||
bool castShadows);
|
bool castShadows);
|
||||||
|
|
||||||
Future removeLight(FilamentEntity light);
|
Future removeLight(FilamentEntity light);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Remove all lights (excluding IBL) from the scene.
|
||||||
|
///
|
||||||
Future clearLights();
|
Future clearLights();
|
||||||
|
|
||||||
Future<FilamentEntity> loadGlb(String path, {bool unlit = false});
|
Future<FilamentEntity> loadGlb(String path, {bool unlit = false});
|
||||||
|
|
||||||
Future<FilamentEntity> loadGltf(String path, String relativeResourcePath);
|
Future<FilamentEntity> loadGltf(String path, String relativeResourcePath);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.
|
||||||
|
///
|
||||||
Future panStart(double x, double y);
|
Future panStart(double x, double y);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.
|
||||||
|
///
|
||||||
Future panUpdate(double x, double y);
|
Future panUpdate(double x, double y);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.
|
||||||
|
///
|
||||||
Future panEnd();
|
Future panEnd();
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.
|
||||||
|
///
|
||||||
Future rotateStart(double x, double y);
|
Future rotateStart(double x, double y);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.
|
||||||
|
///
|
||||||
Future rotateUpdate(double x, double y);
|
Future rotateUpdate(double x, double y);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.
|
||||||
|
///
|
||||||
Future rotateEnd();
|
Future rotateEnd();
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Set the weights for all morph targets under node [meshName] in [asset] to [weights].
|
||||||
|
///
|
||||||
Future setMorphTargetWeights(
|
Future setMorphTargetWeights(
|
||||||
FilamentEntity asset, String meshName, List<double> weights);
|
FilamentEntity entity, String meshName, List<double> weights);
|
||||||
|
|
||||||
Future<List<String>> getMorphTargetNames(
|
Future<List<String>> getMorphTargetNames(
|
||||||
FilamentEntity asset, String meshName);
|
FilamentEntity entity, String meshName);
|
||||||
|
|
||||||
Future<List<String>> getAnimationNames(FilamentEntity asset);
|
Future<List<String>> getAnimationNames(FilamentEntity entity);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Returns the length (in seconds) of the animation at the given index.
|
/// Returns the length (in seconds) of the animation at the given index.
|
||||||
///
|
///
|
||||||
Future<double> getAnimationDuration(FilamentEntity asset, int animationIndex);
|
Future<double> getAnimationDuration(
|
||||||
|
FilamentEntity entity, int animationIndex);
|
||||||
|
|
||||||
///
|
///
|
||||||
|
/// Create/start a dynamic morph target animation for [asset].
|
||||||
/// Animates morph target weights/bone transforms (where each frame requires a duration of [frameLengthInMs].
|
/// Animates morph target weights/bone transforms (where each frame requires a duration of [frameLengthInMs].
|
||||||
/// [morphWeights] is a list of doubles in frame-major format.
|
/// [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.
|
/// 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.
|
||||||
///
|
///
|
||||||
Future setMorphAnimationData(
|
Future setMorphAnimationData(
|
||||||
FilamentEntity asset, MorphAnimationData animation);
|
FilamentEntity entity, MorphAnimationData animation);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Animates morph target weights/bone transforms (where each frame requires a duration of [frameLengthInMs].
|
/// Animates morph target weights/bone transforms (where each frame requires a duration of [frameLengthInMs].
|
||||||
@@ -113,26 +243,73 @@ 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.
|
/// 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)
|
/// for now we only allow animating a single bone (though multiple skinned targets are supported)
|
||||||
///
|
///
|
||||||
Future setBoneAnimation(FilamentEntity asset, BoneAnimationData animation);
|
Future setBoneAnimation(FilamentEntity entity, BoneAnimationData animation);
|
||||||
Future removeAsset(FilamentEntity asset);
|
|
||||||
|
///
|
||||||
|
/// Removes/destroys the specified entity from the scene.
|
||||||
|
/// [asset] will no longer be a valid handle after this method is called; ensure you immediately discard all references once this method is complete.
|
||||||
|
///
|
||||||
|
Future removeAsset(FilamentEntity entity);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Removes/destroys all renderable entities from the scene (including cameras).
|
||||||
|
/// All [FilamentEntity] handles will no longer be valid after this method is called; ensure you immediately discard all references to all entities once this method is complete.
|
||||||
|
///
|
||||||
Future clearAssets();
|
Future clearAssets();
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.
|
||||||
|
///
|
||||||
Future zoomBegin();
|
Future zoomBegin();
|
||||||
Future zoomUpdate(double z);
|
|
||||||
|
///
|
||||||
|
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.
|
||||||
|
///
|
||||||
|
Future zoomUpdate(double x, double y, double z);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.
|
||||||
|
///
|
||||||
Future zoomEnd();
|
Future zoomEnd();
|
||||||
Future playAnimation(FilamentEntity asset, int index,
|
|
||||||
|
///
|
||||||
|
/// Schedules the glTF animation at [index] in [asset] to start playing on the next frame.
|
||||||
|
///
|
||||||
|
Future playAnimation(FilamentEntity entity, int index,
|
||||||
{bool loop = false,
|
{bool loop = false,
|
||||||
bool reverse = false,
|
bool reverse = false,
|
||||||
bool replaceActive = true,
|
bool replaceActive = true,
|
||||||
double crossfade = 0.0});
|
double crossfade = 0.0});
|
||||||
Future setAnimationFrame(FilamentEntity asset, int index, int animationFrame);
|
Future setAnimationFrame(
|
||||||
Future stopAnimation(FilamentEntity asset, int animationIndex);
|
FilamentEntity entity, int index, int animationFrame);
|
||||||
Future setCamera(FilamentEntity asset, String? name);
|
Future stopAnimation(FilamentEntity entity, int animationIndex);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Sets the current scene camera to the glTF camera under [name] in [asset].
|
||||||
|
///
|
||||||
|
Future setCamera(FilamentEntity entity, String? name);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Sets the tone mapping (requires postprocessing).
|
||||||
|
///
|
||||||
Future setToneMapping(ToneMapper mapper);
|
Future setToneMapping(ToneMapper mapper);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Sets the strength of the bloom.
|
||||||
|
///
|
||||||
Future setBloom(double bloom);
|
Future setBloom(double bloom);
|
||||||
Future setCameraFocalLength(double focalLength);
|
Future setCameraFocalLength(double focalLength);
|
||||||
Future setCameraFocusDistance(double focusDistance);
|
Future setCameraFocusDistance(double focusDistance);
|
||||||
Future setCameraPosition(double x, double y, double z);
|
Future setCameraPosition(double x, double y, double z);
|
||||||
Future moveCameraToAsset(FilamentEntity asset);
|
|
||||||
|
///
|
||||||
|
/// Repositions the camera to the last vertex of the bounding box of [asset], looking at the penultimate vertex.
|
||||||
|
///
|
||||||
|
Future moveCameraToAsset(FilamentEntity entity);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Enables/disables frustum culling. Currently we don't expose a method for manipulating the camera projection/culling matrices so this is your only option to deal with unwanted near/far clipping.
|
||||||
|
///
|
||||||
Future setViewFrustumCulling(bool enabled);
|
Future setViewFrustumCulling(bool enabled);
|
||||||
Future setCameraExposure(
|
Future setCameraExposure(
|
||||||
double aperture, double shutterSpeed, double sensitivity);
|
double aperture, double shutterSpeed, double sensitivity);
|
||||||
@@ -140,12 +317,50 @@ abstract class FilamentController {
|
|||||||
Future setCameraModelMatrix(List<double> matrix);
|
Future setCameraModelMatrix(List<double> matrix);
|
||||||
|
|
||||||
Future setMaterialColor(
|
Future setMaterialColor(
|
||||||
FilamentEntity asset, String meshName, int materialIndex, Color color);
|
FilamentEntity entity, String meshName, int materialIndex, Color color);
|
||||||
Future transformToUnitCube(FilamentEntity asset);
|
|
||||||
Future setPosition(FilamentEntity asset, double x, double y, double z);
|
///
|
||||||
Future setScale(FilamentEntity asset, double scale);
|
/// Scales [asset] up/down so it fits within a unit cube.
|
||||||
|
///
|
||||||
|
Future transformToUnitCube(FilamentEntity entity);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Sets the world space position for [asset] to the given coordinates.
|
||||||
|
///
|
||||||
|
Future setPosition(FilamentEntity entity, double x, double y, double z);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Enable/disable postprocessing.
|
||||||
|
///
|
||||||
|
Future setPostProcessing(bool enabled);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Sets the scale for the given entity.
|
||||||
|
///
|
||||||
|
Future setScale(FilamentEntity entity, double scale);
|
||||||
Future setRotation(
|
Future setRotation(
|
||||||
FilamentEntity asset, double rads, double x, double y, double z);
|
FilamentEntity entity, double rads, double x, double y, double z);
|
||||||
Future hide(FilamentEntity asset, String meshName);
|
|
||||||
Future reveal(FilamentEntity asset, String meshName);
|
///
|
||||||
|
/// Reveal the node [meshName] under [entity]. Only applicable if [hide] had previously been called; this is a no-op otherwise.
|
||||||
|
///
|
||||||
|
Future reveal(FilamentEntity entity, String meshName);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Hide the node [meshName] under [entity]. The node is still loaded, but is no longer being rendered into the scene. Call [reveal] to re-commence rendering.
|
||||||
|
///
|
||||||
|
Future hide(FilamentEntity entity, String meshName);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Used to select the entity in the scene at the given viewport coordinates.
|
||||||
|
/// Called by `FilamentGestureDetector` on a mouse/finger down event. You probably don't want to call this yourself.
|
||||||
|
/// This is asynchronous and will require 2-3 frames to complete - subscribe to the [pickResult] stream to receive the results of this method.
|
||||||
|
/// [x] and [y] must be in local logical coordinates (i.e. where 0,0 is at top-left of the FilamentWidget).
|
||||||
|
///
|
||||||
|
void pick(int x, int y);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Retrieves the name assigned to the given FilamentEntity (usually corresponds to the glTF mesh name).
|
||||||
|
///
|
||||||
|
String? getNameForEntity(FilamentEntity entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:ffi';
|
import 'dart:ffi';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:typed_data';
|
|
||||||
import 'dart:ui' as ui;
|
import 'dart:ui' as ui;
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:ffi/ffi.dart';
|
import 'package:ffi/ffi.dart';
|
||||||
@@ -10,31 +9,35 @@ import 'package:polyvox_filament/animations/bone_animation_data.dart';
|
|||||||
import 'package:polyvox_filament/animations/morph_animation_data.dart';
|
import 'package:polyvox_filament/animations/morph_animation_data.dart';
|
||||||
import 'package:polyvox_filament/generated_bindings.dart';
|
import 'package:polyvox_filament/generated_bindings.dart';
|
||||||
|
|
||||||
|
const FilamentEntity _FILAMENT_ASSET_ERROR = 0;
|
||||||
|
|
||||||
class FilamentControllerFFI extends FilamentController {
|
class FilamentControllerFFI extends FilamentController {
|
||||||
late MethodChannel _channel = MethodChannel("app.polyvox.filament/event");
|
late MethodChannel _channel = MethodChannel("app.polyvox.filament/event");
|
||||||
|
|
||||||
double _pixelRatio = 1.0;
|
double _pixelRatio = 1.0;
|
||||||
|
|
||||||
int? _textureId;
|
|
||||||
final _textureIdController = StreamController<int?>.broadcast();
|
|
||||||
Stream<int?> get textureId => _textureIdController.stream;
|
|
||||||
|
|
||||||
Completer _isReadyForScene = Completer();
|
|
||||||
Future get isReadyForScene => _isReadyForScene.future;
|
|
||||||
|
|
||||||
late Pointer<Void>? _assetManager;
|
late Pointer<Void>? _assetManager;
|
||||||
|
|
||||||
late NativeLibrary _lib;
|
late NativeLibrary _lib;
|
||||||
|
|
||||||
Pointer<Void>? _viewer;
|
Pointer<Void>? _viewer;
|
||||||
|
|
||||||
bool _resizing = false;
|
final String? uberArchivePath;
|
||||||
|
|
||||||
|
Stream<bool> get hasViewer => _hasViewerController.stream;
|
||||||
|
final _hasViewerController = StreamController<bool>();
|
||||||
|
|
||||||
|
Stream<FilamentEntity> get pickResult => _pickResultController.stream;
|
||||||
|
final _pickResultController = StreamController<FilamentEntity>.broadcast();
|
||||||
|
|
||||||
|
@override
|
||||||
|
TextureDetails? textureDetails;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// This controller uses platform channels to bridge Dart with the C/C++ code for the Filament API.
|
/// This controller uses platform channels to bridge Dart with the C/C++ code for the Filament API.
|
||||||
/// Setting up the context/texture (since this is platform-specific) and the render ticker are platform-specific; all other methods are passed through by the platform channel to the methods specified in PolyvoxFilamentApi.h.
|
/// Setting up the context/texture (since this is platform-specific) and the render ticker are platform-specific; all other methods are passed through by the platform channel to the methods specified in PolyvoxFilamentApi.h.
|
||||||
///
|
///
|
||||||
FilamentControllerFFI() {
|
FilamentControllerFFI({this.uberArchivePath}) {
|
||||||
_channel.setMethodCallHandler((call) async {
|
_channel.setMethodCallHandler((call) async {
|
||||||
throw Exception("Unknown method channel invocation ${call.method}");
|
throw Exception("Unknown method channel invocation ${call.method}");
|
||||||
});
|
});
|
||||||
@@ -47,17 +50,21 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
_lib = NativeLibrary(dl);
|
_lib = NativeLibrary(dl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool _rendering = false;
|
||||||
|
bool get rendering => _rendering;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future setRendering(bool render) async {
|
Future setRendering(bool render) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
|
_rendering = render;
|
||||||
_lib.set_rendering_ffi(_viewer!, render);
|
_lib.set_rendering_ffi(_viewer!, render);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future render() async {
|
Future render() async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.render_ffi(_viewer!);
|
_lib.render_ffi(_viewer!);
|
||||||
@@ -71,44 +78,63 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
@override
|
@override
|
||||||
void setPixelRatio(double ratio) {
|
void setPixelRatio(double ratio) {
|
||||||
_pixelRatio = ratio;
|
_pixelRatio = ratio;
|
||||||
|
print("Set pixel ratio to $ratio");
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future destroy() async {
|
||||||
|
await destroyViewer();
|
||||||
|
await destroyTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future destroyViewer() async {
|
Future destroyViewer() async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
|
var viewer = _viewer;
|
||||||
|
|
||||||
_viewer = null;
|
_viewer = null;
|
||||||
|
|
||||||
_assetManager = null;
|
_assetManager = null;
|
||||||
_lib.destroy_filament_viewer_ffi(_viewer!);
|
_lib.destroy_filament_viewer_ffi(viewer!);
|
||||||
_isReadyForScene = Completer();
|
_hasViewerController.add(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future destroyTexture() async {
|
Future destroyTexture() async {
|
||||||
await _channel.invokeMethod("destroyTexture");
|
if (textureDetails != null) {
|
||||||
_textureId = null;
|
await _channel.invokeMethod("destroyTexture", textureDetails!.textureId);
|
||||||
_textureIdController.add(null);
|
}
|
||||||
|
print("Texture destroyed");
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Called by `FilamentWidget`. You do not need to call this yourself.
|
/// Called by `FilamentWidget`. You do not need to call this yourself.
|
||||||
///
|
///
|
||||||
Future createViewer(int width, int height) async {
|
void createViewer(int width, int height) async {
|
||||||
if (_viewer != null) {
|
if (_viewer != null) {
|
||||||
throw Exception(
|
throw Exception(
|
||||||
"Viewer already exists, make sure you call destroyViewer first");
|
"Viewer already exists, make sure you call destroyViewer first");
|
||||||
}
|
}
|
||||||
if (_isReadyForScene.isCompleted) {
|
if (textureDetails != null) {
|
||||||
throw Exception(
|
throw Exception(
|
||||||
"Do not call createViewer when a viewer has already been created without calling destroyViewer");
|
"Texture already exists, make sure you call destroyTexture first");
|
||||||
}
|
}
|
||||||
size = ui.Size(width * _pixelRatio, height * _pixelRatio);
|
|
||||||
|
var loader = Pointer<ResourceLoaderWrapper>.fromAddress(
|
||||||
|
await _channel.invokeMethod("getResourceLoaderWrapper"));
|
||||||
|
if (loader == nullptr) {
|
||||||
|
throw Exception("Failed to get resource loader");
|
||||||
|
}
|
||||||
|
|
||||||
|
var size = ui.Size(width * _pixelRatio, height * _pixelRatio);
|
||||||
|
|
||||||
|
print("Creating viewer with size $size");
|
||||||
|
|
||||||
var textures =
|
var textures =
|
||||||
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;
|
|
||||||
|
|
||||||
// void* on iOS (pointer to pixel buffer), void* on Android (pointer to native window), null on Windows/macOS
|
// 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;
|
||||||
@@ -131,12 +157,12 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
|
|
||||||
var sharedContext = await _channel.invokeMethod("getSharedContext");
|
var sharedContext = await _channel.invokeMethod("getSharedContext");
|
||||||
print("Got shared context : $sharedContext");
|
print("Got shared context : $sharedContext");
|
||||||
var loader = await _channel.invokeMethod("getResourceLoaderWrapper");
|
|
||||||
|
|
||||||
_viewer = _lib.create_filament_viewer_ffi(
|
_viewer = _lib.create_filament_viewer_ffi(
|
||||||
Pointer<Void>.fromAddress(sharedContext ?? 0),
|
Pointer<Void>.fromAddress(sharedContext ?? 0),
|
||||||
driver,
|
driver,
|
||||||
Pointer<ResourceLoaderWrapper>.fromAddress(loader),
|
uberArchivePath?.toNativeUtf8().cast<Char>() ?? nullptr,
|
||||||
|
loader,
|
||||||
renderCallback,
|
renderCallback,
|
||||||
renderCallbackOwner);
|
renderCallbackOwner);
|
||||||
|
|
||||||
@@ -145,46 +171,158 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_lib.create_swap_chain_ffi(
|
_lib.create_swap_chain_ffi(
|
||||||
_viewer!, Pointer<Void>.fromAddress(surfaceAddress), width, height);
|
_viewer!,
|
||||||
|
Pointer<Void>.fromAddress(surfaceAddress),
|
||||||
|
size.width.toInt(),
|
||||||
|
size.height.toInt());
|
||||||
if (nativeTexture != 0) {
|
if (nativeTexture != 0) {
|
||||||
assert(surfaceAddress == 0);
|
assert(surfaceAddress == 0);
|
||||||
_lib.create_render_target(_viewer!, nativeTexture, width, height);
|
print("Creating render target from native texture $nativeTexture");
|
||||||
|
_lib.create_render_target_ffi(
|
||||||
|
_viewer!, nativeTexture, size.width.toInt(), size.height.toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
_lib.update_viewport_and_camera_projection_ffi(
|
_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!);
|
_assetManager = _lib.get_asset_manager(_viewer!);
|
||||||
|
|
||||||
_textureIdController.add(_textureId);
|
textureDetails = TextureDetails(
|
||||||
|
textureId: flutterTextureId!, width: width, height: height);
|
||||||
_isReadyForScene.complete(true);
|
_hasViewerController.add(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// When a FilamentWidget is resized, it will call [resize]. This method will tear down/recreate the swapchain and propagate a new texture ID back to the FilamentWidget.
|
||||||
|
/// For "once-off" resizes, this is fine.
|
||||||
|
/// However, this can be problematic for consecutive resizes (e.g. dragging to expand/contract the parent window on desktop, or animating the size of the FilamentWidget itself).
|
||||||
|
/// It is too expensive to recreate the swapchain multiple times per second.
|
||||||
|
/// We therefore add a timer to FilamentWidget so that the call to [resize] is delayed (e.g. 50ms).
|
||||||
|
/// Any subsequent resizes before the delay window elapses will cancel the earlier call.
|
||||||
|
///
|
||||||
|
/// The overall process looks like this:
|
||||||
|
/// 1) the window is resized
|
||||||
|
/// 2) (Windows only) PixelBufferTexture is requested to provide a new pixel buffer with a new size, and we return an empty texture
|
||||||
|
/// 3) After Xms, [resize] is invoked
|
||||||
|
/// 4) the viewer is instructed to stop rendering (synchronous)
|
||||||
|
/// 5) the existing Filament swapchain is destroyed (synchronous)
|
||||||
|
/// 6) the Flutter texture is unregistered
|
||||||
|
/// a) this is asynchronous, but
|
||||||
|
/// b) *** SEE NOTE BELOW ON WINDOWS *** by passing the method channel result through to the callback, we make this synchronous from the Flutter side,
|
||||||
|
// c) in this async callback, the glTexture is destroyed
|
||||||
|
/// 7) a new Flutter/OpenGL texture is created (synchronous)
|
||||||
|
/// 8) a new swapchain is created (synchronous)
|
||||||
|
/// 9) if the viewer was rendering prior to the resize, the viewer is instructed to recommence rendering
|
||||||
|
/// 10) the new texture ID is pushed to the FilamentWidget
|
||||||
|
/// 11) the FilamentWidget updates the Texture widget with the new texture.
|
||||||
|
///
|
||||||
|
/// #### (Windows-only) ############################################################
|
||||||
|
/// # As soon as the widget/window is resized, the PixelBufferTexture will be
|
||||||
|
/// # requested to provide a new pixel buffer for the new size.
|
||||||
|
/// # Even with zero delay to the call to [resize], this will be triggered *before*
|
||||||
|
/// # we have had a chance to anything else (like tear down the swapchain).
|
||||||
|
/// # On the backend, we deal with this by simply returning an empty texture as soon
|
||||||
|
/// # as the size changes, and will rely on the followup call to [resize] to actually
|
||||||
|
/// # destroy/recreate the pixel buffer and Flutter texture.
|
||||||
|
///
|
||||||
|
/// NOTE RE ASYNC CALLBACK
|
||||||
|
/// # The bigger problem is a race condition when resize is called multiple times in quick succession (e.g dragging to resize on Windows).
|
||||||
|
/// # It looks like occasionally, the backend OpenGL texture is being destroyed while its corresponding swapchain is still active, causing a crash.
|
||||||
|
/// # I'm not exactly sure how/where this is occurring, but something clearly isn't synchronized between destroy_swap_chain_ffi and
|
||||||
|
/// # the asynchronous callback passed to FlutterTextureRegistrar::UnregisterTexture.
|
||||||
|
/// # Theoretically this could occur if resize_2 starts before resize_1 completes, i.e.
|
||||||
|
/// # 1) resize_1 destroys swapchain/texture and creates new texture
|
||||||
|
/// # 2) resize_2 destroys swapchain/texture
|
||||||
|
/// # 3) resize_1 creates new swapchain but texture isn't available, ergo crash
|
||||||
|
/// #
|
||||||
|
/// # I don't think this should happen if:
|
||||||
|
/// # 1) we add a flag on the Flutter side to ensure only one call to destroy/recreate the swapchain/texture is active at any given time, and
|
||||||
|
/// # 2) on the Flutter side, we are sure that calling destroyTexture only returns once the async callback on the native side has completed.
|
||||||
|
/// # For (1), checking if textureId is null at the entrypoint should be sufficient.
|
||||||
|
/// # For (2), we invoke flutter::MethodResult<flutter::EncodableValue>->Success in the UnregisterTexture callback.
|
||||||
|
/// #
|
||||||
|
/// # Maybe (2) doesn't actually make Flutter wait?
|
||||||
|
/// #
|
||||||
|
/// # The other possibility is that both (1) and (2) are fine and the issue is elsewhere.
|
||||||
|
/// #
|
||||||
|
/// # Either way, the current solution is to basically setup a double-buffer on resize.
|
||||||
|
/// # When destroyTexture is called, the active texture isn't destroyed yet, it's only marked as inactive.
|
||||||
|
/// # On subsequent calls to destroyTexture, the inactive texture is destroyed.
|
||||||
|
/// # This seems to work fine.
|
||||||
|
///
|
||||||
|
/// # Another option is to only use a single large (e.g. 4k) texture and simply crop whenever a resize is requested.
|
||||||
|
/// # This might be preferable for other reasons (e.g. don't need to destroy/recreate the pixel buffer or swapchain).
|
||||||
|
/// # Given we don't do this on other platforms, I'm OK to stick with the existing solution for the time being.
|
||||||
|
/// ############################################################################
|
||||||
|
///
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future resize(int width, int height, {double scaleFactor = 1.0}) async {
|
Future resize(int width, int height, {double scaleFactor = 1.0}) async {
|
||||||
_resizing = true;
|
// we defer to the FilamentWidget to ensure that every call to [resize] is synchronized
|
||||||
setRendering(false);
|
// so this exception should never be thrown (right?)
|
||||||
_textureId = await _channel.invokeMethod(
|
if (textureDetails == null) {
|
||||||
"resize", [width * _pixelRatio, height * _pixelRatio, scaleFactor]);
|
throw Exception("Resize currently underway, ignoring");
|
||||||
_textureIdController.add(_textureId);
|
}
|
||||||
|
|
||||||
|
var _textureDetails = textureDetails;
|
||||||
|
|
||||||
|
textureDetails = null;
|
||||||
|
|
||||||
|
_lib.set_rendering_ffi(_viewer!, false);
|
||||||
|
|
||||||
|
if (_textureDetails != null) {
|
||||||
|
if (_viewer != null) {
|
||||||
|
_lib.destroy_swap_chain_ffi(_viewer!);
|
||||||
|
}
|
||||||
|
|
||||||
|
await _channel.invokeMethod("destroyTexture", _textureDetails!.textureId);
|
||||||
|
print("Destroyed texture ${_textureDetails!.textureId}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var newSize = ui.Size(width * _pixelRatio, height * _pixelRatio);
|
||||||
|
|
||||||
|
print("Size after pixel ratio : $width x $height ");
|
||||||
|
|
||||||
|
var textures = await _channel
|
||||||
|
.invokeMethod("createTexture", [newSize.width, newSize.height]);
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
// null on iOS/Android, void* on MacOS (pointer to metal texture), GLuid on Windows/Linux
|
||||||
|
var nativeTexture = textures[2] as int? ?? 0;
|
||||||
|
|
||||||
|
_lib.create_swap_chain_ffi(
|
||||||
|
_viewer!,
|
||||||
|
Pointer<Void>.fromAddress(surfaceAddress),
|
||||||
|
newSize.width.toInt(),
|
||||||
|
newSize.height.toInt());
|
||||||
|
if (nativeTexture != 0) {
|
||||||
|
assert(surfaceAddress == 0);
|
||||||
|
print("Creating render target from native texture $nativeTexture");
|
||||||
|
_lib.create_render_target_ffi(_viewer!, nativeTexture,
|
||||||
|
newSize.width.toInt(), newSize.height.toInt());
|
||||||
|
}
|
||||||
|
|
||||||
_lib.update_viewport_and_camera_projection_ffi(
|
_lib.update_viewport_and_camera_projection_ffi(
|
||||||
_viewer!, width, height, scaleFactor);
|
_viewer!, newSize.width.toInt(), newSize.height.toInt(), 1.0);
|
||||||
_resizing = false;
|
|
||||||
setRendering(true);
|
await setRendering(_rendering);
|
||||||
|
textureDetails =
|
||||||
|
TextureDetails(textureId: textures[0]!, width: width, height: height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future clearBackgroundImage() async {
|
Future clearBackgroundImage() async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.clear_background_image_ffi(_viewer!);
|
_lib.clear_background_image_ffi(_viewer!);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future setBackgroundImage(String path, {bool fillHeight = false}) async {
|
Future setBackgroundImage(String path, {bool fillHeight = false}) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.set_background_image_ffi(
|
_lib.set_background_image_ffi(
|
||||||
@@ -193,7 +331,7 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future setBackgroundColor(Color color) async {
|
Future setBackgroundColor(Color color) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.set_background_color_ffi(
|
_lib.set_background_color_ffi(
|
||||||
@@ -207,7 +345,7 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
@override
|
@override
|
||||||
Future setBackgroundImagePosition(double x, double y,
|
Future setBackgroundImagePosition(double x, double y,
|
||||||
{bool clamp = false}) async {
|
{bool clamp = false}) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.set_background_image_position_ffi(_viewer!, x, y, clamp);
|
_lib.set_background_image_position_ffi(_viewer!, x, y, clamp);
|
||||||
@@ -215,7 +353,7 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future loadSkybox(String skyboxPath) async {
|
Future loadSkybox(String skyboxPath) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.load_skybox_ffi(_viewer!, skyboxPath.toNativeUtf8().cast<Char>());
|
_lib.load_skybox_ffi(_viewer!, skyboxPath.toNativeUtf8().cast<Char>());
|
||||||
@@ -223,7 +361,7 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future loadIbl(String lightingPath, {double intensity = 30000}) async {
|
Future loadIbl(String lightingPath, {double intensity = 30000}) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.load_ibl_ffi(
|
_lib.load_ibl_ffi(
|
||||||
@@ -232,7 +370,7 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future removeSkybox() async {
|
Future removeSkybox() async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.remove_skybox_ffi(_viewer!);
|
_lib.remove_skybox_ffi(_viewer!);
|
||||||
@@ -240,7 +378,7 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future removeIbl() async {
|
Future removeIbl() async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.remove_ibl_ffi(_viewer!);
|
_lib.remove_ibl_ffi(_viewer!);
|
||||||
@@ -258,7 +396,7 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
double dirY,
|
double dirY,
|
||||||
double dirZ,
|
double dirZ,
|
||||||
bool castShadows) async {
|
bool castShadows) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
var entity = _lib.add_light_ffi(_viewer!, type, colour, intensity, posX,
|
var entity = _lib.add_light_ffi(_viewer!, type, colour, intensity, posX,
|
||||||
@@ -268,7 +406,7 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future removeLight(FilamentEntity light) async {
|
Future removeLight(FilamentEntity light) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.remove_light_ffi(_viewer!, light);
|
_lib.remove_light_ffi(_viewer!, light);
|
||||||
@@ -276,7 +414,7 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future clearLights() async {
|
Future clearLights() async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.clear_lights_ffi(_viewer!);
|
_lib.clear_lights_ffi(_viewer!);
|
||||||
@@ -284,7 +422,7 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<FilamentEntity> loadGlb(String path, {bool unlit = false}) async {
|
Future<FilamentEntity> loadGlb(String path, {bool unlit = false}) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
if (unlit) {
|
if (unlit) {
|
||||||
@@ -292,105 +430,84 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
}
|
}
|
||||||
var asset = _lib.load_glb_ffi(
|
var asset = _lib.load_glb_ffi(
|
||||||
_assetManager!, path.toNativeUtf8().cast<Char>(), unlit);
|
_assetManager!, path.toNativeUtf8().cast<Char>(), unlit);
|
||||||
if (asset == FILAMENT_ASSET_ERROR) {
|
if (asset == _FILAMENT_ASSET_ERROR) {
|
||||||
throw Exception("An error occurred loading the asset at $path");
|
throw Exception("An error occurred loading the asset at $path");
|
||||||
}
|
}
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<FilamentEntity> loadGltf(
|
Future<FilamentEntity> loadGltf(String path, String relativeResourcePath,
|
||||||
String path, String relativeResourcePath, { bool force=false}) async {
|
{bool force = false}) async {
|
||||||
|
if (Platform.isWindows && !force) {
|
||||||
if(Platform.isWindows && !force) {
|
throw Exception(
|
||||||
throw Exception("loadGltf has a race condition on Windows which is likely to crash your program. If you really want to try, pass force=true to loadGltf");
|
"loadGltf has a race condition on Windows which is likely to crash your program. If you really want to try, pass force=true to loadGltf");
|
||||||
}
|
}
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
var asset = _lib.load_gltf_ffi(
|
var asset = _lib.load_gltf_ffi(
|
||||||
_assetManager!,
|
_assetManager!,
|
||||||
path.toNativeUtf8().cast<Char>(),
|
path.toNativeUtf8().cast<Char>(),
|
||||||
relativeResourcePath.toNativeUtf8().cast<Char>());
|
relativeResourcePath.toNativeUtf8().cast<Char>());
|
||||||
if (asset == FILAMENT_ASSET_ERROR) {
|
if (asset == _FILAMENT_ASSET_ERROR) {
|
||||||
throw Exception("An error occurred loading the asset at $path");
|
throw Exception("An error occurred loading the asset at $path");
|
||||||
}
|
}
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future panStart(double x, double y) async {
|
Future panStart(double x, double y) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.grab_begin(_viewer!, x * _pixelRatio, y * _pixelRatio, true);
|
_lib.grab_begin(_viewer!, x * _pixelRatio, y * _pixelRatio, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future panUpdate(double x, double y) async {
|
Future panUpdate(double x, double y) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.grab_update(_viewer!, x * _pixelRatio, y * _pixelRatio);
|
_lib.grab_update(_viewer!, x * _pixelRatio, y * _pixelRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future panEnd() async {
|
Future panEnd() async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.grab_end(_viewer!);
|
_lib.grab_end(_viewer!);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future rotateStart(double x, double y) async {
|
Future rotateStart(double x, double y) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.grab_begin(_viewer!, x * _pixelRatio, y * _pixelRatio, false);
|
_lib.grab_begin(_viewer!, x * _pixelRatio, y * _pixelRatio, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future rotateUpdate(double x, double y) async {
|
Future rotateUpdate(double x, double y) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.grab_update(_viewer!, x * _pixelRatio, y * _pixelRatio);
|
_lib.grab_update(_viewer!, x * _pixelRatio, y * _pixelRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future rotateEnd() async {
|
Future rotateEnd() async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.grab_end(_viewer!);
|
_lib.grab_end(_viewer!);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Set the weights for all morph targets under node [meshName] in [asset] to [weights].
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future setMorphTargetWeights(
|
Future setMorphTargetWeights(
|
||||||
FilamentEntity asset, String meshName, List<double> weights) async {
|
FilamentEntity asset, String meshName, List<double> weights) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
var weightsPtr = calloc<Float>(weights.length);
|
var weightsPtr = calloc<Float>(weights.length);
|
||||||
@@ -406,7 +523,7 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
@override
|
@override
|
||||||
Future<List<String>> getMorphTargetNames(
|
Future<List<String>> getMorphTargetNames(
|
||||||
FilamentEntity asset, String meshName) async {
|
FilamentEntity asset, String meshName) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
var names = <String>[];
|
var names = <String>[];
|
||||||
@@ -424,7 +541,7 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<String>> getAnimationNames(FilamentEntity asset) async {
|
Future<List<String>> getAnimationNames(FilamentEntity asset) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
var animationCount = _lib.get_animation_count(_assetManager!, asset);
|
var animationCount = _lib.get_animation_count(_assetManager!, asset);
|
||||||
@@ -438,28 +555,22 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Returns the length (in seconds) of the animation at the given index.
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future<double> getAnimationDuration(
|
Future<double> getAnimationDuration(
|
||||||
FilamentEntity asset, int animationIndex) async {
|
FilamentEntity asset, int animationIndex) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
var duration =
|
var duration =
|
||||||
_lib.get_animation_duration_ffi(_assetManager!, asset, animationIndex);
|
_lib.get_animation_duration(_assetManager!, asset, animationIndex);
|
||||||
|
|
||||||
return duration;
|
return duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Create/start a dynamic morph target animation for [asset].
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future setMorphAnimationData(
|
Future setMorphAnimationData(
|
||||||
FilamentEntity asset, MorphAnimationData animation) async {
|
FilamentEntity asset, MorphAnimationData animation) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -486,16 +597,10 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
calloc.free(idxPtr);
|
calloc.free(idxPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Animates morph target weights/bone transforms (where each frame requires a duration of [frameLengthInMs].
|
|
||||||
/// [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.
|
|
||||||
/// for now we only allow animating a single bone (though multiple skinned targets are supported)
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future setBoneAnimation(
|
Future setBoneAnimation(
|
||||||
FilamentEntity asset, BoneAnimationData animation) async {
|
FilamentEntity asset, BoneAnimationData animation) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
// var data = calloc<Float>(animation.frameData.length);
|
// var data = calloc<Float>(animation.frameData.length);
|
||||||
@@ -530,73 +635,53 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
// calloc.free(data);
|
// calloc.free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Removes/destroys the specified entity from the scene.
|
|
||||||
/// [asset] will no longer be a valid handle after this method is called; ensure you immediately discard all references once this method is complete.
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future removeAsset(FilamentEntity asset) async {
|
Future removeAsset(FilamentEntity asset) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.remove_asset_ffi(_viewer!, asset);
|
_lib.remove_asset_ffi(_viewer!, asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Removes/destroys all renderable entities from the scene (including cameras).
|
|
||||||
/// All [FilamentEntity] handles will no longer be valid after this method is called; ensure you immediately discard all references to all entities once this method is complete.
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future clearAssets() async {
|
Future clearAssets() async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.clear_assets_ffi(_viewer!);
|
_lib.clear_assets_ffi(_viewer!);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future zoomBegin() async {
|
Future zoomBegin() async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.scroll_begin(_viewer!);
|
_lib.scroll_begin(_viewer!);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future zoomUpdate(double z) async {
|
Future zoomUpdate(double x, double y, double z) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.scroll_update(_viewer!, 0.0, 0.0, z);
|
_lib.scroll_update(_viewer!, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future zoomEnd() async {
|
Future zoomEnd() async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.scroll_end(_viewer!);
|
_lib.scroll_end(_viewer!);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Schedules the glTF animation at [index] in [asset] to start playing on the next frame.
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future playAnimation(FilamentEntity asset, int index,
|
Future playAnimation(FilamentEntity asset, int index,
|
||||||
{bool loop = false,
|
{bool loop = false,
|
||||||
bool reverse = false,
|
bool reverse = false,
|
||||||
bool replaceActive = true,
|
bool replaceActive = true,
|
||||||
double crossfade = 0.0}) async {
|
double crossfade = 0.0}) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.play_animation_ffi(
|
_lib.play_animation_ffi(
|
||||||
@@ -605,91 +690,88 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
|
|
||||||
Future setAnimationFrame(
|
Future setAnimationFrame(
|
||||||
FilamentEntity asset, int index, int animationFrame) async {
|
FilamentEntity asset, int index, int animationFrame) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.set_animation_frame(_assetManager!, asset, index, animationFrame);
|
_lib.set_animation_frame(_assetManager!, asset, index, animationFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future stopAnimation(FilamentEntity asset, int animationIndex) async {
|
Future stopAnimation(FilamentEntity asset, int animationIndex) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.stop_animation(_assetManager!, asset, animationIndex);
|
_lib.stop_animation(_assetManager!, asset, animationIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Sets the current scene camera to the glTF camera under [name] in [asset].
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future setCamera(FilamentEntity asset, String? name) async {
|
Future setCamera(FilamentEntity asset, String? name) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
var result = _lib.set_camera(
|
var result = _lib.set_camera(
|
||||||
_viewer!, asset, name?.toNativeUtf8()?.cast<Char>() ?? nullptr);
|
_viewer!, asset, name?.toNativeUtf8()?.cast<Char>() ?? nullptr);
|
||||||
if (result != 1) {
|
if (!result) {
|
||||||
throw Exception("Failed to set camera");
|
throw Exception("Failed to set camera");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Sets the tone mapping.
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future setToneMapping(ToneMapper mapper) async {
|
Future setToneMapping(ToneMapper mapper) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
|
|
||||||
_lib.set_tone_mapping_ffi(_viewer!, mapper.index);
|
_lib.set_tone_mapping_ffi(_viewer!, mapper.index);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
@override
|
||||||
/// Sets the strength of the bloom.
|
Future setPostProcessing(bool enabled) async {
|
||||||
///
|
if (_viewer == null) {
|
||||||
|
throw Exception("No viewer available, ignoring");
|
||||||
|
}
|
||||||
|
|
||||||
|
_lib.set_post_processing_ffi(_viewer!, enabled);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future setBloom(double bloom) async {
|
Future setBloom(double bloom) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.set_bloom_ffi(_viewer!, bloom);
|
_lib.set_bloom_ffi(_viewer!, bloom);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future setCameraFocalLength(double focalLength) async {
|
Future setCameraFocalLength(double focalLength) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.set_camera_focal_length(_viewer!, focalLength);
|
_lib.set_camera_focal_length(_viewer!, focalLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future setCameraFocusDistance(double focusDistance) async {
|
Future setCameraFocusDistance(double focusDistance) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.set_camera_focus_distance(_viewer!, focusDistance);
|
_lib.set_camera_focus_distance(_viewer!, focusDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future setCameraPosition(double x, double y, double z) async {
|
Future setCameraPosition(double x, double y, double z) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.set_camera_position(_viewer!, x, y, z);
|
_lib.set_camera_position(_viewer!, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future moveCameraToAsset(FilamentEntity asset) async {
|
Future moveCameraToAsset(FilamentEntity asset) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.move_camera_to_asset(_viewer!, asset);
|
_lib.move_camera_to_asset(_viewer!, asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Enables/disables frustum culling. Currently we don't expose a method for manipulating the camera projection/culling matrices so this is your only option to deal with unwanted near/far clipping.
|
|
||||||
///
|
|
||||||
@override
|
@override
|
||||||
Future setViewFrustumCulling(bool enabled) async {
|
Future setViewFrustumCulling(bool enabled) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.set_view_frustum_culling(_viewer!, enabled);
|
_lib.set_view_frustum_culling(_viewer!, enabled);
|
||||||
@@ -697,21 +779,21 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
|
|
||||||
Future setCameraExposure(
|
Future setCameraExposure(
|
||||||
double aperture, double shutterSpeed, double sensitivity) async {
|
double aperture, double shutterSpeed, double sensitivity) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.set_camera_exposure(_viewer!, aperture, shutterSpeed, sensitivity);
|
_lib.set_camera_exposure(_viewer!, aperture, shutterSpeed, sensitivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future setCameraRotation(double rads, double x, double y, double z) async {
|
Future setCameraRotation(double rads, double x, double y, double z) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.set_camera_rotation(_viewer!, rads, x, y, z);
|
_lib.set_camera_rotation(_viewer!, rads, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future setCameraModelMatrix(List<double> matrix) async {
|
Future setCameraModelMatrix(List<double> matrix) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
assert(matrix.length == 16);
|
assert(matrix.length == 16);
|
||||||
@@ -725,7 +807,7 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
|
|
||||||
Future setMaterialColor(FilamentEntity asset, String meshName,
|
Future setMaterialColor(FilamentEntity asset, String meshName,
|
||||||
int materialIndex, Color color) async {
|
int materialIndex, Color color) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
var result = _lib.set_material_color(
|
var result = _lib.set_material_color(
|
||||||
@@ -743,21 +825,21 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future transformToUnitCube(FilamentEntity asset) async {
|
Future transformToUnitCube(FilamentEntity asset) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.transform_to_unit_cube(_assetManager!, asset);
|
_lib.transform_to_unit_cube(_assetManager!, asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future setPosition(FilamentEntity asset, double x, double y, double z) async {
|
Future setPosition(FilamentEntity asset, double x, double y, double z) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.set_position(_assetManager!, asset, x, y, z);
|
_lib.set_position(_assetManager!, asset, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future setScale(FilamentEntity asset, double scale) async {
|
Future setScale(FilamentEntity asset, double scale) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.set_scale(_assetManager!, asset, scale);
|
_lib.set_scale(_assetManager!, asset, scale);
|
||||||
@@ -765,14 +847,14 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
|
|
||||||
Future setRotation(
|
Future setRotation(
|
||||||
FilamentEntity asset, double rads, double x, double y, double z) async {
|
FilamentEntity asset, double rads, double x, double y, double z) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
_lib.set_rotation(_assetManager!, asset, rads, x, y, z);
|
_lib.set_rotation(_assetManager!, asset, rads, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future hide(FilamentEntity asset, String meshName) async {
|
Future hide(FilamentEntity asset, String meshName) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
if (_lib.hide_mesh(
|
if (_lib.hide_mesh(
|
||||||
@@ -781,7 +863,7 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future reveal(FilamentEntity asset, String meshName) async {
|
Future reveal(FilamentEntity asset, String meshName) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
if (_lib.reveal_mesh(
|
if (_lib.reveal_mesh(
|
||||||
@@ -790,4 +872,34 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
throw Exception("Failed to reveal mesh $meshName");
|
throw Exception("Failed to reveal mesh $meshName");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String? getNameForEntity(FilamentEntity entity) {
|
||||||
|
final result = _lib.get_name_for_entity(_assetManager!, entity);
|
||||||
|
if (result == nullptr) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return result.cast<Utf8>().toDartString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void pick(int x, int y) async {
|
||||||
|
if (_viewer == null) {
|
||||||
|
throw Exception("No viewer available, ignoring");
|
||||||
|
}
|
||||||
|
final outPtr = calloc<EntityId>(1);
|
||||||
|
outPtr.value = 0;
|
||||||
|
|
||||||
|
_lib.pick_ffi(_viewer!, x, textureDetails!.height - y, outPtr);
|
||||||
|
int wait = 0;
|
||||||
|
while (outPtr.value == 0) {
|
||||||
|
await Future.delayed(Duration(milliseconds: 50));
|
||||||
|
wait++;
|
||||||
|
if (wait > 10) {
|
||||||
|
calloc.free(outPtr);
|
||||||
|
throw Exception("Failed to get picking result");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var entityId = outPtr.value;
|
||||||
|
_pickResultController.add(entityId);
|
||||||
|
calloc.free(outPtr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,12 @@ import 'filament_controller.dart';
|
|||||||
|
|
||||||
typedef AssetManager = int;
|
typedef AssetManager = int;
|
||||||
|
|
||||||
|
const FilamentEntity _FILAMENT_ASSET_ERROR = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// This is a previous iteration of FilamentController that used platform channels for every distinct platform.
|
||||||
|
/// This is no longer used; currently kept only for reference/posterity.
|
||||||
|
///
|
||||||
class FilamentControllerMethodChannel extends FilamentController {
|
class FilamentControllerMethodChannel extends FilamentController {
|
||||||
late MethodChannel _channel = MethodChannel("app.polyvox.filament/event");
|
late MethodChannel _channel = MethodChannel("app.polyvox.filament/event");
|
||||||
|
|
||||||
@@ -36,6 +42,10 @@ class FilamentControllerMethodChannel extends FilamentController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future setPostProcessing(bool enabled) async {
|
||||||
|
throw Exception();
|
||||||
|
}
|
||||||
|
|
||||||
Future setRendering(bool render) async {
|
Future setRendering(bool render) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null || _resizing) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
@@ -81,7 +91,8 @@ class FilamentControllerMethodChannel extends FilamentController {
|
|||||||
/// 3) Initially, this widget will only contain an empty Container. After the first frame is rendered, the widget itself will automatically call [createViewer] with the width/height from its constraints
|
/// 3) Initially, this widget will only contain an empty Container. After the first frame is rendered, the widget itself will automatically call [createViewer] with the width/height from its constraints
|
||||||
/// 4) The FilamentWidget will replace the empty Container with the Texture widget.
|
/// 4) The FilamentWidget will replace the empty Container with the Texture widget.
|
||||||
///
|
///
|
||||||
Future createViewer(int width, int height) async {
|
Future<TextureDetails> createViewer(int width, int height) async {
|
||||||
|
throw Exception();
|
||||||
if (_viewer != null) {
|
if (_viewer != null) {
|
||||||
throw Exception(
|
throw Exception(
|
||||||
"Viewer already exists, make sure you call destroyViewer first");
|
"Viewer already exists, make sure you call destroyViewer first");
|
||||||
@@ -109,7 +120,9 @@ class FilamentControllerMethodChannel extends FilamentController {
|
|||||||
|
|
||||||
bool _resizing = false;
|
bool _resizing = false;
|
||||||
|
|
||||||
Future resize(int width, int height, {double scaleFactor = 1.0}) async {
|
Future<TextureDetails> resize(int width, int height,
|
||||||
|
{double scaleFactor = 1.0}) async {
|
||||||
|
throw Exception();
|
||||||
_resizing = true;
|
_resizing = true;
|
||||||
_textureId = await _channel.invokeMethod(
|
_textureId = await _channel.invokeMethod(
|
||||||
"resize", [width * _pixelRatio, height * _pixelRatio, scaleFactor]);
|
"resize", [width * _pixelRatio, height * _pixelRatio, scaleFactor]);
|
||||||
@@ -237,7 +250,7 @@ class FilamentControllerMethodChannel extends FilamentController {
|
|||||||
}
|
}
|
||||||
var asset =
|
var asset =
|
||||||
await _channel.invokeMethod("loadGlb", [_assetManager, path, unlit]);
|
await _channel.invokeMethod("loadGlb", [_assetManager, path, unlit]);
|
||||||
if (asset == FILAMENT_ASSET_ERROR) {
|
if (asset == _FILAMENT_ASSET_ERROR) {
|
||||||
throw Exception("An error occurred loading the asset at $path");
|
throw Exception("An error occurred loading the asset at $path");
|
||||||
}
|
}
|
||||||
return asset;
|
return asset;
|
||||||
@@ -426,11 +439,11 @@ class FilamentControllerMethodChannel extends FilamentController {
|
|||||||
await _channel.invokeMethod("scrollBegin");
|
await _channel.invokeMethod("scrollBegin");
|
||||||
}
|
}
|
||||||
|
|
||||||
Future zoomUpdate(double z) async {
|
Future zoomUpdate(double x, double y, double z) async {
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null || _resizing) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
await _channel.invokeMethod("scrollUpdate", [0.0, 0.0, z]);
|
await _channel.invokeMethod("scrollUpdate", [x, y, z]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future zoomEnd() async {
|
Future zoomEnd() async {
|
||||||
@@ -636,4 +649,37 @@ class FilamentControllerMethodChannel extends FilamentController {
|
|||||||
throw Exception("Failed to reveal mesh $meshName");
|
throw Exception("Failed to reveal mesh $meshName");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future destroy() {
|
||||||
|
// TODO: implement destroy
|
||||||
|
throw UnimplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void pick(int x, int y) {
|
||||||
|
// TODO: implement pick
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement pickResult
|
||||||
|
Stream<FilamentEntity?> get pickResult => throw UnimplementedError();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String? getNameForEntity(FilamentEntity entity) {
|
||||||
|
// TODO: implement getNameForEntity
|
||||||
|
throw UnimplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement textureDetails
|
||||||
|
TextureDetails? get textureDetails => throw UnimplementedError();
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement rendering
|
||||||
|
bool get rendering => throw UnimplementedError();
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement hasViewer
|
||||||
|
Stream<bool> get hasViewer => throw UnimplementedError();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,244 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/gestures.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'filament_controller.dart';
|
|
||||||
|
|
||||||
enum GestureType { RotateCamera, PanCamera, PanBackground }
|
|
||||||
|
|
||||||
class FilamentGestureDetector extends StatefulWidget {
|
|
||||||
final Widget? child;
|
|
||||||
final FilamentController controller;
|
|
||||||
final bool showControlOverlay;
|
|
||||||
final bool enableControls;
|
|
||||||
final double zoomDelta;
|
|
||||||
|
|
||||||
const FilamentGestureDetector(
|
|
||||||
{Key? key,
|
|
||||||
required this.controller,
|
|
||||||
this.child,
|
|
||||||
this.showControlOverlay = false,
|
|
||||||
this.enableControls = true,
|
|
||||||
this.zoomDelta = 1})
|
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<StatefulWidget> createState() => _FilamentGestureDetectorState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _FilamentGestureDetectorState extends State<FilamentGestureDetector> {
|
|
||||||
GestureType gestureType = GestureType.PanCamera;
|
|
||||||
|
|
||||||
final _icons = {
|
|
||||||
GestureType.PanBackground: Icons.image,
|
|
||||||
GestureType.PanCamera: Icons.pan_tool,
|
|
||||||
GestureType.RotateCamera: Icons.rotate_90_degrees_ccw
|
|
||||||
};
|
|
||||||
|
|
||||||
bool _rotating = false;
|
|
||||||
|
|
||||||
// to avoid duplicating code for pan/rotate (panStart, panUpdate, panEnd, rotateStart, rotateUpdate etc)
|
|
||||||
// we have only a single function for start/update/end.
|
|
||||||
// when the gesture type is changed, these properties are updated to point to the correct function.
|
|
||||||
late Function(double x, double y) _functionStart;
|
|
||||||
late Function(double x, double y) _functionUpdate;
|
|
||||||
late Function() _functionEnd;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
_setFunction();
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
void _setFunction() {
|
|
||||||
switch (gestureType) {
|
|
||||||
case GestureType.RotateCamera:
|
|
||||||
_functionStart = widget.controller.rotateStart;
|
|
||||||
_functionUpdate = widget.controller.rotateUpdate;
|
|
||||||
_functionEnd = widget.controller.rotateEnd;
|
|
||||||
break;
|
|
||||||
case GestureType.PanCamera:
|
|
||||||
_functionStart = widget.controller.panStart;
|
|
||||||
_functionUpdate = widget.controller.panUpdate;
|
|
||||||
_functionEnd = widget.controller.panEnd;
|
|
||||||
break;
|
|
||||||
// TODO
|
|
||||||
case GestureType.PanBackground:
|
|
||||||
_functionStart = (x, y) async {};
|
|
||||||
_functionUpdate = (x, y) async {};
|
|
||||||
_functionEnd = () async {};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void didUpdateWidget(FilamentGestureDetector oldWidget) {
|
|
||||||
if (widget.showControlOverlay != oldWidget.showControlOverlay ||
|
|
||||||
widget.enableControls != oldWidget.enableControls) {
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
|
|
||||||
super.didUpdateWidget(oldWidget);
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer? _scrollTimer;
|
|
||||||
|
|
||||||
Widget _desktop() {
|
|
||||||
return Listener(
|
|
||||||
onPointerSignal: !widget.enableControls
|
|
||||||
? null
|
|
||||||
: (pointerSignal) async {
|
|
||||||
// scroll-wheel zoom on desktop
|
|
||||||
if (pointerSignal is PointerScrollEvent) {
|
|
||||||
_scrollTimer?.cancel();
|
|
||||||
widget.controller.zoomBegin();
|
|
||||||
widget.controller.zoomUpdate(pointerSignal.scrollDelta.dy > 0
|
|
||||||
? widget.zoomDelta
|
|
||||||
: -widget.zoomDelta);
|
|
||||||
_scrollTimer = Timer(Duration(milliseconds: 100), () {
|
|
||||||
widget.controller.zoomEnd();
|
|
||||||
_scrollTimer = null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onPointerPanZoomStart: !widget.enableControls ? null : (pzs) {},
|
|
||||||
onPointerDown: !widget.enableControls
|
|
||||||
? null
|
|
||||||
: (d) async {
|
|
||||||
if (d.buttons == kTertiaryButton || _rotating) {
|
|
||||||
widget.controller.rotateStart(
|
|
||||||
d.position.dx * 2.0,
|
|
||||||
d.position.dy *
|
|
||||||
2.0); // multiply by 2.0 to account for pixel density, TODO don't hardcode
|
|
||||||
} else {
|
|
||||||
widget.controller
|
|
||||||
.panStart(d.localPosition.dx, d.localPosition.dy);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onPointerMove: !widget.enableControls
|
|
||||||
? null
|
|
||||||
: (PointerMoveEvent d) async {
|
|
||||||
if (d.buttons == kTertiaryButton || _rotating) {
|
|
||||||
widget.controller
|
|
||||||
.rotateUpdate(d.position.dx * 2.0, d.position.dy * 2.0);
|
|
||||||
} else {
|
|
||||||
widget.controller
|
|
||||||
.panUpdate(d.localPosition.dx, d.localPosition.dy);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onPointerUp: !widget.enableControls
|
|
||||||
? null
|
|
||||||
: (d) async {
|
|
||||||
if (d.buttons == kTertiaryButton || _rotating) {
|
|
||||||
widget.controller.rotateEnd();
|
|
||||||
} else {
|
|
||||||
widget.controller.panEnd();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: widget.child);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool _scaling = false;
|
|
||||||
double _lastScale = 0;
|
|
||||||
DateTime _lastUpdate = DateTime.now();
|
|
||||||
Widget _mobile() {
|
|
||||||
return GestureDetector(
|
|
||||||
behavior: HitTestBehavior.opaque,
|
|
||||||
onDoubleTap: () {
|
|
||||||
_rotating = !_rotating;
|
|
||||||
},
|
|
||||||
onScaleStart: !widget.enableControls
|
|
||||||
? null
|
|
||||||
: (d) async {
|
|
||||||
if (d.pointerCount == 2) {
|
|
||||||
_lastScale = 0;
|
|
||||||
_scaling = true;
|
|
||||||
widget.controller.zoomBegin();
|
|
||||||
} else if (!_scaling) {
|
|
||||||
if (_rotating) {
|
|
||||||
widget.controller
|
|
||||||
.rotateStart(d.focalPoint.dx, d.focalPoint.dy);
|
|
||||||
} else {
|
|
||||||
widget.controller
|
|
||||||
.panStart(d.focalPoint.dx, d.focalPoint.dy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onScaleEnd: !widget.enableControls
|
|
||||||
? null
|
|
||||||
: (d) async {
|
|
||||||
if (d.pointerCount == 2) {
|
|
||||||
widget.controller.zoomEnd();
|
|
||||||
_lastScale = 0;
|
|
||||||
_scaling = false;
|
|
||||||
} else if (!_scaling) {
|
|
||||||
if (_rotating) {
|
|
||||||
widget.controller.rotateEnd();
|
|
||||||
} else {
|
|
||||||
widget.controller.panEnd();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onScaleUpdate: !widget.enableControls
|
|
||||||
? null
|
|
||||||
: (ScaleUpdateDetails d) async {
|
|
||||||
if (d.pointerCount == 2) {
|
|
||||||
// var scale = d.horizontalScale - _lastScale;
|
|
||||||
// print(scale);
|
|
||||||
widget.controller
|
|
||||||
.zoomUpdate(d.horizontalScale > 1 ? 0.1 : -0.1);
|
|
||||||
_lastScale = d.horizontalScale;
|
|
||||||
} else if (!_scaling) {
|
|
||||||
if (_rotating) {
|
|
||||||
widget.controller
|
|
||||||
.rotateUpdate(d.focalPoint.dx, d.focalPoint.dy);
|
|
||||||
} else {
|
|
||||||
widget.controller
|
|
||||||
.panUpdate(d.focalPoint.dx, d.focalPoint.dy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: widget.child);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
late Widget controls;
|
|
||||||
if (kIsWeb) {
|
|
||||||
controls = Container();
|
|
||||||
} else if (Platform.isLinux || Platform.isWindows || Platform.isMacOS) {
|
|
||||||
controls = _desktop();
|
|
||||||
} else {
|
|
||||||
controls = _mobile();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Stack(children: [
|
|
||||||
Positioned.fill(
|
|
||||||
// pinch zoom on mobile
|
|
||||||
// couldn't find any equivalent for pointerCount in Listener so we use two widgets:
|
|
||||||
// - outer is a GestureDetector only for pinch zoom
|
|
||||||
// - inner is a Listener for all other gestures (including scroll zoom on desktop)
|
|
||||||
child: controls),
|
|
||||||
widget.showControlOverlay
|
|
||||||
? Align(
|
|
||||||
alignment: Alignment.bottomRight,
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
setState(() {
|
|
||||||
var curIdx = GestureType.values.indexOf(gestureType);
|
|
||||||
var nextIdx = curIdx == GestureType.values.length - 1
|
|
||||||
? 0
|
|
||||||
: curIdx + 1;
|
|
||||||
gestureType = GestureType.values[nextIdx];
|
|
||||||
_setFunction();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.all(50),
|
|
||||||
child: Icon(_icons[gestureType], color: Colors.green)),
|
|
||||||
))
|
|
||||||
: Container()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,210 +0,0 @@
|
|||||||
import 'dart:io';
|
|
||||||
import 'dart:math';
|
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter/rendering.dart';
|
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:flutter/scheduler.dart';
|
|
||||||
import 'package:polyvox_filament/filament_controller.dart';
|
|
||||||
|
|
||||||
import 'dart:async';
|
|
||||||
import 'filament_controller_method_channel.dart';
|
|
||||||
|
|
||||||
typedef ResizeCallback = void Function(Size oldSize, Size newSize);
|
|
||||||
|
|
||||||
class ResizeObserver extends SingleChildRenderObjectWidget {
|
|
||||||
final ResizeCallback onResized;
|
|
||||||
|
|
||||||
const ResizeObserver({
|
|
||||||
Key? key,
|
|
||||||
required this.onResized,
|
|
||||||
Widget? child,
|
|
||||||
}) : super(
|
|
||||||
key: key,
|
|
||||||
child: child,
|
|
||||||
);
|
|
||||||
|
|
||||||
@override
|
|
||||||
RenderObject createRenderObject(BuildContext context) =>
|
|
||||||
_RenderResizeObserver(onLayoutChangedCallback: onResized);
|
|
||||||
}
|
|
||||||
|
|
||||||
class _RenderResizeObserver extends RenderProxyBox {
|
|
||||||
final ResizeCallback onLayoutChangedCallback;
|
|
||||||
|
|
||||||
_RenderResizeObserver({
|
|
||||||
RenderBox? child,
|
|
||||||
required this.onLayoutChangedCallback,
|
|
||||||
}) : super(child);
|
|
||||||
|
|
||||||
late var _oldSize = size;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void performLayout() {
|
|
||||||
super.performLayout();
|
|
||||||
if (size != _oldSize) {
|
|
||||||
onLayoutChangedCallback(_oldSize, size);
|
|
||||||
_oldSize = size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class FilamentWidget extends StatefulWidget {
|
|
||||||
final FilamentController controller;
|
|
||||||
|
|
||||||
///
|
|
||||||
/// The content to render before the texture widget is available.
|
|
||||||
/// The default is a solid red Container, intentionally chosen to make it clear that there will be at least one frame where the Texture widget is not being rendered.
|
|
||||||
///
|
|
||||||
late final Widget initial;
|
|
||||||
final void Function()? onResize;
|
|
||||||
|
|
||||||
FilamentWidget(
|
|
||||||
{Key? key, required this.controller, this.onResize, Widget? initial})
|
|
||||||
: super(key: key) {
|
|
||||||
if (initial != null) {
|
|
||||||
this.initial = initial;
|
|
||||||
} else {
|
|
||||||
this.initial = Container(color: Colors.red);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
_FilamentWidgetState createState() => _FilamentWidgetState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _FilamentWidgetState extends State<FilamentWidget> {
|
|
||||||
StreamSubscription? _textureIdListener;
|
|
||||||
int? _textureId;
|
|
||||||
bool _resizing = false;
|
|
||||||
|
|
||||||
late final AppLifecycleListener _listener;
|
|
||||||
AppLifecycleState? _lastState;
|
|
||||||
|
|
||||||
Timer? _resizeTimer;
|
|
||||||
|
|
||||||
void _handleStateChange(AppLifecycleState state) async {
|
|
||||||
switch (state) {
|
|
||||||
case AppLifecycleState.detached:
|
|
||||||
print("Detached");
|
|
||||||
_textureId = null;
|
|
||||||
|
|
||||||
await widget.controller.destroyViewer();
|
|
||||||
await widget.controller.destroyTexture();
|
|
||||||
break;
|
|
||||||
case AppLifecycleState.hidden:
|
|
||||||
print("Hidden");
|
|
||||||
if (Platform.isIOS) {
|
|
||||||
_textureId = null;
|
|
||||||
await widget.controller.destroyViewer();
|
|
||||||
await widget.controller.destroyTexture();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case AppLifecycleState.inactive:
|
|
||||||
print("Inactive");
|
|
||||||
break;
|
|
||||||
case AppLifecycleState.paused:
|
|
||||||
print("Paused");
|
|
||||||
break;
|
|
||||||
case AppLifecycleState.resumed:
|
|
||||||
print("Resumed");
|
|
||||||
if (_textureId == null) {
|
|
||||||
var size = ((context.findRenderObject()) as RenderBox).size;
|
|
||||||
print("Size after resuming : $size");
|
|
||||||
await widget.controller
|
|
||||||
.createViewer(size.width.toInt(), size.height.toInt());
|
|
||||||
print("Created viewer Size after resuming");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
_lastState = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
_listener = AppLifecycleListener(
|
|
||||||
onStateChange: _handleStateChange,
|
|
||||||
);
|
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
|
||||||
// when attaching a debugger via Android Studio on startup, this can delay presentation of the widget
|
|
||||||
// (meaning the widget may attempt to create a viewer with size 0x0).
|
|
||||||
// we just add a small delay here which should avoid this
|
|
||||||
if (!kReleaseMode) {
|
|
||||||
await Future.delayed(Duration(seconds: 2));
|
|
||||||
}
|
|
||||||
var size = ((context.findRenderObject()) as RenderBox).size;
|
|
||||||
|
|
||||||
widget.controller.createViewer(size.width.toInt(), size.height.toInt());
|
|
||||||
});
|
|
||||||
|
|
||||||
_textureIdListener = widget.controller.textureId.listen((int? textureId) {
|
|
||||||
var size = ((context.findRenderObject()) as RenderBox).size;
|
|
||||||
print(
|
|
||||||
"Received new texture ID $textureId at size $size (current textureID $_textureId)");
|
|
||||||
setState(() {
|
|
||||||
_textureId = textureId;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_textureIdListener?.cancel();
|
|
||||||
_listener.dispose();
|
|
||||||
_resizeTimer?.cancel();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return LayoutBuilder(builder: ((context, constraints) {
|
|
||||||
if (_textureId == null) {
|
|
||||||
return widget.initial;
|
|
||||||
}
|
|
||||||
var texture = Texture(
|
|
||||||
key: ObjectKey("texture_$_textureId"),
|
|
||||||
textureId: _textureId!,
|
|
||||||
filterQuality: FilterQuality.none,
|
|
||||||
);
|
|
||||||
return SizedBox(
|
|
||||||
height: constraints.maxHeight,
|
|
||||||
width: constraints.maxWidth,
|
|
||||||
child: ResizeObserver(
|
|
||||||
onResized: (Size oldSize, Size newSize) async {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
||||||
if (!_resizing) {
|
|
||||||
setState(() {
|
|
||||||
_resizing = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
_resizeTimer?.cancel();
|
|
||||||
|
|
||||||
_resizeTimer = Timer(Duration(milliseconds: 500), () async {
|
|
||||||
await widget.controller
|
|
||||||
.resize(newSize.width.toInt(), newSize.height.toInt());
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
||||||
setState(() {
|
|
||||||
_resizing = false;
|
|
||||||
widget.onResize?.call();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: _resizing
|
|
||||||
? Container()
|
|
||||||
: Platform.isLinux || Platform.isWindows
|
|
||||||
? Transform(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
transform: Matrix4.rotationX(
|
|
||||||
pi), // TODO - this rotation is due to OpenGL texture coordinate working in a different space from Flutter, can we move this to the C++ side somewhere?
|
|
||||||
child: texture)
|
|
||||||
: texture));
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,11 +23,13 @@ class NativeLibrary {
|
|||||||
ffi.Pointer<ffi.Void> context,
|
ffi.Pointer<ffi.Void> context,
|
||||||
ffi.Pointer<ResourceLoaderWrapper> loader,
|
ffi.Pointer<ResourceLoaderWrapper> loader,
|
||||||
ffi.Pointer<ffi.Void> platform,
|
ffi.Pointer<ffi.Void> platform,
|
||||||
|
ffi.Pointer<ffi.Char> uberArchivePath,
|
||||||
) {
|
) {
|
||||||
return _create_filament_viewer(
|
return _create_filament_viewer(
|
||||||
context,
|
context,
|
||||||
loader,
|
loader,
|
||||||
platform,
|
platform,
|
||||||
|
uberArchivePath,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,10 +38,14 @@ class NativeLibrary {
|
|||||||
ffi.Pointer<ffi.Void> Function(
|
ffi.Pointer<ffi.Void> Function(
|
||||||
ffi.Pointer<ffi.Void>,
|
ffi.Pointer<ffi.Void>,
|
||||||
ffi.Pointer<ResourceLoaderWrapper>,
|
ffi.Pointer<ResourceLoaderWrapper>,
|
||||||
ffi.Pointer<ffi.Void>)>>('create_filament_viewer');
|
ffi.Pointer<ffi.Void>,
|
||||||
|
ffi.Pointer<ffi.Char>)>>('create_filament_viewer');
|
||||||
late final _create_filament_viewer = _create_filament_viewerPtr.asFunction<
|
late final _create_filament_viewer = _create_filament_viewerPtr.asFunction<
|
||||||
ffi.Pointer<ffi.Void> Function(ffi.Pointer<ffi.Void>,
|
ffi.Pointer<ffi.Void> Function(
|
||||||
ffi.Pointer<ResourceLoaderWrapper>, ffi.Pointer<ffi.Void>)>();
|
ffi.Pointer<ffi.Void>,
|
||||||
|
ffi.Pointer<ResourceLoaderWrapper>,
|
||||||
|
ffi.Pointer<ffi.Void>,
|
||||||
|
ffi.Pointer<ffi.Char>)>();
|
||||||
|
|
||||||
void destroy_filament_viewer(
|
void destroy_filament_viewer(
|
||||||
ffi.Pointer<ffi.Void> viewer,
|
ffi.Pointer<ffi.Void> viewer,
|
||||||
@@ -108,8 +114,8 @@ class NativeLibrary {
|
|||||||
|
|
||||||
late final _create_render_targetPtr = _lookup<
|
late final _create_render_targetPtr = _lookup<
|
||||||
ffi.NativeFunction<
|
ffi.NativeFunction<
|
||||||
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int, ffi.Int,
|
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.IntPtr, ffi.Uint32,
|
||||||
ffi.Int)>>('create_render_target');
|
ffi.Uint32)>>('create_render_target');
|
||||||
late final _create_render_target = _create_render_targetPtr
|
late final _create_render_target = _create_render_targetPtr
|
||||||
.asFunction<void Function(ffi.Pointer<ffi.Void>, int, int, int)>();
|
.asFunction<void Function(ffi.Pointer<ffi.Void>, int, int, int)>();
|
||||||
|
|
||||||
@@ -320,7 +326,7 @@ class NativeLibrary {
|
|||||||
ffi.NativeFunction<
|
ffi.NativeFunction<
|
||||||
EntityId Function(
|
EntityId Function(
|
||||||
ffi.Pointer<ffi.Void>,
|
ffi.Pointer<ffi.Void>,
|
||||||
ffi.Int,
|
ffi.Uint8,
|
||||||
ffi.Float,
|
ffi.Float,
|
||||||
ffi.Float,
|
ffi.Float,
|
||||||
ffi.Float,
|
ffi.Float,
|
||||||
@@ -464,7 +470,7 @@ class NativeLibrary {
|
|||||||
ffi.NativeFunction<
|
ffi.NativeFunction<
|
||||||
ffi.Void Function(
|
ffi.Void Function(
|
||||||
ffi.Pointer<ffi.Void>,
|
ffi.Pointer<ffi.Void>,
|
||||||
ffi.Int,
|
ffi.Uint64,
|
||||||
ffi.Pointer<ffi.Void>,
|
ffi.Pointer<ffi.Void>,
|
||||||
ffi.Pointer<
|
ffi.Pointer<
|
||||||
ffi.NativeFunction<
|
ffi.NativeFunction<
|
||||||
@@ -499,7 +505,7 @@ class NativeLibrary {
|
|||||||
late final _create_swap_chainPtr = _lookup<
|
late final _create_swap_chainPtr = _lookup<
|
||||||
ffi.NativeFunction<
|
ffi.NativeFunction<
|
||||||
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>,
|
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>,
|
||||||
ffi.Int, ffi.Int)>>('create_swap_chain');
|
ffi.Uint32, ffi.Uint32)>>('create_swap_chain');
|
||||||
late final _create_swap_chain = _create_swap_chainPtr.asFunction<
|
late final _create_swap_chain = _create_swap_chainPtr.asFunction<
|
||||||
void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int, int)>();
|
void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int, int)>();
|
||||||
|
|
||||||
@@ -550,7 +556,7 @@ class NativeLibrary {
|
|||||||
|
|
||||||
late final _update_viewport_and_camera_projectionPtr = _lookup<
|
late final _update_viewport_and_camera_projectionPtr = _lookup<
|
||||||
ffi.NativeFunction<
|
ffi.NativeFunction<
|
||||||
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int, ffi.Int,
|
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Uint32, ffi.Uint32,
|
||||||
ffi.Float)>>('update_viewport_and_camera_projection');
|
ffi.Float)>>('update_viewport_and_camera_projection');
|
||||||
late final _update_viewport_and_camera_projection =
|
late final _update_viewport_and_camera_projection =
|
||||||
_update_viewport_and_camera_projectionPtr
|
_update_viewport_and_camera_projectionPtr
|
||||||
@@ -1298,6 +1304,61 @@ class NativeLibrary {
|
|||||||
late final _reveal_mesh = _reveal_meshPtr.asFunction<
|
late final _reveal_mesh = _reveal_meshPtr.asFunction<
|
||||||
int Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>)>();
|
int Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>)>();
|
||||||
|
|
||||||
|
void set_post_processing(
|
||||||
|
ffi.Pointer<ffi.Void> viewer,
|
||||||
|
bool enabled,
|
||||||
|
) {
|
||||||
|
return _set_post_processing(
|
||||||
|
viewer,
|
||||||
|
enabled,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
late final _set_post_processingPtr = _lookup<
|
||||||
|
ffi
|
||||||
|
.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Bool)>>(
|
||||||
|
'set_post_processing');
|
||||||
|
late final _set_post_processing = _set_post_processingPtr
|
||||||
|
.asFunction<void Function(ffi.Pointer<ffi.Void>, bool)>();
|
||||||
|
|
||||||
|
void pick(
|
||||||
|
ffi.Pointer<ffi.Void> viewer,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
ffi.Pointer<EntityId> entityId,
|
||||||
|
) {
|
||||||
|
return _pick(
|
||||||
|
viewer,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
entityId,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
late final _pickPtr = _lookup<
|
||||||
|
ffi.NativeFunction<
|
||||||
|
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int, ffi.Int,
|
||||||
|
ffi.Pointer<EntityId>)>>('pick');
|
||||||
|
late final _pick = _pickPtr.asFunction<
|
||||||
|
void Function(ffi.Pointer<ffi.Void>, int, int, ffi.Pointer<EntityId>)>();
|
||||||
|
|
||||||
|
ffi.Pointer<ffi.Char> get_name_for_entity(
|
||||||
|
ffi.Pointer<ffi.Void> assetManager,
|
||||||
|
int entityId,
|
||||||
|
) {
|
||||||
|
return _get_name_for_entity(
|
||||||
|
assetManager,
|
||||||
|
entityId,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
late final _get_name_for_entityPtr = _lookup<
|
||||||
|
ffi.NativeFunction<
|
||||||
|
ffi.Pointer<ffi.Char> Function(
|
||||||
|
ffi.Pointer<ffi.Void>, EntityId)>>('get_name_for_entity');
|
||||||
|
late final _get_name_for_entity = _get_name_for_entityPtr
|
||||||
|
.asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>, int)>();
|
||||||
|
|
||||||
void ios_dummy() {
|
void ios_dummy() {
|
||||||
return _ios_dummy();
|
return _ios_dummy();
|
||||||
}
|
}
|
||||||
@@ -1309,6 +1370,7 @@ class NativeLibrary {
|
|||||||
ffi.Pointer<ffi.Void> create_filament_viewer_ffi(
|
ffi.Pointer<ffi.Void> create_filament_viewer_ffi(
|
||||||
ffi.Pointer<ffi.Void> context,
|
ffi.Pointer<ffi.Void> context,
|
||||||
ffi.Pointer<ffi.Void> platform,
|
ffi.Pointer<ffi.Void> platform,
|
||||||
|
ffi.Pointer<ffi.Char> uberArchivePath,
|
||||||
ffi.Pointer<ResourceLoaderWrapper> loader,
|
ffi.Pointer<ResourceLoaderWrapper> loader,
|
||||||
ffi.Pointer<
|
ffi.Pointer<
|
||||||
ffi.NativeFunction<
|
ffi.NativeFunction<
|
||||||
@@ -1319,6 +1381,7 @@ class NativeLibrary {
|
|||||||
return _create_filament_viewer_ffi(
|
return _create_filament_viewer_ffi(
|
||||||
context,
|
context,
|
||||||
platform,
|
platform,
|
||||||
|
uberArchivePath,
|
||||||
loader,
|
loader,
|
||||||
renderCallback,
|
renderCallback,
|
||||||
renderCallbackOwner,
|
renderCallbackOwner,
|
||||||
@@ -1330,6 +1393,7 @@ class NativeLibrary {
|
|||||||
ffi.Pointer<ffi.Void> Function(
|
ffi.Pointer<ffi.Void> Function(
|
||||||
ffi.Pointer<ffi.Void>,
|
ffi.Pointer<ffi.Void>,
|
||||||
ffi.Pointer<ffi.Void>,
|
ffi.Pointer<ffi.Void>,
|
||||||
|
ffi.Pointer<ffi.Char>,
|
||||||
ffi.Pointer<ResourceLoaderWrapper>,
|
ffi.Pointer<ResourceLoaderWrapper>,
|
||||||
ffi.Pointer<
|
ffi.Pointer<
|
||||||
ffi.NativeFunction<
|
ffi.NativeFunction<
|
||||||
@@ -1341,6 +1405,7 @@ class NativeLibrary {
|
|||||||
ffi.Pointer<ffi.Void> Function(
|
ffi.Pointer<ffi.Void> Function(
|
||||||
ffi.Pointer<ffi.Void>,
|
ffi.Pointer<ffi.Void>,
|
||||||
ffi.Pointer<ffi.Void>,
|
ffi.Pointer<ffi.Void>,
|
||||||
|
ffi.Pointer<ffi.Char>,
|
||||||
ffi.Pointer<ResourceLoaderWrapper>,
|
ffi.Pointer<ResourceLoaderWrapper>,
|
||||||
ffi.Pointer<
|
ffi.Pointer<
|
||||||
ffi.NativeFunction<
|
ffi.NativeFunction<
|
||||||
@@ -1365,10 +1430,24 @@ class NativeLibrary {
|
|||||||
late final _create_swap_chain_ffiPtr = _lookup<
|
late final _create_swap_chain_ffiPtr = _lookup<
|
||||||
ffi.NativeFunction<
|
ffi.NativeFunction<
|
||||||
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>,
|
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>,
|
||||||
ffi.Int, ffi.Int)>>('create_swap_chain_ffi');
|
ffi.Uint32, ffi.Uint32)>>('create_swap_chain_ffi');
|
||||||
late final _create_swap_chain_ffi = _create_swap_chain_ffiPtr.asFunction<
|
late final _create_swap_chain_ffi = _create_swap_chain_ffiPtr.asFunction<
|
||||||
void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int, int)>();
|
void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int, int)>();
|
||||||
|
|
||||||
|
void destroy_swap_chain_ffi(
|
||||||
|
ffi.Pointer<ffi.Void> viewer,
|
||||||
|
) {
|
||||||
|
return _destroy_swap_chain_ffi(
|
||||||
|
viewer,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
late final _destroy_swap_chain_ffiPtr =
|
||||||
|
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>(
|
||||||
|
'destroy_swap_chain_ffi');
|
||||||
|
late final _destroy_swap_chain_ffi = _destroy_swap_chain_ffiPtr
|
||||||
|
.asFunction<void Function(ffi.Pointer<ffi.Void>)>();
|
||||||
|
|
||||||
void create_render_target_ffi(
|
void create_render_target_ffi(
|
||||||
ffi.Pointer<ffi.Void> viewer,
|
ffi.Pointer<ffi.Void> viewer,
|
||||||
int nativeTextureId,
|
int nativeTextureId,
|
||||||
@@ -1385,8 +1464,8 @@ class NativeLibrary {
|
|||||||
|
|
||||||
late final _create_render_target_ffiPtr = _lookup<
|
late final _create_render_target_ffiPtr = _lookup<
|
||||||
ffi.NativeFunction<
|
ffi.NativeFunction<
|
||||||
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int, ffi.Int,
|
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.IntPtr, ffi.Uint32,
|
||||||
ffi.Int)>>('create_render_target_ffi');
|
ffi.Uint32)>>('create_render_target_ffi');
|
||||||
late final _create_render_target_ffi = _create_render_target_ffiPtr
|
late final _create_render_target_ffi = _create_render_target_ffiPtr
|
||||||
.asFunction<void Function(ffi.Pointer<ffi.Void>, int, int, int)>();
|
.asFunction<void Function(ffi.Pointer<ffi.Void>, int, int, int)>();
|
||||||
|
|
||||||
@@ -1481,7 +1560,7 @@ class NativeLibrary {
|
|||||||
|
|
||||||
late final _update_viewport_and_camera_projection_ffiPtr = _lookup<
|
late final _update_viewport_and_camera_projection_ffiPtr = _lookup<
|
||||||
ffi.NativeFunction<
|
ffi.NativeFunction<
|
||||||
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int, ffi.Int,
|
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Uint32, ffi.Uint32,
|
||||||
ffi.Float)>>('update_viewport_and_camera_projection_ffi');
|
ffi.Float)>>('update_viewport_and_camera_projection_ffi');
|
||||||
late final _update_viewport_and_camera_projection_ffi =
|
late final _update_viewport_and_camera_projection_ffi =
|
||||||
_update_viewport_and_camera_projection_ffiPtr
|
_update_viewport_and_camera_projection_ffiPtr
|
||||||
@@ -1698,7 +1777,7 @@ class NativeLibrary {
|
|||||||
ffi.NativeFunction<
|
ffi.NativeFunction<
|
||||||
EntityId Function(
|
EntityId Function(
|
||||||
ffi.Pointer<ffi.Void>,
|
ffi.Pointer<ffi.Void>,
|
||||||
ffi.Int,
|
ffi.Uint8,
|
||||||
ffi.Float,
|
ffi.Float,
|
||||||
ffi.Float,
|
ffi.Float,
|
||||||
ffi.Float,
|
ffi.Float,
|
||||||
@@ -2080,25 +2159,6 @@ class NativeLibrary {
|
|||||||
late final _get_animation_name_ffi = _get_animation_name_ffiPtr.asFunction<
|
late final _get_animation_name_ffi = _get_animation_name_ffiPtr.asFunction<
|
||||||
void Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>, int)>();
|
void Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>, int)>();
|
||||||
|
|
||||||
double get_animation_duration_ffi(
|
|
||||||
ffi.Pointer<ffi.Void> assetManager,
|
|
||||||
int asset,
|
|
||||||
int index,
|
|
||||||
) {
|
|
||||||
return _get_animation_duration_ffi(
|
|
||||||
assetManager,
|
|
||||||
asset,
|
|
||||||
index,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
late final _get_animation_duration_ffiPtr = _lookup<
|
|
||||||
ffi.NativeFunction<
|
|
||||||
ffi.Float Function(ffi.Pointer<ffi.Void>, EntityId,
|
|
||||||
ffi.Int)>>('get_animation_duration_ffi');
|
|
||||||
late final _get_animation_duration_ffi = _get_animation_duration_ffiPtr
|
|
||||||
.asFunction<double Function(ffi.Pointer<ffi.Void>, int, int)>();
|
|
||||||
|
|
||||||
void get_morph_target_name_ffi(
|
void get_morph_target_name_ffi(
|
||||||
ffi.Pointer<ffi.Void> assetManager,
|
ffi.Pointer<ffi.Void> assetManager,
|
||||||
int asset,
|
int asset,
|
||||||
@@ -2148,6 +2208,44 @@ class NativeLibrary {
|
|||||||
_get_morph_target_name_count_ffiPtr.asFunction<
|
_get_morph_target_name_count_ffiPtr.asFunction<
|
||||||
int Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>)>();
|
int Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>)>();
|
||||||
|
|
||||||
|
void set_post_processing_ffi(
|
||||||
|
ffi.Pointer<ffi.Void> viewer,
|
||||||
|
bool enabled,
|
||||||
|
) {
|
||||||
|
return _set_post_processing_ffi(
|
||||||
|
viewer,
|
||||||
|
enabled,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
late final _set_post_processing_ffiPtr = _lookup<
|
||||||
|
ffi
|
||||||
|
.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Bool)>>(
|
||||||
|
'set_post_processing_ffi');
|
||||||
|
late final _set_post_processing_ffi = _set_post_processing_ffiPtr
|
||||||
|
.asFunction<void Function(ffi.Pointer<ffi.Void>, bool)>();
|
||||||
|
|
||||||
|
void pick_ffi(
|
||||||
|
ffi.Pointer<ffi.Void> viewer,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
ffi.Pointer<EntityId> entityId,
|
||||||
|
) {
|
||||||
|
return _pick_ffi(
|
||||||
|
viewer,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
entityId,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
late final _pick_ffiPtr = _lookup<
|
||||||
|
ffi.NativeFunction<
|
||||||
|
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int, ffi.Int,
|
||||||
|
ffi.Pointer<EntityId>)>>('pick_ffi');
|
||||||
|
late final _pick_ffi = _pick_ffiPtr.asFunction<
|
||||||
|
void Function(ffi.Pointer<ffi.Void>, int, int, ffi.Pointer<EntityId>)>();
|
||||||
|
|
||||||
void ios_dummy_ffi() {
|
void ios_dummy_ffi() {
|
||||||
return _ios_dummy_ffi();
|
return _ios_dummy_ffi();
|
||||||
}
|
}
|
||||||
@@ -2157,13 +2255,105 @@ class NativeLibrary {
|
|||||||
late final _ios_dummy_ffi = _ios_dummy_ffiPtr.asFunction<void Function()>();
|
late final _ios_dummy_ffi = _ios_dummy_ffiPtr.asFunction<void Function()>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final class __mbstate_t extends ffi.Union {
|
||||||
|
@ffi.Array.multi([128])
|
||||||
|
external ffi.Array<ffi.Char> __mbstate8;
|
||||||
|
|
||||||
|
@ffi.LongLong()
|
||||||
|
external int _mbstateL;
|
||||||
|
}
|
||||||
|
|
||||||
|
final class __darwin_pthread_handler_rec extends ffi.Struct {
|
||||||
|
external ffi
|
||||||
|
.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>
|
||||||
|
__routine;
|
||||||
|
|
||||||
|
external ffi.Pointer<ffi.Void> __arg;
|
||||||
|
|
||||||
|
external ffi.Pointer<__darwin_pthread_handler_rec> __next;
|
||||||
|
}
|
||||||
|
|
||||||
|
final class _opaque_pthread_attr_t extends ffi.Struct {
|
||||||
|
@ffi.Long()
|
||||||
|
external int __sig;
|
||||||
|
|
||||||
|
@ffi.Array.multi([56])
|
||||||
|
external ffi.Array<ffi.Char> __opaque;
|
||||||
|
}
|
||||||
|
|
||||||
|
final class _opaque_pthread_cond_t extends ffi.Struct {
|
||||||
|
@ffi.Long()
|
||||||
|
external int __sig;
|
||||||
|
|
||||||
|
@ffi.Array.multi([40])
|
||||||
|
external ffi.Array<ffi.Char> __opaque;
|
||||||
|
}
|
||||||
|
|
||||||
|
final class _opaque_pthread_condattr_t extends ffi.Struct {
|
||||||
|
@ffi.Long()
|
||||||
|
external int __sig;
|
||||||
|
|
||||||
|
@ffi.Array.multi([8])
|
||||||
|
external ffi.Array<ffi.Char> __opaque;
|
||||||
|
}
|
||||||
|
|
||||||
|
final class _opaque_pthread_mutex_t extends ffi.Struct {
|
||||||
|
@ffi.Long()
|
||||||
|
external int __sig;
|
||||||
|
|
||||||
|
@ffi.Array.multi([56])
|
||||||
|
external ffi.Array<ffi.Char> __opaque;
|
||||||
|
}
|
||||||
|
|
||||||
|
final class _opaque_pthread_mutexattr_t extends ffi.Struct {
|
||||||
|
@ffi.Long()
|
||||||
|
external int __sig;
|
||||||
|
|
||||||
|
@ffi.Array.multi([8])
|
||||||
|
external ffi.Array<ffi.Char> __opaque;
|
||||||
|
}
|
||||||
|
|
||||||
|
final class _opaque_pthread_once_t extends ffi.Struct {
|
||||||
|
@ffi.Long()
|
||||||
|
external int __sig;
|
||||||
|
|
||||||
|
@ffi.Array.multi([8])
|
||||||
|
external ffi.Array<ffi.Char> __opaque;
|
||||||
|
}
|
||||||
|
|
||||||
|
final class _opaque_pthread_rwlock_t extends ffi.Struct {
|
||||||
|
@ffi.Long()
|
||||||
|
external int __sig;
|
||||||
|
|
||||||
|
@ffi.Array.multi([192])
|
||||||
|
external ffi.Array<ffi.Char> __opaque;
|
||||||
|
}
|
||||||
|
|
||||||
|
final class _opaque_pthread_rwlockattr_t extends ffi.Struct {
|
||||||
|
@ffi.Long()
|
||||||
|
external int __sig;
|
||||||
|
|
||||||
|
@ffi.Array.multi([16])
|
||||||
|
external ffi.Array<ffi.Char> __opaque;
|
||||||
|
}
|
||||||
|
|
||||||
|
final class _opaque_pthread_t extends ffi.Struct {
|
||||||
|
@ffi.Long()
|
||||||
|
external int __sig;
|
||||||
|
|
||||||
|
external ffi.Pointer<__darwin_pthread_handler_rec> __cleanup_stack;
|
||||||
|
|
||||||
|
@ffi.Array.multi([8176])
|
||||||
|
external ffi.Array<ffi.Char> __opaque;
|
||||||
|
}
|
||||||
|
|
||||||
final class ResourceBuffer extends ffi.Struct {
|
final class ResourceBuffer extends ffi.Struct {
|
||||||
external ffi.Pointer<ffi.Void> data;
|
external ffi.Pointer<ffi.Void> data;
|
||||||
|
|
||||||
@ffi.Int()
|
@ffi.Int32()
|
||||||
external int size;
|
external int size;
|
||||||
|
|
||||||
@ffi.Int()
|
@ffi.Int32()
|
||||||
external int id;
|
external int id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2189,7 +2379,10 @@ typedef LoadFilamentResourceFromOwner = ffi.Pointer<
|
|||||||
typedef FreeFilamentResourceFromOwner = ffi.Pointer<
|
typedef FreeFilamentResourceFromOwner = ffi.Pointer<
|
||||||
ffi
|
ffi
|
||||||
.NativeFunction<ffi.Void Function(ResourceBuffer, ffi.Pointer<ffi.Void>)>>;
|
.NativeFunction<ffi.Void Function(ResourceBuffer, ffi.Pointer<ffi.Void>)>>;
|
||||||
typedef EntityId = ffi.Int;
|
|
||||||
|
/// This header replicates most of the methods in PolyvoxFilamentApi.h, and is only intended to be used to generate client FFI bindings.
|
||||||
|
/// The intention is that calling one of these methods will call its respective method in PolyvoxFilamentApi.h, but wrapped in some kind of thread runner to ensure thread safety.
|
||||||
|
typedef EntityId = ffi.Int32;
|
||||||
typedef FilamentRenderCallback = ffi.Pointer<
|
typedef FilamentRenderCallback = ffi.Pointer<
|
||||||
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void> owner)>>;
|
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void> owner)>>;
|
||||||
|
|
||||||
@@ -2198,3 +2391,179 @@ const int __bool_true_false_are_defined = 1;
|
|||||||
const int true1 = 1;
|
const int true1 = 1;
|
||||||
|
|
||||||
const int false1 = 0;
|
const int false1 = 0;
|
||||||
|
|
||||||
|
const int __DARWIN_ONLY_64_BIT_INO_T = 1;
|
||||||
|
|
||||||
|
const int __DARWIN_ONLY_UNIX_CONFORMANCE = 1;
|
||||||
|
|
||||||
|
const int __DARWIN_ONLY_VERS_1050 = 1;
|
||||||
|
|
||||||
|
const int __DARWIN_UNIX03 = 1;
|
||||||
|
|
||||||
|
const int __DARWIN_64_BIT_INO_T = 1;
|
||||||
|
|
||||||
|
const int __DARWIN_VERS_1050 = 1;
|
||||||
|
|
||||||
|
const int __DARWIN_NON_CANCELABLE = 0;
|
||||||
|
|
||||||
|
const String __DARWIN_SUF_EXTSN = '\$DARWIN_EXTSN';
|
||||||
|
|
||||||
|
const int __DARWIN_C_ANSI = 4096;
|
||||||
|
|
||||||
|
const int __DARWIN_C_FULL = 900000;
|
||||||
|
|
||||||
|
const int __DARWIN_C_LEVEL = 900000;
|
||||||
|
|
||||||
|
const int __STDC_WANT_LIB_EXT1__ = 1;
|
||||||
|
|
||||||
|
const int __DARWIN_NO_LONG_LONG = 0;
|
||||||
|
|
||||||
|
const int _DARWIN_FEATURE_64_BIT_INODE = 1;
|
||||||
|
|
||||||
|
const int _DARWIN_FEATURE_ONLY_64_BIT_INODE = 1;
|
||||||
|
|
||||||
|
const int _DARWIN_FEATURE_ONLY_VERS_1050 = 1;
|
||||||
|
|
||||||
|
const int _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE = 1;
|
||||||
|
|
||||||
|
const int _DARWIN_FEATURE_UNIX_CONFORMANCE = 3;
|
||||||
|
|
||||||
|
const int __has_ptrcheck = 0;
|
||||||
|
|
||||||
|
const int __DARWIN_NULL = 0;
|
||||||
|
|
||||||
|
const int __PTHREAD_SIZE__ = 8176;
|
||||||
|
|
||||||
|
const int __PTHREAD_ATTR_SIZE__ = 56;
|
||||||
|
|
||||||
|
const int __PTHREAD_MUTEXATTR_SIZE__ = 8;
|
||||||
|
|
||||||
|
const int __PTHREAD_MUTEX_SIZE__ = 56;
|
||||||
|
|
||||||
|
const int __PTHREAD_CONDATTR_SIZE__ = 8;
|
||||||
|
|
||||||
|
const int __PTHREAD_COND_SIZE__ = 40;
|
||||||
|
|
||||||
|
const int __PTHREAD_ONCE_SIZE__ = 8;
|
||||||
|
|
||||||
|
const int __PTHREAD_RWLOCK_SIZE__ = 192;
|
||||||
|
|
||||||
|
const int __PTHREAD_RWLOCKATTR_SIZE__ = 16;
|
||||||
|
|
||||||
|
const int __DARWIN_WCHAR_MAX = 2147483647;
|
||||||
|
|
||||||
|
const int __DARWIN_WCHAR_MIN = -2147483648;
|
||||||
|
|
||||||
|
const int __DARWIN_WEOF = -1;
|
||||||
|
|
||||||
|
const int _FORTIFY_SOURCE = 2;
|
||||||
|
|
||||||
|
const int NULL = 0;
|
||||||
|
|
||||||
|
const int USER_ADDR_NULL = 0;
|
||||||
|
|
||||||
|
const int __WORDSIZE = 64;
|
||||||
|
|
||||||
|
const int INT8_MAX = 127;
|
||||||
|
|
||||||
|
const int INT16_MAX = 32767;
|
||||||
|
|
||||||
|
const int INT32_MAX = 2147483647;
|
||||||
|
|
||||||
|
const int INT64_MAX = 9223372036854775807;
|
||||||
|
|
||||||
|
const int INT8_MIN = -128;
|
||||||
|
|
||||||
|
const int INT16_MIN = -32768;
|
||||||
|
|
||||||
|
const int INT32_MIN = -2147483648;
|
||||||
|
|
||||||
|
const int INT64_MIN = -9223372036854775808;
|
||||||
|
|
||||||
|
const int UINT8_MAX = 255;
|
||||||
|
|
||||||
|
const int UINT16_MAX = 65535;
|
||||||
|
|
||||||
|
const int UINT32_MAX = 4294967295;
|
||||||
|
|
||||||
|
const int UINT64_MAX = -1;
|
||||||
|
|
||||||
|
const int INT_LEAST8_MIN = -128;
|
||||||
|
|
||||||
|
const int INT_LEAST16_MIN = -32768;
|
||||||
|
|
||||||
|
const int INT_LEAST32_MIN = -2147483648;
|
||||||
|
|
||||||
|
const int INT_LEAST64_MIN = -9223372036854775808;
|
||||||
|
|
||||||
|
const int INT_LEAST8_MAX = 127;
|
||||||
|
|
||||||
|
const int INT_LEAST16_MAX = 32767;
|
||||||
|
|
||||||
|
const int INT_LEAST32_MAX = 2147483647;
|
||||||
|
|
||||||
|
const int INT_LEAST64_MAX = 9223372036854775807;
|
||||||
|
|
||||||
|
const int UINT_LEAST8_MAX = 255;
|
||||||
|
|
||||||
|
const int UINT_LEAST16_MAX = 65535;
|
||||||
|
|
||||||
|
const int UINT_LEAST32_MAX = 4294967295;
|
||||||
|
|
||||||
|
const int UINT_LEAST64_MAX = -1;
|
||||||
|
|
||||||
|
const int INT_FAST8_MIN = -128;
|
||||||
|
|
||||||
|
const int INT_FAST16_MIN = -32768;
|
||||||
|
|
||||||
|
const int INT_FAST32_MIN = -2147483648;
|
||||||
|
|
||||||
|
const int INT_FAST64_MIN = -9223372036854775808;
|
||||||
|
|
||||||
|
const int INT_FAST8_MAX = 127;
|
||||||
|
|
||||||
|
const int INT_FAST16_MAX = 32767;
|
||||||
|
|
||||||
|
const int INT_FAST32_MAX = 2147483647;
|
||||||
|
|
||||||
|
const int INT_FAST64_MAX = 9223372036854775807;
|
||||||
|
|
||||||
|
const int UINT_FAST8_MAX = 255;
|
||||||
|
|
||||||
|
const int UINT_FAST16_MAX = 65535;
|
||||||
|
|
||||||
|
const int UINT_FAST32_MAX = 4294967295;
|
||||||
|
|
||||||
|
const int UINT_FAST64_MAX = -1;
|
||||||
|
|
||||||
|
const int INTPTR_MAX = 9223372036854775807;
|
||||||
|
|
||||||
|
const int INTPTR_MIN = -9223372036854775808;
|
||||||
|
|
||||||
|
const int UINTPTR_MAX = -1;
|
||||||
|
|
||||||
|
const int INTMAX_MAX = 9223372036854775807;
|
||||||
|
|
||||||
|
const int UINTMAX_MAX = -1;
|
||||||
|
|
||||||
|
const int INTMAX_MIN = -9223372036854775808;
|
||||||
|
|
||||||
|
const int PTRDIFF_MIN = -9223372036854775808;
|
||||||
|
|
||||||
|
const int PTRDIFF_MAX = 9223372036854775807;
|
||||||
|
|
||||||
|
const int SIZE_MAX = -1;
|
||||||
|
|
||||||
|
const int RSIZE_MAX = 9223372036854775807;
|
||||||
|
|
||||||
|
const int WCHAR_MAX = 2147483647;
|
||||||
|
|
||||||
|
const int WCHAR_MIN = -2147483648;
|
||||||
|
|
||||||
|
const int WINT_MIN = -2147483648;
|
||||||
|
|
||||||
|
const int WINT_MAX = 2147483647;
|
||||||
|
|
||||||
|
const int SIG_ATOMIC_MIN = -2147483648;
|
||||||
|
|
||||||
|
const int SIG_ATOMIC_MAX = 2147483647;
|
||||||
|
|||||||
69
lib/widgets/filament_gesture_detector.dart
Normal file
69
lib/widgets/filament_gesture_detector.dart
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/gestures.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:polyvox_filament/widgets/filament_gesture_detector_desktop.dart';
|
||||||
|
import 'package:polyvox_filament/widgets/filament_gesture_detector_mobile.dart';
|
||||||
|
import '../filament_controller.dart';
|
||||||
|
|
||||||
|
enum GestureType { RotateCamera, PanCamera, PanBackground }
|
||||||
|
|
||||||
|
///
|
||||||
|
/// A widget that translates finger/mouse gestures to zoom/pan/rotate actions.
|
||||||
|
///
|
||||||
|
class FilamentGestureDetector extends StatelessWidget {
|
||||||
|
///
|
||||||
|
/// The content to display below the gesture detector/listener widget.
|
||||||
|
/// This will usually be a FilamentWidget (so you can navigate by directly interacting with the viewport), but this is not necessary.
|
||||||
|
/// It is equally possible to render the viewport/gesture controls elsewhere in the widget hierarchy. The only requirement is that they share the same [FilamentController].
|
||||||
|
///
|
||||||
|
final Widget? child;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// The [controller] attached to the [FilamentWidget] you wish to control.
|
||||||
|
///
|
||||||
|
final FilamentController controller;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// If true, an overlay will be shown with buttons to toggle whether pointer movements are interpreted as:
|
||||||
|
/// 1) rotate or a pan (mobile only),
|
||||||
|
/// 2) moving the camera or the background image (TODO).
|
||||||
|
///
|
||||||
|
final bool showControlOverlay;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// If false, all gestures will be ignored.
|
||||||
|
///
|
||||||
|
final bool listenerEnabled;
|
||||||
|
|
||||||
|
const FilamentGestureDetector(
|
||||||
|
{Key? key,
|
||||||
|
required this.controller,
|
||||||
|
this.child,
|
||||||
|
this.showControlOverlay = false,
|
||||||
|
this.listenerEnabled = true})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (kIsWeb) {
|
||||||
|
throw Exception("TODO");
|
||||||
|
} else if (Platform.isLinux || Platform.isWindows || Platform.isMacOS) {
|
||||||
|
return FilamentGestureDetectorDesktop(
|
||||||
|
controller: controller,
|
||||||
|
child: child,
|
||||||
|
showControlOverlay: showControlOverlay,
|
||||||
|
listenerEnabled: listenerEnabled,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return FilamentGestureDetectorMobile(
|
||||||
|
controller: controller,
|
||||||
|
child: child,
|
||||||
|
showControlOverlay: showControlOverlay,
|
||||||
|
listenerEnabled: listenerEnabled,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user