-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing serialization support for Mat2/Mat3/Mat4 #17
Comments
It should be pretty easy. I'm traveling at the moment so might not get a chance to take a look until I get back home in a weeks time. |
np, thanks for the quick response. I'll give it a stab |
Actually maybe it's not as straight forward as I thought, I thought these might just be able to use Do you know what I'm thinking either
would be serialized as, which is probably the latter. |
In my implementation I implemented the serialization explicit and serialized the matrices as flat arrays, thought it was a bit cleaner and potentially faster with less verbose output. Checked up on how Code: let m2 = glm::mat2(1.0, 2.0, 3.0, 4.0);
let m3 = glm::mat3(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0);
let m4 = glm::mat4(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0);
println!("mat2: {}", serde_json::to_string(&m2).unwrap());
println!("mat3: {}", serde_json::to_string(&m3).unwrap());
println!("mat4: {}", serde_json::to_string(&m4).unwrap()); Output: mat2: [1.0,3.0,2.0,4.0]
mat3: [1.0,4.0,7.0,2.0,5.0,8.0,3.0,6.0,9.0]
mat4: [1.0,5.0,9.0,13.0,2.0,6.0,10.0,14.0,3.0,7.0,11.0,15.0,4.0,8.0,12.0,16.0] So I think that is the way to go. I'll bring over your tests to my branch as well and do a PR! |
Was experimenting with
glam
as a potential replacement for us fornalgebra-glm
and one of the first issues I ran into was that theMat2
,Mat3
andMat4
types was missingserde
serialization support.Currently it is only implemented for
Vec2
,Vec3
,Vec4
andQuat
inglam_serde.rs
but likely shouldn't be too hard to add support for matrix types as well?.The text was updated successfully, but these errors were encountered: