summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/input/input.cpp6
-rw-r--r--core/math/basis.cpp4
-rw-r--r--core/math/math_funcs.h4
-rw-r--r--core/math/transform_2d.cpp6
-rw-r--r--core/math/vector2.cpp2
-rw-r--r--core/math/vector2.h2
-rw-r--r--core/math/vector3.h2
-rw-r--r--core/math/vector3i.h2
-rw-r--r--core/typedefs.h4
-rw-r--r--core/variant/variant_utility.cpp8
-rw-r--r--editor/action_map_editor.cpp2
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp2
-rw-r--r--scene/3d/gpu_particles_collision_3d.cpp6
-rw-r--r--scene/3d/reflection_probe.cpp4
-rw-r--r--scene/gui/spin_box.cpp2
-rw-r--r--scene/gui/text_edit.cpp8
-rw-r--r--scene/gui/tree.cpp2
-rw-r--r--servers/physics_3d/godot_shape_3d.cpp2
18 files changed, 34 insertions, 34 deletions
diff --git a/core/input/input.cpp b/core/input/input.cpp
index 4b5a84f401..6fd8aca01b 100644
--- a/core/input/input.cpp
+++ b/core/input/input.cpp
@@ -714,11 +714,11 @@ Point2i Input::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, con
// detect the warp: if the relative distance is greater than the half of the size of the relevant rect
// (checked per each axis), it will be considered as the consequence of a former pointer warp.
- const Point2i rel_sgn(p_motion->get_relative().x >= 0.0f ? 1 : -1, p_motion->get_relative().y >= 0.0 ? 1 : -1);
+ const Point2i rel_sign(p_motion->get_relative().x >= 0.0f ? 1 : -1, p_motion->get_relative().y >= 0.0 ? 1 : -1);
const Size2i warp_margin = p_rect.size * 0.5f;
const Point2i rel_warped(
- Math::fmod(p_motion->get_relative().x + rel_sgn.x * warp_margin.x, p_rect.size.x) - rel_sgn.x * warp_margin.x,
- Math::fmod(p_motion->get_relative().y + rel_sgn.y * warp_margin.y, p_rect.size.y) - rel_sgn.y * warp_margin.y);
+ Math::fmod(p_motion->get_relative().x + rel_sign.x * warp_margin.x, p_rect.size.x) - rel_sign.x * warp_margin.x,
+ Math::fmod(p_motion->get_relative().y + rel_sign.y * warp_margin.y, p_rect.size.y) - rel_sign.y * warp_margin.y);
const Point2i pos_local = p_motion->get_global_position() - p_rect.position;
const Point2i pos_warped(Math::fposmod(pos_local.x, p_rect.size.x), Math::fposmod(pos_local.y, p_rect.size.y));
diff --git a/core/math/basis.cpp b/core/math/basis.cpp
index 3d893afb4d..566300c716 100644
--- a/core/math/basis.cpp
+++ b/core/math/basis.cpp
@@ -261,7 +261,7 @@ Vector3 Basis::get_scale_abs() const {
}
Vector3 Basis::get_scale_local() const {
- real_t det_sign = SGN(determinant());
+ real_t det_sign = SIGN(determinant());
return det_sign * Vector3(elements[0].length(), elements[1].length(), elements[2].length());
}
@@ -287,7 +287,7 @@ Vector3 Basis::get_scale() const {
// matrix elements.
//
// The rotation part of this decomposition is returned by get_rotation* functions.
- real_t det_sign = SGN(determinant());
+ real_t det_sign = SIGN(determinant());
return det_sign * get_scale_abs();
}
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h
index b3eabd3e7a..e3b990d48f 100644
--- a/core/math/math_funcs.h
+++ b/core/math/math_funcs.h
@@ -266,8 +266,8 @@ public:
float s = CLAMP((p_s - p_from) / (p_to - p_from), 0.0f, 1.0f);
return s * s * (3.0f - 2.0f * s);
}
- static _ALWAYS_INLINE_ double move_toward(double p_from, double p_to, double p_delta) { return abs(p_to - p_from) <= p_delta ? p_to : p_from + SGN(p_to - p_from) * p_delta; }
- static _ALWAYS_INLINE_ float move_toward(float p_from, float p_to, float p_delta) { return abs(p_to - p_from) <= p_delta ? p_to : p_from + SGN(p_to - p_from) * p_delta; }
+ static _ALWAYS_INLINE_ double move_toward(double p_from, double p_to, double p_delta) { return abs(p_to - p_from) <= p_delta ? p_to : p_from + SIGN(p_to - p_from) * p_delta; }
+ static _ALWAYS_INLINE_ float move_toward(float p_from, float p_to, float p_delta) { return abs(p_to - p_from) <= p_delta ? p_to : p_from + SIGN(p_to - p_from) * p_delta; }
static _ALWAYS_INLINE_ double linear2db(double p_linear) { return Math::log(p_linear) * 8.6858896380650365530225783783321; }
static _ALWAYS_INLINE_ float linear2db(float p_linear) { return Math::log(p_linear) * 8.6858896380650365530225783783321; }
diff --git a/core/math/transform_2d.cpp b/core/math/transform_2d.cpp
index df43c605f9..4bdeaa2a58 100644
--- a/core/math/transform_2d.cpp
+++ b/core/math/transform_2d.cpp
@@ -69,12 +69,12 @@ void Transform2D::rotate(const real_t p_phi) {
real_t Transform2D::get_skew() const {
real_t det = basis_determinant();
- return Math::acos(elements[0].normalized().dot(SGN(det) * elements[1].normalized())) - Math_PI * 0.5;
+ return Math::acos(elements[0].normalized().dot(SIGN(det) * elements[1].normalized())) - Math_PI * 0.5;
}
void Transform2D::set_skew(const real_t p_angle) {
real_t det = basis_determinant();
- elements[1] = SGN(det) * elements[0].rotated((Math_PI * 0.5 + p_angle)).normalized() * elements[1].length();
+ elements[1] = SIGN(det) * elements[0].rotated((Math_PI * 0.5 + p_angle)).normalized() * elements[1].length();
}
real_t Transform2D::get_rotation() const {
@@ -111,7 +111,7 @@ Transform2D::Transform2D(const real_t p_rot, const Size2 &p_scale, const real_t
}
Size2 Transform2D::get_scale() const {
- real_t det_sign = SGN(basis_determinant());
+ real_t det_sign = SIGN(basis_determinant());
return Size2(elements[0].length(), det_sign * elements[1].length());
}
diff --git a/core/math/vector2.cpp b/core/math/vector2.cpp
index 1d3f93848e..718e94eee4 100644
--- a/core/math/vector2.cpp
+++ b/core/math/vector2.cpp
@@ -91,7 +91,7 @@ real_t Vector2::cross(const Vector2 &p_other) const {
}
Vector2 Vector2::sign() const {
- return Vector2(SGN(x), SGN(y));
+ return Vector2(SIGN(x), SIGN(y));
}
Vector2 Vector2::floor() const {
diff --git a/core/math/vector2.h b/core/math/vector2.h
index 332c0475fa..0a7b9d3faf 100644
--- a/core/math/vector2.h
+++ b/core/math/vector2.h
@@ -345,7 +345,7 @@ struct Vector2i {
bool operator!=(const Vector2i &p_vec2) const;
real_t aspect() const { return width / (real_t)height; }
- Vector2i sign() const { return Vector2i(SGN(x), SGN(y)); }
+ Vector2i sign() const { return Vector2i(SIGN(x), SIGN(y)); }
Vector2i abs() const { return Vector2i(ABS(x), ABS(y)); }
Vector2i clamp(const Vector2i &p_min, const Vector2i &p_max) const;
diff --git a/core/math/vector3.h b/core/math/vector3.h
index dc9aa60458..02a56f684e 100644
--- a/core/math/vector3.h
+++ b/core/math/vector3.h
@@ -217,7 +217,7 @@ Vector3 Vector3::abs() const {
}
Vector3 Vector3::sign() const {
- return Vector3(SGN(x), SGN(y), SGN(z));
+ return Vector3(SIGN(x), SIGN(y), SIGN(z));
}
Vector3 Vector3::floor() const {
diff --git a/core/math/vector3i.h b/core/math/vector3i.h
index 9308d09045..10c28a5bb9 100644
--- a/core/math/vector3i.h
+++ b/core/math/vector3i.h
@@ -115,7 +115,7 @@ Vector3i Vector3i::abs() const {
}
Vector3i Vector3i::sign() const {
- return Vector3i(SGN(x), SGN(y), SGN(z));
+ return Vector3i(SIGN(x), SIGN(y), SIGN(z));
}
/* Operators */
diff --git a/core/typedefs.h b/core/typedefs.h
index 9ab874b2f0..95bd423817 100644
--- a/core/typedefs.h
+++ b/core/typedefs.h
@@ -91,8 +91,8 @@
#define ABS(m_v) (((m_v) < 0) ? (-(m_v)) : (m_v))
#endif
-#ifndef SGN
-#define SGN(m_v) (((m_v) == 0) ? (0.0) : (((m_v) < 0) ? (-1.0) : (+1.0)))
+#ifndef SIGN
+#define SIGN(m_v) (((m_v) == 0) ? (0.0) : (((m_v) < 0) ? (-1.0) : (+1.0)))
#endif
#ifndef MIN
diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp
index e89bdd4faa..83fa4bde69 100644
--- a/core/variant/variant_utility.cpp
+++ b/core/variant/variant_utility.cpp
@@ -151,10 +151,10 @@ struct VariantUtilityFunctions {
r_error.error = Callable::CallError::CALL_OK;
switch (x.get_type()) {
case Variant::INT: {
- return SGN(VariantInternalAccessor<int64_t>::get(&x));
+ return SIGN(VariantInternalAccessor<int64_t>::get(&x));
} break;
case Variant::FLOAT: {
- return SGN(VariantInternalAccessor<double>::get(&x));
+ return SIGN(VariantInternalAccessor<double>::get(&x));
} break;
case Variant::VECTOR2: {
return VariantInternalAccessor<Vector2>::get(&x).sign();
@@ -176,11 +176,11 @@ struct VariantUtilityFunctions {
}
static inline double signf(double x) {
- return SGN(x);
+ return SIGN(x);
}
static inline int64_t signi(int64_t x) {
- return SGN(x);
+ return SIGN(x);
}
static inline double pow(double x, double y) {
diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp
index 9581c3cd45..3ca3576de6 100644
--- a/editor/action_map_editor.cpp
+++ b/editor/action_map_editor.cpp
@@ -260,7 +260,7 @@ void InputEventConfigurationDialog::_listen_window_input(const Ref<InputEvent> &
return;
} else {
// Always make the value 1 or -1 for display consistency
- joym->set_axis_value(SGN(axis_value));
+ joym->set_axis_value(SIGN(axis_value));
}
}
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index ccd2b0d473..d827ce2fb0 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -759,7 +759,7 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D
accumulated_floor_delta += delta;
int step = 0;
if (ABS(accumulated_floor_delta) > 1.0) {
- step = SGN(accumulated_floor_delta);
+ step = SIGN(accumulated_floor_delta);
accumulated_floor_delta -= step;
}
if (step) {
diff --git a/scene/3d/gpu_particles_collision_3d.cpp b/scene/3d/gpu_particles_collision_3d.cpp
index 6ac9364b1a..2235de1599 100644
--- a/scene/3d/gpu_particles_collision_3d.cpp
+++ b/scene/3d/gpu_particles_collision_3d.cpp
@@ -256,10 +256,10 @@ void GPUParticlesCollisionSDF::_find_closest_distance(const Vector3 &p_pos, cons
Vector2 pq1 = v1 - e1 * CLAMP(v1.dot(e1) / e1.dot(e1), 0.0, 1.0);
Vector2 pq2 = v2 - e2 * CLAMP(v2.dot(e2) / e2.dot(e2), 0.0, 1.0);
- float s = SGN(e0.x * e2.y - e0.y * e2.x);
+ float s = SIGN(e0.x * e2.y - e0.y * e2.x);
Vector2 d2 = Vector2(pq0.dot(pq0), s * (v0.x * e0.y - v0.y * e0.x)).min(Vector2(pq1.dot(pq1), s * (v1.x * e1.y - v1.y * e1.x))).min(Vector2(pq2.dot(pq2), s * (v2.x * e2.y - v2.y * e2.x)));
- inside_d = -Math::sqrt(d2.x) * SGN(d2.y);
+ inside_d = -Math::sqrt(d2.x) * SIGN(d2.y);
}
//make sure distance to planes is not shorter if inside
@@ -288,7 +288,7 @@ void GPUParticlesCollisionSDF::_find_closest_distance(const Vector3 &p_pos, cons
Vector3 nor = ba.cross(ac);
inside_d = Math::sqrt(
- (SGN(ba.cross(nor).dot(pa)) + SGN(cb.cross(nor).dot(pb)) + SGN(ac.cross(nor).dot(pc)) < 2.0)
+ (SIGN(ba.cross(nor).dot(pa)) + SIGN(cb.cross(nor).dot(pb)) + SIGN(ac.cross(nor).dot(pc)) < 2.0)
? MIN(MIN(
Vector3_dot2(ba * CLAMP(ba.dot(pa) / Vector3_dot2(ba), 0.0, 1.0) - pa),
Vector3_dot2(cb * CLAMP(cb.dot(pb) / Vector3_dot2(cb), 0.0, 1.0) - pb)),
diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp
index 40d4d822c9..f7f19596a7 100644
--- a/scene/3d/reflection_probe.cpp
+++ b/scene/3d/reflection_probe.cpp
@@ -94,7 +94,7 @@ void ReflectionProbe::set_extents(const Vector3 &p_extents) {
}
if (extents[i] - 0.01 < ABS(origin_offset[i])) {
- origin_offset[i] = SGN(origin_offset[i]) * (extents[i] - 0.01);
+ origin_offset[i] = SIGN(origin_offset[i]) * (extents[i] - 0.01);
}
}
@@ -113,7 +113,7 @@ void ReflectionProbe::set_origin_offset(const Vector3 &p_extents) {
for (int i = 0; i < 3; i++) {
if (extents[i] - 0.01 < ABS(origin_offset[i])) {
- origin_offset[i] = SGN(origin_offset[i]) * (extents[i] - 0.01);
+ origin_offset[i] = SIGN(origin_offset[i]) * (extents[i] - 0.01);
}
}
RS::get_singleton()->reflection_probe_set_extents(probe, extents);
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 4497c20772..f30206c943 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -166,7 +166,7 @@ void SpinBox::gui_input(const Ref<InputEvent> &p_event) {
if (mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) {
if (drag.enabled) {
drag.diff_y += mm->get_relative().y;
- float diff_y = -0.01 * Math::pow(ABS(drag.diff_y), 1.8f) * SGN(drag.diff_y);
+ float diff_y = -0.01 * Math::pow(ABS(drag.diff_y), 1.8f) * SIGN(drag.diff_y);
set_value(CLAMP(drag.base_val + get_step() * diff_y, get_min(), get_max()));
} else if (drag.allowed && drag.capture_pos.distance_to(mm->get_position()) > 2) {
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_CAPTURED);
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 8ffbe479be..fbfeea5722 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -3396,7 +3396,7 @@ Point2i TextEdit::get_line_column_at_pos(const Point2i &p_pos) const {
int wrap_index = 0;
if (get_line_wrapping_mode() != LineWrappingMode::LINE_WRAPPING_NONE || _is_hiding_enabled()) {
- Point2i f_ofs = get_next_visible_line_index_offset_from(first_vis_line, caret.wrap_ofs, rows + (1 * SGN(rows)));
+ Point2i f_ofs = get_next_visible_line_index_offset_from(first_vis_line, caret.wrap_ofs, rows + (1 * SIGN(rows)));
wrap_index = f_ofs.y;
if (rows < 0) {
row = first_vis_line - (f_ofs.x - 1);
@@ -3471,7 +3471,7 @@ int TextEdit::get_minimap_line_at_pos(const Point2i &p_pos) const {
int row = minimap_line + Math::floor(rows);
if (get_line_wrapping_mode() != LineWrappingMode::LINE_WRAPPING_NONE || _is_hiding_enabled()) {
- int f_ofs = get_next_visible_line_index_offset_from(minimap_line, caret.wrap_ofs, rows + (1 * SGN(rows))).x - 1;
+ int f_ofs = get_next_visible_line_index_offset_from(minimap_line, caret.wrap_ofs, rows + (1 * SIGN(rows))).x - 1;
if (rows < 0) {
row = minimap_line - f_ofs;
} else {
@@ -5762,7 +5762,7 @@ double TextEdit::_get_v_scroll_offset() const {
}
void TextEdit::_scroll_up(real_t p_delta) {
- if (scrolling && smooth_scroll_enabled && SGN(target_v_scroll - v_scroll->get_value()) != SGN(-p_delta)) {
+ if (scrolling && smooth_scroll_enabled && SIGN(target_v_scroll - v_scroll->get_value()) != SIGN(-p_delta)) {
scrolling = false;
minimap_clicked = false;
}
@@ -5789,7 +5789,7 @@ void TextEdit::_scroll_up(real_t p_delta) {
}
void TextEdit::_scroll_down(real_t p_delta) {
- if (scrolling && smooth_scroll_enabled && SGN(target_v_scroll - v_scroll->get_value()) != SGN(p_delta)) {
+ if (scrolling && smooth_scroll_enabled && SIGN(target_v_scroll - v_scroll->get_value()) != SIGN(p_delta)) {
scrolling = false;
minimap_clicked = false;
}
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 7c4cdf828b..27e617bdd0 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -3164,7 +3164,7 @@ void Tree::gui_input(const Ref<InputEvent> &p_event) {
} else {
const TreeItem::Cell &c = popup_edited_item->cells[popup_edited_item_col];
float diff_y = -mm->get_relative().y;
- diff_y = Math::pow(ABS(diff_y), 1.8f) * SGN(diff_y);
+ diff_y = Math::pow(ABS(diff_y), 1.8f) * SIGN(diff_y);
diff_y *= 0.1;
range_drag_base = CLAMP(range_drag_base + c.step * diff_y, c.min, c.max);
popup_edited_item->set_range(popup_edited_item_col, range_drag_base);
diff --git a/servers/physics_3d/godot_shape_3d.cpp b/servers/physics_3d/godot_shape_3d.cpp
index b520ee45c7..d1e919ab6a 100644
--- a/servers/physics_3d/godot_shape_3d.cpp
+++ b/servers/physics_3d/godot_shape_3d.cpp
@@ -430,7 +430,7 @@ Vector3 GodotBoxShape3D::get_closest_point_to(const Vector3 &p_point) const {
if (outside == 1) {
//use plane if only one side matches
Vector3 n;
- n[i] = SGN(p_point[i]);
+ n[i] = SIGN(p_point[i]);
Plane p(n, half_extents[i]);
min_point = p.project(p_point);