fix dynamic bone animations

This commit is contained in:
Nick Fisher
2023-04-28 20:53:16 +08:00
parent 62c4be0563
commit bbb3cb5727
13 changed files with 170 additions and 130 deletions

View File

@@ -54,7 +54,8 @@ namespace polyvox {
int numFrames,
int numBones,
const char** const boneNames,
const char* const meshName,
const char** const meshName,
int numMeshTargets,
float frameLengthInMs);
void playAnimation(EntityId e, int index, bool loop, bool reverse);
void stopAnimation(EntityId e, int index);

View File

@@ -64,7 +64,8 @@ void set_bone_animation(
int numFrames,
int numBones,
const char** const boneNames,
const char* const meshName,
const char** const meshName,
int numMeshTargets,
float frameLengthInMs);
void play_animation(void* assetManager, EntityId asset, int index, bool loop, bool reverse);

View File

@@ -22,7 +22,7 @@
extern "C" {
#include "PolyvoxFilamentApi.h"
}
template class std::vector<float>;
namespace polyvox {
using namespace filament;
using namespace filament::gltfio;
@@ -56,8 +56,12 @@ namespace polyvox {
// Multiple bones are supported but these must be skinned to a single mesh target.
//
struct BoneAnimationBuffer {
utils::Entity mMeshTarget;
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.
size_t skinIndex = 0;
int mNumFrames = -1;
float mFrameLengthInMs = 0;
@@ -99,10 +103,5 @@ namespace polyvox {
mAnimations[i].mDuration = mAnimator->getAnimationDuration(i);
}
}
};
}
}