diff --git a/example/lib/main.dart b/example/lib/main.dart index b4c7f4de..edcb9c1f 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -44,11 +44,14 @@ class ExampleWidget extends StatefulWidget { class _ExampleWidgetState extends State { FilamentController? _filamentController; + FilamentEntity? _shapes; FilamentEntity? _flightHelmet; - List? _animations; + FilamentEntity? _buster; FilamentEntity? _light; + List? _animations; + StreamSubscription? _pickResultListener; String? picked; @@ -356,6 +359,34 @@ class _ExampleWidgetState extends State { }); _filamentController!.setViewFrustumCulling(_frustumCulling); }, "${_frustumCulling ? "Disable" : "Enable"} frustum culling")); + + children.addAll([ + _item(() async { + await Permission.microphone.request(); + }, "request permissions (tests inactive->resume)"), + _item(() async { + if (_buster != null) { + await _filamentController!.removeAsset(_buster!); + } + _buster = await (_filamentController as FilamentControllerFFI) + .loadGltf("assets/BusterDrone/scene.gltf", "assets/BusterDrone", + force: true); + await _filamentController!.playAnimation(_buster!, 0, loop: true); + }, "load buster") + ]); + } + + if (_animations != null) { + children.addAll(_animations!.map((a) => _item(() { + _filamentController!.playAnimation( + _shapes!, _animations!.indexOf(a), + replaceActive: true, crossfade: 0.5, loop: _loop); + }, "play animation ${_animations!.indexOf(a)} (replace/fade)"))); + children.addAll(_animations!.map((a) => _item(() { + _filamentController!.playAnimation( + _shapes!, _animations!.indexOf(a), + replaceActive: false, loop: _loop); + }, "play animation ${_animations!.indexOf(a)} (noreplace)"))); } } return Stack(children: [