fix morph animations

This commit is contained in:
Nick Fisher
2023-04-20 15:45:59 +08:00
parent e0d3aba6d8
commit 7225cb53b1
12 changed files with 366 additions and 438 deletions

View File

@@ -4,14 +4,12 @@
#include "ResourceBuffer.hpp"
#include <stddef.h>
#include "dart/dart_api_dl.h"
typedef struct ResourceBuffer ResourceBuffer;
typedef int32_t EntityId;
intptr_t init_dart_api_dl(void* data);
void register_filament_port(Dart_Port port);
void* create_filament_viewer(void *context, ResourceBuffer (*loadResource)(const char *), void (*freeResource)(uint32_t));
void delete_filament_viewer(void *viewer);
void* get_asset_manager(void* viewer);
@@ -52,7 +50,7 @@ void apply_weights(
int count
);
void set_morph_animation(
bool set_morph_animation(
void* assetManager,
EntityId asset,
const char *const entityName,

View File

@@ -37,7 +37,7 @@ namespace polyvox {
bool mLoop = false;
bool mReverse = false;
float mDuration = 0;
int mFrameNumber = -1;
bool mAnimating = false;
// AnimationStatus() {
// Log("default constr");
@@ -73,7 +73,7 @@ namespace polyvox {
// Use this to manually construct a buffer of frame data for morph animations.
//
struct MorphAnimationBuffer {
utils::EntityInstance<RenderableManager>* mInstance = nullptr;
utils::Entity mMeshTarget;
int mNumFrames = -1;
float mFrameLengthInMs = 0;
vector<float> mFrameData;
@@ -124,38 +124,7 @@ namespace polyvox {
float mScale = 1;
// SceneAsset(const SceneAsset&& a) {
// Log("MOVE");
// }
// SceneAsset(const SceneAsset& a) {
// mAsset = a.mAsset;
// mAnimator = a.mAnimator;
// mAnimations = a.mAnimations;
// mMorphAnimationBuffer = a.mMorphAnimationBuffer;
// mBoneAnimationBuffer = a.mBoneAnimationBuffer;
// mTexture = a.mTexture;
// mPosition = a.mPosition;
// mRotation = a.mRotation;
// mScale = a.mScale;
// }
// SceneAsset& operator=(SceneAsset a) {
// mAsset = a.mAsset;
// mAnimator = a.mAnimator;
// mAnimations = a.mAnimations;
// mMorphAnimationBuffer = a.mMorphAnimationBuffer;
// mBoneAnimationBuffer = a.mBoneAnimationBuffer;
// mTexture = a.mTexture;
// mPosition = a.mPosition;
// mRotation = a.mRotation;
// mScale = a.mScale;
// return *this;
// }
SceneAsset(
SceneAsset(
FilamentAsset* asset
) : mAsset(asset) {
mAnimator = mAsset->getInstance()->getAnimator();