feat: add startOffset parameter to gltf playAnimation
This commit is contained in:
@@ -1135,8 +1135,8 @@ namespace thermion_filament
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SceneManager::playAnimation(EntityId entityId, int index, bool loop, bool reverse, bool replaceActive, float crossfade)
|
||||
|
||||
void SceneManager::playAnimation(EntityId entityId, int index, bool loop, bool reverse, bool replaceActive, float crossfade, float startOffset)
|
||||
{
|
||||
std::lock_guard lock(_mutex);
|
||||
|
||||
@@ -1200,6 +1200,7 @@ namespace thermion_filament
|
||||
}
|
||||
|
||||
GltfAnimation animation;
|
||||
animation.startOffset = startOffset;
|
||||
animation.index = index;
|
||||
animation.start = std::chrono::high_resolution_clock::now();
|
||||
animation.loop = loop;
|
||||
|
||||
@@ -586,9 +586,10 @@ extern "C"
|
||||
bool loop,
|
||||
bool reverse,
|
||||
bool replaceActive,
|
||||
float crossfade)
|
||||
float crossfade,
|
||||
float startOffset)
|
||||
{
|
||||
((SceneManager *)sceneManager)->playAnimation(asset, index, loop, reverse, replaceActive, crossfade);
|
||||
((SceneManager *)sceneManager)->playAnimation(asset, index, loop, reverse, replaceActive, crossfade, startOffset);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void set_animation_frame(
|
||||
|
||||
@@ -677,18 +677,6 @@ extern "C"
|
||||
auto fut = _rl->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void play_animation_ffi(void *const sceneManager,
|
||||
EntityId asset, int index,
|
||||
bool loop, bool reverse,
|
||||
bool replaceActive,
|
||||
float crossfade)
|
||||
{
|
||||
std::packaged_task<void()> lambda([=]
|
||||
{ play_animation(sceneManager, asset, index, loop, reverse, replaceActive,
|
||||
crossfade); });
|
||||
auto fut = _rl->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void set_animation_frame_ffi(void *const sceneManager,
|
||||
EntityId asset,
|
||||
int animationIndex,
|
||||
|
||||
Reference in New Issue
Block a user