Skip to content
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

Merged
merged 6 commits into from
Jan 11, 2025

Conversation

Gipson62
Copy link
Contributor

This should resolve #71 as all the function that set a position takes impl Into<Position3D> as input, and you can trivially cast a Position3D to a nalgebra_glm::Vec3 with .into() when needed.

Tho, all the examples have to be updated accordingly in the next update

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.
@Gipson62
Copy link
Contributor Author

Examples don't work if you use blue_engine_core = { path = "./crates/blue_engine_core" } because they haven't been updated yet. There's an issue with the cube, it's fixed on my machine, but I'll push everything at once (with examples & some more features for both Vector3 & Vector2) once blue_engine 0.6.1 or so is published, to avoid any breaking changes in the master branch.

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
crates/blue_engine_core/src/header.rs Dismissed Show dismissed Hide dismissed
crates/blue_engine_core/src/header.rs Dismissed Show dismissed Hide dismissed
@Gipson62 Gipson62 changed the title feat!: added Position3D for all of the position: [f32; 3] Adding Vector3 for all the [f32; 3] Jan 11, 2025
Copy link
Collaborator

@ElhamAryanpur ElhamAryanpur left a 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

Copy link
Collaborator

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?

Copy link
Contributor Author

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

@ElhamAryanpur ElhamAryanpur added documentation Improvements or additions to documentation enhancement New feature or request labels Jan 11, 2025
@ElhamAryanpur ElhamAryanpur added this to the 0.6.0 milestone Jan 11, 2025
@ElhamAryanpur ElhamAryanpur merged commit b84b193 into AryanpurTech:master Jan 11, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use impl Into<T>
2 participants