documentation updates
This commit is contained in:
64
README.md
64
README.md
@@ -15,12 +15,8 @@
|
|||||||
<a href="https://discord.gg/h2VdDK3EAQ"><img src="https://img.shields.io/discord/993167615587520602?logo=discord&logoColor=fff&labelColor=333940" alt="discord"></a>
|
<a href="https://discord.gg/h2VdDK3EAQ"><img src="https://img.shields.io/discord/993167615587520602?logo=discord&logoColor=fff&labelColor=333940" alt="discord"></a>
|
||||||
<a href="https://github.com/nmfisher/thermion"><img src="https://img.shields.io/github/contributors/nmfisher/flutter_filament?logo=github&labelColor=333940" alt="contributors"></a>
|
<a href="https://github.com/nmfisher/thermion"><img src="https://img.shields.io/github/contributors/nmfisher/flutter_filament?logo=github&labelColor=333940" alt="contributors"></a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
https://github.com/user-attachments/assets/b0c07b5a-6156-4e42-a09b-5f9bd85fbf32
|
https://github.com/user-attachments/assets/b0c07b5a-6156-4e42-a09b-5f9bd85fbf32
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
- Supports iOS (arm64), MacOS (arm64/x64), Android (arm64), Windows (x64) (>= 10), Web/WASM
|
- Supports iOS (arm64), MacOS (arm64/x64), Android (arm64), Windows (x64) (>= 10), Web/WASM
|
||||||
@@ -43,50 +39,32 @@ flutter config --enable-native-assets
|
|||||||
In your Flutter app:
|
In your Flutter app:
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
_thermionViewer = await ThermionFlutterPlugin.createViewer();
|
@override
|
||||||
|
|
||||||
// Geometry and models are represented as "entities". Here, we load a glTF
|
|
||||||
// file containing a plain cube.
|
|
||||||
// By default, all paths are treated as asset paths. To load from a file
|
|
||||||
// instead, use file:// URIs.
|
|
||||||
var entity =
|
|
||||||
await _thermionViewer!.loadGlb("assets/cube.glb", keepData: true);
|
|
||||||
|
|
||||||
// Thermion uses a right-handed coordinate system where +Y is up and -Z is
|
|
||||||
// "into" the screen.
|
|
||||||
// By default, the camera is located at (0,0,0) looking at (0,0,-1); this
|
|
||||||
// would place it directly inside the cube we just loaded.
|
|
||||||
//
|
|
||||||
// Let's move the camera to (0,0,10) to ensure the cube is visible in the
|
|
||||||
// viewport.
|
|
||||||
await _thermionViewer!.setCameraPosition(0, 0, 10);
|
|
||||||
|
|
||||||
// Without a light source, your scene will be totally black. Let's load a skybox
|
|
||||||
// (a cubemap image that is rendered behind everything else in the scene)
|
|
||||||
// and an image-based indirect light that has been precomputed from the same
|
|
||||||
// skybox.
|
|
||||||
await _thermionViewer!.loadSkybox("assets/default_env_skybox.ktx");
|
|
||||||
await _thermionViewer!.loadIbl("assets/default_env_ibl.ktx");
|
|
||||||
|
|
||||||
// Finally, you need to explicitly enable rendering. Setting rendering to
|
|
||||||
// false is designed to allow you to pause rendering to conserve battery life
|
|
||||||
await _thermionViewer!.setRendering(true);
|
|
||||||
```
|
|
||||||
|
|
||||||
and then in your widget tree:
|
|
||||||
```dart
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Stack(children: [
|
return Scaffold(
|
||||||
if (_thermionViewer != null)
|
body: Stack(children: [
|
||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
child: ThermionWidget(
|
child: ViewerWidget(
|
||||||
viewer: _thermionViewer!,
|
assetPath: "assets/cube.glb",
|
||||||
)),
|
skyboxPath: "assets/default_env_skybox.ktx",
|
||||||
]);
|
iblPath: "assets/default_env_ibl.ktx",
|
||||||
|
transformToUnitCube: true,
|
||||||
|
initialCameraPosition: Vector3(0, 0, 6),
|
||||||
|
background: Colors.blue,
|
||||||
|
manipulatorType: ManipulatorType.ORBIT,
|
||||||
|
onViewerAvailable: (viewer) async {
|
||||||
|
await Future.delayed(const Duration(seconds: 5));
|
||||||
|
await viewer.removeSkybox();
|
||||||
|
},
|
||||||
|
initial: Container(
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
))]));
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
>! the first time you run an app, the Dart native-assets build system will download static binaries from Cloudflare. This may take a few minutes (depending on which platform you are compiling for). These will be cached, so subsequent builds will be much faster.
|
||||||
|
|
||||||
### Sponsors, Contributors & Acknowledgments
|
### Sponsors, Contributors & Acknowledgments
|
||||||
|
|
||||||
Thermion uses the [Filament](https://github.com/google/filament) Physically Based Rendering engine under the hood.
|
Thermion uses the [Filament](https://github.com/google/filament) Physically Based Rendering engine under the hood.
|
||||||
|
|||||||
@@ -4,13 +4,15 @@ Below are instructions for building the Filament (currently pinned to v1.58.0) f
|
|||||||
|
|
||||||
This is only for developers extending the Thermion package itself; if you are simply using Thermion as a dependency in your `pubspec.yaml`, you can ignore this.
|
This is only for developers extending the Thermion package itself; if you are simply using Thermion as a dependency in your `pubspec.yaml`, you can ignore this.
|
||||||
|
|
||||||
## MacOS
|
## MacOS (arm64/x64)
|
||||||
|
|
||||||
```
|
```
|
||||||
./build.sh -i -f -p desktop release
|
./build.sh -l -i -f -p desktop release
|
||||||
./build.sh -i -f -t -d -p desktop debug # build with the framegraph viewer/material debug server enabled
|
./build.sh -l -i -f -t -d -p desktop debug # build with the framegraph viewer/material debug server enabled
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# iOS
|
||||||
|
|
||||||
## Android
|
## Android
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
<a href="https://discord.gg/h2VdDK3EAQ"><img src="https://img.shields.io/discord/993167615587520602?logo=discord&logoColor=fff&labelColor=333940" alt="discord"></a>
|
<a href="https://discord.gg/h2VdDK3EAQ"><img src="https://img.shields.io/discord/993167615587520602?logo=discord&logoColor=fff&labelColor=333940" alt="discord"></a>
|
||||||
<a href="https://github.com/nmfisher/thermion"><img src="https://img.shields.io/github/contributors/nmfisher/flutter_filament?logo=github&labelColor=333940" alt="contributors"></a>
|
<a href="https://github.com/nmfisher/thermion"><img src="https://img.shields.io/github/contributors/nmfisher/flutter_filament?logo=github&labelColor=333940" alt="contributors"></a>
|
||||||
|
|
||||||
|
https://github.com/user-attachments/assets/b0c07b5a-6156-4e42-a09b-5f9bd85fbf32
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
- Supports iOS (arm64), MacOS (arm64/x64), Android (arm64), Windows (x64) (>= 10), Web/WASM
|
- Supports iOS (arm64), MacOS (arm64/x64), Android (arm64), Windows (x64) (>= 10), Web/WASM
|
||||||
|
|||||||
Reference in New Issue
Block a user