move Scene class to own file and add dispose() method

This commit is contained in:
Nick Fisher
2024-06-19 13:04:34 +08:00
parent 89f49f98c4
commit dc70909715
4 changed files with 162 additions and 153 deletions

View File

@@ -1,5 +1,6 @@
import 'dart:math';
import 'package:thermion_dart/thermion_dart/scene.dart';
import 'package:vector_math/vector_math_64.dart';
import 'dart:async';
import 'package:animation_tools_dart/animation_tools_dart.dart';
@@ -707,52 +708,6 @@ abstract class ThermionViewer {
void onDispose(Future Function() callback);
}
///
/// For now, this class just holds the entities that have been loaded (though not necessarily visible in the Filament Scene).
///
abstract class Scene {
///
/// The last entity clicked/tapped in the viewport (internally, the result of calling pick);
ThermionEntity? selected;
///
/// A Stream updated whenever an entity is added/removed from the scene.
///
Stream<bool> get onUpdated;
///
/// A Stream containing every ThermionEntity added to the scene (i.e. via [loadGlb], [loadGltf] or [addLight]).
/// This is provided for convenience so you can set listeners in front-end widgets that can respond to entity loads without manually passing around the ThermionEntity returned from those methods.
///
Stream<ThermionEntity> get onLoad;
///
/// A Stream containing every ThermionEntity removed from the scene (i.e. via [removeEntity], [clearEntities], [removeLight] or [clearLights]).
Stream<ThermionEntity> get onUnload;
///
/// Lists all light entities currently loaded (not necessarily active in the scene). Does not account for instances.
///
Iterable<ThermionEntity> listLights();
///
/// Lists all entities currently loaded (not necessarily active in the scene). Does not account for instances.
///
Iterable<ThermionEntity> listEntities();
///
/// Attach the gizmo to the specified entity.
///
void select(ThermionEntity entity);
///
///
///
void registerEntity(ThermionEntity entity);
}
abstract class AbstractGizmo {
bool get isActive;