Compare commits

..

10 Commits

Author SHA1 Message Date
Nick Fisher 82d4cd3cc7 chore(release): publish packages
- thermion_flutter_ffi@0.1.0+11
 - thermion_flutter@0.1.1+12
2024-07-11 19:04:06 +08:00
Nick Fisher 076c3cbe21 fix: add logging dependency 2024-07-11 19:03:57 +08:00
Nick Fisher f8c6c33269 chore(release): publish packages
- thermion_dart@0.1.2
 - thermion_flutter_ffi@0.1.0+10
 - thermion_flutter_web@0.0.2
 - thermion_flutter@0.1.1+11
 - thermion_flutter_platform_interface@0.1.0+10
2024-07-11 19:00:36 +08:00
Nick Fisher 6e5627f90e Merge pull request #62 from nmfisher/bugfix/windows-native-assets
Native-assets build error on Windows when targeting Android
2024-07-11 20:59:37 +10:00
Nick Fisher 1921007fc6 fix: manually remove leading slash for compiler path on Windows when building for Android 2024-07-11 20:51:48 +10:00
Nick Fisher 7a362411b1 Merge pull request #56 from payl-ampa/patch-2
docs: correct link to windows page in quickstart page
2024-07-05 10:26:21 +10:00
Paul Ampadu e95dfe4671 Update quickstart.mdx 2024-07-04 10:59:27 -07:00
Nick Fisher e7b79bb6b9 fix: web/JS bool checks need to compare to int 2024-07-04 21:49:13 +08:00
Nick Fisher 59bc309f5b feat: allow passing assetPathPrefix to ThermionViewerWasm to account for Flutter build asset paths 2024-07-04 16:29:56 +08:00
Nick Fisher d2fb40f317 fix: shadow JS<->WASM bridge methods 2024-07-04 16:29:08 +08:00
27 changed files with 30 additions and 301 deletions
-52
View File
@@ -3,58 +3,6 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## 2024-07-23
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`thermion_dart` - `v0.1.3`](#thermion_dart---v013)
- [`thermion_flutter_ffi` - `v0.1.0+12`](#thermion_flutter_ffi---v01012)
- [`thermion_flutter_web` - `v0.0.3`](#thermion_flutter_web---v003)
- [`thermion_flutter_platform_interface` - `v0.1.0+11`](#thermion_flutter_platform_interface---v01011)
- [`thermion_flutter` - `v0.1.1+13`](#thermion_flutter---v01113)
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_platform_interface` - `v0.1.0+11`
- `thermion_flutter` - `v0.1.1+13`
---
#### `thermion_dart` - `v0.1.3`
- **FIX**: manually remove leading slash for compiler path on Windows when building for Android.
- **FIX**: web/JS bool checks need to compare to int.
- **FIX**: shadow JS<->WASM bridge methods.
- **FIX**: manually remove leading slash for compiler path on Windows when building for Android.
- **FIX**: web/JS bool checks need to compare to int.
- **FIX**: shadow JS<->WASM bridge methods.
- **FEAT**: add clearMorphAnimationData function.
- **FEAT**: allow passing assetPathPrefix to ThermionViewerWasm to account for Flutter build asset paths.
- **FEAT**: allow passing assetPathPrefix to ThermionViewerWasm to account for Flutter build asset paths.
#### `thermion_flutter_ffi` - `v0.1.0+12`
- **FIX**: add logging dependency.
- **FIX**: web/JS bool checks need to compare to int.
- **FIX**: add logging dependency.
- **FIX**: web/JS bool checks need to compare to int.
#### `thermion_flutter_web` - `v0.0.3`
- **FEAT**: allow passing assetPathPrefix to ThermionViewerWasm to account for Flutter build asset paths.
- **FEAT**: allow passing assetPathPrefix to ThermionViewerWasm to account for Flutter build asset paths.
## 2024-07-11
### Changes
+1 -1
View File
@@ -12,7 +12,7 @@
],
["Misc.", [
["Playground", "https://dartpad.thermion.dev"],
["Showcase", "/showcase"],
["Examples", "/examples"],
["Windows", "/windows"],
["Android", "/android"],
["Contributing", "/contributing"],
-12
View File
@@ -1,15 +1,3 @@
## 0.1.3
- **FIX**: manually remove leading slash for compiler path on Windows when building for Android.
- **FIX**: web/JS bool checks need to compare to int.
- **FIX**: shadow JS<->WASM bridge methods.
- **FIX**: manually remove leading slash for compiler path on Windows when building for Android.
- **FIX**: web/JS bool checks need to compare to int.
- **FIX**: shadow JS<->WASM bridge methods.
- **FEAT**: add clearMorphAnimationData function.
- **FEAT**: allow passing assetPathPrefix to ThermionViewerWasm to account for Flutter build asset paths.
- **FEAT**: allow passing assetPathPrefix to ThermionViewerWasm to account for Flutter build asset paths.
## 0.1.2
- **FIX**: manually remove leading slash for compiler path on Windows when building for Android.
-1
View File
@@ -1 +0,0 @@
For an example with both pure Dart and Flutter, see the [example repository](https://github.com/nmfisher/thermion_examples).
@@ -368,12 +368,6 @@ external bool set_morph_animation(
double frameLengthInMs,
);
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int)>()
external void clear_morph_animation(
ffi.Pointer<ffi.Void> sceneManager,
int entity,
);
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int)>()
external void reset_to_rest_pose(
ffi.Pointer<ffi.Void> sceneManager,
@@ -226,11 +226,6 @@ class ThermionViewerJSDartBridge {
.then((v) => v.toJS)
.toJS;
@JSExport()
void clearMorphAnimationData(ThermionEntity entity) {
viewer.clearMorphAnimationData(entity);
}
@JSExport()
JSPromise setMorphAnimationData(
ThermionEntity entity,
@@ -263,11 +263,6 @@ class ThermionViewerJS implements ThermionViewer {
.toDartDouble;
}
@override
Future<void> clearMorphAnimationData(ThermionEntity entity) async {
_shim.clearMorphAnimationData(entity);
}
@override
Future<void> setMorphAnimationData(
ThermionEntity entity, MorphAnimationData animation,
@@ -6,10 +6,11 @@ import 'dart:js_interop';
import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
///
/// An extension type on [JSObject] that represents a
/// An extension type on [JSObject] that represents a
/// Javascript shim implementation of the [ThermionViewer] interface.
///
///
extension type ThermionViewerJSShim(JSObject _) implements JSObject {
@JS('initialized')
external JSPromise<JSBoolean> get initialized;
@@ -135,9 +136,6 @@ extension type ThermionViewerJSShim(JSObject _) implements JSObject {
external JSPromise<JSNumber> getAnimationDuration(
ThermionEntity entity, int animationIndex);
@JS('clearMorphAnimationData')
external void clearMorphAnimationData(ThermionEntity entity);
@JS('setMorphAnimationData')
external JSPromise setMorphAnimationData(
ThermionEntity entity,
@@ -405,16 +403,19 @@ extension type ThermionViewerJSShim(JSObject _) implements JSObject {
ThermionEntity entity, JSArray<JSNumber> transform);
@JS('setBoneTransform')
external JSPromise setBoneTransform(ThermionEntity entity, int boneIndex,
JSArray<JSNumber> transform, int skinIndex);
external JSPromise setBoneTransform(
ThermionEntity entity, int boneIndex, JSArray<JSNumber> transform, int skinIndex);
@JS('setShadowsEnabled')
external JSPromise setShadowsEnabled(bool enabled);
external JSPromise setShadowsEnabled(
bool enabled);
@JS('setShadowType')
external JSPromise setShadowType(int shadowType);
external JSPromise setShadowType(
int shadowType);
@JS('setSoftShadowOptions')
external JSPromise setSoftShadowOptions(
double penumbraScale, double penumbraRatioScale);
}
@@ -788,27 +788,6 @@ class ThermionViewerWasm implements ThermionViewer {
null);
}
@override
Future clearMorphAnimationData(
ThermionEntity entity) async {
var meshEntities = await getChildEntities(entity, false);
for(final childEntity in meshEntities) {
_module.ccall(
"clear_morph_animation",
"void",
[
"void*".toJS,
"int".toJS,
].toJS,
[
_sceneManager!,
childEntity.toJS,
].toJS,
null);
}
}
@override
Future setMorphAnimationData(
ThermionEntity entity, MorphAnimationData animation,
@@ -269,12 +269,6 @@ abstract class ThermionViewer {
ThermionEntity entity, MorphAnimationData animation,
{List<String>? targetMeshNames});
///
/// Clear all current morph animations for [entity].
///
Future clearMorphAnimationData(
ThermionEntity entity);
///
/// Resets all bones in the given entity to their rest pose.
/// This should be done before every call to addBoneAnimation.
@@ -599,18 +599,6 @@ class ThermionViewerFFI extends ThermionViewer {
return getAnimationDuration(entity, index);
}
Future clearMorphAnimationData(ThermionEntity entity) async {
var meshEntities = await getChildEntities(entity, true);
for(final childEntity in meshEntities) {
clear_morph_animation(
_sceneManager!,
childEntity);
}
}
///
///
///
@@ -586,11 +586,6 @@ class ThermionViewerStub extends ThermionViewer {
throw UnimplementedError();
}
@override
Future clearMorphAnimationData(ThermionEntity entity) {
throw UnimplementedError();
}
@override
Future setMorphAnimationData(
ThermionEntity entity, MorphAnimationData animation,
@@ -731,19 +726,19 @@ class ThermionViewerStub extends ThermionViewer {
// TODO: implement zoomUpdate
throw UnimplementedError();
}
@override
Future setShadowType(ShadowType shadowType) {
// TODO: implement setShadowType
throw UnimplementedError();
}
@override
Future setShadowsEnabled(bool enabled) {
// TODO: implement setShadowsEnabled
throw UnimplementedError();
}
@override
Future setSoftShadowOptions(double penumbraScale, double penumbraRatioScale) {
// TODO: implement setSoftShadowOptions
@@ -87,9 +87,6 @@ namespace thermion_filament
int numFrames,
float frameLengthInMs);
void clearMorphAnimationBuffer(
EntityId entityId);
bool setMorphTargetWeights(EntityId entityId, const float *const weights, int count);
math::mat4f getLocalTransform(EntityId entityId);
@@ -136,9 +136,6 @@ extern "C"
int numMorphTargets,
int numFrames,
float frameLengthInMs);
EMSCRIPTEN_KEEPALIVE void clear_morph_animation(
void *sceneManager,
EntityId entity);
EMSCRIPTEN_KEEPALIVE void reset_to_rest_pose(
void *sceneManager,
-21
View File
@@ -781,27 +781,6 @@ namespace thermion_filament
return true;
}
void SceneManager::clearMorphAnimationBuffer(
EntityId entityId)
{
std::lock_guard lock(_mutex);
auto entity = Entity::import(entityId);
if (entity.isNull())
{
Log("ERROR: invalid entity %d.", entityId);
return;
}
auto animationComponentInstance = _animationComponentManager->getInstance(entity);
auto &animationComponent = _animationComponentManager->elementAt<0>(animationComponentInstance);
auto &morphAnimations = animationComponent.morphAnimations;
morphAnimations.clear();
return;
}
bool SceneManager::setMaterialColor(EntityId entityId, const char *meshName, int materialIndex, const float r, const float g, const float b, const float a)
{
+1 -5
View File
@@ -405,7 +405,7 @@ extern "C"
return ((SceneManager *)sceneManager)->setMorphTargetWeights(asset, weights, numWeights);
}
EMSCRIPTEN_KEEPALIVE bool set_morph_animation(
bool set_morph_animation(
void *sceneManager,
EntityId asset,
const float *const morphData,
@@ -418,10 +418,6 @@ extern "C"
return result;
}
EMSCRIPTEN_KEEPALIVE void clear_morph_animation(void* sceneManager, EntityId asset) {
((SceneManager *)sceneManager)->clearMorphAnimationBuffer(asset);
}
EMSCRIPTEN_KEEPALIVE void reset_to_rest_pose(void *sceneManager, EntityId entityId)
{
((SceneManager *)sceneManager)->resetBones(entityId);
+1 -1
View File
@@ -1,6 +1,6 @@
name: thermion_dart
description: 3D rendering toolkit for Dart.
version: 0.1.3
version: 0.1.2
homepage: https://thermion.dev
repository: https://github.com/nmfisher/thermion
@@ -1,7 +1,3 @@
## 0.1.1+13
- Update a dependency to the latest release.
## 0.1.1+12
- Update a dependency to the latest release.
@@ -1,96 +0,0 @@
For a more thorough example with both Flutter and pure Dart, see the [example repository](https://github.com/nmfisher/thermion_examples).
[flutter/quickstart/lib/main.dart](https://github.com/nmfisher/thermion_examples/blob/master/flutter/quickstart/lib/main.dart)
```dart
import 'package:flutter/material.dart';
import 'package:thermion_flutter/thermion_flutter.dart';
import 'package:vector_math/vector_math_64.dart' as v;
import 'dart:math';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
bool _loaded = false;
ThermionViewer? _thermionViewer;
@override
void initState() {
super.initState();
}
Future _load() async {
var viewer = await ThermionFlutterPlugin.createViewer();
_thermionViewer = viewer;
_thermionViewer!.loadSkybox("assets/default_env_skybox.ktx");
_thermionViewer!.loadGlb("assets/cube.glb");
_thermionViewer!.setCameraPosition(0, 1, 10);
_thermionViewer!.setCameraRotation(
v.Quaternion.axisAngle(v.Vector3(1, 0, 0), -30 / 180 * pi) *
v.Quaternion.axisAngle(v.Vector3(0, 1, 0), 15 / 180 * pi));
_thermionViewer!.addLight(LightType.SUN, 7500, 50000, 0, 0, 0, 1, -1, -1);
_thermionViewer!.setRendering(true);
_loaded = true;
setState(() {});
}
Future _unload() async {
var viewer = _thermionViewer!;
_thermionViewer = null;
setState(() {});
await viewer.dispose();
_loaded = false;
setState(() {});
}
Widget _loadButton() {
return Center(
child: ElevatedButton(child: const Text("Load"), onPressed: _load));
}
Widget _unloadButton() {
return Center(
child: ElevatedButton(child: const Text("Unload"), onPressed: _unload));
}
@override
Widget build(BuildContext context) {
return Stack(children: [
if (_thermionViewer != null)
Positioned.fill(child: ThermionWidget(viewer: _thermionViewer!)),
if (!_loaded) _loadButton(),
if (_loaded) _unloadButton(),
]);
}
}
```
@@ -1,6 +1,6 @@
name: thermion_flutter
description: Flutter plugin for 3D rendering with the Thermion toolkit.
version: 0.1.1+13
version: 0.1.1+12
homepage: https://thermion.dev
repository: https://github.com/nmfisher/thermion
@@ -17,10 +17,10 @@ dependencies:
plugin_platform_interface: ^2.0.0
ffi: ^2.1.2
animation_tools_dart: ^0.0.4
thermion_dart: ^0.1.3
thermion_flutter_platform_interface: ^0.1.0+11
thermion_flutter_ffi: ^0.1.0+12
thermion_flutter_web: ^0.0.3
thermion_dart: ^0.1.2
thermion_flutter_platform_interface: ^0.1.0+10
thermion_flutter_ffi: ^0.1.0+11
thermion_flutter_web: ^0.0.2
logging: ^1.2.0
dev_dependencies:
@@ -1,10 +1,3 @@
## 0.1.0+12
- **FIX**: add logging dependency.
- **FIX**: web/JS bool checks need to compare to int.
- **FIX**: add logging dependency.
- **FIX**: web/JS bool checks need to compare to int.
## 0.1.0+11
- **FIX**: add logging dependency.
@@ -1,7 +1,7 @@
name: thermion_flutter_ffi
description: An FFI interface for the thermion_flutter plugin (all platforms except web).
repository: https://github.com/nmfisher/thermion_flutter/thermion_flutter
version: 0.1.0+12
version: 0.1.0+11
environment:
sdk: ">=3.3.0 <4.0.0"
@@ -22,8 +22,8 @@ dependencies:
flutter:
sdk: flutter
plugin_platform_interface: ^2.1.0
thermion_flutter_platform_interface: ^0.1.0+11
thermion_dart: ^0.1.3
thermion_flutter_platform_interface: ^0.1.0+10
thermion_dart: ^0.1.2
logging: ^1.2.0
dev_dependencies:
@@ -1,7 +1,3 @@
## 0.1.0+11
- Update a dependency to the latest release.
## 0.1.0+10
- Update a dependency to the latest release.
@@ -1,7 +1,7 @@
name: thermion_flutter_platform_interface
description: A common platform interface for the thermion_flutter plugin.
repository: https://github.com/nmfisher/thermion_flutter/thermion_flutter
version: 0.1.0+11
version: 0.1.0+10
environment:
sdk: ">=3.3.0 <4.0.0"
@@ -11,7 +11,7 @@ dependencies:
flutter:
sdk: flutter
plugin_platform_interface: ^2.1.0
thermion_dart: ^0.1.3
thermion_dart: ^0.1.2
dev_dependencies:
flutter_test:
@@ -1,8 +1,3 @@
## 0.0.3
- **FEAT**: allow passing assetPathPrefix to ThermionViewerWasm to account for Flutter build asset paths.
- **FEAT**: allow passing assetPathPrefix to ThermionViewerWasm to account for Flutter build asset paths.
## 0.0.2
- **FEAT**: allow passing assetPathPrefix to ThermionViewerWasm to account for Flutter build asset paths.
@@ -1,7 +1,7 @@
name: thermion_flutter_web
description: A web platform interface for the thermion_flutter plugin.
repository: https://github.com/nmfisher/thermion_flutter/thermion_flutter
version: 0.0.3
version: 0.0.2
environment:
sdk: ">=3.3.0 <4.0.0"
@@ -20,8 +20,8 @@ dependencies:
sdk: flutter
plugin_platform_interface: ^2.1.0
web: ^0.5.1
thermion_dart: ^0.1.3
thermion_flutter_platform_interface: ^0.1.0+11
thermion_dart: ^0.1.2
thermion_flutter_platform_interface: ^0.1.0+10
flutter_web_plugins:
sdk: flutter