Gltf handle missing bindposes (#18419)

# Objective

correctly load gltfs without explicit bindposes

## Solution

use identity matrices if bindposes are not found.

note: currently does nothing, as gltfs without explicit bindposes fail
to load, see <https://github.com/gltf-rs/gltf/pull/449>

---------

Co-authored-by: François Mockers <francois.mockers@vleue.com>
This commit is contained in:
robtfm 2025-03-19 21:45:05 +00:00 committed by François Mockers
parent 7cd729cf1a
commit 27fe954623

View File

@ -740,9 +740,10 @@ async fn load_gltf<'a, 'b, 'c>(
let reader = gltf_skin.reader(|buffer| Some(&buffer_data[buffer.index()]));
let local_to_bone_bind_matrices: Vec<Mat4> = reader
.read_inverse_bind_matrices()
.unwrap()
.map(|mat| Mat4::from_cols_array_2d(&mat))
.collect();
.map(|mats| mats.map(|mat| Mat4::from_cols_array_2d(&mat)).collect())
.unwrap_or_else(|| {
core::iter::repeat_n(Mat4::IDENTITY, gltf_skin.joints().len()).collect()
});
load_context
.add_labeled_asset(