Compare commits

..

28 Commits

Author SHA1 Message Date
Nick Fisher
5dec13f00b chore(release): publish packages
- thermion_dart@0.1.1+5
 - thermion_flutter_web@0.0.1+9
 - thermion_flutter@0.1.1+10
 - thermion_flutter_platform_interface@0.1.0+9
 - thermion_flutter_ffi@0.1.0+9
2024-07-04 14:44:04 +08:00
Nick Fisher
7464c05483 Merge pull request #55 from nmfisher/develop
feat: shadows, web, docs, image material
2024-07-04 16:42:25 +10:00
Nick Fisher
7b97b2e6c3 save fetched resources to IndexedDB on web 2024-07-04 14:19:37 +08:00
Nick Fisher
168f46cf56 add shadow methods to wasm/js viewers 2024-07-04 14:19:04 +08:00
Nick Fisher
5622b0ce9f chore(release): publish packages
- thermion_dart@0.1.1+4
 - thermion_flutter_web@0.0.1+8
 - thermion_flutter@0.1.1+9
 - thermion_flutter_platform_interface@0.1.0+8
 - thermion_flutter_ffi@0.1.0+8
2024-07-02 16:18:17 +08:00
Nick Fisher
c7a0b2f5cc fix: defer creating image entity/material/etc until actually requested
feat: expose shadow options
2024-07-02 16:17:36 +08:00
Nick Fisher
7546b2a6c5 Merge pull request #51 from payl-ampa/patch-1
Update quickstart.mdx - Simple link fix
2024-06-30 16:15:39 +10:00
Paul Ampadu
e363c82f2d Update quickstart.mdx
Simple link fix
2024-06-29 00:13:59 -07:00
Nick Fisher
b9643dbd94 Merge pull request #49 from nmfisher/develop
docs: Update docs
2024-06-28 00:03:18 +10:00
Nick Fisher
2664e08eb3 update README 2024-06-27 21:57:23 +08:00
Nick Fisher
733ba7d439 docs: add discord link 2024-06-27 21:52:34 +08:00
Nick Fisher
2255be3a86 Merge pull request #48 from nmfisher/develop
docs: update docs
2024-06-27 23:47:10 +10:00
Nick Fisher
03f8e2e353 docs: update docs 2024-06-27 21:46:06 +08:00
Nick Fisher
be1bf3f3ca Merge pull request #47 from nmfisher/develop
docs: update docs with sidebar links
2024-06-27 23:36:22 +10:00
Nick Fisher
5f1334660e docs: update docs with sidebar links 2024-06-27 21:35:44 +08:00
Nick Fisher
ec381f43ef Merge pull request #46 from nmfisher/develop
Documentation
2024-06-27 23:16:10 +10:00
Nick Fisher
eba843535b docs: update quickstart 2024-06-27 21:15:13 +08:00
Nick Fisher
4fa286bd60 docs: update links 2024-06-27 21:14:23 +08:00
Nick Fisher
7293b0f8dd Merge pull request #45 from nmfisher/develop
Documentation
2024-06-27 23:13:20 +10:00
Nick Fisher
0279ee1985 doc: update head README 2024-06-27 21:12:16 +08:00
Nick Fisher
83053c60f9 Merge pull request #44 from nmfisher/develop
Merge develop
2024-06-27 23:10:51 +10:00
Nick Fisher
ad28e5484c chore(release): publish packages
- thermion_dart@0.1.1+3
 - thermion_flutter@0.1.1+8
 - thermion_flutter_web@0.0.1+7
 - thermion_flutter_platform_interface@0.1.0+7
 - thermion_flutter_ffi@0.1.0+7
2024-06-27 21:06:46 +08:00
Nick Fisher
b91d629b90 docs: update homepage links and minor documentation updates 2024-06-27 21:05:44 +08:00
Nick Fisher
96df3a0f35 chore: remove binary filamat files from repo 2024-06-26 15:50:22 +10:00
Nick Fisher
de8fb5e2d0 docs: remove old GETTING_STARTED and update quickstart with new repo link 2024-06-26 15:49:11 +10:00
Nick Fisher
51d79c7626 fix: bump ffigen dependency version & regenerate bindings (and revert to ffi.Int rather than ffi.Int32) 2024-06-26 12:46:56 +08:00
Nick Fisher
f7c22d2480 docs: update quickstart 2024-06-26 12:46:56 +08:00
Nick Fisher
b117a4a19c chore: move examples to separate repository 2024-06-26 12:46:56 +08:00
431 changed files with 979 additions and 15337 deletions

View File

@@ -3,6 +3,112 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## 2024-07-04
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`thermion_dart` - `v0.1.1+5`](#thermion_dart---v0115)
- [`thermion_flutter_web` - `v0.0.1+9`](#thermion_flutter_web---v0019)
- [`thermion_flutter` - `v0.1.1+10`](#thermion_flutter---v01110)
- [`thermion_flutter_platform_interface` - `v0.1.0+9`](#thermion_flutter_platform_interface---v0109)
- [`thermion_flutter_ffi` - `v0.1.0+9`](#thermion_flutter_ffi---v0109)
Packages with dependency updates only:
> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project.
- `thermion_flutter_web` - `v0.0.1+9`
- `thermion_flutter` - `v0.1.1+10`
- `thermion_flutter_platform_interface` - `v0.1.0+9`
- `thermion_flutter_ffi` - `v0.1.0+9`
---
#### `thermion_dart` - `v0.1.1+5`
- Bump "thermion_dart" to `0.1.1+5`.
## 2024-07-02
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`thermion_dart` - `v0.1.1+4`](#thermion_dart---v0114)
- [`thermion_flutter_web` - `v0.0.1+8`](#thermion_flutter_web---v0018)
- [`thermion_flutter` - `v0.1.1+9`](#thermion_flutter---v0119)
- [`thermion_flutter_platform_interface` - `v0.1.0+8`](#thermion_flutter_platform_interface---v0108)
- [`thermion_flutter_ffi` - `v0.1.0+8`](#thermion_flutter_ffi---v0108)
Packages with dependency updates only:
> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project.
- `thermion_flutter_web` - `v0.0.1+8`
- `thermion_flutter` - `v0.1.1+9`
- `thermion_flutter_platform_interface` - `v0.1.0+8`
- `thermion_flutter_ffi` - `v0.1.0+8`
---
#### `thermion_dart` - `v0.1.1+4`
- **FIX**: defer creating image entity/material/etc until actually requested.
## 2024-06-27
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`thermion_dart` - `v0.1.1+3`](#thermion_dart---v0113)
- [`thermion_flutter` - `v0.1.1+8`](#thermion_flutter---v0118)
- [`thermion_flutter_web` - `v0.0.1+7`](#thermion_flutter_web---v0017)
- [`thermion_flutter_platform_interface` - `v0.1.0+7`](#thermion_flutter_platform_interface---v0107)
- [`thermion_flutter_ffi` - `v0.1.0+7`](#thermion_flutter_ffi---v0107)
Packages with dependency updates only:
> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project.
- `thermion_flutter_web` - `v0.0.1+7`
- `thermion_flutter_platform_interface` - `v0.1.0+7`
- `thermion_flutter_ffi` - `v0.1.0+7`
---
#### `thermion_dart` - `v0.1.1+3`
- **FIX**: bump ffigen dependency version & regenerate bindings (and revert to ffi.Int rather than ffi.Int32).
- **DOCS**: update homepage links and minor documentation updates.
#### `thermion_flutter` - `v0.1.1+8`
- **DOCS**: update homepage links and minor documentation updates.
## 2024-06-26
### Changes

View File

@@ -1,38 +0,0 @@
# Thermion
Thermion is a package for creating 3D applications with Dart and/or Flutter.
## Overview
### Packages 
The two most relevant Thermion packages are:- [thermion_dart], which contains all the code needed to create a viewer, - [thermion_flutter], which is a Flutter-only package that contains all the logic necessary to create/embed a rendering surface inside a Flutter app. 
By decoupling the Flutter-specific components from the Dart-only components, Thermion can be used for rendering in both Flutter and non-Flutter applications. As far as the latter is concerned, Thermion ships with examples for  Javascript/WASM/HTML, and for CLI/headless mode on MacOS. 
### pubspec.yaml
If you are creating a Flutter application, add [thermion_flutter] as a dependency to your `pubspec.yaml`.
```$ cd /path/to/your/flutter/project$ flutter pub add thermion_flutter```
### ThermionFlutterPlugin
Create an instance of `ThermionFlutterPlugin` in your app.
```dart
class _MyAppState extends State<MyApp> {
  late ThermionFlutterPlugin _thermionFlutterPlugin;  late Future<ThermionViewer> _thermionViewer;
  void initState() {    _thermionFlutterPlugin = ThermionFlutterPlugin();    _thermionViewer = _thermionFlutterPlugin.createViewer();  }}```
`ThermionFlutterPlugin` is a singleton, and mostly just handles creating a 3D rendering surface that can be embedded in a Flutter widget hierarchy.  [ThermionViewer] is the interface for actually interacting with the scene (loading assets, manipulating the camera, and so on). Call `createViewer` on `ThermionFlutterPlugin` to obtain a reference to `ThermionViewer` (which is also a singleton).
Note: `ThermionFlutterPlugin` and `ThermionViewer` were designed as separate classes so we can use `ThermionViewer` in non-Flutter apps.
### ThermionWidget
On most platforms[0], [ThermionWidget] is the widget where your rendered content (i.e. your viewport) will appear. This can be any size; the 3D viewport will be scaled to fit the dimensions on this widget. On most platforms, a [ThermionWidget] can be positioned above or below any other widget in the hierarchy and the Z-order will be preserved.
```class _MyAppState extends State<MyApp> {
  late ThermionFlutterPlugin _thermionFlutterPlugin;  late Future<ThermionViewer> _thermionViewer;
  void initState() {    _thermionFlutterPlugin = ThermionFlutterPlugin();    _thermionViewer = _thermionFlutterPlugin.createViewer();  }    Widget build(BuildContext context) {       return Stack(children:[      Positioned.fill(        child:ThermionWidget(          plugin:_thermionFlutterPlugin        )      )    ]);  }}```
[0] Currently, the rendering surface on Windows and Web will always appear at the bottom of the application. You still need a ThermionWidget, but this only keeps track of the dimensions of your viewport and punches a transparent hole in the hierarchy; the actual rendering surface is attached beneath the Flutter window.
`ThermionWidget` will not display the rendering surface (even an empty one) until the call to `createViewer` has been completed.
- 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 ThermionWidget constructor.on the second frame, ThermionWidget will pass its dimensions/pixel ratio to the FilamentController
 You can then call createViewer to create:the rendering surface (on most platforms, a backing texture that will be registered with Flutter for use in a Texture widget)a rendering threada ThermionViewerFFI and an AssetManager, which will allow you to load assets/cameras/lighting/etc via the FilamentControllerafter an indeterminate number of frames, FilamentController will notify ThermionWidget when a rendering surface is available the viewportThermionWidget will replace the default initial Widget with the viewport (which will initially be solid black or white, depending on your platform).IMPORTANT: there will be a delay between adding a ThermionWidget, calling createViewer and the actual rendering viewport becoming available. This is why we fill ThermionWidget with red - to make it abundantly clear that you need to handle this asynchronous delay appropriately. Once createViewer has completed, the viewport is available for rendering.
Currently, the initial widget will also be displayed whenever the viewport is resized (including changing orientation on mobile and drag-to-resize on desktop). You probably want to change this from the default red.
Congratulations! You now have a scene. It's completely empty, so you probably want to add something visible.

View File

@@ -1,14 +1,14 @@
![Thermion Logo](docs/logo.png)
<p align="center">
<a href="https://docs.page/nmfisher/thermion/quickstart">Quickstart (Flutter)</a> •
<a href="https://docs.page/nmfisher/thermion">Documentation</a> •
<a href="https://docs.page/nmfisher/thermion/examples">Showcase</a> •
<a href="https://thermion.dev/quickstart">Quickstart (Flutter)</a> •
<a href="https://thermion.dev/">Documentation</a> •
<a href="https://thermion.dev/examples">Showcase</a> •
<a href="https://dartpad.thermion.dev/">Playground</a> •
<a href="https://discord.gg/h2VdDK3EAQ">Discord</a>
</p>
## Cross-platform 3D engine for Dart and Flutter.
## Cross-platform 3D toolkit for Dart and Flutter.
<a href="https://pub.dev/packages/thermion_dart"><img src="https://img.shields.io/pub/v/thermion_dart?label=pub.dev&labelColor=333940&logo=dart&color=00589B" alt="pub"></a>
<a href="https://github.com/nmfisher/thermion"><img src="https://img.shields.io/github/stars/nmfisher/flutter_filament?style=flat&label=stars&labelColor=333940&color=8957e5&logo=github" alt="github"></a>
@@ -24,7 +24,7 @@
### Sponsors, Contributors & Acknowledgments
Thermion uses the [Filament](https://github.com/google/filament) physically based rendering package under the hood.
Thermion uses the [Filament](https://github.com/google/filament) Physically Based Rendering engine under the hood.
Special thanks to [odd-io](https://github.com/odd-io/) for sponsoring work on supporting Windows, raycasting, testing and documentation.

View File

@@ -7,14 +7,16 @@
"Getting Started",
[
["Overview", "/"],
["Quick Start", "/quickstart"],
["Playground", "https://dartpad.thermion.dev"]
["Quick Start", "/quickstart"]
]
],
["Misc.", [
["Playground", "https://dartpad.thermion.dev"],
["Examples", "/examples"],
["Windows", "/windows"],
["Android", "/android"],
["Contributing", "/contributing"]
["Contributing", "/contributing"],
["Discord", "https://discord.gg/h2VdDK3EAQ"]
]]
]

View File

@@ -1 +0,0 @@
# Another Page

View File

@@ -1,10 +1,10 @@
## Contributing
Thermion is an open source project and we welcome all contributions from every level of experience.
Thermion is an open source project and all contributions are welcome, no matter the level of experience.
Please [join us on Discord](https://discord.gg/h2VdDK3EAQ) if you'd like some guidance or just want to chat.
##
Note that the Thermion project uses [Melos](https://melos.invertase.dev/) to manage the repository.
We are now using [Melos](https://melos.invertase.dev/) to manage the repository. This lets us auto-generate changelogs & versioning from commit messages, so if you wish to submit a PR, please use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
This lets us auto-generate changelogs & versioning from commit messages, so if you wish to submit a PR, please use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).

View File

@@ -1,8 +1,16 @@
# Examples
Thermion is a package for creating 3D applications with Dart and/or Flutter.
## Showcase
## DartPad Playground
A custom DartPad that lets you experiment with Thermion from your browser (currently, only Chrome is supported).
[![Screenshot of Thermion Dartpad](images/dartpad.thermion.dev_.png)](https://dartpad.thermion.dev)
## Nick Fisher
My personal website, where I create an interactive clone of myself with Avaturn & Cartesia (no Flutter, made with Thermion and the [Jaspr Dart UI framework](https://github.com/schultek/jaspr)).
[![Screenshot of Nick Fisher's personal website](images/nick-fisher.com.png)](https://nick-fisher.com)
## Polyvox
iOS app
## Nick Fisher (Personal Website)

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 KiB

View File

@@ -4,6 +4,10 @@ Thermion is a framework for creating cross-platform 3D applications with Dart an
## Overview
Below is a general overview of how the Thermion packages are structured to ensure a clean separation between the general Dart components, and the Flutter specific components.
If you want a more detailed explanation of how to start rendering 3D content inside a Flutter app, [click here to view the quickstart page](/quickstart).
### Package structure 
Thermion is divided into two packages:
@@ -18,8 +22,39 @@ For example, Thermion ships with examples for rendering with Dart only (no Flutt
### ThermionViewer (`thermion_dart`)
// TODO
The ThermionViewer class provides an API for creating and interacting with 3D scenes powered by the Filament rendering engine.
It allows loading 3D models in glTF format, adding lights and a skybox, manipulating the camera, animating objects, and more.
Key functionalities include:
- Scene Management: Load and manipulate entities, lights, skyboxes, and background elements within a 3D scene.
- Rendering Control: Manage rendering loop, frame rate, and post-processing effects like tone mapping and bloom.
- Camera Control: Position and orient the camera, adjust focal length, and control exposure settings.
- Animation: Play, pause, and manipulate skeletal and morph target animations.
- Entity Manipulation: Transform entities (position, rotation, scale), set material properties, and manage parent-child relationships.
- Collision Detection (experimental): Add collision components to entities and test for collisions within the scene.
- Input Handling: Interact with the scene using touch gestures for panning, rotating, and zooming.
- Developers use the ThermionViewer class to build and control the behavior of their 3D applications.
### ThermionFlutterPlugin
The ThermionFlutterPlugin class handles the platform-specific initialization required to embed a Filament rendering surface within a Flutter Widget.
This includes creating a texture and managing the application lifecycle to pause rendering when the app is inactive.
You will generally only need to interact with `ThermionFlutterPlugin` directly to create or dispose of a ThermionViewer.
### ThermionWidget (`thermion_flutter`)
// TODO
`ThermionWidget` is a Flutter widget that displays the 3D content rendered by a ThermionViewer.
It handles creating and managing the underlying platform-specific texture that Filament renders to, and provides a way to embed this texture within the Flutter widget tree.
Key features of ThermionWidget include:
- Texture Management: It creates, resizes, and destroys the ThermionFlutterTexture used to display the rendered content from the ThermionViewer.
- Platform Adaption: It handles platform-specific differences, such as texture coordinate systems, to ensure consistent rendering across different platforms.
- Initialization Handling: Displays a placeholder (configurable via the initial property) while the Filament texture is being initialized, providing a smoother user experience.
- Seamless Integration: Integrates seamlessly within the Flutter widget tree, allowing developers to combine 2D and 3D content easily.
- Resize Handling: It listens for resize events and automatically resizes the underlying texture to match, ensuring the 3D content scales correctly.

View File

@@ -1,11 +1,12 @@
## Quickstart (Flutter)
> You can find the entire project below in the [examples/flutter/quickstart](examples/flutter/quickstart) folder of the repository.
> You can find the entire project below in the [flutter/quickstart](https://github.com/nmfisher/thermion_examples/tree/master/flutter/quickstart) folder of the `thermion_examples` repository.
1. Switch to Flutter master channel, create a new project, then add `thermion_flutter` as a dependency
1. Switch to Flutter master channel, upgrade Flutter, create a new project, then add `thermion_flutter` as a dependency
```bash
$ flutter channel master
$ flutter upgrade
$ flutter config --enable-native-assets
$ flutter create thermion_sample_project && cd thermion_sample_project
$ flutter pub add thermion_flutter
@@ -13,7 +14,7 @@ $ flutter pub add thermion_flutter
2. If running on iOS or MacOS, change the minimum deployment target to OSX 13
<Accordion title="Click to iOS/MacOS instructions">
<Accordion title="Click to open iOS/MacOS instructions">
Make sure the `platform` entry refers to `13.0` in your Podfile.
@@ -38,6 +39,11 @@ and change the minimum deployment target to 13.0:
</Accordion>
<Accordion title="Click to open Windows instructions">
See the [/windows](/Windows) page for steps needed to build on Windows.
</Accordion>
2. Add a folder containing your assets (glTF model + skybox ktx) to your `pubspec.yaml` asset list
```yaml
@@ -70,18 +76,21 @@ class _MyAppState extends State<MyApp> {
class _MyAppState extends State<MyApp> {
late ThermionFlutterPlugin _thermionFlutterPlugin; 
late Future<ThermionViewer> _thermionViewer;
ThermionViewer? _thermionViewer;
void initState() {   
_thermionFlutterPlugin = ThermionFlutterPlugin();
_thermionViewer = _thermionFlutterPlugin.initialize();
_thermionFlutterPlugin.createViewer().then((viewer) {
setState(() {
_thermionViewer = viewer;
});
});
}   
Widget build(BuildContext context) {
return Stack(children:[
if(_thermionViewer != null)
    Positioned.fill(
child:ThermionWidget(
plugin:_thermionFlutterPlugin
plugin:_thermionViewer!
        ) 
    )
    ]); 
@@ -104,11 +113,12 @@ class _MyAppState extends State<MyApp> {
Widget build(BuildContext context) {
return Stack(children:[
    if(_thermionViewer != null)
    Positioned.fill(
child:ThermionWidget(
plugin:_thermionFlutterPlugin
plugin:_thermionViewer!
        ) 
    ),
    ),
if (!_loaded)
Center(
child: ElevatedButton(
@@ -208,4 +218,4 @@ $ flutter run -d macos
![Screenshot of Thermion Quickstart project](images/thermion_sample_project.png)
Your first Thermion project is complete!
Your first Thermion project is complete!

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4a1d72d69da8b933bde5453ef2000612b561f8ddfa536a7ad89288ef11eb876d
size 1624

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fe0151ced8fd8609f9692f3d62dbd30890dada97cb6995572e37c7e7b4440d86
size 21304

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0f8b793f6513cf83f80ce9c63c7b51d329908b1991f17ca642911634b15b32de
size 34172

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2aafaedba913b3c5642907e4fc57f5fcd2f4f4deb0a5a6c9ad17ef2b0ae2ed1f
size 1810780

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ea5425c972afb40de5b0c5caa1ae121c51592143245c4e8a39273ac26ca19d01
size 232514

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f6d208315a0b37935face8f9b159ee3bdf44d3b95bcfdf441d1725f6c81d0faa
size 543635

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e5f3a5f2deb2abd7382905a2fb483071f610152f1433eecc527dc8d8ded1c98b
size 1680

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1c9fe38941e09e853ab8410a84a0336d0fc1e2733a4a2b8571e5b5e47b5fd30c
size 876491

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e57477f5e57d6e3381051367dd05425327643c7bd19a972a1172275ecc675106
size 1501226

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:999903752cd80ca12b074117942a7128c1c84d27edc8cc773bb15a7f7ddcdcb9
size 197691

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d88568b3463f21a96400cd265286fbb26accdef3a11dbeb65e9faf824a441e4e
size 3868939

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a34c5fdd0696d1679f5f0464f8fdfc5f012dc2be435046218158bed1bed0f7cb
size 1369811

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8de472e97570c33f0945bb38e97fea2af779e972e21d0226145060ab3ec83fd2
size 512354

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:df391e772b5ff04540d5187cdf01d5cb04adf661931b2ccbe8744909b0954100
size 628316

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:20dec60f67ea38b14ac45ae2490ddd4bbf5c108f842e244a5fe3f90c7010cc7f
size 468148

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a8b61da658f891a244ffba8a293b0b4dcf384893f99c6bcaa4ab653f981de853
size 501824

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7b05a4cf63ea1c614a9385cdb902c62bad324eccbb87a6c9e3370da2b6f36f2d
size 14565

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8e5567daf7a3ac83f6ebc04605f3605ac17c19a153b6b8aadd2596690209c34c
size 2778518

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fd1207967131afbe2fa523c9f4bae1f6dbce1a8fdd0ebfad5ec0cf7ba6a66dc1
size 5348302

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7729882e59bc227554d1b26ffd6494bbd37357ee37ac959fad2932b16d586f79
size 825327

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3c8bd17cfddecede5a3fa9e1933ac6f309ce4cc6bc85d4122b9ae39b0ba2b0d8
size 2990685

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7987620b2a90887fa1a0521bf72f84933a2eadca88965f47599204dd55dae62a
size 3974850

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7acaed3775bb6246c266c8e3dcd803391a08a528b727781bf11559f016752f61
size 3185146

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:573a3d39db8a109352d16a421aff316d37faeb52f6abf01d0ca72db279bde7d9
size 5708074

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:13e867927da090fe696248e0d884087a7d4e310dca8315cd8d4d686b95db7aef
size 17805

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3506c43687bf4bd441eef301b157761574c2edecab6c8af6b8e6a85b772abe15
size 3713769

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c34919581290d71a541697454ef9200d3f693236e8e9ddac89b49fa83c3befd9
size 3702691

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7fe00edcc79fb3266f7fe61ddb3fbf08f425b731985af7543bc5b677414cbf19
size 4591738

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c6f75cb920285d4b0eb1f087bc79e70d31b1801c3df4edba294351516fa98953
size 5304637

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:32afd5ae0da2f2880fc85753b993a6945da1993f4087e562f2f75e107ecbf2f3
size 755081

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c15354b40ef4f79b83d16d6aaa37cfd7654a8e281ef5e5dc5a25934d55f16f7a
size 3748216

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c821ef0709398d8bc3cccfa311572fb45d4d9198514155f940936019ad0f32fd
size 4489618

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0bc81c711f74fdfd2ef56e34d747383444a3ab6a1ee52fe62cb5838e59b0be56
size 545

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:620bfa644724e9914df19949346ad0f441357fbb176879421d66b4377705836b
size 1048644

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bedb625eca04a9abba66d1521efda591819212e44cef0ab2438631596902140c
size 585493

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0245800fa846c2a3c15cb1d2aa6ded86fcf8355e568907dcd50e073c589f85d6
size 2095464

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:40379fcd881ca3729b0fa057f66b8fedbd8ab92b8e407bc3a4fd17c1a2b6e75e
size 1572932

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5821c53850d84c5b2d0b39ad28e6cde94d8fc7e1bbb97d5d898c40733e2d4e99
size 107424

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d9134594e40a4bad7601d0396bb5f2a7600656bda5d815b3cb2e855ba6c6c5e4
size 1263808

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ab0cada556723be0d138d7b1cadb5e315a273524db0468e0c4255d8d2b0c1c2d
size 1222992

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6c58d82602dc9b4dabb63f378fecd7ecb9eaf6f5da5746552ec42dde4ec211d7
size 121104

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0c1d3eac0151a58c3f36bea0f636691559612fd2d5ce21bb3551d43e86043e26
size 36741

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b58c687c2687f5b3b576e4f5672981fde5657519f51dd331e6e671634c77640f
size 29920

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c07d5f3b06fb763d74e4d6afa2ff933d8953e8f73828320d0c34c2105e346d97
size 38119

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2033d3f7f8e0af983d8ab237737b45db2ed476b9283c6b0fda6a6954e1a72dea
size 294

View File

@@ -1,3 +0,0 @@
# https://dart.dev/guides/libraries/private-files
# Created by `dart pub`
.dart_tool/

View File

@@ -1,3 +0,0 @@
## 1.0.0
- Initial version.

View File

@@ -1,2 +0,0 @@
A sample command-line application with an entrypoint in `bin/`, library code
in `lib/`, and example unit test in `test/`.

View File

@@ -1,30 +0,0 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
#
# If you want a smaller set of lints you can change this to specify
# 'package:lints/core.yaml'. These are just the most critical lints
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.
include: package:lints/recommended.yaml
# Uncomment the following section to specify additional rules.
# linter:
# rules:
# - camel_case_types
# analyzer:
# exclude:
# - path/to/excluded/files/**
# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints
# For additional information about configuring this file, see
# https://dart.dev/guides/language/analysis-options

View File

@@ -1 +0,0 @@
../../../assets

View File

@@ -1,46 +0,0 @@
import 'dart:io';
import 'package:thermion_dart/thermion_dart/compatibility/compatibility.dart';
import 'package:thermion_dart/thermion_dart/swift/swift_bindings.g.dart';
import 'package:thermion_dart/thermion_dart/compatibility/compatibility.dart';
import 'package:thermion_dart/thermion_dart/utils/dart_resources.dart';
import 'package:ffi/ffi.dart';
import 'package:thermion_dart/thermion_dart.dart';
void main() async {
var scriptDir = File(Platform.script.toFilePath()).parent.path;
final lib = ThermionDartTexture1(
DynamicLibrary.open("$scriptDir/libthermion_swift.dylib"));
final object = ThermionDartTexture.new1(lib);
object.initWithWidth_height_(500, 500);
final resourceLoader = calloc<ResourceLoaderWrapper>(1);
var loadToOut = NativeCallable<
Void Function(Pointer<Char>,
Pointer<ResourceBuffer>)>.listener(DartResourceLoader.loadResource);
resourceLoader.ref.loadToOut = loadToOut.nativeFunction;
var freeResource = NativeCallable<Void Function(ResourceBuffer)>.listener(
DartResourceLoader.freeResource);
resourceLoader.ref.freeResource = freeResource.nativeFunction;
var viewer = ThermionViewerFFI(resourceLoader: resourceLoader.cast<Void>());
await viewer.initialized;
await viewer.createSwapChain(500, 500);
await viewer.createRenderTarget(500, 500, object.metalTextureAddress);
await viewer.updateViewportAndCameraProjection(500, 500);
var outDir = Directory("$scriptDir/output");
if (outDir.existsSync()) {
outDir.deleteSync(recursive: true);
}
outDir.createSync();
await viewer.setRecordingOutputDirectory(outDir.path);
await viewer.setRecording(true);
await viewer.loadSkybox(
"file:///$scriptDir/assets/default_env/default_env_skybox.ktx");
await Future.delayed(Duration(milliseconds: 16));
await viewer.render();
await viewer.dispose();
}

View File

@@ -1 +0,0 @@
../../../../thermion_dart/native/lib/macos/swift/libthermion_swift.dylib

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

View File

@@ -1,18 +0,0 @@
name: example_cli
description: A sample command-line application.
version: 1.0.0
# repository: https://github.com/my_org/my_repo
environment:
sdk: ^3.3.0
# Add regular dependencies here.
dependencies:
thermion_dart:
path: ../../../thermion_dart
ffi:
dev_dependencies:
ffigen: ^11.0.0
lints: ^3.0.0
test: ^1.24.0

View File

@@ -1,8 +0,0 @@
import 'package:example_cli/example_cli.dart';
import 'package:test/test.dart';
void main() {
test('calculate', () {
expect(calculate(), 42);
});
}

View File

@@ -1,3 +0,0 @@
# https://dart.dev/guides/libraries/private-files
# Created by `dart pub`
.dart_tool/

View File

@@ -1,3 +0,0 @@
## 1.0.0
- Initial version.

View File

@@ -1,2 +0,0 @@
A sample command-line application with an entrypoint in `bin/`, library code
in `lib/`, and example unit test in `test/`.

View File

@@ -1,30 +0,0 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
#
# If you want a smaller set of lints you can change this to specify
# 'package:lints/core.yaml'. These are just the most critical lints
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.
include: package:lints/recommended.yaml
# Uncomment the following section to specify additional rules.
# linter:
# rules:
# - camel_case_types
# analyzer:
# exclude:
# - path/to/excluded/files/**
# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints
# For additional information about configuring this file, see
# https://dart.dev/guides/language/analysis-options

View File

@@ -1,4 +0,0 @@
example_cli.mjs
example_cli.wasm
example_cli.unopt.wasm
node_modules/**/*

View File

@@ -1,98 +0,0 @@
MAIN
initializing
gto uberarchive ptr
create void ptr callback
resolve
try
done, returning
created
got promise [object Promise]
got fn ptr address 2720
Calling create_filament_viewer_ffi
Call complete
Created viewer, waiting for initialization
Creating WebGL context.
Created WebGL context 2.0
Made WebGL context current
FEngine (32 bits) created at 0x1937d0 (threading is disabled)
[stack-gl], [ANGLE], [OpenGL ES 3.0 (WebGL 1.0 stack-gl 8.0.2)], [OpenGL ES GLSL ES 1.00 (WebGL GLSL ES 1.0 stack-gl)]
Feature level: 1
Active workarounds:
Backend feature level: 1
FEngine feature level: 1
Set frame interval to 16.666666
Setting tone mapping to ACES
Bloom is disabled on WebGL builds as it causes instability with certain drivers. setBloom will be ignored
View created
Camera aperture 16.000000 shutter 0.008000 sensitivity 100.000000
Created ubershader provider.
Added imageEntity 6
Got void ptr callback
Set viewer to true
Created viewer 1652064
Initialied
Loading GLB from buffer of length 116948
Loaded glb
Entities : [10, 11, 12]
entityName : Cone
Getting morpht arget names
No insdtance
Using asset instance
Getting morpht arget names
No insdtance
Using asset instance
Getting morpht arget names
No insdtance
Using asset instance
Getting morpht arget names
No insdtance
Using asset instance
Getting morpht arget names
No insdtance
Using asset instance
Getting morpht arget names
No insdtance
Using asset instance
Getting morpht arget names
No insdtance
Using asset instance
Getting morpht arget names
No insdtance
Using asset instance
Getting morpht arget names
No insdtance
Using asset instance
morph targets : [Key 1, Key 2, Key 3, Key 4, Key 5, Key 6, Key 7, Key 8]
entityName : Cube
Getting morpht arget names
No insdtance
Using asset instance
Getting morpht arget names
No insdtance
Using asset instance
Getting morpht arget names
No insdtance
Using asset instance
morph targets : [Key 1, Key 2]
entityName : Cylinder
Getting morpht arget names
No insdtance
Using asset instance
Getting morpht arget names
No insdtance
Using asset instance
Getting morpht arget names
No insdtance
Using asset instance
Getting morpht arget names
No insdtance
Using asset instance
Getting morpht arget names
No insdtance
Using asset instance
morph targets : [Key 1, Key 2, Key 3, Key 4]

View File

@@ -1,33 +0,0 @@
import 'package:thermion_dart/thermion_dart/compatibility/compatibility.dart';
import 'package:thermion_dart/thermion_dart.dart';
import 'package:animation_tools_dart/animation_tools_dart.dart';
void main(List<String> args) async {
final resourceLoader = thermion_dart_web_get_resource_loader_wrapper();
var viewer = ThermionViewerFFI(resourceLoader: resourceLoader.cast<Void>());
viewer.initialized.then((_) async {
var entity = await viewer.loadGlb(
"/Users/nickfisher/Documents/polyvox/apps/packages/thermion_flutter/thermion_flutter_federated/thermion_flutter/example/assets/shapes/shapes.glb");
var entities = await viewer.getChildEntities(entity, true);
for (final childEntity in entities) {
final childName = await viewer.getNameForEntity(childEntity);
var morphTargetNames =
await viewer.getMorphTargetNames(entity, childEntity!);
if (morphTargetNames.isNotEmpty) {
await viewer.setMorphTargetWeights(
childEntity, List<double>.filled(morphTargetNames.length, 1.0));
}
var animationData = MorphAnimationData(
List.generate(
10, (_) => List<double>.filled(morphTargetNames.length, 1.0)),
morphTargetNames);
await viewer.setMorphAnimationData(entity, animationData,
targetMeshNames: [childName!]);
}
});
while (true) {
await Future.delayed(Duration(seconds: 1));
}
}

View File

@@ -1,123 +0,0 @@
const fs = require('node:fs');
const thermion_dart = require("./thermion_dart.js")
const GLctx = require('gl')(100, 100, { preserveDrawingBuffer: true })
// queueMicrotask = (func) => {
// func();
// }
// read('thermion_dart.wasm', 'binary')
// const exports = {};
// const module = {};
const wasmBuffer = fs.readFileSync('thermion_dart.wasm');
var dartFilamentModulePromise = WebAssembly.compile(wasmBuffer);
let globalDf;
thermion_dart({
dartFilamentResolveCallback: (cb, data) => {
const fn = globalDf.wasmTable.get(cb);
if(data) {
fn(data);
} else {
fn();
}
},
ctx:GLctx}).then((df) => {
globalDf = df;
createVoidCallback = () => {
let res; //placeholder for resolver callback, outside of promise
const promise = new Promise((resolve, reject) => {
res = resolve;
});
try {
const callback = () => {
try {
res({});
} catch(err) {
console.log(err);
}
}
const fnPtr = df.addFunction(callback, 'v');
return [promise, fnPtr];
} catch(err) {
console.log(err);
return null;
}
}
createIntCallback = () => {
let res;
const promise = new Promise((resolve, reject) => {
res = resolve;
});
try {
const callback = (val) => {
try {
res(val);
} catch(err) {
console.log(err);
}
}
const fnPtr = df.addFunction(callback, 'vi');
return [promise, fnPtr];
} catch(err) {
console.log(err);
return null;
}
}
createVoidPointerCallback = () => {
console.log("create void ptr callback");
let res; //placeholder for resolver callback, outside of promise
const promise = new Promise((resolve, reject) => {
console.log("resolve");
res = resolve;
});
try {
console.log("try");
const callback = (voidPtr) => {
try {
res(voidPtr);
} catch(err) {
console.log(err);
}
}
const fnPtr = df.addFunction(callback, 'vi');
console.log("done, returning");
return [promise, fnPtr];
} catch(err) {
console.log(err);
return null;
}
}
createBoolCallback = () => {
let res; //placeholder for resolver callback, outside of promise
const promise = new Promise((resolve, reject) => {
res = resolve;
});
try {
const callback = (val) => {
try {
res(val);
} catch(err) {
console.log(err);
}
}
const fnPtr = df.addFunction(callback, 'vi');
return [promise, fnPtr];
} catch(err) {
console.log(err);
return null;
}
}
import('./example_cli.mjs').then((dart2wasm_runtime) => {
var dartModulePromise = WebAssembly.compile(fs.readFileSync('./example_cli.wasm'));
const imports = {"thermion_dart": df, "ctx": GLctx};
dart2wasm_runtime.instantiate(dartModulePromise, imports).then((moduleInstance) => {
dart2wasm_runtime.invoke(moduleInstance);
});
});
});
// // dartModulePromise.then((dartModule) => { console.log(dartModule.exports); dart2wasm_runtime.invoke(dartModule, imports);}); });

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +0,0 @@
{
"dependencies": {
"gl": "^8.0.2"
}
}

View File

@@ -1 +0,0 @@
../../../native/web/build/build/out/dart_filament.js

View File

@@ -1 +0,0 @@
../../../native/web/build/build/out/dart_filament.wasm

View File

@@ -1 +0,0 @@
../../../native/web/build/build/out/dart_filament.worker.js

View File

@@ -1,18 +0,0 @@
name: example_cli
description: A sample command-line application.
version: 1.0.0
# repository: https://github.com/my_org/my_repo
environment:
sdk: ^3.3.0
# Add regular dependencies here.
dependencies:
thermion_dart:
path: ../../
ffi:
dev_dependencies:
ffigen: ^11.0.0
lints: ^3.0.0
test: ^1.24.0

View File

@@ -1,8 +0,0 @@
import 'package:example_cli/example_cli.dart';
import 'package:test/test.dart';
void main() {
test('calculate', () {
expect(calculate(), 42);
});
}

View File

@@ -1,3 +0,0 @@
# https://dart.dev/guides/libraries/private-files
# Created by `dart pub`
.dart_tool/

View File

@@ -1,3 +0,0 @@
## 1.0.0
- Initial version.

View File

@@ -1,2 +0,0 @@
A sample command-line application with an entrypoint in `bin/`, library code
in `lib/`, and example unit test in `test/`.

View File

@@ -1,30 +0,0 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
#
# If you want a smaller set of lints you can change this to specify
# 'package:lints/core.yaml'. These are just the most critical lints
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.
include: package:lints/recommended.yaml
# Uncomment the following section to specify additional rules.
# linter:
# rules:
# - camel_case_types
# analyzer:
# exclude:
# - path/to/excluded/files/**
# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints
# For additional information about configuring this file, see
# https://dart.dev/guides/language/analysis-options

View File

@@ -1,16 +0,0 @@
# Flight Helmet
## Screenshot
![screenshot](screenshot/screenshot.jpg)
## License Information
Donated by Microsoft for glTF testing
[![CC0](http://i.creativecommons.org/p/zero/1.0/88x31.png)](http://creativecommons.org/publicdomain/zero/1.0/)
To the extent possible under law, Microsoft has waived all copyright and related or neighboring rights to this asset.
Draco compression was done via Cesium tools on 27-03-2020 as follows.
gltf-pipeline -i FlightHelmet.gltf -o FlightHelmet.gltf -d -s --keep-unused-elements

View File

@@ -1 +0,0 @@
../../../../flutter_filament_federated/flutter_filament/example/assets

View File

@@ -1,57 +0,0 @@
import 'dart:js_interop';
import 'dart:js_interop_unsafe';
import 'package:thermion_dart/thermion_dart/compatibility/compatibility.dart';
import 'package:thermion_dart/thermion_dart/thermion_viewer_ffi.dart';
import 'package:web/web.dart';
void main(List<String> arguments) async {
var fc = FooChar();
final canvas = document.getElementById("canvas") as HTMLCanvasElement;
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
var resourceLoader = thermion_dart_web_get_resource_loader_wrapper();
var viewer = ThermionViewerFFI(resourceLoader: resourceLoader);
var mousedown = (JSObject event) {
var x = event.getProperty("clientX".toJS) as JSNumber;
var y = event.getProperty("clientY".toJS) as JSNumber;
viewer.rotateStart(x.toDartDouble, y.toDartDouble);
};
canvas.addEventListener("mousedown", mousedown.toJS);
var mousemove = (JSObject event) {
var x = event.getProperty("clientX".toJS) as JSNumber;
var y = event.getProperty("clientY".toJS) as JSNumber;
viewer.rotateUpdate(x.toDartDouble, y.toDartDouble);
};
canvas.addEventListener("mousemove", mousemove.toJS);
var mouseup = (JSObject event) {
viewer.rotateEnd();
};
canvas.addEventListener("mouseup", mousedown.toJS);
await viewer.initialized;
var width = window.innerWidth;
var height = window.innerHeight;
await viewer.createSwapChain(width.toDouble(), height.toDouble());
await viewer.setBackgroundColor(0.0, 1.0, 1.0, 1.0);
await viewer.loadSkybox("assets/default_env_skybox.ktx");
await viewer.loadIbl("assets/default_env_ibl.ktx");
await viewer.loadGltf("assets/FlightHelmet.gltf", "assets");
await viewer.updateViewportAndCameraProjection(
width.toDouble(), height.toDouble());
await viewer.setPostProcessing(true);
await viewer.setRendering(true);
while (true) {
await Future.delayed(Duration(milliseconds: 16));
}
print("Finisehd!");
}

View File

@@ -1,249 +0,0 @@
let buildArgsList;
// `modulePromise` is a promise to the `WebAssembly.module` object to be
// instantiated.
// `importObjectPromise` is a promise to an object that contains any additional
// imports needed by the module that aren't provided by the standard runtime.
// The fields on this object will be merged into the importObject with which
// the module will be instantiated.
// This function returns a promise to the instantiated module.
export const instantiate = async (modulePromise, importObjectPromise) => {
let dartInstance;
function stringFromDartString(string) {
const totalLength = dartInstance.exports.$stringLength(string);
let result = '';
let index = 0;
while (index < totalLength) {
let chunkLength = Math.min(totalLength - index, 0xFFFF);
const array = new Array(chunkLength);
for (let i = 0; i < chunkLength; i++) {
array[i] = dartInstance.exports.$stringRead(string, index++);
}
result += String.fromCharCode(...array);
}
return result;
}
function stringToDartString(string) {
const length = string.length;
let range = 0;
for (let i = 0; i < length; i++) {
range |= string.codePointAt(i);
}
if (range < 256) {
const dartString = dartInstance.exports.$stringAllocate1(length);
for (let i = 0; i < length; i++) {
dartInstance.exports.$stringWrite1(dartString, i, string.codePointAt(i));
}
return dartString;
} else {
const dartString = dartInstance.exports.$stringAllocate2(length);
for (let i = 0; i < length; i++) {
dartInstance.exports.$stringWrite2(dartString, i, string.charCodeAt(i));
}
return dartString;
}
}
// Prints to the console
function printToConsole(value) {
if (typeof dartPrint == "function") {
dartPrint(value);
return;
}
if (typeof console == "object" && typeof console.log != "undefined") {
console.log(value);
return;
}
if (typeof print == "function") {
print(value);
return;
}
throw "Unable to print message: " + js;
}
// Converts a Dart List to a JS array. Any Dart objects will be converted, but
// this will be cheap for JSValues.
function arrayFromDartList(constructor, list) {
const length = dartInstance.exports.$listLength(list);
const array = new constructor(length);
for (let i = 0; i < length; i++) {
array[i] = dartInstance.exports.$listRead(list, i);
}
return array;
}
buildArgsList = function(list) {
const dartList = dartInstance.exports.$makeStringList();
for (let i = 0; i < list.length; i++) {
dartInstance.exports.$listAdd(dartList, stringToDartString(list[i]));
}
return dartList;
}
// A special symbol attached to functions that wrap Dart functions.
const jsWrappedDartFunctionSymbol = Symbol("JSWrappedDartFunction");
function finalizeWrapper(dartFunction, wrapped) {
wrapped.dartFunction = dartFunction;
wrapped[jsWrappedDartFunctionSymbol] = true;
return wrapped;
}
// Imports
const dart2wasm = {
_18: f => finalizeWrapper(f,x0 => dartInstance.exports._18(f,x0)),
_19: f => finalizeWrapper(f,x0 => dartInstance.exports._19(f,x0)),
_75: (x0,x1) => x0.getElementById(x1),
_76: f => finalizeWrapper(f,x0 => dartInstance.exports._76(f,x0)),
_77: (x0,x1,x2) => x0.addEventListener(x1,x2),
_78: f => finalizeWrapper(f,x0 => dartInstance.exports._78(f,x0)),
_79: f => finalizeWrapper(f,x0 => dartInstance.exports._79(f,x0)),
_1499: (x0,x1) => x0.width = x1,
_1501: (x0,x1) => x0.height = x1,
_1878: () => globalThis.window,
_1920: x0 => x0.innerWidth,
_1921: x0 => x0.innerHeight,
_6854: () => globalThis.document,
_12721: () => globalThis.createBoolCallback(),
_12722: () => globalThis.createVoidPointerCallback(),
_12723: () => globalThis.createVoidCallback(),
_12727: v => stringToDartString(v.toString()),
_12743: () => {
let stackString = new Error().stack.toString();
let frames = stackString.split('\n');
let drop = 2;
if (frames[0] === 'Error') {
drop += 1;
}
return frames.slice(drop).join('\n');
},
_12762: s => stringToDartString(JSON.stringify(stringFromDartString(s))),
_12763: s => printToConsole(stringFromDartString(s)),
_12777: (ms, c) =>
setTimeout(() => dartInstance.exports.$invokeCallback(c),ms),
_12781: (c) =>
queueMicrotask(() => dartInstance.exports.$invokeCallback(c)),
_12783: (a, i) => a.push(i),
_12794: a => a.length,
_12796: (a, i) => a[i],
_12797: (a, i, v) => a[i] = v,
_12799: a => a.join(''),
_12809: (s, p, i) => s.indexOf(p, i),
_12812: (o, start, length) => new Uint8Array(o.buffer, o.byteOffset + start, length),
_12813: (o, start, length) => new Int8Array(o.buffer, o.byteOffset + start, length),
_12814: (o, start, length) => new Uint8ClampedArray(o.buffer, o.byteOffset + start, length),
_12815: (o, start, length) => new Uint16Array(o.buffer, o.byteOffset + start, length),
_12816: (o, start, length) => new Int16Array(o.buffer, o.byteOffset + start, length),
_12817: (o, start, length) => new Uint32Array(o.buffer, o.byteOffset + start, length),
_12818: (o, start, length) => new Int32Array(o.buffer, o.byteOffset + start, length),
_12821: (o, start, length) => new Float32Array(o.buffer, o.byteOffset + start, length),
_12822: (o, start, length) => new Float64Array(o.buffer, o.byteOffset + start, length),
_12827: (o) => new DataView(o.buffer, o.byteOffset, o.byteLength),
_12831: Function.prototype.call.bind(Object.getOwnPropertyDescriptor(DataView.prototype, 'byteLength').get),
_12832: (b, o) => new DataView(b, o),
_12834: Function.prototype.call.bind(DataView.prototype.getUint8),
_12836: Function.prototype.call.bind(DataView.prototype.getInt8),
_12838: Function.prototype.call.bind(DataView.prototype.getUint16),
_12840: Function.prototype.call.bind(DataView.prototype.getInt16),
_12842: Function.prototype.call.bind(DataView.prototype.getUint32),
_12844: Function.prototype.call.bind(DataView.prototype.getInt32),
_12850: Function.prototype.call.bind(DataView.prototype.getFloat32),
_12852: Function.prototype.call.bind(DataView.prototype.getFloat64),
_12873: o => o === undefined,
_12874: o => typeof o === 'boolean',
_12875: o => typeof o === 'number',
_12877: o => typeof o === 'string',
_12880: o => o instanceof Int8Array,
_12881: o => o instanceof Uint8Array,
_12882: o => o instanceof Uint8ClampedArray,
_12883: o => o instanceof Int16Array,
_12884: o => o instanceof Uint16Array,
_12885: o => o instanceof Int32Array,
_12886: o => o instanceof Uint32Array,
_12887: o => o instanceof Float32Array,
_12888: o => o instanceof Float64Array,
_12889: o => o instanceof ArrayBuffer,
_12890: o => o instanceof DataView,
_12891: o => o instanceof Array,
_12892: o => typeof o === 'function' && o[jsWrappedDartFunctionSymbol] === true,
_12896: (l, r) => l === r,
_12897: o => o,
_12898: o => o,
_12899: o => o,
_12900: b => !!b,
_12901: o => o.length,
_12904: (o, i) => o[i],
_12905: f => f.dartFunction,
_12906: l => arrayFromDartList(Int8Array, l),
_12907: l => arrayFromDartList(Uint8Array, l),
_12908: l => arrayFromDartList(Uint8ClampedArray, l),
_12909: l => arrayFromDartList(Int16Array, l),
_12910: l => arrayFromDartList(Uint16Array, l),
_12911: l => arrayFromDartList(Int32Array, l),
_12912: l => arrayFromDartList(Uint32Array, l),
_12913: l => arrayFromDartList(Float32Array, l),
_12914: l => arrayFromDartList(Float64Array, l),
_12915: (data, length) => {
const view = new DataView(new ArrayBuffer(length));
for (let i = 0; i < length; i++) {
view.setUint8(i, dartInstance.exports.$byteDataGetUint8(data, i));
}
return view;
},
_12916: l => arrayFromDartList(Array, l),
_12917: stringFromDartString,
_12918: stringToDartString,
_12921: l => new Array(l),
_12925: (o, p) => o[p],
_12929: o => String(o),
_12930: (p, s, f) => p.then(s, f),
_12949: (o, p) => o[p]
};
const baseImports = {
dart2wasm: dart2wasm,
Math: Math,
Date: Date,
Object: Object,
Array: Array,
Reflect: Reflect,
};
const jsStringPolyfill = {
"charCodeAt": (s, i) => s.charCodeAt(i),
"compare": (s1, s2) => {
if (s1 < s2) return -1;
if (s1 > s2) return 1;
return 0;
},
"concat": (s1, s2) => s1 + s2,
"equals": (s1, s2) => s1 === s2,
"fromCharCode": (i) => String.fromCharCode(i),
"length": (s) => s.length,
"substring": (s, a, b) => s.substring(a, b),
};
dartInstance = await WebAssembly.instantiate(await modulePromise, {
...baseImports,
...(await importObjectPromise),
"wasm:js-string": jsStringPolyfill,
});
return dartInstance;
}
// Call the main function for the instantiated module
// `moduleInstance` is the instantiated dart2wasm module
// `args` are any arguments that should be passed into the main function.
export const invoke = (moduleInstance, ...args) => {
const dartMain = moduleInstance.exports.$getMain();
const dartArgs = buildArgsList(args);
moduleInstance.exports.$invokeMain(dartMain, dartArgs);
}

View File

@@ -1,127 +0,0 @@
<html>
<head>
<script src="thermion_dart.js"></script>
<style>
html, body {
margin:0;
padding:0;
}
canvas {
position:absolute;
left:0;
right:0;
top:0;
bottom:0;
width:100%;
height:100%;
}
</style>
</head>
<script type="module">
window.resolveCallback = (cb, data) => {
const fn = window.df.wasmTable.get(cb);
if(data) {
fn(data);
} else {
fn();
}
}
window.createVoidCallback = () => {
let res; //placeholder for resolver callback, outside of promise
const promise = new Promise((resolve, reject) => {
res = resolve;
});
try {
const callback = () => {
try {
res({});
} catch(err) {
console.log(err);
}
}
const fnPtr = window.df.addFunction(callback, 'v');
return [promise, fnPtr];
} catch(err) {
console.log(err);
return null;
}
}
window.createIntCallback = () => {
let res;
const promise = new Promise((resolve, reject) => {
res = resolve;
});
try {
const callback = (val) => {
try {
res(val);
} catch(err) {
console.log(err);
}
}
const fnPtr = window.df.addFunction(callback, 'vi');
return [promise, fnPtr];
} catch(err) {
console.log(err);
return null;
}
}
window.createVoidPointerCallback = () => {
let res; //placeholder for resolver callback, outside of promise
const promise = new Promise((resolve, reject) => {
res = resolve;
});
try {
const callback = (voidPtr) => {
try {
res(voidPtr);
} catch(err) {
console.log(err);
}
}
const fnPtr = window.df.addFunction(callback, 'vi');
return [promise, fnPtr];
} catch(err) {
console.log(err);
return null;
}
}
window.createBoolCallback = () => {
let res; //placeholder for resolver callback, outside of promise
const promise = new Promise((resolve, reject) => {
res = resolve;
});
try {
const callback = (val) => {
try {
res(val);
} catch(err) {
console.log(err);
}
}
const fnPtr = window.df.addFunction(callback, 'vi');
return [promise, fnPtr];
} catch(err) {
console.log(err);
return null;
}
}
const df = await thermion_dart();
window.df = df;
const dartModulePromise = WebAssembly.compileStreaming(fetch('example_web.wasm'));
const imports = {"thermion_dart":df};
const dart2wasm_runtime = await import('./example_web.mjs');
const moduleInstance = await dart2wasm_runtime.instantiate(dartModulePromise, imports);
window.example = moduleInstance;
await dart2wasm_runtime.invoke(moduleInstance);
</script>
<body>
<canvas id="canvas"></canvas>
</body>
</html>

View File

@@ -1 +0,0 @@
../../../native/web/build/build/out/dart_filament.js

View File

@@ -1 +0,0 @@
../../../native/web/build/build/out/dart_filament.wasm

View File

@@ -1 +0,0 @@
../../../native/web/build/build/out/dart_filament.worker.js

View File

@@ -1,17 +0,0 @@
name: example_web
description: A sample command-line application.
version: 1.0.0
# repository: https://github.com/my_org/my_repo
environment:
sdk: ^3.3.0
# Add regular dependencies here.
dependencies:
thermion_dart:
path: ../../
ffi:
dev_dependencies:
lints: ^3.0.0
test: ^1.24.0

View File

@@ -1,8 +0,0 @@
import 'package:example_web/example_web.dart';
import 'package:test/test.dart';
void main() {
test('calculate', () {
expect(calculate(), 42);
});
}

View File

@@ -1,4 +0,0 @@
{
"flutterSdkVersion": "3.16.0-0.2.pre",
"flavors": {}
}

View File

@@ -1,30 +0,0 @@
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

View File

@@ -1,50 +0,0 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
# Web related
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
/android/.cxx/**/*
# fvm
.fvm/flutter_sdk

Some files were not shown because too many files have changed in this diff Show More