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:
parent
7cd729cf1a
commit
27fe954623
@ -740,9 +740,10 @@ async fn load_gltf<'a, 'b, 'c>(
|
|||||||
let reader = gltf_skin.reader(|buffer| Some(&buffer_data[buffer.index()]));
|
let reader = gltf_skin.reader(|buffer| Some(&buffer_data[buffer.index()]));
|
||||||
let local_to_bone_bind_matrices: Vec<Mat4> = reader
|
let local_to_bone_bind_matrices: Vec<Mat4> = reader
|
||||||
.read_inverse_bind_matrices()
|
.read_inverse_bind_matrices()
|
||||||
.unwrap()
|
.map(|mats| mats.map(|mat| Mat4::from_cols_array_2d(&mat)).collect())
|
||||||
.map(|mat| Mat4::from_cols_array_2d(&mat))
|
.unwrap_or_else(|| {
|
||||||
.collect();
|
core::iter::repeat_n(Mat4::IDENTITY, gltf_skin.joints().len()).collect()
|
||||||
|
});
|
||||||
|
|
||||||
load_context
|
load_context
|
||||||
.add_labeled_asset(
|
.add_labeled_asset(
|
||||||
|
Loading…
Reference in New Issue
Block a user