merge in changes from web/js branch by hand (bone animation updates)
This commit is contained in:
@@ -83,7 +83,9 @@ namespace polyvox
|
||||
const char *const boneName,
|
||||
const char **const meshName,
|
||||
int numMeshTargets,
|
||||
float frameLengthInMs);
|
||||
float frameLengthInMs,
|
||||
bool isModelSpace);
|
||||
void resetBones(EntityId entityId);
|
||||
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);
|
||||
@@ -95,6 +97,8 @@ namespace polyvox
|
||||
utils::Entity findChildEntityByName(
|
||||
EntityId entityId,
|
||||
const char *entityName);
|
||||
int getEntityCount(EntityId entity, bool renderableOnly);
|
||||
const char* getEntityNameAt(EntityId entity, int index, bool renderableOnly);
|
||||
|
||||
private:
|
||||
AssetLoader *_assetLoader = nullptr;
|
||||
@@ -117,11 +121,5 @@ namespace polyvox
|
||||
|
||||
inline void updateTransform(SceneAsset &asset);
|
||||
|
||||
void updateBoneTransformFromAnimationBuffer(
|
||||
const BoneAnimation& animation,
|
||||
int frameNumber,
|
||||
FilamentAsset *asset
|
||||
);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ namespace polyvox
|
||||
|
||||
void loadIbl(const char *const iblUri, float intensity);
|
||||
void removeIbl();
|
||||
void rotateIbl(const math::mat3f & matrix);
|
||||
|
||||
|
||||
void removeAsset(EntityId asset);
|
||||
void clearAssets();
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
#endif /* __STDBOOL_H */
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__) || defined(__EMSCRIPTEN__)
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
@@ -67,6 +67,7 @@ extern "C"
|
||||
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 rotate_ibl(const void *const viewer, float* rotationMatrix);
|
||||
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);
|
||||
@@ -113,6 +114,10 @@ extern "C"
|
||||
int numMorphTargets,
|
||||
int numFrames,
|
||||
float frameLengthInMs);
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void reset_to_rest_pose(
|
||||
void *assetManager,
|
||||
EntityId asset);
|
||||
FLUTTER_PLUGIN_EXPORT void add_bone_animation(
|
||||
void *assetManager,
|
||||
EntityId asset,
|
||||
@@ -121,7 +126,8 @@ extern "C"
|
||||
const char *const boneName,
|
||||
const char **const meshNames,
|
||||
int numMeshTargets,
|
||||
float frameLengthInMs);
|
||||
float frameLengthInMs,
|
||||
bool isModelSpace);
|
||||
FLUTTER_PLUGIN_EXPORT bool set_bone_transform(
|
||||
void *assetManager,
|
||||
EntityId asset,
|
||||
@@ -171,6 +177,8 @@ extern "C"
|
||||
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 const EntityId find_child_entity_by_name(void *const assetManager, const EntityId parent, const char* name);
|
||||
FLUTTER_PLUGIN_EXPORT int get_entity_count(void *const assetManager, const EntityId target, bool renderableOnly);
|
||||
FLUTTER_PLUGIN_EXPORT const char* get_entity_name_at(void *const assetManager, const EntityId target, int index, bool renderableOnly);
|
||||
FLUTTER_PLUGIN_EXPORT void set_recording(void *const viewer, bool recording);
|
||||
FLUTTER_PLUGIN_EXPORT void set_recording_output_directory(void *const viewer, const char* outputDirectory);
|
||||
FLUTTER_PLUGIN_EXPORT void ios_dummy();
|
||||
|
||||
@@ -64,14 +64,34 @@ FLUTTER_PLUGIN_EXPORT void set_morph_target_weights_ffi(void* const assetManager
|
||||
const float *const morphData,
|
||||
int numWeights
|
||||
);
|
||||
FLUTTER_PLUGIN_EXPORT bool set_morph_animation_ffi(
|
||||
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 bool set_bone_transform_ffi(
|
||||
void *assetManager,
|
||||
EntityId asset,
|
||||
const char *entityName,
|
||||
const float *const transform,
|
||||
const char *boneName);
|
||||
FLUTTER_PLUGIN_EXPORT void add_bone_animation_ffi(
|
||||
void *assetManager,
|
||||
EntityId asset,
|
||||
const float *const frameData,
|
||||
int numFrames,
|
||||
const char *const boneName,
|
||||
const char **const meshNames,
|
||||
int numMeshTargets,
|
||||
float frameLengthInMs,
|
||||
bool isModelSpace);
|
||||
FLUTTER_PLUGIN_EXPORT void set_post_processing_ffi(void* const viewer, bool enabled);
|
||||
FLUTTER_PLUGIN_EXPORT void pick_ffi(void* const viewer, int x, int y, EntityId* entityId);
|
||||
FLUTTER_PLUGIN_EXPORT void reset_to_rest_pose_ffi(void* const assetManager, EntityId entityId);
|
||||
FLUTTER_PLUGIN_EXPORT void ios_dummy_ffi();
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -62,17 +62,17 @@ namespace polyvox {
|
||||
// Use this to construct a dynamic (i.e. non-glTF embedded) bone/joint animation.
|
||||
//
|
||||
struct BoneAnimation : AnimationStatus {
|
||||
uint8_t boneIndex;
|
||||
size_t boneIndex;
|
||||
vector<utils::Entity> meshTargets;
|
||||
size_t skinIndex = 0;
|
||||
int lengthInFrames;
|
||||
float frameLengthInMs = 0;
|
||||
vector<math::quatf> frameData;
|
||||
vector<math::mat4f> frameData;
|
||||
};
|
||||
|
||||
struct SceneAsset {
|
||||
FilamentAsset* asset = nullptr;
|
||||
|
||||
vector<math::mat4f> initialJointTransforms;
|
||||
vector<GltfAnimation> gltfAnimations;
|
||||
vector<MorphAnimation> morphAnimations;
|
||||
vector<BoneAnimation> boneAnimations;
|
||||
|
||||
Reference in New Issue
Block a user