1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Core: Use Math namespace for constants

This commit is contained in:
Thaddeus Crews
2025-04-10 11:21:05 -05:00
parent 06c71fbf40
commit 94282d88f9
181 changed files with 812 additions and 818 deletions

View File

@@ -80,14 +80,14 @@ struct FloatConstantDef {
};
static FloatConstantDef float_constant_defs[] = {
{ "E", Math_E, TTRC("E constant (2.718282). Represents the base of the natural logarithm.") },
{ "E", Math::E, TTRC("E constant (2.718282). Represents the base of the natural logarithm.") },
{ "Epsilon", CMP_EPSILON, TTRC("Epsilon constant (0.00001). Smallest possible scalar number.") },
{ "Phi", 1.618034f, TTRC("Phi constant (1.618034). Golden ratio.") },
{ "Pi/4", Math_PI / 4, TTRC("Pi/4 constant (0.785398) or 45 degrees.") },
{ "Pi/2", Math_PI / 2, TTRC("Pi/2 constant (1.570796) or 90 degrees.") },
{ "Pi", Math_PI, TTRC("Pi constant (3.141593) or 180 degrees.") },
{ "Tau", Math_TAU, TTRC("Tau constant (6.283185) or 360 degrees.") },
{ "Sqrt2", Math_SQRT2, TTRC("Sqrt2 constant (1.414214). Square root of 2.") }
{ "Pi/4", Math::PI / 4, TTRC("Pi/4 constant (0.785398) or 45 degrees.") },
{ "Pi/2", Math::PI / 2, TTRC("Pi/2 constant (1.570796) or 90 degrees.") },
{ "Pi", Math::PI, TTRC("Pi constant (3.141593) or 180 degrees.") },
{ "Tau", Math::TAU, TTRC("Tau constant (6.283185) or 360 degrees.") },
{ "Sqrt2", Math::SQRT2, TTRC("Sqrt2 constant (1.414214). Square root of 2.") }
};
constexpr int MAX_FLOAT_CONST_DEFS = std::size(float_constant_defs);
@@ -6122,7 +6122,7 @@ void VisualShaderEditor::_connection_menu_id_pressed(int p_idx) {
}
Variant VisualShaderEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
if (p_point == Vector2(INFINITY, INFINITY)) {
if (p_point == Vector2(Math::INF, Math::INF)) {
return Variant();
}
@@ -6151,7 +6151,7 @@ Variant VisualShaderEditor::get_drag_data_fw(const Point2 &p_point, Control *p_f
}
bool VisualShaderEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
if (p_point == Vector2(INFINITY, INFINITY)) {
if (p_point == Vector2(Math::INF, Math::INF)) {
return false;
}
@@ -6170,7 +6170,7 @@ bool VisualShaderEditor::can_drop_data_fw(const Point2 &p_point, const Variant &
}
void VisualShaderEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
if (p_point == Vector2(INFINITY, INFINITY)) {
if (p_point == Vector2(Math::INF, Math::INF)) {
return;
}