feature!:

This is a breaking change needed to fully implement instancing and stencil highlighting.

Previously, users would work directly with entities (on the Dart side, ThermionEntity), e.g.

final entity = await viewer.loadGlb("some.glb");

However, Filament "entities" are a lower-level abstraction.

Loading a glTF file, for example, inserts multiple entities into the scene.

For example, each mesh, light, and camera within a glTF asset will be assigned an entity. A top-level (non-renderable) entity will also be created for the glTF asset, which can be used to transform the entire hierarchy.

"Asset" is a better representation for loading/inserting objects into the scene; think of this as a bundle of entities.

Unless you need to work directly with transforms, instancing, materials and renderables, you can work directly with ThermionAsset.
This commit is contained in:
Nick Fisher
2024-11-21 15:04:10 +08:00
parent 9ada6aae64
commit ed444b0615
195 changed files with 18061 additions and 12628 deletions

View File

@@ -2,7 +2,6 @@ import 'dart:async';
import 'dart:typed_data';
import 'package:animation_tools_dart/animation_tools_dart.dart';
import 'package:test/test.dart';
import 'package:vector_math/vector_math_64.dart';
import 'helpers.dart';
void main() async {
@@ -10,23 +9,21 @@ void main() async {
group('morph animation tests', () {
test('set morph animation', () async {
var viewer = await testHelper.createViewer(
bg: kRed, cameraPosition: Vector3(0, 0, 5));
await testHelper.withViewer((viewer) async {
final cube = await viewer.loadGlb(
"${testHelper.testDir}/assets/cube_with_morph_targets.glb");
var morphData = MorphAnimationData(
Float32List.fromList(List<double>.generate(60, (i) => i / 60)),
["Key 1"]);
final cube = await viewer
.loadGlb("${testHelper.testDir}/assets/cube_with_morph_targets.glb");
var morphData = MorphAnimationData(
Float32List.fromList(List<double>.generate(60, (i) => i / 60)),
["Key 1"]);
await viewer.setMorphAnimationData(cube, morphData);
for (int i = 0; i < 60; i++) {
await viewer.requestFrame();
await Future.delayed(Duration(milliseconds: 17));
}
await testHelper.capture(viewer, "morph_animation");
await viewer.dispose();
for (int i = 0; i < 60; i++) {
await viewer.requestFrame();
await Future.delayed(Duration(milliseconds: 17));
}
await testHelper.capture(viewer, "morph_animation");
});
});
});
}