-
-
Notifications
You must be signed in to change notification settings - Fork 218
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
Reimplement Rect2
, Rect2i
, Aabb
, and Plane
in rust
#209
Labels
c: core
Core components
good first issue
Good for newcomers
quality-of-life
No new functionality, but improves ergonomics/internals
Comments
Bromeon
added
quality-of-life
No new functionality, but improves ergonomics/internals
c: core
Core components
good first issue
Good for newcomers
labels
Mar 29, 2023
bors bot
added a commit
that referenced
this issue
Apr 12, 2023
218: godot-core: builtin: reimplement Rect2i to reduce need of inner usage r=Bromeon a=yannick-was-taken Addresses part of #209 . Only doing `Rect2i` for now, so that suggestions only have to be applied once, instead of four times ;) The implementations are tested (regular case + edge case where applicable) including an itest that checks equivalence between the inner type's fns and the implemented fns. Documentation is mostly taken from Godot's docs for Rect2i, with little changes here and there. There are a bunch of FIXMEs that need to be resolved before this is mergable: Godot's rect2i.h prints errors in some cases when the rect size is negative. In accordance with what I believe to be a design principle of gdext, the equivalent fns panic in that case (compare to `cast`/`try_cast`: default is to assume and panic?). There could be `_unchecked` fns that likely should be marked unsafe, as though they would not introduce memory unsafety, they would result in "Garbage In / Garbage Out", which in Rust usually is considered unsafe, as the safe bet would be to prevent the Garbage In situation via typing, or at least make it return `Option<Garbage Out>`. The Option approach could be used here as well, but would change the type's API as opposed to what it is in GdScript. So please provide input on those FIXMEs as to what you think should be done here. Co-authored-by: yannick-was-taken <yannick-was-taken@posteo.de>
bors bot
added a commit
that referenced
this issue
May 24, 2023
268: godot-core: builtin: reimplement Plane functions/methods r=Bromeon a=T4rmin Partly addresses issue #209 by re-implementing `Plane`'s functions/methods. I know there's a need to implement test cases for it by looking at the `Rect2i` commits, but I would like to know if this part is correct yet since I am an still an absolute beginner at this stuff. Please let me know of anything that is an issue. Also, would implementing test cases for `Plane` be similar in implementation as the `Rect2i` ones? Co-authored-by: Aaron Lawrence <t4rmin@protonmail.com>
Aabb is done, you can mark it as closed. #280 |
Will close automatically when #242 is merged. |
33 tasks
bors bot
added a commit
that referenced
this issue
Jun 17, 2023
295: Implementation of Plane integration tests r=Bromeon a=T4rmin Adds integration tests to the re-implemented Plane functions (#268, and fixing a function in it) and should also address the Plane section of issue #209. This PR is also a recreation of #286 since it has the great error of force-pushing after rebasing. Co-authored-by: Aaron Lawrence <t4rmin@protonmail.com>
bors bot
added a commit
that referenced
this issue
Jun 17, 2023
295: Implementation of Plane integration tests r=Bromeon a=T4rmin Adds integration tests to the re-implemented Plane functions (#268, and fixing a function in it) and should also address the Plane section of issue #209. This PR is also a recreation of #286 since it has the great error of force-pushing after rebasing. Co-authored-by: Aaron Lawrence <t4rmin@protonmail.com>
bors bot
added a commit
that referenced
this issue
Jun 17, 2023
242: Reimplement Rect2 functions r=Bromeon a=juliohq Reimplement Rect2 functions as proposed by #209. It's missing to reimplement `is_infinite()` somehow, since it needs an `inf` type. Co-authored-by: juliohq <juliohenrique31501234@gmail.com> Co-authored-by: Jan Haller <bromeon@gmail.com>
bors bot
added a commit
that referenced
this issue
Jun 17, 2023
242: Reimplement Rect2 functions r=Bromeon a=juliohq Reimplement Rect2 functions as proposed by #209. It's missing to reimplement `is_infinite()` somehow, since it needs an `inf` type. Co-authored-by: juliohq <juliohenrique31501234@gmail.com> Co-authored-by: Jan Haller <bromeon@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
c: core
Core components
good first issue
Good for newcomers
quality-of-life
No new functionality, but improves ergonomics/internals
Currently,
Rect2
,Rect2i
,Aabb
, andPlane
have only a very simple implementation, requiring users to useInnerX
to call most methods on them. We should reimplement these in rust, along the lines of the other mathematical types.Have a look at for instance
Vector2
andBasis
to see what this should look like.Another good source for inspiration is our gdnative bindings, they can be found here:
Rect2
,Aabb
,Plane
In addition unit tests and integration tests would be needed.
For unit tests it can be useful to look at godot's unit tests for the same types, they can be found here.
For integration tests, basis_test.rs is a good example to go by, something like
basis_equiv
is a minimum to ensure our methods behave similarly to godot.Finally, for writing documentation and ensuring you're covering all methods we want, look at the godot docs for the various types: Rect2, Rect2i, Aabb and Plane.
Not everything has to be done at once.
Reimplemented so far:
The text was updated successfully, but these errors were encountered: