gltf
gltf copied to clipboard
How to edit contents of gltf?
I need to apply a linear transformation to the gltf data. i know the amth that I need to do, but I am not sure how to use the crate to modify it.
For example say I want to scale down all inverse bind matrices, The way the library is implemented seems to allow you to peek into the ibm data through, e.g.:
for ibm_accessor in skin.inverse_bind_matrices()
{
println!("Accessor #{}", ibm_accessor.index());
println!("offset: {}", ibm_accessor.offset());
println!("count: {}", ibm_accessor.count());
println!("data_type: {:?}", ibm_accessor.data_type());
println!("dimensions: {:?}", ibm_accessor.dimensions());
let source = ibm_accessor.view().unwrap().buffer().source();
}
But this is read only. I cannot write bytes back into the buffer, how would I go about it?
Regretfully, the only way right now is to modify the underlying JSON. https://docs.rs/gltf/latest/gltf/struct.Document.html#method.into_json