Replies: 2 comments 1 reply
-
glam sounds pretty nice, might be interesting to investigate at some point but doesn't seem like a priority right now.
I agree with this, it's very annoying. I think I'd prefer to stick with cgmath (or glam) for that reason. |
Beta Was this translation helpful? Give feedback.
-
I forgot to list some differences between cgmath and glam. cgmath handles types in a generic way, such as shorts among others, while glam is more specialized in 32-bit and 64-bit integer/float types. Generally this does not matter, in the typical gamedev context, but it is still something to take into account. One particularly cool thing is that glam has great Simd support. cgmath has more support for some math stuff, like the frustum matrix. |
Beta Was this translation helpful? Give feedback.
-
I can tell you a little about my (however little) experience.
In general I haven't found it too difficult to convert from one crate to another.
cgmath: it is considered the one with the clearest and easiest to use api, I think that's actually the case. In case we keep this crate it is probably possible to use the nalgebra mint feature to be able to convert from one type to another.
glam: it's very popular among the gamedevs of the rust ecosystem, and it's the one I've used the most, I'm happy with it. One particular thing, which was introduced in version 0.21.0, is that the code is generated from templates (instead of macros) and is therefore readable and (perhaps) even easier to optimize by the compiler. nalgebra has a type conversion system from the glam crate (convert-glam0XX features)
nalgebra: it has the advantage of being integrated in rapier but it has such a wide use of generics that it becomes impossible to navigate for debugging or in general to understand anything. Even the compiler struggles to optimize it. In theory it would be the one that should give more performance but to use it to its fullest you need to design your own structures such as array of structures (AoS) or structure of arrays (SoA) or similar
ultraviolet: I used it a little, but it is focused for the gamedev and it shouldn't be underestimated, from what I remember it was very good in some benchmarks. Also in this case through the mint feature it is possible to convert the types from ultraviolet to nalgebra and vice versa
Link of interest:
https://github.com/bitshifter/mathbench-rs
(bitshifter is the author of glam)
As usual these benchmarks are to be taken with a grain of salt and at the same time could be representative...
Beta Was this translation helpful? Give feedback.
All reactions