godot
godot copied to clipboard
Core: Convert `Math` class to namespace
This adopts the formatting seen in godot-cpp which opts for Math as a namespace rather than a class. Given the class already shouldn't be instanced, nor did it really utilize any class-specific functionality, functioning as a namespace feels more apt. Beyond the conversion, the only adjustments were:
core/math/random_pcg.hinclude migrated tomath_funcs.cpp; explicitly included in the handful of files utilizingRandomPCGdirectly.default_rand, the one private field in the entire class, migrated tomath_funcs.cppas a static variable.RANDOM_32BIT_MAXreplaced by existing, equivalent define:UINT32_MAX.staticdeclaration removed from all functions.absd,absf,is_equal_approx, andis_zero_approxmoved up—a consequence of needing to be declared before use in a namespace context.math_funcs.{h|cpp}functions that weren't usingp_*argument syntax now do.Math::prefix removed in header where redundant.doublesorted beforefloatequivalent where applicable.
I assume this change qualifies as codestyle too? Or perhaps I'm missing something.
Now that you mention it, yeah; this would technically qualify as that. Given that's already the case, might as well fixup stuff like argument name syntax
Thanks! Congrants on your first Godot contribution!