Closed EriKWDev closed 4 months ago
For the most part I only support behaviour that is supported in Rust itself. Rust will not let you multiple a f32 or i32 by a bool.
1.0_f32 * true // compile error
1.0_f32 * f32::from(true) // ok
What it does support is a from conversion from bool to float or bool to integer.
1.0_f32 * f32::from(true) // ok
glam also has from impls for creating a Vec3 or IVec3 from a BVec3 or BVec3A, so while what you are proposing won't work the following will
Vec3A::from(BVec3A) * Vec3A, Vec3::from(BVec3) * Vec3, IVec3::from(BVec3) * IVec3, I16Vec3::from(BVec3) * I16Vec3
Possibly .into()
will work in these cases as well if the compiler can work out what type conversion you are after.
As for supporting arithmetic operations on vector masks for other vector types, I don't intend to add that for the reasons given above, that is rust itself doesn't support it.
Bitmasks are cool and would be even more useful if they could be multiplied with a vector of same dimension. This could be done either if the
BVecN
could be converted into a vector of 0.0:s and 1.0:s, or ifstd::ops::Mul
was implemented for the permutations of BVec and all other VecI feel like this could be done for all vecs of same dimensions?
BVec3A * Vec3A
,BVec3 * Vec3
,BVec3 * IVec3
,BVec3 * I16Vec3
and so on..