summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/canvas_item.cpp4
-rw-r--r--scene/2d/collision_polygon_2d.cpp7
-rw-r--r--scene/2d/cpu_particles_2d.cpp54
-rw-r--r--scene/2d/cpu_particles_2d.h24
-rw-r--r--scene/2d/light_occluder_2d.cpp14
-rw-r--r--scene/2d/light_occluder_2d.h6
-rw-r--r--scene/2d/line_2d.cpp12
-rw-r--r--scene/2d/line_2d.h6
-rw-r--r--scene/2d/navigation_polygon.cpp44
-rw-r--r--scene/2d/navigation_polygon.h16
-rw-r--r--scene/2d/polygon_2d.cpp40
-rw-r--r--scene/2d/polygon_2d.h26
-rw-r--r--scene/2d/tile_map.cpp16
-rw-r--r--scene/2d/tile_map.h4
14 files changed, 135 insertions, 138 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; }