add support for multiple bone animations using quaternions
This commit is contained in:
@@ -97,6 +97,8 @@ class ExampleWidgetState extends State<ExampleWidget> {
|
||||
await _filamentController!.setRendering(true);
|
||||
shapes =
|
||||
await _filamentController!.loadGlb("assets/shapes/shapes.glb");
|
||||
ExampleWidgetState.animations = await _filamentController!
|
||||
.getAnimationNames(ExampleWidgetState.shapes!);
|
||||
hasSkybox = true;
|
||||
rendering = true;
|
||||
});
|
||||
|
||||
@@ -2,10 +2,13 @@ import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_filament/animations/animation_data.dart';
|
||||
import 'package:flutter_filament/filament_controller.dart';
|
||||
import 'package:flutter_filament_example/main.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
import 'package:vector_math/vector_math_64.dart' as v;
|
||||
|
||||
class AssetSubmenu extends StatefulWidget {
|
||||
final FilamentController controller;
|
||||
const AssetSubmenu({super.key, required this.controller});
|
||||
@@ -65,7 +68,25 @@ class _AssetSubmenuState extends State<AssetSubmenu> {
|
||||
0,
|
||||
Matrix4.rotationX(pi / 2));
|
||||
},
|
||||
child: const Text('Set bone tranform to identity for Cylinder')),
|
||||
child:
|
||||
const Text('Set bone transform for Cylinder (pi/2 rotation X)')),
|
||||
MenuItemButton(
|
||||
onPressed: ExampleWidgetState.shapes == null
|
||||
? null
|
||||
: () async {
|
||||
await widget.controller.addBoneAnimation(
|
||||
ExampleWidgetState.shapes!,
|
||||
BoneAnimationData(
|
||||
"Bone",
|
||||
["Cylinder"],
|
||||
List.generate(
|
||||
60,
|
||||
(idx) => v.Quaternion.axisAngle(
|
||||
v.Vector3(0, 0, 1), pi * (idx / 60))
|
||||
.normalized()),
|
||||
1000.0 / 30.0));
|
||||
},
|
||||
child: const Text('Set bone transform animation for Cylinder')),
|
||||
MenuItemButton(
|
||||
onPressed: () async {
|
||||
var names = await widget.controller
|
||||
|
||||
@@ -13,92 +13,108 @@
|
||||
|
||||
typedef int32_t EntityId;
|
||||
|
||||
namespace polyvox {
|
||||
namespace polyvox
|
||||
{
|
||||
using namespace filament;
|
||||
using namespace filament::gltfio;
|
||||
|
||||
class AssetManager {
|
||||
public:
|
||||
AssetManager(const ResourceLoaderWrapper* const loader,
|
||||
NameComponentManager* ncm,
|
||||
Engine* engine,
|
||||
Scene* scene,
|
||||
const char* uberArchivePath);
|
||||
~AssetManager();
|
||||
EntityId loadGltf(const char* uri, const char* relativeResourcePath);
|
||||
EntityId loadGlb(const char* uri, bool unlit);
|
||||
FilamentAsset* getAssetByEntityId(EntityId entityId);
|
||||
void remove(EntityId entity);
|
||||
void destroyAll();
|
||||
unique_ptr<vector<string>> getAnimationNames(EntityId entity);
|
||||
float getAnimationDuration(EntityId entity, int animationIndex);
|
||||
unique_ptr<vector<string>> getMorphTargetNames(EntityId entity, const char *meshName);
|
||||
void transformToUnitCube(EntityId e);
|
||||
inline void updateTransform(EntityId e);
|
||||
void setScale(EntityId e, float scale);
|
||||
void setPosition(EntityId e, float x, float y, float z);
|
||||
void setRotation(EntityId e, float rads, float x, float y, float z);
|
||||
const utils::Entity *getCameraEntities(EntityId e);
|
||||
size_t getCameraEntityCount(EntityId e);
|
||||
const utils::Entity* getLightEntities(EntityId e) const noexcept;
|
||||
size_t getLightEntityCount(EntityId e) const noexcept;
|
||||
void updateAnimations();
|
||||
bool setMaterialColor(EntityId e, const char* meshName, int materialInstance, const float r, const float g, const float b, const float a);
|
||||
class AssetManager
|
||||
{
|
||||
public:
|
||||
AssetManager(const ResourceLoaderWrapper *const loader,
|
||||
NameComponentManager *ncm,
|
||||
Engine *engine,
|
||||
Scene *scene,
|
||||
const char *uberArchivePath);
|
||||
~AssetManager();
|
||||
EntityId loadGltf(const char *uri, const char *relativeResourcePath);
|
||||
EntityId loadGlb(const char *uri, bool unlit);
|
||||
FilamentAsset *getAssetByEntityId(EntityId entityId);
|
||||
void remove(EntityId entity);
|
||||
void destroyAll();
|
||||
unique_ptr<vector<string>> getAnimationNames(EntityId entity);
|
||||
float getAnimationDuration(EntityId entity, int animationIndex);
|
||||
unique_ptr<vector<string>> getMorphTargetNames(EntityId entity, const char *meshName);
|
||||
void transformToUnitCube(EntityId e);
|
||||
inline void updateTransform(EntityId e);
|
||||
void setScale(EntityId e, float scale);
|
||||
void setPosition(EntityId e, float x, float y, float z);
|
||||
void setRotation(EntityId e, float rads, float x, float y, float z);
|
||||
const utils::Entity *getCameraEntities(EntityId e);
|
||||
size_t getCameraEntityCount(EntityId e);
|
||||
const utils::Entity *getLightEntities(EntityId e) const noexcept;
|
||||
size_t getLightEntityCount(EntityId e) const noexcept;
|
||||
void updateAnimations();
|
||||
bool setMaterialColor(EntityId e, const char *meshName, int materialInstance, const float r, const float g, const float b, const float a);
|
||||
|
||||
bool setMorphAnimationBuffer(
|
||||
EntityId entityId,
|
||||
const char* entityName,
|
||||
const float* const morphData,
|
||||
const int* const morphIndices,
|
||||
int numMorphTargets,
|
||||
int numFrames,
|
||||
float frameLengthInMs);
|
||||
|
||||
void setMorphTargetWeights(EntityId entityId, const char* const entityName, const float* const weights, int count);
|
||||
bool setMorphAnimationBuffer(
|
||||
EntityId entityId,
|
||||
const char *entityName,
|
||||
const float *const morphData,
|
||||
const int *const morphIndices,
|
||||
int numMorphTargets,
|
||||
int numFrames,
|
||||
float frameLengthInMs);
|
||||
|
||||
bool setBoneAnimationBuffer(
|
||||
EntityId entity,
|
||||
const float* const frameData,
|
||||
int numFrames,
|
||||
int numBones,
|
||||
const char** const boneNames,
|
||||
const char** const meshName,
|
||||
int numMeshTargets,
|
||||
float frameLengthInMs);
|
||||
void playAnimation(EntityId e, int index, bool loop, bool reverse, bool replaceActive, float crossfade = 0.3f);
|
||||
void stopAnimation(EntityId e, int index);
|
||||
void setMorphTargetWeights(const char* const entityName, float *weights, int count);
|
||||
void loadTexture(EntityId entity, const char* resourcePath, int renderableIndex);
|
||||
void setAnimationFrame(EntityId entity, int animationIndex, int animationFrame);
|
||||
bool hide(EntityId entity, const char* meshName);
|
||||
bool reveal(EntityId entity, const char* meshName);
|
||||
const char* getNameForEntity(EntityId entityId);
|
||||
void setMorphTargetWeights(EntityId entityId, const char *const entityName, const float *const weights, int count);
|
||||
|
||||
bool setBoneTransform(EntityId entityId, const char* entityName, int skinIndex, int boneIndex, math::mat4f transform);
|
||||
|
||||
private:
|
||||
AssetLoader* _assetLoader = nullptr;
|
||||
const ResourceLoaderWrapper* const _resourceLoaderWrapper;
|
||||
NameComponentManager* _ncm = nullptr;
|
||||
Engine* _engine;
|
||||
Scene* _scene;
|
||||
MaterialProvider* _ubershaderProvider = nullptr;
|
||||
gltfio::ResourceLoader* _gltfResourceLoader = nullptr;
|
||||
gltfio::TextureProvider* _stbDecoder = nullptr;
|
||||
gltfio::TextureProvider* _ktxDecoder = nullptr;
|
||||
std::mutex _animationMutex;
|
||||
|
||||
vector<SceneAsset> _assets;
|
||||
tsl::robin_map<EntityId, int> _entityIdLookup;
|
||||
|
||||
utils::Entity findEntityByName(
|
||||
SceneAsset asset,
|
||||
const char* entityName
|
||||
);
|
||||
|
||||
inline void updateTransform(SceneAsset& asset);
|
||||
/// @brief Set the local transform for the bone at boneIndex/skinIndex in the given entity.
|
||||
/// @param entityId
|
||||
/// @param entityName
|
||||
/// @param skinIndex
|
||||
/// @param boneIndex
|
||||
/// @param transform
|
||||
/// @return
|
||||
bool setBoneTransform(EntityId entityId, const char *entityName, int skinIndex, int boneIndex, math::mat4f transform);
|
||||
|
||||
inline void setBoneTransformFromAnimation(SceneAsset& asset, int frameNumber);
|
||||
/// @brief Set frame data to animate the given bones/entities.
|
||||
/// @param entity
|
||||
/// @param frameData frame data as quaternions
|
||||
/// @param numFrames
|
||||
/// @param boneName
|
||||
/// @param meshName
|
||||
/// @param numMeshTargets
|
||||
/// @param frameLengthInMs
|
||||
/// @return
|
||||
bool addBoneAnimation(
|
||||
EntityId entity,
|
||||
const float *const frameData,
|
||||
int numFrames,
|
||||
const char *const boneName,
|
||||
const char **const meshName,
|
||||
int numMeshTargets,
|
||||
float frameLengthInMs);
|
||||
void playAnimation(EntityId e, int index, bool loop, bool reverse, bool replaceActive, float crossfade = 0.3f);
|
||||
void stopAnimation(EntityId e, int index);
|
||||
void setMorphTargetWeights(const char *const entityName, float *weights, int count);
|
||||
void loadTexture(EntityId entity, const char *resourcePath, int renderableIndex);
|
||||
void setAnimationFrame(EntityId entity, int animationIndex, int animationFrame);
|
||||
bool hide(EntityId entity, const char *meshName);
|
||||
bool reveal(EntityId entity, const char *meshName);
|
||||
const char *getNameForEntity(EntityId entityId);
|
||||
|
||||
private:
|
||||
AssetLoader *_assetLoader = nullptr;
|
||||
const ResourceLoaderWrapper *const _resourceLoaderWrapper;
|
||||
NameComponentManager *_ncm = nullptr;
|
||||
Engine *_engine;
|
||||
Scene *_scene;
|
||||
MaterialProvider *_ubershaderProvider = nullptr;
|
||||
gltfio::ResourceLoader *_gltfResourceLoader = nullptr;
|
||||
gltfio::TextureProvider *_stbDecoder = nullptr;
|
||||
gltfio::TextureProvider *_ktxDecoder = nullptr;
|
||||
std::mutex _animationMutex;
|
||||
|
||||
vector<SceneAsset> _assets;
|
||||
tsl::robin_map<EntityId, int> _entityIdLookup;
|
||||
|
||||
utils::Entity findEntityByName(
|
||||
SceneAsset asset,
|
||||
const char *entityName);
|
||||
|
||||
inline void updateTransform(SceneAsset &asset);
|
||||
|
||||
void updateBoneTransformFromAnimationBuffer(const BoneAnimation& animation, int frameNumber);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
#ifndef _FLUTTER_FILAMENT_API_H
|
||||
#define _FLUTTER_FILAMENT_API_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN32
|
||||
#ifdef IS_DLL
|
||||
#define FLUTTER_PLUGIN_EXPORT __declspec( dllimport )
|
||||
#define FLUTTER_PLUGIN_EXPORT __declspec(dllimport)
|
||||
#else
|
||||
#define FLUTTER_PLUGIN_EXPORT __declspec( dllexport )
|
||||
#define FLUTTER_PLUGIN_EXPORT __declspec(dllexport)
|
||||
#endif
|
||||
#else
|
||||
#define FLUTTER_PLUGIN_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
// we copy the LLVM <stdbool.h> here rather than including,
|
||||
// we copy the LLVM <stdbool.h> here rather than including,
|
||||
// because on Windows it's difficult to pin the exact location which confuses dart ffigen
|
||||
|
||||
#ifndef __STDBOOL_H
|
||||
@@ -50,131 +50,126 @@ typedef int32_t EntityId;
|
||||
typedef int32_t _ManipulatorMode;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT const void* create_filament_viewer(const void* const context, const ResourceLoaderWrapper* const loader, void* const platform, const char* uberArchivePath);
|
||||
FLUTTER_PLUGIN_EXPORT void destroy_filament_viewer(const void* const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT ResourceLoaderWrapper* make_resource_loader(LoadFilamentResourceFromOwner loadFn, FreeFilamentResourceFromOwner freeFn, void* owner);
|
||||
FLUTTER_PLUGIN_EXPORT void* get_asset_manager(const void* const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void create_render_target(const void* const viewer, intptr_t texture, uint32_t width, uint32_t height);
|
||||
FLUTTER_PLUGIN_EXPORT void clear_background_image(const void* const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void set_background_image(const void* const viewer, const char *path, bool fillHeight);
|
||||
FLUTTER_PLUGIN_EXPORT void set_background_image_position(const void* const viewer, float x, float y, bool clamp);
|
||||
FLUTTER_PLUGIN_EXPORT void set_background_color(const void* const viewer, const float r, const float g, const float b, const float a);
|
||||
FLUTTER_PLUGIN_EXPORT void set_tone_mapping(const void* const viewer, int toneMapping);
|
||||
FLUTTER_PLUGIN_EXPORT void set_bloom(const void* const viewer, float strength);
|
||||
FLUTTER_PLUGIN_EXPORT void load_skybox(const void* const viewer, const char *skyboxPath);
|
||||
FLUTTER_PLUGIN_EXPORT void load_ibl(const void* const viewer, const char *iblPath, float intensity);
|
||||
FLUTTER_PLUGIN_EXPORT void remove_skybox(const void* const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void remove_ibl(const void* const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT EntityId add_light(const void* const viewer, uint8_t type, float colour, float intensity, float posX, float posY, float posZ, float dirX, float dirY, float dirZ, bool shadows);
|
||||
FLUTTER_PLUGIN_EXPORT void remove_light(const void* const viewer, EntityId entityId);
|
||||
FLUTTER_PLUGIN_EXPORT void clear_lights(const void* const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT EntityId load_glb(void *assetManager, const char *assetPath, bool unlit);
|
||||
FLUTTER_PLUGIN_EXPORT EntityId load_gltf(void *assetManager, const char *assetPath, const char *relativePath);
|
||||
FLUTTER_PLUGIN_EXPORT bool set_camera(const void* const viewer, EntityId asset, const char *nodeName);
|
||||
FLUTTER_PLUGIN_EXPORT void set_view_frustum_culling(const void* const viewer, bool enabled);
|
||||
FLUTTER_PLUGIN_EXPORT void render(
|
||||
const void* const viewer,
|
||||
uint64_t frameTimeInNanos,
|
||||
void* pixelBuffer,
|
||||
void (*callback)(void *buf, size_t size, void *data),
|
||||
void* data
|
||||
);
|
||||
FLUTTER_PLUGIN_EXPORT void create_swap_chain(const void* const viewer, const void* const window, uint32_t width, uint32_t height);
|
||||
FLUTTER_PLUGIN_EXPORT void destroy_swap_chain(const void* const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void set_frame_interval(const void* const viewer, float interval);
|
||||
FLUTTER_PLUGIN_EXPORT void update_viewport_and_camera_projection(const void* const viewer, uint32_t width, uint32_t height, float scaleFactor);
|
||||
FLUTTER_PLUGIN_EXPORT void scroll_begin(const void* const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void scroll_update(const void* const viewer, float x, float y, float z);
|
||||
FLUTTER_PLUGIN_EXPORT void scroll_end(const void* const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void grab_begin(const void* const viewer, float x, float y, bool pan);
|
||||
FLUTTER_PLUGIN_EXPORT void grab_update(const void* const viewer, float x, float y);
|
||||
FLUTTER_PLUGIN_EXPORT void grab_end(const void* const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void apply_weights(
|
||||
void* assetManager,
|
||||
EntityId asset,
|
||||
const char *const entityName,
|
||||
float *const weights,
|
||||
int count
|
||||
);
|
||||
FLUTTER_PLUGIN_EXPORT void set_morph_target_weights(
|
||||
void* assetManager,
|
||||
EntityId asset,
|
||||
const char *const entityName,
|
||||
const float *const morphData,
|
||||
int numWeights
|
||||
);
|
||||
FLUTTER_PLUGIN_EXPORT bool set_morph_animation(
|
||||
void* 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 set_bone_animation(
|
||||
void* assetManager,
|
||||
EntityId asset,
|
||||
const float* const frameData,
|
||||
int numFrames,
|
||||
int numBones,
|
||||
const char** const boneNames,
|
||||
const char** const meshName,
|
||||
int numMeshTargets,
|
||||
float frameLengthInMs);
|
||||
FLUTTER_PLUGIN_EXPORT bool set_bone_transform(
|
||||
void* assetManager,
|
||||
EntityId asset,
|
||||
const char* entityName,
|
||||
const float* const transform,
|
||||
int boneIndex
|
||||
);
|
||||
FLUTTER_PLUGIN_EXPORT void play_animation(void* assetManager, EntityId asset, int index, bool loop, bool reverse, bool replaceActive, float crossfade);
|
||||
FLUTTER_PLUGIN_EXPORT void set_animation_frame(void* assetManager, EntityId asset, int animationIndex, int animationFrame);
|
||||
FLUTTER_PLUGIN_EXPORT void stop_animation(void* assetManager, EntityId asset, int index);
|
||||
FLUTTER_PLUGIN_EXPORT int get_animation_count(void* assetManager, EntityId asset);
|
||||
FLUTTER_PLUGIN_EXPORT void get_animation_name(void* assetManager, EntityId asset, char *const outPtr, int index);
|
||||
FLUTTER_PLUGIN_EXPORT float get_animation_duration(void* assetManager, EntityId asset, int index);
|
||||
FLUTTER_PLUGIN_EXPORT void get_morph_target_name(void* assetManager, EntityId asset, const char *meshName, char *const outPtr, int index);
|
||||
FLUTTER_PLUGIN_EXPORT int get_morph_target_name_count(void* assetManager, EntityId asset, const char *meshName);
|
||||
FLUTTER_PLUGIN_EXPORT void remove_asset(const void* const viewer, EntityId asset);
|
||||
FLUTTER_PLUGIN_EXPORT void clear_assets(const void* const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT bool set_material_color(void* assetManager, EntityId asset, const char* meshName, int materialIndex, const float r, const float g, const float b, const float a);
|
||||
FLUTTER_PLUGIN_EXPORT void transform_to_unit_cube(void* assetManager, EntityId asset);
|
||||
FLUTTER_PLUGIN_EXPORT void set_position(void* assetManager, EntityId asset, float x, float y, float z);
|
||||
FLUTTER_PLUGIN_EXPORT void set_rotation(void* assetManager, EntityId asset, float rads, float x, float y, float z);
|
||||
FLUTTER_PLUGIN_EXPORT void set_scale(void* assetManager, EntityId asset, float scale);
|
||||
FLUTTER_PLUGIN_EXPORT const void *create_filament_viewer(const void *const context, const ResourceLoaderWrapper *const loader, void *const platform, const char *uberArchivePath);
|
||||
FLUTTER_PLUGIN_EXPORT void destroy_filament_viewer(const void *const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT ResourceLoaderWrapper *make_resource_loader(LoadFilamentResourceFromOwner loadFn, FreeFilamentResourceFromOwner freeFn, void *owner);
|
||||
FLUTTER_PLUGIN_EXPORT void *get_asset_manager(const void *const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void create_render_target(const void *const viewer, intptr_t texture, uint32_t width, uint32_t height);
|
||||
FLUTTER_PLUGIN_EXPORT void clear_background_image(const void *const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void set_background_image(const void *const viewer, const char *path, bool fillHeight);
|
||||
FLUTTER_PLUGIN_EXPORT void set_background_image_position(const void *const viewer, float x, float y, bool clamp);
|
||||
FLUTTER_PLUGIN_EXPORT void set_background_color(const void *const viewer, const float r, const float g, const float b, const float a);
|
||||
FLUTTER_PLUGIN_EXPORT void set_tone_mapping(const void *const viewer, int toneMapping);
|
||||
FLUTTER_PLUGIN_EXPORT void set_bloom(const void *const viewer, float strength);
|
||||
FLUTTER_PLUGIN_EXPORT void load_skybox(const void *const viewer, const char *skyboxPath);
|
||||
FLUTTER_PLUGIN_EXPORT void load_ibl(const void *const viewer, const char *iblPath, float intensity);
|
||||
FLUTTER_PLUGIN_EXPORT void remove_skybox(const void *const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void remove_ibl(const void *const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT EntityId add_light(const void *const viewer, uint8_t type, float colour, float intensity, float posX, float posY, float posZ, float dirX, float dirY, float dirZ, bool shadows);
|
||||
FLUTTER_PLUGIN_EXPORT void remove_light(const void *const viewer, EntityId entityId);
|
||||
FLUTTER_PLUGIN_EXPORT void clear_lights(const void *const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT EntityId load_glb(void *assetManager, const char *assetPath, bool unlit);
|
||||
FLUTTER_PLUGIN_EXPORT EntityId load_gltf(void *assetManager, const char *assetPath, const char *relativePath);
|
||||
FLUTTER_PLUGIN_EXPORT bool set_camera(const void *const viewer, EntityId asset, const char *nodeName);
|
||||
FLUTTER_PLUGIN_EXPORT void set_view_frustum_culling(const void *const viewer, bool enabled);
|
||||
FLUTTER_PLUGIN_EXPORT void render(
|
||||
const void *const viewer,
|
||||
uint64_t frameTimeInNanos,
|
||||
void *pixelBuffer,
|
||||
void (*callback)(void *buf, size_t size, void *data),
|
||||
void *data);
|
||||
FLUTTER_PLUGIN_EXPORT void create_swap_chain(const void *const viewer, const void *const window, uint32_t width, uint32_t height);
|
||||
FLUTTER_PLUGIN_EXPORT void destroy_swap_chain(const void *const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void set_frame_interval(const void *const viewer, float interval);
|
||||
FLUTTER_PLUGIN_EXPORT void update_viewport_and_camera_projection(const void *const viewer, uint32_t width, uint32_t height, float scaleFactor);
|
||||
FLUTTER_PLUGIN_EXPORT void scroll_begin(const void *const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void scroll_update(const void *const viewer, float x, float y, float z);
|
||||
FLUTTER_PLUGIN_EXPORT void scroll_end(const void *const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void grab_begin(const void *const viewer, float x, float y, bool pan);
|
||||
FLUTTER_PLUGIN_EXPORT void grab_update(const void *const viewer, float x, float y);
|
||||
FLUTTER_PLUGIN_EXPORT void grab_end(const void *const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void apply_weights(
|
||||
void *assetManager,
|
||||
EntityId asset,
|
||||
const char *const entityName,
|
||||
float *const weights,
|
||||
int count);
|
||||
FLUTTER_PLUGIN_EXPORT void set_morph_target_weights(
|
||||
void *assetManager,
|
||||
EntityId asset,
|
||||
const char *const entityName,
|
||||
const float *const morphData,
|
||||
int numWeights);
|
||||
FLUTTER_PLUGIN_EXPORT bool set_morph_animation(
|
||||
void *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 add_bone_animation(
|
||||
void *assetManager,
|
||||
EntityId asset,
|
||||
const float *const frameData,
|
||||
int numFrames,
|
||||
const char *const boneName,
|
||||
const char **const meshNames,
|
||||
int numMeshTargets,
|
||||
float frameLengthInMs);
|
||||
FLUTTER_PLUGIN_EXPORT bool set_bone_transform(
|
||||
void *assetManager,
|
||||
EntityId asset,
|
||||
const char *entityName,
|
||||
const float *const transform,
|
||||
int boneIndex);
|
||||
FLUTTER_PLUGIN_EXPORT void play_animation(void *assetManager, EntityId asset, int index, bool loop, bool reverse, bool replaceActive, float crossfade);
|
||||
FLUTTER_PLUGIN_EXPORT void set_animation_frame(void *assetManager, EntityId asset, int animationIndex, int animationFrame);
|
||||
FLUTTER_PLUGIN_EXPORT void stop_animation(void *assetManager, EntityId asset, int index);
|
||||
FLUTTER_PLUGIN_EXPORT int get_animation_count(void *assetManager, EntityId asset);
|
||||
FLUTTER_PLUGIN_EXPORT void get_animation_name(void *assetManager, EntityId asset, char *const outPtr, int index);
|
||||
FLUTTER_PLUGIN_EXPORT float get_animation_duration(void *assetManager, EntityId asset, int index);
|
||||
FLUTTER_PLUGIN_EXPORT void get_morph_target_name(void *assetManager, EntityId asset, const char *meshName, char *const outPtr, int index);
|
||||
FLUTTER_PLUGIN_EXPORT int get_morph_target_name_count(void *assetManager, EntityId asset, const char *meshName);
|
||||
FLUTTER_PLUGIN_EXPORT void remove_asset(const void *const viewer, EntityId asset);
|
||||
FLUTTER_PLUGIN_EXPORT void clear_assets(const void *const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT bool set_material_color(void *assetManager, EntityId asset, const char *meshName, int materialIndex, const float r, const float g, const float b, const float a);
|
||||
FLUTTER_PLUGIN_EXPORT void transform_to_unit_cube(void *assetManager, EntityId asset);
|
||||
FLUTTER_PLUGIN_EXPORT void set_position(void *assetManager, EntityId asset, float x, float y, float z);
|
||||
FLUTTER_PLUGIN_EXPORT void set_rotation(void *assetManager, EntityId asset, float rads, float x, float y, float z);
|
||||
FLUTTER_PLUGIN_EXPORT void set_scale(void *assetManager, EntityId asset, float scale);
|
||||
|
||||
// Camera methods
|
||||
FLUTTER_PLUGIN_EXPORT void move_camera_to_asset(const void* const viewer, EntityId asset);
|
||||
FLUTTER_PLUGIN_EXPORT void set_view_frustum_culling(const void* const viewer, bool enabled);
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_exposure(const void* const viewer, float aperture, float shutterSpeed, float sensitivity);
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_position(const void* const viewer, float x, float y, float z);
|
||||
FLUTTER_PLUGIN_EXPORT void get_camera_position(const void* const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_rotation(const void* const viewer, float rads, float x, float y, float z);
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_model_matrix(const void* const viewer, const float *const matrix);
|
||||
FLUTTER_PLUGIN_EXPORT const double* const get_camera_model_matrix(const void* const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT const double* const get_camera_view_matrix(const void* const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT const double* const get_camera_projection_matrix(const void* const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_projection_matrix(const void* const viewer, const double *const matrix, double near, double far);
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_culling(const void* const viewer, double near, double far);
|
||||
FLUTTER_PLUGIN_EXPORT const double* const get_camera_culling_projection_matrix(const void* const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT const double* const get_camera_frustum(const void* const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_focal_length(const void* const viewer, float focalLength);
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_focus_distance(const void* const viewer, float focusDistance);
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_manipulator_options(const void* const viewer, _ManipulatorMode mode, double orbitSpeedX, double orbitSpeedY, double zoomSpeed);
|
||||
// Camera methods
|
||||
FLUTTER_PLUGIN_EXPORT void move_camera_to_asset(const void *const viewer, EntityId asset);
|
||||
FLUTTER_PLUGIN_EXPORT void set_view_frustum_culling(const void *const viewer, bool enabled);
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_exposure(const void *const viewer, float aperture, float shutterSpeed, float sensitivity);
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_position(const void *const viewer, float x, float y, float z);
|
||||
FLUTTER_PLUGIN_EXPORT void get_camera_position(const void *const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_rotation(const void *const viewer, float rads, float x, float y, float z);
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_model_matrix(const void *const viewer, const float *const matrix);
|
||||
FLUTTER_PLUGIN_EXPORT const double *const get_camera_model_matrix(const void *const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT const double *const get_camera_view_matrix(const void *const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT const double *const get_camera_projection_matrix(const void *const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_projection_matrix(const void *const viewer, const double *const matrix, double near, double far);
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_culling(const void *const viewer, double near, double far);
|
||||
FLUTTER_PLUGIN_EXPORT const double *const get_camera_culling_projection_matrix(const void *const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT const double *const get_camera_frustum(const void *const viewer);
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_focal_length(const void *const viewer, float focalLength);
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_focus_distance(const void *const viewer, float focusDistance);
|
||||
FLUTTER_PLUGIN_EXPORT void set_camera_manipulator_options(const void *const viewer, _ManipulatorMode mode, double orbitSpeedX, double orbitSpeedY, double zoomSpeed);
|
||||
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT int hide_mesh(void* assetManager, EntityId asset, const char* meshName);
|
||||
FLUTTER_PLUGIN_EXPORT int reveal_mesh(void* assetManager, EntityId asset, const char* meshName);
|
||||
FLUTTER_PLUGIN_EXPORT void set_post_processing(void* const viewer, bool enabled);
|
||||
FLUTTER_PLUGIN_EXPORT void pick(void* const viewer, int x, int y, EntityId* entityId);
|
||||
FLUTTER_PLUGIN_EXPORT const char* get_name_for_entity(void* const assetManager, const EntityId entityId);
|
||||
FLUTTER_PLUGIN_EXPORT void ios_dummy();
|
||||
FLUTTER_PLUGIN_EXPORT void flutter_filament_free(void* ptr);
|
||||
FLUTTER_PLUGIN_EXPORT int hide_mesh(void *assetManager, EntityId asset, const char *meshName);
|
||||
FLUTTER_PLUGIN_EXPORT int reveal_mesh(void *assetManager, EntityId asset, const char *meshName);
|
||||
FLUTTER_PLUGIN_EXPORT void set_post_processing(void *const viewer, bool enabled);
|
||||
FLUTTER_PLUGIN_EXPORT void pick(void *const viewer, int x, int y, EntityId *entityId);
|
||||
FLUTTER_PLUGIN_EXPORT const char *get_name_for_entity(void *const assetManager, const EntityId entityId);
|
||||
FLUTTER_PLUGIN_EXPORT void ios_dummy();
|
||||
FLUTTER_PLUGIN_EXPORT void flutter_filament_free(void *ptr);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -66,17 +66,6 @@ FLUTTER_PLUGIN_EXPORT bool set_morph_animation_ffi(
|
||||
int numMorphTargets,
|
||||
int numFrames,
|
||||
float frameLengthInMs);
|
||||
FLUTTER_PLUGIN_EXPORT
|
||||
FLUTTER_PLUGIN_EXPORT void set_bone_animation_ffi(
|
||||
void* const assetManager,
|
||||
EntityId asset,
|
||||
const float* const frameData,
|
||||
int numFrames,
|
||||
int numBones,
|
||||
const char** const boneNames,
|
||||
const char** const meshName,
|
||||
int numMeshTargets,
|
||||
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);
|
||||
|
||||
@@ -36,50 +36,46 @@ namespace polyvox {
|
||||
};
|
||||
|
||||
struct AnimationStatus {
|
||||
time_point_t mStart = time_point_t::max();
|
||||
bool mLoop = false;
|
||||
bool mReverse = false;
|
||||
float mDuration = 0;
|
||||
AnimationType type;
|
||||
int gltfIndex = -1;
|
||||
time_point_t start = time_point_t::max();
|
||||
bool loop = false;
|
||||
bool reverse = false;
|
||||
float durationInSecs = 0;
|
||||
};
|
||||
|
||||
struct GltfAnimation : AnimationStatus {
|
||||
int index = -1;
|
||||
};
|
||||
|
||||
//
|
||||
// Use this to manually construct a buffer of frame data for morph animations.
|
||||
// Use this to construct a dynamic (i.e. non-glTF embedded) morph target animation.
|
||||
//
|
||||
struct MorphAnimationBuffer {
|
||||
utils::Entity mMeshTarget;
|
||||
int mNumFrames = -1;
|
||||
float mFrameLengthInMs = 0;
|
||||
vector<float> mFrameData;
|
||||
vector<int> mMorphIndices;
|
||||
struct MorphAnimation : AnimationStatus {
|
||||
utils::Entity meshTarget;
|
||||
int numFrames = -1;
|
||||
float frameLengthInMs = 0;
|
||||
vector<float> frameData;
|
||||
vector<int> morphIndices;
|
||||
int lengthInFrames;
|
||||
};
|
||||
|
||||
//
|
||||
// Use this to construct a dynamic (i.e. non-glTF embedded) bone animation.
|
||||
// Only a single animation is supported at any time (i.e you can't blend animations).
|
||||
// Multiple bones are supported but these must be skinned to a single mesh target.
|
||||
// Use this to construct a dynamic (i.e. non-glTF embedded) bone/joint animation.
|
||||
//
|
||||
struct BoneAnimationBuffer {
|
||||
vector<utils::Entity> mMeshTargets;
|
||||
vector<uint8_t> mBones;
|
||||
vector<math::mat4f> mBaseTransforms;
|
||||
// vector<math::float3> mBaseTranslations; // these are the base transforms for the bones we will animate; the translations/rotations in mFrameData will be relative to this.
|
||||
// vector<math::quatf> mBaseRotations; // these are the base transforms for the bones we will animate; the translations/rotations in mFrameData will be relative to this.
|
||||
// vector<math::float3> mBaseScales; // these are the base transforms for the bones we will animate; the translations/rotations in mFrameData will be relative to this.
|
||||
struct BoneAnimation : AnimationStatus {
|
||||
uint8_t boneIndex;
|
||||
vector<utils::Entity> meshTargets;
|
||||
size_t skinIndex = 0;
|
||||
int mNumFrames = -1;
|
||||
float mFrameLengthInMs = 0;
|
||||
vector<float> mFrameData;
|
||||
int lengthInFrames;
|
||||
float frameLengthInMs = 0;
|
||||
vector<const math::quatf> frameData;
|
||||
};
|
||||
|
||||
struct SceneAsset {
|
||||
bool mAnimating = false;
|
||||
FilamentAsset* mAsset = nullptr;
|
||||
Animator* mAnimator = nullptr;
|
||||
|
||||
// vector containing AnimationStatus structs for the morph, bone and/or glTF animations.
|
||||
vector<AnimationStatus> mAnimations;
|
||||
FilamentAsset* asset = nullptr;
|
||||
|
||||
vector<GltfAnimation> gltfAnimations;
|
||||
vector<MorphAnimation> morphAnimations;
|
||||
vector<BoneAnimation> boneAnimations;
|
||||
|
||||
// the index of the last active glTF animation,
|
||||
// used to cross-fade
|
||||
@@ -87,24 +83,19 @@ namespace polyvox {
|
||||
float fadeDuration = 0.0f;
|
||||
float fadeOutAnimationStart = 0.0f;
|
||||
|
||||
MorphAnimationBuffer mMorphAnimationBuffer;
|
||||
BoneAnimationBuffer mBoneAnimationBuffer;
|
||||
|
||||
// a slot to preload textures
|
||||
filament::Texture* mTexture = nullptr;
|
||||
filament::Texture* texture = nullptr;
|
||||
|
||||
// initialized to identity
|
||||
math::mat4f mPosition;
|
||||
math::mat4f position;
|
||||
|
||||
// initialized to identity
|
||||
math::mat4f mRotation;
|
||||
math::mat4f rotation;
|
||||
|
||||
float mScale = 1;
|
||||
|
||||
SceneAsset(
|
||||
FilamentAsset* asset
|
||||
) : mAsset(asset) {
|
||||
mAnimator = mAsset->getInstance()->getAnimator();
|
||||
}
|
||||
) : asset(asset) {}
|
||||
};
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -321,18 +321,17 @@ extern "C"
|
||||
return ((AssetManager *)assetManager)->setMorphAnimationBuffer(asset, entityName, morphData, morphIndices, numMorphTargets, numFrames, frameLengthInMs);
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_bone_animation(
|
||||
FLUTTER_PLUGIN_EXPORT void add_bone_animation(
|
||||
void *assetManager,
|
||||
EntityId asset,
|
||||
const float *const frameData,
|
||||
int numFrames,
|
||||
int numBones,
|
||||
const char **const boneNames,
|
||||
const char *const boneName,
|
||||
const char **const meshNames,
|
||||
int numMeshTargets,
|
||||
float frameLengthInMs)
|
||||
{
|
||||
((AssetManager *)assetManager)->setBoneAnimationBuffer(asset, frameData, numFrames, numBones, boneNames, meshNames, numMeshTargets, frameLengthInMs);
|
||||
((AssetManager *)assetManager)->addBoneAnimation(asset, frameData, numFrames, boneName, meshNames, numMeshTargets, frameLengthInMs);
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_post_processing(void *const viewer, bool enabled)
|
||||
@@ -366,33 +365,6 @@ extern "C"
|
||||
return ((AssetManager *)assetManager)->setBoneTransform(entityId, entityName, 0, boneIndex, matrix);
|
||||
}
|
||||
|
||||
// void set_bone_transform(
|
||||
// EntityId asset,
|
||||
// const char* boneName,
|
||||
// const char* entityName,
|
||||
// float transX,
|
||||
// float transY,
|
||||
// float transZ,
|
||||
// float quatX,
|
||||
// float quatY,
|
||||
// float quatZ,
|
||||
// float quatW
|
||||
// ) {
|
||||
// ((AssetManager*)assetManager)->setBoneTransform(
|
||||
// boneName,
|
||||
// entityName,
|
||||
// transX,
|
||||
// transY,
|
||||
// transZ,
|
||||
// quatX,
|
||||
// quatY,
|
||||
// quatZ,
|
||||
// quatW,
|
||||
// false
|
||||
// );
|
||||
|
||||
// }
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void play_animation(
|
||||
void *assetManager,
|
||||
EntityId asset,
|
||||
|
||||
@@ -331,18 +331,6 @@ FLUTTER_PLUGIN_EXPORT bool set_camera_ffi(void *const viewer, EntityId asset,
|
||||
return fut.get();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void set_bone_animation_ffi(
|
||||
void *assetManager, EntityId asset, const float *const frameData,
|
||||
int numFrames, int numBones, const char **const boneNames,
|
||||
const char **const meshName, int numMeshTargets, float frameLengthInMs) {
|
||||
std::packaged_task<void()> lambda([&] {
|
||||
set_bone_animation(assetManager, asset, frameData, numFrames, numBones,
|
||||
boneNames, meshName, numMeshTargets, frameLengthInMs);
|
||||
});
|
||||
auto fut = _rl->add_task(lambda);
|
||||
fut.wait();
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void
|
||||
get_morph_target_name_ffi(void *assetManager, EntityId asset,
|
||||
const char *meshName, char *const outPtr, int index) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:vector_math/vector_math_64.dart';
|
||||
|
||||
///
|
||||
/// Specifies frame data (i.e. weights) to animate the morph targets contained in [morphTargets] under a mesh named [mesh].
|
||||
/// [data] is laid out as numFrames x numMorphTargets.
|
||||
@@ -40,7 +42,7 @@ class MorphAnimationData {
|
||||
class BoneAnimationData {
|
||||
final String boneName;
|
||||
final List<String> meshNames;
|
||||
final Float32List frameData;
|
||||
final List<Quaternion> frameData;
|
||||
double frameLengthInMs;
|
||||
BoneAnimationData(
|
||||
this.boneName, this.meshNames, this.frameData, this.frameLengthInMs);
|
||||
|
||||
@@ -272,12 +272,9 @@ abstract class FilamentController {
|
||||
FilamentEntity entity, MorphAnimationData animation);
|
||||
|
||||
///
|
||||
/// Animates morph target weights/bone transforms (where each frame requires a duration of [frameLengthInMs].
|
||||
/// [morphWeights] is a list of doubles in frame-major format.
|
||||
/// Each frame is [numWeights] in length, and each entry is the weight to be applied to the morph target located at that index in the mesh primitive at that frame.
|
||||
/// for now we only allow animating a single bone (though multiple skinned targets are supported)
|
||||
/// Starts animating a bone (joint) according to the specified [animation].
|
||||
///
|
||||
Future setBoneAnimation(FilamentEntity entity, BoneAnimationData animation);
|
||||
Future addBoneAnimation(FilamentEntity entity, BoneAnimationData animation);
|
||||
|
||||
///
|
||||
/// Sets the local joint transform for the bone at the given index in [entity] for the mesh under [meshName].
|
||||
|
||||
@@ -691,41 +691,40 @@ class FilamentControllerFFI extends FilamentController {
|
||||
}
|
||||
|
||||
@override
|
||||
Future setBoneAnimation(
|
||||
Future addBoneAnimation(
|
||||
FilamentEntity entity, BoneAnimationData animation) async {
|
||||
if (_viewer == null) {
|
||||
throw Exception("No viewer available, ignoring");
|
||||
}
|
||||
// var data = calloc<Float>(animation.frameData.length);
|
||||
// int offset = 0;
|
||||
// var numFrames = animation.frameData.length ~/ 7;
|
||||
// var boneNames = calloc<Pointer<Char>>(1);
|
||||
// boneNames.elementAt(0).value =
|
||||
// animation.boneName.toNativeUtf8().cast<Char>();
|
||||
|
||||
// var meshNames = calloc<Pointer<Char>>(animation.meshNames.length);
|
||||
// for (int i = 0; i < animation.meshNames.length; i++) {
|
||||
// meshNames.elementAt(i).value =
|
||||
// animation.meshNames[i].toNativeUtf8().cast<Char>();
|
||||
// }
|
||||
var numFrames = animation.frameData.length;
|
||||
|
||||
// for (int i = 0; i < animation.frameData.length; i++) {
|
||||
// data.elementAt(offset).value = animation.frameData[i];
|
||||
// offset += 1;
|
||||
// }
|
||||
var meshNames = calloc<Pointer<Char>>(animation.meshNames.length);
|
||||
for (int i = 0; i < animation.meshNames.length; i++) {
|
||||
meshNames.elementAt(i).value =
|
||||
animation.meshNames[i].toNativeUtf8().cast<Char>();
|
||||
}
|
||||
|
||||
// await _channel.invokeMethod("setBoneAnimation", [
|
||||
// _assetManager!,
|
||||
// asset,
|
||||
// data,
|
||||
// numFrames,
|
||||
// 1,
|
||||
// boneNames,
|
||||
// meshNames,
|
||||
// animation.meshNames.length,
|
||||
// animation.frameLengthInMs
|
||||
// ]);
|
||||
// calloc.free(data);
|
||||
var data = calloc<Float>(numFrames * 4);
|
||||
|
||||
for (int i = 0; i < numFrames; i++) {
|
||||
data.elementAt(i * 4).value = animation.frameData[i].w;
|
||||
data.elementAt((i * 4) + 1).value = animation.frameData[i].x;
|
||||
data.elementAt((i * 4) + 2).value = animation.frameData[i].y;
|
||||
data.elementAt((i * 4) + 3).value = animation.frameData[i].z;
|
||||
}
|
||||
|
||||
add_bone_animation(
|
||||
_assetManager!,
|
||||
entity,
|
||||
data,
|
||||
numFrames,
|
||||
animation.boneName.toNativeUtf8().cast<Char>(),
|
||||
meshNames,
|
||||
animation.meshNames.length,
|
||||
animation.frameLengthInMs);
|
||||
calloc.free(data);
|
||||
calloc.free(meshNames);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -370,20 +370,18 @@ external bool set_morph_animation(
|
||||
EntityId,
|
||||
ffi.Pointer<ffi.Float>,
|
||||
ffi.Int,
|
||||
ffi.Int,
|
||||
ffi.Pointer<ffi.Pointer<ffi.Char>>,
|
||||
ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<ffi.Pointer<ffi.Char>>,
|
||||
ffi.Int,
|
||||
ffi.Float)>(
|
||||
symbol: 'set_bone_animation', assetId: 'flutter_filament_plugin')
|
||||
external void set_bone_animation(
|
||||
symbol: 'add_bone_animation', assetId: 'flutter_filament_plugin')
|
||||
external void add_bone_animation(
|
||||
ffi.Pointer<ffi.Void> assetManager,
|
||||
int asset,
|
||||
ffi.Pointer<ffi.Float> frameData,
|
||||
int numFrames,
|
||||
int numBones,
|
||||
ffi.Pointer<ffi.Pointer<ffi.Char>> boneNames,
|
||||
ffi.Pointer<ffi.Pointer<ffi.Char>> meshName,
|
||||
ffi.Pointer<ffi.Char> boneName,
|
||||
ffi.Pointer<ffi.Pointer<ffi.Char>> meshNames,
|
||||
int numMeshTargets,
|
||||
double frameLengthInMs,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user