add method for setting material color

This commit is contained in:
Nick Fisher
2023-08-19 13:52:57 +08:00
parent ed72c16724
commit 042439a72b
7 changed files with 823 additions and 754 deletions

View File

@@ -260,13 +260,12 @@ class FilamentController {
///
void setMorphAnimationData(
FilamentEntity asset, MorphAnimationData animation) async {
print("SETTING animation with ${animation.data}");
await _channel.invokeMethod("setMorphAnimation", [
_assetManager,
asset,
animation.meshName,
animation.data,
animation.morphIndices,
animation.animatedMorphIndices,
animation.numMorphTargets,
animation.numFrames,
animation.frameLengthInMs
@@ -402,6 +401,22 @@ class FilamentController {
await _channel.invokeMethod("setTexture", [_assetManager, asset]);
}
void setMaterialColor(FilamentEntity asset, String meshName,
int materialIndex, Color color) async {
await _channel.invokeMethod("setMaterialColor", [
_assetManager,
asset,
meshName,
materialIndex,
[
color.red.toDouble() / 255.0,
color.green.toDouble() / 255.0,
color.blue.toDouble() / 255.0,
color.alpha.toDouble() / 255.0
]
]);
}
void transformToUnitCube(FilamentEntity asset) async {
await _channel.invokeMethod("transformToUnitCube", [_assetManager, asset]);
}