From d248a85aeeb35bd22870488aa5d92d1c5dbde262 Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Fri, 20 Sep 2024 14:08:16 +0800 Subject: [PATCH] add createUnlitMaterialInstance, setMaterialPropertyInt methods to viewer interface --- .../viewer/thermion_viewer_base.dart | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/thermion_dart/lib/thermion_dart/viewer/thermion_viewer_base.dart b/thermion_dart/lib/thermion_dart/viewer/thermion_viewer_base.dart index bdac6c24..d0419f58 100644 --- a/thermion_dart/lib/thermion_dart/viewer/thermion_viewer_base.dart +++ b/thermion_dart/lib/thermion_dart/viewer/thermion_viewer_base.dart @@ -1,4 +1,5 @@ import 'package:thermion_dart/thermion_dart/viewer/events.dart'; +import 'package:thermion_dart/thermion_dart/viewer/ffi/thermion_viewer_ffi.dart'; import 'shared_types/shared_types.dart'; export 'shared_types/shared_types.dart'; @@ -189,7 +190,10 @@ abstract class ThermionViewer { /// If [keepData] is false, the source glTF data will be released and [createInstance] will throw an exception. /// Future loadGlbFromBuffer(Uint8List data, - {int numInstances = 1, bool keepData = false, int priority=4, int layer=0}); + {int numInstances = 1, + bool keepData = false, + int priority = 4, + int layer = 0}); /// /// Create a new instance of [entity]. @@ -588,6 +592,13 @@ abstract class ThermionViewer { Future setMaterialPropertyFloat(ThermionEntity entity, String propertyName, int materialIndex, double value); + /// + /// Sets the material property [propertyName] under material [materialIndex] for [entity] to [value]. + /// [entity] must have a Renderable attached. + /// + Future setMaterialPropertyInt(ThermionEntity entity, String propertyName, + int materialIndex, int value); + /// /// Scale [entity] to fit within the unit cube. /// @@ -786,7 +797,8 @@ abstract class ThermionViewer { /// Creates a (renderable) entity with the specified geometry and adds to the scene. /// If [keepData] is true, the source data will not be released. /// - Future createGeometry(Geometry geometry, {MaterialInstance? materialInstance, bool keepData = false}); + Future createGeometry(Geometry geometry, + {MaterialInstance? materialInstance, bool keepData = false}); /// /// Gets the parent entity of [entity]. Returns null if the entity has no parent. @@ -915,4 +927,9 @@ abstract class ThermionViewer { /// /// Future destroyMaterialInstance(covariant MaterialInstance materialInstance); + + /// + /// + /// + Future createUnlitMaterialInstance(); }