diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-11-16 22:24:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-16 22:24:42 +0100 |
commit | 184b5244ba501d2323c4bf8631695bd873da9bd9 (patch) | |
tree | c0a47367d1778fb3903be27067ad0c3731e76668 /scene | |
parent | 5045f46a5c384d83504be3d0cf101e403700b1e3 (diff) | |
parent | 8fb7e622a6a4d6651442764e4e22e000f455f77b (diff) |
Merge pull request #53867 from Calinou/rename-sgn-macro
Diffstat (limited to 'scene')
-rw-r--r-- | scene/3d/gpu_particles_collision_3d.cpp | 6 | ||||
-rw-r--r-- | scene/3d/reflection_probe.cpp | 4 | ||||
-rw-r--r-- | scene/gui/spin_box.cpp | 2 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 8 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 2 |
5 files changed, 11 insertions, 11 deletions
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); |