gdnative
gdnative copied to clipboard
Implement missing Basis and Transform methods
The interfaces of Basis and Transform aren't on par with GDScript's yet. A list of methods available in GDScript on those types can be found at their respective doc pages:
- ~~Basis: http://docs.godotengine.org/en/stable/classes/class_basis.html~~
- Transform: http://docs.godotengine.org/en/stable/classes/class_transform.html
Additionally, methods available to the engine but not exposed to GDScript can be implemented if desirable:
- ~~Basis: https://github.com/godotengine/godot/blob/master/core/math/basis.h~~
- Transform: https://github.com/godotengine/godot/blob/master/core/math/transform.h
If any of the methods need to be manually implemented, sanity tests should be added to make sure their output match Godot's.
Basis methods added in #373.
shouldn't this be closed?
Transform still has little mathematical methods ported.
Note that GDScript's Transform members have some ugly semantic inconsistencies, see https://github.com/godotengine/godot-proposals/issues/1336. Perhaps it even would make sense to anticipate that change.
Note that GDScript's Transform members have some ugly semantic inconsistencies, see godotengine/godot-proposals#1336. Perhaps it even would make sense to anticipate that change.
The point of implementing them is to make porting easier, so for this issue we care more about what the methods are, not what they should be.
Actually the missing methods were implemented for Transform2D; Transform still needs doing.
I'm taking a stab at this (Hi all). The Godot implementation seems to be inconsistent - some of the in-place methods call copy methods and then assign the result to self. Do you want to reproduce the same behavior in godot-rust, or can I have some freedom to fix those as I implement them?
@Hexorg Thank you! I would only provide immutable methods for now (i.e. those returning a new object, not those modifying the existing one).
Feel free to improve on the Godot implementation where needed!
Would be great to add some tests with hardcoded values (ideally obtained by GDScript), like we did for Quat or Basis.