diff options
Diffstat (limited to 'servers')
-rw-r--r-- | servers/physics_2d/collision_solver_2d_sat.cpp | 4 | ||||
-rw-r--r-- | servers/physics_2d/shape_2d_sw.cpp | 8 | ||||
-rw-r--r-- | servers/physics_3d/collision_solver_3d_sat.cpp | 42 | ||||
-rw-r--r-- | servers/physics_3d/shape_3d_sw.cpp | 34 | ||||
-rw-r--r-- | servers/physics_3d/shape_3d_sw.h | 6 | ||||
-rw-r--r-- | servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp | 2 | ||||
-rw-r--r-- | servers/rendering/rendering_server_canvas.cpp | 4 | ||||
-rw-r--r-- | servers/rendering/rendering_server_scene.h | 1 | ||||
-rw-r--r-- | servers/rendering_server.cpp | 6 | ||||
-rw-r--r-- | servers/rendering_server.h | 4 |
10 files changed, 56 insertions, 55 deletions
diff --git a/servers/physics_2d/collision_solver_2d_sat.cpp b/servers/physics_2d/collision_solver_2d_sat.cpp index 2cada2bf50..d993754fee 100644 --- a/servers/physics_2d/collision_solver_2d_sat.cpp +++ b/servers/physics_2d/collision_solver_2d_sat.cpp @@ -30,7 +30,7 @@ #include "collision_solver_2d_sat.h" -#include "core/math/geometry.h" +#include "core/math/geometry_2d.h" struct _CollectorCallback2D { CollisionSolver2DSW::CallbackResult callback; @@ -70,7 +70,7 @@ _FORCE_INLINE_ static void _generate_contacts_point_edge(const Vector2 *p_points ERR_FAIL_COND(p_point_count_B != 2); #endif - Vector2 closest_B = Geometry::get_closest_point_to_segment_uncapped_2d(*p_points_A, p_points_B); + Vector2 closest_B = Geometry2D::get_closest_point_to_segment_uncapped(*p_points_A, p_points_B); p_collector->call(*p_points_A, closest_B); } diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp index c0589b9804..87e22ef1c9 100644 --- a/servers/physics_2d/shape_2d_sw.cpp +++ b/servers/physics_2d/shape_2d_sw.cpp @@ -30,7 +30,7 @@ #include "shape_2d_sw.h" -#include "core/math/geometry.h" +#include "core/math/geometry_2d.h" #include "core/sort_array.h" void Shape2DSW::configure(const Rect2 &p_aabb) { @@ -205,7 +205,7 @@ bool SegmentShape2DSW::contains_point(const Vector2 &p_point) const { } bool SegmentShape2DSW::intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const { - if (!Geometry::segment_intersects_segment_2d(p_begin, p_end, a, b, &r_point)) { + if (!Geometry2D::segment_intersects_segment(p_begin, p_end, a, b, &r_point)) { return false; } @@ -556,7 +556,7 @@ bool ConvexPolygonShape2DSW::intersect_segment(const Vector2 &p_begin, const Vec Vector2 res; - if (!Geometry::segment_intersects_segment_2d(p_begin, p_end, points[i].pos, points[(i + 1) % point_count].pos, &res)) { + if (!Geometry2D::segment_intersects_segment(p_begin, p_end, points[i].pos, points[(i + 1) % point_count].pos, &res)) { continue; } @@ -735,7 +735,7 @@ bool ConcavePolygonShape2DSW::intersect_segment(const Vector2 &p_begin, const Ve Vector2 res; - if (Geometry::segment_intersects_segment_2d(p_begin, p_end, a, b, &res)) { + if (Geometry2D::segment_intersects_segment(p_begin, p_end, a, b, &res)) { real_t nd = n.dot(res); if (nd < d) { d = nd; diff --git a/servers/physics_3d/collision_solver_3d_sat.cpp b/servers/physics_3d/collision_solver_3d_sat.cpp index 736222c7d9..85f55ad66d 100644 --- a/servers/physics_3d/collision_solver_3d_sat.cpp +++ b/servers/physics_3d/collision_solver_3d_sat.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "collision_solver_3d_sat.h" -#include "core/math/geometry.h" +#include "core/math/geometry_3d.h" #define _EDGE_IS_VALID_SUPPORT_THRESHOLD 0.02 @@ -67,7 +67,7 @@ static void _generate_contacts_point_edge(const Vector3 *p_points_A, int p_point ERR_FAIL_COND(p_point_count_B != 2); #endif - Vector3 closest_B = Geometry::get_closest_point_to_segment_uncapped(*p_points_A, p_points_B); + Vector3 closest_B = Geometry3D::get_closest_point_to_segment_uncapped(*p_points_A, p_points_B); p_callback->call(*p_points_A, closest_B); } @@ -124,7 +124,7 @@ static void _generate_contacts_edge_edge(const Vector3 *p_points_A, int p_point_ } Vector3 closest_A = p_points_A[0] + rel_A * d; - Vector3 closest_B = Geometry::get_closest_point_to_segment_uncapped(closest_A, p_points_B); + Vector3 closest_B = Geometry3D::get_closest_point_to_segment_uncapped(closest_A, p_points_B); p_callback->call(closest_A, closest_B); } @@ -542,11 +542,11 @@ static void _collision_sphere_convex_polygon(const Shape3DSW *p_a, const Transfo return; } - const Geometry::MeshData &mesh = convex_polygon_B->get_mesh(); + const Geometry3D::MeshData &mesh = convex_polygon_B->get_mesh(); - const Geometry::MeshData::Face *faces = mesh.faces.ptr(); + const Geometry3D::MeshData::Face *faces = mesh.faces.ptr(); int face_count = mesh.faces.size(); - const Geometry::MeshData::Edge *edges = mesh.edges.ptr(); + const Geometry3D::MeshData::Edge *edges = mesh.edges.ptr(); int edge_count = mesh.edges.size(); const Vector3 *vertices = mesh.vertices.ptr(); int vertex_count = mesh.vertices.size(); @@ -839,11 +839,11 @@ static void _collision_box_convex_polygon(const Shape3DSW *p_a, const Transform return; } - const Geometry::MeshData &mesh = convex_polygon_B->get_mesh(); + const Geometry3D::MeshData &mesh = convex_polygon_B->get_mesh(); - const Geometry::MeshData::Face *faces = mesh.faces.ptr(); + const Geometry3D::MeshData::Face *faces = mesh.faces.ptr(); int face_count = mesh.faces.size(); - const Geometry::MeshData::Edge *edges = mesh.edges.ptr(); + const Geometry3D::MeshData::Edge *edges = mesh.edges.ptr(); int edge_count = mesh.edges.size(); const Vector3 *vertices = mesh.vertices.ptr(); int vertex_count = mesh.vertices.size(); @@ -1124,11 +1124,11 @@ static void _collision_capsule_convex_polygon(const Shape3DSW *p_a, const Transf return; } - const Geometry::MeshData &mesh = convex_polygon_B->get_mesh(); + const Geometry3D::MeshData &mesh = convex_polygon_B->get_mesh(); - const Geometry::MeshData::Face *faces = mesh.faces.ptr(); + const Geometry3D::MeshData::Face *faces = mesh.faces.ptr(); int face_count = mesh.faces.size(); - const Geometry::MeshData::Edge *edges = mesh.edges.ptr(); + const Geometry3D::MeshData::Edge *edges = mesh.edges.ptr(); int edge_count = mesh.edges.size(); const Vector3 *vertices = mesh.vertices.ptr(); @@ -1257,20 +1257,20 @@ static void _collision_convex_polygon_convex_polygon(const Shape3DSW *p_a, const return; } - const Geometry::MeshData &mesh_A = convex_polygon_A->get_mesh(); + const Geometry3D::MeshData &mesh_A = convex_polygon_A->get_mesh(); - const Geometry::MeshData::Face *faces_A = mesh_A.faces.ptr(); + const Geometry3D::MeshData::Face *faces_A = mesh_A.faces.ptr(); int face_count_A = mesh_A.faces.size(); - const Geometry::MeshData::Edge *edges_A = mesh_A.edges.ptr(); + const Geometry3D::MeshData::Edge *edges_A = mesh_A.edges.ptr(); int edge_count_A = mesh_A.edges.size(); const Vector3 *vertices_A = mesh_A.vertices.ptr(); int vertex_count_A = mesh_A.vertices.size(); - const Geometry::MeshData &mesh_B = convex_polygon_B->get_mesh(); + const Geometry3D::MeshData &mesh_B = convex_polygon_B->get_mesh(); - const Geometry::MeshData::Face *faces_B = mesh_B.faces.ptr(); + const Geometry3D::MeshData::Face *faces_B = mesh_B.faces.ptr(); int face_count_B = mesh_B.faces.size(); - const Geometry::MeshData::Edge *edges_B = mesh_B.edges.ptr(); + const Geometry3D::MeshData::Edge *edges_B = mesh_B.edges.ptr(); int edge_count_B = mesh_B.edges.size(); const Vector3 *vertices_B = mesh_B.vertices.ptr(); int vertex_count_B = mesh_B.vertices.size(); @@ -1362,11 +1362,11 @@ static void _collision_convex_polygon_face(const Shape3DSW *p_a, const Transform SeparatorAxisTest<ConvexPolygonShape3DSW, FaceShape3DSW, withMargin> separator(convex_polygon_A, p_transform_a, face_B, p_transform_b, p_collector, p_margin_a, p_margin_b); - const Geometry::MeshData &mesh = convex_polygon_A->get_mesh(); + const Geometry3D::MeshData &mesh = convex_polygon_A->get_mesh(); - const Geometry::MeshData::Face *faces = mesh.faces.ptr(); + const Geometry3D::MeshData::Face *faces = mesh.faces.ptr(); int face_count = mesh.faces.size(); - const Geometry::MeshData::Edge *edges = mesh.edges.ptr(); + const Geometry3D::MeshData::Edge *edges = mesh.edges.ptr(); int edge_count = mesh.edges.size(); const Vector3 *vertices = mesh.vertices.ptr(); int vertex_count = mesh.vertices.size(); diff --git a/servers/physics_3d/shape_3d_sw.cpp b/servers/physics_3d/shape_3d_sw.cpp index eb0e87cec0..ca33241d29 100644 --- a/servers/physics_3d/shape_3d_sw.cpp +++ b/servers/physics_3d/shape_3d_sw.cpp @@ -30,7 +30,7 @@ #include "shape_3d_sw.h" -#include "core/math/geometry.h" +#include "core/math/geometry_3d.h" #include "core/math/quick_hull.h" #include "core/sort_array.h" @@ -195,7 +195,7 @@ Vector3 RayShape3DSW::get_closest_point_to(const Vector3 &p_point) const { Vector3(0, 0, length) }; - return Geometry::get_closest_point_to_segment(p_point, s); + return Geometry3D::get_closest_point_to_segment(p_point, s); } Vector3 RayShape3DSW::get_moment_of_inertia(real_t p_mass) const { @@ -252,7 +252,7 @@ void SphereShape3DSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 * } bool SphereShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const { - return Geometry::segment_intersects_sphere(p_begin, p_end, Vector3(), radius, &r_result, &r_normal); + return Geometry3D::segment_intersects_sphere(p_begin, p_end, Vector3(), radius, &r_result, &r_normal); } bool SphereShape3DSW::intersect_point(const Vector3 &p_point) const { @@ -441,7 +441,7 @@ Vector3 BoxShape3DSW::get_closest_point_to(const Vector3 &p_point) const { s[1] = closest_vertex; s[1][i] = -s[1][i]; //edge - Vector3 closest_edge = Geometry::get_closest_point_to_segment(p_point, s); + Vector3 closest_edge = Geometry3D::get_closest_point_to_segment(p_point, s); float d = p_point.distance_to(closest_edge); if (d < min_distance) { @@ -540,7 +540,7 @@ bool CapsuleShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 & // test against cylinder and spheres :-| - collided = Geometry::segment_intersects_cylinder(p_begin, p_end, height, radius, &auxres, &auxn); + collided = Geometry3D::segment_intersects_cylinder(p_begin, p_end, height, radius, &auxres, &auxn); if (collided) { real_t d = norm.dot(auxres); @@ -552,7 +552,7 @@ bool CapsuleShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 & } } - collided = Geometry::segment_intersects_sphere(p_begin, p_end, Vector3(0, 0, height * 0.5), radius, &auxres, &auxn); + collided = Geometry3D::segment_intersects_sphere(p_begin, p_end, Vector3(0, 0, height * 0.5), radius, &auxres, &auxn); if (collided) { real_t d = norm.dot(auxres); @@ -564,7 +564,7 @@ bool CapsuleShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 & } } - collided = Geometry::segment_intersects_sphere(p_begin, p_end, Vector3(0, 0, height * -0.5), radius, &auxres, &auxn); + collided = Geometry3D::segment_intersects_sphere(p_begin, p_end, Vector3(0, 0, height * -0.5), radius, &auxres, &auxn); if (collided) { real_t d = norm.dot(auxres); @@ -600,7 +600,7 @@ Vector3 CapsuleShape3DSW::get_closest_point_to(const Vector3 &p_point) const { Vector3(0, 0, height * 0.5), }; - Vector3 p = Geometry::get_closest_point_to_segment(p_point, s); + Vector3 p = Geometry3D::get_closest_point_to_segment(p_point, s); if (p.distance_to(p_point) < radius) { return p_point; @@ -691,10 +691,10 @@ Vector3 ConvexPolygonShape3DSW::get_support(const Vector3 &p_normal) const { } void ConvexPolygonShape3DSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const { - const Geometry::MeshData::Face *faces = mesh.faces.ptr(); + const Geometry3D::MeshData::Face *faces = mesh.faces.ptr(); int fc = mesh.faces.size(); - const Geometry::MeshData::Edge *edges = mesh.edges.ptr(); + const Geometry3D::MeshData::Edge *edges = mesh.edges.ptr(); int ec = mesh.edges.size(); const Vector3 *vertices = mesh.vertices.ptr(); @@ -755,7 +755,7 @@ void ConvexPolygonShape3DSW::get_supports(const Vector3 &p_normal, int p_max, Ve } bool ConvexPolygonShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const { - const Geometry::MeshData::Face *faces = mesh.faces.ptr(); + const Geometry3D::MeshData::Face *faces = mesh.faces.ptr(); int fc = mesh.faces.size(); const Vector3 *vertices = mesh.vertices.ptr(); @@ -793,7 +793,7 @@ bool ConvexPolygonShape3DSW::intersect_segment(const Vector3 &p_begin, const Vec } bool ConvexPolygonShape3DSW::intersect_point(const Vector3 &p_point) const { - const Geometry::MeshData::Face *faces = mesh.faces.ptr(); + const Geometry3D::MeshData::Face *faces = mesh.faces.ptr(); int fc = mesh.faces.size(); for (int i = 0; i < fc; i++) { @@ -806,7 +806,7 @@ bool ConvexPolygonShape3DSW::intersect_point(const Vector3 &p_point) const { } Vector3 ConvexPolygonShape3DSW::get_closest_point_to(const Vector3 &p_point) const { - const Geometry::MeshData::Face *faces = mesh.faces.ptr(); + const Geometry3D::MeshData::Face *faces = mesh.faces.ptr(); int fc = mesh.faces.size(); const Vector3 *vertices = mesh.vertices.ptr(); @@ -844,7 +844,7 @@ Vector3 ConvexPolygonShape3DSW::get_closest_point_to(const Vector3 &p_point) con Vector3 min_point; //check edges - const Geometry::MeshData::Edge *edges = mesh.edges.ptr(); + const Geometry3D::MeshData::Edge *edges = mesh.edges.ptr(); int ec = mesh.edges.size(); for (int i = 0; i < ec; i++) { Vector3 s[2] = { @@ -852,7 +852,7 @@ Vector3 ConvexPolygonShape3DSW::get_closest_point_to(const Vector3 &p_point) con vertices[edges[i].b] }; - Vector3 closest = Geometry::get_closest_point_to_segment(p_point, s); + Vector3 closest = Geometry3D::get_closest_point_to_segment(p_point, s); float d = closest.distance_to(p_point); if (d < min_distance) { min_distance = d; @@ -986,7 +986,7 @@ void FaceShape3DSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_ } bool FaceShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const { - bool c = Geometry::segment_intersects_triangle(p_begin, p_end, vertex[0], vertex[1], vertex[2], &r_result); + bool c = Geometry3D::segment_intersects_triangle(p_begin, p_end, vertex[0], vertex[1], vertex[2], &r_result); if (c) { r_normal = Plane(vertex[0], vertex[1], vertex[2]).normal; if (r_normal.dot(p_end - p_begin) > 0) { @@ -1095,7 +1095,7 @@ void ConcavePolygonShape3DSW::_cull_segment(int p_idx, _SegmentCullParams *p_par p_params->vertices[p_params->faces[bvh->face_index].indices[2]] }; - if (Geometry::segment_intersects_triangle( + if (Geometry3D::segment_intersects_triangle( p_params->from, p_params->to, vertices[0], diff --git a/servers/physics_3d/shape_3d_sw.h b/servers/physics_3d/shape_3d_sw.h index 848a1135ad..2a2cd42255 100644 --- a/servers/physics_3d/shape_3d_sw.h +++ b/servers/physics_3d/shape_3d_sw.h @@ -31,7 +31,7 @@ #ifndef SHAPE_SW_H #define SHAPE_SW_H -#include "core/math/geometry.h" +#include "core/math/geometry_3d.h" #include "servers/physics_server_3d.h" /* @@ -252,12 +252,12 @@ public: }; struct ConvexPolygonShape3DSW : public Shape3DSW { - Geometry::MeshData mesh; + Geometry3D::MeshData mesh; void _setup(const Vector<Vector3> &p_vertices); public: - const Geometry::MeshData &get_mesh() const { return mesh; } + const Geometry3D::MeshData &get_mesh() const { return mesh; } virtual PhysicsServer3D::ShapeType get_type() const { return PhysicsServer3D::SHAPE_CONVEX_POLYGON; } diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp index 4f216d7cb5..a5151d1ff8 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp @@ -4295,7 +4295,7 @@ void RasterizerStorageRD::lightmap_tap_sh_light(RID p_lightmap, const Vector3 &p uint32_t *tetrahedron = (uint32_t *)&lm->tetrahedra[node * 4]; Vector3 points[4] = { lm->points[tetrahedron[0]], lm->points[tetrahedron[1]], lm->points[tetrahedron[2]], lm->points[tetrahedron[3]] }; const Color *sh_colors[4]{ &lm->point_sh[tetrahedron[0] * 9], &lm->point_sh[tetrahedron[1] * 9], &lm->point_sh[tetrahedron[2] * 9], &lm->point_sh[tetrahedron[3] * 9] }; - Color barycentric = Geometry::tetrahedron_get_barycentric_coords(points[0], points[1], points[2], points[3], p_point); + Color barycentric = Geometry3D::tetrahedron_get_barycentric_coords(points[0], points[1], points[2], points[3], p_point); for (int i = 0; i < 4; i++) { float c = CLAMP(barycentric[i], 0.0, 1.0); diff --git a/servers/rendering/rendering_server_canvas.cpp b/servers/rendering/rendering_server_canvas.cpp index 0c9290a765..5c0741bb3b 100644 --- a/servers/rendering/rendering_server_canvas.cpp +++ b/servers/rendering/rendering_server_canvas.cpp @@ -29,6 +29,8 @@ /*************************************************************************/ #include "rendering_server_canvas.h" + +#include "core/math/geometry_2d.h" #include "rendering_server_globals.h" #include "rendering_server_raster.h" #include "rendering_server_viewport.h" @@ -774,7 +776,7 @@ void RenderingServerCanvas::canvas_item_add_polygon(RID p_item, const Vector<Poi ERR_FAIL_COND(color_size != 0 && color_size != 1 && color_size != pointcount); ERR_FAIL_COND(uv_size != 0 && (uv_size != pointcount)); #endif - Vector<int> indices = Geometry::triangulate_polygon(p_points); + Vector<int> indices = Geometry2D::triangulate_polygon(p_points); ERR_FAIL_COND_MSG(indices.empty(), "Invalid polygon data, triangulation failed."); Item::CommandPolygon *polygon = canvas_item->alloc_command<Item::CommandPolygon>(); diff --git a/servers/rendering/rendering_server_scene.h b/servers/rendering/rendering_server_scene.h index f59028603f..f2e2918f21 100644 --- a/servers/rendering/rendering_server_scene.h +++ b/servers/rendering/rendering_server_scene.h @@ -33,7 +33,6 @@ #include "servers/rendering/rasterizer.h" -#include "core/math/geometry.h" #include "core/math/octree.h" #include "core/os/semaphore.h" #include "core/os/thread.h" diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp index 906946f074..4f12ec5b02 100644 --- a/servers/rendering_server.cpp +++ b/servers/rendering_server.cpp @@ -2245,12 +2245,12 @@ void RenderingServer::_camera_set_orthogonal(RID p_camera, float p_size, float p camera_set_orthogonal(p_camera, p_size, p_z_near, p_z_far); } -void RenderingServer::mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry::MeshData &p_mesh_data) { +void RenderingServer::mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry3D::MeshData &p_mesh_data) { Vector<Vector3> vertices; Vector<Vector3> normals; for (int i = 0; i < p_mesh_data.faces.size(); i++) { - const Geometry::MeshData::Face &f = p_mesh_data.faces[i]; + const Geometry3D::MeshData::Face &f = p_mesh_data.faces[i]; for (int j = 2; j < f.indices.size(); j++) { #define _ADD_VERTEX(m_idx) \ @@ -2271,7 +2271,7 @@ void RenderingServer::mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry } void RenderingServer::mesh_add_surface_from_planes(RID p_mesh, const Vector<Plane> &p_planes) { - Geometry::MeshData mdata = Geometry::build_convex_mesh(p_planes); + Geometry3D::MeshData mdata = Geometry3D::build_convex_mesh(p_planes); mesh_add_surface_from_mesh_data(p_mesh, mdata); } diff --git a/servers/rendering_server.h b/servers/rendering_server.h index 92a27b7fe6..3ce63585a8 100644 --- a/servers/rendering_server.h +++ b/servers/rendering_server.h @@ -32,7 +32,7 @@ #define RENDERING_SERVER_H #include "core/image.h" -#include "core/math/geometry.h" +#include "core/math/geometry_3d.h" #include "core/math/transform_2d.h" #include "core/object.h" #include "core/rid.h" @@ -1208,7 +1208,7 @@ public: virtual RID make_sphere_mesh(int p_lats, int p_lons, float p_radius); - virtual void mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry::MeshData &p_mesh_data); + virtual void mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry3D::MeshData &p_mesh_data); virtual void mesh_add_surface_from_planes(RID p_mesh, const Vector<Plane> &p_planes); virtual void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter = true) = 0; |