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 /scene | |
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 'scene')
100 files changed, 921 insertions, 965 deletions
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index aca0c4c959..5625a0085b 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -1184,8 +1184,8 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("draw_texture_rect_region", "texture", "rect", "src_rect", "modulate", "transpose", "normal_map", "specular_map", "clip_uv", "specular_shinness", "texture_filter", "texture_repeat"), &CanvasItem::draw_texture_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(true), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(TEXTURE_FILTER_PARENT_NODE), DEFVAL(TEXTURE_REPEAT_PARENT_NODE)); ClassDB::bind_method(D_METHOD("draw_style_box", "style_box", "rect"), &CanvasItem::draw_style_box); ClassDB::bind_method(D_METHOD("draw_primitive", "points", "colors", "uvs", "texture", "width", "normal_map", "specular_map", "specular_shinness", "texture_filter", "texture_repeat"), &CanvasItem::draw_primitive, DEFVAL(Variant()), DEFVAL(1.0), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(TEXTURE_FILTER_PARENT_NODE), DEFVAL(TEXTURE_REPEAT_PARENT_NODE)); - ClassDB::bind_method(D_METHOD("draw_polygon", "points", "colors", "uvs", "texture", "normal_map", "specular_map", "specular_shinness", "texture_filter", "texture_repeat"), &CanvasItem::draw_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(TEXTURE_FILTER_PARENT_NODE), DEFVAL(TEXTURE_REPEAT_PARENT_NODE)); - ClassDB::bind_method(D_METHOD("draw_colored_polygon", "points", "color", "uvs", "texture", "normal_map", "specular_map", "specular_shinness", "texture_filter", "texture_repeat"), &CanvasItem::draw_colored_polygon, DEFVAL(PoolVector2Array()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(TEXTURE_FILTER_PARENT_NODE), DEFVAL(TEXTURE_REPEAT_PARENT_NODE)); + ClassDB::bind_method(D_METHOD("draw_polygon", "points", "colors", "uvs", "texture", "normal_map", "specular_map", "specular_shinness", "texture_filter", "texture_repeat"), &CanvasItem::draw_polygon, DEFVAL(PackedVector2Array()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(TEXTURE_FILTER_PARENT_NODE), DEFVAL(TEXTURE_REPEAT_PARENT_NODE)); + ClassDB::bind_method(D_METHOD("draw_colored_polygon", "points", "color", "uvs", "texture", "normal_map", "specular_map", "specular_shinness", "texture_filter", "texture_repeat"), &CanvasItem::draw_colored_polygon, DEFVAL(PackedVector2Array()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(TEXTURE_FILTER_PARENT_NODE), DEFVAL(TEXTURE_REPEAT_PARENT_NODE)); ClassDB::bind_method(D_METHOD("draw_string", "font", "position", "text", "modulate", "clip_w"), &CanvasItem::draw_string, DEFVAL(Color(1, 1, 1)), DEFVAL(-1)); ClassDB::bind_method(D_METHOD("draw_char", "font", "position", "char", "next", "modulate"), &CanvasItem::draw_char, DEFVAL(Color(1, 1, 1))); ClassDB::bind_method(D_METHOD("draw_mesh", "mesh", "texture", "normal_map", "specular_map", "transform", "modulate", "specular_shinness", "texture_filter", "texture_repeat"), &CanvasItem::draw_mesh, DEFVAL(Ref<Texture2D>()), DEFVAL(Ref<Texture2D>()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(Transform2D()), DEFVAL(Color(1, 1, 1)), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(TEXTURE_FILTER_PARENT_NODE), DEFVAL(TEXTURE_REPEAT_PARENT_NODE)); diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index d9cc94c6eb..72af0fcb2a 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -61,16 +61,15 @@ void CollisionPolygon2D::_build_polygon() { Ref<ConcavePolygonShape2D> concave = memnew(ConcavePolygonShape2D); - PoolVector<Vector2> segments; + Vector<Vector2> segments; segments.resize(polygon.size() * 2); - PoolVector<Vector2>::Write w = segments.write(); + Vector2 *w = segments.ptrw(); for (int i = 0; i < polygon.size(); i++) { w[(i << 1) + 0] = polygon[i]; w[(i << 1) + 1] = polygon[(i + 1) % polygon.size()]; } - w.release(); concave->set_segments(segments); parent->shape_owner_add_shape(owner_id, concave); @@ -306,7 +305,7 @@ void CollisionPolygon2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_one_way_collision_margin"), &CollisionPolygon2D::get_one_way_collision_margin); ADD_PROPERTY(PropertyInfo(Variant::INT, "build_mode", PROPERTY_HINT_ENUM, "Solids,Segments"), "set_build_mode", "get_build_mode"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disabled"), "set_disabled", "is_disabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_way_collision"), "set_one_way_collision", "is_one_way_collision_enabled"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "one_way_collision_margin", PROPERTY_HINT_RANGE, "0,128,0.1"), "set_one_way_collision_margin", "get_one_way_collision_margin"); diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index 449951bc6c..922ee0c208 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -51,7 +51,7 @@ void CPUParticles2D::set_amount(int p_amount) { particles.resize(p_amount); { - PoolVector<Particle>::Write w = particles.write(); + Particle *w = particles.ptrw(); for (int i = 0; i < p_amount; i++) { w[i].active = false; @@ -163,12 +163,12 @@ void CPUParticles2D::_update_mesh_texture() { } else { tex_size = Size2(1, 1); } - PoolVector<Vector2> vertices; + Vector<Vector2> vertices; vertices.push_back(-tex_size * 0.5); vertices.push_back(-tex_size * 0.5 + Vector2(tex_size.x, 0)); vertices.push_back(-tex_size * 0.5 + Vector2(tex_size.x, tex_size.y)); vertices.push_back(-tex_size * 0.5 + Vector2(0, tex_size.y)); - PoolVector<Vector2> uvs; + Vector<Vector2> uvs; AtlasTexture *atlas_texure = Object::cast_to<AtlasTexture>(*texture); if (atlas_texure && atlas_texure->get_atlas().is_valid()) { Rect2 region_rect = atlas_texure->get_region(); @@ -183,12 +183,12 @@ void CPUParticles2D::_update_mesh_texture() { uvs.push_back(Vector2(1, 1)); uvs.push_back(Vector2(0, 1)); } - PoolVector<Color> colors; + Vector<Color> colors; colors.push_back(Color(1, 1, 1, 1)); colors.push_back(Color(1, 1, 1, 1)); colors.push_back(Color(1, 1, 1, 1)); colors.push_back(Color(1, 1, 1, 1)); - PoolVector<int> indices; + Vector<int> indices; indices.push_back(0); indices.push_back(1); indices.push_back(2); @@ -291,7 +291,7 @@ void CPUParticles2D::restart() { { int pc = particles.size(); - PoolVector<Particle>::Write w = particles.write(); + Particle *w = particles.ptrw(); for (int i = 0; i < pc; i++) { w[i].active = false; @@ -455,17 +455,17 @@ void CPUParticles2D::set_emission_rect_extents(Vector2 p_extents) { emission_rect_extents = p_extents; } -void CPUParticles2D::set_emission_points(const PoolVector<Vector2> &p_points) { +void CPUParticles2D::set_emission_points(const Vector<Vector2> &p_points) { emission_points = p_points; } -void CPUParticles2D::set_emission_normals(const PoolVector<Vector2> &p_normals) { +void CPUParticles2D::set_emission_normals(const Vector<Vector2> &p_normals) { emission_normals = p_normals; } -void CPUParticles2D::set_emission_colors(const PoolVector<Color> &p_colors) { +void CPUParticles2D::set_emission_colors(const Vector<Color> &p_colors) { emission_colors = p_colors; } @@ -478,16 +478,16 @@ Vector2 CPUParticles2D::get_emission_rect_extents() const { return emission_rect_extents; } -PoolVector<Vector2> CPUParticles2D::get_emission_points() const { +Vector<Vector2> CPUParticles2D::get_emission_points() const { return emission_points; } -PoolVector<Vector2> CPUParticles2D::get_emission_normals() const { +Vector<Vector2> CPUParticles2D::get_emission_normals() const { return emission_normals; } -PoolVector<Color> CPUParticles2D::get_emission_colors() const { +Vector<Color> CPUParticles2D::get_emission_colors() const { return emission_colors; } @@ -630,9 +630,9 @@ void CPUParticles2D::_particles_process(float p_delta) { p_delta *= speed_scale; int pcount = particles.size(); - PoolVector<Particle>::Write w = particles.write(); + Particle *w = particles.ptrw(); - Particle *parray = w.ptr(); + Particle *parray = w; float prev_time = time; time += p_delta; @@ -978,23 +978,23 @@ void CPUParticles2D::_update_particle_data_buffer() { int pc = particles.size(); - PoolVector<int>::Write ow; + int *ow; int *order = NULL; - PoolVector<float>::Write w = particle_data.write(); - PoolVector<Particle>::Read r = particles.read(); - float *ptr = w.ptr(); + float *w = particle_data.ptrw(); + const Particle *r = particles.ptr(); + float *ptr = w; if (draw_order != DRAW_ORDER_INDEX) { - ow = particle_order.write(); - order = ow.ptr(); + ow = particle_order.ptrw(); + order = ow; for (int i = 0; i < pc; i++) { order[i] = i; } if (draw_order == DRAW_ORDER_LIFETIME) { SortArray<int, SortLifetime> sorter; - sorter.compare.particles = r.ptr(); + sorter.compare.particles = r; sorter.sort(order, pc); } } @@ -1127,9 +1127,9 @@ void CPUParticles2D::_notification(int p_what) { int pc = particles.size(); - PoolVector<float>::Write w = particle_data.write(); - PoolVector<Particle>::Read r = particles.read(); - float *ptr = w.ptr(); + float *w = particle_data.ptrw(); + const Particle *r = particles.ptr(); + float *ptr = w; for (int i = 0; i < pc; i++) { @@ -1348,9 +1348,9 @@ void CPUParticles2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "emission_shape", PROPERTY_HINT_ENUM, "Point,Sphere,Box,Points,Directed Points"), "set_emission_shape", "get_emission_shape"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "emission_sphere_radius", PROPERTY_HINT_RANGE, "0.01,128,0.01"), "set_emission_sphere_radius", "get_emission_sphere_radius"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "emission_rect_extents"), "set_emission_rect_extents", "get_emission_rect_extents"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "emission_points"), "set_emission_points", "get_emission_points"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "emission_normals"), "set_emission_normals", "get_emission_normals"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "emission_colors"), "set_emission_colors", "get_emission_colors"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "emission_points"), "set_emission_points", "get_emission_points"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "emission_normals"), "set_emission_normals", "get_emission_normals"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_COLOR_ARRAY, "emission_colors"), "set_emission_colors", "get_emission_colors"); ADD_GROUP("Flags", "flag_"); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flag_align_y"), "set_particle_flag", "get_particle_flag", FLAG_ALIGN_Y_TO_VELOCITY); ADD_GROUP("Direction", ""); diff --git a/scene/2d/cpu_particles_2d.h b/scene/2d/cpu_particles_2d.h index 5eb563bbbc..6f85631fe1 100644 --- a/scene/2d/cpu_particles_2d.h +++ b/scene/2d/cpu_particles_2d.h @@ -108,9 +108,9 @@ private: RID mesh; RID multimesh; - PoolVector<Particle> particles; - PoolVector<float> particle_data; - PoolVector<int> particle_order; + Vector<Particle> particles; + Vector<float> particle_data; + Vector<int> particle_order; struct SortLifetime { const Particle *particles; @@ -167,9 +167,9 @@ private: EmissionShape emission_shape; float emission_sphere_radius; Vector2 emission_rect_extents; - PoolVector<Vector2> emission_points; - PoolVector<Vector2> emission_normals; - PoolVector<Color> emission_colors; + Vector<Vector2> emission_points; + Vector<Vector2> emission_normals; + Vector<Color> emission_colors; int emission_point_count; Vector2 gravity; @@ -265,17 +265,17 @@ public: void set_emission_shape(EmissionShape p_shape); void set_emission_sphere_radius(float p_radius); void set_emission_rect_extents(Vector2 p_extents); - void set_emission_points(const PoolVector<Vector2> &p_points); - void set_emission_normals(const PoolVector<Vector2> &p_normals); - void set_emission_colors(const PoolVector<Color> &p_colors); + void set_emission_points(const Vector<Vector2> &p_points); + void set_emission_normals(const Vector<Vector2> &p_normals); + void set_emission_colors(const Vector<Color> &p_colors); void set_emission_point_count(int p_count); EmissionShape get_emission_shape() const; float get_emission_sphere_radius() const; Vector2 get_emission_rect_extents() const; - PoolVector<Vector2> get_emission_points() const; - PoolVector<Vector2> get_emission_normals() const; - PoolVector<Color> get_emission_colors() const; + Vector<Vector2> get_emission_points() const; + Vector<Vector2> get_emission_normals() const; + Vector<Color> get_emission_colors() const; int get_emission_point_count() const; void set_gravity(const Vector2 &p_gravity); diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index 0e8e8f6679..c000346a1a 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -39,7 +39,7 @@ Rect2 OccluderPolygon2D::_edit_get_rect() const { if (rect_cache_dirty) { if (closed) { - PoolVector<Vector2>::Read r = polygon.read(); + const Vector2 *r = polygon.ptr(); item_rect = Rect2(); for (int i = 0; i < polygon.size(); i++) { Vector2 pos = r[i]; @@ -72,7 +72,7 @@ bool OccluderPolygon2D::_edit_is_selected_on_click(const Point2 &p_point, double return Geometry::is_point_in_polygon(p_point, Variant(polygon)); } else { const real_t d = LINE_GRAB_WIDTH / 2 + p_tolerance; - PoolVector<Vector2>::Read points = polygon.read(); + 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]); if (p.distance_to(p_point) <= d) @@ -84,7 +84,7 @@ bool OccluderPolygon2D::_edit_is_selected_on_click(const Point2 &p_point, double } #endif -void OccluderPolygon2D::set_polygon(const PoolVector<Vector2> &p_polygon) { +void OccluderPolygon2D::set_polygon(const Vector<Vector2> &p_polygon) { polygon = p_polygon; rect_cache_dirty = true; @@ -92,7 +92,7 @@ void OccluderPolygon2D::set_polygon(const PoolVector<Vector2> &p_polygon) { emit_changed(); } -PoolVector<Vector2> OccluderPolygon2D::get_polygon() const { +Vector<Vector2> OccluderPolygon2D::get_polygon() const { return polygon; } @@ -141,7 +141,7 @@ void OccluderPolygon2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "closed"), "set_closed", "is_closed"); ADD_PROPERTY(PropertyInfo(Variant::INT, "cull_mode", PROPERTY_HINT_ENUM, "Disabled,ClockWise,CounterClockWise"), "set_cull_mode", "get_cull_mode"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon"); BIND_ENUM_CONSTANT(CULL_DISABLED); BIND_ENUM_CONSTANT(CULL_CLOCKWISE); @@ -191,7 +191,7 @@ void LightOccluder2D::_notification(int p_what) { if (occluder_polygon.is_valid()) { - PoolVector<Vector2> poly = occluder_polygon->get_polygon(); + Vector<Vector2> poly = occluder_polygon->get_polygon(); if (poly.size()) { if (occluder_polygon->is_closed()) { @@ -201,7 +201,7 @@ void LightOccluder2D::_notification(int p_what) { } else { int ps = poly.size(); - PoolVector<Vector2>::Read r = poly.read(); + const Vector2 *r = poly.ptr(); for (int i = 0; i < ps - 1; i++) { draw_line(r[i], r[i + 1], Color(0, 0, 0, 0.6), 3); diff --git a/scene/2d/light_occluder_2d.h b/scene/2d/light_occluder_2d.h index b20e347c35..83702f2875 100644 --- a/scene/2d/light_occluder_2d.h +++ b/scene/2d/light_occluder_2d.h @@ -46,7 +46,7 @@ public: private: RID occ_polygon; - PoolVector<Vector2> polygon; + Vector<Vector2> polygon; bool closed; CullMode cull; @@ -62,8 +62,8 @@ public: virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const; #endif - void set_polygon(const PoolVector<Vector2> &p_polygon); - PoolVector<Vector2> get_polygon() const; + void set_polygon(const Vector<Vector2> &p_polygon); + Vector<Vector2> get_polygon() const; void set_closed(bool p_closed); bool is_closed() const; diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp index 92d06d6056..3c457b7df0 100644 --- a/scene/2d/line_2d.cpp +++ b/scene/2d/line_2d.cpp @@ -71,7 +71,7 @@ bool Line2D::_edit_use_rect() const { bool Line2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { const real_t d = _width / 2 + p_tolerance; - PoolVector<Vector2>::Read points = _points.read(); + 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]); if (p.distance_to(p_point) <= d) @@ -82,7 +82,7 @@ bool Line2D::_edit_is_selected_on_click(const Point2 &p_point, double p_toleranc } #endif -void Line2D::set_points(const PoolVector<Vector2> &p_points) { +void Line2D::set_points(const Vector<Vector2> &p_points) { _points = p_points; update(); } @@ -118,7 +118,7 @@ Ref<Curve> Line2D::get_curve() const { return _curve; } -PoolVector<Vector2> Line2D::get_points() const { +Vector<Vector2> Line2D::get_points() const { return _points; } @@ -146,7 +146,7 @@ void Line2D::clear_points() { void Line2D::add_point(Vector2 p_pos, int p_atpos) { if (p_atpos < 0 || _points.size() < p_atpos) { - _points.append(p_pos); + _points.push_back(p_pos); } else { _points.insert(p_atpos, p_pos); } @@ -282,7 +282,7 @@ void Line2D::_draw() { points.resize(_points.size()); int len = points.size(); { - PoolVector<Vector2>::Read points_read = _points.read(); + const Vector2 *points_read = _points.ptr(); for (int i = 0; i < len; ++i) { points.write[i] = points_read[i]; } @@ -400,7 +400,7 @@ void Line2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_antialiased", "antialiased"), &Line2D::set_antialiased); ClassDB::bind_method(D_METHOD("get_antialiased"), &Line2D::get_antialiased); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "points"), "set_points", "get_points"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "points"), "set_points", "get_points"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "width"), "set_width", "get_width"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "width_curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve"), "set_curve", "get_curve"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "default_color"), "set_default_color", "get_default_color"); diff --git a/scene/2d/line_2d.h b/scene/2d/line_2d.h index b7e7f59403..51706befdb 100644 --- a/scene/2d/line_2d.h +++ b/scene/2d/line_2d.h @@ -64,8 +64,8 @@ public: Line2D(); - void set_points(const PoolVector<Vector2> &p_points); - PoolVector<Vector2> get_points() const; + void set_points(const Vector<Vector2> &p_points); + Vector<Vector2> get_points() const; void set_point_position(int i, Vector2 pos); Vector2 get_point_position(int i) const; @@ -124,7 +124,7 @@ private: void _curve_changed(); private: - PoolVector<Vector2> _points; + Vector<Vector2> _points; LineJointMode _joint_mode; LineCapMode _begin_cap_mode; LineCapMode _end_cap_mode; diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index 21b2bede05..678e5f113a 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -46,11 +46,11 @@ Rect2 NavigationPolygon::_edit_get_rect() const { bool first = true; for (int i = 0; i < outlines.size(); i++) { - const PoolVector<Vector2> &outline = outlines[i]; + const Vector<Vector2> &outline = outlines[i]; const int outline_size = outline.size(); if (outline_size < 3) continue; - PoolVector<Vector2>::Read p = outline.read(); + const Vector2 *p = outline.ptr(); for (int j = 0; j < outline_size; j++) { if (first) { item_rect = Rect2(p[j], Vector2(0, 0)); @@ -69,7 +69,7 @@ Rect2 NavigationPolygon::_edit_get_rect() const { bool NavigationPolygon::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { for (int i = 0; i < outlines.size(); i++) { - const PoolVector<Vector2> &outline = outlines[i]; + const Vector<Vector2> &outline = outlines[i]; const int outline_size = outline.size(); if (outline_size < 3) continue; @@ -80,7 +80,7 @@ bool NavigationPolygon::_edit_is_selected_on_click(const Point2 &p_point, double } #endif -void NavigationPolygon::set_vertices(const PoolVector<Vector2> &p_vertices) { +void NavigationPolygon::set_vertices(const Vector<Vector2> &p_vertices) { navmesh_generation->lock(); navmesh.unref(); @@ -89,7 +89,7 @@ void NavigationPolygon::set_vertices(const PoolVector<Vector2> &p_vertices) { rect_cache_dirty = true; } -PoolVector<Vector2> NavigationPolygon::get_vertices() const { +Vector<Vector2> NavigationPolygon::get_vertices() const { return vertices; } @@ -146,7 +146,7 @@ void NavigationPolygon::add_polygon(const Vector<int> &p_polygon) { navmesh_generation->unlock(); } -void NavigationPolygon::add_outline_at_index(const PoolVector<Vector2> &p_outline, int p_index) { +void NavigationPolygon::add_outline_at_index(const Vector<Vector2> &p_outline, int p_index) { outlines.insert(p_index, p_outline); rect_cache_dirty = true; @@ -173,12 +173,12 @@ Ref<NavigationMesh> NavigationPolygon::get_mesh() { navmesh_generation->lock(); if (navmesh.is_null()) { navmesh.instance(); - PoolVector<Vector3> verts; + Vector<Vector3> verts; { verts.resize(get_vertices().size()); - PoolVector<Vector3>::Write w = verts.write(); + Vector3 *w = verts.ptrw(); - PoolVector<Vector2>::Read r = get_vertices().read(); + const Vector2 *r = get_vertices().ptr(); for (int i(0); i < get_vertices().size(); i++) { w[i] = Vector3(r[i].x, 0.0, r[i].y); @@ -194,7 +194,7 @@ Ref<NavigationMesh> NavigationPolygon::get_mesh() { return navmesh; } -void NavigationPolygon::add_outline(const PoolVector<Vector2> &p_outline) { +void NavigationPolygon::add_outline(const Vector<Vector2> &p_outline) { outlines.push_back(p_outline); rect_cache_dirty = true; @@ -205,7 +205,7 @@ int NavigationPolygon::get_outline_count() const { return outlines.size(); } -void NavigationPolygon::set_outline(int p_idx, const PoolVector<Vector2> &p_outline) { +void NavigationPolygon::set_outline(int p_idx, const Vector<Vector2> &p_outline) { ERR_FAIL_INDEX(p_idx, outlines.size()); outlines.write[p_idx] = p_outline; rect_cache_dirty = true; @@ -218,8 +218,8 @@ void NavigationPolygon::remove_outline(int p_idx) { rect_cache_dirty = true; } -PoolVector<Vector2> NavigationPolygon::get_outline(int p_idx) const { - ERR_FAIL_INDEX_V(p_idx, outlines.size(), PoolVector<Vector2>()); +Vector<Vector2> NavigationPolygon::get_outline(int p_idx) const { + ERR_FAIL_INDEX_V(p_idx, outlines.size(), Vector<Vector2>()); return outlines[p_idx]; } @@ -239,11 +239,11 @@ void NavigationPolygon::make_polygons_from_outlines() { for (int i = 0; i < outlines.size(); i++) { - PoolVector<Vector2> ol = outlines[i]; + Vector<Vector2> ol = outlines[i]; int olsize = ol.size(); if (olsize < 3) continue; - PoolVector<Vector2>::Read r = ol.read(); + const Vector2 *r = ol.ptr(); for (int j = 0; j < olsize; j++) { outside_point.x = MAX(r[j].x, outside_point.x); outside_point.y = MAX(r[j].y, outside_point.y); @@ -254,11 +254,11 @@ void NavigationPolygon::make_polygons_from_outlines() { for (int i = 0; i < outlines.size(); i++) { - PoolVector<Vector2> ol = outlines[i]; + Vector<Vector2> ol = outlines[i]; int olsize = ol.size(); if (olsize < 3) continue; - PoolVector<Vector2>::Read r = ol.read(); + const Vector2 *r = ol.ptr(); int interscount = 0; //test if this is an outer outline @@ -267,11 +267,11 @@ void NavigationPolygon::make_polygons_from_outlines() { if (i == k) continue; //no self intersect - PoolVector<Vector2> ol2 = outlines[k]; + Vector<Vector2> ol2 = outlines[k]; int olsize2 = ol2.size(); if (olsize2 < 3) continue; - PoolVector<Vector2>::Read r2 = ol2.read(); + const Vector2 *r2 = ol2.ptr(); for (int l = 0; l < olsize2; l++) { @@ -356,7 +356,7 @@ void NavigationPolygon::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_outlines", "outlines"), &NavigationPolygon::_set_outlines); ClassDB::bind_method(D_METHOD("_get_outlines"), &NavigationPolygon::_get_outlines); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "vertices", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_vertices", "get_vertices"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "vertices", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_vertices", "get_vertices"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "polygons", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_polygons", "_get_polygons"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "outlines", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_outlines", "_get_outlines"); } @@ -451,7 +451,7 @@ void NavigationPolygonInstance::_notification(int p_what) { if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()) && navpoly.is_valid()) { - PoolVector<Vector2> verts = navpoly->get_vertices(); + Vector<Vector2> verts = navpoly->get_vertices(); int vsize = verts.size(); if (vsize < 3) return; @@ -467,7 +467,7 @@ void NavigationPolygonInstance::_notification(int p_what) { vertices.resize(vsize); colors.resize(vsize); { - PoolVector<Vector2>::Read vr = verts.read(); + const Vector2 *vr = verts.ptr(); for (int i = 0; i < vsize; i++) { vertices.write[i] = vr[i]; colors.write[i] = color; diff --git a/scene/2d/navigation_polygon.h b/scene/2d/navigation_polygon.h index 8d3d8543c4..557ce4b3e7 100644 --- a/scene/2d/navigation_polygon.h +++ b/scene/2d/navigation_polygon.h @@ -40,12 +40,12 @@ class NavigationPolygon : public Resource { GDCLASS(NavigationPolygon, Resource); - PoolVector<Vector2> vertices; + Vector<Vector2> vertices; struct Polygon { Vector<int> indices; }; Vector<Polygon> polygons; - Vector<PoolVector<Vector2> > outlines; + Vector<Vector<Vector2> > outlines; mutable Rect2 item_rect; mutable bool rect_cache_dirty; @@ -69,16 +69,16 @@ public: bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const; #endif - void set_vertices(const PoolVector<Vector2> &p_vertices); - PoolVector<Vector2> get_vertices() const; + void set_vertices(const Vector<Vector2> &p_vertices); + Vector<Vector2> get_vertices() const; void add_polygon(const Vector<int> &p_polygon); int get_polygon_count() const; - void add_outline(const PoolVector<Vector2> &p_outline); - void add_outline_at_index(const PoolVector<Vector2> &p_outline, int p_index); - void set_outline(int p_idx, const PoolVector<Vector2> &p_outline); - PoolVector<Vector2> get_outline(int p_idx) const; + void add_outline(const Vector<Vector2> &p_outline); + void add_outline_at_index(const Vector<Vector2> &p_outline, int p_index); + void set_outline(int p_idx, const Vector<Vector2> &p_outline); + Vector<Vector2> get_outline(int p_idx) const; void remove_outline(int p_idx); int get_outline_count() const; diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index ba5b7d29e7..67269134ef 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -61,7 +61,7 @@ bool Polygon2D::_edit_use_pivot() const { Rect2 Polygon2D::_edit_get_rect() const { if (rect_cache_dirty) { int l = polygon.size(); - PoolVector<Vector2>::Read r = polygon.read(); + const Vector2 *r = polygon.ptr(); item_rect = Rect2(); for (int i = 0; i < l; i++) { Vector2 pos = r[i] + offset; @@ -148,7 +148,7 @@ void Polygon2D::_notification(int p_what) { { - PoolVector<Vector2>::Read polyr = polygon.read(); + const Vector2 *polyr = polygon.ptr(); for (int i = 0; i < len; i++) { points.write[i] = polyr[i] + offset; } @@ -217,7 +217,7 @@ void Polygon2D::_notification(int p_what) { if (points.size() == uv.size()) { - PoolVector<Vector2>::Read uvr = uv.read(); + const Vector2 *uvr = uv.ptr(); for (int i = 0; i < len; i++) { uvs.write[i] = texmat.xform(uvr[i]) / tex_size; @@ -257,7 +257,7 @@ void Polygon2D::_notification(int p_what) { } int bone_index = bone->get_index_in_skeleton(); - PoolVector<float>::Read r = bone_weights[i].weights.read(); + const float *r = bone_weights[i].weights.ptr(); for (int j = 0; j < vc; j++) { if (r[j] == 0.0) continue; //weight is unpainted, skip @@ -296,7 +296,7 @@ void Polygon2D::_notification(int p_what) { Vector<Color> colors; if (vertex_colors.size() == points.size()) { colors.resize(len); - PoolVector<Color>::Read color_r = vertex_colors.read(); + const Color *color_r = vertex_colors.ptr(); for (int i = 0; i < len; i++) { colors.write[i] = color_r[i]; } @@ -313,11 +313,11 @@ void Polygon2D::_notification(int p_what) { //draw individual polygons Vector<int> total_indices; for (int i = 0; i < polygons.size(); i++) { - PoolVector<int> src_indices = polygons[i]; + Vector<int> src_indices = polygons[i]; int ic = src_indices.size(); if (ic < 3) continue; - PoolVector<int>::Read r = src_indices.read(); + const int *r = src_indices.ptr(); Vector<Vector2> tmp_points; tmp_points.resize(ic); @@ -349,13 +349,13 @@ void Polygon2D::_notification(int p_what) { } } -void Polygon2D::set_polygon(const PoolVector<Vector2> &p_polygon) { +void Polygon2D::set_polygon(const Vector<Vector2> &p_polygon) { polygon = p_polygon; rect_cache_dirty = true; update(); } -PoolVector<Vector2> Polygon2D::get_polygon() const { +Vector<Vector2> Polygon2D::get_polygon() const { return polygon; } @@ -369,13 +369,13 @@ int Polygon2D::get_internal_vertex_count() const { return internal_vertices; } -void Polygon2D::set_uv(const PoolVector<Vector2> &p_uv) { +void Polygon2D::set_uv(const Vector<Vector2> &p_uv) { uv = p_uv; update(); } -PoolVector<Vector2> Polygon2D::get_uv() const { +Vector<Vector2> Polygon2D::get_uv() const { return uv; } @@ -401,12 +401,12 @@ Color Polygon2D::get_color() const { return color; } -void Polygon2D::set_vertex_colors(const PoolVector<Color> &p_colors) { +void Polygon2D::set_vertex_colors(const Vector<Color> &p_colors) { vertex_colors = p_colors; update(); } -PoolVector<Color> Polygon2D::get_vertex_colors() const { +Vector<Color> Polygon2D::get_vertex_colors() const { return vertex_colors; } @@ -548,7 +548,7 @@ Vector2 Polygon2D::get_offset() const { return offset; } -void Polygon2D::add_bone(const NodePath &p_path, const PoolVector<float> &p_weights) { +void Polygon2D::add_bone(const NodePath &p_path, const Vector<float> &p_weights) { Bone bone; bone.path = p_path; @@ -562,9 +562,9 @@ NodePath Polygon2D::get_bone_path(int p_index) const { ERR_FAIL_INDEX_V(p_index, bone_weights.size(), NodePath()); return bone_weights[p_index].path; } -PoolVector<float> Polygon2D::get_bone_weights(int p_index) const { +Vector<float> Polygon2D::get_bone_weights(int p_index) const { - ERR_FAIL_INDEX_V(p_index, bone_weights.size(), PoolVector<float>()); + ERR_FAIL_INDEX_V(p_index, bone_weights.size(), Vector<float>()); return bone_weights[p_index].weights; } void Polygon2D::erase_bone(int p_idx) { @@ -577,7 +577,7 @@ void Polygon2D::clear_bones() { bone_weights.clear(); } -void Polygon2D::set_bone_weights(int p_index, const PoolVector<float> &p_weights) { +void Polygon2D::set_bone_weights(int p_index, const Vector<float> &p_weights) { ERR_FAIL_INDEX(p_index, bone_weights.size()); bone_weights.write[p_index].weights = p_weights; update(); @@ -715,9 +715,9 @@ void Polygon2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "invert_border", PROPERTY_HINT_RANGE, "0.1,16384,0.1"), "set_invert_border", "get_invert_border"); ADD_GROUP("Data", ""); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "uv"), "set_uv", "get_uv"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "vertex_colors"), "set_vertex_colors", "get_vertex_colors"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "uv"), "set_uv", "get_uv"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_COLOR_ARRAY, "vertex_colors"), "set_vertex_colors", "get_vertex_colors"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "polygons"), "set_polygons", "get_polygons"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "bones", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_bones", "_get_bones"); ADD_PROPERTY(PropertyInfo(Variant::INT, "internal_vertex_count", PROPERTY_HINT_RANGE, "0,1000"), "set_internal_vertex_count", "get_internal_vertex_count"); diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h index 4816e2c869..777c1f82f3 100644 --- a/scene/2d/polygon_2d.h +++ b/scene/2d/polygon_2d.h @@ -37,15 +37,15 @@ class Polygon2D : public Node2D { GDCLASS(Polygon2D, Node2D); - PoolVector<Vector2> polygon; - PoolVector<Vector2> uv; - PoolVector<Color> vertex_colors; + Vector<Vector2> polygon; + Vector<Vector2> uv; + Vector<Color> vertex_colors; Array polygons; int internal_vertices; struct Bone { NodePath path; - PoolVector<float> weights; + Vector<float> weights; }; Vector<Bone> bone_weights; @@ -95,14 +95,14 @@ public: virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const; #endif - void set_polygon(const PoolVector<Vector2> &p_polygon); - PoolVector<Vector2> get_polygon() const; + void set_polygon(const Vector<Vector2> &p_polygon); + Vector<Vector2> get_polygon() const; void set_internal_vertex_count(int p_count); int get_internal_vertex_count() const; - void set_uv(const PoolVector<Vector2> &p_uv); - PoolVector<Vector2> get_uv() const; + void set_uv(const Vector<Vector2> &p_uv); + Vector<Vector2> get_uv() const; void set_polygons(const Array &p_polygons); Array get_polygons() const; @@ -110,8 +110,8 @@ public: void set_color(const Color &p_color); Color get_color() const; - void set_vertex_colors(const PoolVector<Color> &p_colors); - PoolVector<Color> get_vertex_colors() const; + void set_vertex_colors(const Vector<Color> &p_colors); + Vector<Color> get_vertex_colors() const; void set_texture(const Ref<Texture2D> &p_texture); Ref<Texture2D> get_texture() const; @@ -152,13 +152,13 @@ public: void set_offset(const Vector2 &p_offset); Vector2 get_offset() const; - void add_bone(const NodePath &p_path = NodePath(), const PoolVector<float> &p_weights = PoolVector<float>()); + void add_bone(const NodePath &p_path = NodePath(), const Vector<float> &p_weights = Vector<float>()); int get_bone_count() const; NodePath get_bone_path(int p_index) const; - PoolVector<float> get_bone_weights(int p_index) const; + Vector<float> get_bone_weights(int p_index) const; void erase_bone(int p_idx); void clear_bones(); - void set_bone_weights(int p_index, const PoolVector<float> &p_weights); + void set_bone_weights(int p_index, const Vector<float> &p_weights); void set_bone_path(int p_index, const NodePath &p_path); void set_skeleton(const NodePath &p_skeleton); diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index e3fda5b585..57b11fa069 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -629,7 +629,7 @@ void TileMap::update_dirty_quadrants() { vs->canvas_item_set_z_index(debug_navigation_item, VS::CANVAS_ITEM_Z_MAX - 2); // Display one below collision debug if (debug_navigation_item.is_valid()) { - PoolVector<Vector2> navigation_polygon_vertices = navpoly->get_vertices(); + Vector<Vector2> navigation_polygon_vertices = navpoly->get_vertices(); int vsize = navigation_polygon_vertices.size(); if (vsize > 2) { @@ -638,7 +638,7 @@ void TileMap::update_dirty_quadrants() { vertices.resize(vsize); colors.resize(vsize); { - PoolVector<Vector2>::Read vr = navigation_polygon_vertices.read(); + const Vector2 *vr = navigation_polygon_vertices.ptr(); for (int j = 0; j < vsize; j++) { vertices.write[j] = vr[j]; colors.write[j] = debug_navigation_color; @@ -1207,12 +1207,12 @@ void TileMap::clear() { used_size_cache_dirty = true; } -void TileMap::_set_tile_data(const PoolVector<int> &p_data) { +void TileMap::_set_tile_data(const Vector<int> &p_data) { ERR_FAIL_COND(format > FORMAT_2); int c = p_data.size(); - PoolVector<int>::Read r = p_data.read(); + const int *r = p_data.ptr(); int offset = (format == FORMAT_2) ? 3 : 2; @@ -1255,11 +1255,11 @@ void TileMap::_set_tile_data(const PoolVector<int> &p_data) { } } -PoolVector<int> TileMap::_get_tile_data() const { +Vector<int> TileMap::_get_tile_data() const { - PoolVector<int> data; + Vector<int> data; data.resize(tile_map.size() * 3); - PoolVector<int>::Write w = data.write(); + int *w = data.ptrw(); // Save in highest format @@ -1281,8 +1281,6 @@ PoolVector<int> TileMap::_get_tile_data() const { idx += 3; } - w.release(); - return data; } diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index d5ef7fc818..d9490aae13 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -220,8 +220,8 @@ private: _FORCE_INLINE_ int _get_quadrant_size() const; - void _set_tile_data(const PoolVector<int> &p_data); - PoolVector<int> _get_tile_data() const; + void _set_tile_data(const Vector<int> &p_data); + Vector<int> _get_tile_data() const; void _set_old_cell_size(int p_size) { set_cell_size(Size2(p_size, p_size)); } int _get_old_cell_size() const { return cell_size.x; } diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 189ac1d1b3..ae70e2e1ac 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -45,12 +45,12 @@ private: mutable real_t squared_gain; // temporary }; - PoolVector<Speaker> speakers; + Vector<Speaker> speakers; public: Spcap(unsigned int speaker_count, const Vector3 *speaker_directions) { this->speakers.resize(speaker_count); - PoolVector<Speaker>::Write w = this->speakers.write(); + Speaker *w = this->speakers.ptrw(); for (unsigned int speaker_num = 0; speaker_num < speaker_count; speaker_num++) { w[speaker_num].direction = speaker_directions[speaker_num]; w[speaker_num].squared_gain = 0.0; @@ -66,11 +66,11 @@ public: } Vector3 get_speaker_direction(unsigned int index) const { - return this->speakers.read()[index].direction; + return this->speakers.ptr()[index].direction; } void calculate(const Vector3 &source_direction, real_t tightness, unsigned int volume_count, real_t *volumes) const { - PoolVector<Speaker>::Read r = this->speakers.read(); + const Speaker *r = this->speakers.ptr(); real_t sum_squared_gains = 0.0; for (unsigned int speaker_num = 0; speaker_num < (unsigned int)this->speakers.size(); speaker_num++) { real_t initial_gain = 0.5 * powf(1.0 + r[speaker_num].direction.dot(source_direction), tightness) / r[speaker_num].effective_number_of_speakers; diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp index 31a80bc2db..a6b92d5ee6 100644 --- a/scene/3d/baked_lightmap.cpp +++ b/scene/3d/baked_lightmap.cpp @@ -47,12 +47,12 @@ AABB BakedLightmapData::get_bounds() const { return bounds; } -void BakedLightmapData::set_octree(const PoolVector<uint8_t> &p_octree) { +void BakedLightmapData::set_octree(const Vector<uint8_t> &p_octree) { VS::get_singleton()->lightmap_capture_set_octree(baked_light, p_octree); } -PoolVector<uint8_t> BakedLightmapData::get_octree() const { +Vector<uint8_t> BakedLightmapData::get_octree() const { return VS::get_singleton()->lightmap_capture_get_octree(baked_light); } @@ -175,7 +175,7 @@ void BakedLightmapData::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "cell_space_transform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_cell_space_transform", "get_cell_space_transform"); ADD_PROPERTY(PropertyInfo(Variant::INT, "cell_subdiv", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_cell_subdiv", "get_cell_subdiv"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "energy", PROPERTY_HINT_RANGE, "0,16,0.01,or_greater"), "set_energy", "get_energy"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "octree", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_octree", "get_octree"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_BYTE_ARRAY, "octree", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_octree", "get_octree"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "user_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_user_data", "_get_user_data"); } @@ -495,13 +495,13 @@ BakedLightmap::BakeError BakedLightmap::bake(Node *p_from_node, bool p_create_vi if (hdr) { //just save a regular image - PoolVector<uint8_t> data; + Vector<uint8_t> data; int s = lm.light.size(); data.resize(lm.light.size() * 2); { - PoolVector<uint8_t>::Write w = data.write(); - PoolVector<float>::Read r = lm.light.read(); + uint8_t* w = data.ptrw(); + const float* r = lm.light.ptr(); uint16_t *hfw = (uint16_t *)w.ptr(); for (int i = 0; i < s; i++) { hfw[i] = Math::make_half_float(r[i]); @@ -513,13 +513,13 @@ BakedLightmap::BakeError BakedLightmap::bake(Node *p_from_node, bool p_create_vi } else { //just save a regular image - PoolVector<uint8_t> data; + Vector<uint8_t> data; int s = lm.light.size(); data.resize(lm.light.size()); { - PoolVector<uint8_t>::Write w = data.write(); - PoolVector<float>::Read r = lm.light.read(); + uint8_t* w = data.ptrw(); + const float* r = lm.light.ptr(); for (int i = 0; i < s; i += 3) { Color c(r[i + 0], r[i + 1], r[i + 2]); c = c.to_srgb(); @@ -775,8 +775,8 @@ String BakedLightmap::get_image_path() const { AABB BakedLightmap::get_aabb() const { return AABB(-extents, extents * 2); } -PoolVector<Face3> BakedLightmap::get_faces(uint32_t p_usage_flags) const { - return PoolVector<Face3>(); +Vector<Face3> BakedLightmap::get_faces(uint32_t p_usage_flags) const { + return Vector<Face3>(); } void BakedLightmap::_bind_methods() { diff --git a/scene/3d/baked_lightmap.h b/scene/3d/baked_lightmap.h index 0633ffa641..bc9e3f55ea 100644 --- a/scene/3d/baked_lightmap.h +++ b/scene/3d/baked_lightmap.h @@ -64,8 +64,8 @@ public: void set_bounds(const AABB &p_bounds); AABB get_bounds() const; - void set_octree(const PoolVector<uint8_t> &p_octree); - PoolVector<uint8_t> get_octree() const; + void set_octree(const Vector<uint8_t> &p_octree); + Vector<uint8_t> get_octree() const; void set_cell_space_transform(const Transform &p_xform); Transform get_cell_space_transform() const; @@ -202,7 +202,7 @@ public: String get_image_path() const; AABB get_aabb() const; - PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; + Vector<Face3> get_faces(uint32_t p_usage_flags) const; BakeError bake(Node *p_from_node, bool p_create_visual_debug = false); BakedLightmap(); diff --git a/scene/3d/collision_polygon.cpp b/scene/3d/collision_polygon.cpp index cc07072962..342159d80f 100644 --- a/scene/3d/collision_polygon.cpp +++ b/scene/3d/collision_polygon.cpp @@ -53,11 +53,11 @@ void CollisionPolygon::_build_polygon() { for (int i = 0; i < decomp.size(); i++) { Ref<ConvexPolygonShape> convex = memnew(ConvexPolygonShape); - PoolVector<Vector3> cp; + Vector<Vector3> cp; int cs = decomp[i].size(); cp.resize(cs * 2); { - PoolVector<Vector3>::Write w = cp.write(); + Vector3 *w = cp.ptrw(); int idx = 0; for (int j = 0; j < cs; j++) { @@ -193,7 +193,7 @@ void CollisionPolygon::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "depth"), "set_depth", "get_depth"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disabled"), "set_disabled", "is_disabled"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon"); } CollisionPolygon::CollisionPolygon() { diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp index 6e26f7ce8f..552c15c86b 100644 --- a/scene/3d/cpu_particles.cpp +++ b/scene/3d/cpu_particles.cpp @@ -39,9 +39,9 @@ AABB CPUParticles::get_aabb() const { return AABB(); } -PoolVector<Face3> CPUParticles::get_faces(uint32_t p_usage_flags) const { +Vector<Face3> CPUParticles::get_faces(uint32_t p_usage_flags) const { - return PoolVector<Face3>(); + return Vector<Face3>(); } void CPUParticles::set_emitting(bool p_emitting) { @@ -65,7 +65,7 @@ void CPUParticles::set_amount(int p_amount) { particles.resize(p_amount); { - PoolVector<Particle>::Write w = particles.write(); + Particle *w = particles.ptrw(); for (int i = 0; i < p_amount; i++) { w[i].active = false; @@ -244,7 +244,7 @@ void CPUParticles::restart() { { int pc = particles.size(); - PoolVector<Particle>::Write w = particles.write(); + Particle *w = particles.ptrw(); for (int i = 0; i < pc; i++) { w[i].active = false; @@ -419,17 +419,17 @@ void CPUParticles::set_emission_box_extents(Vector3 p_extents) { emission_box_extents = p_extents; } -void CPUParticles::set_emission_points(const PoolVector<Vector3> &p_points) { +void CPUParticles::set_emission_points(const Vector<Vector3> &p_points) { emission_points = p_points; } -void CPUParticles::set_emission_normals(const PoolVector<Vector3> &p_normals) { +void CPUParticles::set_emission_normals(const Vector<Vector3> &p_normals) { emission_normals = p_normals; } -void CPUParticles::set_emission_colors(const PoolVector<Color> &p_colors) { +void CPUParticles::set_emission_colors(const Vector<Color> &p_colors) { emission_colors = p_colors; } @@ -442,16 +442,16 @@ Vector3 CPUParticles::get_emission_box_extents() const { return emission_box_extents; } -PoolVector<Vector3> CPUParticles::get_emission_points() const { +Vector<Vector3> CPUParticles::get_emission_points() const { return emission_points; } -PoolVector<Vector3> CPUParticles::get_emission_normals() const { +Vector<Vector3> CPUParticles::get_emission_normals() const { return emission_normals; } -PoolVector<Color> CPUParticles::get_emission_colors() const { +Vector<Color> CPUParticles::get_emission_colors() const { return emission_colors; } @@ -597,9 +597,9 @@ void CPUParticles::_particles_process(float p_delta) { p_delta *= speed_scale; int pcount = particles.size(); - PoolVector<Particle>::Write w = particles.write(); + Particle *w = particles.ptrw(); - Particle *parray = w.ptr(); + Particle *parray = w; float prev_time = time; time += p_delta; @@ -1025,23 +1025,23 @@ void CPUParticles::_update_particle_data_buffer() { int pc = particles.size(); - PoolVector<int>::Write ow; + int *ow; int *order = NULL; - PoolVector<float>::Write w = particle_data.write(); - PoolVector<Particle>::Read r = particles.read(); - float *ptr = w.ptr(); + float *w = particle_data.ptrw(); + const Particle *r = particles.ptr(); + float *ptr = w; if (draw_order != DRAW_ORDER_INDEX) { - ow = particle_order.write(); - order = ow.ptr(); + ow = particle_order.ptrw(); + order = ow; for (int i = 0; i < pc; i++) { order[i] = i; } if (draw_order == DRAW_ORDER_LIFETIME) { SortArray<int, SortLifetime> sorter; - sorter.compare.particles = r.ptr(); + sorter.compare.particles = r; sorter.sort(order, pc); } else if (draw_order == DRAW_ORDER_VIEW_DEPTH) { Camera *c = get_viewport()->get_camera(); @@ -1058,7 +1058,7 @@ void CPUParticles::_update_particle_data_buffer() { } SortArray<int, SortAxis> sorter; - sorter.compare.particles = r.ptr(); + sorter.compare.particles = r; sorter.compare.axis = dir; sorter.sort(order, pc); } @@ -1185,9 +1185,9 @@ void CPUParticles::_notification(int p_what) { int pc = particles.size(); - PoolVector<float>::Write w = particle_data.write(); - PoolVector<Particle>::Read r = particles.read(); - float *ptr = w.ptr(); + float *w = particle_data.ptrw(); + const Particle *r = particles.ptr(); + float *ptr = w; for (int i = 0; i < pc; i++) { @@ -1403,9 +1403,9 @@ void CPUParticles::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "emission_shape", PROPERTY_HINT_ENUM, "Point,Sphere,Box,Points,Directed Points"), "set_emission_shape", "get_emission_shape"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "emission_sphere_radius", PROPERTY_HINT_RANGE, "0.01,128,0.01"), "set_emission_sphere_radius", "get_emission_sphere_radius"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "emission_box_extents"), "set_emission_box_extents", "get_emission_box_extents"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "emission_points"), "set_emission_points", "get_emission_points"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "emission_normals"), "set_emission_normals", "get_emission_normals"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "emission_colors"), "set_emission_colors", "get_emission_colors"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR3_ARRAY, "emission_points"), "set_emission_points", "get_emission_points"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR3_ARRAY, "emission_normals"), "set_emission_normals", "get_emission_normals"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_COLOR_ARRAY, "emission_colors"), "set_emission_colors", "get_emission_colors"); ADD_GROUP("Flags", "flag_"); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flag_align_y"), "set_particle_flag", "get_particle_flag", FLAG_ALIGN_Y_TO_VELOCITY); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "flag_rotate_y"), "set_particle_flag", "get_particle_flag", FLAG_ROTATE_Y); diff --git a/scene/3d/cpu_particles.h b/scene/3d/cpu_particles.h index d5a549b976..1a5537e4f2 100644 --- a/scene/3d/cpu_particles.h +++ b/scene/3d/cpu_particles.h @@ -106,9 +106,9 @@ private: RID multimesh; - PoolVector<Particle> particles; - PoolVector<float> particle_data; - PoolVector<int> particle_order; + Vector<Particle> particles; + Vector<float> particle_data; + Vector<int> particle_order; struct SortLifetime { const Particle *particles; @@ -167,9 +167,9 @@ private: EmissionShape emission_shape; float emission_sphere_radius; Vector3 emission_box_extents; - PoolVector<Vector3> emission_points; - PoolVector<Vector3> emission_normals; - PoolVector<Color> emission_colors; + Vector<Vector3> emission_points; + Vector<Vector3> emission_normals; + Vector<Color> emission_colors; int emission_point_count; Vector3 gravity; @@ -191,7 +191,7 @@ protected: public: AABB get_aabb() const; - PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; + Vector<Face3> get_faces(uint32_t p_usage_flags) const; void set_emitting(bool p_emitting); void set_amount(int p_amount); @@ -264,17 +264,17 @@ public: void set_emission_shape(EmissionShape p_shape); void set_emission_sphere_radius(float p_radius); void set_emission_box_extents(Vector3 p_extents); - void set_emission_points(const PoolVector<Vector3> &p_points); - void set_emission_normals(const PoolVector<Vector3> &p_normals); - void set_emission_colors(const PoolVector<Color> &p_colors); + void set_emission_points(const Vector<Vector3> &p_points); + void set_emission_normals(const Vector<Vector3> &p_normals); + void set_emission_colors(const Vector<Color> &p_colors); void set_emission_point_count(int p_count); EmissionShape get_emission_shape() const; float get_emission_sphere_radius() const; Vector3 get_emission_box_extents() const; - PoolVector<Vector3> get_emission_points() const; - PoolVector<Vector3> get_emission_normals() const; - PoolVector<Color> get_emission_colors() const; + Vector<Vector3> get_emission_points() const; + Vector<Vector3> get_emission_normals() const; + Vector<Color> get_emission_colors() const; int get_emission_point_count() const; void set_gravity(const Vector3 &p_gravity); diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 34540525af..918646fd9e 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -47,14 +47,14 @@ void GIProbeData::_set_data(const Dictionary &p_data) { AABB bounds = p_data["bounds"]; Vector3 octree_size = p_data["octree_size"]; - PoolVector<uint8_t> octree_cells = p_data["octree_cells"]; - PoolVector<uint8_t> octree_data = p_data["octree_data"]; + Vector<uint8_t> octree_cells = p_data["octree_cells"]; + Vector<uint8_t> octree_data = p_data["octree_data"]; - PoolVector<uint8_t> octree_df; + Vector<uint8_t> octree_df; if (p_data.has("octree_df")) { octree_df = p_data["octree_df"]; } else if (p_data.has("octree_df_png")) { - PoolVector<uint8_t> octree_df_png = p_data["octree_df_png"]; + Vector<uint8_t> octree_df_png = p_data["octree_df_png"]; Ref<Image> img; img.instance(); Error err = img->load_png_from_buffer(octree_df_png); @@ -62,7 +62,7 @@ void GIProbeData::_set_data(const Dictionary &p_data) { ERR_FAIL_COND(img->get_format() != Image::FORMAT_L8); octree_df = img->get_data(); } - PoolVector<int> octree_levels = p_data["level_counts"]; + Vector<int> octree_levels = p_data["level_counts"]; Transform to_cell_xform = p_data["to_cell_xform"]; allocate(to_cell_xform, bounds, octree_size, octree_cells, octree_data, octree_df, octree_levels); @@ -79,11 +79,11 @@ Dictionary GIProbeData::_get_data() const { Ref<Image> img; img.instance(); img->create(otsize.x * otsize.y, otsize.z, false, Image::FORMAT_L8, get_distance_field()); - PoolVector<uint8_t> df_png = img->save_png_to_buffer(); + Vector<uint8_t> df_png = img->save_png_to_buffer(); ERR_FAIL_COND_V(df_png.size() == 0, Dictionary()); d["octree_df_png"] = df_png; } else { - d["octree_df"] = PoolVector<uint8_t>(); + d["octree_df"] = Vector<uint8_t>(); } d["level_counts"] = get_level_counts(); @@ -91,7 +91,7 @@ Dictionary GIProbeData::_get_data() const { return d; } -void GIProbeData::allocate(const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3 &p_octree_size, const PoolVector<uint8_t> &p_octree_cells, const PoolVector<uint8_t> &p_data_cells, const PoolVector<uint8_t> &p_distance_field, const PoolVector<int> &p_level_counts) { +void GIProbeData::allocate(const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3 &p_octree_size, const Vector<uint8_t> &p_octree_cells, const Vector<uint8_t> &p_data_cells, const Vector<uint8_t> &p_distance_field, const Vector<int> &p_level_counts) { VS::get_singleton()->gi_probe_allocate(probe, p_to_cell_xform, p_aabb, p_octree_size, p_octree_cells, p_data_cells, p_distance_field, p_level_counts); bounds = p_aabb; to_cell_xform = p_to_cell_xform; @@ -104,17 +104,17 @@ AABB GIProbeData::get_bounds() const { Vector3 GIProbeData::get_octree_size() const { return octree_size; } -PoolVector<uint8_t> GIProbeData::get_octree_cells() const { +Vector<uint8_t> GIProbeData::get_octree_cells() const { return VS::get_singleton()->gi_probe_get_octree_cells(probe); } -PoolVector<uint8_t> GIProbeData::get_data_cells() const { +Vector<uint8_t> GIProbeData::get_data_cells() const { return VS::get_singleton()->gi_probe_get_data_cells(probe); } -PoolVector<uint8_t> GIProbeData::get_distance_field() const { +Vector<uint8_t> GIProbeData::get_distance_field() const { return VS::get_singleton()->gi_probe_get_distance_field(probe); } -PoolVector<int> GIProbeData::get_level_counts() const { +Vector<int> GIProbeData::get_level_counts() const { return VS::get_singleton()->gi_probe_get_level_counts(probe); } Transform GIProbeData::get_to_cell_xform() const { @@ -492,7 +492,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) { bake_step_function(pmc++, RTR("Generating Distance Field")); } - PoolVector<uint8_t> df = baker.get_sdf_3d_image(); + Vector<uint8_t> df = baker.get_sdf_3d_image(); probe_data->allocate(baker.get_to_cell_space_xform(), AABB(-extents, extents * 2.0), baker.get_giprobe_octree_size(), baker.get_giprobe_octree_cells(), baker.get_giprobe_data_cells(), df, baker.get_giprobe_level_cell_count()); @@ -519,9 +519,9 @@ AABB GIProbe::get_aabb() const { return AABB(-extents, extents * 2); } -PoolVector<Face3> GIProbe::get_faces(uint32_t p_usage_flags) const { +Vector<Face3> GIProbe::get_faces(uint32_t p_usage_flags) const { - return PoolVector<Face3>(); + return Vector<Face3>(); } String GIProbe::get_configuration_warning() const { diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h index 60aa1d952c..354eaad7c0 100644 --- a/scene/3d/gi_probe.h +++ b/scene/3d/gi_probe.h @@ -63,13 +63,13 @@ protected: void _validate_property(PropertyInfo &property) const; public: - void allocate(const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3 &p_octree_size, const PoolVector<uint8_t> &p_octree_cells, const PoolVector<uint8_t> &p_data_cells, const PoolVector<uint8_t> &p_distance_field, const PoolVector<int> &p_level_counts); + void allocate(const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3 &p_octree_size, const Vector<uint8_t> &p_octree_cells, const Vector<uint8_t> &p_data_cells, const Vector<uint8_t> &p_distance_field, const Vector<int> &p_level_counts); AABB get_bounds() const; Vector3 get_octree_size() const; - PoolVector<uint8_t> get_octree_cells() const; - PoolVector<uint8_t> get_data_cells() const; - PoolVector<uint8_t> get_distance_field() const; - PoolVector<int> get_level_counts() const; + Vector<uint8_t> get_octree_cells() const; + Vector<uint8_t> get_data_cells() const; + Vector<uint8_t> get_distance_field() const; + Vector<int> get_level_counts() const; Transform get_to_cell_xform() const; void set_dynamic_range(float p_range); @@ -164,7 +164,7 @@ public: void bake(Node *p_from_node = NULL, bool p_create_visual_debug = false); virtual AABB get_aabb() const; - virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const; virtual String get_configuration_warning() const; diff --git a/scene/3d/immediate_geometry.cpp b/scene/3d/immediate_geometry.cpp index afe60226b6..f5b08b86e1 100644 --- a/scene/3d/immediate_geometry.cpp +++ b/scene/3d/immediate_geometry.cpp @@ -90,9 +90,9 @@ AABB ImmediateGeometry::get_aabb() const { return aabb; } -PoolVector<Face3> ImmediateGeometry::get_faces(uint32_t p_usage_flags) const { +Vector<Face3> ImmediateGeometry::get_faces(uint32_t p_usage_flags) const { - return PoolVector<Face3>(); + return Vector<Face3>(); } void ImmediateGeometry::add_sphere(int p_lats, int p_lons, float p_radius, bool p_add_uv) { diff --git a/scene/3d/immediate_geometry.h b/scene/3d/immediate_geometry.h index 7f506ce9ef..77a20e8d4d 100644 --- a/scene/3d/immediate_geometry.h +++ b/scene/3d/immediate_geometry.h @@ -64,7 +64,7 @@ public: void add_sphere(int p_lats, int p_lons, float p_radius, bool p_add_uv = true); virtual AABB get_aabb() const; - virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const; ImmediateGeometry(); ~ImmediateGeometry(); diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 8d3b9bbaf0..90d3f71b95 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -152,9 +152,9 @@ AABB Light::get_aabb() const { return AABB(); } -PoolVector<Face3> Light::get_faces(uint32_t p_usage_flags) const { +Vector<Face3> Light::get_faces(uint32_t p_usage_flags) const { - return PoolVector<Face3>(); + return Vector<Face3>(); } void Light::set_bake_mode(BakeMode p_mode) { diff --git a/scene/3d/light.h b/scene/3d/light.h index 7287518ae9..16e0c47083 100644 --- a/scene/3d/light.h +++ b/scene/3d/light.h @@ -124,7 +124,7 @@ public: BakeMode get_bake_mode() const; virtual AABB get_aabb() const; - virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const; Light(); ~Light(); diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp index 6d0216d99c..3188a8d5b1 100644 --- a/scene/3d/mesh_instance.cpp +++ b/scene/3d/mesh_instance.cpp @@ -204,13 +204,13 @@ AABB MeshInstance::get_aabb() const { return AABB(); } -PoolVector<Face3> MeshInstance::get_faces(uint32_t p_usage_flags) const { +Vector<Face3> MeshInstance::get_faces(uint32_t p_usage_flags) const { if (!(p_usage_flags & (FACES_SOLID | FACES_ENCLOSING))) - return PoolVector<Face3>(); + return Vector<Face3>(); if (mesh.is_null()) - return PoolVector<Face3>(); + return Vector<Face3>(); return mesh->get_faces(); } diff --git a/scene/3d/mesh_instance.h b/scene/3d/mesh_instance.h index fd5f60a5d7..d49d9ed98f 100644 --- a/scene/3d/mesh_instance.h +++ b/scene/3d/mesh_instance.h @@ -94,7 +94,7 @@ public: void create_debug_tangents(); virtual AABB get_aabb() const; - virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const; MeshInstance(); ~MeshInstance(); diff --git a/scene/3d/multimesh_instance.cpp b/scene/3d/multimesh_instance.cpp index 245dbdaf58..075eb0a1ec 100644 --- a/scene/3d/multimesh_instance.cpp +++ b/scene/3d/multimesh_instance.cpp @@ -51,9 +51,9 @@ Ref<MultiMesh> MultiMeshInstance::get_multimesh() const { return multimesh; } -PoolVector<Face3> MultiMeshInstance::get_faces(uint32_t p_usage_flags) const { +Vector<Face3> MultiMeshInstance::get_faces(uint32_t p_usage_flags) const { - return PoolVector<Face3>(); + return Vector<Face3>(); } AABB MultiMeshInstance::get_aabb() const { diff --git a/scene/3d/multimesh_instance.h b/scene/3d/multimesh_instance.h index 855bd54910..2b59c3b96c 100644 --- a/scene/3d/multimesh_instance.h +++ b/scene/3d/multimesh_instance.h @@ -44,7 +44,7 @@ protected: // bind helpers public: - virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const; void set_multimesh(const Ref<MultiMesh> &p_multimesh); Ref<MultiMesh> get_multimesh() const; diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 9fe626474e..787638053c 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -39,9 +39,9 @@ AABB Particles::get_aabb() const { return AABB(); } -PoolVector<Face3> Particles::get_faces(uint32_t p_usage_flags) const { +Vector<Face3> Particles::get_faces(uint32_t p_usage_flags) const { - return PoolVector<Face3>(); + return Vector<Face3>(); } void Particles::set_emitting(bool p_emitting) { diff --git a/scene/3d/particles.h b/scene/3d/particles.h index 69be7da29a..95c6de15ec 100644 --- a/scene/3d/particles.h +++ b/scene/3d/particles.h @@ -78,7 +78,7 @@ protected: public: AABB get_aabb() const; - PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; + Vector<Face3> get_faces(uint32_t p_usage_flags) const; void set_emitting(bool p_emitting); void set_amount(int p_amount); diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp index 2a5a84741f..0c44f21e76 100644 --- a/scene/3d/reflection_probe.cpp +++ b/scene/3d/reflection_probe.cpp @@ -186,9 +186,9 @@ AABB ReflectionProbe::get_aabb() const { aabb.size = origin_offset + extents; return aabb; } -PoolVector<Face3> ReflectionProbe::get_faces(uint32_t p_usage_flags) const { +Vector<Face3> ReflectionProbe::get_faces(uint32_t p_usage_flags) const { - return PoolVector<Face3>(); + return Vector<Face3>(); } void ReflectionProbe::_validate_property(PropertyInfo &property) const { diff --git a/scene/3d/reflection_probe.h b/scene/3d/reflection_probe.h index 28ca680e9f..57c1b0a320 100644 --- a/scene/3d/reflection_probe.h +++ b/scene/3d/reflection_probe.h @@ -103,7 +103,7 @@ public: UpdateMode get_update_mode() const; virtual AABB get_aabb() const; - virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const; ReflectionProbe(); ~ReflectionProbe(); diff --git a/scene/3d/soft_body.cpp b/scene/3d/soft_body.cpp index 931e786455..1c20677f64 100644 --- a/scene/3d/soft_body.cpp +++ b/scene/3d/soft_body.cpp @@ -73,11 +73,11 @@ void SoftBodyVisualServerHandler::clear() { } void SoftBodyVisualServerHandler::open() { - write_buffer = buffer.write(); + write_buffer = buffer.ptrw(); } void SoftBodyVisualServerHandler::close() { - write_buffer.release(); + //write_buffer.release(); } void SoftBodyVisualServerHandler::commit_changes() { @@ -149,7 +149,7 @@ bool SoftBody::_get(const StringName &p_name, Variant &r_ret) const { if ("pinned_points" == which) { Array arr_ret; const int pinned_points_indices_size = pinned_points.size(); - PoolVector<PinnedPoint>::Read r = pinned_points.read(); + const PinnedPoint *r = pinned_points.ptr(); arr_ret.resize(pinned_points_indices_size); for (int i = 0; i < pinned_points_indices_size; ++i) { @@ -174,7 +174,7 @@ void SoftBody::_get_property_list(List<PropertyInfo> *p_list) const { const int pinned_points_indices_size = pinned_points.size(); - p_list->push_back(PropertyInfo(Variant::POOL_INT_ARRAY, "pinned_points")); + p_list->push_back(PropertyInfo(Variant::PACKED_INT_ARRAY, "pinned_points")); for (int i = 0; i < pinned_points_indices_size; ++i) { p_list->push_back(PropertyInfo(Variant::INT, "attachments/" + itos(i) + "/point_index")); @@ -188,7 +188,7 @@ bool SoftBody::_set_property_pinned_points_indices(const Array &p_indices) { const int p_indices_size = p_indices.size(); { // Remove the pined points on physics server that will be removed by resize - PoolVector<PinnedPoint>::Read r = pinned_points.read(); + const PinnedPoint *r = pinned_points.ptr(); if (p_indices_size < pinned_points.size()) { for (int i = pinned_points.size() - 1; i >= p_indices_size; --i) { pin_point(r[i].point_index, false); @@ -198,7 +198,7 @@ bool SoftBody::_set_property_pinned_points_indices(const Array &p_indices) { pinned_points.resize(p_indices_size); - PoolVector<PinnedPoint>::Write w = pinned_points.write(); + PinnedPoint *w = pinned_points.ptrw(); int point_index; for (int i = 0; i < p_indices_size; ++i) { point_index = p_indices.get(i); @@ -218,11 +218,11 @@ bool SoftBody::_set_property_pinned_points_attachment(int p_item, const String & } if ("spatial_attachment_path" == p_what) { - PoolVector<PinnedPoint>::Write w = pinned_points.write(); + PinnedPoint *w = pinned_points.ptrw(); pin_point(w[p_item].point_index, true, p_value); _make_cache_dirty(); } else if ("offset" == p_what) { - PoolVector<PinnedPoint>::Write w = pinned_points.write(); + PinnedPoint *w = pinned_points.ptrw(); w[p_item].offset = p_value; } else { return false; @@ -235,7 +235,7 @@ bool SoftBody::_get_property_pinned_points(int p_item, const String &p_what, Var if (pinned_points.size() <= p_item) { return false; } - PoolVector<PinnedPoint>::Read r = pinned_points.read(); + const PinnedPoint *r = pinned_points.ptr(); if ("point_index" == p_what) { r_ret = r[p_item].point_index; @@ -417,7 +417,7 @@ void SoftBody::_update_physics_server() { _update_cache_pin_points_datas(); // Submit bone attachment const int pinned_points_indices_size = pinned_points.size(); - PoolVector<PinnedPoint>::Read r = pinned_points.read(); + const PinnedPoint *r = pinned_points.ptr(); for (int i = 0; i < pinned_points_indices_size; ++i) { if (r[i].spatial_attachment) { PhysicsServer::get_singleton()->soft_body_move_point(physics_rid, r[i].point_index, r[i].spatial_attachment->get_global_transform().xform(r[i].offset)); @@ -559,15 +559,15 @@ const NodePath &SoftBody::get_parent_collision_ignore() const { return parent_collision_ignore; } -void SoftBody::set_pinned_points_indices(PoolVector<SoftBody::PinnedPoint> p_pinned_points_indices) { +void SoftBody::set_pinned_points_indices(Vector<SoftBody::PinnedPoint> p_pinned_points_indices) { pinned_points = p_pinned_points_indices; - PoolVector<PinnedPoint>::Read w = pinned_points.read(); + const PinnedPoint *w = pinned_points.ptr(); for (int i = pinned_points.size() - 1; 0 <= i; --i) { pin_point(p_pinned_points_indices[i].point_index, true); } } -PoolVector<SoftBody::PinnedPoint> SoftBody::get_pinned_points_indices() { +Vector<SoftBody::PinnedPoint> SoftBody::get_pinned_points_indices() { return pinned_points; } @@ -721,7 +721,7 @@ SoftBody::~SoftBody() { void SoftBody::reset_softbody_pin() { PhysicsServer::get_singleton()->soft_body_remove_all_pinned_points(physics_rid); - PoolVector<PinnedPoint>::Read pps = pinned_points.read(); + const PinnedPoint *pps = pinned_points.ptr(); for (int i = pinned_points.size() - 1; 0 < i; --i) { PhysicsServer::get_singleton()->soft_body_pin_point(physics_rid, pps[i].point_index, true); } @@ -737,7 +737,7 @@ void SoftBody::_update_cache_pin_points_datas() { pinned_points_cache_dirty = false; - PoolVector<PinnedPoint>::Write w = pinned_points.write(); + PinnedPoint *w = pinned_points.ptrw(); for (int i = pinned_points.size() - 1; 0 <= i; --i) { if (!w[i].spatial_attachment_path.is_empty()) { @@ -786,8 +786,8 @@ void SoftBody::_reset_points_offsets() { if (!Engine::get_singleton()->is_editor_hint()) return; - PoolVector<PinnedPoint>::Read r = pinned_points.read(); - PoolVector<PinnedPoint>::Write w = pinned_points.write(); + const PinnedPoint *r = pinned_points.ptr(); + PinnedPoint *w = pinned_points.ptrw(); for (int i = pinned_points.size() - 1; 0 <= i; --i) { if (!r[i].spatial_attachment) @@ -813,13 +813,13 @@ int SoftBody::_get_pinned_point(int p_point_index, SoftBody::PinnedPoint *&r_poi r_point = NULL; return -1; } else { - r_point = const_cast<SoftBody::PinnedPoint *>(&pinned_points.read()[id]); + r_point = const_cast<SoftBody::PinnedPoint *>(&pinned_points.ptr()[id]); return id; } } int SoftBody::_has_pinned_point(int p_point_index) const { - PoolVector<PinnedPoint>::Read r = pinned_points.read(); + const PinnedPoint *r = pinned_points.ptr(); for (int i = pinned_points.size() - 1; 0 <= i; --i) { if (p_point_index == r[i].point_index) { return i; diff --git a/scene/3d/soft_body.h b/scene/3d/soft_body.h index 800db12594..d6c35a5989 100644 --- a/scene/3d/soft_body.h +++ b/scene/3d/soft_body.h @@ -41,12 +41,12 @@ class SoftBodyVisualServerHandler { RID mesh; int surface; - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; uint32_t stride; uint32_t offset_vertices; uint32_t offset_normal; - PoolVector<uint8_t>::Write write_buffer; + uint8_t *write_buffer; private: SoftBodyVisualServerHandler(); @@ -87,7 +87,7 @@ private: uint32_t collision_mask; uint32_t collision_layer; NodePath parent_collision_ignore; - PoolVector<PinnedPoint> pinned_points; + Vector<PinnedPoint> pinned_points; bool simulation_started; bool pinned_points_cache_dirty; @@ -138,8 +138,8 @@ public: void set_parent_collision_ignore(const NodePath &p_parent_collision_ignore); const NodePath &get_parent_collision_ignore() const; - void set_pinned_points_indices(PoolVector<PinnedPoint> p_pinned_points_indices); - PoolVector<PinnedPoint> get_pinned_points_indices(); + void set_pinned_points_indices(Vector<PinnedPoint> p_pinned_points_indices); + Vector<PinnedPoint> get_pinned_points_indices(); void set_simulation_precision(int p_simulation_precision); int get_simulation_precision(); diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 04f00a527e..7351b87078 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -197,18 +197,18 @@ AABB SpriteBase3D::get_aabb() const { return aabb; } -PoolVector<Face3> SpriteBase3D::get_faces(uint32_t p_usage_flags) const { +Vector<Face3> SpriteBase3D::get_faces(uint32_t p_usage_flags) const { - return PoolVector<Face3>(); + return Vector<Face3>(); } Ref<TriangleMesh> SpriteBase3D::generate_triangle_mesh() const { if (triangle_mesh.is_valid()) return triangle_mesh; - PoolVector<Vector3> faces; + Vector<Vector3> faces; faces.resize(6); - PoolVector<Vector3>::Write facesw = faces.write(); + Vector3 *facesw = faces.ptrw(); Rect2 final_rect = get_item_rect(); @@ -254,8 +254,6 @@ Ref<TriangleMesh> SpriteBase3D::generate_triangle_mesh() const { facesw[j] = vtx; } - facesw.release(); - triangle_mesh = Ref<TriangleMesh>(memnew(TriangleMesh)); triangle_mesh->create(faces); diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h index 9c31a667b5..3b3f0265ce 100644 --- a/scene/3d/sprite_3d.h +++ b/scene/3d/sprite_3d.h @@ -137,7 +137,7 @@ public: virtual Rect2 get_item_rect() const = 0; virtual AABB get_aabb() const; - virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const; Ref<TriangleMesh> generate_triangle_mesh() const; SpriteBase3D(); diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h index c1d6c2b015..fee6787c87 100644 --- a/scene/3d/visual_instance.h +++ b/scene/3d/visual_instance.h @@ -63,7 +63,7 @@ public: RID get_instance() const; virtual AABB get_aabb() const = 0; - virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const = 0; + virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const = 0; virtual AABB get_transformed_aabb() const; // helper diff --git a/scene/3d/voxelizer.cpp b/scene/3d/voxelizer.cpp index 7cf26ab974..0257e6e83d 100644 --- a/scene/3d/voxelizer.cpp +++ b/scene/3d/voxelizer.cpp @@ -497,7 +497,7 @@ Vector<Color> Voxelizer::_get_bake_texture(Ref<Image> p_image, const Color &p_co p_image->convert(Image::FORMAT_RGBA8); p_image->resize(bake_texture_size, bake_texture_size, Image::INTERPOLATE_CUBIC); - PoolVector<uint8_t>::Read r = p_image->get_data().read(); + const uint8_t *r = p_image->get_data().ptr(); ret.resize(bake_texture_size * bake_texture_size); for (int i = 0; i < bake_texture_size * bake_texture_size; i++) { @@ -589,32 +589,32 @@ void Voxelizer::plot_mesh(const Transform &p_xform, Ref<Mesh> &p_mesh, const Vec Array a = p_mesh->surface_get_arrays(i); - PoolVector<Vector3> vertices = a[Mesh::ARRAY_VERTEX]; - PoolVector<Vector3>::Read vr = vertices.read(); - PoolVector<Vector2> uv = a[Mesh::ARRAY_TEX_UV]; - PoolVector<Vector2>::Read uvr; - PoolVector<Vector3> normals = a[Mesh::ARRAY_NORMAL]; - PoolVector<Vector3>::Read nr; - PoolVector<int> index = a[Mesh::ARRAY_INDEX]; + Vector<Vector3> vertices = a[Mesh::ARRAY_VERTEX]; + const Vector3 *vr = vertices.ptr(); + Vector<Vector2> uv = a[Mesh::ARRAY_TEX_UV]; + const Vector2 *uvr; + Vector<Vector3> normals = a[Mesh::ARRAY_NORMAL]; + const Vector3 *nr; + Vector<int> index = a[Mesh::ARRAY_INDEX]; bool read_uv = false; bool read_normals = false; if (uv.size()) { - uvr = uv.read(); + uvr = uv.ptr(); read_uv = true; } if (normals.size()) { read_normals = true; - nr = normals.read(); + nr = normals.ptr(); } if (index.size()) { int facecount = index.size() / 3; - PoolVector<int>::Read ir = index.read(); + const int *ir = index.ptr(); for (int j = 0; j < facecount; j++) { @@ -886,12 +886,12 @@ int Voxelizer::get_giprobe_cell_count() const { return bake_cells.size(); } -PoolVector<uint8_t> Voxelizer::get_giprobe_octree_cells() const { - PoolVector<uint8_t> data; +Vector<uint8_t> Voxelizer::get_giprobe_octree_cells() const { + Vector<uint8_t> data; data.resize((8 * 4) * bake_cells.size()); //8 uint32t values { - PoolVector<uint8_t>::Write w = data.write(); - uint32_t *children_cells = (uint32_t *)w.ptr(); + uint8_t *w = data.ptrw(); + uint32_t *children_cells = (uint32_t *)w; const Cell *cells = bake_cells.ptr(); uint32_t cell_count = bake_cells.size(); @@ -906,12 +906,12 @@ PoolVector<uint8_t> Voxelizer::get_giprobe_octree_cells() const { return data; } -PoolVector<uint8_t> Voxelizer::get_giprobe_data_cells() const { - PoolVector<uint8_t> data; +Vector<uint8_t> Voxelizer::get_giprobe_data_cells() const { + Vector<uint8_t> data; data.resize((4 * 4) * bake_cells.size()); //8 uint32t values { - PoolVector<uint8_t>::Write w = data.write(); - uint32_t *dataptr = (uint32_t *)w.ptr(); + uint8_t *w = data.ptrw(); + uint32_t *dataptr = (uint32_t *)w; const Cell *cells = bake_cells.ptr(); uint32_t cell_count = bake_cells.size(); @@ -962,13 +962,13 @@ PoolVector<uint8_t> Voxelizer::get_giprobe_data_cells() const { return data; } -PoolVector<int> Voxelizer::get_giprobe_level_cell_count() const { +Vector<int> Voxelizer::get_giprobe_level_cell_count() const { uint32_t cell_count = bake_cells.size(); const Cell *cells = bake_cells.ptr(); - PoolVector<int> level_count; + Vector<int> level_count; level_count.resize(cell_subdiv + 1); //remember, always x+1 levels for x subdivisions { - PoolVector<int>::Write w = level_count.write(); + int *w = level_count.ptrw(); for (int i = 0; i < cell_subdiv + 1; i++) { w[i] = 0; } @@ -1025,7 +1025,7 @@ static void edt(float *f, int stride, int n) { #undef square -PoolVector<uint8_t> Voxelizer::get_sdf_3d_image() const { +Vector<uint8_t> Voxelizer::get_sdf_3d_image() const { Vector3i octree_size = get_giprobe_octree_size(); @@ -1078,10 +1078,10 @@ PoolVector<uint8_t> Voxelizer::get_sdf_3d_image() const { } } - PoolVector<uint8_t> image3d; + Vector<uint8_t> image3d; image3d.resize(float_count); { - PoolVector<uint8_t>::Write w = image3d.write(); + uint8_t *w = image3d.ptrw(); for (uint32_t i = 0; i < float_count; i++) { uint32_t d = uint32_t(Math::sqrt(work_memory[i])); if (d == 0) { @@ -1154,8 +1154,8 @@ Ref<MultiMesh> Voxelizer::create_debug_multimesh() { Array arr; arr.resize(Mesh::ARRAY_MAX); - PoolVector<Vector3> vertices; - PoolVector<Color> colors; + Vector<Vector3> vertices; + Vector<Color> colors; #define ADD_VTX(m_idx) \ vertices.push_back(face_points[m_idx]); \ colors.push_back(Color(1, 1, 1, 1)); diff --git a/scene/3d/voxelizer.h b/scene/3d/voxelizer.h index 5016ff029f..0ea613e2fd 100644 --- a/scene/3d/voxelizer.h +++ b/scene/3d/voxelizer.h @@ -132,10 +132,10 @@ public: int get_gi_probe_octree_depth() const; Vector3i get_giprobe_octree_size() const; int get_giprobe_cell_count() const; - PoolVector<uint8_t> get_giprobe_octree_cells() const; - PoolVector<uint8_t> get_giprobe_data_cells() const; - PoolVector<int> get_giprobe_level_cell_count() const; - PoolVector<uint8_t> get_sdf_3d_image() const; + Vector<uint8_t> get_giprobe_octree_cells() const; + Vector<uint8_t> get_giprobe_data_cells() const; + Vector<int> get_giprobe_level_cell_count() const; + Vector<uint8_t> get_sdf_3d_image() const; Ref<MultiMesh> create_debug_multimesh(); diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp index d749959377..0eb8203419 100644 --- a/scene/animation/animation_blend_space_2d.cpp +++ b/scene/animation/animation_blend_space_2d.cpp @@ -650,7 +650,7 @@ void AnimationNodeBlendSpace2D::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::VECTOR2, "blend_point_" + itos(i) + "/pos", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_blend_point_position", "get_blend_point_position", i); } - ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY, "triangles", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_triangles", "_get_triangles"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT_ARRAY, "triangles", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_triangles", "_get_triangles"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "min_space", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_min_space", "get_min_space"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "max_space", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_max_space", "get_max_space"); diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index ceee0529c2..4276c145ec 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -1129,8 +1129,8 @@ void AnimationPlayer::queue(const StringName &p_name) { queued.push_back(p_name); } -PoolVector<String> AnimationPlayer::get_queue() { - PoolVector<String> ret; +Vector<String> AnimationPlayer::get_queue() { + Vector<String> ret; for (List<StringName>::Element *E = queued.front(); E; E = E->next()) { ret.push_back(E->get()); } diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index 48829b02b9..24f60363ed 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -264,11 +264,11 @@ private: void _stop_playing_caches(); // bind helpers - PoolVector<String> _get_animation_list() const { + Vector<String> _get_animation_list() const { List<StringName> animations; get_animation_list(&animations); - PoolVector<String> ret; + Vector<String> ret; while (animations.size()) { ret.push_back(animations.front()->get()); @@ -316,7 +316,7 @@ public: void play(const StringName &p_name = StringName(), float p_custom_blend = -1, float p_custom_scale = 1.0, bool p_from_end = false); void play_backwards(const StringName &p_name = StringName(), float p_custom_blend = -1); void queue(const StringName &p_name); - PoolVector<String> get_queue(); + Vector<String> get_queue(); void clear_queue(); void stop(bool p_reset = true); bool is_playing() const; diff --git a/scene/animation/root_motion_view.cpp b/scene/animation/root_motion_view.cpp index fe062e0a20..1a26131fcb 100644 --- a/scene/animation/root_motion_view.cpp +++ b/scene/animation/root_motion_view.cpp @@ -164,8 +164,8 @@ AABB RootMotionView::get_aabb() const { return AABB(Vector3(-radius, 0, -radius), Vector3(radius * 2, 0.001, radius * 2)); } -PoolVector<Face3> RootMotionView::get_faces(uint32_t p_usage_flags) const { - return PoolVector<Face3>(); +Vector<Face3> RootMotionView::get_faces(uint32_t p_usage_flags) const { + return Vector<Face3>(); } void RootMotionView::_bind_methods() { diff --git a/scene/animation/root_motion_view.h b/scene/animation/root_motion_view.h index 0a255cb5d2..42950dde42 100644 --- a/scene/animation/root_motion_view.h +++ b/scene/animation/root_motion_view.h @@ -69,7 +69,7 @@ public: bool get_zero_y() const; virtual AABB get_aabb() const; - virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const; RootMotionView(); ~RootMotionView(); diff --git a/scene/debugger/script_debugger_remote.cpp b/scene/debugger/script_debugger_remote.cpp index 80972ba3d1..0e61a5746b 100644 --- a/scene/debugger/script_debugger_remote.cpp +++ b/scene/debugger/script_debugger_remote.cpp @@ -996,13 +996,13 @@ void ScriptDebuggerRemote::idle_poll() { if (visual_profiling) { Vector<VS::FrameProfileArea> profile_areas = VS::get_singleton()->get_frame_profile(); if (profile_areas.size()) { - PoolVector<String> area_names; - PoolVector<real_t> area_times; + Vector<String> area_names; + Vector<real_t> area_times; area_names.resize(profile_areas.size()); area_times.resize(profile_areas.size() * 2); { - PoolVector<String>::Write area_namesw = area_names.write(); - PoolVector<real_t>::Write area_timesw = area_times.write(); + String *area_namesw = area_names.ptrw(); + real_t *area_timesw = area_times.ptrw(); for (int i = 0; i < profile_areas.size(); i++) { area_namesw[i] = profile_areas[i].name; diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 2e903b6867..6ed16a2b75 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -59,7 +59,7 @@ void ColorPicker::_notification(int p_what) { #ifdef TOOLS_ENABLED if (Engine::get_singleton()->is_editor_hint()) { - PoolColorArray saved_presets = EditorSettings::get_singleton()->get_project_metadata("color_picker", "presets", PoolColorArray()); + PackedColorArray saved_presets = EditorSettings::get_singleton()->get_project_metadata("color_picker", "presets", PackedColorArray()); for (int i = 0; i < saved_presets.size(); i++) { add_preset(saved_presets[i]); @@ -295,7 +295,7 @@ void ColorPicker::add_preset(const Color &p_color) { #ifdef TOOLS_ENABLED if (Engine::get_singleton()->is_editor_hint()) { - PoolColorArray arr_to_save = get_presets(); + PackedColorArray arr_to_save = get_presets(); EditorSettings::get_singleton()->set_project_metadata("color_picker", "presets", arr_to_save); } #endif @@ -309,16 +309,16 @@ void ColorPicker::erase_preset(const Color &p_color) { #ifdef TOOLS_ENABLED if (Engine::get_singleton()->is_editor_hint()) { - PoolColorArray arr_to_save = get_presets(); + PackedColorArray arr_to_save = get_presets(); EditorSettings::get_singleton()->set_project_metadata("color_picker", "presets", arr_to_save); } #endif } } -PoolColorArray ColorPicker::get_presets() const { +PackedColorArray ColorPicker::get_presets() const { - PoolColorArray arr; + PackedColorArray arr; arr.resize(presets.size()); for (int i = 0; i < presets.size(); i++) { arr.set(i, presets[i]); @@ -593,10 +593,10 @@ void ColorPicker::_screen_input(const Ref<InputEvent> &p_event) { Ref<Image> img = r->get_texture()->get_data(); if (img.is_valid() && !img->empty()) { - img->lock(); + Vector2 ofs = mev->get_global_position() - r->get_visible_rect().get_position(); Color c = img->get_pixel(ofs.x, r->get_visible_rect().size.height - ofs.y); - img->unlock(); + set_pick_color(c); } } diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h index 49d36dfb3a..dde2f37135 100644 --- a/scene/gui/color_picker.h +++ b/scene/gui/color_picker.h @@ -116,7 +116,7 @@ public: void add_preset(const Color &p_color); void erase_preset(const Color &p_color); - PoolColorArray get_presets() const; + PackedColorArray get_presets() const; void set_hsv_mode(bool p_enabled); bool is_hsv_mode() const; diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 6e7491e7b4..931fb4f13e 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -193,7 +193,7 @@ void FileDialog::_action_pressed() { TreeItem *ti = tree->get_next_selected(NULL); String fbase = dir_access->get_current_dir(); - PoolVector<String> files; + Vector<String> files; while (ti) { files.push_back(fbase.plus_file(ti->get_text(0))); @@ -849,14 +849,14 @@ void FileDialog::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "mode_overrides_title"), "set_mode_overrides_title", "is_mode_overriding_title"); ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Open File,Open Files,Open Folder,Open Any,Save"), "set_mode", "get_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "access", PROPERTY_HINT_ENUM, "Resources,User data,File system"), "set_access", "get_access"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_STRING_ARRAY, "filters"), "set_filters", "get_filters"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_STRING_ARRAY, "filters"), "set_filters", "get_filters"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_hidden_files"), "set_show_hidden_files", "is_showing_hidden_files"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_dir"), "set_current_dir", "get_current_dir"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_file"), "set_current_file", "get_current_file"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "current_path"), "set_current_path", "get_current_path"); ADD_SIGNAL(MethodInfo("file_selected", PropertyInfo(Variant::STRING, "path"))); - ADD_SIGNAL(MethodInfo("files_selected", PropertyInfo(Variant::POOL_STRING_ARRAY, "paths"))); + ADD_SIGNAL(MethodInfo("files_selected", PropertyInfo(Variant::PACKED_STRING_ARRAY, "paths"))); ADD_SIGNAL(MethodInfo("dir_selected", PropertyInfo(Variant::STRING, "dir"))); BIND_ENUM_CONSTANT(MODE_OPEN_FILE); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index a5c316848e..ae169e3dcd 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -5446,11 +5446,11 @@ int TextEdit::_get_column_pos_of_word(const String &p_key, const String &p_searc return col; } -PoolVector<int> TextEdit::_search_bind(const String &p_key, uint32_t p_search_flags, int p_from_line, int p_from_column) const { +Vector<int> TextEdit::_search_bind(const String &p_key, uint32_t p_search_flags, int p_from_line, int p_from_column) const { int col, line; if (search(p_key, p_search_flags, p_from_line, p_from_column, line, col)) { - PoolVector<int> result; + Vector<int> result; result.resize(2); result.set(SEARCH_RESULT_COLUMN, col); result.set(SEARCH_RESULT_LINE, line); @@ -5458,7 +5458,7 @@ PoolVector<int> TextEdit::_search_bind(const String &p_key, uint32_t p_search_fl } else { - return PoolVector<int>(); + return Vector<int>(); } } diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index a849f62bc5..9986b80fd5 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -513,7 +513,7 @@ private: int _get_column_pos_of_word(const String &p_key, const String &p_search, uint32_t p_search_flags, int p_from_column); - PoolVector<int> _search_bind(const String &p_key, uint32_t p_search_flags, int p_from_line, int p_from_column) const; + Vector<int> _search_bind(const String &p_key, uint32_t p_search_flags, int p_from_line, int p_from_column) const; PopupMenu *menu; diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index 3c89069816..c4fb3335dc 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -118,7 +118,7 @@ Error HTTPRequest::request(const String &p_url, const Vector<String> &p_custom_h client->set_blocking_mode(false); err = _request(); if (err != OK) { - call_deferred("_request_done", RESULT_CANT_CONNECT, 0, PoolStringArray(), PoolByteArray()); + call_deferred("_request_done", RESULT_CANT_CONNECT, 0, PackedStringArray(), PackedByteArray()); return ERR_CANT_CONNECT; } @@ -135,7 +135,7 @@ void HTTPRequest::_thread_func(void *p_userdata) { Error err = hr->_request(); if (err != OK) { - hr->call_deferred("_request_done", RESULT_CANT_CONNECT, 0, PoolStringArray(), PoolByteArray()); + hr->call_deferred("_request_done", RESULT_CANT_CONNECT, 0, PackedStringArray(), PackedByteArray()); } else { while (!hr->thread_request_quit) { @@ -180,7 +180,7 @@ void HTTPRequest::cancel_request() { bool HTTPRequest::_handle_response(bool *ret_value) { if (!client->has_response()) { - call_deferred("_request_done", RESULT_NO_RESPONSE, 0, PoolStringArray(), PoolByteArray()); + call_deferred("_request_done", RESULT_NO_RESPONSE, 0, PackedStringArray(), PackedByteArray()); *ret_value = true; return true; } @@ -200,7 +200,7 @@ bool HTTPRequest::_handle_response(bool *ret_value) { if (max_redirects >= 0 && redirections >= max_redirects) { - call_deferred("_request_done", RESULT_REDIRECT_LIMIT_REACHED, response_code, response_headers, PoolByteArray()); + call_deferred("_request_done", RESULT_REDIRECT_LIMIT_REACHED, response_code, response_headers, PackedByteArray()); *ret_value = true; return true; } @@ -246,7 +246,7 @@ bool HTTPRequest::_update_connection() { switch (client->get_status()) { case HTTPClient::STATUS_DISCONNECTED: { - call_deferred("_request_done", RESULT_CANT_CONNECT, 0, PoolStringArray(), PoolByteArray()); + call_deferred("_request_done", RESULT_CANT_CONNECT, 0, PackedStringArray(), PackedByteArray()); return true; // End it, since it's doing something } break; case HTTPClient::STATUS_RESOLVING: { @@ -255,7 +255,7 @@ bool HTTPRequest::_update_connection() { return false; } break; case HTTPClient::STATUS_CANT_RESOLVE: { - call_deferred("_request_done", RESULT_CANT_RESOLVE, 0, PoolStringArray(), PoolByteArray()); + call_deferred("_request_done", RESULT_CANT_RESOLVE, 0, PackedStringArray(), PackedByteArray()); return true; } break; @@ -266,7 +266,7 @@ bool HTTPRequest::_update_connection() { } break; // Connecting to IP case HTTPClient::STATUS_CANT_CONNECT: { - call_deferred("_request_done", RESULT_CANT_CONNECT, 0, PoolStringArray(), PoolByteArray()); + call_deferred("_request_done", RESULT_CANT_CONNECT, 0, PackedStringArray(), PackedByteArray()); return true; } break; @@ -283,7 +283,7 @@ bool HTTPRequest::_update_connection() { if (_handle_response(&ret_value)) return ret_value; - call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, PoolByteArray()); + call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, PackedByteArray()); return true; } if (body_len < 0) { @@ -292,7 +292,7 @@ bool HTTPRequest::_update_connection() { return true; } - call_deferred("_request_done", RESULT_CHUNKED_BODY_SIZE_MISMATCH, response_code, response_headers, PoolByteArray()); + call_deferred("_request_done", RESULT_CHUNKED_BODY_SIZE_MISMATCH, response_code, response_headers, PackedByteArray()); return true; // Request migh have been done } else { @@ -300,7 +300,7 @@ bool HTTPRequest::_update_connection() { Error err = client->request(method, request_string, headers, request_data); if (err != OK) { - call_deferred("_request_done", RESULT_CONNECTION_ERROR, 0, PoolStringArray(), PoolByteArray()); + call_deferred("_request_done", RESULT_CONNECTION_ERROR, 0, PackedStringArray(), PackedByteArray()); return true; } @@ -325,7 +325,7 @@ bool HTTPRequest::_update_connection() { if (!client->is_response_chunked() && client->get_response_body_length() == 0) { - call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, PoolByteArray()); + call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, PackedByteArray()); return true; } @@ -334,7 +334,7 @@ bool HTTPRequest::_update_connection() { body_len = client->get_response_body_length(); if (body_size_limit >= 0 && body_len > body_size_limit) { - call_deferred("_request_done", RESULT_BODY_SIZE_LIMIT_EXCEEDED, response_code, response_headers, PoolByteArray()); + call_deferred("_request_done", RESULT_BODY_SIZE_LIMIT_EXCEEDED, response_code, response_headers, PackedByteArray()); return true; } @@ -342,7 +342,7 @@ bool HTTPRequest::_update_connection() { file = FileAccess::open(download_to_file, FileAccess::WRITE); if (!file) { - call_deferred("_request_done", RESULT_DOWNLOAD_FILE_CANT_OPEN, response_code, response_headers, PoolByteArray()); + call_deferred("_request_done", RESULT_DOWNLOAD_FILE_CANT_OPEN, response_code, response_headers, PackedByteArray()); return true; } } @@ -350,14 +350,14 @@ bool HTTPRequest::_update_connection() { client->poll(); - PoolByteArray chunk = client->read_response_body_chunk(); + PackedByteArray chunk = client->read_response_body_chunk(); downloaded += chunk.size(); if (file) { - PoolByteArray::Read r = chunk.read(); - file->store_buffer(r.ptr(), chunk.size()); + const uint8_t *r = chunk.ptr(); + file->store_buffer(r, chunk.size()); if (file->get_error() != OK) { - call_deferred("_request_done", RESULT_DOWNLOAD_FILE_WRITE_ERROR, response_code, response_headers, PoolByteArray()); + call_deferred("_request_done", RESULT_DOWNLOAD_FILE_WRITE_ERROR, response_code, response_headers, PackedByteArray()); return true; } } else { @@ -365,7 +365,7 @@ bool HTTPRequest::_update_connection() { } if (body_size_limit >= 0 && downloaded > body_size_limit) { - call_deferred("_request_done", RESULT_BODY_SIZE_LIMIT_EXCEEDED, response_code, response_headers, PoolByteArray()); + call_deferred("_request_done", RESULT_BODY_SIZE_LIMIT_EXCEEDED, response_code, response_headers, PackedByteArray()); return true; } @@ -384,11 +384,11 @@ bool HTTPRequest::_update_connection() { } break; // Request resulted in body: break which must be read case HTTPClient::STATUS_CONNECTION_ERROR: { - call_deferred("_request_done", RESULT_CONNECTION_ERROR, 0, PoolStringArray(), PoolByteArray()); + call_deferred("_request_done", RESULT_CONNECTION_ERROR, 0, PackedStringArray(), PackedByteArray()); return true; } break; case HTTPClient::STATUS_SSL_HANDSHAKE_ERROR: { - call_deferred("_request_done", RESULT_SSL_HANDSHAKE_ERROR, 0, PoolStringArray(), PoolByteArray()); + call_deferred("_request_done", RESULT_SSL_HANDSHAKE_ERROR, 0, PackedStringArray(), PackedByteArray()); return true; } break; } @@ -396,7 +396,7 @@ bool HTTPRequest::_update_connection() { ERR_FAIL_V(false); } -void HTTPRequest::_request_done(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data) { +void HTTPRequest::_request_done(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data) { cancel_request(); emit_signal("request_completed", p_status, p_code, headers, p_data); @@ -505,12 +505,12 @@ int HTTPRequest::get_timeout() { void HTTPRequest::_timeout() { cancel_request(); - call_deferred("_request_done", RESULT_TIMEOUT, 0, PoolStringArray(), PoolByteArray()); + call_deferred("_request_done", RESULT_TIMEOUT, 0, PackedStringArray(), PackedByteArray()); } void HTTPRequest::_bind_methods() { - ClassDB::bind_method(D_METHOD("request", "url", "custom_headers", "ssl_validate_domain", "method", "request_data"), &HTTPRequest::request, DEFVAL(PoolStringArray()), DEFVAL(true), DEFVAL(HTTPClient::METHOD_GET), DEFVAL(String())); + ClassDB::bind_method(D_METHOD("request", "url", "custom_headers", "ssl_validate_domain", "method", "request_data"), &HTTPRequest::request, DEFVAL(PackedStringArray()), DEFVAL(true), DEFVAL(HTTPClient::METHOD_GET), DEFVAL(String())); ClassDB::bind_method(D_METHOD("cancel_request"), &HTTPRequest::cancel_request); ClassDB::bind_method(D_METHOD("get_http_client_status"), &HTTPRequest::get_http_client_status); @@ -548,7 +548,7 @@ void HTTPRequest::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "max_redirects", PROPERTY_HINT_RANGE, "-1,64"), "set_max_redirects", "get_max_redirects"); ADD_PROPERTY(PropertyInfo(Variant::INT, "timeout", PROPERTY_HINT_RANGE, "0,86400"), "set_timeout", "get_timeout"); - ADD_SIGNAL(MethodInfo("request_completed", PropertyInfo(Variant::INT, "result"), PropertyInfo(Variant::INT, "response_code"), PropertyInfo(Variant::POOL_STRING_ARRAY, "headers"), PropertyInfo(Variant::POOL_BYTE_ARRAY, "body"))); + ADD_SIGNAL(MethodInfo("request_completed", PropertyInfo(Variant::INT, "result"), PropertyInfo(Variant::INT, "response_code"), PropertyInfo(Variant::PACKED_STRING_ARRAY, "headers"), PropertyInfo(Variant::PACKED_BYTE_ARRAY, "body"))); BIND_ENUM_CONSTANT(RESULT_SUCCESS); //BIND_ENUM_CONSTANT( RESULT_NO_BODY ); diff --git a/scene/main/http_request.h b/scene/main/http_request.h index 94b323ae8a..a3d95cd652 100644 --- a/scene/main/http_request.h +++ b/scene/main/http_request.h @@ -73,12 +73,12 @@ private: bool request_sent; Ref<HTTPClient> client; - PoolByteArray body; + PackedByteArray body; volatile bool use_threads; bool got_response; int response_code; - PoolVector<String> response_headers; + Vector<String> response_headers; String download_to_file; @@ -108,7 +108,7 @@ private: Thread *thread; - void _request_done(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data); + void _request_done(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data); static void _thread_func(void *p_userdata); protected: diff --git a/scene/main/instance_placeholder.cpp b/scene/main/instance_placeholder.cpp index f1b3f91920..fe238af1c4 100644 --- a/scene/main/instance_placeholder.cpp +++ b/scene/main/instance_placeholder.cpp @@ -115,7 +115,7 @@ Node *InstancePlaceholder::create_instance(bool p_replace, const Ref<PackedScene Dictionary InstancePlaceholder::get_stored_values(bool p_with_order) { Dictionary ret; - PoolStringArray order; + PackedStringArray order; for (List<PropSet>::Element *E = stored_values.front(); E; E = E->next()) { ret[E->get().name] = E->get().value; diff --git a/scene/main/resource_preloader.cpp b/scene/main/resource_preloader.cpp index 5582ed59b0..43a61834eb 100644 --- a/scene/main/resource_preloader.cpp +++ b/scene/main/resource_preloader.cpp @@ -35,7 +35,7 @@ void ResourcePreloader::_set_resources(const Array &p_data) { resources.clear(); ERR_FAIL_COND(p_data.size() != 2); - PoolVector<String> names = p_data[0]; + Vector<String> names = p_data[0]; Array resdata = p_data[1]; ERR_FAIL_COND(names.size() != resdata.size()); @@ -53,7 +53,7 @@ void ResourcePreloader::_set_resources(const Array &p_data) { Array ResourcePreloader::_get_resources() const { - PoolVector<String> names; + Vector<String> names; Array arr; arr.resize(resources.size()); names.resize(resources.size()); @@ -129,9 +129,9 @@ RES ResourcePreloader::get_resource(const StringName &p_name) const { return resources[p_name]; } -PoolVector<String> ResourcePreloader::_get_resource_list() const { +Vector<String> ResourcePreloader::_get_resource_list() const { - PoolVector<String> res; + Vector<String> res; res.resize(resources.size()); int i = 0; for (Map<StringName, RES>::Element *E = resources.front(); E; E = E->next(), i++) { diff --git a/scene/main/resource_preloader.h b/scene/main/resource_preloader.h index d03c784883..9ad219dd92 100644 --- a/scene/main/resource_preloader.h +++ b/scene/main/resource_preloader.h @@ -41,7 +41,7 @@ class ResourcePreloader : public Node { void _set_resources(const Array &p_data); Array _get_resources() const; - PoolVector<String> _get_resource_list() const; + Vector<String> _get_resource_list() const; protected: static void _bind_methods(); diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index a27f8c4d94..818ae93d95 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -873,11 +873,11 @@ Ref<ArrayMesh> SceneTree::get_debug_contact_mesh() { }; /* clang-format on */ - PoolVector<int> indices; + Vector<int> indices; for (int i = 0; i < 8 * 3; i++) indices.push_back(diamond_faces[i]); - PoolVector<Vector3> vertices; + Vector<Vector3> vertices; for (int i = 0; i < 6; i++) vertices.push_back(diamond[i] * 0.1); @@ -1933,7 +1933,7 @@ void SceneTree::_bind_methods() { ADD_SIGNAL(MethodInfo("idle_frame")); ADD_SIGNAL(MethodInfo("physics_frame")); - ADD_SIGNAL(MethodInfo("files_dropped", PropertyInfo(Variant::POOL_STRING_ARRAY, "files"), PropertyInfo(Variant::INT, "screen"))); + ADD_SIGNAL(MethodInfo("files_dropped", PropertyInfo(Variant::PACKED_STRING_ARRAY, "files"), PropertyInfo(Variant::INT, "screen"))); ADD_SIGNAL(MethodInfo("global_menu_action", PropertyInfo(Variant::NIL, "id"), PropertyInfo(Variant::NIL, "meta"))); ADD_SIGNAL(MethodInfo("network_peer_connected", PropertyInfo(Variant::INT, "id"))); ADD_SIGNAL(MethodInfo("network_peer_disconnected", PropertyInfo(Variant::INT, "id"))); diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index 91d1e32053..6177356e9a 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -91,11 +91,11 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) { if (track_get_type(track) == TYPE_TRANSFORM) { TransformTrack *tt = static_cast<TransformTrack *>(tracks[track]); - PoolVector<float> values = p_value; + Vector<float> values = p_value; int vcount = values.size(); ERR_FAIL_COND_V(vcount % 12, false); // should be multiple of 11 - PoolVector<float>::Read r = values.read(); + const float *r = values.ptr(); tt->transforms.resize(vcount / 12); @@ -140,7 +140,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) { vt->update_mode = UpdateMode(um); } - PoolVector<float> times = d["times"]; + Vector<float> times = d["times"]; Array values = d["values"]; ERR_FAIL_COND_V(times.size() != values.size(), false); @@ -149,7 +149,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) { int valcount = times.size(); - PoolVector<float>::Read rt = times.read(); + const float *rt = times.ptr(); vt->values.resize(valcount); @@ -161,10 +161,10 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) { if (d.has("transitions")) { - PoolVector<float> transitions = d["transitions"]; + Vector<float> transitions = d["transitions"]; ERR_FAIL_COND_V(transitions.size() != valcount, false); - PoolVector<float>::Read rtr = transitions.read(); + const float *rtr = transitions.ptr(); for (int i = 0; i < valcount; i++) { @@ -184,7 +184,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) { ERR_FAIL_COND_V(!d.has("times"), false); ERR_FAIL_COND_V(!d.has("values"), false); - PoolVector<float> times = d["times"]; + Vector<float> times = d["times"]; Array values = d["values"]; ERR_FAIL_COND_V(times.size() != values.size(), false); @@ -193,7 +193,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) { int valcount = times.size(); - PoolVector<float>::Read rt = times.read(); + const float *rt = times.ptr(); for (int i = 0; i < valcount; i++) { @@ -202,10 +202,10 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) { if (d.has("transitions")) { - PoolVector<float> transitions = d["transitions"]; + Vector<float> transitions = d["transitions"]; ERR_FAIL_COND_V(transitions.size() != valcount, false); - PoolVector<float>::Read rtr = transitions.read(); + const float *rtr = transitions.ptr(); for (int i = 0; i < valcount; i++) { @@ -220,8 +220,8 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) { ERR_FAIL_COND_V(!d.has("times"), false); ERR_FAIL_COND_V(!d.has("points"), false); - PoolVector<float> times = d["times"]; - PoolRealArray values = d["points"]; + Vector<float> times = d["times"]; + PackedRealArray values = d["points"]; ERR_FAIL_COND_V(times.size() * 5 != values.size(), false); @@ -229,8 +229,8 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) { int valcount = times.size(); - PoolVector<float>::Read rt = times.read(); - PoolVector<float>::Read rv = values.read(); + const float *rt = times.ptr(); + const float *rv = values.ptr(); bt->values.resize(valcount); @@ -254,7 +254,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) { ERR_FAIL_COND_V(!d.has("times"), false); ERR_FAIL_COND_V(!d.has("clips"), false); - PoolVector<float> times = d["times"]; + Vector<float> times = d["times"]; Array clips = d["clips"]; ERR_FAIL_COND_V(clips.size() != times.size(), false); @@ -263,7 +263,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) { int valcount = times.size(); - PoolVector<float>::Read rt = times.read(); + const float *rt = times.ptr(); ad->values.clear(); @@ -295,8 +295,8 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) { ERR_FAIL_COND_V(!d.has("times"), false); ERR_FAIL_COND_V(!d.has("clips"), false); - PoolVector<float> times = d["times"]; - PoolVector<String> clips = d["clips"]; + Vector<float> times = d["times"]; + Vector<String> clips = d["clips"]; ERR_FAIL_COND_V(clips.size() != times.size(), false); @@ -304,8 +304,8 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) { int valcount = times.size(); - PoolVector<float>::Read rt = times.read(); - PoolVector<String>::Read rc = clips.read(); + const float *rt = times.ptr(); + const String *rc = clips.ptr(); an->values.resize(valcount); @@ -373,11 +373,11 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { if (track_get_type(track) == TYPE_TRANSFORM) { - PoolVector<real_t> keys; + Vector<real_t> keys; int kk = track_get_key_count(track); keys.resize(kk * 12); - PoolVector<real_t>::Write w = keys.write(); + real_t *w = keys.ptrw(); int idx = 0; for (int i = 0; i < track_get_key_count(track); i++) { @@ -403,7 +403,6 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { w[idx++] = scale.z; } - w.release(); r_ret = keys; return true; @@ -413,8 +412,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { Dictionary d; - PoolVector<float> key_times; - PoolVector<float> key_transitions; + Vector<float> key_times; + Vector<float> key_transitions; Array key_values; int kk = vt->values.size(); @@ -423,8 +422,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { key_transitions.resize(kk); key_values.resize(kk); - PoolVector<float>::Write wti = key_times.write(); - PoolVector<float>::Write wtr = key_transitions.write(); + float *wti = key_times.ptrw(); + float *wtr = key_transitions.ptrw(); int idx = 0; @@ -438,9 +437,6 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { idx++; } - wti.release(); - wtr.release(); - d["times"] = key_times; d["transitions"] = key_transitions; d["values"] = key_values; @@ -456,8 +452,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { Dictionary d; - PoolVector<float> key_times; - PoolVector<float> key_transitions; + Vector<float> key_times; + Vector<float> key_transitions; Array key_values; int kk = track_get_key_count(track); @@ -466,8 +462,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { key_transitions.resize(kk); key_values.resize(kk); - PoolVector<float>::Write wti = key_times.write(); - PoolVector<float>::Write wtr = key_transitions.write(); + float *wti = key_times.ptrw(); + float *wtr = key_transitions.ptrw(); int idx = 0; for (int i = 0; i < track_get_key_count(track); i++) { @@ -478,9 +474,6 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { idx++; } - wti.release(); - wtr.release(); - d["times"] = key_times; d["transitions"] = key_transitions; d["values"] = key_values; @@ -497,16 +490,16 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { Dictionary d; - PoolVector<float> key_times; - PoolVector<float> key_points; + Vector<float> key_times; + Vector<float> key_points; int kk = bt->values.size(); key_times.resize(kk); key_points.resize(kk * 5); - PoolVector<float>::Write wti = key_times.write(); - PoolVector<float>::Write wpo = key_points.write(); + float *wti = key_times.ptrw(); + float *wpo = key_points.ptrw(); int idx = 0; @@ -523,9 +516,6 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { idx++; } - wti.release(); - wpo.release(); - d["times"] = key_times; d["points"] = key_points; @@ -538,14 +528,14 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { Dictionary d; - PoolVector<float> key_times; + Vector<float> key_times; Array clips; int kk = ad->values.size(); key_times.resize(kk); - PoolVector<float>::Write wti = key_times.write(); + float *wti = key_times.ptrw(); int idx = 0; @@ -562,8 +552,6 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { idx++; } - wti.release(); - d["times"] = key_times; d["clips"] = clips; @@ -576,16 +564,16 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { Dictionary d; - PoolVector<float> key_times; - PoolVector<String> clips; + Vector<float> key_times; + Vector<String> clips; int kk = an->values.size(); key_times.resize(kk); clips.resize(kk); - PoolVector<float>::Write wti = key_times.write(); - PoolVector<String>::Write wcl = clips.write(); + float *wti = key_times.ptrw(); + String *wcl = clips.ptrw(); const TKey<StringName> *vls = an->values.ptr(); @@ -595,9 +583,6 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { wcl[i] = vls[i].value; } - wti.release(); - wcl.release(); - d["times"] = key_times; d["clips"] = clips; diff --git a/scene/resources/animation.h b/scene/resources/animation.h index 6ac0ea04d9..ea4f92878d 100644 --- a/scene/resources/animation.h +++ b/scene/resources/animation.h @@ -242,11 +242,11 @@ private: return ret; } - PoolVector<int> _value_track_get_key_indices(int p_track, float p_time, float p_delta) const { + Vector<int> _value_track_get_key_indices(int p_track, float p_time, float p_delta) const { List<int> idxs; value_track_get_key_indices(p_track, p_time, p_delta, &idxs); - PoolVector<int> idxr; + Vector<int> idxr; for (List<int>::Element *E = idxs.front(); E; E = E->next()) { @@ -254,11 +254,11 @@ private: } return idxr; } - PoolVector<int> _method_track_get_key_indices(int p_track, float p_time, float p_delta) const { + Vector<int> _method_track_get_key_indices(int p_track, float p_time, float p_delta) const { List<int> idxs; method_track_get_key_indices(p_track, p_time, p_delta, &idxs); - PoolVector<int> idxr; + Vector<int> idxr; for (List<int>::Element *E = idxs.front(); E; E = E->next()) { diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp index a412d8a5e2..ed25729c40 100644 --- a/scene/resources/audio_stream_sample.cpp +++ b/scene/resources/audio_stream_sample.cpp @@ -477,7 +477,7 @@ float AudioStreamSample::get_length() const { return float(len) / mix_rate; } -void AudioStreamSample::set_data(const PoolVector<uint8_t> &p_data) { +void AudioStreamSample::set_data(const Vector<uint8_t> &p_data) { AudioServer::get_singleton()->lock(); if (data) { @@ -489,28 +489,28 @@ void AudioStreamSample::set_data(const PoolVector<uint8_t> &p_data) { int datalen = p_data.size(); if (datalen) { - PoolVector<uint8_t>::Read r = p_data.read(); + const uint8_t *r = p_data.ptr(); int alloc_len = datalen + DATA_PAD * 2; data = AudioServer::get_singleton()->audio_data_alloc(alloc_len); //alloc with some padding for interpolation zeromem(data, alloc_len); uint8_t *dataptr = (uint8_t *)data; - copymem(dataptr + DATA_PAD, r.ptr(), datalen); + copymem(dataptr + DATA_PAD, r, datalen); data_bytes = datalen; } AudioServer::get_singleton()->unlock(); } -PoolVector<uint8_t> AudioStreamSample::get_data() const { +Vector<uint8_t> AudioStreamSample::get_data() const { - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; if (data) { pv.resize(data_bytes); { - PoolVector<uint8_t>::Write w = pv.write(); + uint8_t *w = pv.ptrw(); uint8_t *dataptr = (uint8_t *)data; - copymem(w.ptr(), dataptr + DATA_PAD, data_bytes); + copymem(w, dataptr + DATA_PAD, data_bytes); } } @@ -566,8 +566,8 @@ Error AudioStreamSample::save_to_wav(const String &p_path) { file->store_32(sub_chunk_2_size); //Subchunk2Size // Add data - PoolVector<uint8_t> data = get_data(); - PoolVector<uint8_t>::Read read_data = data.read(); + Vector<uint8_t> data = get_data(); + const uint8_t *read_data = data.ptr(); switch (format) { case AudioStreamSample::FORMAT_8_BITS: for (unsigned int i = 0; i < data_bytes; i++) { @@ -629,7 +629,7 @@ void AudioStreamSample::_bind_methods() { ClassDB::bind_method(D_METHOD("save_to_wav", "path"), &AudioStreamSample::save_to_wav); - ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_data", "get_data"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_data", "get_data"); ADD_PROPERTY(PropertyInfo(Variant::INT, "format", PROPERTY_HINT_ENUM, "8-Bit,16-Bit,IMA-ADPCM"), "set_format", "get_format"); ADD_PROPERTY(PropertyInfo(Variant::INT, "loop_mode", PROPERTY_HINT_ENUM, "Disabled,Forward,Ping-Pong,Backward"), "set_loop_mode", "get_loop_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "loop_begin"), "set_loop_begin", "get_loop_begin"); diff --git a/scene/resources/audio_stream_sample.h b/scene/resources/audio_stream_sample.h index adcac14ea8..0b46bc1c75 100644 --- a/scene/resources/audio_stream_sample.h +++ b/scene/resources/audio_stream_sample.h @@ -138,8 +138,8 @@ public: virtual float get_length() const; //if supported, otherwise return 0 - void set_data(const PoolVector<uint8_t> &p_data); - PoolVector<uint8_t> get_data() const; + void set_data(const Vector<uint8_t> &p_data); + Vector<uint8_t> get_data() const; Error save_to_wav(const String &p_path); diff --git a/scene/resources/bit_map.cpp b/scene/resources/bit_map.cpp index 06323a8d31..6730f86e0c 100644 --- a/scene/resources/bit_map.cpp +++ b/scene/resources/bit_map.cpp @@ -52,7 +52,7 @@ void BitMap::create_from_image_alpha(const Ref<Image> &p_image, float p_threshol create(Size2(img->get_width(), img->get_height())); - PoolVector<uint8_t>::Read r = img->get_data().read(); + const uint8_t *r = img->get_data().ptr(); uint8_t *w = bitmask.ptrw(); for (int i = 0; i < width * height; i++) { @@ -426,7 +426,7 @@ struct FillBitsStackEntry { static void fill_bits(const BitMap *p_src, Ref<BitMap> &p_map, const Point2i &p_pos, const Rect2i &rect) { // Using a custom stack to work iteratively to avoid stack overflow on big bitmaps - PoolVector<FillBitsStackEntry> stack; + Vector<FillBitsStackEntry> stack; // Tracking size since we won't be shrinking the stack vector int stack_size = 0; @@ -601,11 +601,11 @@ Array BitMap::_opaque_to_polygons_bind(const Rect2 &p_rect, float p_epsilon) con const Vector<Vector2> &polygon = result[i]; - PoolVector2Array polygon_array; + PackedVector2Array polygon_array; polygon_array.resize(polygon.size()); { - PoolVector2Array::Write w = polygon_array.write(); + Vector2 *w = polygon_array.ptrw(); for (int j = 0; j < polygon.size(); j++) { w[j] = polygon[j]; } @@ -640,15 +640,13 @@ Ref<Image> BitMap::convert_to_image() const { Ref<Image> image; image.instance(); image->create(width, height, false, Image::FORMAT_L8); - image->lock(); + for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { image->set_pixel(i, j, get_bit(Point2(i, j)) ? Color(1, 1, 1) : Color(0, 0, 0)); } } - image->unlock(); - return image; } void BitMap::blit(const Vector2 &p_pos, const Ref<BitMap> &p_bitmap) { diff --git a/scene/resources/concave_polygon_shape.cpp b/scene/resources/concave_polygon_shape.cpp index 0a93f99ea3..fe123a2df7 100644 --- a/scene/resources/concave_polygon_shape.cpp +++ b/scene/resources/concave_polygon_shape.cpp @@ -36,11 +36,11 @@ Vector<Vector3> ConcavePolygonShape::get_debug_mesh_lines() { Set<DrawEdge> edges; - PoolVector<Vector3> data = get_faces(); + Vector<Vector3> data = get_faces(); int datalen = data.size(); ERR_FAIL_COND_V((datalen % 3) != 0, Vector<Vector3>()); - PoolVector<Vector3>::Read r = data.read(); + const Vector3 *r = data.ptr(); for (int i = 0; i < datalen; i += 3) { @@ -65,8 +65,8 @@ Vector<Vector3> ConcavePolygonShape::get_debug_mesh_lines() { } real_t ConcavePolygonShape::get_enclosing_radius() const { - PoolVector<Vector3> data = get_faces(); - PoolVector<Vector3>::Read read = data.read(); + Vector<Vector3> data = get_faces(); + const Vector3 *read = data.ptr(); real_t r = 0; for (int i(0); i < data.size(); i++) { r = MAX(read[i].length_squared(), r); @@ -78,13 +78,13 @@ void ConcavePolygonShape::_update_shape() { Shape::_update_shape(); } -void ConcavePolygonShape::set_faces(const PoolVector<Vector3> &p_faces) { +void ConcavePolygonShape::set_faces(const Vector<Vector3> &p_faces) { PhysicsServer::get_singleton()->shape_set_data(get_shape(), p_faces); notify_change_to_owners(); } -PoolVector<Vector3> ConcavePolygonShape::get_faces() const { +Vector<Vector3> ConcavePolygonShape::get_faces() const { return PhysicsServer::get_singleton()->shape_get_data(get_shape()); } @@ -93,7 +93,7 @@ void ConcavePolygonShape::_bind_methods() { ClassDB::bind_method(D_METHOD("set_faces", "faces"), &ConcavePolygonShape::set_faces); ClassDB::bind_method(D_METHOD("get_faces"), &ConcavePolygonShape::get_faces); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_faces", "get_faces"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR3_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_faces", "get_faces"); } ConcavePolygonShape::ConcavePolygonShape() : diff --git a/scene/resources/concave_polygon_shape.h b/scene/resources/concave_polygon_shape.h index b4bebbd7b4..63aabb27d7 100644 --- a/scene/resources/concave_polygon_shape.h +++ b/scene/resources/concave_polygon_shape.h @@ -63,8 +63,8 @@ protected: virtual void _update_shape(); public: - void set_faces(const PoolVector<Vector3> &p_faces); - PoolVector<Vector3> get_faces() const; + void set_faces(const Vector<Vector3> &p_faces); + Vector<Vector3> get_faces() const; virtual Vector<Vector3> get_debug_mesh_lines(); virtual real_t get_enclosing_radius() const; diff --git a/scene/resources/concave_polygon_shape_2d.cpp b/scene/resources/concave_polygon_shape_2d.cpp index 840733add3..c3e9e19721 100644 --- a/scene/resources/concave_polygon_shape_2d.cpp +++ b/scene/resources/concave_polygon_shape_2d.cpp @@ -35,12 +35,12 @@ bool ConcavePolygonShape2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { - PoolVector<Vector2> s = get_segments(); + Vector<Vector2> s = get_segments(); int len = s.size(); if (len == 0 || (len % 2) == 1) return false; - PoolVector<Vector2>::Read r = s.read(); + const Vector2 *r = s.ptr(); for (int i = 0; i < len; i += 2) { Vector2 closest = Geometry::get_closest_point_to_segment_2d(p_point, &r[i]); if (p_point.distance_to(closest) < p_tolerance) @@ -50,25 +50,25 @@ bool ConcavePolygonShape2D::_edit_is_selected_on_click(const Point2 &p_point, do return false; } -void ConcavePolygonShape2D::set_segments(const PoolVector<Vector2> &p_segments) { +void ConcavePolygonShape2D::set_segments(const Vector<Vector2> &p_segments) { Physics2DServer::get_singleton()->shape_set_data(get_rid(), p_segments); emit_changed(); } -PoolVector<Vector2> ConcavePolygonShape2D::get_segments() const { +Vector<Vector2> ConcavePolygonShape2D::get_segments() const { return Physics2DServer::get_singleton()->shape_get_data(get_rid()); } void ConcavePolygonShape2D::draw(const RID &p_to_rid, const Color &p_color) { - PoolVector<Vector2> s = get_segments(); + Vector<Vector2> s = get_segments(); int len = s.size(); if (len == 0 || (len % 2) == 1) return; - PoolVector<Vector2>::Read r = s.read(); + const Vector2 *r = s.ptr(); for (int i = 0; i < len; i += 2) { VisualServer::get_singleton()->canvas_item_add_line(p_to_rid, r[i], r[i + 1], p_color, 2); } @@ -76,14 +76,14 @@ void ConcavePolygonShape2D::draw(const RID &p_to_rid, const Color &p_color) { Rect2 ConcavePolygonShape2D::get_rect() const { - PoolVector<Vector2> s = get_segments(); + Vector<Vector2> s = get_segments(); int len = s.size(); if (len == 0) return Rect2(); Rect2 rect; - PoolVector<Vector2>::Read r = s.read(); + const Vector2 *r = s.ptr(); for (int i = 0; i < len; i++) { if (i == 0) rect.position = r[i]; @@ -95,8 +95,8 @@ Rect2 ConcavePolygonShape2D::get_rect() const { } real_t ConcavePolygonShape2D::get_enclosing_radius() const { - PoolVector<Vector2> data = get_segments(); - PoolVector<Vector2>::Read read = data.read(); + Vector<Vector2> data = get_segments(); + const Vector2 *read = data.ptr(); real_t r = 0; for (int i(0); i < data.size(); i++) { r = MAX(read[i].length_squared(), r); @@ -109,11 +109,11 @@ void ConcavePolygonShape2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_segments", "segments"), &ConcavePolygonShape2D::set_segments); ClassDB::bind_method(D_METHOD("get_segments"), &ConcavePolygonShape2D::get_segments); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "segments"), "set_segments", "get_segments"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "segments"), "set_segments", "get_segments"); } ConcavePolygonShape2D::ConcavePolygonShape2D() : Shape2D(Physics2DServer::get_singleton()->concave_polygon_shape_create()) { - PoolVector<Vector2> empty; + Vector<Vector2> empty; set_segments(empty); } diff --git a/scene/resources/concave_polygon_shape_2d.h b/scene/resources/concave_polygon_shape_2d.h index 4e47ad34b8..f89995567e 100644 --- a/scene/resources/concave_polygon_shape_2d.h +++ b/scene/resources/concave_polygon_shape_2d.h @@ -42,8 +42,8 @@ protected: public: virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const; - void set_segments(const PoolVector<Vector2> &p_segments); - PoolVector<Vector2> get_segments() const; + void set_segments(const Vector<Vector2> &p_segments); + Vector<Vector2> get_segments() const; virtual void draw(const RID &p_to_rid, const Color &p_color); virtual Rect2 get_rect() const; diff --git a/scene/resources/convex_polygon_shape.cpp b/scene/resources/convex_polygon_shape.cpp index 21fdcc1f06..b7463605b4 100644 --- a/scene/resources/convex_polygon_shape.cpp +++ b/scene/resources/convex_polygon_shape.cpp @@ -34,7 +34,7 @@ Vector<Vector3> ConvexPolygonShape::get_debug_mesh_lines() { - PoolVector<Vector3> points = get_points(); + Vector<Vector3> points = get_points(); if (points.size() > 3) { @@ -56,8 +56,8 @@ Vector<Vector3> ConvexPolygonShape::get_debug_mesh_lines() { } real_t ConvexPolygonShape::get_enclosing_radius() const { - PoolVector<Vector3> data = get_points(); - PoolVector<Vector3>::Read read = data.read(); + Vector<Vector3> data = get_points(); + const Vector3 *read = data.ptr(); real_t r = 0; for (int i(0); i < data.size(); i++) { r = MAX(read[i].length_squared(), r); @@ -71,14 +71,14 @@ void ConvexPolygonShape::_update_shape() { Shape::_update_shape(); } -void ConvexPolygonShape::set_points(const PoolVector<Vector3> &p_points) { +void ConvexPolygonShape::set_points(const Vector<Vector3> &p_points) { points = p_points; _update_shape(); notify_change_to_owners(); } -PoolVector<Vector3> ConvexPolygonShape::get_points() const { +Vector<Vector3> ConvexPolygonShape::get_points() const { return points; } diff --git a/scene/resources/convex_polygon_shape.h b/scene/resources/convex_polygon_shape.h index e3bf02399a..fcd733887e 100644 --- a/scene/resources/convex_polygon_shape.h +++ b/scene/resources/convex_polygon_shape.h @@ -36,7 +36,7 @@ class ConvexPolygonShape : public Shape { GDCLASS(ConvexPolygonShape, Shape); - PoolVector<Vector3> points; + Vector<Vector3> points; protected: static void _bind_methods(); @@ -44,8 +44,8 @@ protected: virtual void _update_shape(); public: - void set_points(const PoolVector<Vector3> &p_points); - PoolVector<Vector3> get_points() const; + void set_points(const Vector<Vector3> &p_points); + Vector<Vector3> get_points() const; virtual Vector<Vector3> get_debug_mesh_lines(); virtual real_t get_enclosing_radius() const; diff --git a/scene/resources/convex_polygon_shape_2d.cpp b/scene/resources/convex_polygon_shape_2d.cpp index 296d014cc7..95967429c9 100644 --- a/scene/resources/convex_polygon_shape_2d.cpp +++ b/scene/resources/convex_polygon_shape_2d.cpp @@ -74,7 +74,7 @@ void ConvexPolygonShape2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_points", "points"), &ConvexPolygonShape2D::set_points); ClassDB::bind_method(D_METHOD("get_points"), &ConvexPolygonShape2D::get_points); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "points"), "set_points", "get_points"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "points"), "set_points", "get_points"); } void ConvexPolygonShape2D::draw(const RID &p_to_rid, const Color &p_color) { diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp index 397f6ca906..00c52e8a03 100644 --- a/scene/resources/curve.cpp +++ b/scene/resources/curve.cpp @@ -741,7 +741,7 @@ void Curve2D::_bake() const { pointlist.push_back(lastpos); baked_point_cache.resize(pointlist.size()); - PoolVector2Array::Write w = baked_point_cache.write(); + Vector2 *w = baked_point_cache.ptrw(); int idx = 0; for (List<Vector2>::Element *E = pointlist.front(); E; E = E->next()) { @@ -771,7 +771,7 @@ Vector2 Curve2D::interpolate_baked(float p_offset, bool p_cubic) const { return baked_point_cache.get(0); int bpc = baked_point_cache.size(); - PoolVector2Array::Read r = baked_point_cache.read(); + const Vector2 *r = baked_point_cache.ptr(); if (p_offset < 0) return r[0]; @@ -800,7 +800,7 @@ Vector2 Curve2D::interpolate_baked(float p_offset, bool p_cubic) const { } } -PoolVector2Array Curve2D::get_baked_points() const { +PackedVector2Array Curve2D::get_baked_points() const { if (baked_cache_dirty) _bake(); @@ -833,7 +833,7 @@ Vector2 Curve2D::get_closest_point(const Vector2 &p_to_point) const { if (pc == 1) return baked_point_cache.get(0); - PoolVector2Array::Read r = baked_point_cache.read(); + const Vector2 *r = baked_point_cache.ptr(); Vector2 nearest; float nearest_dist = -1.0f; @@ -869,7 +869,7 @@ float Curve2D::get_closest_offset(const Vector2 &p_to_point) const { if (pc == 1) return 0.0f; - PoolVector2Array::Read r = baked_point_cache.read(); + const Vector2 *r = baked_point_cache.ptr(); float nearest = 0.0f; float nearest_dist = -1.0f; @@ -899,9 +899,9 @@ Dictionary Curve2D::_get_data() const { Dictionary dc; - PoolVector2Array d; + PackedVector2Array d; d.resize(points.size() * 3); - PoolVector2Array::Write w = d.write(); + Vector2 *w = d.ptrw(); for (int i = 0; i < points.size(); i++) { @@ -910,8 +910,6 @@ Dictionary Curve2D::_get_data() const { w[i * 3 + 2] = points[i].pos; } - w = PoolVector2Array::Write(); - dc["points"] = d; return dc; @@ -920,11 +918,11 @@ void Curve2D::_set_data(const Dictionary &p_data) { ERR_FAIL_COND(!p_data.has("points")); - PoolVector2Array rp = p_data["points"]; + PackedVector2Array rp = p_data["points"]; int pc = rp.size(); ERR_FAIL_COND(pc % 3 != 0); points.resize(pc / 3); - PoolVector2Array::Read r = rp.read(); + const Vector2 *r = rp.ptr(); for (int i = 0; i < points.size(); i++) { @@ -936,9 +934,9 @@ void Curve2D::_set_data(const Dictionary &p_data) { baked_cache_dirty = true; } -PoolVector2Array Curve2D::tessellate(int p_max_stages, float p_tolerance) const { +PackedVector2Array Curve2D::tessellate(int p_max_stages, float p_tolerance) const { - PoolVector2Array tess; + PackedVector2Array tess; if (points.size() == 0) { return tess; @@ -956,7 +954,7 @@ PoolVector2Array Curve2D::tessellate(int p_max_stages, float p_tolerance) const } tess.resize(pc); - PoolVector2Array::Write bpw = tess.write(); + Vector2 *bpw = tess.ptrw(); bpw[0] = points[0].pos; int pidx = 0; @@ -972,8 +970,6 @@ PoolVector2Array Curve2D::tessellate(int p_max_stages, float p_tolerance) const bpw[pidx] = points[i + 1].pos; } - bpw = PoolVector2Array::Write(); - return tess; } @@ -1258,14 +1254,14 @@ void Curve3D::_bake() const { pointlist.push_back(Plane(lastpos, lastilt)); baked_point_cache.resize(pointlist.size()); - PoolVector3Array::Write w = baked_point_cache.write(); + Vector3 *w = baked_point_cache.ptrw(); int idx = 0; baked_tilt_cache.resize(pointlist.size()); - PoolRealArray::Write wt = baked_tilt_cache.write(); + real_t *wt = baked_tilt_cache.ptrw(); baked_up_vector_cache.resize(up_vector_enabled ? pointlist.size() : 0); - PoolVector3Array::Write up_write = baked_up_vector_cache.write(); + Vector3 *up_write = baked_up_vector_cache.ptrw(); Vector3 sideways; Vector3 up; @@ -1333,7 +1329,7 @@ Vector3 Curve3D::interpolate_baked(float p_offset, bool p_cubic) const { return baked_point_cache.get(0); int bpc = baked_point_cache.size(); - PoolVector3Array::Read r = baked_point_cache.read(); + const Vector3 *r = baked_point_cache.ptr(); if (p_offset < 0) return r[0]; @@ -1375,7 +1371,7 @@ float Curve3D::interpolate_baked_tilt(float p_offset) const { return baked_tilt_cache.get(0); int bpc = baked_tilt_cache.size(); - PoolRealArray::Read r = baked_tilt_cache.read(); + const real_t *r = baked_tilt_cache.ptr(); if (p_offset < 0) return r[0]; @@ -1410,9 +1406,9 @@ Vector3 Curve3D::interpolate_baked_up_vector(float p_offset, bool p_apply_tilt) if (count == 1) return baked_up_vector_cache.get(0); - PoolVector3Array::Read r = baked_up_vector_cache.read(); - PoolVector3Array::Read rp = baked_point_cache.read(); - PoolRealArray::Read rt = baked_tilt_cache.read(); + const Vector3 *r = baked_up_vector_cache.ptr(); + const Vector3 *rp = baked_point_cache.ptr(); + const real_t *rt = baked_tilt_cache.ptr(); float offset = CLAMP(p_offset, 0.0f, baked_max_ofs); @@ -1441,7 +1437,7 @@ Vector3 Curve3D::interpolate_baked_up_vector(float p_offset, bool p_apply_tilt) return up.rotated(axis, up.angle_to(up1) * frac); } -PoolVector3Array Curve3D::get_baked_points() const { +PackedVector3Array Curve3D::get_baked_points() const { if (baked_cache_dirty) _bake(); @@ -1449,7 +1445,7 @@ PoolVector3Array Curve3D::get_baked_points() const { return baked_point_cache; } -PoolRealArray Curve3D::get_baked_tilts() const { +PackedRealArray Curve3D::get_baked_tilts() const { if (baked_cache_dirty) _bake(); @@ -1457,7 +1453,7 @@ PoolRealArray Curve3D::get_baked_tilts() const { return baked_tilt_cache; } -PoolVector3Array Curve3D::get_baked_up_vectors() const { +PackedVector3Array Curve3D::get_baked_up_vectors() const { if (baked_cache_dirty) _bake(); @@ -1478,7 +1474,7 @@ Vector3 Curve3D::get_closest_point(const Vector3 &p_to_point) const { if (pc == 1) return baked_point_cache.get(0); - PoolVector3Array::Read r = baked_point_cache.read(); + const Vector3 *r = baked_point_cache.ptr(); Vector3 nearest; float nearest_dist = -1.0f; @@ -1514,7 +1510,7 @@ float Curve3D::get_closest_offset(const Vector3 &p_to_point) const { if (pc == 1) return 0.0f; - PoolVector3Array::Read r = baked_point_cache.read(); + const Vector3 *r = baked_point_cache.ptr(); float nearest = 0.0f; float nearest_dist = -1.0f; @@ -1568,12 +1564,12 @@ Dictionary Curve3D::_get_data() const { Dictionary dc; - PoolVector3Array d; + PackedVector3Array d; d.resize(points.size() * 3); - PoolVector3Array::Write w = d.write(); - PoolRealArray t; + Vector3 *w = d.ptrw(); + PackedRealArray t; t.resize(points.size()); - PoolRealArray::Write wt = t.write(); + real_t *wt = t.ptrw(); for (int i = 0; i < points.size(); i++) { @@ -1583,9 +1579,6 @@ Dictionary Curve3D::_get_data() const { wt[i] = points[i].tilt; } - w = PoolVector3Array::Write(); - wt = PoolRealArray::Write(); - dc["points"] = d; dc["tilts"] = t; @@ -1596,13 +1589,13 @@ void Curve3D::_set_data(const Dictionary &p_data) { ERR_FAIL_COND(!p_data.has("points")); ERR_FAIL_COND(!p_data.has("tilts")); - PoolVector3Array rp = p_data["points"]; + PackedVector3Array rp = p_data["points"]; int pc = rp.size(); ERR_FAIL_COND(pc % 3 != 0); points.resize(pc / 3); - PoolVector3Array::Read r = rp.read(); - PoolRealArray rtl = p_data["tilts"]; - PoolRealArray::Read rt = rtl.read(); + const Vector3 *r = rp.ptr(); + PackedRealArray rtl = p_data["tilts"]; + const real_t *rt = rtl.ptr(); for (int i = 0; i < points.size(); i++) { @@ -1615,9 +1608,9 @@ void Curve3D::_set_data(const Dictionary &p_data) { baked_cache_dirty = true; } -PoolVector3Array Curve3D::tessellate(int p_max_stages, float p_tolerance) const { +PackedVector3Array Curve3D::tessellate(int p_max_stages, float p_tolerance) const { - PoolVector3Array tess; + PackedVector3Array tess; if (points.size() == 0) { return tess; @@ -1635,7 +1628,7 @@ PoolVector3Array Curve3D::tessellate(int p_max_stages, float p_tolerance) const } tess.resize(pc); - PoolVector3Array::Write bpw = tess.write(); + Vector3 *bpw = tess.ptrw(); bpw[0] = points[0].pos; int pidx = 0; @@ -1651,8 +1644,6 @@ PoolVector3Array Curve3D::tessellate(int p_max_stages, float p_tolerance) const bpw[pidx] = points[i + 1].pos; } - bpw = PoolVector3Array::Write(); - return tess; } diff --git a/scene/resources/curve.h b/scene/resources/curve.h index b02466534c..91b744f302 100644 --- a/scene/resources/curve.h +++ b/scene/resources/curve.h @@ -168,7 +168,7 @@ class Curve2D : public Resource { }; mutable bool baked_cache_dirty; - mutable PoolVector2Array baked_point_cache; + mutable PackedVector2Array baked_point_cache; mutable float baked_max_ofs; void _bake() const; @@ -202,11 +202,11 @@ public: float get_baked_length() const; Vector2 interpolate_baked(float p_offset, bool p_cubic = false) const; - PoolVector2Array get_baked_points() const; //useful for going through + PackedVector2Array get_baked_points() const; //useful for going through Vector2 get_closest_point(const Vector2 &p_to_point) const; float get_closest_offset(const Vector2 &p_to_point) const; - PoolVector2Array tessellate(int p_max_stages = 5, float p_tolerance = 4) const; //useful for display + PackedVector2Array tessellate(int p_max_stages = 5, float p_tolerance = 4) const; //useful for display Curve2D(); }; @@ -234,9 +234,9 @@ class Curve3D : public Resource { }; mutable bool baked_cache_dirty; - mutable PoolVector3Array baked_point_cache; - mutable PoolRealArray baked_tilt_cache; - mutable PoolVector3Array baked_up_vector_cache; + mutable PackedVector3Array baked_point_cache; + mutable PackedRealArray baked_tilt_cache; + mutable PackedVector3Array baked_up_vector_cache; mutable float baked_max_ofs; void _bake() const; @@ -277,13 +277,13 @@ public: Vector3 interpolate_baked(float p_offset, bool p_cubic = false) const; float interpolate_baked_tilt(float p_offset) const; Vector3 interpolate_baked_up_vector(float p_offset, bool p_apply_tilt = false) const; - PoolVector3Array get_baked_points() const; //useful for going through - PoolRealArray get_baked_tilts() const; //useful for going through - PoolVector3Array get_baked_up_vectors() const; + PackedVector3Array get_baked_points() const; //useful for going through + PackedRealArray get_baked_tilts() const; //useful for going through + PackedVector3Array get_baked_up_vectors() const; Vector3 get_closest_point(const Vector3 &p_to_point) const; float get_closest_offset(const Vector3 &p_to_point) const; - PoolVector3Array tessellate(int p_max_stages = 5, float p_tolerance = 4) const; //useful for display + PackedVector3Array tessellate(int p_max_stages = 5, float p_tolerance = 4) const; //useful for display Curve3D(); }; diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index d2a90f388e..79a1500129 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -442,7 +442,7 @@ DynamicFontAtSize::TexturePosition DynamicFontAtSize::_find_texture_pos_for_glyp { //zero texture - PoolVector<uint8_t>::Write w = tex.imgdata.write(); + uint8_t *w = tex.imgdata.ptrw(); ERR_FAIL_COND_V(texsize * texsize * p_color_size > tex.imgdata.size(), ret); for (int i = 0; i < texsize * texsize * p_color_size; i++) { w[i] = 0; @@ -480,7 +480,7 @@ DynamicFontAtSize::Character DynamicFontAtSize::_bitmap_to_character(FT_Bitmap b CharTexture &tex = textures.write[tex_pos.index]; { - PoolVector<uint8_t>::Write wr = tex.imgdata.write(); + uint8_t *wr = tex.imgdata.ptrw(); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h index 94f03665d3..fa6db370f8 100644 --- a/scene/resources/dynamic_font.h +++ b/scene/resources/dynamic_font.h @@ -129,7 +129,7 @@ class DynamicFontAtSize : public Reference { struct CharTexture { - PoolVector<uint8_t> imgdata; + Vector<uint8_t> imgdata; int texture_size; Vector<int> offsets; Ref<ImageTexture> texture; diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 872d6a043c..e890ff13a6 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -107,7 +107,7 @@ Font::Font() { ///////////////////////////////////////////////////////////////// -void BitmapFont::_set_chars(const PoolVector<int> &p_chars) { +void BitmapFont::_set_chars(const Vector<int> &p_chars) { int len = p_chars.size(); //char 1 charsize 1 texture, 4 rect, 2 align, advance 1 @@ -116,7 +116,7 @@ void BitmapFont::_set_chars(const PoolVector<int> &p_chars) { return; //none to do int chars = len / 9; - PoolVector<int>::Read r = p_chars.read(); + const int *r = p_chars.ptr(); for (int i = 0; i < chars; i++) { const int *data = &r[i * 9]; @@ -124,16 +124,16 @@ void BitmapFont::_set_chars(const PoolVector<int> &p_chars) { } } -PoolVector<int> BitmapFont::_get_chars() const { +Vector<int> BitmapFont::_get_chars() const { - PoolVector<int> chars; + Vector<int> chars; const CharType *key = NULL; while ((key = char_map.next(key))) { const Character *c = char_map.getptr(*key); - ERR_FAIL_COND_V(!c, PoolVector<int>()); + ERR_FAIL_COND_V(!c, Vector<int>()); chars.push_back(*key); chars.push_back(c->texture_idx); chars.push_back(c->rect.position.x); @@ -149,13 +149,13 @@ PoolVector<int> BitmapFont::_get_chars() const { return chars; } -void BitmapFont::_set_kernings(const PoolVector<int> &p_kernings) { +void BitmapFont::_set_kernings(const Vector<int> &p_kernings) { int len = p_kernings.size(); ERR_FAIL_COND(len % 3); if (!len) return; - PoolVector<int>::Read r = p_kernings.read(); + const int *r = p_kernings.ptr(); for (int i = 0; i < len / 3; i++) { @@ -164,9 +164,9 @@ void BitmapFont::_set_kernings(const PoolVector<int> &p_kernings) { } } -PoolVector<int> BitmapFont::_get_kernings() const { +Vector<int> BitmapFont::_get_kernings() const { - PoolVector<int> kernings; + Vector<int> kernings; for (Map<KerningPairKey, int>::Element *E = kerning_map.front(); E; E = E->next()) { @@ -625,8 +625,8 @@ void BitmapFont::_bind_methods() { ClassDB::bind_method(D_METHOD("get_fallback"), &BitmapFont::get_fallback); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "textures", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_textures", "_get_textures"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY, "chars", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_chars", "_get_chars"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY, "kernings", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_kernings", "_get_kernings"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT_ARRAY, "chars", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_chars", "_get_chars"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT_ARRAY, "kernings", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_kernings", "_get_kernings"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_RANGE, "1,1024,1"), "set_height", "get_height"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "ascent", PROPERTY_HINT_RANGE, "0,1024,1"), "set_ascent", "get_ascent"); diff --git a/scene/resources/font.h b/scene/resources/font.h index fc1d92e2f9..1ce8e79f09 100644 --- a/scene/resources/font.h +++ b/scene/resources/font.h @@ -146,10 +146,10 @@ private: float ascent; bool distance_field_hint; - void _set_chars(const PoolVector<int> &p_chars); - PoolVector<int> _get_chars() const; - void _set_kernings(const PoolVector<int> &p_kernings); - PoolVector<int> _get_kernings() const; + void _set_chars(const Vector<int> &p_chars); + Vector<int> _get_chars() const; + void _set_kernings(const Vector<int> &p_kernings); + Vector<int> _get_kernings() const; void _set_textures(const Vector<Variant> &p_textures); Vector<Variant> _get_textures() const; diff --git a/scene/resources/gradient.cpp b/scene/resources/gradient.cpp index fe5a01886d..bfa3d05d2d 100644 --- a/scene/resources/gradient.cpp +++ b/scene/resources/gradient.cpp @@ -72,8 +72,8 @@ void Gradient::_bind_methods() { ClassDB::bind_method(D_METHOD(COLOR_RAMP_SET_COLORS, "colors"), &Gradient::set_colors); ClassDB::bind_method(D_METHOD(COLOR_RAMP_GET_COLORS), &Gradient::get_colors); - ADD_PROPERTY(PropertyInfo(Variant::POOL_REAL_ARRAY, "offsets"), COLOR_RAMP_SET_OFFSETS, COLOR_RAMP_GET_OFFSETS); - ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "colors"), COLOR_RAMP_SET_COLORS, COLOR_RAMP_GET_COLORS); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_REAL_ARRAY, "offsets"), COLOR_RAMP_SET_OFFSETS, COLOR_RAMP_GET_OFFSETS); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_COLOR_ARRAY, "colors"), COLOR_RAMP_SET_COLORS, COLOR_RAMP_GET_COLORS); } Vector<float> Gradient::get_offsets() const { diff --git a/scene/resources/height_map_shape.cpp b/scene/resources/height_map_shape.cpp index 48c9221e27..1d8483dfb4 100644 --- a/scene/resources/height_map_shape.cpp +++ b/scene/resources/height_map_shape.cpp @@ -42,7 +42,7 @@ Vector<Vector3> HeightMapShape::get_debug_mesh_lines() { Vector2 size(map_width - 1, map_depth - 1); Vector2 start = size * -0.5; - PoolRealArray::Read r = map_data.read(); + const real_t *r = map_data.ptr(); // reserve some memory for our points.. points.resize(((map_width - 1) * map_depth * 2) + (map_width * (map_depth - 1) * 2)); @@ -102,7 +102,7 @@ void HeightMapShape::set_map_width(int p_new) { int new_size = map_width * map_depth; map_data.resize(map_width * map_depth); - PoolRealArray::Write w = map_data.write(); + real_t *w = map_data.ptrw(); while (was_size < new_size) { w[was_size++] = 0.0; } @@ -128,7 +128,7 @@ void HeightMapShape::set_map_depth(int p_new) { int new_size = map_width * map_depth; map_data.resize(new_size); - PoolRealArray::Write w = map_data.write(); + real_t *w = map_data.ptrw(); while (was_size < new_size) { w[was_size++] = 0.0; } @@ -144,7 +144,7 @@ int HeightMapShape::get_map_depth() const { return map_depth; } -void HeightMapShape::set_map_data(PoolRealArray p_new) { +void HeightMapShape::set_map_data(PackedRealArray p_new) { int size = (map_width * map_depth); if (p_new.size() != size) { // fail @@ -152,8 +152,8 @@ void HeightMapShape::set_map_data(PoolRealArray p_new) { } // copy - PoolRealArray::Write w = map_data.write(); - PoolRealArray::Read r = p_new.read(); + real_t *w = map_data.ptrw(); + const real_t *r = p_new.ptr(); for (int i = 0; i < size; i++) { float val = r[i]; w[i] = val; @@ -174,7 +174,7 @@ void HeightMapShape::set_map_data(PoolRealArray p_new) { _change_notify("map_data"); } -PoolRealArray HeightMapShape::get_map_data() const { +PackedRealArray HeightMapShape::get_map_data() const { return map_data; } @@ -188,7 +188,7 @@ void HeightMapShape::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "map_width", PROPERTY_HINT_RANGE, "1,4096,1"), "set_map_width", "get_map_width"); ADD_PROPERTY(PropertyInfo(Variant::INT, "map_depth", PROPERTY_HINT_RANGE, "1,4096,1"), "set_map_depth", "get_map_depth"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_REAL_ARRAY, "map_data"), "set_map_data", "get_map_data"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_REAL_ARRAY, "map_data"), "set_map_data", "get_map_data"); } HeightMapShape::HeightMapShape() : @@ -197,7 +197,7 @@ HeightMapShape::HeightMapShape() : map_width = 2; map_depth = 2; map_data.resize(map_width * map_depth); - PoolRealArray::Write w = map_data.write(); + real_t *w = map_data.ptrw(); w[0] = 0.0; w[1] = 0.0; w[2] = 0.0; diff --git a/scene/resources/height_map_shape.h b/scene/resources/height_map_shape.h index a6263f061f..7b17f9ee7b 100644 --- a/scene/resources/height_map_shape.h +++ b/scene/resources/height_map_shape.h @@ -38,7 +38,7 @@ class HeightMapShape : public Shape { int map_width; int map_depth; - PoolRealArray map_data; + PackedRealArray map_data; float min_height; float max_height; @@ -51,8 +51,8 @@ public: int get_map_width() const; void set_map_depth(int p_new); int get_map_depth() const; - void set_map_data(PoolRealArray p_new); - PoolRealArray get_map_data() const; + void set_map_data(PackedRealArray p_new); + PackedRealArray get_map_data() const; virtual Vector<Vector3> get_debug_mesh_lines(); virtual real_t get_enclosing_radius() const; diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 58463abad8..08c4169167 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -63,9 +63,9 @@ Ref<TriangleMesh> Mesh::generate_triangle_mesh() const { if (facecount == 0 || (facecount % 3) != 0) return triangle_mesh; - PoolVector<Vector3> faces; + Vector<Vector3> faces; faces.resize(facecount); - PoolVector<Vector3>::Write facesw = faces.write(); + Vector3 *facesw = faces.ptrw(); int widx = 0; @@ -78,14 +78,14 @@ Ref<TriangleMesh> Mesh::generate_triangle_mesh() const { ERR_FAIL_COND_V(a.empty(), Ref<TriangleMesh>()); int vc = surface_get_array_len(i); - PoolVector<Vector3> vertices = a[ARRAY_VERTEX]; - PoolVector<Vector3>::Read vr = vertices.read(); + Vector<Vector3> vertices = a[ARRAY_VERTEX]; + const Vector3 *vr = vertices.ptr(); if (surface_get_format(i) & ARRAY_FORMAT_INDEX) { int ic = surface_get_array_index_len(i); - PoolVector<int> indices = a[ARRAY_INDEX]; - PoolVector<int>::Read ir = indices.read(); + Vector<int> indices = a[ARRAY_INDEX]; + const int *ir = indices.ptr(); for (int j = 0; j < ic; j++) { int index = ir[j]; @@ -99,8 +99,6 @@ Ref<TriangleMesh> Mesh::generate_triangle_mesh() const { } } - facesw.release(); - triangle_mesh = Ref<TriangleMesh>(memnew(TriangleMesh)); triangle_mesh->create(faces); @@ -118,15 +116,15 @@ void Mesh::generate_debug_mesh_lines(Vector<Vector3> &r_lines) { if (tm.is_null()) return; - PoolVector<int> triangle_indices; + Vector<int> triangle_indices; tm->get_indices(&triangle_indices); const int triangles_num = tm->get_triangles().size(); - PoolVector<Vector3> vertices = tm->get_vertices(); + Vector<Vector3> vertices = tm->get_vertices(); debug_lines.resize(tm->get_triangles().size() * 6); // 3 lines x 2 points each line - PoolVector<int>::Read ind_r = triangle_indices.read(); - PoolVector<Vector3>::Read ver_r = vertices.read(); + const int *ind_r = triangle_indices.ptr(); + const Vector3 *ver_r = vertices.ptr(); for (int j = 0, x = 0, i = 0; i < triangles_num; j += 6, x += 3, ++i) { // Triangle line 1 debug_lines.write[j + 0] = ver_r[ind_r[x + 0]]; @@ -148,7 +146,7 @@ void Mesh::generate_debug_mesh_indices(Vector<Vector3> &r_points) { if (tm.is_null()) return; - PoolVector<Vector3> vertices = tm->get_vertices(); + Vector<Vector3> vertices = tm->get_vertices(); int vertices_size = vertices.size(); r_points.resize(vertices_size); @@ -162,20 +160,20 @@ bool Mesh::surface_is_softbody_friendly(int p_idx) const { return (surface_format & Mesh::ARRAY_FLAG_USE_DYNAMIC_UPDATE && (!(surface_format & Mesh::ARRAY_COMPRESS_NORMAL))); } -PoolVector<Face3> Mesh::get_faces() const { +Vector<Face3> Mesh::get_faces() const { Ref<TriangleMesh> tm = generate_triangle_mesh(); if (tm.is_valid()) return tm->get_faces(); - return PoolVector<Face3>(); + return Vector<Face3>(); /* for (int i=0;i<surfaces.size();i++) { if (VisualServer::get_singleton()->mesh_surface_get_primitive_type( mesh, i ) != VisualServer::PRIMITIVE_TRIANGLES ) continue; - PoolVector<int> indices; - PoolVector<Vector3> vertices; + Vector<int> indices; + Vector<Vector3> vertices; vertices=VisualServer::get_singleton()->mesh_surface_get_array(mesh, i,VisualServer::ARRAY_VERTEX); @@ -196,10 +194,10 @@ PoolVector<Face3> Mesh::get_faces() const { if (len<=0) continue; - PoolVector<int>::Read indicesr = indices.read(); + const int* indicesr = indices.ptr(); const int *indicesptr = indicesr.ptr(); - PoolVector<Vector3>::Read verticesr = vertices.read(); + const Vector3* verticesr = vertices.ptr(); const Vector3 *verticesptr = verticesr.ptr(); int old_faces=faces.size(); @@ -207,7 +205,7 @@ PoolVector<Face3> Mesh::get_faces() const { faces.resize(new_faces); - PoolVector<Face3>::Write facesw = faces.write(); + Face3* facesw = faces.ptrw(); Face3 *facesptr=facesw.ptr(); @@ -230,13 +228,13 @@ PoolVector<Face3> Mesh::get_faces() const { Ref<Shape> Mesh::create_convex_shape() const { - PoolVector<Vector3> vertices; + Vector<Vector3> vertices; for (int i = 0; i < get_surface_count(); i++) { Array a = surface_get_arrays(i); ERR_FAIL_COND_V(a.empty(), Ref<ConvexPolygonShape>()); - PoolVector<Vector3> v = a[ARRAY_VERTEX]; + Vector<Vector3> v = a[ARRAY_VERTEX]; vertices.append_array(v); } @@ -247,11 +245,11 @@ Ref<Shape> Mesh::create_convex_shape() const { Ref<Shape> Mesh::create_trimesh_shape() const { - PoolVector<Face3> faces = get_faces(); + Vector<Face3> faces = get_faces(); if (faces.size() == 0) return Ref<Shape>(); - PoolVector<Vector3> face_points; + Vector<Vector3> face_points; face_points.resize(faces.size() * 3); for (int i = 0; i < face_points.size(); i++) { @@ -279,7 +277,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { if (i == 0) { arrays = a; - PoolVector<Vector3> v = a[ARRAY_VERTEX]; + Vector<Vector3> v = a[ARRAY_VERTEX]; index_accum += v.size(); } else { @@ -297,8 +295,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { case ARRAY_VERTEX: case ARRAY_NORMAL: { - PoolVector<Vector3> dst = arrays[j]; - PoolVector<Vector3> src = a[j]; + Vector<Vector3> dst = arrays[j]; + Vector<Vector3> src = a[j]; if (j == ARRAY_VERTEX) vcount = src.size(); if (dst.size() == 0 || src.size() == 0) { @@ -312,8 +310,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { case ARRAY_BONES: case ARRAY_WEIGHTS: { - PoolVector<real_t> dst = arrays[j]; - PoolVector<real_t> src = a[j]; + Vector<real_t> dst = arrays[j]; + Vector<real_t> src = a[j]; if (dst.size() == 0 || src.size() == 0) { arrays[j] = Variant(); continue; @@ -323,8 +321,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { } break; case ARRAY_COLOR: { - PoolVector<Color> dst = arrays[j]; - PoolVector<Color> src = a[j]; + Vector<Color> dst = arrays[j]; + Vector<Color> src = a[j]; if (dst.size() == 0 || src.size() == 0) { arrays[j] = Variant(); continue; @@ -335,8 +333,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { } break; case ARRAY_TEX_UV: case ARRAY_TEX_UV2: { - PoolVector<Vector2> dst = arrays[j]; - PoolVector<Vector2> src = a[j]; + Vector<Vector2> dst = arrays[j]; + Vector<Vector2> src = a[j]; if (dst.size() == 0 || src.size() == 0) { arrays[j] = Variant(); continue; @@ -346,15 +344,15 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { } break; case ARRAY_INDEX: { - PoolVector<int> dst = arrays[j]; - PoolVector<int> src = a[j]; + Vector<int> dst = arrays[j]; + Vector<int> src = a[j]; if (dst.size() == 0 || src.size() == 0) { arrays[j] = Variant(); continue; } { int ss = src.size(); - PoolVector<int>::Write w = src.write(); + int *w = src.ptrw(); for (int k = 0; k < ss; k++) { w[k] += index_accum; } @@ -372,18 +370,18 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { ERR_FAIL_COND_V(arrays.size() != ARRAY_MAX, Ref<ArrayMesh>()); { - PoolVector<int>::Write ir; - PoolVector<int> indices = arrays[ARRAY_INDEX]; + int *ir; + Vector<int> indices = arrays[ARRAY_INDEX]; bool has_indices = false; - PoolVector<Vector3> vertices = arrays[ARRAY_VERTEX]; + Vector<Vector3> vertices = arrays[ARRAY_VERTEX]; int vc = vertices.size(); ERR_FAIL_COND_V(!vc, Ref<ArrayMesh>()); - PoolVector<Vector3>::Write r = vertices.write(); + Vector3 *r = vertices.ptrw(); if (indices.size()) { ERR_FAIL_COND_V(indices.size() % 3 != 0, Ref<ArrayMesh>()); vc = indices.size(); - ir = indices.write(); + ir = indices.ptrw(); has_indices = true; } @@ -440,14 +438,13 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { r[i] = t; } - r.release(); arrays[ARRAY_VERTEX] = vertices; if (!has_indices) { - PoolVector<int> new_indices; + Vector<int> new_indices; new_indices.resize(vertices.size()); - PoolVector<int>::Write iw = new_indices.write(); + int *iw = new_indices.ptrw(); for (int j = 0; j < vc2; j += 3) { @@ -456,7 +453,6 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { iw[j + 2] = j + 1; } - iw.release(); arrays[ARRAY_INDEX] = new_indices; } else { @@ -465,7 +461,6 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { SWAP(ir[j + 1], ir[j + 2]); } - ir.release(); arrays[ARRAY_INDEX] = indices; } } @@ -548,10 +543,10 @@ Vector<Ref<Shape> > Mesh::convex_decompose() const { ERR_FAIL_COND_V(!convex_composition_function, Vector<Ref<Shape> >()); - PoolVector<Face3> faces = get_faces(); + Vector<Face3> faces = get_faces(); Vector<Face3> f3; f3.resize(faces.size()); - PoolVector<Face3>::Read f = faces.read(); + const Face3 *f = faces.ptr(); for (int i = 0; i < f3.size(); i++) { f3.write[i] = f[i]; } @@ -568,10 +563,10 @@ Vector<Ref<Shape> > Mesh::convex_decompose() const { points.insert(decomposed[i][j].vertex[2]); } - PoolVector<Vector3> convex_points; + Vector<Vector3> convex_points; convex_points.resize(points.size()); { - PoolVector<Vector3>::Write w = convex_points.write(); + Vector3 *w = convex_points.ptrw(); int idx = 0; for (Set<Vector3>::Element *E = points.front(); E; E = E->next()) { w[idx++] = E->get(); @@ -590,7 +585,7 @@ Vector<Ref<Shape> > Mesh::convex_decompose() const { Mesh::Mesh() { } -static PoolVector<uint8_t> _fix_array_compatibility(const PoolVector<uint8_t> &p_src, uint32_t p_format, uint32_t p_elements) { +static Vector<uint8_t> _fix_array_compatibility(const Vector<uint8_t> &p_src, uint32_t p_format, uint32_t p_elements) { bool vertex_16bit = p_format & ((1 << (Mesh::ARRAY_VERTEX + Mesh::ARRAY_COMPRESS_BASE))); bool has_bones = (p_format & Mesh::ARRAY_FORMAT_BONES); @@ -608,18 +603,18 @@ static PoolVector<uint8_t> _fix_array_compatibility(const PoolVector<uint8_t> &p uint32_t src_stride = p_src.size() / p_elements; uint32_t dst_stride = src_stride + (vertex_16bit ? 4 : 0) + (bone_8 ? 4 : 0) - (weight_32 ? 8 : 0); - PoolVector<uint8_t> ret = p_src; + Vector<uint8_t> ret = p_src; ret.resize(dst_stride * p_elements); { - PoolVector<uint8_t>::Write w = ret.write(); - PoolVector<uint8_t>::Read r = p_src.read(); + uint8_t *w = ret.ptrw(); + const uint8_t *r = p_src.ptr(); for (uint32_t i = 0; i < p_elements; i++) { uint32_t remaining = src_stride; - const uint8_t *src = (const uint8_t *)(r.ptr() + src_stride * i); - uint8_t *dst = (uint8_t *)(w.ptr() + dst_stride * i); + const uint8_t *src = (const uint8_t *)(r + src_stride * i); + uint8_t *dst = (uint8_t *)(w + dst_stride * i); if (!vertex_2d) { //3D if (vertex_16bit) { @@ -714,9 +709,9 @@ bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) { if (p_name == "blend_shape/names") { - PoolVector<String> sk = p_value; + Vector<String> sk = p_value; int sz = sk.size(); - PoolVector<String>::Read r = sk.read(); + const String *r = sk.ptr(); for (int i = 0; i < sz; i++) add_blend_shape(r[i]); return true; @@ -766,8 +761,8 @@ bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) { } else if (d.has("array_data")) { //print_line("array data (old style"); //older format (3.x) - PoolVector<uint8_t> array_data = d["array_data"]; - PoolVector<uint8_t> array_index_data; + Vector<uint8_t> array_data = d["array_data"]; + Vector<uint8_t> array_index_data; if (d.has("array_index_data")) array_index_data = d["array_index_data"]; @@ -797,12 +792,12 @@ bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) { if (d.has("index_count")) index_count = d["index_count"]; - Vector<PoolVector<uint8_t> > blend_shapes; + Vector<Vector<uint8_t> > blend_shapes; if (d.has("blend_shape_data")) { Array blend_shape_data = d["blend_shape_data"]; for (int i = 0; i < blend_shape_data.size(); i++) { - PoolVector<uint8_t> shape = blend_shape_data[i]; + Vector<uint8_t> shape = blend_shape_data[i]; shape = _fix_array_compatibility(shape, format, vertex_count); blend_shapes.push_back(shape); @@ -1049,7 +1044,7 @@ bool ArrayMesh::_get(const StringName &p_name, Variant &r_ret) const { if (p_name == "blend_shape/names") { - PoolVector<String> sk; + Vector<String> sk; for (int i = 0; i < blend_shapes.size(); i++) sk.push_back(blend_shapes[i]); r_ret = sk; @@ -1081,7 +1076,7 @@ void ArrayMesh::_get_property_list(List<PropertyInfo> *p_list) const { return; if (blend_shapes.size()) { - p_list->push_back(PropertyInfo(Variant::POOL_STRING_ARRAY, "blend_shape/names", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::PACKED_STRING_ARRAY, "blend_shape/names", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); p_list->push_back(PropertyInfo(Variant::INT, "blend_shape/mode", PROPERTY_HINT_ENUM, "Normalized,Relative")); } @@ -1112,7 +1107,7 @@ void ArrayMesh::_recompute_aabb() { #ifndef _MSC_VER #warning need to add binding to add_surface using future MeshSurfaceData object #endif -void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes, const Vector<AABB> &p_bone_aabb, const Vector<VS::SurfaceData::LOD> &p_lods) { +void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t> > &p_blend_shapes, const Vector<AABB> &p_bone_aabb, const Vector<VS::SurfaceData::LOD> &p_lods) { _create_if_empty(); @@ -1293,7 +1288,7 @@ String ArrayMesh::surface_get_name(int p_idx) const { return surfaces[p_idx].name; } -void ArrayMesh::surface_update_region(int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) { +void ArrayMesh::surface_update_region(int p_surface, int p_offset, const Vector<uint8_t> &p_data) { ERR_FAIL_INDEX(p_surface, surfaces.size()); VS::get_singleton()->mesh_surface_update_region(mesh, p_surface, p_offset, p_data); @@ -1404,12 +1399,12 @@ Error ArrayMesh::lightmap_unwrap(const Transform &p_base_transform, float p_texe s.material = surface_get_material(i); s.vertices = SurfaceTool::create_vertex_array_from_triangle_arrays(arrays); - PoolVector<Vector3> rvertices = arrays[Mesh::ARRAY_VERTEX]; + Vector<Vector3> rvertices = arrays[Mesh::ARRAY_VERTEX]; int vc = rvertices.size(); - PoolVector<Vector3>::Read r = rvertices.read(); + const Vector3 *r = rvertices.ptr(); - PoolVector<Vector3> rnormals = arrays[Mesh::ARRAY_NORMAL]; - PoolVector<Vector3>::Read rn = rnormals.read(); + Vector<Vector3> rnormals = arrays[Mesh::ARRAY_NORMAL]; + const Vector3 *rn = rnormals.ptr(); int vertex_ofs = vertices.size() / 3; @@ -1431,7 +1426,7 @@ Error ArrayMesh::lightmap_unwrap(const Transform &p_base_transform, float p_texe uv_index.write[j + vertex_ofs] = Pair<int, int>(i, j); } - PoolVector<int> rindices = arrays[Mesh::ARRAY_INDEX]; + Vector<int> rindices = arrays[Mesh::ARRAY_INDEX]; int ic = rindices.size(); if (ic == 0) { @@ -1447,7 +1442,7 @@ Error ArrayMesh::lightmap_unwrap(const Transform &p_base_transform, float p_texe } } else { - PoolVector<int>::Read ri = rindices.read(); + const int *ri = rindices.ptr(); for (int j = 0; j < ic / 3; j++) { if (Face3(r[ri[j * 3 + 0]], r[ri[j * 3 + 1]], r[ri[j * 3 + 2]]).is_degenerate()) diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index b8f3702bbe..0e356c16a6 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -126,7 +126,7 @@ public: virtual int get_blend_shape_count() const = 0; virtual StringName get_blend_shape_name(int p_index) const = 0; - PoolVector<Face3> get_faces() const; + Vector<Face3> get_faces() const; Ref<TriangleMesh> generate_triangle_mesh() const; void generate_debug_mesh_lines(Vector<Vector3> &r_lines); void generate_debug_mesh_indices(Vector<Vector3> &r_points); @@ -193,7 +193,7 @@ protected: public: void add_surface_from_arrays(PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes = Array(), const Dictionary &p_lods = Dictionary(), uint32_t p_flags = ARRAY_COMPRESS_DEFAULT); - void add_surface(uint32_t p_format, PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>(), const Vector<VS::SurfaceData::LOD> &p_lods = Vector<VS::SurfaceData::LOD>()); + void add_surface(uint32_t p_format, PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t> > &p_blend_shapes = Vector<Vector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>(), const Vector<VS::SurfaceData::LOD> &p_lods = Vector<VS::SurfaceData::LOD>()); Array surface_get_arrays(int p_surface) const; Array surface_get_blend_shape_arrays(int p_surface) const; @@ -207,7 +207,7 @@ public: void set_blend_shape_mode(BlendShapeMode p_mode); BlendShapeMode get_blend_shape_mode() const; - void surface_update_region(int p_surface, int p_offset, const PoolVector<uint8_t> &p_data); + void surface_update_region(int p_surface, int p_offset, const Vector<uint8_t> &p_data); int get_surface_count() const; void surface_remove(int p_idx); diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp index 7a303443e3..675cfc6d64 100644 --- a/scene/resources/mesh_data_tool.cpp +++ b/scene/resources/mesh_data_tool.cpp @@ -47,7 +47,7 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf Array arrays = p_mesh->surface_get_arrays(p_surface); ERR_FAIL_COND_V(arrays.empty(), ERR_INVALID_PARAMETER); - PoolVector<Vector3> varray = arrays[Mesh::ARRAY_VERTEX]; + Vector<Vector3> varray = arrays[Mesh::ARRAY_VERTEX]; int vcount = varray.size(); ERR_FAIL_COND_V(vcount == 0, ERR_INVALID_PARAMETER); @@ -56,34 +56,34 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf format = p_mesh->surface_get_format(p_surface); material = p_mesh->surface_get_material(p_surface); - PoolVector<Vector3>::Read vr = varray.read(); + const Vector3 *vr = varray.ptr(); - PoolVector<Vector3>::Read nr; + const Vector3 *nr; if (arrays[Mesh::ARRAY_NORMAL].get_type() != Variant::NIL) - nr = arrays[Mesh::ARRAY_NORMAL].operator PoolVector<Vector3>().read(); + nr = arrays[Mesh::ARRAY_NORMAL].operator Vector<Vector3>().ptr(); - PoolVector<real_t>::Read ta; + const real_t *ta; if (arrays[Mesh::ARRAY_TANGENT].get_type() != Variant::NIL) - ta = arrays[Mesh::ARRAY_TANGENT].operator PoolVector<real_t>().read(); + ta = arrays[Mesh::ARRAY_TANGENT].operator Vector<real_t>().ptr(); - PoolVector<Vector2>::Read uv; + const Vector2 *uv; if (arrays[Mesh::ARRAY_TEX_UV].get_type() != Variant::NIL) - uv = arrays[Mesh::ARRAY_TEX_UV].operator PoolVector<Vector2>().read(); - PoolVector<Vector2>::Read uv2; + uv = arrays[Mesh::ARRAY_TEX_UV].operator Vector<Vector2>().ptr(); + const Vector2 *uv2; if (arrays[Mesh::ARRAY_TEX_UV2].get_type() != Variant::NIL) - uv2 = arrays[Mesh::ARRAY_TEX_UV2].operator PoolVector<Vector2>().read(); + uv2 = arrays[Mesh::ARRAY_TEX_UV2].operator Vector<Vector2>().ptr(); - PoolVector<Color>::Read col; + const Color *col; if (arrays[Mesh::ARRAY_COLOR].get_type() != Variant::NIL) - col = arrays[Mesh::ARRAY_COLOR].operator PoolVector<Color>().read(); + col = arrays[Mesh::ARRAY_COLOR].operator Vector<Color>().ptr(); - PoolVector<int>::Read bo; + const int *bo; if (arrays[Mesh::ARRAY_BONES].get_type() != Variant::NIL) - bo = arrays[Mesh::ARRAY_BONES].operator PoolVector<int>().read(); + bo = arrays[Mesh::ARRAY_BONES].operator Vector<int>().ptr(); - PoolVector<real_t>::Read we; + const real_t *we; if (arrays[Mesh::ARRAY_WEIGHTS].get_type() != Variant::NIL) - we = arrays[Mesh::ARRAY_WEIGHTS].operator PoolVector<real_t>().read(); + we = arrays[Mesh::ARRAY_WEIGHTS].operator Vector<real_t>().ptr(); vertices.resize(vcount); @@ -91,18 +91,18 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf Vertex v; v.vertex = vr[i]; - if (nr.ptr()) + if (nr) v.normal = nr[i]; - if (ta.ptr()) + if (ta) v.tangent = Plane(ta[i * 4 + 0], ta[i * 4 + 1], ta[i * 4 + 2], ta[i * 4 + 3]); - if (uv.ptr()) + if (uv) v.uv = uv[i]; - if (uv2.ptr()) + if (uv2) v.uv2 = uv2[i]; - if (col.ptr()) + if (col) v.color = col[i]; - if (we.ptr()) { + if (we) { v.weights.push_back(we[i * 4 + 0]); v.weights.push_back(we[i * 4 + 1]); @@ -110,7 +110,7 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf v.weights.push_back(we[i * 4 + 3]); } - if (bo.ptr()) { + if (bo) { v.bones.push_back(bo[i * 4 + 0]); v.bones.push_back(bo[i * 4 + 1]); @@ -121,7 +121,7 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf vertices.write[i] = v; } - PoolVector<int> indices; + Vector<int> indices; if (arrays[Mesh::ARRAY_INDEX].get_type() != Variant::NIL) { @@ -129,13 +129,13 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf } else { //make code simpler indices.resize(vcount); - PoolVector<int>::Write iw = indices.write(); + int *iw = indices.ptrw(); for (int i = 0; i < vcount; i++) iw[i] = i; } int icount = indices.size(); - PoolVector<int>::Read r = indices.read(); + const int *r = indices.ptr(); Map<Point2i, int> edge_indices; @@ -187,61 +187,61 @@ Error MeshDataTool::commit_to_surface(const Ref<ArrayMesh> &p_mesh) { int vcount = vertices.size(); - PoolVector<Vector3> v; - PoolVector<Vector3> n; - PoolVector<real_t> t; - PoolVector<Vector2> u; - PoolVector<Vector2> u2; - PoolVector<Color> c; - PoolVector<int> b; - PoolVector<real_t> w; - PoolVector<int> in; + Vector<Vector3> v; + Vector<Vector3> n; + Vector<real_t> t; + Vector<Vector2> u; + Vector<Vector2> u2; + Vector<Color> c; + Vector<int> b; + Vector<real_t> w; + Vector<int> in; { v.resize(vcount); - PoolVector<Vector3>::Write vr = v.write(); + Vector3 *vr = v.ptrw(); - PoolVector<Vector3>::Write nr; + Vector3 *nr; if (format & Mesh::ARRAY_FORMAT_NORMAL) { n.resize(vcount); - nr = n.write(); + nr = n.ptrw(); } - PoolVector<real_t>::Write ta; + real_t *ta; if (format & Mesh::ARRAY_FORMAT_TANGENT) { t.resize(vcount * 4); - ta = t.write(); + ta = t.ptrw(); } - PoolVector<Vector2>::Write uv; + Vector2 *uv; if (format & Mesh::ARRAY_FORMAT_TEX_UV) { u.resize(vcount); - uv = u.write(); + uv = u.ptrw(); } - PoolVector<Vector2>::Write uv2; + Vector2 *uv2; if (format & Mesh::ARRAY_FORMAT_TEX_UV2) { u2.resize(vcount); - uv2 = u2.write(); + uv2 = u2.ptrw(); } - PoolVector<Color>::Write col; + Color *col; if (format & Mesh::ARRAY_FORMAT_COLOR) { c.resize(vcount); - col = c.write(); + col = c.ptrw(); } - PoolVector<int>::Write bo; + int *bo; if (format & Mesh::ARRAY_FORMAT_BONES) { b.resize(vcount * 4); - bo = b.write(); + bo = b.ptrw(); } - PoolVector<real_t>::Write we; + real_t *we; if (format & Mesh::ARRAY_FORMAT_WEIGHTS) { w.resize(vcount * 4); - we = w.write(); + we = w.ptrw(); } for (int i = 0; i < vcount; i++) { @@ -249,22 +249,22 @@ Error MeshDataTool::commit_to_surface(const Ref<ArrayMesh> &p_mesh) { const Vertex &vtx = vertices[i]; vr[i] = vtx.vertex; - if (nr.ptr()) + if (nr) nr[i] = vtx.normal; - if (ta.ptr()) { + if (ta) { ta[i * 4 + 0] = vtx.tangent.normal.x; ta[i * 4 + 1] = vtx.tangent.normal.y; ta[i * 4 + 2] = vtx.tangent.normal.z; ta[i * 4 + 3] = vtx.tangent.d; } - if (uv.ptr()) + if (uv) uv[i] = vtx.uv; - if (uv2.ptr()) + if (uv2) uv2[i] = vtx.uv2; - if (col.ptr()) + if (col) col[i] = vtx.color; - if (we.ptr()) { + if (we) { we[i * 4 + 0] = vtx.weights[0]; we[i * 4 + 1] = vtx.weights[1]; @@ -272,7 +272,7 @@ Error MeshDataTool::commit_to_surface(const Ref<ArrayMesh> &p_mesh) { we[i * 4 + 3] = vtx.weights[3]; } - if (bo.ptr()) { + if (bo) { bo[i * 4 + 0] = vtx.bones[0]; bo[i * 4 + 1] = vtx.bones[1]; @@ -283,7 +283,7 @@ Error MeshDataTool::commit_to_surface(const Ref<ArrayMesh> &p_mesh) { int fc = faces.size(); in.resize(fc * 3); - PoolVector<int>::Write iw = in.write(); + int *iw = in.ptrw(); for (int i = 0; i < fc; i++) { iw[i * 3 + 0] = faces[i].v[0]; diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp index 9c34ae0504..85eab335de 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -35,17 +35,17 @@ #ifndef DISABLE_DEPRECATED // Kept for compatibility from 3.x to 4.0. -void MultiMesh::_set_transform_array(const PoolVector<Vector3> &p_array) { +void MultiMesh::_set_transform_array(const Vector<Vector3> &p_array) { if (transform_format != TRANSFORM_3D) return; - const PoolVector<Vector3> &xforms = p_array; + const Vector<Vector3> &xforms = p_array; int len = xforms.size(); ERR_FAIL_COND((len / 4) != instance_count); if (len == 0) return; - PoolVector<Vector3>::Read r = xforms.read(); + const Vector3 *r = xforms.ptr(); for (int i = 0; i < len / 4; i++) { @@ -59,18 +59,18 @@ void MultiMesh::_set_transform_array(const PoolVector<Vector3> &p_array) { } } -PoolVector<Vector3> MultiMesh::_get_transform_array() const { +Vector<Vector3> MultiMesh::_get_transform_array() const { if (transform_format != TRANSFORM_3D) - return PoolVector<Vector3>(); + return Vector<Vector3>(); if (instance_count == 0) - return PoolVector<Vector3>(); + return Vector<Vector3>(); - PoolVector<Vector3> xforms; + Vector<Vector3> xforms; xforms.resize(instance_count * 4); - PoolVector<Vector3>::Write w = xforms.write(); + Vector3 *w = xforms.ptrw(); for (int i = 0; i < instance_count; i++) { @@ -84,18 +84,18 @@ PoolVector<Vector3> MultiMesh::_get_transform_array() const { return xforms; } -void MultiMesh::_set_transform_2d_array(const PoolVector<Vector2> &p_array) { +void MultiMesh::_set_transform_2d_array(const Vector<Vector2> &p_array) { if (transform_format != TRANSFORM_2D) return; - const PoolVector<Vector2> &xforms = p_array; + const Vector<Vector2> &xforms = p_array; int len = xforms.size(); ERR_FAIL_COND((len / 3) != instance_count); if (len == 0) return; - PoolVector<Vector2>::Read r = xforms.read(); + const Vector2 *r = xforms.ptr(); for (int i = 0; i < len / 3; i++) { @@ -108,18 +108,18 @@ void MultiMesh::_set_transform_2d_array(const PoolVector<Vector2> &p_array) { } } -PoolVector<Vector2> MultiMesh::_get_transform_2d_array() const { +Vector<Vector2> MultiMesh::_get_transform_2d_array() const { if (transform_format != TRANSFORM_2D) - return PoolVector<Vector2>(); + return Vector<Vector2>(); if (instance_count == 0) - return PoolVector<Vector2>(); + return Vector<Vector2>(); - PoolVector<Vector2> xforms; + Vector<Vector2> xforms; xforms.resize(instance_count * 3); - PoolVector<Vector2>::Write w = xforms.write(); + Vector2 *w = xforms.ptrw(); for (int i = 0; i < instance_count; i++) { @@ -132,15 +132,15 @@ PoolVector<Vector2> MultiMesh::_get_transform_2d_array() const { return xforms; } -void MultiMesh::_set_color_array(const PoolVector<Color> &p_array) { +void MultiMesh::_set_color_array(const Vector<Color> &p_array) { - const PoolVector<Color> &colors = p_array; + const Vector<Color> &colors = p_array; int len = colors.size(); if (len == 0) return; ERR_FAIL_COND(len != instance_count); - PoolVector<Color>::Read r = colors.read(); + const Color *r = colors.ptr(); for (int i = 0; i < len; i++) { @@ -148,12 +148,12 @@ void MultiMesh::_set_color_array(const PoolVector<Color> &p_array) { } } -PoolVector<Color> MultiMesh::_get_color_array() const { +Vector<Color> MultiMesh::_get_color_array() const { if (instance_count == 0 || !use_colors) - return PoolVector<Color>(); + return Vector<Color>(); - PoolVector<Color> colors; + Vector<Color> colors; colors.resize(instance_count); for (int i = 0; i < instance_count; i++) { @@ -164,15 +164,15 @@ PoolVector<Color> MultiMesh::_get_color_array() const { return colors; } -void MultiMesh::_set_custom_data_array(const PoolVector<Color> &p_array) { +void MultiMesh::_set_custom_data_array(const Vector<Color> &p_array) { - const PoolVector<Color> &custom_datas = p_array; + const Vector<Color> &custom_datas = p_array; int len = custom_datas.size(); if (len == 0) return; ERR_FAIL_COND(len != instance_count); - PoolVector<Color>::Read r = custom_datas.read(); + const Color *r = custom_datas.ptr(); for (int i = 0; i < len; i++) { @@ -180,12 +180,12 @@ void MultiMesh::_set_custom_data_array(const PoolVector<Color> &p_array) { } } -PoolVector<Color> MultiMesh::_get_custom_data_array() const { +Vector<Color> MultiMesh::_get_custom_data_array() const { if (instance_count == 0 || !use_custom_data) - return PoolVector<Color>(); + return Vector<Color>(); - PoolVector<Color> custom_datas; + Vector<Color> custom_datas; custom_datas.resize(instance_count); for (int i = 0; i < instance_count; i++) { @@ -197,11 +197,11 @@ PoolVector<Color> MultiMesh::_get_custom_data_array() const { } #endif // DISABLE_DEPRECATED -void MultiMesh::set_buffer(const PoolVector<float> &p_buffer) { +void MultiMesh::set_buffer(const Vector<float> &p_buffer) { VS::get_singleton()->multimesh_set_buffer(multimesh, p_buffer); } -PoolVector<float> MultiMesh::get_buffer() const { +Vector<float> MultiMesh::get_buffer() const { return VS::get_singleton()->multimesh_get_buffer(multimesh); } @@ -350,7 +350,7 @@ void MultiMesh::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "instance_count", PROPERTY_HINT_RANGE, "0,16384,1,or_greater"), "set_instance_count", "get_instance_count"); ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_instance_count", PROPERTY_HINT_RANGE, "-1,16384,1,or_greater"), "set_visible_instance_count", "get_visible_instance_count"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mesh", PROPERTY_HINT_RESOURCE_TYPE, "Mesh"), "set_mesh", "get_mesh"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_REAL_ARRAY, "buffer", PROPERTY_HINT_NONE), "set_buffer", "get_buffer"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_REAL_ARRAY, "buffer", PROPERTY_HINT_NONE), "set_buffer", "get_buffer"); #ifndef DISABLE_DEPRECATED // Kept for compatibility from 3.x to 4.0. @@ -363,10 +363,10 @@ void MultiMesh::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_custom_data_array"), &MultiMesh::_set_custom_data_array); ClassDB::bind_method(D_METHOD("_get_custom_data_array"), &MultiMesh::_get_custom_data_array); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "transform_array", PROPERTY_HINT_NONE, "", 0), "_set_transform_array", "_get_transform_array"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "transform_2d_array", PROPERTY_HINT_NONE, "", 0), "_set_transform_2d_array", "_get_transform_2d_array"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "color_array", PROPERTY_HINT_NONE, "", 0), "_set_color_array", "_get_color_array"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_COLOR_ARRAY, "custom_data_array", PROPERTY_HINT_NONE, "", 0), "_set_custom_data_array", "_get_custom_data_array"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR3_ARRAY, "transform_array", PROPERTY_HINT_NONE, "", 0), "_set_transform_array", "_get_transform_array"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "transform_2d_array", PROPERTY_HINT_NONE, "", 0), "_set_transform_2d_array", "_get_transform_2d_array"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_COLOR_ARRAY, "color_array", PROPERTY_HINT_NONE, "", 0), "_set_color_array", "_get_color_array"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_COLOR_ARRAY, "custom_data_array", PROPERTY_HINT_NONE, "", 0), "_set_custom_data_array", "_get_custom_data_array"); #endif BIND_ENUM_CONSTANT(TRANSFORM_2D); diff --git a/scene/resources/multimesh.h b/scene/resources/multimesh.h index 5423e66358..8ca30a5b88 100644 --- a/scene/resources/multimesh.h +++ b/scene/resources/multimesh.h @@ -59,20 +59,20 @@ protected: #ifndef DISABLE_DEPRECATED // Kept for compatibility from 3.x to 4.0. - void _set_transform_array(const PoolVector<Vector3> &p_array); - PoolVector<Vector3> _get_transform_array() const; + void _set_transform_array(const Vector<Vector3> &p_array); + Vector<Vector3> _get_transform_array() const; - void _set_transform_2d_array(const PoolVector<Vector2> &p_array); - PoolVector<Vector2> _get_transform_2d_array() const; + void _set_transform_2d_array(const Vector<Vector2> &p_array); + Vector<Vector2> _get_transform_2d_array() const; - void _set_color_array(const PoolVector<Color> &p_array); - PoolVector<Color> _get_color_array() const; + void _set_color_array(const Vector<Color> &p_array); + Vector<Color> _get_color_array() const; - void _set_custom_data_array(const PoolVector<Color> &p_array); - PoolVector<Color> _get_custom_data_array() const; + void _set_custom_data_array(const Vector<Color> &p_array); + Vector<Color> _get_custom_data_array() const; #endif - void set_buffer(const PoolVector<float> &p_buffer); - PoolVector<float> get_buffer() const; + void set_buffer(const Vector<float> &p_buffer); + Vector<float> get_buffer() const; public: void set_mesh(const Ref<Mesh> &p_mesh); diff --git a/scene/resources/navigation_mesh.cpp b/scene/resources/navigation_mesh.cpp index e6544778bc..809513c5ae 100644 --- a/scene/resources/navigation_mesh.cpp +++ b/scene/resources/navigation_mesh.cpp @@ -32,7 +32,7 @@ void NavigationMesh::create_from_mesh(const Ref<Mesh> &p_mesh) { - vertices = PoolVector<Vector3>(); + vertices = Vector<Vector3>(); clear_polygons(); for (int i = 0; i < p_mesh->get_surface_count(); i++) { @@ -40,15 +40,15 @@ void NavigationMesh::create_from_mesh(const Ref<Mesh> &p_mesh) { if (p_mesh->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES) continue; Array arr = p_mesh->surface_get_arrays(i); - PoolVector<Vector3> varr = arr[Mesh::ARRAY_VERTEX]; - PoolVector<int> iarr = arr[Mesh::ARRAY_INDEX]; + Vector<Vector3> varr = arr[Mesh::ARRAY_VERTEX]; + Vector<int> iarr = arr[Mesh::ARRAY_INDEX]; if (varr.size() == 0 || iarr.size() == 0) continue; int from = vertices.size(); vertices.append_array(varr); int rlen = iarr.size(); - PoolVector<int>::Read r = iarr.read(); + const int *r = iarr.ptr(); for (int j = 0; j < rlen; j += 3) { Vector<int> vi; @@ -252,13 +252,13 @@ bool NavigationMesh::get_filter_walkable_low_height_spans() const { return filter_walkable_low_height_spans; } -void NavigationMesh::set_vertices(const PoolVector<Vector3> &p_vertices) { +void NavigationMesh::set_vertices(const Vector<Vector3> &p_vertices) { vertices = p_vertices; _change_notify(); } -PoolVector<Vector3> NavigationMesh::get_vertices() const { +Vector<Vector3> NavigationMesh::get_vertices() const { return vertices; } @@ -309,8 +309,8 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() { if (debug_mesh.is_valid()) return debug_mesh; - PoolVector<Vector3> vertices = get_vertices(); - PoolVector<Vector3>::Read vr = vertices.read(); + Vector<Vector3> vertices = get_vertices(); + const Vector3 *vr = vertices.ptr(); List<Face3> faces; for (int i = 0; i < get_polygon_count(); i++) { Vector<int> p = get_polygon(i); @@ -326,11 +326,11 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() { } Map<_EdgeKey, bool> edge_map; - PoolVector<Vector3> tmeshfaces; + Vector<Vector3> tmeshfaces; tmeshfaces.resize(faces.size() * 3); { - PoolVector<Vector3>::Write tw = tmeshfaces.write(); + Vector3 *tw = tmeshfaces.ptrw(); int tidx = 0; for (List<Face3>::Element *E = faces.front(); E; E = E->next()) { @@ -369,10 +369,10 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() { } } - PoolVector<Vector3> varr; + Vector<Vector3> varr; varr.resize(lines.size()); { - PoolVector<Vector3>::Write w = varr.write(); + Vector3 *w = varr.ptrw(); int idx = 0; for (List<Vector3>::Element *E = lines.front(); E; E = E->next()) { w[idx++] = E->get(); @@ -478,7 +478,7 @@ void NavigationMesh::_bind_methods() { BIND_CONSTANT(PARSED_GEOMETRY_STATIC_COLLIDERS); BIND_CONSTANT(PARSED_GEOMETRY_BOTH); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "vertices", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_vertices", "get_vertices"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR3_ARRAY, "vertices", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_vertices", "get_vertices"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "polygons", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_polygons", "_get_polygons"); ADD_PROPERTY(PropertyInfo(Variant::INT, "sample_partition_type/sample_partition_type", PROPERTY_HINT_ENUM, "Watershed,Monotone,Layers"), "set_sample_partition_type", "get_sample_partition_type"); diff --git a/scene/resources/navigation_mesh.h b/scene/resources/navigation_mesh.h index a2b1c62eab..cc3ac6e3fd 100644 --- a/scene/resources/navigation_mesh.h +++ b/scene/resources/navigation_mesh.h @@ -39,7 +39,7 @@ class NavigationMesh : public Resource { GDCLASS(NavigationMesh, Resource); - PoolVector<Vector3> vertices; + Vector<Vector3> vertices; struct Polygon { Vector<int> indices; }; @@ -179,8 +179,8 @@ public: void create_from_mesh(const Ref<Mesh> &p_mesh); - void set_vertices(const PoolVector<Vector3> &p_vertices); - PoolVector<Vector3> get_vertices() const; + void set_vertices(const Vector<Vector3> &p_vertices); + Vector<Vector3> get_vertices() const; void add_polygon(const Vector<int> &p_polygon); int get_polygon_count() const; diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 3e7d350eec..c018ab2029 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -1098,19 +1098,19 @@ void SceneState::set_bundled_scene(const Dictionary &p_dictionary) { ERR_FAIL_COND_MSG(version > PACKED_SCENE_VERSION, "Save format version too new."); const int node_count = p_dictionary["node_count"]; - const PoolVector<int> snodes = p_dictionary["nodes"]; + const Vector<int> snodes = p_dictionary["nodes"]; ERR_FAIL_COND(snodes.size() < node_count); const int conn_count = p_dictionary["conn_count"]; - const PoolVector<int> sconns = p_dictionary["conns"]; + const Vector<int> sconns = p_dictionary["conns"]; ERR_FAIL_COND(sconns.size() < conn_count); - PoolVector<String> snames = p_dictionary["names"]; + Vector<String> snames = p_dictionary["names"]; if (snames.size()) { int namecount = snames.size(); names.resize(namecount); - PoolVector<String>::Read r = snames.read(); + const String *r = snames.ptr(); for (int i = 0; i < names.size(); i++) names.write[i] = r[i]; } @@ -1131,7 +1131,7 @@ void SceneState::set_bundled_scene(const Dictionary &p_dictionary) { nodes.resize(node_count); if (node_count) { - PoolVector<int>::Read r = snodes.read(); + const int *r = snodes.ptr(); int idx = 0; for (int i = 0; i < node_count; i++) { NodeData &nd = nodes.write[i]; @@ -1159,7 +1159,7 @@ void SceneState::set_bundled_scene(const Dictionary &p_dictionary) { connections.resize(conn_count); if (conn_count) { - PoolVector<int>::Read r = sconns.read(); + const int *r = sconns.ptr(); int idx = 0; for (int i = 0; i < conn_count; i++) { ConnectionData &cd = connections.write[i]; @@ -1205,12 +1205,12 @@ void SceneState::set_bundled_scene(const Dictionary &p_dictionary) { Dictionary SceneState::get_bundled_scene() const { - PoolVector<String> rnames; + Vector<String> rnames; rnames.resize(names.size()); if (names.size()) { - PoolVector<String>::Write r = rnames.write(); + String *r = rnames.ptrw(); for (int i = 0; i < names.size(); i++) r[i] = names[i]; @@ -1612,10 +1612,10 @@ void SceneState::add_editable_instance(const NodePath &p_path) { editable_instances.push_back(p_path); } -PoolVector<String> SceneState::_get_node_groups(int p_idx) const { +Vector<String> SceneState::_get_node_groups(int p_idx) const { Vector<StringName> groups = get_node_groups(p_idx); - PoolVector<String> ret; + Vector<String> ret; for (int i = 0; i < groups.size(); i++) ret.push_back(groups[i]); diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h index b4966e2528..c5873a0792 100644 --- a/scene/resources/packed_scene.h +++ b/scene/resources/packed_scene.h @@ -103,7 +103,7 @@ class SceneState : public Reference { static bool disable_placeholders; - PoolVector<String> _get_node_groups(int p_idx) const; + Vector<String> _get_node_groups(int p_idx) const; int _find_base_scene_node_remap_key(int p_idx) const; diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp index 9a1d478777..eff0721cef 100644 --- a/scene/resources/polygon_path_finder.cpp +++ b/scene/resources/polygon_path_finder.cpp @@ -415,7 +415,7 @@ void PolygonPathFinder::_set_data(const Dictionary &p_data) { ERR_FAIL_COND(!p_data.has("segments")); ERR_FAIL_COND(!p_data.has("bounds")); - PoolVector<Vector2> p = p_data["points"]; + Vector<Vector2> p = p_data["points"]; Array c = p_data["connections"]; ERR_FAIL_COND(c.size() != p.size()); @@ -425,11 +425,11 @@ void PolygonPathFinder::_set_data(const Dictionary &p_data) { int pc = p.size(); points.resize(pc + 2); - PoolVector<Vector2>::Read pr = p.read(); + const Vector2 *pr = p.ptr(); for (int i = 0; i < pc; i++) { points.write[i].pos = pr[i]; - PoolVector<int> con = c[i]; - PoolVector<int>::Read cr = con.read(); + Vector<int> con = c[i]; + const int *cr = con.ptr(); int cc = con.size(); for (int j = 0; j < cc; j++) { @@ -439,19 +439,19 @@ void PolygonPathFinder::_set_data(const Dictionary &p_data) { if (p_data.has("penalties")) { - PoolVector<float> penalties = p_data["penalties"]; + Vector<float> penalties = p_data["penalties"]; if (penalties.size() == pc) { - PoolVector<float>::Read pr2 = penalties.read(); + const float *pr2 = penalties.ptr(); for (int i = 0; i < pc; i++) { points.write[i].penalty = pr2[i]; } } } - PoolVector<int> segs = p_data["segments"]; + Vector<int> segs = p_data["segments"]; int sc = segs.size(); ERR_FAIL_COND(sc & 1); - PoolVector<int>::Read sr = segs.read(); + const int *sr = segs.ptr(); for (int i = 0; i < sc; i += 2) { Edge e(sr[i], sr[i + 1]); @@ -463,25 +463,25 @@ void PolygonPathFinder::_set_data(const Dictionary &p_data) { Dictionary PolygonPathFinder::_get_data() const { Dictionary d; - PoolVector<Vector2> p; - PoolVector<int> ind; + Vector<Vector2> p; + Vector<int> ind; Array connections; p.resize(MAX(0, points.size() - 2)); connections.resize(MAX(0, points.size() - 2)); ind.resize(edges.size() * 2); - PoolVector<float> penalties; + Vector<float> penalties; penalties.resize(MAX(0, points.size() - 2)); { - PoolVector<Vector2>::Write wp = p.write(); - PoolVector<float>::Write pw = penalties.write(); + Vector2 *wp = p.ptrw(); + float *pw = penalties.ptrw(); for (int i = 0; i < points.size() - 2; i++) { wp[i] = points[i].pos; pw[i] = points[i].penalty; - PoolVector<int> c; + Vector<int> c; c.resize(points[i].connections.size()); { - PoolVector<int>::Write cw = c.write(); + int *cw = c.ptrw(); int idx = 0; for (Set<int>::Element *E = points[i].connections.front(); E; E = E->next()) { cw[idx++] = E->get(); @@ -492,7 +492,7 @@ Dictionary PolygonPathFinder::_get_data() const { } { - PoolVector<int>::Write iw = ind.write(); + int *iw = ind.ptrw(); int idx = 0; for (Set<Edge>::Element *E = edges.front(); E; E = E->next()) { iw[idx++] = E->get().points[0]; diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index fa0ded12a1..ea775ba028 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -40,7 +40,7 @@ void PrimitiveMesh::_update() const { arr.resize(VS::ARRAY_MAX); _create_mesh_array(arr); - PoolVector<Vector3> points = arr[VS::ARRAY_VERTEX]; + Vector<Vector3> points = arr[VS::ARRAY_VERTEX]; aabb = AABB(); @@ -48,7 +48,7 @@ void PrimitiveMesh::_update() const { ERR_FAIL_COND(pc == 0); { - PoolVector<Vector3>::Read r = points.read(); + const Vector3 *r = points.ptr(); for (int i = 0; i < pc; i++) { if (i == 0) aabb.position = r[i]; @@ -57,16 +57,16 @@ void PrimitiveMesh::_update() const { } } - PoolVector<int> indices = arr[VS::ARRAY_INDEX]; + Vector<int> indices = arr[VS::ARRAY_INDEX]; if (flip_faces) { - PoolVector<Vector3> normals = arr[VS::ARRAY_NORMAL]; + Vector<Vector3> normals = arr[VS::ARRAY_NORMAL]; if (normals.size() && indices.size()) { { int nc = normals.size(); - PoolVector<Vector3>::Write w = normals.write(); + Vector3 *w = normals.ptrw(); for (int i = 0; i < nc; i++) { w[i] = -w[i]; } @@ -74,7 +74,7 @@ void PrimitiveMesh::_update() const { { int ic = indices.size(); - PoolVector<int>::Write w = indices.write(); + int *w = indices.ptrw(); for (int i = 0; i < ic; i += 3) { SWAP(w[i + 0], w[i + 1]); } @@ -282,11 +282,11 @@ void CapsuleMesh::_create_mesh_array(Array &p_arr) const { // note, this has been aligned with our collision shape but I've left the descriptions as top/middle/bottom - PoolVector<Vector3> points; - PoolVector<Vector3> normals; - PoolVector<float> tangents; - PoolVector<Vector2> uvs; - PoolVector<int> indices; + Vector<Vector3> points; + Vector<Vector3> normals; + Vector<float> tangents; + Vector<Vector2> uvs; + Vector<int> indices; point = 0; #define ADD_TANGENT(m_x, m_y, m_z, m_d) \ @@ -495,11 +495,11 @@ void CubeMesh::_create_mesh_array(Array &p_arr) const { // set our bounding box - PoolVector<Vector3> points; - PoolVector<Vector3> normals; - PoolVector<float> tangents; - PoolVector<Vector2> uvs; - PoolVector<int> indices; + Vector<Vector3> points; + Vector<Vector3> normals; + Vector<float> tangents; + Vector<Vector2> uvs; + Vector<int> indices; point = 0; #define ADD_TANGENT(m_x, m_y, m_z, m_d) \ @@ -746,11 +746,11 @@ void CylinderMesh::_create_mesh_array(Array &p_arr) const { int i, j, prevrow, thisrow, point; float x, y, z, u, v, radius; - PoolVector<Vector3> points; - PoolVector<Vector3> normals; - PoolVector<float> tangents; - PoolVector<Vector2> uvs; - PoolVector<int> indices; + Vector<Vector3> points; + Vector<Vector3> normals; + Vector<float> tangents; + Vector<Vector2> uvs; + Vector<int> indices; point = 0; #define ADD_TANGENT(m_x, m_y, m_z, m_d) \ @@ -962,11 +962,11 @@ void PlaneMesh::_create_mesh_array(Array &p_arr) const { Size2 start_pos = size * -0.5; - PoolVector<Vector3> points; - PoolVector<Vector3> normals; - PoolVector<float> tangents; - PoolVector<Vector2> uvs; - PoolVector<int> indices; + Vector<Vector3> points; + Vector<Vector3> normals; + Vector<float> tangents; + Vector<Vector2> uvs; + Vector<int> indices; point = 0; #define ADD_TANGENT(m_x, m_y, m_z, m_d) \ @@ -1079,11 +1079,11 @@ void PrismMesh::_create_mesh_array(Array &p_arr) const { // set our bounding box - PoolVector<Vector3> points; - PoolVector<Vector3> normals; - PoolVector<float> tangents; - PoolVector<Vector2> uvs; - PoolVector<int> indices; + Vector<Vector3> points; + Vector<Vector3> normals; + Vector<float> tangents; + Vector<Vector2> uvs; + Vector<int> indices; point = 0; #define ADD_TANGENT(m_x, m_y, m_z, m_d) \ @@ -1357,10 +1357,10 @@ PrismMesh::PrismMesh() { */ void QuadMesh::_create_mesh_array(Array &p_arr) const { - PoolVector<Vector3> faces; - PoolVector<Vector3> normals; - PoolVector<float> tangents; - PoolVector<Vector2> uvs; + Vector<Vector3> faces; + Vector<Vector3> normals; + Vector<float> tangents; + Vector<Vector2> uvs; faces.resize(6); normals.resize(6); @@ -1437,11 +1437,11 @@ void SphereMesh::_create_mesh_array(Array &p_arr) const { // set our bounding box - PoolVector<Vector3> points; - PoolVector<Vector3> normals; - PoolVector<float> tangents; - PoolVector<Vector2> uvs; - PoolVector<int> indices; + Vector<Vector3> points; + Vector<Vector3> normals; + Vector<float> tangents; + Vector<Vector2> uvs; + Vector<int> indices; point = 0; #define ADD_TANGENT(m_x, m_y, m_z, m_d) \ @@ -1581,7 +1581,7 @@ SphereMesh::SphereMesh() { */ void PointMesh::_create_mesh_array(Array &p_arr) const { - PoolVector<Vector3> faces; + Vector<Vector3> faces; faces.resize(1); faces.set(0, Vector3(0.0, 0.0, 0.0)); diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index a5475776a7..956cc0bc4a 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -35,7 +35,7 @@ #include "core/project_settings.h" #include "core/version.h" -//version 2: changed names for basis, aabb, poolvectors, etc. +//version 2: changed names for basis, aabb, Vectors, etc. #define FORMAT_VERSION 2 #include "core/os/dir_access.h" diff --git a/scene/resources/shape.cpp b/scene/resources/shape.cpp index b50c68727a..988ff0d4f0 100644 --- a/scene/resources/shape.cpp +++ b/scene/resources/shape.cpp @@ -35,7 +35,7 @@ #include "scene/resources/mesh.h" #include "servers/physics_server.h" -void Shape::add_vertices_to_array(PoolVector<Vector3> &array, const Transform &p_xform) { +void Shape::add_vertices_to_array(Vector<Vector3> &array, const Transform &p_xform) { Vector<Vector3> toadd = get_debug_mesh_lines(); @@ -43,7 +43,7 @@ void Shape::add_vertices_to_array(PoolVector<Vector3> &array, const Transform &p int base = array.size(); array.resize(base + toadd.size()); - PoolVector<Vector3>::Write w = array.write(); + Vector3 *w = array.ptrw(); for (int i = 0; i < toadd.size(); i++) { w[i + base] = p_xform.xform(toadd[i]); } @@ -70,11 +70,11 @@ Ref<ArrayMesh> Shape::get_debug_mesh() { if (!lines.empty()) { //make mesh - PoolVector<Vector3> array; + Vector<Vector3> array; array.resize(lines.size()); { - PoolVector<Vector3>::Write w = array.write(); + Vector3 *w = array.ptrw(); for (int i = 0; i < lines.size(); i++) { w[i] = lines[i]; } diff --git a/scene/resources/shape.h b/scene/resources/shape.h index 227a581c96..e5ccbf7e28 100644 --- a/scene/resources/shape.h +++ b/scene/resources/shape.h @@ -61,7 +61,7 @@ public: /// Returns the radius of a sphere that fully enclose this shape virtual real_t get_enclosing_radius() const = 0; - void add_vertices_to_array(PoolVector<Vector3> &array, const Transform &p_xform); + void add_vertices_to_array(Vector<Vector3> &array, const Transform &p_xform); real_t get_margin() const; void set_margin(real_t p_margin); diff --git a/scene/resources/sky.cpp b/scene/resources/sky.cpp index 3e797a7bde..7a54828639 100644 --- a/scene/resources/sky.cpp +++ b/scene/resources/sky.cpp @@ -130,7 +130,7 @@ Ref<Image> ProceduralSky::_generate_sky() { update_queued = false; - PoolVector<uint8_t> imgdata; + Vector<uint8_t> imgdata; static const int size[TEXTURE_SIZE_MAX] = { 256, 512, 1024, 2048, 4096 @@ -142,9 +142,9 @@ Ref<Image> ProceduralSky::_generate_sky() { imgdata.resize(w * h * 4); //RGBE { - PoolVector<uint8_t>::Write dataw = imgdata.write(); + uint8_t *dataw = imgdata.ptrw(); - uint32_t *ptr = (uint32_t *)dataw.ptr(); + uint32_t *ptr = (uint32_t *)dataw; Color sky_top_linear = sky_top_color.to_linear(); Color sky_horizon_linear = sky_horizon_color.to_linear(); diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index a1e6430255..fc5c906bd4 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -288,9 +288,9 @@ Array SurfaceTool::commit_to_arrays() { case Mesh::ARRAY_VERTEX: case Mesh::ARRAY_NORMAL: { - PoolVector<Vector3> array; + Vector<Vector3> array; array.resize(varr_len); - PoolVector<Vector3>::Write w = array.write(); + Vector3 *w = array.ptrw(); int idx = 0; for (List<Vertex>::Element *E = vertex_array.front(); E; E = E->next(), idx++) { @@ -307,7 +307,6 @@ Array SurfaceTool::commit_to_arrays() { } } - w.release(); a[i] = array; } break; @@ -315,9 +314,9 @@ Array SurfaceTool::commit_to_arrays() { case Mesh::ARRAY_TEX_UV: case Mesh::ARRAY_TEX_UV2: { - PoolVector<Vector2> array; + Vector<Vector2> array; array.resize(varr_len); - PoolVector<Vector2>::Write w = array.write(); + Vector2 *w = array.ptrw(); int idx = 0; for (List<Vertex>::Element *E = vertex_array.front(); E; E = E->next(), idx++) { @@ -335,14 +334,13 @@ Array SurfaceTool::commit_to_arrays() { } } - w.release(); a[i] = array; } break; case Mesh::ARRAY_TANGENT: { - PoolVector<float> array; + Vector<float> array; array.resize(varr_len * 4); - PoolVector<float>::Write w = array.write(); + float *w = array.ptrw(); int idx = 0; for (List<Vertex>::Element *E = vertex_array.front(); E; E = E->next(), idx += 4) { @@ -358,15 +356,14 @@ Array SurfaceTool::commit_to_arrays() { w[idx + 3] = d < 0 ? -1 : 1; } - w.release(); a[i] = array; } break; case Mesh::ARRAY_COLOR: { - PoolVector<Color> array; + Vector<Color> array; array.resize(varr_len); - PoolVector<Color>::Write w = array.write(); + Color *w = array.ptrw(); int idx = 0; for (List<Vertex>::Element *E = vertex_array.front(); E; E = E->next(), idx++) { @@ -375,14 +372,13 @@ Array SurfaceTool::commit_to_arrays() { w[idx] = v.color; } - w.release(); a[i] = array; } break; case Mesh::ARRAY_BONES: { - PoolVector<int> array; + Vector<int> array; array.resize(varr_len * 4); - PoolVector<int>::Write w = array.write(); + int *w = array.ptrw(); int idx = 0; for (List<Vertex>::Element *E = vertex_array.front(); E; E = E->next(), idx += 4) { @@ -396,15 +392,14 @@ Array SurfaceTool::commit_to_arrays() { } } - w.release(); a[i] = array; } break; case Mesh::ARRAY_WEIGHTS: { - PoolVector<float> array; + Vector<float> array; array.resize(varr_len * 4); - PoolVector<float>::Write w = array.write(); + float *w = array.ptrw(); int idx = 0; for (List<Vertex>::Element *E = vertex_array.front(); E; E = E->next(), idx += 4) { @@ -418,7 +413,6 @@ Array SurfaceTool::commit_to_arrays() { } } - w.release(); a[i] = array; } break; @@ -426,9 +420,9 @@ Array SurfaceTool::commit_to_arrays() { ERR_CONTINUE(index_array.size() == 0); - PoolVector<int> array; + Vector<int> array; array.resize(index_array.size()); - PoolVector<int>::Write w = array.write(); + int *w = array.ptrw(); int idx = 0; for (List<int>::Element *E = index_array.front(); E; E = E->next(), idx++) { @@ -436,8 +430,6 @@ Array SurfaceTool::commit_to_arrays() { w[idx] = E->get(); } - w.release(); - a[i] = array; } break; @@ -535,14 +527,14 @@ Vector<SurfaceTool::Vertex> SurfaceTool::create_vertex_array_from_triangle_array Vector<SurfaceTool::Vertex> ret; - PoolVector<Vector3> varr = p_arrays[VS::ARRAY_VERTEX]; - PoolVector<Vector3> narr = p_arrays[VS::ARRAY_NORMAL]; - PoolVector<float> tarr = p_arrays[VS::ARRAY_TANGENT]; - PoolVector<Color> carr = p_arrays[VS::ARRAY_COLOR]; - PoolVector<Vector2> uvarr = p_arrays[VS::ARRAY_TEX_UV]; - PoolVector<Vector2> uv2arr = p_arrays[VS::ARRAY_TEX_UV2]; - PoolVector<int> barr = p_arrays[VS::ARRAY_BONES]; - PoolVector<float> warr = p_arrays[VS::ARRAY_WEIGHTS]; + Vector<Vector3> varr = p_arrays[VS::ARRAY_VERTEX]; + Vector<Vector3> narr = p_arrays[VS::ARRAY_NORMAL]; + Vector<float> tarr = p_arrays[VS::ARRAY_TANGENT]; + Vector<Color> carr = p_arrays[VS::ARRAY_COLOR]; + Vector<Vector2> uvarr = p_arrays[VS::ARRAY_TEX_UV]; + Vector<Vector2> uv2arr = p_arrays[VS::ARRAY_TEX_UV2]; + Vector<int> barr = p_arrays[VS::ARRAY_BONES]; + Vector<float> warr = p_arrays[VS::ARRAY_WEIGHTS]; int vc = varr.size(); @@ -550,49 +542,49 @@ Vector<SurfaceTool::Vertex> SurfaceTool::create_vertex_array_from_triangle_array return ret; int lformat = 0; - PoolVector<Vector3>::Read rv; + const Vector3 *rv; if (varr.size()) { lformat |= VS::ARRAY_FORMAT_VERTEX; - rv = varr.read(); + rv = varr.ptr(); } - PoolVector<Vector3>::Read rn; + const Vector3 *rn; if (narr.size()) { lformat |= VS::ARRAY_FORMAT_NORMAL; - rn = narr.read(); + rn = narr.ptr(); } - PoolVector<float>::Read rt; + const float *rt; if (tarr.size()) { lformat |= VS::ARRAY_FORMAT_TANGENT; - rt = tarr.read(); + rt = tarr.ptr(); } - PoolVector<Color>::Read rc; + const Color *rc; if (carr.size()) { lformat |= VS::ARRAY_FORMAT_COLOR; - rc = carr.read(); + rc = carr.ptr(); } - PoolVector<Vector2>::Read ruv; + const Vector2 *ruv; if (uvarr.size()) { lformat |= VS::ARRAY_FORMAT_TEX_UV; - ruv = uvarr.read(); + ruv = uvarr.ptr(); } - PoolVector<Vector2>::Read ruv2; + const Vector2 *ruv2; if (uv2arr.size()) { lformat |= VS::ARRAY_FORMAT_TEX_UV2; - ruv2 = uv2arr.read(); + ruv2 = uv2arr.ptr(); } - PoolVector<int>::Read rb; + const int *rb; if (barr.size()) { lformat |= VS::ARRAY_FORMAT_BONES; - rb = barr.read(); + rb = barr.ptr(); } - PoolVector<float>::Read rw; + const float *rw; if (warr.size()) { lformat |= VS::ARRAY_FORMAT_WEIGHTS; - rw = warr.read(); + rw = warr.ptr(); } for (int i = 0; i < vc; i++) { @@ -640,14 +632,14 @@ Vector<SurfaceTool::Vertex> SurfaceTool::create_vertex_array_from_triangle_array void SurfaceTool::_create_list_from_arrays(Array arr, List<Vertex> *r_vertex, List<int> *r_index, int &lformat) { - PoolVector<Vector3> varr = arr[VS::ARRAY_VERTEX]; - PoolVector<Vector3> narr = arr[VS::ARRAY_NORMAL]; - PoolVector<float> tarr = arr[VS::ARRAY_TANGENT]; - PoolVector<Color> carr = arr[VS::ARRAY_COLOR]; - PoolVector<Vector2> uvarr = arr[VS::ARRAY_TEX_UV]; - PoolVector<Vector2> uv2arr = arr[VS::ARRAY_TEX_UV2]; - PoolVector<int> barr = arr[VS::ARRAY_BONES]; - PoolVector<float> warr = arr[VS::ARRAY_WEIGHTS]; + Vector<Vector3> varr = arr[VS::ARRAY_VERTEX]; + Vector<Vector3> narr = arr[VS::ARRAY_NORMAL]; + Vector<float> tarr = arr[VS::ARRAY_TANGENT]; + Vector<Color> carr = arr[VS::ARRAY_COLOR]; + Vector<Vector2> uvarr = arr[VS::ARRAY_TEX_UV]; + Vector<Vector2> uv2arr = arr[VS::ARRAY_TEX_UV2]; + Vector<int> barr = arr[VS::ARRAY_BONES]; + Vector<float> warr = arr[VS::ARRAY_WEIGHTS]; int vc = varr.size(); @@ -655,49 +647,49 @@ void SurfaceTool::_create_list_from_arrays(Array arr, List<Vertex> *r_vertex, Li return; lformat = 0; - PoolVector<Vector3>::Read rv; + const Vector3 *rv; if (varr.size()) { lformat |= VS::ARRAY_FORMAT_VERTEX; - rv = varr.read(); + rv = varr.ptr(); } - PoolVector<Vector3>::Read rn; + const Vector3 *rn; if (narr.size()) { lformat |= VS::ARRAY_FORMAT_NORMAL; - rn = narr.read(); + rn = narr.ptr(); } - PoolVector<float>::Read rt; + const float *rt; if (tarr.size()) { lformat |= VS::ARRAY_FORMAT_TANGENT; - rt = tarr.read(); + rt = tarr.ptr(); } - PoolVector<Color>::Read rc; + const Color *rc; if (carr.size()) { lformat |= VS::ARRAY_FORMAT_COLOR; - rc = carr.read(); + rc = carr.ptr(); } - PoolVector<Vector2>::Read ruv; + const Vector2 *ruv; if (uvarr.size()) { lformat |= VS::ARRAY_FORMAT_TEX_UV; - ruv = uvarr.read(); + ruv = uvarr.ptr(); } - PoolVector<Vector2>::Read ruv2; + const Vector2 *ruv2; if (uv2arr.size()) { lformat |= VS::ARRAY_FORMAT_TEX_UV2; - ruv2 = uv2arr.read(); + ruv2 = uv2arr.ptr(); } - PoolVector<int>::Read rb; + const int *rb; if (barr.size()) { lformat |= VS::ARRAY_FORMAT_BONES; - rb = barr.read(); + rb = barr.ptr(); } - PoolVector<float>::Read rw; + const float *rw; if (warr.size()) { lformat |= VS::ARRAY_FORMAT_WEIGHTS; - rw = warr.read(); + rw = warr.ptr(); } for (int i = 0; i < vc; i++) { @@ -742,12 +734,12 @@ void SurfaceTool::_create_list_from_arrays(Array arr, List<Vertex> *r_vertex, Li //indices - PoolVector<int> idx = arr[VS::ARRAY_INDEX]; + Vector<int> idx = arr[VS::ARRAY_INDEX]; int is = idx.size(); if (is) { lformat |= VS::ARRAY_FORMAT_INDEX; - PoolVector<int>::Read iarr = idx.read(); + const int *iarr = idx.ptr(); for (int i = 0; i < is; i++) { r_index->push_back(iarr[i]); } diff --git a/scene/resources/text_file.cpp b/scene/resources/text_file.cpp index af55d2dde3..e291dcb67e 100644 --- a/scene/resources/text_file.cpp +++ b/scene/resources/text_file.cpp @@ -50,7 +50,7 @@ void TextFile::reload_from_file() { Error TextFile::load_text(const String &p_path) { - PoolVector<uint8_t> sourcef; + Vector<uint8_t> sourcef; Error err; FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err); @@ -58,15 +58,15 @@ Error TextFile::load_text(const String &p_path) { int len = f->get_len(); sourcef.resize(len + 1); - PoolVector<uint8_t>::Write w = sourcef.write(); - int r = f->get_buffer(w.ptr(), len); + uint8_t *w = sourcef.ptrw(); + int r = f->get_buffer(w, len); f->close(); memdelete(f); ERR_FAIL_COND_V(r != len, ERR_CANT_OPEN); w[len] = 0; String s; - ERR_FAIL_COND_V_MSG(s.parse_utf8((const char *)w.ptr()), ERR_INVALID_DATA, "Script '" + p_path + "' contains invalid unicode (UTF-8), so it was not loaded. Please ensure that scripts are saved in valid UTF-8 unicode."); + ERR_FAIL_COND_V_MSG(s.parse_utf8((const char *)w), ERR_INVALID_DATA, "Script '" + p_path + "' contains invalid unicode (UTF-8), so it was not loaded. Please ensure that scripts are saved in valid UTF-8 unicode."); text = s; path = p_path; return OK; diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index ff9c786b4c..60a9ca8f0f 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -388,11 +388,11 @@ Ref<Image> StreamTexture::load_image_from_file(FileAccess *f, int p_size_limit) continue; } - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; pv.resize(size); { - PoolVector<uint8_t>::Write wr = pv.write(); - f->get_buffer(wr.ptr(), size); + uint8_t *wr = pv.ptrw(); + f->get_buffer(wr, size); } Ref<Image> img; @@ -438,19 +438,19 @@ Ref<Image> StreamTexture::load_image_from_file(FileAccess *f, int p_size_limit) } else { //rarer use case, but needs to be supported - PoolVector<uint8_t> img_data; + Vector<uint8_t> img_data; img_data.resize(total_size); { - PoolVector<uint8_t>::Write wr = img_data.write(); + uint8_t *wr = img_data.ptrw(); int ofs = 0; for (int i = 0; i < mipmap_images.size(); i++) { - PoolVector<uint8_t> id = mipmap_images[i]->get_data(); + Vector<uint8_t> id = mipmap_images[i]->get_data(); int len = id.size(); - PoolVector<uint8_t>::Read r = id.read(); - copymem(&wr[ofs], r.ptr(), len); + const uint8_t *r = id.ptr(); + copymem(&wr[ofs], r, len); ofs += len; } } @@ -474,12 +474,12 @@ Ref<Image> StreamTexture::load_image_from_file(FileAccess *f, int p_size_limit) continue; //oops, size limit enforced, go to next } - PoolVector<uint8_t> data; + Vector<uint8_t> data; data.resize(size - ofs); { - PoolVector<uint8_t>::Write wr = data.write(); - f->get_buffer(wr.ptr(), data.size()); + uint8_t *wr = data.ptrw(); + f->get_buffer(wr, data.size()); } Ref<Image> image; @@ -1422,13 +1422,13 @@ void CurveTexture::set_curve(Ref<Curve> p_curve) { void CurveTexture::_update() { - PoolVector<uint8_t> data; + Vector<uint8_t> data; data.resize(_width * sizeof(float)); // The array is locked in that scope { - PoolVector<uint8_t>::Write wd8 = data.write(); - float *wd = (float *)wd8.ptr(); + uint8_t *wd8 = data.ptrw(); + float *wd = (float *)wd8; if (_curve.is_valid()) { Curve &curve = **_curve; @@ -1545,10 +1545,10 @@ void GradientTexture::_update() { if (gradient.is_null()) return; - PoolVector<uint8_t> data; + Vector<uint8_t> data; data.resize(width * 4); { - PoolVector<uint8_t>::Write wd8 = data.write(); + uint8_t *wd8 = data.ptrw(); Gradient &g = **gradient; for (int i = 0; i < width; i++) { @@ -2096,11 +2096,11 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String for (int i = 0; i < mipmaps; i++) { uint32_t size = f->get_32(); - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; pv.resize(size); { - PoolVector<uint8_t>::Write w = pv.write(); - f->get_buffer(w.ptr(), size); + uint8_t *w = pv.ptrw(); + f->get_buffer(w, size); } Ref<Image> img = Image::lossless_unpacker(pv); @@ -2123,19 +2123,19 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String } else { int total_size = Image::get_image_data_size(tw, th, format, true); - PoolVector<uint8_t> img_data; + Vector<uint8_t> img_data; img_data.resize(total_size); { - PoolVector<uint8_t>::Write w = img_data.write(); + uint8_t *w = img_data.ptrw(); int ofs = 0; for (int i = 0; i < mipmap_images.size(); i++) { - PoolVector<uint8_t> id = mipmap_images[i]->get_data(); + Vector<uint8_t> id = mipmap_images[i]->get_data(); int len = id.size(); - PoolVector<uint8_t>::Read r = id.read(); - copymem(&w[ofs], r.ptr(), len); + const uint8_t *r = id.ptr(); + copymem(&w[ofs], r, len); ofs += len; } } @@ -2157,12 +2157,12 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String int total_size = Image::get_image_data_size(tw, th, format, use_mipmaps); - PoolVector<uint8_t> img_data; + Vector<uint8_t> img_data; img_data.resize(total_size); { - PoolVector<uint8_t>::Write w = img_data.write(); - int bytes = f->get_buffer(w.ptr(), total_size); + uint8_t *w = img_data.ptrw(); + int bytes = f->get_buffer(w, total_size); if (bytes != total_size) { if (r_error) { *r_error = ERR_FILE_CORRUPT; diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index 75903c1383..aa05e41b16 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -37,112 +37,112 @@ void Theme::_emit_theme_changed() { emit_changed(); } -PoolVector<String> Theme::_get_icon_list(const String &p_type) const { +Vector<String> Theme::_get_icon_list(const String &p_type) const { - PoolVector<String> ilret; + Vector<String> ilret; List<StringName> il; get_icon_list(p_type, &il); ilret.resize(il.size()); int i = 0; - PoolVector<String>::Write w = ilret.write(); + String *w = ilret.ptrw(); for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) { w[i] = E->get(); } return ilret; } -PoolVector<String> Theme::_get_stylebox_list(const String &p_type) const { +Vector<String> Theme::_get_stylebox_list(const String &p_type) const { - PoolVector<String> ilret; + Vector<String> ilret; List<StringName> il; get_stylebox_list(p_type, &il); ilret.resize(il.size()); int i = 0; - PoolVector<String>::Write w = ilret.write(); + String *w = ilret.ptrw(); for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) { w[i] = E->get(); } return ilret; } -PoolVector<String> Theme::_get_stylebox_types(void) const { +Vector<String> Theme::_get_stylebox_types(void) const { - PoolVector<String> ilret; + Vector<String> ilret; List<StringName> il; get_stylebox_types(&il); ilret.resize(il.size()); int i = 0; - PoolVector<String>::Write w = ilret.write(); + String *w = ilret.ptrw(); for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) { w[i] = E->get(); } return ilret; } -PoolVector<String> Theme::_get_font_list(const String &p_type) const { +Vector<String> Theme::_get_font_list(const String &p_type) const { - PoolVector<String> ilret; + Vector<String> ilret; List<StringName> il; get_font_list(p_type, &il); ilret.resize(il.size()); int i = 0; - PoolVector<String>::Write w = ilret.write(); + String *w = ilret.ptrw(); for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) { w[i] = E->get(); } return ilret; } -PoolVector<String> Theme::_get_color_list(const String &p_type) const { +Vector<String> Theme::_get_color_list(const String &p_type) const { - PoolVector<String> ilret; + Vector<String> ilret; List<StringName> il; get_color_list(p_type, &il); ilret.resize(il.size()); int i = 0; - PoolVector<String>::Write w = ilret.write(); + String *w = ilret.ptrw(); for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) { w[i] = E->get(); } return ilret; } -PoolVector<String> Theme::_get_constant_list(const String &p_type) const { +Vector<String> Theme::_get_constant_list(const String &p_type) const { - PoolVector<String> ilret; + Vector<String> ilret; List<StringName> il; get_constant_list(p_type, &il); ilret.resize(il.size()); int i = 0; - PoolVector<String>::Write w = ilret.write(); + String *w = ilret.ptrw(); for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) { w[i] = E->get(); } return ilret; } -PoolVector<String> Theme::_get_type_list(const String &p_type) const { +Vector<String> Theme::_get_type_list(const String &p_type) const { - PoolVector<String> ilret; + Vector<String> ilret; List<StringName> il; get_type_list(&il); ilret.resize(il.size()); int i = 0; - PoolVector<String>::Write w = ilret.write(); + String *w = ilret.ptrw(); for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) { w[i] = E->get(); } diff --git a/scene/resources/theme.h b/scene/resources/theme.h index e60734b144..3d01f71ea0 100644 --- a/scene/resources/theme.h +++ b/scene/resources/theme.h @@ -52,13 +52,13 @@ class Theme : public Resource { HashMap<StringName, HashMap<StringName, Color> > color_map; HashMap<StringName, HashMap<StringName, int> > constant_map; - PoolVector<String> _get_icon_list(const String &p_type) const; - PoolVector<String> _get_stylebox_list(const String &p_type) const; - PoolVector<String> _get_stylebox_types(void) const; - PoolVector<String> _get_font_list(const String &p_type) const; - PoolVector<String> _get_color_list(const String &p_type) const; - PoolVector<String> _get_constant_list(const String &p_type) const; - PoolVector<String> _get_type_list(const String &p_type) const; + Vector<String> _get_icon_list(const String &p_type) const; + Vector<String> _get_stylebox_list(const String &p_type) const; + Vector<String> _get_stylebox_types(void) const; + Vector<String> _get_font_list(const String &p_type) const; + Vector<String> _get_color_list(const String &p_type) const; + Vector<String> _get_constant_list(const String &p_type) const; + Vector<String> _get_type_list(const String &p_type) const; protected: bool _set(const StringName &p_name, const Variant &p_value); diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index f80fe9f791..38b7c5cda0 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -1050,7 +1050,7 @@ void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back(PropertyInfo(Variant::STRING, prop_name + "/expression", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); } } - p_list->push_back(PropertyInfo(Variant::POOL_INT_ARRAY, "nodes/" + String(type_string[i]) + "/connections", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); + p_list->push_back(PropertyInfo(Variant::PACKED_INT_ARRAY, "nodes/" + String(type_string[i]) + "/connections", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); } } |