Sync math defs and functions with upstream Godot#2021
Conversation
There was a problem hiding this comment.
This looks good. Am I right in assuming you've worked manually (adding constexpr to the existing bodies)?
The way we often sync looks more like "copy-paste the upstream version, then review the diff to godot-cpp-ify it again".
For example, it seems like you're skipping SQRT3 and upstream updates to smoothstep and abs.
So I think this is mergable/a clear improvement, but I wouldn't consider it to be a full sync yet.
|
What I did was manually compare the functions to the upstream version and made changes where needed. Copy-pasting seemed a bit more unreliable here since I noticed that we have functions that upstream does not have and many functions that upstream has weren't synced in the past either, additionally functions are in a different order making reading diffs properly harder. I can still take another look and fix the remaining changes though yes :) |
|
Sounds good! |
|
Oh and another thing. I saw that our |
|
Good question. It's interesting that godot-cpp has versions of them in the first place even though we usually try to avoid adding more features that are not in godot upstream. I'd say yes, keep them to avoid compat breaks (and because godot might move them to |
|
Noticed that there is a mix of using |
|
Whatever upstream Godot uses is fine. |
|
There are functions that weren't synced before. My assumption is that that's because they aren't exposed in gdscript to keep the two APIs similar. Should I continue only adding functions that are available in the latest godot version's gdscript? |
|
I'm not aware of the history, but I'd just sync everything. The goal of godot-cpp is to match Godot's own c++ as closely as possible, not necessarily the GDScript API. |
|
Alright, a lot has changed😅 comparing |
accaa7e to
0748b6e
Compare
|
removed the |
There was a problem hiding this comment.
Whew, this turned quite large now, but going by the diffs it looks all good!
For posterity: Math_PI etc. macros, absf/absd, db2linear/linear2db are all deleted, and CMP_EPSILON etc. move into the godot namespace. All without no compatibility shim.
I don't think any of these are widely used, they're easy to fix, and providing no compat is defensible for 10.0. So I agree with the decision.
Thank you for taking care of this!!
This PR syncs math functions and definitions with upstream Godot.
Notable changes include adding
constexprto many functions and changing macro definitions to beconstexprconstants in theMathnamespace. Some math function bodies were changed to stay in sync with upstream godot and to allow theconstexprspecifier.