BVH animation loading / retargeting (#25)

This PR adds support for BVH animation files, with a custom animation
player and retargeting solution for our Blender Rigify-based skeletal
meshes.

---------

Co-authored-by: Brooks Palin <brookspalin710@gmail.com>
This commit is contained in:
Danny McGee
2024-01-18 17:28:25 -05:00
committed by GitHub
parent cc00f197dc
commit 1687bfd6ed
36 changed files with 29129 additions and 37 deletions
+37
View File
@@ -0,0 +1,37 @@
use bevy::{
asset::{io::Reader, AssetLoader, AsyncReadExt, LoadContext},
utils::BoxedFuture,
};
use super::{
error::{Anyhow, Error},
Bvh,
};
#[derive(Default)]
pub struct BvhLoader;
impl AssetLoader for BvhLoader {
type Asset = Bvh;
type Settings = ();
type Error = Error;
fn load<'a>(
&'a self,
reader: &'a mut Reader,
_settings: &'a Self::Settings,
_cx: &'a mut LoadContext,
) -> BoxedFuture<'a, Result<Self::Asset, Self::Error>> {
Box::pin(async move {
let mut buf = vec![];
reader.read_to_end(&mut buf).await.anyhow()?;
let bvh = studio_bvh::from_bytes(&buf).anyhow()?;
Ok(Bvh(bvh))
})
}
fn extensions(&self) -> &[&str] {
&["bvh"]
}
}