From 4086c9bd01d521b46bd77fab7490354fd693478e Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Mon, 9 Jun 2025 18:26:36 +0800 Subject: [PATCH] add interface methods for getPrimitiveCount, setMaterialInstancesFromMap, getMaterialInstancesAsMap and setMaterialInstanceForAll --- .../lib/src/filament/src/interface/asset.dart | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/thermion_dart/lib/src/filament/src/interface/asset.dart b/thermion_dart/lib/src/filament/src/interface/asset.dart index 5b0d68a5..156c9922 100644 --- a/thermion_dart/lib/src/filament/src/interface/asset.dart +++ b/thermion_dart/lib/src/filament/src/interface/asset.dart @@ -48,7 +48,10 @@ abstract class ThermionAsset { Future getMaterialInstanceAt( {ThermionEntity? entity, int index = 0}); + /// Sets the material instance for the primitive at [primitiveIndex] in + /// [entity]. /// + /// If [entity] is null, the top-most parent for this asset will be used. /// /// Future setMaterialInstanceAt(covariant MaterialInstance instance, @@ -56,9 +59,37 @@ abstract class ThermionAsset { throw UnimplementedError(); } + /// Sets the material instance for all primitives in all entities to + /// [instance]. /// + Future setMaterialInstanceForAll(covariant MaterialInstance instance) { + throw UnimplementedError(); + } + + /// Returns a map of all renderable entities attached to this asset, and + /// a list of material instances for each primitive for the respective + /// entity. + /// + Future>> + getMaterialInstancesAsMap() { + throw UnimplementedError(); + } + + + /// For each entity in the given map, set the material instance + /// for the respective primitive. + /// + /// Mainly intended for use with [getMaterialInstancesAsMap] so you can + /// easily save/restore an asset's material instances. + /// + Future setMaterialInstancesFromMap( + Map> materialInstances) async { + throw UnimplementedError(); + } + /// Renders an outline around [entity] with the given color. /// + /// Future setStencilHighlight( {double r = 1.0, double g = 0.0, double b = 0.0, int? entityIndex}); @@ -340,4 +371,12 @@ abstract class ThermionAsset { /// Removes an animation component from [entity]. /// Future removeAnimationComponent(); + + /// Returns the number of primitives in [entity] (which is assumed to have + /// a Renderable component attached). + /// + /// + Future getPrimitiveCount({ThermionEntity? entity}) async { + throw UnimplementedError(); + } }