-
Notifications
You must be signed in to change notification settings - Fork 18
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
Adding Vector3 for all the [f32; 3] #88
Conversation
This should resolve AryanpurTech#71 as all of the function that set a position taks `impl Into<Position3D>` as input and you can trivially cast a Position3D to a nalgebra_glm::Vec3 with `.into()` when needed
The Position3D already got replaced by a more general purposes Vector3. A lot of implementation got done so the Vector3 supports all of the basic operations: + - * / & += -= *= /= and also you can do all the base matrix operations on them.
Also modified the ./primitive_shapes codes to use directly Vector3 & Vector2 directly instead of casting arrays to their respectives Vector.
Examples don't work if you use |
All of the *most used* functions are implemented for both Vector3 & Vector2. Examples have been updated, tho it makes the import of blue_engine in `Cargo.toml` be a path instead of a version. Cube has been fixed, there might need more test to ensure everything is working correctly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely the most amazing commit of this project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't this auto cast?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most statically typed language doesn't allow implicit casting as the end users wouldn't be able to know the cost of that casting. By making it explicit, the compiler can be sure that the user actively want to pay that cost. So no, sadly no auto cast. Tho [f32; 3].into()
works fine, I just changed it so it is a better example for other users
This should resolve #71 as all the function that set a position takes
impl Into<Position3D>
as input, and you can trivially cast aPosition3D
to a nalgebra_glm::Vec3 with.into()
when needed.Tho, all the examples have to be updated accordingly in the next update