rustgd / cgmath

A linear algebra and mathematics library for computer graphics.
https://docs.rs/cgmath
Apache License 2.0
1.12k stars 155 forks source link

Add support for cast using bytemuck crate #541

Closed maku693 closed 2 years ago

maku693 commented 2 years ago

Added support for bytemuck crate.

I also applied cargo fmt, but I think it is out of scope, so I can remove that changes if you mind.

Rua commented 2 years ago

Good idea! I just came looking for this, and you read my mind.

kvark commented 2 years ago

Thank you for the PR! Does that match what any other libraries are doing?

maku693 commented 2 years ago

I think yes.

bytemuck offers derive macro for that purpose, but it cannot be used for generic structs.

glam does this too (but not using macros).

Rua commented 2 years ago

Nalgebra does as well.