This commit is contained in:
@@ -660,6 +660,14 @@ fn bake_gltf(
|
||||
) -> io::Result<BakedFighterAnimations> {
|
||||
let (document, buffers, _) = gltf::import_slice(bytes)
|
||||
.map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))?;
|
||||
bake_gltf_document(document, buffers, animations)
|
||||
}
|
||||
|
||||
fn bake_gltf_document(
|
||||
document: gltf::Document,
|
||||
buffers: Vec<gltf::buffer::Data>,
|
||||
animations: &HashMap<AnimKind, String>,
|
||||
) -> io::Result<BakedFighterAnimations> {
|
||||
let nodes: Vec<_> = document.nodes().collect();
|
||||
if nodes.is_empty() {
|
||||
return Err(io::Error::new(
|
||||
@@ -933,11 +941,12 @@ mod tests {
|
||||
fn configured_fighter_clips_bake_to_fixed_point_frames() {
|
||||
let manifest: FighterManifest =
|
||||
ron::from_str(include_str!("../../assets/fighters/test/test.fighter.ron")).unwrap();
|
||||
let baked = bake_gltf(
|
||||
include_bytes!("../../assets/fighters/test/test-fighter-2.glb"),
|
||||
&manifest.animations,
|
||||
)
|
||||
let (document, buffers, _) = gltf::import(concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/assets/fighters/test/test_fighter.gltf"
|
||||
))
|
||||
.unwrap();
|
||||
let baked = bake_gltf_document(document, buffers, &manifest.animations).unwrap();
|
||||
|
||||
assert_eq!(baked.frame_rate, BAKED_ANIMATION_FPS);
|
||||
assert_eq!(baked.frame_count(AnimKind::Wait), Some(121));
|
||||
|
||||
Reference in New Issue
Block a user