From a31142de6de75c285c985767f3e21803d95e0571 Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Fri, 28 Mar 2025 16:13:36 +0800 Subject: [PATCH] documentation updates --- README.md | 64 +++++++++++++-------------------------- thermion_dart/BUILDING.md | 8 +++-- thermion_dart/README.md | 2 ++ 3 files changed, 28 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index ca9e72ed..ea385f06 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,8 @@ discord contributors - - https://github.com/user-attachments/assets/b0c07b5a-6156-4e42-a09b-5f9bd85fbf32 - - ### Features - 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: ```dart -_thermionViewer = await ThermionFlutterPlugin.createViewer(); - -// 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 +@override Widget build(BuildContext context) { - return Stack(children: [ - if (_thermionViewer != null) + return Scaffold( + body: Stack(children: [ Positioned.fill( - child: ThermionWidget( - viewer: _thermionViewer!, - )), - ]); + child: ViewerWidget( + 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 Thermion uses the [Filament](https://github.com/google/filament) Physically Based Rendering engine under the hood. diff --git a/thermion_dart/BUILDING.md b/thermion_dart/BUILDING.md index 4391c325..522126a7 100644 --- a/thermion_dart/BUILDING.md +++ b/thermion_dart/BUILDING.md @@ -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. -## MacOS +## MacOS (arm64/x64) ``` -./build.sh -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 -p desktop release +./build.sh -l -i -f -t -d -p desktop debug # build with the framegraph viewer/material debug server enabled ``` +# iOS + ## Android ``` diff --git a/thermion_dart/README.md b/thermion_dart/README.md index f8387082..11540168 100644 --- a/thermion_dart/README.md +++ b/thermion_dart/README.md @@ -15,6 +15,8 @@ discord contributors +https://github.com/user-attachments/assets/b0c07b5a-6156-4e42-a09b-5f9bd85fbf32 + ### Features - Supports iOS (arm64), MacOS (arm64/x64), Android (arm64), Windows (x64) (>= 10), Web/WASM