rename (asset to entity)

This commit is contained in:
Nick Fisher
2024-02-15 15:16:56 +08:00
parent 935b876ce9
commit 2ae3f8c466
15 changed files with 108 additions and 41 deletions

View File

@@ -35,7 +35,7 @@ abstract class FilamentController {
Stream<FilamentEntity> get onLoad;
///
/// A Stream containing every FilamentEntity removed from the scene (i.e. via [removeAsset], [clearAssets], [removeLight] or [clearLights]).
/// A Stream containing every FilamentEntity removed from the scene (i.e. via [removeEntity], [clearEntities], [removeLight] or [clearLights]).
Stream<FilamentEntity> get onUnload;
@@ -294,13 +294,13 @@ abstract class FilamentController {
/// Removes/destroys the specified entity from the scene.
/// [entity] will no longer be a valid handle after this method is called; ensure you immediately discard all references once this method is complete.
///
Future removeAsset(FilamentEntity entity);
Future removeEntity(FilamentEntity entity);
///
/// Removes/destroys all renderable entities from the scene (including cameras).
/// All [FilamentEntity] handles will no longer be valid after this method is called; ensure you immediately discard all references to all entities once this method is complete.
///
Future clearAssets();
Future clearEntities();
///
/// Called by `FilamentGestureDetector`. You probably don't want to call this yourself.

View File

@@ -817,21 +817,21 @@ class FilamentControllerFFI extends FilamentController {
}
@override
Future removeAsset(FilamentEntity entity) async {
Future removeEntity(FilamentEntity entity) async {
if (_viewer == null) {
throw Exception("No viewer available, ignoring");
}
_entities.remove(entity);
remove_asset_ffi(_viewer!, entity);
remove_entity_ffi(_viewer!, entity);
_onUnloadController.add(entity);
}
@override
Future clearAssets() async {
Future clearEntities() async {
if (_viewer == null) {
throw Exception("No viewer available, ignoring");
}
clear_assets_ffi(_viewer!);
clear_entities_ffi(_viewer!);
for (final entity in _entities) {
_onUnloadController.add(entity);

View File

@@ -499,15 +499,15 @@ external int get_morph_target_name_count(
);
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId)>(
symbol: 'remove_asset', assetId: 'flutter_filament_plugin')
external void remove_asset(
symbol: 'remove_entity', assetId: 'flutter_filament_plugin')
external void remove_entity(
ffi.Pointer<ffi.Void> viewer,
int asset,
);
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(
symbol: 'clear_assets', assetId: 'flutter_filament_plugin')
external void clear_assets(
symbol: 'clear_entities', assetId: 'flutter_filament_plugin')
external void clear_entities(
ffi.Pointer<ffi.Void> viewer,
);
@@ -852,14 +852,15 @@ external void flutter_filament_free(
ffi.Void Function(
ffi.Pointer<ffi.Void>,
EntityId,
ffi.Pointer<
ffi.NativeFunction<ffi.Void Function(EntityId entityId)>>)>(
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(EntityId entityId)>>,
ffi.Bool)>(
symbol: 'add_collision_component', assetId: 'flutter_filament_plugin')
external void add_collision_component(
ffi.Pointer<ffi.Void> assetManager,
int entityId,
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(EntityId entityId)>>
callback,
bool affectsCollidingTransform,
);
@ffi.Native<
@@ -875,6 +876,14 @@ external int create_geometry(
ffi.Pointer<ffi.Char> materialPath,
);
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId, EntityId)>(
symbol: 'set_parent', assetId: 'flutter_filament_plugin')
external void set_parent(
ffi.Pointer<ffi.Void> assetManager,
int child,
int parent,
);
@ffi.Native<
ffi.Pointer<ffi.Void> Function(
ffi.Pointer<ffi.Void>,
@@ -1114,15 +1123,15 @@ external int load_gltf_ffi(
);
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId)>(
symbol: 'remove_asset_ffi', assetId: 'flutter_filament_plugin')
external void remove_asset_ffi(
symbol: 'remove_entity_ffi', assetId: 'flutter_filament_plugin')
external void remove_entity_ffi(
ffi.Pointer<ffi.Void> viewer,
int asset,
);
@ffi.Native<ffi.Void Function(ffi.Pointer<ffi.Void>)>(
symbol: 'clear_assets_ffi', assetId: 'flutter_filament_plugin')
external void clear_assets_ffi(
symbol: 'clear_entities_ffi', assetId: 'flutter_filament_plugin')
external void clear_entities_ffi(
ffi.Pointer<ffi.Void> viewer,
);