diff options
author | Juan Linietsky <juan@godotengine.org> | 2020-02-17 18:06:54 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-02-18 10:10:36 +0100 |
commit | 3205a92ad872f918c8322cdcd1434c231a1fd251 (patch) | |
tree | db44242ca27432eb8ea849679752d0835d2ae41a /servers/physics_2d | |
parent | fb8c93c10b4b73d5f18f1ed287497728800e22b5 (diff) |
PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
Diffstat (limited to 'servers/physics_2d')
-rw-r--r-- | servers/physics_2d/shape_2d_sw.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp index 75c604f0fa..86057e4078 100644 --- a/servers/physics_2d/shape_2d_sw.cpp +++ b/servers/physics_2d/shape_2d_sw.cpp @@ -639,19 +639,19 @@ real_t ConvexPolygonShape2DSW::get_moment_of_inertia(real_t p_mass, const Size2 void ConvexPolygonShape2DSW::set_data(const Variant &p_data) { - ERR_FAIL_COND(p_data.get_type() != Variant::POOL_VECTOR2_ARRAY && p_data.get_type() != Variant::POOL_REAL_ARRAY); + ERR_FAIL_COND(p_data.get_type() != Variant::PACKED_VECTOR2_ARRAY && p_data.get_type() != Variant::PACKED_REAL_ARRAY); if (points) memdelete_arr(points); points = NULL; point_count = 0; - if (p_data.get_type() == Variant::POOL_VECTOR2_ARRAY) { - PoolVector<Vector2> arr = p_data; + if (p_data.get_type() == Variant::PACKED_VECTOR2_ARRAY) { + Vector<Vector2> arr = p_data; ERR_FAIL_COND(arr.size() == 0); point_count = arr.size(); points = memnew_arr(Point, point_count); - PoolVector<Vector2>::Read r = arr.read(); + const Vector2 *r = arr.ptr(); for (int i = 0; i < point_count; i++) { points[i].pos = r[i]; @@ -665,12 +665,12 @@ void ConvexPolygonShape2DSW::set_data(const Variant &p_data) { } } else { - PoolVector<real_t> dvr = p_data; + Vector<real_t> dvr = p_data; point_count = dvr.size() / 4; ERR_FAIL_COND(point_count == 0); points = memnew_arr(Point, point_count); - PoolVector<real_t>::Read r = dvr.read(); + const real_t *r = dvr.ptr(); for (int i = 0; i < point_count; i++) { @@ -693,7 +693,7 @@ void ConvexPolygonShape2DSW::set_data(const Variant &p_data) { Variant ConvexPolygonShape2DSW::get_data() const { - PoolVector<Vector2> dvr; + Vector<Vector2> dvr; dvr.resize(point_count); @@ -899,13 +899,13 @@ int ConcavePolygonShape2DSW::_generate_bvh(BVH *p_bvh, int p_len, int p_depth) { void ConcavePolygonShape2DSW::set_data(const Variant &p_data) { - ERR_FAIL_COND(p_data.get_type() != Variant::POOL_VECTOR2_ARRAY && p_data.get_type() != Variant::POOL_REAL_ARRAY); + ERR_FAIL_COND(p_data.get_type() != Variant::PACKED_VECTOR2_ARRAY && p_data.get_type() != Variant::PACKED_REAL_ARRAY); Rect2 aabb; - if (p_data.get_type() == Variant::POOL_VECTOR2_ARRAY) { + if (p_data.get_type() == Variant::PACKED_VECTOR2_ARRAY) { - PoolVector<Vector2> p2arr = p_data; + Vector<Vector2> p2arr = p_data; int len = p2arr.size(); ERR_FAIL_COND(len % 2); @@ -919,7 +919,7 @@ void ConcavePolygonShape2DSW::set_data(const Variant &p_data) { return; } - PoolVector<Vector2>::Read arr = p2arr.read(); + const Vector2 *arr = p2arr.ptr(); Map<Point2, int> pointmap; for (int i = 0; i < len; i += 2) { @@ -976,18 +976,16 @@ void ConcavePolygonShape2DSW::set_data(const Variant &p_data) { } Variant ConcavePolygonShape2DSW::get_data() const { - PoolVector<Vector2> rsegments; + Vector<Vector2> rsegments; int len = segments.size(); rsegments.resize(len * 2); - PoolVector<Vector2>::Write w = rsegments.write(); + Vector2 *w = rsegments.ptrw(); for (int i = 0; i < len; i++) { w[(i << 1) + 0] = points[segments[i].points[0]]; w[(i << 1) + 1] = points[segments[i].points[1]]; } - w.release(); - return rsegments; } |