From 69d5de632e04d48a247d50c1dc2c09322129c73a Mon Sep 17 00:00:00 2001 From: "Andrii Doroshenko (Xrayez)" Date: Mon, 25 May 2020 20:20:45 +0300 Subject: Split `Geometry` singleton into `Geometry2D` and `Geometry3D` Extra `_2d` suffixes are removed from 2D methods accoringly. --- scene/3d/baked_lightmap.cpp | 2 +- scene/3d/collision_polygon_3d.cpp | 3 ++- scene/3d/navigation_agent_3d.cpp | 2 +- scene/3d/voxelizer.cpp | 10 +++++----- 4 files changed, 9 insertions(+), 8 deletions(-) (limited to 'scene/3d') diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp index e2f1b3807d..a41eaf9da0 100644 --- a/scene/3d/baked_lightmap.cpp +++ b/scene/3d/baked_lightmap.cpp @@ -559,7 +559,7 @@ void BakedLightmap::_plot_triangle_into_octree(GenProbesOctree *p_cell, float p_ subcell.position = Vector3(pos) * p_cell_size; subcell.size = Vector3(half_size, half_size, half_size) * p_cell_size; - if (!Geometry::triangle_box_overlap(subcell.position + subcell.size * 0.5, subcell.size * 0.5, p_triangle)) { + if (!Geometry3D::triangle_box_overlap(subcell.position + subcell.size * 0.5, subcell.size * 0.5, p_triangle)) { continue; } diff --git a/scene/3d/collision_polygon_3d.cpp b/scene/3d/collision_polygon_3d.cpp index bad4a1fddd..e2d11c740a 100644 --- a/scene/3d/collision_polygon_3d.cpp +++ b/scene/3d/collision_polygon_3d.cpp @@ -31,6 +31,7 @@ #include "collision_polygon_3d.h" #include "collision_object_3d.h" +#include "core/math/geometry_2d.h" #include "scene/resources/concave_polygon_shape_3d.h" #include "scene/resources/convex_polygon_shape_3d.h" @@ -45,7 +46,7 @@ void CollisionPolygon3D::_build_polygon() { return; } - Vector> decomp = Geometry::decompose_polygon_in_convex(polygon); + Vector> decomp = Geometry2D::decompose_polygon_in_convex(polygon); if (decomp.size() == 0) { return; } diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp index f8d44506b6..e179261002 100644 --- a/scene/3d/navigation_agent_3d.cpp +++ b/scene/3d/navigation_agent_3d.cpp @@ -323,7 +323,7 @@ void NavigationAgent3D::update_navigation() { segment[1] = navigation_path[nav_path_index]; segment[0].y -= navigation_height_offset; segment[1].y -= navigation_height_offset; - Vector3 p = Geometry::get_closest_point_to_segment(o, segment); + Vector3 p = Geometry3D::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/3d/voxelizer.cpp b/scene/3d/voxelizer.cpp index 9fc3feb49a..de5496ee35 100644 --- a/scene/3d/voxelizer.cpp +++ b/scene/3d/voxelizer.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "voxelizer.h" -#include "core/math/geometry.h" +#include "core/math/geometry_3d.h" #include "core/os/os.h" #include "core/os/threaded_array_processor.h" @@ -124,7 +124,7 @@ void Voxelizer::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, co Vector3 half = (to - from) * 0.5; //is in this cell? - if (!Geometry::triangle_box_overlap(from + half, half, p_vtx)) { + if (!Geometry3D::triangle_box_overlap(from + half, half, p_vtx)) { continue; //face does not span this cell } @@ -267,7 +267,7 @@ void Voxelizer::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, co //test_aabb.grow_by(test_aabb.get_longest_axis_size()*0.05); //grow a bit to avoid numerical error in real-time Vector3 qsize = test_aabb.size * 0.5; //quarter size, for fast aabb test - if (!Geometry::triangle_box_overlap(test_aabb.position + qsize, qsize, p_vtx)) { + if (!Geometry3D::triangle_box_overlap(test_aabb.position + qsize, qsize, p_vtx)) { //if (!Face3(p_vtx[0],p_vtx[1],p_vtx[2]).intersects_aabb2(aabb)) { //does not fit in child, go on continue; @@ -439,7 +439,7 @@ void Voxelizer::plot_mesh(const Transform &p_xform, Ref &p_mesh, const Vec } //test against original bounds - if (!Geometry::triangle_box_overlap(original_bounds.position + original_bounds.size * 0.5, original_bounds.size * 0.5, vtxs)) { + if (!Geometry3D::triangle_box_overlap(original_bounds.position + original_bounds.size * 0.5, original_bounds.size * 0.5, vtxs)) { continue; } //plot @@ -471,7 +471,7 @@ void Voxelizer::plot_mesh(const Transform &p_xform, Ref &p_mesh, const Vec } //test against original bounds - if (!Geometry::triangle_box_overlap(original_bounds.position + original_bounds.size * 0.5, original_bounds.size * 0.5, vtxs)) { + if (!Geometry3D::triangle_box_overlap(original_bounds.position + original_bounds.size * 0.5, original_bounds.size * 0.5, vtxs)) { continue; } //plot face -- cgit v1.2.3