(
skeleton: &SkeletonData,
joint_idx: usize,
parent_transform: &[[f32; 4]; 4],
translations: &[[f32; 3]],
rotations: &[[f32; 4]],
scales: &[[f32; 3]],
world_transforms: &mu
| 707 | } |
| 708 | |
| 709 | fn compute_joint_transforms( |
| 710 | skeleton: &SkeletonData, |
| 711 | joint_idx: usize, |
| 712 | parent_transform: &[[f32; 4]; 4], |
| 713 | translations: &[[f32; 3]], |
| 714 | rotations: &[[f32; 4]], |
| 715 | scales: &[[f32; 3]], |
| 716 | world_transforms: &mut [[[f32; 4]; 4]], |
| 717 | ) { |
| 718 | if joint_idx >= skeleton.joints.len() { return; } |
| 719 | let local = mat4_from_trs(&translations[joint_idx], &rotations[joint_idx], &scales[joint_idx]); |
| 720 | let world = mat4_mul(parent_transform, &local); |
| 721 | world_transforms[joint_idx] = world; |
| 722 | let children = skeleton.joints[joint_idx].children.clone(); |
| 723 | for &child in &children { |
| 724 | compute_joint_transforms(skeleton, child, &world, translations, rotations, scales, world_transforms); |
| 725 | } |
| 726 | } |
| 727 | |
| 728 | // ============================================================ |
| 729 | // glTF animation loader |
no test coverage detected