Use `impl Into<T>`
some functions like set_color or set position use multiple arguments, it bit discomfort if you want set position of tuple or Array4.
Solution: position: impl Into<Array4>
or use from
The issue with that is that the function does more than setting just values, it also updates the uniform buffer and transform matrices.
A solution can be to add a whole new copy of the functions that accepts from array/list and internally maps them. But that will add extra confusion and cluttering.
e.g.
// the main
fn set_position(&mut self, x: f32, y: f32, z: f32);
// for array, an extra function can be added
fn set_position_with_array(&mut self, value: impl Into<[f32; 3]>) {
self.set_position(value[0], value[1], value[2]);
}
@Gipson62 @NickJasonHagen What do you guys think?
Honestly, having more functions like this would help, it'll help as much as functions overloading is useful in OOP languages and don't most people use the set_position() like this already?
let pos: Position3D = ...; set_position(pos.x, pos.y, pos.z);
So making it takes an impl Into<[f32; 3]> instead of 3 f32 wouldn't be stupid imho