diff options
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/collision_polygon_2d.cpp | 5 | ||||
-rw-r--r-- | scene/2d/joints_2d.cpp | 12 | ||||
-rw-r--r-- | scene/2d/light_occluder_2d.cpp | 5 | ||||
-rw-r--r-- | scene/2d/line_2d.cpp | 3 | ||||
-rw-r--r-- | scene/2d/navigation_agent_2d.cpp | 3 | ||||
-rw-r--r-- | scene/2d/navigation_region_2d.cpp | 5 | ||||
-rw-r--r-- | scene/2d/path_2d.cpp | 3 | ||||
-rw-r--r-- | scene/2d/polygon_2d.cpp | 8 |
8 files changed, 25 insertions, 19 deletions
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index 4919ef8304..d23398713a 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -32,6 +32,7 @@ #include "collision_object_2d.h" #include "core/engine.h" +#include "core/math/geometry_2d.h" #include "scene/resources/concave_polygon_shape_2d.h" #include "scene/resources/convex_polygon_shape_2d.h" @@ -75,7 +76,7 @@ void CollisionPolygon2D::_build_polygon() { } Vector<Vector<Vector2>> CollisionPolygon2D::_decompose_in_convex() { - Vector<Vector<Vector2>> decomp = Geometry::decompose_polygon_in_convex(polygon); + Vector<Vector<Vector2>> decomp = Geometry2D::decompose_polygon_in_convex(polygon); return decomp; } @@ -224,7 +225,7 @@ bool CollisionPolygon2D::_edit_use_rect() const { } bool CollisionPolygon2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { - return Geometry::is_point_in_polygon(p_point, Variant(polygon)); + return Geometry2D::is_point_in_polygon(p_point, Variant(polygon)); } #endif diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp index 0d126b949d..8df72d7aac 100644 --- a/scene/2d/joints_2d.cpp +++ b/scene/2d/joints_2d.cpp @@ -309,10 +309,10 @@ RID DampedSpringJoint2D::_configure_joint(PhysicsBody2D *body_a, PhysicsBody2D * RID dsj = PhysicsServer2D::get_singleton()->damped_spring_joint_create(anchor_A, anchor_B, body_a->get_rid(), body_b->get_rid()); if (rest_length) { - PhysicsServer2D::get_singleton()->damped_string_joint_set_param(dsj, PhysicsServer2D::DAMPED_STRING_REST_LENGTH, rest_length); + PhysicsServer2D::get_singleton()->damped_spring_joint_set_param(dsj, PhysicsServer2D::DAMPED_SPRING_REST_LENGTH, rest_length); } - PhysicsServer2D::get_singleton()->damped_string_joint_set_param(dsj, PhysicsServer2D::DAMPED_STRING_STIFFNESS, stiffness); - PhysicsServer2D::get_singleton()->damped_string_joint_set_param(dsj, PhysicsServer2D::DAMPED_STRING_DAMPING, damping); + PhysicsServer2D::get_singleton()->damped_spring_joint_set_param(dsj, PhysicsServer2D::DAMPED_SPRING_STIFFNESS, stiffness); + PhysicsServer2D::get_singleton()->damped_spring_joint_set_param(dsj, PhysicsServer2D::DAMPED_SPRING_DAMPING, damping); return dsj; } @@ -330,7 +330,7 @@ void DampedSpringJoint2D::set_rest_length(real_t p_rest_length) { rest_length = p_rest_length; update(); if (get_joint().is_valid()) { - PhysicsServer2D::get_singleton()->damped_string_joint_set_param(get_joint(), PhysicsServer2D::DAMPED_STRING_REST_LENGTH, p_rest_length ? p_rest_length : length); + PhysicsServer2D::get_singleton()->damped_spring_joint_set_param(get_joint(), PhysicsServer2D::DAMPED_SPRING_REST_LENGTH, p_rest_length ? p_rest_length : length); } } @@ -342,7 +342,7 @@ void DampedSpringJoint2D::set_stiffness(real_t p_stiffness) { stiffness = p_stiffness; update(); if (get_joint().is_valid()) { - PhysicsServer2D::get_singleton()->damped_string_joint_set_param(get_joint(), PhysicsServer2D::DAMPED_STRING_STIFFNESS, p_stiffness); + PhysicsServer2D::get_singleton()->damped_spring_joint_set_param(get_joint(), PhysicsServer2D::DAMPED_SPRING_STIFFNESS, p_stiffness); } } @@ -354,7 +354,7 @@ void DampedSpringJoint2D::set_damping(real_t p_damping) { damping = p_damping; update(); if (get_joint().is_valid()) { - PhysicsServer2D::get_singleton()->damped_string_joint_set_param(get_joint(), PhysicsServer2D::DAMPED_STRING_DAMPING, p_damping); + PhysicsServer2D::get_singleton()->damped_spring_joint_set_param(get_joint(), PhysicsServer2D::DAMPED_SPRING_DAMPING, p_damping); } } diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index 0f4880f69a..023cfa6d03 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "light_occluder_2d.h" +#include "core/math/geometry_2d.h" #include "core/engine.h" @@ -68,12 +69,12 @@ Rect2 OccluderPolygon2D::_edit_get_rect() const { bool OccluderPolygon2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { if (closed) { - return Geometry::is_point_in_polygon(p_point, Variant(polygon)); + return Geometry2D::is_point_in_polygon(p_point, Variant(polygon)); } else { const real_t d = LINE_GRAB_WIDTH / 2 + p_tolerance; const Vector2 *points = polygon.ptr(); for (int i = 0; i < polygon.size() - 1; i++) { - Vector2 p = Geometry::get_closest_point_to_segment_2d(p_point, &points[i]); + Vector2 p = Geometry2D::get_closest_point_to_segment(p_point, &points[i]); if (p.distance_to(p_point) <= d) { return true; } diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp index 28183403f2..b120b115b0 100644 --- a/scene/2d/line_2d.cpp +++ b/scene/2d/line_2d.cpp @@ -31,6 +31,7 @@ #include "line_2d.h" #include "core/core_string_names.h" +#include "core/math/geometry_2d.h" #include "line_builder.h" // Needed so we can bind functions @@ -72,7 +73,7 @@ bool Line2D::_edit_is_selected_on_click(const Point2 &p_point, double p_toleranc const real_t d = _width / 2 + p_tolerance; const Vector2 *points = _points.ptr(); for (int i = 0; i < _points.size() - 1; i++) { - Vector2 p = Geometry::get_closest_point_to_segment_2d(p_point, &points[i]); + Vector2 p = Geometry2D::get_closest_point_to_segment(p_point, &points[i]); if (p.distance_to(p_point) <= d) { return true; } diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp index cb2dbba0fe..e5cdade4a4 100644 --- a/scene/2d/navigation_agent_2d.cpp +++ b/scene/2d/navigation_agent_2d.cpp @@ -31,6 +31,7 @@ #include "navigation_agent_2d.h" #include "core/engine.h" +#include "core/math/geometry_2d.h" #include "scene/2d/navigation_2d.h" #include "servers/navigation_server_2d.h" @@ -304,7 +305,7 @@ void NavigationAgent2D::update_navigation() { Vector2 segment[2]; segment[0] = navigation_path[nav_path_index - 1]; segment[1] = navigation_path[nav_path_index]; - Vector2 p = Geometry::get_closest_point_to_segment_2d(o, segment); + Vector2 p = Geometry2D::get_closest_point_to_segment(o, segment); if (o.distance_to(p) >= path_max_distance) { // To faraway, reload path reload_path = true; diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp index 72bde17428..671bda558d 100644 --- a/scene/2d/navigation_region_2d.cpp +++ b/scene/2d/navigation_region_2d.cpp @@ -32,6 +32,7 @@ #include "core/core_string_names.h" #include "core/engine.h" +#include "core/math/geometry_2d.h" #include "core/os/mutex.h" #include "navigation_2d.h" #include "servers/navigation_server_2d.h" @@ -73,7 +74,7 @@ bool NavigationPolygon::_edit_is_selected_on_click(const Point2 &p_point, double if (outline_size < 3) { continue; } - if (Geometry::is_point_in_polygon(p_point, Variant(outline))) { + if (Geometry2D::is_point_in_polygon(p_point, Variant(outline))) { return true; } } @@ -269,7 +270,7 @@ void NavigationPolygon::make_polygons_from_outlines() { const Vector2 *r2 = ol2.ptr(); for (int l = 0; l < olsize2; l++) { - if (Geometry::segment_intersects_segment_2d(r[0], outside_point, r2[l], r2[(l + 1) % olsize2], nullptr)) { + if (Geometry2D::segment_intersects_segment(r[0], outside_point, r2[l], r2[(l + 1) % olsize2], nullptr)) { interscount++; } } diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index 046e4dbd41..00e9af3bb7 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -31,6 +31,7 @@ #include "path_2d.h" #include "core/engine.h" +#include "core/math/geometry_2d.h" #include "scene/scene_string_names.h" #ifdef TOOLS_ENABLED @@ -73,7 +74,7 @@ bool Path2D::_edit_is_selected_on_click(const Point2 &p_point, double p_toleranc real_t frac = j / 8.0; s[1] = curve->interpolate(i, frac); - Vector2 p = Geometry::get_closest_point_to_segment_2d(p_point, s); + Vector2 p = Geometry2D::get_closest_point_to_segment(p_point, s); if (p.distance_to(p_point) <= p_tolerance) { return true; } diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index 62c66dbb29..13b62816a4 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -30,7 +30,7 @@ #include "polygon_2d.h" -#include "core/math/geometry.h" +#include "core/math/geometry_2d.h" #include "skeleton_2d.h" #ifdef TOOLS_ENABLED @@ -86,7 +86,7 @@ bool Polygon2D::_edit_is_selected_on_click(const Point2 &p_point, double p_toler if (internal_vertices > 0) { polygon2d.resize(polygon2d.size() - internal_vertices); } - return Geometry::is_point_in_polygon(p_point - get_offset(), polygon2d); + return Geometry2D::is_point_in_polygon(p_point - get_offset(), polygon2d); } #endif @@ -300,7 +300,7 @@ void Polygon2D::_notification(int p_what) { } if (invert || polygons.size() == 0) { - Vector<int> indices = Geometry::triangulate_polygon(points); + Vector<int> indices = Geometry2D::triangulate_polygon(points); if (indices.size()) { RS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, points, colors, uvs, bones, weights, texture.is_valid() ? texture->get_rid() : RID(), -1, normal_map.is_valid() ? normal_map->get_rid() : RID(), specular_map.is_valid() ? specular_map->get_rid() : RID(), Color(specular_color.r, specular_color.g, specular_color.b, shininess)); } @@ -323,7 +323,7 @@ void Polygon2D::_notification(int p_what) { ERR_CONTINUE(idx < 0 || idx >= points.size()); tmp_points.write[j] = points[r[j]]; } - Vector<int> indices = Geometry::triangulate_polygon(tmp_points); + Vector<int> indices = Geometry2D::triangulate_polygon(tmp_points); int ic2 = indices.size(); const int *r2 = indices.ptr(); |