remove morph animation FFI-specific methods (regular methods are OK to use outside the engine thread)

This commit is contained in:
Nick Fisher
2023-11-19 18:12:38 +08:00
parent ad9e4689b1
commit f0683b0b24
5 changed files with 8 additions and 58 deletions

View File

@@ -50,22 +50,7 @@ FLUTTER_PLUGIN_EXPORT void apply_weights_ffi(
float *const weights,
int count
);
FLUTTER_PLUGIN_EXPORT void set_morph_target_weights_ffi(
void* const assetManager,
EntityId asset,
const char *const entityName,
const float *const morphData,
int numWeights
);
FLUTTER_PLUGIN_EXPORT bool set_morph_animation_ffi(
void* const assetManager,
EntityId asset,
const char *const entityName,
const float *const morphData,
const int* const morphIndices,
int numMorphTargets,
int numFrames,
float frameLengthInMs);
FLUTTER_PLUGIN_EXPORT void play_animation_ffi(void* const assetManager, EntityId asset, int index, bool loop, bool reverse, bool replaceActive, float crossfade);
FLUTTER_PLUGIN_EXPORT void set_animation_frame_ffi(void* const assetManager, EntityId asset, int animationIndex, int animationFrame);
FLUTTER_PLUGIN_EXPORT void stop_animation_ffi(void* const assetManager, EntityId asset, int index);

View File

@@ -352,12 +352,7 @@ get_morph_target_name_count_ffi(void *assetManager, EntityId asset,
return fut.get();
}
void set_morph_target_weights_ffi(void *const assetManager, EntityId asset,
const char *const entityName,
const float *const morphData,
int numWeights) {
// TODO
}
FLUTTER_PLUGIN_EXPORT void play_animation_ffi(void *const assetManager,
EntityId asset, int index,

View File

@@ -247,6 +247,8 @@ abstract class FilamentController {
///
/// Set the weights for all morph targets under node [meshName] in [entity] to [weights].
/// Note that [weights] must contain values for ALL morph targets, but no exception will be thrown if you don't do so (you'll just get incorrect results).
/// If you only want to set one value, set all others to zero (check [getMorphTargetNames] if you need the get a list of all morph targets.)
///
Future setMorphTargetWeights(
FilamentEntity entity, String meshName, List<double> weights);

View File

@@ -595,9 +595,11 @@ class FilamentControllerFFI extends FilamentController {
for (int i = 0; i < weights.length; i++) {
weightsPtr.elementAt(i).value = weights[i];
}
set_morph_target_weights_ffi(_assetManager!, entity,
meshName.toNativeUtf8().cast<Char>(), weightsPtr, weights.length);
var meshNamePtr = meshName.toNativeUtf8(allocator: calloc).cast<Char>();
set_morph_target_weights(
_assetManager!, entity, meshNamePtr, weightsPtr, weights.length);
calloc.free(weightsPtr);
calloc.free(meshNamePtr);
}
@override

View File

@@ -1019,40 +1019,6 @@ external void apply_weights_ffi(
int count,
);
@ffi.Native<
ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId,
ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Float>, ffi.Int)>(
symbol: 'set_morph_target_weights_ffi', assetId: 'flutter_filament_plugin')
external void set_morph_target_weights_ffi(
ffi.Pointer<ffi.Void> assetManager,
int asset,
ffi.Pointer<ffi.Char> entityName,
ffi.Pointer<ffi.Float> morphData,
int numWeights,
);
@ffi.Native<
ffi.Bool Function(
ffi.Pointer<ffi.Void>,
EntityId,
ffi.Pointer<ffi.Char>,
ffi.Pointer<ffi.Float>,
ffi.Pointer<ffi.Int>,
ffi.Int,
ffi.Int,
ffi.Float)>(
symbol: 'set_morph_animation_ffi', assetId: 'flutter_filament_plugin')
external bool set_morph_animation_ffi(
ffi.Pointer<ffi.Void> assetManager,
int asset,
ffi.Pointer<ffi.Char> entityName,
ffi.Pointer<ffi.Float> morphData,
ffi.Pointer<ffi.Int> morphIndices,
int numMorphTargets,
int numFrames,
double frameLengthInMs,
);
@ffi.Native<
ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId, ffi.Int, ffi.Bool,
ffi.Bool, ffi.Bool, ffi.Float)>(