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 | |
parent | fb8c93c10b4b73d5f18f1ed287497728800e22b5 (diff) |
PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
406 files changed, 5210 insertions, 8167 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index d7614c5a82..583a44846f 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -77,11 +77,11 @@ RES _ResourceLoader::load(const String &p_path, const String &p_type_hint, bool return ret; } -PoolVector<String> _ResourceLoader::get_recognized_extensions_for_type(const String &p_type) { +Vector<String> _ResourceLoader::get_recognized_extensions_for_type(const String &p_type) { List<String> exts; ResourceLoader::get_recognized_extensions_for_type(p_type, &exts); - PoolVector<String> ret; + Vector<String> ret; for (List<String>::Element *E = exts.front(); E; E = E->next()) { ret.push_back(E->get()); @@ -95,12 +95,12 @@ void _ResourceLoader::set_abort_on_missing_resources(bool p_abort) { ResourceLoader::set_abort_on_missing_resources(p_abort); } -PoolStringArray _ResourceLoader::get_dependencies(const String &p_path) { +PackedStringArray _ResourceLoader::get_dependencies(const String &p_path) { List<String> deps; ResourceLoader::get_dependencies(p_path, &deps); - PoolStringArray ret; + PackedStringArray ret; for (List<String>::Element *E = deps.front(); E; E = E->next()) { ret.push_back(E->get()); } @@ -139,12 +139,12 @@ Error _ResourceSaver::save(const String &p_path, const RES &p_resource, SaverFla return ResourceSaver::save(p_path, p_resource, p_flags); } -PoolVector<String> _ResourceSaver::get_recognized_extensions(const RES &p_resource) { +Vector<String> _ResourceSaver::get_recognized_extensions(const RES &p_resource) { - ERR_FAIL_COND_V_MSG(p_resource.is_null(), PoolVector<String>(), "It's not a reference to a valid Resource object."); + ERR_FAIL_COND_V_MSG(p_resource.is_null(), Vector<String>(), "It's not a reference to a valid Resource object."); List<String> exts; ResourceSaver::get_recognized_extensions(p_resource, &exts); - PoolVector<String> ret; + Vector<String> ret; for (List<String>::Element *E = exts.front(); E; E = E->next()) { ret.push_back(E->get()); @@ -249,7 +249,7 @@ String _OS::get_audio_driver_name(int p_driver) const { return OS::get_singleton()->get_audio_driver_name(p_driver); } -PoolStringArray _OS::get_connected_midi_inputs() { +PackedStringArray _OS::get_connected_midi_inputs() { return OS::get_singleton()->get_connected_midi_inputs(); } @@ -646,11 +646,6 @@ uint64_t _OS::get_static_memory_peak_usage() const { return OS::get_singleton()->get_static_memory_peak_usage(); } -uint64_t _OS::get_dynamic_memory_usage() const { - - return OS::get_singleton()->get_dynamic_memory_usage(); -} - void _OS::set_native_icon(const String &p_filename) { OS::get_singleton()->set_native_icon(p_filename); @@ -1301,7 +1296,6 @@ void _OS::_bind_methods() { ClassDB::bind_method(D_METHOD("get_static_memory_usage"), &_OS::get_static_memory_usage); ClassDB::bind_method(D_METHOD("get_static_memory_peak_usage"), &_OS::get_static_memory_peak_usage); - ClassDB::bind_method(D_METHOD("get_dynamic_memory_usage"), &_OS::get_dynamic_memory_usage); ClassDB::bind_method(D_METHOD("get_user_data_dir"), &_OS::get_user_data_dir); ClassDB::bind_method(D_METHOD("get_system_dir", "dir"), &_OS::get_system_dir); @@ -1439,16 +1433,16 @@ _Geometry *_Geometry::get_singleton() { return singleton; } -PoolVector<Plane> _Geometry::build_box_planes(const Vector3 &p_extents) { +Vector<Plane> _Geometry::build_box_planes(const Vector3 &p_extents) { return Geometry::build_box_planes(p_extents); } -PoolVector<Plane> _Geometry::build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis) { +Vector<Plane> _Geometry::build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis) { return Geometry::build_cylinder_planes(p_radius, p_height, p_sides, p_axis); } -PoolVector<Plane> _Geometry::build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis) { +Vector<Plane> _Geometry::build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis) { return Geometry::build_capsule_planes(p_radius, p_height, p_sides, p_lats, p_axis); } @@ -1484,22 +1478,22 @@ Variant _Geometry::line_intersects_line_2d(const Vector2 &p_from_a, const Vector } } -PoolVector<Vector2> _Geometry::get_closest_points_between_segments_2d(const Vector2 &p1, const Vector2 &q1, const Vector2 &p2, const Vector2 &q2) { +Vector<Vector2> _Geometry::get_closest_points_between_segments_2d(const Vector2 &p1, const Vector2 &q1, const Vector2 &p2, const Vector2 &q2) { Vector2 r1, r2; Geometry::get_closest_points_between_segments(p1, q1, p2, q2, r1, r2); - PoolVector<Vector2> r; + Vector<Vector2> r; r.resize(2); r.set(0, r1); r.set(1, r2); return r; } -PoolVector<Vector3> _Geometry::get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2) { +Vector<Vector3> _Geometry::get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2) { Vector3 r1, r2; Geometry::get_closest_points_between_segments(p1, p2, q1, q2, r1, r2); - PoolVector<Vector3> r; + Vector<Vector3> r; r.resize(2); r.set(0, r1); r.set(1, r2); @@ -1547,9 +1541,9 @@ bool _Geometry::point_is_inside_triangle(const Vector2 &s, const Vector2 &a, con return Geometry::is_point_in_triangle(s, a, b, c); } -PoolVector<Vector3> _Geometry::segment_intersects_sphere(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_sphere_pos, real_t p_sphere_radius) { +Vector<Vector3> _Geometry::segment_intersects_sphere(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_sphere_pos, real_t p_sphere_radius) { - PoolVector<Vector3> r; + Vector<Vector3> r; Vector3 res, norm; if (!Geometry::segment_intersects_sphere(p_from, p_to, p_sphere_pos, p_sphere_radius, &res, &norm)) return r; @@ -1559,9 +1553,9 @@ PoolVector<Vector3> _Geometry::segment_intersects_sphere(const Vector3 &p_from, r.set(1, norm); return r; } -PoolVector<Vector3> _Geometry::segment_intersects_cylinder(const Vector3 &p_from, const Vector3 &p_to, float p_height, float p_radius) { +Vector<Vector3> _Geometry::segment_intersects_cylinder(const Vector3 &p_from, const Vector3 &p_to, float p_height, float p_radius) { - PoolVector<Vector3> r; + Vector<Vector3> r; Vector3 res, norm; if (!Geometry::segment_intersects_cylinder(p_from, p_to, p_height, p_radius, &res, &norm)) return r; @@ -1571,9 +1565,9 @@ PoolVector<Vector3> _Geometry::segment_intersects_cylinder(const Vector3 &p_from r.set(1, norm); return r; } -PoolVector<Vector3> _Geometry::segment_intersects_convex(const Vector3 &p_from, const Vector3 &p_to, const Vector<Plane> &p_planes) { +Vector<Vector3> _Geometry::segment_intersects_convex(const Vector3 &p_from, const Vector3 &p_to, const Vector<Plane> &p_planes) { - PoolVector<Vector3> r; + Vector<Vector3> r; Vector3 res, norm; if (!Geometry::segment_intersects_convex(p_from, p_to, p_planes.ptr(), p_planes.size(), &res, &norm)) return r; @@ -1962,9 +1956,9 @@ real_t _File::get_real() const { return f->get_real(); } -PoolVector<uint8_t> _File::get_buffer(int p_length) const { +Vector<uint8_t> _File::get_buffer(int p_length) const { - PoolVector<uint8_t> data; + Vector<uint8_t> data; ERR_FAIL_COND_V_MSG(!f, data, "File must be opened before use."); ERR_FAIL_COND_V_MSG(p_length < 0, data, "Length of buffer cannot be smaller than 0."); @@ -1974,11 +1968,9 @@ PoolVector<uint8_t> _File::get_buffer(int p_length) const { Error err = data.resize(p_length); ERR_FAIL_COND_V_MSG(err != OK, data, "Can't resize data to " + itos(p_length) + " elements."); - PoolVector<uint8_t>::Write w = data.write(); + uint8_t *w = data.ptrw(); int len = f->get_buffer(&w[0], p_length); - ERR_FAIL_COND_V(len < 0, PoolVector<uint8_t>()); - - w.release(); + ERR_FAIL_COND_V(len < 0, Vector<uint8_t>()); if (len < p_length) data.resize(p_length); @@ -2126,7 +2118,7 @@ void _File::store_csv_line(const Vector<String> &p_values, const String &p_delim f->store_csv_line(p_values, p_delim); } -void _File::store_buffer(const PoolVector<uint8_t> &p_buffer) { +void _File::store_buffer(const Vector<uint8_t> &p_buffer) { ERR_FAIL_COND_MSG(!f, "File must be opened before use."); @@ -2134,7 +2126,7 @@ void _File::store_buffer(const PoolVector<uint8_t> &p_buffer) { if (len == 0) return; - PoolVector<uint8_t>::Read r = p_buffer.read(); + const uint8_t *r = p_buffer.ptr(); f->store_buffer(&r[0], len); } @@ -2151,13 +2143,12 @@ void _File::store_var(const Variant &p_var, bool p_full_objects) { Error err = encode_variant(p_var, NULL, len, p_full_objects); ERR_FAIL_COND_MSG(err != OK, "Error when trying to encode Variant."); - PoolVector<uint8_t> buff; + Vector<uint8_t> buff; buff.resize(len); - PoolVector<uint8_t>::Write w = buff.write(); + uint8_t *w = buff.ptrw(); err = encode_variant(p_var, &w[0], len, p_full_objects); ERR_FAIL_COND_MSG(err != OK, "Error when trying to encode Variant."); - w.release(); store_32(len); store_buffer(buff); @@ -2167,10 +2158,10 @@ Variant _File::get_var(bool p_allow_objects) const { ERR_FAIL_COND_V_MSG(!f, Variant(), "File must be opened before use."); uint32_t len = get_32(); - PoolVector<uint8_t> buff = get_buffer(len); + Vector<uint8_t> buff = get_buffer(len); ERR_FAIL_COND_V((uint32_t)buff.size() != len, Variant()); - PoolVector<uint8_t>::Read r = buff.read(); + const uint8_t *r = buff.ptr(); Variant v; Error err = decode_variant(v, &r[0], len, NULL, p_allow_objects); @@ -2465,9 +2456,9 @@ String _Marshalls::variant_to_base64(const Variant &p_var, bool p_full_objects) Error err = encode_variant(p_var, NULL, len, p_full_objects); ERR_FAIL_COND_V_MSG(err != OK, "", "Error when trying to encode Variant."); - PoolVector<uint8_t> buff; + Vector<uint8_t> buff; buff.resize(len); - PoolVector<uint8_t>::Write w = buff.write(); + uint8_t *w = buff.ptrw(); err = encode_variant(p_var, &w[0], len, p_full_objects); ERR_FAIL_COND_V_MSG(err != OK, "", "Error when trying to encode Variant."); @@ -2483,9 +2474,9 @@ Variant _Marshalls::base64_to_variant(const String &p_str, bool p_allow_objects) int strlen = p_str.length(); CharString cstr = p_str.ascii(); - PoolVector<uint8_t> buf; + Vector<uint8_t> buf; buf.resize(strlen / 4 * 3 + 1); - PoolVector<uint8_t>::Write w = buf.write(); + uint8_t *w = buf.ptrw(); size_t len = 0; ERR_FAIL_COND_V(CryptoCore::b64_decode(&w[0], buf.size(), &len, (unsigned char *)cstr.get_data(), strlen) != OK, Variant()); @@ -2497,25 +2488,25 @@ Variant _Marshalls::base64_to_variant(const String &p_str, bool p_allow_objects) return v; }; -String _Marshalls::raw_to_base64(const PoolVector<uint8_t> &p_arr) { +String _Marshalls::raw_to_base64(const Vector<uint8_t> &p_arr) { - String ret = CryptoCore::b64_encode_str(p_arr.read().ptr(), p_arr.size()); + String ret = CryptoCore::b64_encode_str(p_arr.ptr(), p_arr.size()); ERR_FAIL_COND_V(ret == "", ret); return ret; }; -PoolVector<uint8_t> _Marshalls::base64_to_raw(const String &p_str) { +Vector<uint8_t> _Marshalls::base64_to_raw(const String &p_str) { int strlen = p_str.length(); CharString cstr = p_str.ascii(); size_t arr_len = 0; - PoolVector<uint8_t> buf; + Vector<uint8_t> buf; { buf.resize(strlen / 4 * 3 + 1); - PoolVector<uint8_t>::Write w = buf.write(); + uint8_t *w = buf.ptrw(); - ERR_FAIL_COND_V(CryptoCore::b64_decode(&w[0], buf.size(), &arr_len, (unsigned char *)cstr.get_data(), strlen) != OK, PoolVector<uint8_t>()); + ERR_FAIL_COND_V(CryptoCore::b64_decode(&w[0], buf.size(), &arr_len, (unsigned char *)cstr.get_data(), strlen) != OK, Vector<uint8_t>()); } buf.resize(arr_len); @@ -2535,9 +2526,9 @@ String _Marshalls::base64_to_utf8(const String &p_str) { int strlen = p_str.length(); CharString cstr = p_str.ascii(); - PoolVector<uint8_t> buf; + Vector<uint8_t> buf; buf.resize(strlen / 4 * 3 + 1 + 1); - PoolVector<uint8_t>::Write w = buf.write(); + uint8_t *w = buf.ptrw(); size_t len = 0; ERR_FAIL_COND_V(CryptoCore::b64_decode(&w[0], buf.size(), &len, (unsigned char *)cstr.get_data(), strlen) != OK, String()); @@ -2746,12 +2737,12 @@ _Thread::~_Thread() { ///////////////////////////////////// -PoolStringArray _ClassDB::get_class_list() const { +PackedStringArray _ClassDB::get_class_list() const { List<StringName> classes; ClassDB::get_class_list(&classes); - PoolStringArray ret; + PackedStringArray ret; ret.resize(classes.size()); int idx = 0; for (List<StringName>::Element *E = classes.front(); E; E = E->next()) { @@ -2760,12 +2751,12 @@ PoolStringArray _ClassDB::get_class_list() const { return ret; } -PoolStringArray _ClassDB::get_inheriters_from_class(const StringName &p_class) const { +PackedStringArray _ClassDB::get_inheriters_from_class(const StringName &p_class) const { List<StringName> classes; ClassDB::get_inheriters_from_class(p_class, &classes); - PoolStringArray ret; + PackedStringArray ret; ret.resize(classes.size()); int idx = 0; for (List<StringName>::Element *E = classes.front(); E; E = E->next()) { @@ -2883,12 +2874,12 @@ Array _ClassDB::get_method_list(StringName p_class, bool p_no_inheritance) const return ret; } -PoolStringArray _ClassDB::get_integer_constant_list(const StringName &p_class, bool p_no_inheritance) const { +PackedStringArray _ClassDB::get_integer_constant_list(const StringName &p_class, bool p_no_inheritance) const { List<String> constants; ClassDB::get_integer_constant_list(p_class, &constants, p_no_inheritance); - PoolStringArray ret; + PackedStringArray ret; ret.resize(constants.size()); int idx = 0; for (List<String>::Element *E = constants.front(); E; E = E->next()) { diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 39bed791d0..342c43802e 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -52,9 +52,9 @@ public: static _ResourceLoader *get_singleton() { return singleton; } Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, const String &p_type_hint = ""); RES load(const String &p_path, const String &p_type_hint = "", bool p_no_cache = false); - PoolVector<String> get_recognized_extensions_for_type(const String &p_type); + Vector<String> get_recognized_extensions_for_type(const String &p_type); void set_abort_on_missing_resources(bool p_abort); - PoolStringArray get_dependencies(const String &p_path); + PackedStringArray get_dependencies(const String &p_path); bool has_cached(const String &p_path); bool exists(const String &p_path, const String &p_type_hint = ""); @@ -83,7 +83,7 @@ public: static _ResourceSaver *get_singleton() { return singleton; } Error save(const String &p_path, const RES &p_resource, SaverFlags p_flags); - PoolVector<String> get_recognized_extensions(const RES &p_resource); + Vector<String> get_recognized_extensions(const RES &p_resource); _ResourceSaver(); }; @@ -157,7 +157,7 @@ public: virtual int get_audio_driver_count() const; virtual String get_audio_driver_name(int p_driver) const; - virtual PoolStringArray get_connected_midi_inputs(); + virtual PackedStringArray get_connected_midi_inputs(); virtual void open_midi_inputs(); virtual void close_midi_inputs(); @@ -276,7 +276,6 @@ public: uint64_t get_static_memory_usage() const; uint64_t get_static_memory_peak_usage() const; - uint64_t get_dynamic_memory_usage() const; void delay_usec(uint32_t p_usec) const; void delay_msec(uint32_t p_msec) const; @@ -366,13 +365,13 @@ protected: public: static _Geometry *get_singleton(); - PoolVector<Plane> build_box_planes(const Vector3 &p_extents); - PoolVector<Plane> build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis = Vector3::AXIS_Z); - PoolVector<Plane> build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis = Vector3::AXIS_Z); + Vector<Plane> build_box_planes(const Vector3 &p_extents); + Vector<Plane> build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis = Vector3::AXIS_Z); + Vector<Plane> build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis = Vector3::AXIS_Z); Variant segment_intersects_segment_2d(const Vector2 &p_from_a, const Vector2 &p_to_a, const Vector2 &p_from_b, const Vector2 &p_to_b); Variant line_intersects_line_2d(const Vector2 &p_from_a, const Vector2 &p_dir_a, const Vector2 &p_from_b, const Vector2 &p_dir_b); - PoolVector<Vector2> get_closest_points_between_segments_2d(const Vector2 &p1, const Vector2 &q1, const Vector2 &p2, const Vector2 &q2); - PoolVector<Vector3> get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2); + Vector<Vector2> get_closest_points_between_segments_2d(const Vector2 &p1, const Vector2 &q1, const Vector2 &p2, const Vector2 &q2); + Vector<Vector3> get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2); Vector2 get_closest_point_to_segment_2d(const Vector2 &p_point, const Vector2 &p_a, const Vector2 &p_b); Vector3 get_closest_point_to_segment(const Vector3 &p_point, const Vector3 &p_a, const Vector3 &p_b); Vector2 get_closest_point_to_segment_uncapped_2d(const Vector2 &p_point, const Vector2 &p_a, const Vector2 &p_b); @@ -381,9 +380,9 @@ public: Variant segment_intersects_triangle(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2); bool point_is_inside_triangle(const Vector2 &s, const Vector2 &a, const Vector2 &b, const Vector2 &c) const; - PoolVector<Vector3> segment_intersects_sphere(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_sphere_pos, real_t p_sphere_radius); - PoolVector<Vector3> segment_intersects_cylinder(const Vector3 &p_from, const Vector3 &p_to, float p_height, float p_radius); - PoolVector<Vector3> segment_intersects_convex(const Vector3 &p_from, const Vector3 &p_to, const Vector<Plane> &p_planes); + Vector<Vector3> segment_intersects_sphere(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_sphere_pos, real_t p_sphere_radius); + Vector<Vector3> segment_intersects_cylinder(const Vector3 &p_from, const Vector3 &p_to, float p_height, float p_radius); + Vector<Vector3> segment_intersects_convex(const Vector3 &p_from, const Vector3 &p_to, const Vector<Plane> &p_planes); bool is_point_in_circle(const Vector2 &p_point, const Vector2 &p_circle_pos, real_t p_circle_radius); real_t segment_intersects_circle(const Vector2 &p_from, const Vector2 &p_to, const Vector2 &p_circle_pos, real_t p_circle_radius); int get_uv84_normal_bit(const Vector3 &p_vector); @@ -490,7 +489,7 @@ public: Variant get_var(bool p_allow_objects = false) const; - PoolVector<uint8_t> get_buffer(int p_length) const; // Get an array of bytes. + Vector<uint8_t> get_buffer(int p_length) const; // Get an array of bytes. String get_line() const; Vector<String> get_csv_line(const String &p_delim = ",") const; String get_as_text() const; @@ -523,7 +522,7 @@ public: virtual void store_pascal_string(const String &p_string); virtual String get_pascal_string(); - void store_buffer(const PoolVector<uint8_t> &p_buffer); // Store an array of bytes. + void store_buffer(const Vector<uint8_t> &p_buffer); // Store an array of bytes. void store_var(const Variant &p_var, bool p_full_objects = false); @@ -597,8 +596,8 @@ public: String variant_to_base64(const Variant &p_var, bool p_full_objects = false); Variant base64_to_variant(const String &p_str, bool p_allow_objects = false); - String raw_to_base64(const PoolVector<uint8_t> &p_arr); - PoolVector<uint8_t> base64_to_raw(const String &p_str); + String raw_to_base64(const Vector<uint8_t> &p_arr); + Vector<uint8_t> base64_to_raw(const String &p_str); String utf8_to_base64(const String &p_str); String base64_to_utf8(const String &p_str); @@ -680,8 +679,8 @@ protected: static void _bind_methods(); public: - PoolStringArray get_class_list() const; - PoolStringArray get_inheriters_from_class(const StringName &p_class) const; + PackedStringArray get_class_list() const; + PackedStringArray get_inheriters_from_class(const StringName &p_class) const; StringName get_parent_class(const StringName &p_class) const; bool class_exists(const StringName &p_class) const; bool is_parent_class(const StringName &p_class, const StringName &p_inherits) const; @@ -700,7 +699,7 @@ public: Array get_method_list(StringName p_class, bool p_no_inheritance = false) const; - PoolStringArray get_integer_constant_list(const StringName &p_class, bool p_no_inheritance = false) const; + PackedStringArray get_integer_constant_list(const StringName &p_class, bool p_no_inheritance = false) const; bool has_integer_constant(const StringName &p_class, const StringName &p_name) const; int get_integer_constant(const StringName &p_class, const StringName &p_name) const; StringName get_category(const StringName &p_node) const; diff --git a/core/compressed_translation.cpp b/core/compressed_translation.cpp index 69b4ec292f..ea84ded3b4 100644 --- a/core/compressed_translation.cpp +++ b/core/compressed_translation.cpp @@ -141,8 +141,8 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) { hash_table.resize(size); bucket_table.resize(bucket_table_size); - PoolVector<int>::Write htwb = hash_table.write(); - PoolVector<int>::Write btwb = bucket_table.write(); + int *htwb = hash_table.ptrw(); + int *btwb = bucket_table.ptrw(); uint32_t *htw = (uint32_t *)&htwb[0]; uint32_t *btw = (uint32_t *)&btwb[0]; @@ -174,7 +174,7 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) { } strings.resize(total_compression_size); - PoolVector<uint8_t>::Write cw = strings.write(); + uint8_t *cw = strings.ptrw(); for (int i = 0; i < compressed.size(); i++) { memcpy(&cw[compressed[i].offset], compressed[i].compressed.get_data(), compressed[i].compressed.size()); @@ -228,11 +228,11 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const { CharString str = p_src_text.operator String().utf8(); uint32_t h = hash(0, str.get_data()); - PoolVector<int>::Read htr = hash_table.read(); + const int *htr = hash_table.ptr(); const uint32_t *htptr = (const uint32_t *)&htr[0]; - PoolVector<int>::Read btr = bucket_table.read(); + const int *btr = bucket_table.ptr(); const uint32_t *btptr = (const uint32_t *)&btr[0]; - PoolVector<uint8_t>::Read sr = strings.read(); + const uint8_t *sr = strings.ptr(); const char *sptr = (const char *)&sr[0]; uint32_t p = htptr[h % htsize]; @@ -279,9 +279,9 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const { void PHashTranslation::_get_property_list(List<PropertyInfo> *p_list) const { - p_list->push_back(PropertyInfo(Variant::POOL_INT_ARRAY, "hash_table")); - p_list->push_back(PropertyInfo(Variant::POOL_INT_ARRAY, "bucket_table")); - p_list->push_back(PropertyInfo(Variant::POOL_BYTE_ARRAY, "strings")); + p_list->push_back(PropertyInfo(Variant::PACKED_INT_ARRAY, "hash_table")); + p_list->push_back(PropertyInfo(Variant::PACKED_INT_ARRAY, "bucket_table")); + p_list->push_back(PropertyInfo(Variant::PACKED_BYTE_ARRAY, "strings")); p_list->push_back(PropertyInfo(Variant::OBJECT, "load_from", PROPERTY_HINT_RESOURCE_TYPE, "Translation", PROPERTY_USAGE_EDITOR)); } void PHashTranslation::_bind_methods() { diff --git a/core/compressed_translation.h b/core/compressed_translation.h index a72be739a1..d599240dfe 100644 --- a/core/compressed_translation.h +++ b/core/compressed_translation.h @@ -43,9 +43,9 @@ class PHashTranslation : public Translation { //of catching untranslated strings //load/store friendly types - PoolVector<int> hash_table; - PoolVector<int> bucket_table; - PoolVector<uint8_t> strings; + Vector<int> hash_table; + Vector<int> bucket_table; + Vector<uint8_t> strings; struct Bucket { diff --git a/core/crypto/crypto.cpp b/core/crypto/crypto.cpp index 3bee34f8e4..3711b26e47 100644 --- a/core/crypto/crypto.cpp +++ b/core/crypto/crypto.cpp @@ -82,8 +82,8 @@ void Crypto::_bind_methods() { ClassDB::bind_method(D_METHOD("generate_self_signed_certificate", "key", "issuer_name", "not_before", "not_after"), &Crypto::generate_self_signed_certificate, DEFVAL("CN=myserver,O=myorganisation,C=IT"), DEFVAL("20140101000000"), DEFVAL("20340101000000")); } -PoolByteArray Crypto::generate_random_bytes(int p_bytes) { - ERR_FAIL_V_MSG(PoolByteArray(), "generate_random_bytes is not available when mbedtls module is disabled."); +PackedByteArray Crypto::generate_random_bytes(int p_bytes) { + ERR_FAIL_V_MSG(PackedByteArray(), "generate_random_bytes is not available when mbedtls module is disabled."); } Ref<CryptoKey> Crypto::generate_rsa(int p_bytes) { diff --git a/core/crypto/crypto.h b/core/crypto/crypto.h index adc36255b6..babd0bc4eb 100644 --- a/core/crypto/crypto.h +++ b/core/crypto/crypto.h @@ -76,7 +76,7 @@ public: static Crypto *create(); static void load_default_certificates(String p_path); - virtual PoolByteArray generate_random_bytes(int p_bytes); + virtual PackedByteArray generate_random_bytes(int p_bytes); virtual Ref<CryptoKey> generate_rsa(int p_bytes); virtual Ref<X509Certificate> generate_self_signed_certificate(Ref<CryptoKey> p_key, String p_issuer_name, String p_not_before, String p_not_after); diff --git a/core/crypto/crypto_core.cpp b/core/crypto/crypto_core.cpp index dec52d8ca4..ec25ee0d38 100644 --- a/core/crypto/crypto_core.cpp +++ b/core/crypto/crypto_core.cpp @@ -148,9 +148,9 @@ Error CryptoCore::AESContext::decrypt_ecb(const uint8_t p_src[16], uint8_t r_dst // CryptoCore String CryptoCore::b64_encode_str(const uint8_t *p_src, int p_src_len) { int b64len = p_src_len / 3 * 4 + 4 + 1; - PoolVector<uint8_t> b64buff; + Vector<uint8_t> b64buff; b64buff.resize(b64len); - PoolVector<uint8_t>::Write w64 = b64buff.write(); + uint8_t *w64 = b64buff.ptrw(); size_t strlen = 0; int ret = b64_encode(&w64[0], b64len, &strlen, p_src, p_src_len); w64[strlen] = 0; diff --git a/core/crypto/hashing_context.cpp b/core/crypto/hashing_context.cpp index 7bee8f1200..a4d8a93c8a 100644 --- a/core/crypto/hashing_context.cpp +++ b/core/crypto/hashing_context.cpp @@ -47,11 +47,11 @@ Error HashingContext::start(HashType p_type) { return ERR_UNAVAILABLE; } -Error HashingContext::update(PoolByteArray p_chunk) { +Error HashingContext::update(PackedByteArray p_chunk) { ERR_FAIL_COND_V(ctx == NULL, ERR_UNCONFIGURED); size_t len = p_chunk.size(); ERR_FAIL_COND_V(len == 0, FAILED); - PoolByteArray::Read r = p_chunk.read(); + const uint8_t *r = p_chunk.ptr(); switch (type) { case HASH_MD5: return ((CryptoCore::MD5Context *)ctx)->update(&r[0], len); @@ -63,26 +63,26 @@ Error HashingContext::update(PoolByteArray p_chunk) { return ERR_UNAVAILABLE; } -PoolByteArray HashingContext::finish() { - ERR_FAIL_COND_V(ctx == NULL, PoolByteArray()); - PoolByteArray out; +PackedByteArray HashingContext::finish() { + ERR_FAIL_COND_V(ctx == NULL, PackedByteArray()); + PackedByteArray out; Error err = FAILED; switch (type) { case HASH_MD5: out.resize(16); - err = ((CryptoCore::MD5Context *)ctx)->finish(out.write().ptr()); + err = ((CryptoCore::MD5Context *)ctx)->finish(out.ptrw()); break; case HASH_SHA1: out.resize(20); - err = ((CryptoCore::SHA1Context *)ctx)->finish(out.write().ptr()); + err = ((CryptoCore::SHA1Context *)ctx)->finish(out.ptrw()); break; case HASH_SHA256: out.resize(32); - err = ((CryptoCore::SHA256Context *)ctx)->finish(out.write().ptr()); + err = ((CryptoCore::SHA256Context *)ctx)->finish(out.ptrw()); break; } _delete_ctx(); - ERR_FAIL_COND_V(err != OK, PoolByteArray()); + ERR_FAIL_COND_V(err != OK, PackedByteArray()); return out; } diff --git a/core/crypto/hashing_context.h b/core/crypto/hashing_context.h index af6ed3aa0b..230ba7ee85 100644 --- a/core/crypto/hashing_context.h +++ b/core/crypto/hashing_context.h @@ -54,8 +54,8 @@ protected: public: Error start(HashType p_type); - Error update(PoolByteArray p_chunk); - PoolByteArray finish(); + Error update(PackedByteArray p_chunk); + PackedByteArray finish(); HashingContext(); ~HashingContext(); diff --git a/core/global_constants.cpp b/core/global_constants.cpp index e48556c064..94713b4ee6 100644 --- a/core/global_constants.cpp +++ b/core/global_constants.cpp @@ -611,13 +611,13 @@ void register_global_constants() { BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_OBJECT", Variant::OBJECT); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_DICTIONARY", Variant::DICTIONARY); // 20 BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_ARRAY", Variant::ARRAY); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RAW_ARRAY", Variant::POOL_BYTE_ARRAY); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_INT_ARRAY", Variant::POOL_INT_ARRAY); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_REAL_ARRAY", Variant::POOL_REAL_ARRAY); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_STRING_ARRAY", Variant::POOL_STRING_ARRAY); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2_ARRAY", Variant::POOL_VECTOR2_ARRAY); // 25 - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3_ARRAY", Variant::POOL_VECTOR3_ARRAY); - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_COLOR_ARRAY", Variant::POOL_COLOR_ARRAY); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RAW_ARRAY", Variant::PACKED_BYTE_ARRAY); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_INT_ARRAY", Variant::PACKED_INT_ARRAY); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_REAL_ARRAY", Variant::PACKED_REAL_ARRAY); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_STRING_ARRAY", Variant::PACKED_STRING_ARRAY); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2_ARRAY", Variant::PACKED_VECTOR2_ARRAY); // 25 + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3_ARRAY", Variant::PACKED_VECTOR3_ARRAY); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_COLOR_ARRAY", Variant::PACKED_COLOR_ARRAY); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_MAX", Variant::VARIANT_MAX); //comparison diff --git a/core/image.cpp b/core/image.cpp index d9f84621a3..a188447f90 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -444,8 +444,6 @@ void Image::convert(Format p_new_format) { if (p_new_format == format) return; - ERR_FAIL_COND_MSG(write_lock.ptr(), "Cannot convert image when it is locked."); - if (format > FORMAT_RGBE9995 || p_new_format > FORMAT_RGBE9995) { ERR_FAIL_MSG("Cannot convert to <-> from compressed formats. Use compress() and decompress() instead."); @@ -454,8 +452,6 @@ void Image::convert(Format p_new_format) { //use put/set pixel which is slower but works with non byte formats Image new_img(width, height, 0, p_new_format); - lock(); - new_img.lock(); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { @@ -464,9 +460,6 @@ void Image::convert(Format p_new_format) { } } - unlock(); - new_img.unlock(); - if (has_mipmaps()) { new_img.generate_mipmaps(); } @@ -478,11 +471,8 @@ void Image::convert(Format p_new_format) { Image new_img(width, height, 0, p_new_format); - PoolVector<uint8_t>::Read r = data.read(); - PoolVector<uint8_t>::Write w = new_img.data.write(); - - const uint8_t *rptr = r.ptr(); - uint8_t *wptr = w.ptr(); + const uint8_t *rptr = data.ptr(); + uint8_t *wptr = new_img.data.ptrw(); int conversion_type = format | p_new_format << 8; @@ -520,9 +510,6 @@ void Image::convert(Format p_new_format) { case FORMAT_RGBA8 | (FORMAT_RGB8 << 8): _convert<3, true, 3, false, false, false>(width, height, rptr, wptr); break; } - r.release(); - w.release(); - bool gen_mipmaps = mipmaps; _copy_internals_from(new_img); @@ -906,7 +893,6 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) { ERR_FAIL_COND_MSG(data.size() == 0, "Cannot resize image before creating it, use create() or create_from_data() first."); ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot resize in compressed or custom image formats."); - ERR_FAIL_COND_MSG(write_lock.ptr(), "Cannot resize image when it is locked."); bool mipmap_aware = p_interpolation == INTERPOLATE_TRILINEAR /* || p_interpolation == INTERPOLATE_TRICUBIC */; @@ -948,11 +934,11 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) { } // -- - PoolVector<uint8_t>::Read r = data.read(); - const unsigned char *r_ptr = r.ptr(); + const uint8_t *r = data.ptr(); + const unsigned char *r_ptr = r; - PoolVector<uint8_t>::Write w = dst.data.write(); - unsigned char *w_ptr = w.ptr(); + uint8_t *w = dst.data.ptrw(); + unsigned char *w_ptr = w; switch (p_interpolation) { @@ -1017,8 +1003,8 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) { _get_mipmap_offset_and_size(mip2, offs, src_width, src_height); src_ptr = r_ptr + offs; // Switch to write to the second destination image - w = dst2.data.write(); - w_ptr = w.ptr(); + w = dst2.data.ptrw(); + w_ptr = w; } } @@ -1048,8 +1034,8 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) { if (interpolate_mipmaps) { // Switch to read again from the first scaled mipmap to overlay it over the second - r = dst.data.read(); - _overlay(r.ptr(), w.ptr(), mip1_weight, p_width, p_height, get_format_pixel_size(format)); + r = dst.data.ptr(); + _overlay(r, w, mip1_weight, p_width, p_height, get_format_pixel_size(format)); } } break; @@ -1105,9 +1091,6 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) { } break; } - r.release(); - w.release(); - if (interpolate_mipmaps) { dst._copy_internals_from(dst2); } @@ -1142,8 +1125,8 @@ void Image::crop_from_point(int p_x, int p_y, int p_width, int p_height) { Image dst(p_width, p_height, 0, format); { - PoolVector<uint8_t>::Read r = data.read(); - PoolVector<uint8_t>::Write w = dst.data.write(); + const uint8_t *r = data.ptr(); + uint8_t *w = dst.data.ptrw(); int m_h = p_y + p_height; int m_w = p_x + p_width; @@ -1155,10 +1138,10 @@ void Image::crop_from_point(int p_x, int p_y, int p_width, int p_height) { for (uint32_t i = 0; i < pixel_size; i++) pdata[i] = 0; } else { - _get_pixelb(x, y, pixel_size, r.ptr(), pdata); + _get_pixelb(x, y, pixel_size, r, pdata); } - dst._put_pixelb(x - p_x, y - p_y, pixel_size, w.ptr(), pdata); + dst._put_pixelb(x - p_x, y - p_y, pixel_size, w, pdata); } } } @@ -1183,7 +1166,7 @@ void Image::flip_y() { } { - PoolVector<uint8_t>::Write w = data.write(); + uint8_t *w = data.ptrw(); uint8_t up[16]; uint8_t down[16]; uint32_t pixel_size = get_format_pixel_size(format); @@ -1192,11 +1175,11 @@ void Image::flip_y() { for (int x = 0; x < width; x++) { - _get_pixelb(x, y, pixel_size, w.ptr(), up); - _get_pixelb(x, height - y - 1, pixel_size, w.ptr(), down); + _get_pixelb(x, y, pixel_size, w, up); + _get_pixelb(x, height - y - 1, pixel_size, w, down); - _put_pixelb(x, height - y - 1, pixel_size, w.ptr(), up); - _put_pixelb(x, y, pixel_size, w.ptr(), down); + _put_pixelb(x, height - y - 1, pixel_size, w, up); + _put_pixelb(x, y, pixel_size, w, down); } } } @@ -1216,7 +1199,7 @@ void Image::flip_x() { } { - PoolVector<uint8_t>::Write w = data.write(); + uint8_t *w = data.ptrw(); uint8_t up[16]; uint8_t down[16]; uint32_t pixel_size = get_format_pixel_size(format); @@ -1225,11 +1208,11 @@ void Image::flip_x() { for (int x = 0; x < width / 2; x++) { - _get_pixelb(x, y, pixel_size, w.ptr(), up); - _get_pixelb(width - x - 1, y, pixel_size, w.ptr(), down); + _get_pixelb(x, y, pixel_size, w, up); + _get_pixelb(width - x - 1, y, pixel_size, w, down); - _put_pixelb(width - x - 1, y, pixel_size, w.ptr(), up); - _put_pixelb(x, y, pixel_size, w.ptr(), down); + _put_pixelb(width - x - 1, y, pixel_size, w, up); + _put_pixelb(x, y, pixel_size, w, down); } } } @@ -1348,16 +1331,16 @@ void Image::expand_x2_hq2x() { if (current != FORMAT_RGBA8) convert(FORMAT_RGBA8); - PoolVector<uint8_t> dest; + Vector<uint8_t> dest; dest.resize(width * 2 * height * 2 * 4); { - PoolVector<uint8_t>::Read r = data.read(); - PoolVector<uint8_t>::Write w = dest.write(); + const uint8_t *r = data.ptr(); + uint8_t *w = dest.ptrw(); - ERR_FAIL_COND(!r.ptr()); + ERR_FAIL_COND(!r); - hq2x_resize((const uint32_t *)r.ptr(), width, height, (uint32_t *)w.ptr()); + hq2x_resize((const uint32_t *)r, width, height, (uint32_t *)w); } width *= 2; @@ -1381,7 +1364,7 @@ void Image::shrink_x2() { if (mipmaps) { //just use the lower mipmap as base and copy all - PoolVector<uint8_t> new_img; + Vector<uint8_t> new_img; int ofs = get_mipmap_offset(1); @@ -1390,10 +1373,10 @@ void Image::shrink_x2() { ERR_FAIL_COND(new_img.size() == 0); { - PoolVector<uint8_t>::Write w = new_img.write(); - PoolVector<uint8_t>::Read r = data.read(); + uint8_t *w = new_img.ptrw(); + const uint8_t *r = data.ptr(); - copymem(w.ptr(), &r[ofs], new_size); + copymem(w, &r[ofs], new_size); } width = MAX(width / 2, 1); @@ -1402,7 +1385,7 @@ void Image::shrink_x2() { } else { - PoolVector<uint8_t> new_img; + Vector<uint8_t> new_img; ERR_FAIL_COND(!_can_modify(format)); int ps = get_format_pixel_size(format); @@ -1411,29 +1394,29 @@ void Image::shrink_x2() { ERR_FAIL_COND(data.size() == 0); { - PoolVector<uint8_t>::Write w = new_img.write(); - PoolVector<uint8_t>::Read r = data.read(); + uint8_t *w = new_img.ptrw(); + const uint8_t *r = data.ptr(); switch (format) { case FORMAT_L8: - case FORMAT_R8: _generate_po2_mipmap<uint8_t, 1, false, Image::average_4_uint8, Image::renormalize_uint8>(r.ptr(), w.ptr(), width, height); break; - case FORMAT_LA8: _generate_po2_mipmap<uint8_t, 2, false, Image::average_4_uint8, Image::renormalize_uint8>(r.ptr(), w.ptr(), width, height); break; - case FORMAT_RG8: _generate_po2_mipmap<uint8_t, 2, false, Image::average_4_uint8, Image::renormalize_uint8>(r.ptr(), w.ptr(), width, height); break; - case FORMAT_RGB8: _generate_po2_mipmap<uint8_t, 3, false, Image::average_4_uint8, Image::renormalize_uint8>(r.ptr(), w.ptr(), width, height); break; - case FORMAT_RGBA8: _generate_po2_mipmap<uint8_t, 4, false, Image::average_4_uint8, Image::renormalize_uint8>(r.ptr(), w.ptr(), width, height); break; - - case FORMAT_RF: _generate_po2_mipmap<float, 1, false, Image::average_4_float, Image::renormalize_float>(reinterpret_cast<const float *>(r.ptr()), reinterpret_cast<float *>(w.ptr()), width, height); break; - case FORMAT_RGF: _generate_po2_mipmap<float, 2, false, Image::average_4_float, Image::renormalize_float>(reinterpret_cast<const float *>(r.ptr()), reinterpret_cast<float *>(w.ptr()), width, height); break; - case FORMAT_RGBF: _generate_po2_mipmap<float, 3, false, Image::average_4_float, Image::renormalize_float>(reinterpret_cast<const float *>(r.ptr()), reinterpret_cast<float *>(w.ptr()), width, height); break; - case FORMAT_RGBAF: _generate_po2_mipmap<float, 4, false, Image::average_4_float, Image::renormalize_float>(reinterpret_cast<const float *>(r.ptr()), reinterpret_cast<float *>(w.ptr()), width, height); break; - - case FORMAT_RH: _generate_po2_mipmap<uint16_t, 1, false, Image::average_4_half, Image::renormalize_half>(reinterpret_cast<const uint16_t *>(r.ptr()), reinterpret_cast<uint16_t *>(w.ptr()), width, height); break; - case FORMAT_RGH: _generate_po2_mipmap<uint16_t, 2, false, Image::average_4_half, Image::renormalize_half>(reinterpret_cast<const uint16_t *>(r.ptr()), reinterpret_cast<uint16_t *>(w.ptr()), width, height); break; - case FORMAT_RGBH: _generate_po2_mipmap<uint16_t, 3, false, Image::average_4_half, Image::renormalize_half>(reinterpret_cast<const uint16_t *>(r.ptr()), reinterpret_cast<uint16_t *>(w.ptr()), width, height); break; - case FORMAT_RGBAH: _generate_po2_mipmap<uint16_t, 4, false, Image::average_4_half, Image::renormalize_half>(reinterpret_cast<const uint16_t *>(r.ptr()), reinterpret_cast<uint16_t *>(w.ptr()), width, height); break; - - case FORMAT_RGBE9995: _generate_po2_mipmap<uint32_t, 1, false, Image::average_4_rgbe9995, Image::renormalize_rgbe9995>(reinterpret_cast<const uint32_t *>(r.ptr()), reinterpret_cast<uint32_t *>(w.ptr()), width, height); break; + case FORMAT_R8: _generate_po2_mipmap<uint8_t, 1, false, Image::average_4_uint8, Image::renormalize_uint8>(r, w, width, height); break; + case FORMAT_LA8: _generate_po2_mipmap<uint8_t, 2, false, Image::average_4_uint8, Image::renormalize_uint8>(r, w, width, height); break; + case FORMAT_RG8: _generate_po2_mipmap<uint8_t, 2, false, Image::average_4_uint8, Image::renormalize_uint8>(r, w, width, height); break; + case FORMAT_RGB8: _generate_po2_mipmap<uint8_t, 3, false, Image::average_4_uint8, Image::renormalize_uint8>(r, w, width, height); break; + case FORMAT_RGBA8: _generate_po2_mipmap<uint8_t, 4, false, Image::average_4_uint8, Image::renormalize_uint8>(r, w, width, height); break; + + case FORMAT_RF: _generate_po2_mipmap<float, 1, false, Image::average_4_float, Image::renormalize_float>(reinterpret_cast<const float *>(r), reinterpret_cast<float *>(w), width, height); break; + case FORMAT_RGF: _generate_po2_mipmap<float, 2, false, Image::average_4_float, Image::renormalize_float>(reinterpret_cast<const float *>(r), reinterpret_cast<float *>(w), width, height); break; + case FORMAT_RGBF: _generate_po2_mipmap<float, 3, false, Image::average_4_float, Image::renormalize_float>(reinterpret_cast<const float *>(r), reinterpret_cast<float *>(w), width, height); break; + case FORMAT_RGBAF: _generate_po2_mipmap<float, 4, false, Image::average_4_float, Image::renormalize_float>(reinterpret_cast<const float *>(r), reinterpret_cast<float *>(w), width, height); break; + + case FORMAT_RH: _generate_po2_mipmap<uint16_t, 1, false, Image::average_4_half, Image::renormalize_half>(reinterpret_cast<const uint16_t *>(r), reinterpret_cast<uint16_t *>(w), width, height); break; + case FORMAT_RGH: _generate_po2_mipmap<uint16_t, 2, false, Image::average_4_half, Image::renormalize_half>(reinterpret_cast<const uint16_t *>(r), reinterpret_cast<uint16_t *>(w), width, height); break; + case FORMAT_RGBH: _generate_po2_mipmap<uint16_t, 3, false, Image::average_4_half, Image::renormalize_half>(reinterpret_cast<const uint16_t *>(r), reinterpret_cast<uint16_t *>(w), width, height); break; + case FORMAT_RGBAH: _generate_po2_mipmap<uint16_t, 4, false, Image::average_4_half, Image::renormalize_half>(reinterpret_cast<const uint16_t *>(r), reinterpret_cast<uint16_t *>(w), width, height); break; + + case FORMAT_RGBE9995: _generate_po2_mipmap<uint32_t, 1, false, Image::average_4_rgbe9995, Image::renormalize_rgbe9995>(reinterpret_cast<const uint32_t *>(r), reinterpret_cast<uint32_t *>(w), width, height); break; default: { } } @@ -1452,8 +1435,6 @@ void Image::normalize() { clear_mipmaps(); } - lock(); - for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { @@ -1468,8 +1449,6 @@ void Image::normalize() { } } - unlock(); - if (used_mipmaps) { generate_mipmaps(true); } @@ -1487,7 +1466,7 @@ Error Image::generate_mipmaps(bool p_renormalize) { data.resize(size); - PoolVector<uint8_t>::Write wp = data.write(); + uint8_t *wp = data.ptrw(); int prev_ofs = 0; int prev_h = height; @@ -1599,7 +1578,6 @@ Error Image::generate_mipmap_roughness(RoughnessChannel p_roughness_channel, con normal_sat = normal_sat_vec.ptrw(); //create summed area table - nm->lock(); for (int y = 0; y < normal_h; y++) { double line_sum[3] = { 0, 0, 0 }; @@ -1642,9 +1620,7 @@ Error Image::generate_mipmap_roughness(RoughnessChannel p_roughness_channel, con _get_dst_image_size(width, height, format, mmcount); - lock(); - - uint8_t *base_ptr = write_lock.ptr(); + uint8_t *base_ptr = data.ptrw(); for (int i = 1; i <= mmcount; i++) { @@ -1759,11 +1735,13 @@ Error Image::generate_mipmap_roughness(RoughnessChannel p_roughness_channel, con { int size = get_mipmap_byte_size(i); print_line("size for mimpap " + itos(i) + ": " + itos(size)); - PoolVector<uint8_t> imgdata; + Vector<uint8_t> imgdata; imgdata.resize(size); - PoolVector<uint8_t>::Write wr = imgdata.write(); + + + uint8_t* wr = imgdata.ptrw(); copymem(wr.ptr(), ptr, size); - wr = PoolVector<uint8_t>::Write(); + wr = uint8_t*(); Ref<Image> im; im.instance(); im->create(w, h, false, format, imgdata); @@ -1772,9 +1750,6 @@ Error Image::generate_mipmap_roughness(RoughnessChannel p_roughness_channel, con #endif } - unlock(); - nm->unlock(); - return OK; } @@ -1798,7 +1773,7 @@ bool Image::empty() const { return (data.size() == 0); } -PoolVector<uint8_t> Image::get_data() const { +Vector<uint8_t> Image::get_data() const { return data; } @@ -1812,9 +1787,10 @@ void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_forma int mm = 0; int size = _get_dst_image_size(p_width, p_height, p_format, mm, p_use_mipmaps ? -1 : 0); data.resize(size); + { - PoolVector<uint8_t>::Write w = data.write(); - zeromem(w.ptr(), size); + uint8_t *w = data.ptrw(); + zeromem(w, size); } width = p_width; @@ -1823,7 +1799,7 @@ void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_forma format = p_format; } -void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const PoolVector<uint8_t> &p_data) { +void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const Vector<uint8_t> &p_data) { ERR_FAIL_INDEX(p_width - 1, MAX_WIDTH); ERR_FAIL_INDEX(p_height - 1, MAX_HEIGHT); @@ -1838,6 +1814,7 @@ void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_forma width = p_width; format = p_format; data = p_data; + mipmaps = p_use_mipmaps; } @@ -1862,7 +1839,7 @@ void Image::create(const char **p_xpm) { HashMap<String, Color> colormap; int colormap_size = 0; uint32_t pixel_size = 0; - PoolVector<uint8_t>::Write w; + uint8_t *w; while (status != DONE) { @@ -1953,7 +1930,7 @@ void Image::create(const char **p_xpm) { status = READING_PIXELS; create(size_width, size_height, 0, has_alpha ? FORMAT_RGBA8 : FORMAT_RGB8); - w = data.write(); + w = data.ptrw(); pixel_size = has_alpha ? 4 : 3; } } break; @@ -1972,7 +1949,7 @@ void Image::create(const char **p_xpm) { for (uint32_t i = 0; i < pixel_size; i++) { pixel[i] = CLAMP((*colorptr)[i] * 255, 0, 255); } - _put_pixelb(x, y, pixel_size, w.ptr(), pixel); + _put_pixelb(x, y, pixel_size, w, pixel); } if (y == (size_height - 1)) @@ -2024,8 +2001,8 @@ bool Image::is_invisible() const { int w, h; _get_mipmap_offset_and_size(1, len, w, h); - PoolVector<uint8_t>::Read r = data.read(); - const unsigned char *data_ptr = r.ptr(); + const uint8_t *r = data.ptr(); + const unsigned char *data_ptr = r; bool detected = false; @@ -2069,8 +2046,8 @@ Image::AlphaMode Image::detect_alpha() const { int w, h; _get_mipmap_offset_and_size(1, len, w, h); - PoolVector<uint8_t>::Read r = data.read(); - const unsigned char *data_ptr = r.ptr(); + const uint8_t *r = data.ptr(); + const unsigned char *data_ptr = r; bool bit = false; bool detected = false; @@ -2126,9 +2103,9 @@ Error Image::save_png(const String &p_path) const { return save_png_func(p_path, Ref<Image>((Image *)this)); } -PoolVector<uint8_t> Image::save_png_to_buffer() const { +Vector<uint8_t> Image::save_png_to_buffer() const { if (save_png_buffer_func == NULL) { - return PoolVector<uint8_t>(); + return Vector<uint8_t>(); } return save_png_buffer_func(Ref<Image>((Image *)this)); @@ -2266,7 +2243,7 @@ Image::Image(int p_width, int p_height, bool p_use_mipmaps, Format p_format) { create(p_width, p_height, p_use_mipmaps, p_format); } -Image::Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const PoolVector<uint8_t> &p_data) { +Image::Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const Vector<uint8_t> &p_data) { width = 0; height = 0; @@ -2286,7 +2263,6 @@ Rect2 Image::get_used_rect() const { if (len == 0) return Rect2(); - const_cast<Image *>(this)->lock(); int minx = 0xFFFFFF, miny = 0xFFFFFFF; int maxx = -1, maxy = -1; for (int j = 0; j < height; j++) { @@ -2305,8 +2281,6 @@ Rect2 Image::get_used_rect() const { } } - const_cast<Image *>(this)->unlock(); - if (maxx == -1) return Rect2(); else @@ -2343,11 +2317,11 @@ void Image::blit_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const Po Point2 src_underscan = Point2(MIN(0, p_src_rect.position.x), MIN(0, p_src_rect.position.y)); Rect2i dest_rect = Rect2i(0, 0, width, height).clip(Rect2i(p_dest - src_underscan, clipped_src_rect.size)); - PoolVector<uint8_t>::Write wp = data.write(); - uint8_t *dst_data_ptr = wp.ptr(); + uint8_t *wp = data.ptrw(); + uint8_t *dst_data_ptr = wp; - PoolVector<uint8_t>::Read rp = p_src->data.read(); - const uint8_t *src_data_ptr = rp.ptr(); + const uint8_t *rp = p_src->data.ptr(); + const uint8_t *src_data_ptr = rp; int pixel_size = get_format_pixel_size(format); @@ -2398,16 +2372,15 @@ void Image::blit_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, co Point2 src_underscan = Point2(MIN(0, p_src_rect.position.x), MIN(0, p_src_rect.position.y)); Rect2i dest_rect = Rect2i(0, 0, width, height).clip(Rect2i(p_dest - src_underscan, clipped_src_rect.size)); - PoolVector<uint8_t>::Write wp = data.write(); - uint8_t *dst_data_ptr = wp.ptr(); + uint8_t *wp = data.ptrw(); + uint8_t *dst_data_ptr = wp; - PoolVector<uint8_t>::Read rp = p_src->data.read(); - const uint8_t *src_data_ptr = rp.ptr(); + const uint8_t *rp = p_src->data.ptr(); + const uint8_t *src_data_ptr = rp; int pixel_size = get_format_pixel_size(format); Ref<Image> msk = p_mask; - msk->lock(); for (int i = 0; i < dest_rect.size.y; i++) { @@ -2430,8 +2403,6 @@ void Image::blit_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, co } } } - - msk->unlock(); } void Image::blend_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const Point2 &p_dest) { @@ -2456,9 +2427,7 @@ void Image::blend_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const P Point2 src_underscan = Point2(MIN(0, p_src_rect.position.x), MIN(0, p_src_rect.position.y)); Rect2i dest_rect = Rect2i(0, 0, width, height).clip(Rect2i(p_dest - src_underscan, clipped_src_rect.size)); - lock(); Ref<Image> img = p_src; - img->lock(); for (int i = 0; i < dest_rect.size.y; i++) { @@ -2479,9 +2448,6 @@ void Image::blend_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const P set_pixel(dst_x, dst_y, dc); } } - - img->unlock(); - unlock(); } void Image::blend_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, const Rect2 &p_src_rect, const Point2 &p_dest) { @@ -2511,11 +2477,8 @@ void Image::blend_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, c Point2 src_underscan = Point2(MIN(0, p_src_rect.position.x), MIN(0, p_src_rect.position.y)); Rect2i dest_rect = Rect2i(0, 0, width, height).clip(Rect2i(p_dest - src_underscan, clipped_src_rect.size)); - lock(); Ref<Image> img = p_src; Ref<Image> msk = p_mask; - img->lock(); - msk->lock(); for (int i = 0; i < dest_rect.size.y; i++) { @@ -2542,19 +2505,13 @@ void Image::blend_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, c } } } - - msk->unlock(); - img->unlock(); - unlock(); } void Image::fill(const Color &c) { ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot fill in compressed or custom image formats."); - lock(); - - PoolVector<uint8_t>::Write wp = data.write(); - uint8_t *dst_data_ptr = wp.ptr(); + uint8_t *wp = data.ptrw(); + uint8_t *dst_data_ptr = wp; int pixel_size = get_format_pixel_size(format); @@ -2572,8 +2529,6 @@ void Image::fill(const Color &c) { } } } - - unlock(); } ImageMemLoadFunc Image::_png_mem_loader_func = NULL; @@ -2592,12 +2547,12 @@ void (*Image::_image_decompress_bptc)(Image *) = NULL; void (*Image::_image_decompress_etc1)(Image *) = NULL; void (*Image::_image_decompress_etc2)(Image *) = NULL; -PoolVector<uint8_t> (*Image::lossy_packer)(const Ref<Image> &, float) = NULL; -Ref<Image> (*Image::lossy_unpacker)(const PoolVector<uint8_t> &) = NULL; -PoolVector<uint8_t> (*Image::lossless_packer)(const Ref<Image> &) = NULL; -Ref<Image> (*Image::lossless_unpacker)(const PoolVector<uint8_t> &) = NULL; -PoolVector<uint8_t> (*Image::basis_universal_packer)(const Ref<Image> &, Image::UsedChannels) = NULL; -Ref<Image> (*Image::basis_universal_unpacker)(const PoolVector<uint8_t> &) = NULL; +Vector<uint8_t> (*Image::lossy_packer)(const Ref<Image> &, float) = NULL; +Ref<Image> (*Image::lossy_unpacker)(const Vector<uint8_t> &) = NULL; +Vector<uint8_t> (*Image::lossless_packer)(const Ref<Image> &) = NULL; +Ref<Image> (*Image::lossless_unpacker)(const Vector<uint8_t> &) = NULL; +Vector<uint8_t> (*Image::basis_universal_packer)(const Ref<Image> &, Image::UsedChannels) = NULL; +Ref<Image> (*Image::basis_universal_unpacker)(const Vector<uint8_t> &) = NULL; void Image::_set_data(const Dictionary &p_data) { @@ -2611,7 +2566,7 @@ void Image::_set_data(const Dictionary &p_data) { int dheight = p_data["height"]; String dformat = p_data["format"]; bool dmipmaps = p_data["mipmaps"]; - PoolVector<uint8_t> ddata = p_data["data"]; + Vector<uint8_t> ddata = p_data["data"]; Format ddformat = FORMAT_MAX; for (int i = 0; i < FORMAT_MAX; i++) { if (dformat == get_format_name(Format(i))) { @@ -2636,22 +2591,11 @@ Dictionary Image::_get_data() const { return d; } -void Image::lock() { - - ERR_FAIL_COND(data.size() == 0); - write_lock = data.write(); -} - -void Image::unlock() { - - write_lock.release(); -} - Color Image::get_pixelv(const Point2 &p_src) const { return get_pixel(p_src.x, p_src.y); } -Color Image::_get_color_at_ofs(uint8_t *ptr, uint32_t ofs) const { +Color Image::_get_color_at_ofs(const uint8_t *ptr, uint32_t ofs) const { switch (format) { case FORMAT_L8: { @@ -2873,18 +2817,13 @@ void Image::_set_color_at_ofs(uint8_t *ptr, uint32_t ofs, const Color &p_color) } Color Image::get_pixel(int p_x, int p_y) const { - - uint8_t *ptr = write_lock.ptr(); #ifdef DEBUG_ENABLED - ERR_FAIL_COND_V_MSG(!ptr, Color(), "Image must be locked with 'lock()' before using get_pixel()."); - ERR_FAIL_INDEX_V(p_x, width, Color()); ERR_FAIL_INDEX_V(p_y, height, Color()); - #endif uint32_t ofs = p_y * width + p_x; - return _get_color_at_ofs(ptr, ofs); + return _get_color_at_ofs(data.ptr(), ofs); } void Image::set_pixelv(const Point2 &p_dst, const Color &p_color) { @@ -2892,18 +2831,13 @@ void Image::set_pixelv(const Point2 &p_dst, const Color &p_color) { } void Image::set_pixel(int p_x, int p_y, const Color &p_color) { - - uint8_t *ptr = write_lock.ptr(); #ifdef DEBUG_ENABLED - ERR_FAIL_COND_MSG(!ptr, "Image must be locked with 'lock()' before using set_pixel()."); - ERR_FAIL_INDEX(p_x, width); ERR_FAIL_INDEX(p_y, height); - #endif uint32_t ofs = p_y * width + p_x; - _set_color_at_ofs(ptr, ofs, p_color); + _set_color_at_ofs(data.ptrw(), ofs, p_color); } Image::UsedChannels Image::detect_used_channels(CompressSource p_source) { @@ -2911,7 +2845,7 @@ Image::UsedChannels Image::detect_used_channels(CompressSource p_source) { ERR_FAIL_COND_V(data.size() == 0, USED_CHANNELS_RGBA); ERR_FAIL_COND_V(is_compressed(), USED_CHANNELS_RGBA); bool r = false, g = false, b = false, a = false, c = false; - lock(); + for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { @@ -2932,8 +2866,6 @@ Image::UsedChannels Image::detect_used_channels(CompressSource p_source) { } } - unlock(); - UsedChannels used_channels; if (!c && !a) @@ -3036,8 +2968,6 @@ void Image::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_data", "data"), &Image::_set_data); ClassDB::bind_method(D_METHOD("_get_data"), &Image::_get_data); - ClassDB::bind_method(D_METHOD("lock"), &Image::lock); - ClassDB::bind_method(D_METHOD("unlock"), &Image::unlock); ClassDB::bind_method(D_METHOD("get_pixelv", "src"), &Image::get_pixelv); ClassDB::bind_method(D_METHOD("get_pixel", "x", "y"), &Image::get_pixel); ClassDB::bind_method(D_METHOD("set_pixelv", "dst", "color"), &Image::set_pixelv); @@ -3137,8 +3067,7 @@ void Image::normalmap_to_xy() { { int len = data.size() / 4; - PoolVector<uint8_t>::Write wp = data.write(); - unsigned char *data_ptr = wp.ptr(); + uint8_t *data_ptr = data.ptrw(); for (int i = 0; i < len; i++) { @@ -3162,19 +3091,12 @@ Ref<Image> Image::rgbe_to_srgb() { new_image.instance(); new_image->create(width, height, 0, Image::FORMAT_RGB8); - lock(); - - new_image->lock(); - for (int row = 0; row < height; row++) { for (int col = 0; col < width; col++) { new_image->set_pixel(col, row, get_pixel(col, row).to_srgb()); } } - unlock(); - new_image->unlock(); - if (has_mipmaps()) { new_image->generate_mipmaps(); } @@ -3187,12 +3109,13 @@ Ref<Image> Image::get_image_from_mipmap(int p_mipamp) const { int ofs, size, w, h; get_mipmap_offset_size_and_dimensions(p_mipamp, ofs, size, w, h); - PoolVector<uint8_t> new_data; + Vector<uint8_t> new_data; new_data.resize(size); + { - PoolVector<uint8_t>::Write wr = new_data.write(); - PoolVector<uint8_t>::Read rd = data.read(); - copymem(wr.ptr(), rd.ptr() + ofs, size); + uint8_t *wr = new_data.ptrw(); + const uint8_t *rd = data.ptr(); + copymem(wr, rd + ofs, size); } Ref<Image> image; @@ -3201,6 +3124,7 @@ Ref<Image> Image::get_image_from_mipmap(int p_mipamp) const { image->height = h; image->format = format; image->data = new_data; + image->mipmaps = false; return image; } @@ -3209,17 +3133,17 @@ void Image::bumpmap_to_normalmap(float bump_scale) { ERR_FAIL_COND(!_can_modify(format)); convert(Image::FORMAT_RF); - PoolVector<uint8_t> result_image; //rgba output + Vector<uint8_t> result_image; //rgba output result_image.resize(width * height * 4); { - PoolVector<uint8_t>::Read rp = data.read(); - PoolVector<uint8_t>::Write wp = result_image.write(); + const uint8_t *rp = data.ptr(); + uint8_t *wp = result_image.ptrw(); - ERR_FAIL_COND(!rp.ptr()); + ERR_FAIL_COND(!rp); - unsigned char *write_ptr = wp.ptr(); - float *read_ptr = (float *)rp.ptr(); + unsigned char *write_ptr = wp; + float *read_ptr = (float *)rp; for (int ty = 0; ty < height; ty++) { int py = ty + 1; @@ -3260,8 +3184,7 @@ void Image::srgb_to_linear() { if (format == FORMAT_RGBA8) { int len = data.size() / 4; - PoolVector<uint8_t>::Write wp = data.write(); - unsigned char *data_ptr = wp.ptr(); + uint8_t *data_ptr = data.ptrw(); for (int i = 0; i < len; i++) { @@ -3273,8 +3196,7 @@ void Image::srgb_to_linear() { } else if (format == FORMAT_RGB8) { int len = data.size() / 3; - PoolVector<uint8_t>::Write wp = data.write(); - unsigned char *data_ptr = wp.ptr(); + uint8_t *data_ptr = data.ptrw(); for (int i = 0; i < len; i++) { @@ -3293,8 +3215,7 @@ void Image::premultiply_alpha() { if (format != FORMAT_RGBA8) return; //not needed - PoolVector<uint8_t>::Write wp = data.write(); - unsigned char *data_ptr = wp.ptr(); + uint8_t *data_ptr = data.ptrw(); for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { @@ -3316,12 +3237,10 @@ void Image::fix_alpha_edges() { if (format != FORMAT_RGBA8) return; //not needed - PoolVector<uint8_t> dcopy = data; - PoolVector<uint8_t>::Read rp = dcopy.read(); - const uint8_t *srcptr = rp.ptr(); + Vector<uint8_t> dcopy = data; + const uint8_t *srcptr = dcopy.ptr(); - PoolVector<uint8_t>::Write wp = data.write(); - unsigned char *data_ptr = wp.ptr(); + uint8_t *data_ptr = data.ptrw(); const int max_radius = 4; const int alpha_threshold = 20; @@ -3381,15 +3300,15 @@ String Image::get_format_name(Format p_format) { return format_names[p_format]; } -Error Image::load_png_from_buffer(const PoolVector<uint8_t> &p_array) { +Error Image::load_png_from_buffer(const Vector<uint8_t> &p_array) { return _load_from_buffer(p_array, _png_mem_loader_func); } -Error Image::load_jpg_from_buffer(const PoolVector<uint8_t> &p_array) { +Error Image::load_jpg_from_buffer(const Vector<uint8_t> &p_array) { return _load_from_buffer(p_array, _jpg_mem_loader_func); } -Error Image::load_webp_from_buffer(const PoolVector<uint8_t> &p_array) { +Error Image::load_webp_from_buffer(const Vector<uint8_t> &p_array) { return _load_from_buffer(p_array, _webp_mem_loader_func); } @@ -3398,7 +3317,7 @@ void Image::convert_rg_to_ra_rgba8() { ERR_FAIL_COND(!data.size()); int s = data.size(); - PoolVector<uint8_t>::Write w = data.write(); + uint8_t *w = data.ptrw(); for (int i = 0; i < s; i += 4) { w[i + 3] = w[i + 1]; w[i + 1] = 0; @@ -3410,7 +3329,7 @@ void Image::convert_ra_rgba8_to_rg() { ERR_FAIL_COND(!data.size()); int s = data.size(); - PoolVector<uint8_t>::Write w = data.write(); + uint8_t *w = data.ptrw(); for (int i = 0; i < s; i += 4) { w[i + 1] = w[i + 3]; w[i + 2] = 0; @@ -3418,15 +3337,15 @@ void Image::convert_ra_rgba8_to_rg() { } } -Error Image::_load_from_buffer(const PoolVector<uint8_t> &p_array, ImageMemLoadFunc p_loader) { +Error Image::_load_from_buffer(const Vector<uint8_t> &p_array, ImageMemLoadFunc p_loader) { int buffer_size = p_array.size(); ERR_FAIL_COND_V(buffer_size == 0, ERR_INVALID_PARAMETER); ERR_FAIL_COND_V(!p_loader, ERR_INVALID_PARAMETER); - PoolVector<uint8_t>::Read r = p_array.read(); + const uint8_t *r = p_array.ptr(); - Ref<Image> image = p_loader(r.ptr(), buffer_size); + Ref<Image> image = p_loader(r, buffer_size); ERR_FAIL_COND_V(!image.is_valid(), ERR_PARSE_ERROR); copy_internals_from(image); @@ -3516,8 +3435,4 @@ Image::Image() { } Image::~Image() { - - if (write_lock.ptr()) { - unlock(); - } } diff --git a/core/image.h b/core/image.h index 1cc22420d5..4dc4bf1328 100644 --- a/core/image.h +++ b/core/image.h @@ -33,7 +33,7 @@ #include "core/color.h" #include "core/math/rect2.h" -#include "core/pool_vector.h" + #include "core/resource.h" /** @@ -47,7 +47,7 @@ class Image; typedef Error (*SavePNGFunc)(const String &p_path, const Ref<Image> &p_img); -typedef PoolVector<uint8_t> (*SavePNGBufferFunc)(const Ref<Image> &p_img); +typedef Vector<uint8_t> (*SavePNGBufferFunc)(const Ref<Image> &p_img); typedef Ref<Image> (*ImageMemLoadFunc)(const uint8_t *p_png, int p_size); typedef Error (*SaveEXRFunc)(const String &p_path, const Ref<Image> &p_img, bool p_grayscale); @@ -150,16 +150,14 @@ public: static void (*_image_decompress_etc1)(Image *); static void (*_image_decompress_etc2)(Image *); - static PoolVector<uint8_t> (*lossy_packer)(const Ref<Image> &p_image, float p_quality); - static Ref<Image> (*lossy_unpacker)(const PoolVector<uint8_t> &p_buffer); - static PoolVector<uint8_t> (*lossless_packer)(const Ref<Image> &p_image); - static Ref<Image> (*lossless_unpacker)(const PoolVector<uint8_t> &p_buffer); - static PoolVector<uint8_t> (*basis_universal_packer)(const Ref<Image> &p_image, UsedChannels p_channels); - static Ref<Image> (*basis_universal_unpacker)(const PoolVector<uint8_t> &p_buffer); - - PoolVector<uint8_t>::Write write_lock; + static Vector<uint8_t> (*lossy_packer)(const Ref<Image> &p_image, float p_quality); + static Ref<Image> (*lossy_unpacker)(const Vector<uint8_t> &p_buffer); + static Vector<uint8_t> (*lossless_packer)(const Ref<Image> &p_image); + static Ref<Image> (*lossless_unpacker)(const Vector<uint8_t> &p_buffer); + static Vector<uint8_t> (*basis_universal_packer)(const Ref<Image> &p_image, UsedChannels p_channels); + static Ref<Image> (*basis_universal_unpacker)(const Vector<uint8_t> &p_buffer); - _FORCE_INLINE_ Color _get_color_at_ofs(uint8_t *ptr, uint32_t ofs) const; + _FORCE_INLINE_ Color _get_color_at_ofs(const uint8_t *ptr, uint32_t ofs) const; _FORCE_INLINE_ void _set_color_at_ofs(uint8_t *ptr, uint32_t ofs, const Color &p_color); protected: @@ -170,12 +168,12 @@ private: create(p_width, p_height, p_use_mipmaps, p_format); } - void _create_from_data(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const PoolVector<uint8_t> &p_data) { + void _create_from_data(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const Vector<uint8_t> &p_data) { create(p_width, p_height, p_use_mipmaps, p_format, p_data); } Format format; - PoolVector<uint8_t> data; + Vector<uint8_t> data; int width, height; bool mipmaps; @@ -198,7 +196,7 @@ private: void _set_data(const Dictionary &p_data); Dictionary _get_data() const; - Error _load_from_buffer(const PoolVector<uint8_t> &p_array, ImageMemLoadFunc p_loader); + Error _load_from_buffer(const Vector<uint8_t> &p_array, ImageMemLoadFunc p_loader); static void average_4_uint8(uint8_t &p_out, const uint8_t &p_a, const uint8_t &p_b, const uint8_t &p_c, const uint8_t &p_d); static void average_4_float(float &p_out, const float &p_a, const float &p_b, const float &p_c, const float &p_d); @@ -270,7 +268,7 @@ public: * Create a new image of a given size and format. Current image will be lost */ void create(int p_width, int p_height, bool p_use_mipmaps, Format p_format); - void create(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const PoolVector<uint8_t> &p_data); + void create(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const Vector<uint8_t> &p_data); void create(const char **p_xpm); /** @@ -278,11 +276,11 @@ public: */ bool empty() const; - PoolVector<uint8_t> get_data() const; + Vector<uint8_t> get_data() const; Error load(const String &p_path); Error save_png(const String &p_path) const; - PoolVector<uint8_t> save_png_to_buffer() const; + Vector<uint8_t> save_png_to_buffer() const; Error save_exr(const String &p_path, bool p_grayscale) const; /** @@ -296,7 +294,7 @@ public: /** * import an image of a specific size and format from a pointer */ - Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const PoolVector<uint8_t> &p_data); + Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const Vector<uint8_t> &p_data); enum AlphaMode { ALPHA_NONE, @@ -358,9 +356,9 @@ public: static void set_compress_bptc_func(void (*p_compress_func)(Image *, float, UsedChannels)); static String get_format_name(Format p_format); - Error load_png_from_buffer(const PoolVector<uint8_t> &p_array); - Error load_jpg_from_buffer(const PoolVector<uint8_t> &p_array); - Error load_webp_from_buffer(const PoolVector<uint8_t> &p_array); + Error load_png_from_buffer(const Vector<uint8_t> &p_array); + Error load_jpg_from_buffer(const Vector<uint8_t> &p_array); + Error load_webp_from_buffer(const Vector<uint8_t> &p_array); void convert_rg_to_ra_rgba8(); void convert_ra_rgba8_to_rg(); @@ -370,9 +368,6 @@ public: virtual Ref<Resource> duplicate(bool p_subresources = false) const; - void lock(); - void unlock(); - UsedChannels detect_used_channels(CompressSource p_source = COMPRESS_SOURCE_GENERIC); void optimize_channels(); diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp index 5968972143..b44ac16a87 100644 --- a/core/io/config_file.cpp +++ b/core/io/config_file.cpp @@ -34,11 +34,11 @@ #include "core/os/keyboard.h" #include "core/variant_parser.h" -PoolStringArray ConfigFile::_get_sections() const { +PackedStringArray ConfigFile::_get_sections() const { List<String> s; get_sections(&s); - PoolStringArray arr; + PackedStringArray arr; arr.resize(s.size()); int idx = 0; for (const List<String>::Element *E = s.front(); E; E = E->next()) { @@ -49,11 +49,11 @@ PoolStringArray ConfigFile::_get_sections() const { return arr; } -PoolStringArray ConfigFile::_get_section_keys(const String &p_section) const { +PackedStringArray ConfigFile::_get_section_keys(const String &p_section) const { List<String> s; get_section_keys(p_section, &s); - PoolStringArray arr; + PackedStringArray arr; arr.resize(s.size()); int idx = 0; for (const List<String>::Element *E = s.front(); E; E = E->next()) { diff --git a/core/io/config_file.h b/core/io/config_file.h index 2d61ef6afe..150fd24693 100644 --- a/core/io/config_file.h +++ b/core/io/config_file.h @@ -42,8 +42,8 @@ class ConfigFile : public Reference { OrderedHashMap<String, OrderedHashMap<String, Variant> > values; - PoolStringArray _get_sections() const; - PoolStringArray _get_section_keys(const String &p_section) const; + PackedStringArray _get_sections() const; + PackedStringArray _get_section_keys(const String &p_section) const; Error _internal_load(const String &p_path, FileAccess *f); Error _internal_save(FileAccess *file); diff --git a/core/io/file_access_buffered.cpp b/core/io/file_access_buffered.cpp index 6ac065a19b..ab0fb3943c 100644 --- a/core/io/file_access_buffered.cpp +++ b/core/io/file_access_buffered.cpp @@ -113,7 +113,7 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_length) const { int size = (cache.buffer.size() - (file.offset - cache.offset)); size = size - (size % 4); - //PoolVector<uint8_t>::Read read = cache.buffer.read(); + //const uint8_t* read = cache.buffer.ptr(); //memcpy(p_dest, read.ptr() + (file.offset - cache.offset), size); memcpy(p_dest, cache.buffer.ptr() + (file.offset - cache.offset), size); p_dest += size; @@ -145,7 +145,7 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_length) const { } int r = MIN(left, to_read); - //PoolVector<uint8_t>::Read read = cache.buffer.read(); + //const uint8_t* read = cache.buffer.ptr(); //memcpy(p_dest+total_read, &read.ptr()[file.offset - cache.offset], r); memcpy(p_dest + total_read, cache.buffer.ptr() + (file.offset - cache.offset), r); diff --git a/core/io/file_access_buffered.h b/core/io/file_access_buffered.h index 5e2939c1a2..a6177c20be 100644 --- a/core/io/file_access_buffered.h +++ b/core/io/file_access_buffered.h @@ -32,7 +32,7 @@ #define FILE_ACCESS_BUFFERED_H #include "core/os/file_access.h" -#include "core/pool_vector.h" + #include "core/ustring.h" class FileAccessBuffered : public FileAccess { diff --git a/core/io/file_access_buffered_fa.h b/core/io/file_access_buffered_fa.h index c17652080c..6ec77d503b 100644 --- a/core/io/file_access_buffered_fa.h +++ b/core/io/file_access_buffered_fa.h @@ -54,8 +54,8 @@ class FileAccessBufferedFA : public FileAccessBuffered { cache.offset = p_offset; cache.buffer.resize(p_size); - // on PoolVector - //PoolVector<uint8_t>::Write write = cache.buffer.write(); + // on Vector + //uint8_t* write = cache.buffer.ptrw(); //f.get_buffer(write.ptrw(), p_size); // on vector diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 541bd3a7c8..ce7025de35 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -110,7 +110,7 @@ Ref<StreamPeer> HTTPClient::get_connection() const { return connection; } -Error HTTPClient::request_raw(Method p_method, const String &p_url, const Vector<String> &p_headers, const PoolVector<uint8_t> &p_body) { +Error HTTPClient::request_raw(Method p_method, const String &p_url, const Vector<String> &p_headers, const Vector<uint8_t> &p_body) { ERR_FAIL_INDEX_V(p_method, METHOD_MAX, ERR_INVALID_PARAMETER); ERR_FAIL_COND_V(!p_url.begins_with("/"), ERR_INVALID_PARAMETER); @@ -152,10 +152,10 @@ Error HTTPClient::request_raw(Method p_method, const String &p_url, const Vector request += "\r\n"; CharString cs = request.utf8(); - PoolVector<uint8_t> data; + Vector<uint8_t> data; data.resize(cs.length()); { - PoolVector<uint8_t>::Write data_write = data.write(); + uint8_t *data_write = data.ptrw(); for (int i = 0; i < cs.length(); i++) { data_write[i] = cs[i]; } @@ -163,7 +163,7 @@ Error HTTPClient::request_raw(Method p_method, const String &p_url, const Vector data.append_array(p_body); - PoolVector<uint8_t>::Read r = data.read(); + const uint8_t *r = data.ptr(); Error err = connection->put_data(&r[0], data.size()); if (err) { @@ -517,11 +517,11 @@ int HTTPClient::get_response_body_length() const { return body_size; } -PoolByteArray HTTPClient::read_response_body_chunk() { +PackedByteArray HTTPClient::read_response_body_chunk() { - ERR_FAIL_COND_V(status != STATUS_BODY, PoolByteArray()); + ERR_FAIL_COND_V(status != STATUS_BODY, PackedByteArray()); - PoolByteArray ret; + PackedByteArray ret; Error err = OK; if (chunked) { @@ -622,8 +622,8 @@ PoolByteArray HTTPClient::read_response_body_chunk() { } ret.resize(chunk.size() - 2); - PoolByteArray::Write w = ret.write(); - copymem(w.ptr(), chunk.ptr(), chunk.size() - 2); + uint8_t *w = ret.ptrw(); + copymem(w, chunk.ptr(), chunk.size() - 2); chunk.clear(); } @@ -639,8 +639,8 @@ PoolByteArray HTTPClient::read_response_body_chunk() { while (to_read > 0) { int rec = 0; { - PoolByteArray::Write w = ret.write(); - err = _get_http_data(w.ptr() + _offset, to_read, rec); + uint8_t *w = ret.ptrw(); + err = _get_http_data(w + _offset, to_read, rec); } if (rec <= 0) { // Ended up reading less ret.resize(_offset); @@ -801,11 +801,11 @@ Dictionary HTTPClient::_get_response_headers_as_dictionary() { return ret; } -PoolStringArray HTTPClient::_get_response_headers() { +PackedStringArray HTTPClient::_get_response_headers() { List<String> rh; get_response_headers(&rh); - PoolStringArray ret; + PackedStringArray ret; ret.resize(rh.size()); int idx = 0; for (const List<String>::Element *E = rh.front(); E; E = E->next()) { diff --git a/core/io/http_client.h b/core/io/http_client.h index 3796eb992c..03ba20f8dd 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -191,7 +191,7 @@ private: #include "platform/javascript/http_client.h.inc" #endif - PoolStringArray _get_response_headers(); + PackedStringArray _get_response_headers(); Dictionary _get_response_headers_as_dictionary(); static void _bind_methods(); @@ -202,7 +202,7 @@ public: void set_connection(const Ref<StreamPeer> &p_connection); Ref<StreamPeer> get_connection() const; - Error request_raw(Method p_method, const String &p_url, const Vector<String> &p_headers, const PoolVector<uint8_t> &p_body); + Error request_raw(Method p_method, const String &p_url, const Vector<String> &p_headers, const Vector<uint8_t> &p_body); Error request(Method p_method, const String &p_url, const Vector<String> &p_headers, const String &p_body = String()); void close(); @@ -215,7 +215,7 @@ public: Error get_response_headers(List<String> *r_response); int get_response_body_length() const; - PoolByteArray read_response_body_chunk(); // Can't get body as partial text because of most encodings UTF8, gzip, etc. + PackedByteArray read_response_body_chunk(); // Can't get body as partial text because of most encodings UTF8, gzip, etc. void set_blocking_mode(bool p_enable); // Useful mostly if running in a thread bool is_blocking_mode_enabled() const; diff --git a/core/io/json.cpp b/core/io/json.cpp index 144e4bdc3b..08a147032f 100644 --- a/core/io/json.cpp +++ b/core/io/json.cpp @@ -71,9 +71,9 @@ String JSON::_print_var(const Variant &p_var, const String &p_indent, int p_cur_ case Variant::BOOL: return p_var.operator bool() ? "true" : "false"; case Variant::INT: return itos(p_var); case Variant::REAL: return rtos(p_var); - case Variant::POOL_INT_ARRAY: - case Variant::POOL_REAL_ARRAY: - case Variant::POOL_STRING_ARRAY: + case Variant::PACKED_INT_ARRAY: + case Variant::PACKED_REAL_ARRAY: + case Variant::PACKED_STRING_ARRAY: case Variant::ARRAY: { String s = "["; diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 17edc4982c..6548faac9f 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -535,7 +535,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int } break; // arrays - case Variant::POOL_BYTE_ARRAY: { + case Variant::PACKED_BYTE_ARRAY: { ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA); int32_t count = decode_uint32(buf); @@ -543,11 +543,11 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int len -= 4; ERR_FAIL_COND_V(count < 0 || count > len, ERR_INVALID_DATA); - PoolVector<uint8_t> data; + Vector<uint8_t> data; if (count) { data.resize(count); - PoolVector<uint8_t>::Write w = data.write(); + uint8_t *w = data.ptrw(); for (int32_t i = 0; i < count; i++) { w[i] = buf[i]; @@ -563,7 +563,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int } } break; - case Variant::POOL_INT_ARRAY: { + case Variant::PACKED_INT_ARRAY: { ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA); int32_t count = decode_uint32(buf); @@ -572,12 +572,12 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int ERR_FAIL_MUL_OF(count, 4, ERR_INVALID_DATA); ERR_FAIL_COND_V(count < 0 || count * 4 > len, ERR_INVALID_DATA); - PoolVector<int> data; + Vector<int> data; if (count) { //const int*rbuf=(const int*)buf; data.resize(count); - PoolVector<int>::Write w = data.write(); + int *w = data.ptrw(); for (int32_t i = 0; i < count; i++) { w[i] = decode_uint32(&buf[i * 4]); @@ -589,7 +589,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int } } break; - case Variant::POOL_REAL_ARRAY: { + case Variant::PACKED_REAL_ARRAY: { ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA); int32_t count = decode_uint32(buf); @@ -598,12 +598,12 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int ERR_FAIL_MUL_OF(count, 4, ERR_INVALID_DATA); ERR_FAIL_COND_V(count < 0 || count * 4 > len, ERR_INVALID_DATA); - PoolVector<float> data; + Vector<float> data; if (count) { //const float*rbuf=(const float*)buf; data.resize(count); - PoolVector<float>::Write w = data.write(); + float *w = data.ptrw(); for (int32_t i = 0; i < count; i++) { w[i] = decode_float(&buf[i * 4]); @@ -616,12 +616,12 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int } } break; - case Variant::POOL_STRING_ARRAY: { + case Variant::PACKED_STRING_ARRAY: { ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA); int32_t count = decode_uint32(buf); - PoolVector<String> strings; + Vector<String> strings; buf += 4; len -= 4; @@ -642,7 +642,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int r_variant = strings; } break; - case Variant::POOL_VECTOR2_ARRAY: { + case Variant::PACKED_VECTOR2_ARRAY: { ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA); int32_t count = decode_uint32(buf); @@ -651,7 +651,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int ERR_FAIL_MUL_OF(count, 4 * 2, ERR_INVALID_DATA); ERR_FAIL_COND_V(count < 0 || count * 4 * 2 > len, ERR_INVALID_DATA); - PoolVector<Vector2> varray; + Vector<Vector2> varray; if (r_len) { (*r_len) += 4; @@ -659,7 +659,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int if (count) { varray.resize(count); - PoolVector<Vector2>::Write w = varray.write(); + Vector2 *w = varray.ptrw(); for (int32_t i = 0; i < count; i++) { @@ -676,7 +676,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int r_variant = varray; } break; - case Variant::POOL_VECTOR3_ARRAY: { + case Variant::PACKED_VECTOR3_ARRAY: { ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA); int32_t count = decode_uint32(buf); @@ -686,7 +686,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int ERR_FAIL_MUL_OF(count, 4 * 3, ERR_INVALID_DATA); ERR_FAIL_COND_V(count < 0 || count * 4 * 3 > len, ERR_INVALID_DATA); - PoolVector<Vector3> varray; + Vector<Vector3> varray; if (r_len) { (*r_len) += 4; @@ -694,7 +694,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int if (count) { varray.resize(count); - PoolVector<Vector3>::Write w = varray.write(); + Vector3 *w = varray.ptrw(); for (int32_t i = 0; i < count; i++) { @@ -712,7 +712,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int r_variant = varray; } break; - case Variant::POOL_COLOR_ARRAY: { + case Variant::PACKED_COLOR_ARRAY: { ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA); int32_t count = decode_uint32(buf); @@ -722,7 +722,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int ERR_FAIL_MUL_OF(count, 4 * 4, ERR_INVALID_DATA); ERR_FAIL_COND_V(count < 0 || count * 4 * 4 > len, ERR_INVALID_DATA); - PoolVector<Color> carray; + Vector<Color> carray; if (r_len) { (*r_len) += 4; @@ -730,7 +730,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int if (count) { carray.resize(count); - PoolVector<Color>::Write w = carray.write(); + Color *w = carray.ptrw(); for (int32_t i = 0; i < count; i++) { @@ -1207,16 +1207,16 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo } break; // arrays - case Variant::POOL_BYTE_ARRAY: { + case Variant::PACKED_BYTE_ARRAY: { - PoolVector<uint8_t> data = p_variant; + Vector<uint8_t> data = p_variant; int datalen = data.size(); int datasize = sizeof(uint8_t); if (buf) { encode_uint32(datalen, buf); buf += 4; - PoolVector<uint8_t>::Read r = data.read(); + const uint8_t *r = data.ptr(); copymem(buf, &r[0], datalen * datasize); buf += datalen * datasize; } @@ -1229,16 +1229,16 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo } } break; - case Variant::POOL_INT_ARRAY: { + case Variant::PACKED_INT_ARRAY: { - PoolVector<int> data = p_variant; + Vector<int> data = p_variant; int datalen = data.size(); int datasize = sizeof(int32_t); if (buf) { encode_uint32(datalen, buf); buf += 4; - PoolVector<int>::Read r = data.read(); + const int *r = data.ptr(); for (int i = 0; i < datalen; i++) encode_uint32(r[i], &buf[i * datasize]); } @@ -1246,16 +1246,16 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo r_len += 4 + datalen * datasize; } break; - case Variant::POOL_REAL_ARRAY: { + case Variant::PACKED_REAL_ARRAY: { - PoolVector<real_t> data = p_variant; + Vector<real_t> data = p_variant; int datalen = data.size(); int datasize = sizeof(real_t); if (buf) { encode_uint32(datalen, buf); buf += 4; - PoolVector<real_t>::Read r = data.read(); + const real_t *r = data.ptr(); for (int i = 0; i < datalen; i++) encode_float(r[i], &buf[i * datasize]); } @@ -1263,9 +1263,9 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo r_len += 4 + datalen * datasize; } break; - case Variant::POOL_STRING_ARRAY: { + case Variant::PACKED_STRING_ARRAY: { - PoolVector<String> data = p_variant; + Vector<String> data = p_variant; int len = data.size(); if (buf) { @@ -1295,9 +1295,9 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo } } break; - case Variant::POOL_VECTOR2_ARRAY: { + case Variant::PACKED_VECTOR2_ARRAY: { - PoolVector<Vector2> data = p_variant; + Vector<Vector2> data = p_variant; int len = data.size(); if (buf) { @@ -1322,9 +1322,9 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo r_len += 4 * 2 * len; } break; - case Variant::POOL_VECTOR3_ARRAY: { + case Variant::PACKED_VECTOR3_ARRAY: { - PoolVector<Vector3> data = p_variant; + Vector<Vector3> data = p_variant; int len = data.size(); if (buf) { @@ -1350,9 +1350,9 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo r_len += 4 * 3 * len; } break; - case Variant::POOL_COLOR_ARRAY: { + case Variant::PACKED_COLOR_ARRAY: { - PoolVector<Color> data = p_variant; + Vector<Color> data = p_variant; int len = data.size(); if (buf) { diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp index 3f66e00021..abe629ecba 100644 --- a/core/io/multiplayer_api.cpp +++ b/core/io/multiplayer_api.cpp @@ -1087,14 +1087,14 @@ void MultiplayerAPI::rsetp(Node *p_node, int p_peer_id, bool p_unreliable, const _send_rpc(p_node, p_peer_id, p_unreliable, true, p_property, &vptr, 1); } -Error MultiplayerAPI::send_bytes(PoolVector<uint8_t> p_data, int p_to, NetworkedMultiplayerPeer::TransferMode p_mode) { +Error MultiplayerAPI::send_bytes(Vector<uint8_t> p_data, int p_to, NetworkedMultiplayerPeer::TransferMode p_mode) { ERR_FAIL_COND_V_MSG(p_data.size() < 1, ERR_INVALID_DATA, "Trying to send an empty raw packet."); ERR_FAIL_COND_V_MSG(!network_peer.is_valid(), ERR_UNCONFIGURED, "Trying to send a raw packet while no network peer is active."); ERR_FAIL_COND_V_MSG(network_peer->get_connection_status() != NetworkedMultiplayerPeer::CONNECTION_CONNECTED, ERR_UNCONFIGURED, "Trying to send a raw packet via a network peer which is not connected."); MAKE_ROOM(p_data.size() + 1); - PoolVector<uint8_t>::Read r = p_data.read(); + const uint8_t *r = p_data.ptr(); packet_cache.write[0] = NETWORK_COMMAND_RAW; memcpy(&packet_cache.write[1], &r[0], p_data.size()); @@ -1108,11 +1108,11 @@ void MultiplayerAPI::_process_raw(int p_from, const uint8_t *p_packet, int p_pac ERR_FAIL_COND_MSG(p_packet_len < 2, "Invalid packet received. Size too small."); - PoolVector<uint8_t> out; + Vector<uint8_t> out; int len = p_packet_len - 1; out.resize(len); { - PoolVector<uint8_t>::Write w = out.write(); + uint8_t *w = out.ptrw(); memcpy(&w[0], &p_packet[1], len); } emit_signal("network_peer_packet", p_from, out); @@ -1284,7 +1284,7 @@ void MultiplayerAPI::_bind_methods() { ADD_SIGNAL(MethodInfo("network_peer_connected", PropertyInfo(Variant::INT, "id"))); ADD_SIGNAL(MethodInfo("network_peer_disconnected", PropertyInfo(Variant::INT, "id"))); - ADD_SIGNAL(MethodInfo("network_peer_packet", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::POOL_BYTE_ARRAY, "packet"))); + ADD_SIGNAL(MethodInfo("network_peer_packet", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::PACKED_BYTE_ARRAY, "packet"))); ADD_SIGNAL(MethodInfo("connected_to_server")); ADD_SIGNAL(MethodInfo("connection_failed")); ADD_SIGNAL(MethodInfo("server_disconnected")); diff --git a/core/io/multiplayer_api.h b/core/io/multiplayer_api.h index 8748dba03c..a706a0e450 100644 --- a/core/io/multiplayer_api.h +++ b/core/io/multiplayer_api.h @@ -145,7 +145,7 @@ public: void set_root_node(Node *p_node); void set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_peer); Ref<NetworkedMultiplayerPeer> get_network_peer() const; - Error send_bytes(PoolVector<uint8_t> p_data, int p_to = NetworkedMultiplayerPeer::TARGET_PEER_BROADCAST, NetworkedMultiplayerPeer::TransferMode p_mode = NetworkedMultiplayerPeer::TRANSFER_MODE_RELIABLE); + Error send_bytes(Vector<uint8_t> p_data, int p_to = NetworkedMultiplayerPeer::TARGET_PEER_BROADCAST, NetworkedMultiplayerPeer::TransferMode p_mode = NetworkedMultiplayerPeer::TRANSFER_MODE_RELIABLE); // Called by Node.rpc void rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const StringName &p_method, const Variant **p_arg, int p_argcount); diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp index 81d7b86161..2f5c493c2c 100644 --- a/core/io/packet_peer.cpp +++ b/core/io/packet_peer.cpp @@ -53,7 +53,7 @@ int PacketPeer::get_encode_buffer_max_size() const { return encode_buffer_max_size; } -Error PacketPeer::get_packet_buffer(PoolVector<uint8_t> &r_buffer) { +Error PacketPeer::get_packet_buffer(Vector<uint8_t> &r_buffer) { const uint8_t *buffer; int buffer_size; @@ -65,20 +65,20 @@ Error PacketPeer::get_packet_buffer(PoolVector<uint8_t> &r_buffer) { if (buffer_size == 0) return OK; - PoolVector<uint8_t>::Write w = r_buffer.write(); + uint8_t *w = r_buffer.ptrw(); for (int i = 0; i < buffer_size; i++) w[i] = buffer[i]; return OK; } -Error PacketPeer::put_packet_buffer(const PoolVector<uint8_t> &p_buffer) { +Error PacketPeer::put_packet_buffer(const Vector<uint8_t> &p_buffer) { int len = p_buffer.size(); if (len == 0) return OK; - PoolVector<uint8_t>::Read r = p_buffer.read(); + const uint8_t *r = p_buffer.ptr(); return put_packet(&r[0], len); } @@ -110,11 +110,11 @@ Error PacketPeer::put_var(const Variant &p_packet, bool p_full_objects) { encode_buffer.resize(next_power_of_2(len)); } - PoolVector<uint8_t>::Write w = encode_buffer.write(); - err = encode_variant(p_packet, w.ptr(), len, p_full_objects); + uint8_t *w = encode_buffer.ptrw(); + err = encode_variant(p_packet, w, len, p_full_objects); ERR_FAIL_COND_V_MSG(err != OK, err, "Error when trying to encode Variant."); - return put_packet(w.ptr(), len); + return put_packet(w, len); } Variant PacketPeer::_bnd_get_var(bool p_allow_objects) { @@ -125,12 +125,12 @@ Variant PacketPeer::_bnd_get_var(bool p_allow_objects) { return var; } -Error PacketPeer::_put_packet(const PoolVector<uint8_t> &p_buffer) { +Error PacketPeer::_put_packet(const Vector<uint8_t> &p_buffer) { return put_packet_buffer(p_buffer); } -PoolVector<uint8_t> PacketPeer::_get_packet() { +Vector<uint8_t> PacketPeer::_get_packet() { - PoolVector<uint8_t> raw; + Vector<uint8_t> raw; last_get_error = get_packet_buffer(raw); return raw; } diff --git a/core/io/packet_peer.h b/core/io/packet_peer.h index bee69f5ca9..62144259cc 100644 --- a/core/io/packet_peer.h +++ b/core/io/packet_peer.h @@ -43,14 +43,14 @@ class PacketPeer : public Reference { static void _bind_methods(); - Error _put_packet(const PoolVector<uint8_t> &p_buffer); - PoolVector<uint8_t> _get_packet(); + Error _put_packet(const Vector<uint8_t> &p_buffer); + Vector<uint8_t> _get_packet(); Error _get_packet_error() const; mutable Error last_get_error; int encode_buffer_max_size; - PoolVector<uint8_t> encode_buffer; + Vector<uint8_t> encode_buffer; public: virtual int get_available_packet_count() const = 0; @@ -61,8 +61,8 @@ public: /* helpers / binders */ - virtual Error get_packet_buffer(PoolVector<uint8_t> &r_buffer); - virtual Error put_packet_buffer(const PoolVector<uint8_t> &p_buffer); + virtual Error get_packet_buffer(Vector<uint8_t> &r_buffer); + virtual Error put_packet_buffer(const Vector<uint8_t> &p_buffer); virtual Error get_var(Variant &r_variant, bool p_allow_objects = false); virtual Error put_var(const Variant &p_packet, bool p_full_objects = false); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 02ae5788fc..d4c1fd2e9b 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -398,12 +398,12 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { uint32_t len = f->get_32(); - PoolVector<uint8_t> array; + Vector<uint8_t> array; array.resize(len); - PoolVector<uint8_t>::Write w = array.write(); - f->get_buffer(w.ptr(), len); + uint8_t *w = array.ptrw(); + f->get_buffer(w, len); _advance_padding(len); - w.release(); + r_v = array; } break; @@ -411,10 +411,10 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { uint32_t len = f->get_32(); - PoolVector<int> array; + Vector<int> array; array.resize(len); - PoolVector<int>::Write w = array.write(); - f->get_buffer((uint8_t *)w.ptr(), len * 4); + int *w = array.ptrw(); + f->get_buffer((uint8_t *)w, len * 4); #ifdef BIG_ENDIAN_ENABLED { uint32_t *ptr = (uint32_t *)w.ptr(); @@ -425,17 +425,17 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { } #endif - w.release(); + r_v = array; } break; case VARIANT_REAL_ARRAY: { uint32_t len = f->get_32(); - PoolVector<real_t> array; + Vector<real_t> array; array.resize(len); - PoolVector<real_t>::Write w = array.write(); - f->get_buffer((uint8_t *)w.ptr(), len * sizeof(real_t)); + real_t *w = array.ptrw(); + f->get_buffer((uint8_t *)w, len * sizeof(real_t)); #ifdef BIG_ENDIAN_ENABLED { uint32_t *ptr = (uint32_t *)w.ptr(); @@ -447,18 +447,17 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { #endif - w.release(); r_v = array; } break; case VARIANT_STRING_ARRAY: { uint32_t len = f->get_32(); - PoolVector<String> array; + Vector<String> array; array.resize(len); - PoolVector<String>::Write w = array.write(); + String *w = array.ptrw(); for (uint32_t i = 0; i < len; i++) w[i] = get_unicode_string(); - w.release(); + r_v = array; } break; @@ -466,11 +465,11 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { uint32_t len = f->get_32(); - PoolVector<Vector2> array; + Vector<Vector2> array; array.resize(len); - PoolVector<Vector2>::Write w = array.write(); + Vector2 *w = array.ptrw(); if (sizeof(Vector2) == 8) { - f->get_buffer((uint8_t *)w.ptr(), len * sizeof(real_t) * 2); + f->get_buffer((uint8_t *)w, len * sizeof(real_t) * 2); #ifdef BIG_ENDIAN_ENABLED { uint32_t *ptr = (uint32_t *)w.ptr(); @@ -485,7 +484,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { } else { ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "Vector2 size is NOT 8!"); } - w.release(); + r_v = array; } break; @@ -493,11 +492,11 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { uint32_t len = f->get_32(); - PoolVector<Vector3> array; + Vector<Vector3> array; array.resize(len); - PoolVector<Vector3>::Write w = array.write(); + Vector3 *w = array.ptrw(); if (sizeof(Vector3) == 12) { - f->get_buffer((uint8_t *)w.ptr(), len * sizeof(real_t) * 3); + f->get_buffer((uint8_t *)w, len * sizeof(real_t) * 3); #ifdef BIG_ENDIAN_ENABLED { uint32_t *ptr = (uint32_t *)w.ptr(); @@ -512,7 +511,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { } else { ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "Vector3 size is NOT 12!"); } - w.release(); + r_v = array; } break; @@ -520,11 +519,11 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { uint32_t len = f->get_32(); - PoolVector<Color> array; + Vector<Color> array; array.resize(len); - PoolVector<Color>::Write w = array.write(); + Color *w = array.ptrw(); if (sizeof(Color) == 16) { - f->get_buffer((uint8_t *)w.ptr(), len * sizeof(real_t) * 4); + f->get_buffer((uint8_t *)w, len * sizeof(real_t) * 4); #ifdef BIG_ENDIAN_ENABLED { uint32_t *ptr = (uint32_t *)w.ptr(); @@ -539,7 +538,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { } else { ERR_FAIL_V_MSG(ERR_UNAVAILABLE, "Color size is NOT 16!"); } - w.release(); + r_v = array; } break; default: { @@ -1473,59 +1472,59 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia } } break; - case Variant::POOL_BYTE_ARRAY: { + case Variant::PACKED_BYTE_ARRAY: { f->store_32(VARIANT_RAW_ARRAY); - PoolVector<uint8_t> arr = p_property; + Vector<uint8_t> arr = p_property; int len = arr.size(); f->store_32(len); - PoolVector<uint8_t>::Read r = arr.read(); - f->store_buffer(r.ptr(), len); + const uint8_t *r = arr.ptr(); + f->store_buffer(r, len); _pad_buffer(f, len); } break; - case Variant::POOL_INT_ARRAY: { + case Variant::PACKED_INT_ARRAY: { f->store_32(VARIANT_INT_ARRAY); - PoolVector<int> arr = p_property; + Vector<int> arr = p_property; int len = arr.size(); f->store_32(len); - PoolVector<int>::Read r = arr.read(); + const int *r = arr.ptr(); for (int i = 0; i < len; i++) f->store_32(r[i]); } break; - case Variant::POOL_REAL_ARRAY: { + case Variant::PACKED_REAL_ARRAY: { f->store_32(VARIANT_REAL_ARRAY); - PoolVector<real_t> arr = p_property; + Vector<real_t> arr = p_property; int len = arr.size(); f->store_32(len); - PoolVector<real_t>::Read r = arr.read(); + const real_t *r = arr.ptr(); for (int i = 0; i < len; i++) { f->store_real(r[i]); } } break; - case Variant::POOL_STRING_ARRAY: { + case Variant::PACKED_STRING_ARRAY: { f->store_32(VARIANT_STRING_ARRAY); - PoolVector<String> arr = p_property; + Vector<String> arr = p_property; int len = arr.size(); f->store_32(len); - PoolVector<String>::Read r = arr.read(); + const String *r = arr.ptr(); for (int i = 0; i < len; i++) { save_unicode_string(f, r[i]); } } break; - case Variant::POOL_VECTOR3_ARRAY: { + case Variant::PACKED_VECTOR3_ARRAY: { f->store_32(VARIANT_VECTOR3_ARRAY); - PoolVector<Vector3> arr = p_property; + Vector<Vector3> arr = p_property; int len = arr.size(); f->store_32(len); - PoolVector<Vector3>::Read r = arr.read(); + const Vector3 *r = arr.ptr(); for (int i = 0; i < len; i++) { f->store_real(r[i].x); f->store_real(r[i].y); @@ -1533,26 +1532,26 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia } } break; - case Variant::POOL_VECTOR2_ARRAY: { + case Variant::PACKED_VECTOR2_ARRAY: { f->store_32(VARIANT_VECTOR2_ARRAY); - PoolVector<Vector2> arr = p_property; + Vector<Vector2> arr = p_property; int len = arr.size(); f->store_32(len); - PoolVector<Vector2>::Read r = arr.read(); + const Vector2 *r = arr.ptr(); for (int i = 0; i < len; i++) { f->store_real(r[i].x); f->store_real(r[i].y); } } break; - case Variant::POOL_COLOR_ARRAY: { + case Variant::PACKED_COLOR_ARRAY: { f->store_32(VARIANT_COLOR_ARRAY); - PoolVector<Color> arr = p_property; + Vector<Color> arr = p_property; int len = arr.size(); f->store_32(len); - PoolVector<Color>::Read r = arr.read(); + const Color *r = arr.ptr(); for (int i = 0; i < len; i++) { f->store_real(r[i].r); f->store_real(r[i].g); diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 6877f816e1..1d5d8f9280 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -157,10 +157,10 @@ bool ResourceFormatLoader::exists(const String &p_path) const { void ResourceFormatLoader::get_recognized_extensions(List<String> *p_extensions) const { if (get_script_instance() && get_script_instance()->has_method("get_recognized_extensions")) { - PoolStringArray exts = get_script_instance()->call("get_recognized_extensions"); + PackedStringArray exts = get_script_instance()->call("get_recognized_extensions"); { - PoolStringArray::Read r = exts.read(); + const String *r = exts.ptr(); for (int i = 0; i < exts.size(); ++i) { p_extensions->push_back(r[i]); } @@ -212,10 +212,10 @@ RES ResourceFormatLoader::load(const String &p_path, const String &p_original_pa void ResourceFormatLoader::get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types) { if (get_script_instance() && get_script_instance()->has_method("get_dependencies")) { - PoolStringArray deps = get_script_instance()->call("get_dependencies", p_path, p_add_types); + PackedStringArray deps = get_script_instance()->call("get_dependencies", p_path, p_add_types); { - PoolStringArray::Read r = deps.read(); + const String *r = deps.ptr(); for (int i = 0; i < deps.size(); ++i) { p_dependencies->push_back(r[i]); } @@ -247,7 +247,7 @@ void ResourceFormatLoader::_bind_methods() { ClassDB::add_virtual_method(get_class_static(), info); } - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::POOL_STRING_ARRAY, "get_recognized_extensions")); + ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::PACKED_STRING_ARRAY, "get_recognized_extensions")); ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "handles_type", PropertyInfo(Variant::STRING, "typename"))); ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_resource_type", PropertyInfo(Variant::STRING, "path"))); ClassDB::add_virtual_method(get_class_static(), MethodInfo("get_dependencies", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::STRING, "add_types"))); @@ -743,7 +743,7 @@ String ResourceLoader::_path_remap(const String &p_path, bool *r_translation_rem if (translation_remaps.has(p_path)) { // translation_remaps has the following format: - // { "res://path.png": PoolStringArray( "res://path-ru.png:ru", "res://path-de.png:de" ) } + // { "res://path.png": PackedStringArray( "res://path-ru.png:ru", "res://path-de.png:de" ) } // To find the path of the remapped resource, we extract the locale name after // the last ':' to match the project locale. @@ -905,10 +905,10 @@ void ResourceLoader::load_path_remaps() { if (!ProjectSettings::get_singleton()->has_setting("path_remap/remapped_paths")) return; - PoolVector<String> remaps = ProjectSettings::get_singleton()->get("path_remap/remapped_paths"); + Vector<String> remaps = ProjectSettings::get_singleton()->get("path_remap/remapped_paths"); int rc = remaps.size(); ERR_FAIL_COND(rc & 1); //must be even - PoolVector<String>::Read r = remaps.read(); + const String *r = remaps.ptr(); for (int i = 0; i < rc; i += 2) { diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp index 685d21107f..740aaf5cfa 100644 --- a/core/io/resource_saver.cpp +++ b/core/io/resource_saver.cpp @@ -61,10 +61,10 @@ bool ResourceFormatSaver::recognize(const RES &p_resource) const { void ResourceFormatSaver::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const { if (get_script_instance() && get_script_instance()->has_method("get_recognized_extensions")) { - PoolStringArray exts = get_script_instance()->call("get_recognized_extensions", p_resource); + PackedStringArray exts = get_script_instance()->call("get_recognized_extensions", p_resource); { - PoolStringArray::Read r = exts.read(); + const String *r = exts.ptr(); for (int i = 0; i < exts.size(); ++i) { p_extensions->push_back(r[i]); } @@ -81,7 +81,7 @@ void ResourceFormatSaver::_bind_methods() { ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "save", arg0, arg1, arg2)); } - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::POOL_STRING_ARRAY, "get_recognized_extensions", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource"))); + ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::PACKED_STRING_ARRAY, "get_recognized_extensions", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource"))); ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "recognize", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource"))); } diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp index dee82de691..3c695c18fc 100644 --- a/core/io/stream_peer.cpp +++ b/core/io/stream_peer.cpp @@ -32,16 +32,16 @@ #include "core/io/marshalls.h" -Error StreamPeer::_put_data(const PoolVector<uint8_t> &p_data) { +Error StreamPeer::_put_data(const Vector<uint8_t> &p_data) { int len = p_data.size(); if (len == 0) return OK; - PoolVector<uint8_t>::Read r = p_data.read(); + const uint8_t *r = p_data.ptr(); return put_data(&r[0], len); } -Array StreamPeer::_put_partial_data(const PoolVector<uint8_t> &p_data) { +Array StreamPeer::_put_partial_data(const Vector<uint8_t> &p_data) { Array ret; @@ -52,7 +52,7 @@ Array StreamPeer::_put_partial_data(const PoolVector<uint8_t> &p_data) { return ret; } - PoolVector<uint8_t>::Read r = p_data.read(); + const uint8_t *r = p_data.ptr(); int sent; Error err = put_partial_data(&r[0], len, sent); @@ -68,18 +68,18 @@ Array StreamPeer::_get_data(int p_bytes) { Array ret; - PoolVector<uint8_t> data; + Vector<uint8_t> data; data.resize(p_bytes); if (data.size() != p_bytes) { ret.push_back(ERR_OUT_OF_MEMORY); - ret.push_back(PoolVector<uint8_t>()); + ret.push_back(Vector<uint8_t>()); return ret; } - PoolVector<uint8_t>::Write w = data.write(); + uint8_t *w = data.ptrw(); Error err = get_data(&w[0], p_bytes); - w.release(); + ret.push_back(err); ret.push_back(data); return ret; @@ -89,19 +89,18 @@ Array StreamPeer::_get_partial_data(int p_bytes) { Array ret; - PoolVector<uint8_t> data; + Vector<uint8_t> data; data.resize(p_bytes); if (data.size() != p_bytes) { ret.push_back(ERR_OUT_OF_MEMORY); - ret.push_back(PoolVector<uint8_t>()); + ret.push_back(Vector<uint8_t>()); return ret; } - PoolVector<uint8_t>::Write w = data.write(); + uint8_t *w = data.ptrw(); int received; Error err = get_partial_data(&w[0], p_bytes, received); - w.release(); if (err != OK) { data.resize(0); @@ -431,7 +430,7 @@ void StreamPeerBuffer::_bind_methods() { ClassDB::bind_method(D_METHOD("clear"), &StreamPeerBuffer::clear); ClassDB::bind_method(D_METHOD("duplicate"), &StreamPeerBuffer::duplicate); - ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data_array"), "set_data_array", "get_data_array"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_BYTE_ARRAY, "data_array"), "set_data_array", "get_data_array"); } Error StreamPeerBuffer::put_data(const uint8_t *p_data, int p_bytes) { @@ -443,7 +442,7 @@ Error StreamPeerBuffer::put_data(const uint8_t *p_data, int p_bytes) { data.resize(pointer + p_bytes); } - PoolVector<uint8_t>::Write w = data.write(); + uint8_t *w = data.ptrw(); copymem(&w[pointer], p_data, p_bytes); pointer += p_bytes; @@ -478,8 +477,8 @@ Error StreamPeerBuffer::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_ r_received = p_bytes; } - PoolVector<uint8_t>::Read r = data.read(); - copymem(p_buffer, r.ptr() + pointer, r_received); + const uint8_t *r = data.ptr(); + copymem(p_buffer, r + pointer, r_received); pointer += r_received; // FIXME: return what? OK or ERR_* @@ -513,13 +512,13 @@ void StreamPeerBuffer::resize(int p_size) { data.resize(p_size); } -void StreamPeerBuffer::set_data_array(const PoolVector<uint8_t> &p_data) { +void StreamPeerBuffer::set_data_array(const Vector<uint8_t> &p_data) { data = p_data; pointer = 0; } -PoolVector<uint8_t> StreamPeerBuffer::get_data_array() const { +Vector<uint8_t> StreamPeerBuffer::get_data_array() const { return data; } diff --git a/core/io/stream_peer.h b/core/io/stream_peer.h index d6ce7ddc16..9358a2c07c 100644 --- a/core/io/stream_peer.h +++ b/core/io/stream_peer.h @@ -41,8 +41,8 @@ protected: static void _bind_methods(); //bind helpers - Error _put_data(const PoolVector<uint8_t> &p_data); - Array _put_partial_data(const PoolVector<uint8_t> &p_data); + Error _put_data(const Vector<uint8_t> &p_data); + Array _put_partial_data(const Vector<uint8_t> &p_data); Array _get_data(int p_bytes); Array _get_partial_data(int p_bytes); @@ -96,7 +96,7 @@ class StreamPeerBuffer : public StreamPeer { GDCLASS(StreamPeerBuffer, StreamPeer); - PoolVector<uint8_t> data; + Vector<uint8_t> data; int pointer; protected: @@ -116,8 +116,8 @@ public: int get_position() const; void resize(int p_size); - void set_data_array(const PoolVector<uint8_t> &p_data); - PoolVector<uint8_t> get_data_array() const; + void set_data_array(const Vector<uint8_t> &p_data); + Vector<uint8_t> get_data_array() const; void clear(); diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index 73f190a330..b26903e45a 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -235,13 +235,13 @@ Array AStar::get_points() { return point_list; } -PoolVector<int> AStar::get_point_connections(int p_id) { +Vector<int> AStar::get_point_connections(int p_id) { Point *p; bool p_exists = points.lookup(p_id, p); - ERR_FAIL_COND_V(!p_exists, PoolVector<int>()); + ERR_FAIL_COND_V(!p_exists, Vector<int>()); - PoolVector<int> point_list; + Vector<int> point_list; for (OAHashMap<int, Point *>::Iterator it = p->neighbours.iter(); it.valid; it = p->neighbours.next_iter(it)) { point_list.push_back((*it.key)); @@ -431,18 +431,18 @@ float AStar::_compute_cost(int p_from_id, int p_to_id) { return from_point->pos.distance_to(to_point->pos); } -PoolVector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) { +Vector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) { Point *a; bool from_exists = points.lookup(p_from_id, a); - ERR_FAIL_COND_V(!from_exists, PoolVector<Vector3>()); + ERR_FAIL_COND_V(!from_exists, Vector<Vector3>()); Point *b; bool to_exists = points.lookup(p_to_id, b); - ERR_FAIL_COND_V(!to_exists, PoolVector<Vector3>()); + ERR_FAIL_COND_V(!to_exists, Vector<Vector3>()); if (a == b) { - PoolVector<Vector3> ret; + Vector<Vector3> ret; ret.push_back(a->pos); return ret; } @@ -451,7 +451,7 @@ PoolVector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) { Point *end_point = b; bool found_route = _solve(begin_point, end_point); - if (!found_route) return PoolVector<Vector3>(); + if (!found_route) return Vector<Vector3>(); Point *p = end_point; int pc = 1; // Begin point @@ -460,11 +460,11 @@ PoolVector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) { p = p->prev_point; } - PoolVector<Vector3> path; + Vector<Vector3> path; path.resize(pc); { - PoolVector<Vector3>::Write w = path.write(); + Vector3 *w = path.ptrw(); Point *p2 = end_point; int idx = pc - 1; @@ -479,18 +479,18 @@ PoolVector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) { return path; } -PoolVector<int> AStar::get_id_path(int p_from_id, int p_to_id) { +Vector<int> AStar::get_id_path(int p_from_id, int p_to_id) { Point *a; bool from_exists = points.lookup(p_from_id, a); - ERR_FAIL_COND_V(!from_exists, PoolVector<int>()); + ERR_FAIL_COND_V(!from_exists, Vector<int>()); Point *b; bool to_exists = points.lookup(p_to_id, b); - ERR_FAIL_COND_V(!to_exists, PoolVector<int>()); + ERR_FAIL_COND_V(!to_exists, Vector<int>()); if (a == b) { - PoolVector<int> ret; + Vector<int> ret; ret.push_back(a->id); return ret; } @@ -499,7 +499,7 @@ PoolVector<int> AStar::get_id_path(int p_from_id, int p_to_id) { Point *end_point = b; bool found_route = _solve(begin_point, end_point); - if (!found_route) return PoolVector<int>(); + if (!found_route) return Vector<int>(); Point *p = end_point; int pc = 1; // Begin point @@ -508,11 +508,11 @@ PoolVector<int> AStar::get_id_path(int p_from_id, int p_to_id) { p = p->prev_point; } - PoolVector<int> path; + Vector<int> path; path.resize(pc); { - PoolVector<int>::Write w = path.write(); + int *w = path.ptrw(); p = end_point; int idx = pc - 1; @@ -624,7 +624,7 @@ bool AStar2D::has_point(int p_id) const { return astar.has_point(p_id); } -PoolVector<int> AStar2D::get_point_connections(int p_id) { +Vector<int> AStar2D::get_point_connections(int p_id) { return astar.get_point_connections(p_id); } @@ -677,15 +677,15 @@ Vector2 AStar2D::get_closest_position_in_segment(const Vector2 &p_point) const { return Vector2(p.x, p.y); } -PoolVector<Vector2> AStar2D::get_point_path(int p_from_id, int p_to_id) { +Vector<Vector2> AStar2D::get_point_path(int p_from_id, int p_to_id) { - PoolVector3Array pv = astar.get_point_path(p_from_id, p_to_id); + PackedVector3Array pv = astar.get_point_path(p_from_id, p_to_id); int size = pv.size(); - PoolVector2Array path; + PackedVector2Array path; path.resize(size); { - PoolVector<Vector3>::Read r = pv.read(); - PoolVector<Vector2>::Write w = path.write(); + const Vector3 *r = pv.ptr(); + Vector2 *w = path.ptrw(); for (int i = 0; i < size; i++) { Vector3 p = r[i]; w[i] = Vector2(p.x, p.y); @@ -694,7 +694,7 @@ PoolVector<Vector2> AStar2D::get_point_path(int p_from_id, int p_to_id) { return path; } -PoolVector<int> AStar2D::get_id_path(int p_from_id, int p_to_id) { +Vector<int> AStar2D::get_id_path(int p_from_id, int p_to_id) { return astar.get_id_path(p_from_id, p_to_id); } diff --git a/core/math/a_star.h b/core/math/a_star.h index 0b10976932..bfcf0c09d3 100644 --- a/core/math/a_star.h +++ b/core/math/a_star.h @@ -137,7 +137,7 @@ public: void set_point_weight_scale(int p_id, real_t p_weight_scale); void remove_point(int p_id); bool has_point(int p_id) const; - PoolVector<int> get_point_connections(int p_id); + Vector<int> get_point_connections(int p_id); Array get_points(); void set_point_disabled(int p_id, bool p_disabled = true); @@ -155,8 +155,8 @@ public: int get_closest_point(const Vector3 &p_point, bool p_include_disabled = false) const; Vector3 get_closest_position_in_segment(const Vector3 &p_point) const; - PoolVector<Vector3> get_point_path(int p_from_id, int p_to_id); - PoolVector<int> get_id_path(int p_from_id, int p_to_id); + Vector<Vector3> get_point_path(int p_from_id, int p_to_id); + Vector<int> get_id_path(int p_from_id, int p_to_id); AStar(); ~AStar(); @@ -179,7 +179,7 @@ public: void set_point_weight_scale(int p_id, real_t p_weight_scale); void remove_point(int p_id); bool has_point(int p_id) const; - PoolVector<int> get_point_connections(int p_id); + Vector<int> get_point_connections(int p_id); Array get_points(); void set_point_disabled(int p_id, bool p_disabled = true); @@ -197,8 +197,8 @@ public: int get_closest_point(const Vector2 &p_point, bool p_include_disabled = false) const; Vector2 get_closest_position_in_segment(const Vector2 &p_point) const; - PoolVector<Vector2> get_point_path(int p_from_id, int p_to_id); - PoolVector<int> get_id_path(int p_from_id, int p_to_id); + Vector<Vector2> get_point_path(int p_from_id, int p_to_id); + Vector<int> get_id_path(int p_from_id, int p_to_id); AStar2D(); ~AStar2D(); diff --git a/core/math/bsp_tree.cpp b/core/math/bsp_tree.cpp deleted file mode 100644 index 7ad907db97..0000000000 --- a/core/math/bsp_tree.cpp +++ /dev/null @@ -1,581 +0,0 @@ -/*************************************************************************/ -/* bsp_tree.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "bsp_tree.h" - -#include "core/error_macros.h" -#include "core/print_string.h" - -void BSP_Tree::from_aabb(const AABB &p_aabb) { - - planes.clear(); - - for (int i = 0; i < 3; i++) { - - Vector3 n; - n[i] = 1; - planes.push_back(Plane(n, p_aabb.position[i] + p_aabb.size[i])); - planes.push_back(Plane(-n, -p_aabb.position[i])); - } - - nodes.clear(); - - for (int i = 0; i < 6; i++) { - - Node n; - n.plane = i; - n.under = (i == 0) ? UNDER_LEAF : i - 1; - n.over = OVER_LEAF; - nodes.push_back(n); - } - - aabb = p_aabb; - error_radius = 0; -} - -Vector<BSP_Tree::Node> BSP_Tree::get_nodes() const { - - return nodes; -} -Vector<Plane> BSP_Tree::get_planes() const { - - return planes; -} - -AABB BSP_Tree::get_aabb() const { - - return aabb; -} - -int BSP_Tree::_get_points_inside(int p_node, const Vector3 *p_points, int *p_indices, const Vector3 &p_center, const Vector3 &p_half_extents, int p_indices_count) const { - - const Node *node = &nodes[p_node]; - const Plane &p = planes[node->plane]; - - Vector3 min( - (p.normal.x > 0) ? -p_half_extents.x : p_half_extents.x, - (p.normal.y > 0) ? -p_half_extents.y : p_half_extents.y, - (p.normal.z > 0) ? -p_half_extents.z : p_half_extents.z); - Vector3 max = -min; - max += p_center; - min += p_center; - - real_t dist_min = p.distance_to(min); - real_t dist_max = p.distance_to(max); - - if ((dist_min * dist_max) < CMP_EPSILON) { //intersection, test point by point - - int under_count = 0; - - //sort points, so the are under first, over last - for (int i = 0; i < p_indices_count; i++) { - - int index = p_indices[i]; - - if (p.is_point_over(p_points[index])) { - - // kind of slow (but cache friendly), should try something else, - // but this is a corner case most of the time - - for (int j = index; j < p_indices_count - 1; j++) - p_indices[j] = p_indices[j + 1]; - - p_indices[p_indices_count - 1] = index; - - } else { - under_count++; - } - } - - int total = 0; - - if (under_count > 0) { - if (node->under == UNDER_LEAF) { - total += under_count; - } else { - total += _get_points_inside(node->under, p_points, p_indices, p_center, p_half_extents, under_count); - } - } - - if (under_count != p_indices_count) { - if (node->over == OVER_LEAF) { - //total+=0 //if they are over an OVER_LEAF, they are outside the model - } else { - total += _get_points_inside(node->over, p_points, &p_indices[under_count], p_center, p_half_extents, p_indices_count - under_count); - } - } - - return total; - - } else if (dist_min > 0) { //all points over plane - - if (node->over == OVER_LEAF) { - - return 0; // all these points are not visible - } - - return _get_points_inside(node->over, p_points, p_indices, p_center, p_half_extents, p_indices_count); - } else { //all points behind plane - - if (node->under == UNDER_LEAF) { - - return p_indices_count; // all these points are visible - } - return _get_points_inside(node->under, p_points, p_indices, p_center, p_half_extents, p_indices_count); - } -} - -int BSP_Tree::get_points_inside(const Vector3 *p_points, int p_point_count) const { - - if (nodes.size() == 0) - return 0; - -#if 1 - //this version is easier to debug, and and MUCH faster in real world cases - - int pass_count = 0; - const Node *nodesptr = &nodes[0]; - const Plane *planesptr = &planes[0]; - int node_count = nodes.size(); - - if (node_count == 0) // no nodes! - return 0; - - for (int i = 0; i < p_point_count; i++) { - - const Vector3 &point = p_points[i]; - if (!aabb.has_point(point)) { - continue; - } - - int idx = node_count - 1; - - bool pass = false; - - while (true) { - - if (idx == OVER_LEAF) { - pass = false; - break; - } else if (idx == UNDER_LEAF) { - pass = true; - break; - } - -#ifdef DEBUG_ENABLED - int plane_count = planes.size(); - uint16_t plane = nodesptr[idx].plane; - ERR_FAIL_UNSIGNED_INDEX_V(plane, plane_count, 0); -#endif - - idx = planesptr[nodesptr[idx].plane].is_point_over(point) ? nodes[idx].over : nodes[idx].under; - -#ifdef DEBUG_ENABLED - - ERR_FAIL_COND_V(idx < MAX_NODES && idx >= node_count, 0); -#endif - } - - if (pass) - pass_count++; - } - - return pass_count; - -#else - //this version scales better but it's slower for real world cases - - int *indices = (int *)alloca(p_point_count * sizeof(int)); - AABB bounds; - - for (int i = 0; i < p_point_count; i++) { - - indices[i] = i; - if (i == 0) - bounds.pos = p_points[i]; - else - bounds.expand_to(p_points[i]); - } - - Vector3 half_extents = bounds.size / 2.0; - return _get_points_inside(nodes.size() + 1, p_points, indices, bounds.pos + half_extents, half_extents, p_point_count); -#endif -} - -bool BSP_Tree::point_is_inside(const Vector3 &p_point) const { - - if (!aabb.has_point(p_point)) { - return false; - } - - int node_count = nodes.size(); - - if (node_count == 0) // no nodes! - return false; - - const Node *nodesptr = &nodes[0]; - const Plane *planesptr = &planes[0]; - - int idx = node_count - 1; - - while (true) { - - if (idx == OVER_LEAF) { - return false; - } - if (idx == UNDER_LEAF) { - - return true; - } - -#ifdef DEBUG_ENABLED - int plane_count = planes.size(); - uint16_t plane = nodesptr[idx].plane; - ERR_FAIL_UNSIGNED_INDEX_V(plane, plane_count, false); -#endif - - bool over = planesptr[nodesptr[idx].plane].is_point_over(p_point); - - idx = over ? nodes[idx].over : nodes[idx].under; - -#ifdef DEBUG_ENABLED - ERR_FAIL_COND_V(idx < MAX_NODES && idx >= node_count, false); -#endif - } -} - -static int _bsp_find_best_half_plane(const Face3 *p_faces, const Vector<int> &p_indices, real_t p_tolerance) { - - int ic = p_indices.size(); - const int *indices = p_indices.ptr(); - - int best_plane = -1; - real_t best_plane_cost = 1e20; - - // Loop to find the polygon that best divides the set. - - for (int i = 0; i < ic; i++) { - - const Face3 &f = p_faces[indices[i]]; - Plane p = f.get_plane(); - - int num_over = 0, num_under = 0, num_spanning = 0; - - for (int j = 0; j < ic; j++) { - - if (i == j) - continue; - - const Face3 &g = p_faces[indices[j]]; - int over = 0, under = 0; - - for (int k = 0; k < 3; k++) { - - real_t d = p.distance_to(g.vertex[j]); - - if (Math::abs(d) > p_tolerance) { - - if (d > 0) - over++; - else - under++; - } - } - - if (over && under) - num_spanning++; - else if (over) - num_over++; - else - num_under++; - } - - //real_t split_cost = num_spanning / (real_t) face_count; - real_t relation = Math::abs(num_over - num_under) / (real_t)ic; - - // being honest, i never found a way to add split cost to the mix in a meaninguful way - // in this engine, also, will likely be ignored anyway - - real_t plane_cost = /*split_cost +*/ relation; - - //printf("plane %i, %i over, %i under, %i spanning, cost is %g\n",i,num_over,num_under,num_spanning,plane_cost); - if (plane_cost < best_plane_cost) { - - best_plane = i; - best_plane_cost = plane_cost; - } - } - - return best_plane; -} - -static int _bsp_create_node(const Face3 *p_faces, const Vector<int> &p_indices, Vector<Plane> &p_planes, Vector<BSP_Tree::Node> &p_nodes, real_t p_tolerance) { - - ERR_FAIL_COND_V(p_nodes.size() == BSP_Tree::MAX_NODES, -1); - - // should not reach here - ERR_FAIL_COND_V(p_indices.size() == 0, -1); - - int ic = p_indices.size(); - const int *indices = p_indices.ptr(); - - int divisor_idx = _bsp_find_best_half_plane(p_faces, p_indices, p_tolerance); - - // returned error - ERR_FAIL_COND_V(divisor_idx < 0, -1); - - Vector<int> faces_over; - Vector<int> faces_under; - - Plane divisor_plane = p_faces[indices[divisor_idx]].get_plane(); - - for (int i = 0; i < ic; i++) { - - if (i == divisor_idx) - continue; - - const Face3 &f = p_faces[indices[i]]; - - /* - if (f.get_plane().is_equal_approx(divisor_plane)) - continue; - */ - - int over_count = 0; - int under_count = 0; - - for (int j = 0; j < 3; j++) { - - real_t d = divisor_plane.distance_to(f.vertex[j]); - if (Math::abs(d) > p_tolerance) { - - if (d > 0) - over_count++; - else - under_count++; - } - } - - if (over_count) - faces_over.push_back(indices[i]); - if (under_count) - faces_under.push_back(indices[i]); - } - - uint16_t over_idx = BSP_Tree::OVER_LEAF, under_idx = BSP_Tree::UNDER_LEAF; - - if (faces_over.size() > 0) { //have facess above? - - int idx = _bsp_create_node(p_faces, faces_over, p_planes, p_nodes, p_tolerance); - if (idx >= 0) - over_idx = idx; - } - - if (faces_under.size() > 0) { //have facess above? - - int idx = _bsp_create_node(p_faces, faces_under, p_planes, p_nodes, p_tolerance); - if (idx >= 0) - under_idx = idx; - } - - /* Create the node */ - - // find existing divisor plane - int divisor_plane_idx = -1; - - for (int i = 0; i < p_planes.size(); i++) { - - if (p_planes[i].is_equal_approx(divisor_plane)) { - divisor_plane_idx = i; - break; - } - } - - if (divisor_plane_idx == -1) { - - ERR_FAIL_COND_V(p_planes.size() == BSP_Tree::MAX_PLANES, -1); - divisor_plane_idx = p_planes.size(); - p_planes.push_back(divisor_plane); - } - - BSP_Tree::Node node; - node.plane = divisor_plane_idx; - node.under = under_idx; - node.over = over_idx; - - p_nodes.push_back(node); - - return p_nodes.size() - 1; -} - -BSP_Tree::operator Variant() const { - - Dictionary d; - d["error_radius"] = error_radius; - - Vector<real_t> plane_values; - plane_values.resize(planes.size() * 4); - - for (int i = 0; i < planes.size(); i++) { - - plane_values.write[i * 4 + 0] = planes[i].normal.x; - plane_values.write[i * 4 + 1] = planes[i].normal.y; - plane_values.write[i * 4 + 2] = planes[i].normal.z; - plane_values.write[i * 4 + 3] = planes[i].d; - } - - d["planes"] = plane_values; - - PoolVector<int> dst_nodes; - dst_nodes.resize(nodes.size() * 3); - - for (int i = 0; i < nodes.size(); i++) { - - dst_nodes.set(i * 3 + 0, nodes[i].over); - dst_nodes.set(i * 3 + 1, nodes[i].under); - dst_nodes.set(i * 3 + 2, nodes[i].plane); - } - - d["nodes"] = dst_nodes; - d["aabb"] = aabb; - - return Variant(d); -} - -BSP_Tree::BSP_Tree() { -} - -BSP_Tree::BSP_Tree(const Variant &p_variant) { - - Dictionary d = p_variant; - ERR_FAIL_COND(!d.has("nodes")); - ERR_FAIL_COND(!d.has("planes")); - ERR_FAIL_COND(!d.has("aabb")); - ERR_FAIL_COND(!d.has("error_radius")); - - PoolVector<int> src_nodes = d["nodes"]; - ERR_FAIL_COND(src_nodes.size() % 3); - - if (d["planes"].get_type() == Variant::POOL_REAL_ARRAY) { - - PoolVector<real_t> src_planes = d["planes"]; - int plane_count = src_planes.size(); - ERR_FAIL_COND(plane_count % 4); - planes.resize(plane_count / 4); - - if (plane_count) { - PoolVector<real_t>::Read r = src_planes.read(); - for (int i = 0; i < plane_count / 4; i++) { - - planes.write[i].normal.x = r[i * 4 + 0]; - planes.write[i].normal.y = r[i * 4 + 1]; - planes.write[i].normal.z = r[i * 4 + 2]; - planes.write[i].d = r[i * 4 + 3]; - } - } - - } else { - - planes = d["planes"]; - } - - error_radius = d["error"]; - aabb = d["aabb"]; - - //int node_count = src_nodes.size(); - nodes.resize(src_nodes.size() / 3); - - PoolVector<int>::Read r = src_nodes.read(); - - for (int i = 0; i < nodes.size(); i++) { - - nodes.write[i].over = r[i * 3 + 0]; - nodes.write[i].under = r[i * 3 + 1]; - nodes.write[i].plane = r[i * 3 + 2]; - } -} - -BSP_Tree::BSP_Tree(const PoolVector<Face3> &p_faces, real_t p_error_radius) { - - // compute aabb - - int face_count = p_faces.size(); - PoolVector<Face3>::Read faces_r = p_faces.read(); - const Face3 *facesptr = faces_r.ptr(); - - bool first = true; - - Vector<int> indices; - - for (int i = 0; i < face_count; i++) { - - const Face3 &f = facesptr[i]; - - if (f.is_degenerate()) - continue; - - for (int j = 0; j < 3; j++) { - - if (first) { - - aabb.position = f.vertex[0]; - first = false; - } else { - - aabb.expand_to(f.vertex[j]); - } - } - - indices.push_back(i); - } - - ERR_FAIL_COND(aabb.has_no_area()); - - int top = _bsp_create_node(faces_r.ptr(), indices, planes, nodes, aabb.get_longest_axis_size() * 0.0001); - - if (top < 0) { - - nodes.clear(); - planes.clear(); - ERR_FAIL_COND(top < 0); - } - - error_radius = p_error_radius; -} - -BSP_Tree::BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const AABB &p_aabb, real_t p_error_radius) : - nodes(p_nodes), - planes(p_planes), - aabb(p_aabb), - error_radius(p_error_radius) { -} - -BSP_Tree::~BSP_Tree() { -} diff --git a/core/math/bsp_tree.h b/core/math/bsp_tree.h deleted file mode 100644 index 1c8ea380ff..0000000000 --- a/core/math/bsp_tree.h +++ /dev/null @@ -1,159 +0,0 @@ -/*************************************************************************/ -/* bsp_tree.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef BSP_TREE_H -#define BSP_TREE_H - -#include "core/math/aabb.h" -#include "core/math/face3.h" -#include "core/math/plane.h" -#include "core/method_ptrcall.h" -#include "core/pool_vector.h" -#include "core/variant.h" -#include "core/vector.h" - -class BSP_Tree { -public: - enum { - - UNDER_LEAF = 0xFFFF, - OVER_LEAF = 0xFFFE, - MAX_NODES = 0xFFFE, - MAX_PLANES = (1 << 16) - }; - - struct Node { - - uint16_t plane; - uint16_t under; - uint16_t over; - }; - -private: - // thanks to the properties of Vector, - // this class can be assigned and passed around between threads - // with no cost. - - Vector<Node> nodes; - Vector<Plane> planes; - AABB aabb; - real_t error_radius; - - int _get_points_inside(int p_node, const Vector3 *p_points, int *p_indices, const Vector3 &p_center, const Vector3 &p_half_extents, int p_indices_count) const; - - template <class T> - bool _test_convex(const Node *p_nodes, const Plane *p_planes, int p_current, const T &p_convex) const; - -public: - bool is_empty() const { return nodes.size() == 0; } - Vector<Node> get_nodes() const; - Vector<Plane> get_planes() const; - AABB get_aabb() const; - - bool point_is_inside(const Vector3 &p_point) const; - int get_points_inside(const Vector3 *p_points, int p_point_count) const; - template <class T> - bool convex_is_inside(const T &p_convex) const; - - operator Variant() const; - - void from_aabb(const AABB &p_aabb); - - BSP_Tree(); - BSP_Tree(const Variant &p_variant); - BSP_Tree(const PoolVector<Face3> &p_faces, real_t p_error_radius = 0); - BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const AABB &p_aabb, real_t p_error_radius = 0); - ~BSP_Tree(); -}; - -template <class T> -bool BSP_Tree::_test_convex(const Node *p_nodes, const Plane *p_planes, int p_current, const T &p_convex) const { - - if (p_current == UNDER_LEAF) - return true; - else if (p_current == OVER_LEAF) - return false; - - bool collided = false; - const Node &n = p_nodes[p_current]; - - const Plane &p = p_planes[n.plane]; - - real_t min, max; - p_convex.project_range(p.normal, min, max); - - bool go_under = min < p.d; - bool go_over = max >= p.d; - - if (go_under && _test_convex(p_nodes, p_planes, n.under, p_convex)) - collided = true; - if (go_over && _test_convex(p_nodes, p_planes, n.over, p_convex)) - collided = true; - - return collided; -} - -template <class T> -bool BSP_Tree::convex_is_inside(const T &p_convex) const { - - int node_count = nodes.size(); - if (node_count == 0) - return false; - const Node *nodes = &this->nodes[0]; - const Plane *planes = &this->planes[0]; - - return _test_convex(nodes, planes, node_count - 1, p_convex); -} - -#ifdef PTRCALL_ENABLED - -template <> -struct PtrToArg<BSP_Tree> { - _FORCE_INLINE_ static BSP_Tree convert(const void *p_ptr) { - BSP_Tree s(Variant(*reinterpret_cast<const Dictionary *>(p_ptr))); - return s; - } - _FORCE_INLINE_ static void encode(BSP_Tree p_val, void *p_ptr) { - Dictionary *d = reinterpret_cast<Dictionary *>(p_ptr); - *d = Variant(p_val); - } -}; - -template <> -struct PtrToArg<const BSP_Tree &> { - _FORCE_INLINE_ static BSP_Tree convert(const void *p_ptr) { - BSP_Tree s(Variant(*reinterpret_cast<const Dictionary *>(p_ptr))); - return s; - } -}; - -#endif - -#endif diff --git a/core/math/expression.cpp b/core/math/expression.cpp index 2fda7a27d5..c7229ef688 100644 --- a/core/math/expression.cpp +++ b/core/math/expression.cpp @@ -757,7 +757,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant } break; case VAR_TO_BYTES: { - PoolByteArray barr; + PackedByteArray barr; bool full_objects = *p_inputs[1]; int len; Error err = encode_variant(*p_inputs[0], NULL, len, full_objects); @@ -771,32 +771,32 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant barr.resize(len); { - PoolByteArray::Write w = barr.write(); - encode_variant(*p_inputs[0], w.ptr(), len, full_objects); + uint8_t *w = barr.ptrw(); + encode_variant(*p_inputs[0], w, len, full_objects); } *r_return = barr; } break; case BYTES_TO_VAR: { - if (p_inputs[0]->get_type() != Variant::POOL_BYTE_ARRAY) { + if (p_inputs[0]->get_type() != Variant::PACKED_BYTE_ARRAY) { r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; - r_error.expected = Variant::POOL_BYTE_ARRAY; + r_error.expected = Variant::PACKED_BYTE_ARRAY; return; } - PoolByteArray varr = *p_inputs[0]; + PackedByteArray varr = *p_inputs[0]; bool allow_objects = *p_inputs[1]; Variant ret; { - PoolByteArray::Read r = varr.read(); - Error err = decode_variant(ret, r.ptr(), varr.size(), NULL, allow_objects); + const uint8_t *r = varr.ptr(); + Error err = decode_variant(ret, r, varr.size(), NULL, allow_objects); if (err != OK) { r_error_str = RTR("Not enough bytes for decoding bytes, or invalid format."); r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; - r_error.expected = Variant::POOL_BYTE_ARRAY; + r_error.expected = Variant::PACKED_BYTE_ARRAY; return; } } diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp index 7eb48290a8..69c7abfd30 100644 --- a/core/math/geometry.cpp +++ b/core/math/geometry.cpp @@ -214,23 +214,19 @@ static bool _group_face(_FaceClassify *p_faces, int len, int p_index, int p_grou return true; } -PoolVector<PoolVector<Face3> > Geometry::separate_objects(PoolVector<Face3> p_array) { +Vector<Vector<Face3> > Geometry::separate_objects(Vector<Face3> p_array) { - PoolVector<PoolVector<Face3> > objects; + Vector<Vector<Face3> > objects; int len = p_array.size(); - PoolVector<Face3>::Read r = p_array.read(); + const Face3 *arrayptr = p_array.ptr(); - const Face3 *arrayptr = r.ptr(); - - PoolVector<_FaceClassify> fc; + Vector<_FaceClassify> fc; fc.resize(len); - PoolVector<_FaceClassify>::Write fcw = fc.write(); - - _FaceClassify *_fcptr = fcw.ptr(); + _FaceClassify *_fcptr = fc.ptrw(); for (int i = 0; i < len; i++) { @@ -239,7 +235,7 @@ PoolVector<PoolVector<Face3> > Geometry::separate_objects(PoolVector<Face3> p_ar bool error = _connect_faces(_fcptr, len, -1); - ERR_FAIL_COND_V_MSG(error, PoolVector<PoolVector<Face3> >(), "Invalid geometry."); + ERR_FAIL_COND_V_MSG(error, Vector<Vector<Face3> >(), "Invalid geometry."); // Group connected faces in separate objects. @@ -263,8 +259,7 @@ PoolVector<PoolVector<Face3> > Geometry::separate_objects(PoolVector<Face3> p_ar if (group >= 0) { objects.resize(group); - PoolVector<PoolVector<Face3> >::Write obw = objects.write(); - PoolVector<Face3> *group_faces = obw.ptr(); + Vector<Face3> *group_faces = objects.ptrw(); for (int i = 0; i < len; i++) { if (!_fcptr[i].valid) @@ -470,7 +465,7 @@ static inline void _mark_outside(uint8_t ***p_cell_status, int x, int y, int z, } } -static inline void _build_faces(uint8_t ***p_cell_status, int x, int y, int z, int len_x, int len_y, int len_z, PoolVector<Face3> &p_faces) { +static inline void _build_faces(uint8_t ***p_cell_status, int x, int y, int z, int len_x, int len_y, int len_z, Vector<Face3> &p_faces) { ERR_FAIL_INDEX(x, len_x); ERR_FAIL_INDEX(y, len_y); @@ -530,14 +525,13 @@ static inline void _build_faces(uint8_t ***p_cell_status, int x, int y, int z, i } } -PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_error) { +Vector<Face3> Geometry::wrap_geometry(Vector<Face3> p_array, real_t *p_error) { #define _MIN_SIZE 1.0 #define _MAX_LENGTH 20 int face_count = p_array.size(); - PoolVector<Face3>::Read facesr = p_array.read(); - const Face3 *faces = facesr.ptr(); + const Face3 *faces = p_array.ptr(); AABB global_aabb; @@ -638,7 +632,7 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e // Build faces for the inside-outside cell divisors. - PoolVector<Face3> wrapped_faces; + Vector<Face3> wrapped_faces; for (int i = 0; i < div_x; i++) { @@ -654,8 +648,7 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e // Transform face vertices to global coords. int wrapped_faces_count = wrapped_faces.size(); - PoolVector<Face3>::Write wrapped_facesw = wrapped_faces.write(); - Face3 *wrapped_faces_ptr = wrapped_facesw.ptr(); + Face3 *wrapped_faces_ptr = wrapped_faces.ptrw(); for (int i = 0; i < wrapped_faces_count; i++) { @@ -720,7 +713,7 @@ Vector<Vector<Vector2> > Geometry::decompose_polygon_in_convex(Vector<Point2> po return decomp; } -Geometry::MeshData Geometry::build_convex_mesh(const PoolVector<Plane> &p_planes) { +Geometry::MeshData Geometry::build_convex_mesh(const Vector<Plane> &p_planes) { MeshData mesh; @@ -859,9 +852,9 @@ Geometry::MeshData Geometry::build_convex_mesh(const PoolVector<Plane> &p_planes return mesh; } -PoolVector<Plane> Geometry::build_box_planes(const Vector3 &p_extents) { +Vector<Plane> Geometry::build_box_planes(const Vector3 &p_extents) { - PoolVector<Plane> planes; + Vector<Plane> planes; planes.push_back(Plane(Vector3(1, 0, 0), p_extents.x)); planes.push_back(Plane(Vector3(-1, 0, 0), p_extents.x)); @@ -873,9 +866,9 @@ PoolVector<Plane> Geometry::build_box_planes(const Vector3 &p_extents) { return planes; } -PoolVector<Plane> Geometry::build_cylinder_planes(real_t p_radius, real_t p_height, int p_sides, Vector3::Axis p_axis) { +Vector<Plane> Geometry::build_cylinder_planes(real_t p_radius, real_t p_height, int p_sides, Vector3::Axis p_axis) { - PoolVector<Plane> planes; + Vector<Plane> planes; for (int i = 0; i < p_sides; i++) { @@ -895,9 +888,9 @@ PoolVector<Plane> Geometry::build_cylinder_planes(real_t p_radius, real_t p_heig return planes; } -PoolVector<Plane> Geometry::build_sphere_planes(real_t p_radius, int p_lats, int p_lons, Vector3::Axis p_axis) { +Vector<Plane> Geometry::build_sphere_planes(real_t p_radius, int p_lats, int p_lons, Vector3::Axis p_axis) { - PoolVector<Plane> planes; + Vector<Plane> planes; Vector3 axis; axis[p_axis] = 1.0; @@ -928,9 +921,9 @@ PoolVector<Plane> Geometry::build_sphere_planes(real_t p_radius, int p_lats, int return planes; } -PoolVector<Plane> Geometry::build_capsule_planes(real_t p_radius, real_t p_height, int p_sides, int p_lats, Vector3::Axis p_axis) { +Vector<Plane> Geometry::build_capsule_planes(real_t p_radius, real_t p_height, int p_sides, int p_lats, Vector3::Axis p_axis) { - PoolVector<Plane> planes; + Vector<Plane> planes; Vector3 axis; axis[p_axis] = 1.0; diff --git a/core/math/geometry.h b/core/math/geometry.h index b9193242bc..a94d00bf77 100644 --- a/core/math/geometry.h +++ b/core/math/geometry.h @@ -37,7 +37,7 @@ #include "core/math/triangulate.h" #include "core/math/vector3.h" #include "core/object.h" -#include "core/pool_vector.h" + #include "core/print_string.h" #include "core/vector.h" @@ -899,10 +899,10 @@ public: return (intersections & 1); } - static PoolVector<PoolVector<Face3> > separate_objects(PoolVector<Face3> p_array); + static Vector<Vector<Face3> > separate_objects(Vector<Face3> p_array); // Create a "wrap" that encloses the given geometry. - static PoolVector<Face3> wrap_geometry(PoolVector<Face3> p_array, real_t *p_error = NULL); + static Vector<Face3> wrap_geometry(Vector<Face3> p_array, real_t *p_error = NULL); struct MeshData { @@ -1006,11 +1006,11 @@ public: } static Vector<Vector<Vector2> > decompose_polygon_in_convex(Vector<Point2> polygon); - static MeshData build_convex_mesh(const PoolVector<Plane> &p_planes); - static PoolVector<Plane> build_sphere_planes(real_t p_radius, int p_lats, int p_lons, Vector3::Axis p_axis = Vector3::AXIS_Z); - static PoolVector<Plane> build_box_planes(const Vector3 &p_extents); - static PoolVector<Plane> build_cylinder_planes(real_t p_radius, real_t p_height, int p_sides, Vector3::Axis p_axis = Vector3::AXIS_Z); - static PoolVector<Plane> build_capsule_planes(real_t p_radius, real_t p_height, int p_sides, int p_lats, Vector3::Axis p_axis = Vector3::AXIS_Z); + static MeshData build_convex_mesh(const Vector<Plane> &p_planes); + static Vector<Plane> build_sphere_planes(real_t p_radius, int p_lats, int p_lons, Vector3::Axis p_axis = Vector3::AXIS_Z); + static Vector<Plane> build_box_planes(const Vector3 &p_extents); + static Vector<Plane> build_cylinder_planes(real_t p_radius, real_t p_height, int p_sides, Vector3::Axis p_axis = Vector3::AXIS_Z); + static Vector<Plane> build_capsule_planes(real_t p_radius, real_t p_height, int p_sides, int p_lats, Vector3::Axis p_axis = Vector3::AXIS_Z); static void make_atlas(const Vector<Size2i> &p_rects, Vector<Point2i> &r_result, Size2i &r_size); diff --git a/core/math/transform.h b/core/math/transform.h index ad397d9c09..c6e3be4c70 100644 --- a/core/math/transform.h +++ b/core/math/transform.h @@ -34,7 +34,6 @@ #include "core/math/aabb.h" #include "core/math/basis.h" #include "core/math/plane.h" -#include "core/pool_vector.h" class Transform { public: @@ -84,8 +83,8 @@ public: _FORCE_INLINE_ AABB xform(const AABB &p_aabb) const; _FORCE_INLINE_ AABB xform_inv(const AABB &p_aabb) const; - _FORCE_INLINE_ PoolVector<Vector3> xform(const PoolVector<Vector3> &p_array) const; - _FORCE_INLINE_ PoolVector<Vector3> xform_inv(const PoolVector<Vector3> &p_array) const; + _FORCE_INLINE_ Vector<Vector3> xform(const Vector<Vector3> &p_array) const; + _FORCE_INLINE_ Vector<Vector3> xform_inv(const Vector<Vector3> &p_array) const; void operator*=(const Transform &p_transform); Transform operator*(const Transform &p_transform) const; @@ -210,13 +209,13 @@ _FORCE_INLINE_ AABB Transform::xform_inv(const AABB &p_aabb) const { return ret; } -PoolVector<Vector3> Transform::xform(const PoolVector<Vector3> &p_array) const { +Vector<Vector3> Transform::xform(const Vector<Vector3> &p_array) const { - PoolVector<Vector3> array; + Vector<Vector3> array; array.resize(p_array.size()); - PoolVector<Vector3>::Read r = p_array.read(); - PoolVector<Vector3>::Write w = array.write(); + const Vector3 *r = p_array.ptr(); + Vector3 *w = array.ptrw(); for (int i = 0; i < p_array.size(); ++i) { w[i] = xform(r[i]); @@ -224,13 +223,13 @@ PoolVector<Vector3> Transform::xform(const PoolVector<Vector3> &p_array) const { return array; } -PoolVector<Vector3> Transform::xform_inv(const PoolVector<Vector3> &p_array) const { +Vector<Vector3> Transform::xform_inv(const Vector<Vector3> &p_array) const { - PoolVector<Vector3> array; + Vector<Vector3> array; array.resize(p_array.size()); - PoolVector<Vector3>::Read r = p_array.read(); - PoolVector<Vector3>::Write w = array.write(); + const Vector3 *r = p_array.ptr(); + Vector3 *w = array.ptrw(); for (int i = 0; i < p_array.size(); ++i) { w[i] = xform_inv(r[i]); diff --git a/core/math/transform_2d.h b/core/math/transform_2d.h index 367f697ccf..fa43762aa4 100644 --- a/core/math/transform_2d.h +++ b/core/math/transform_2d.h @@ -32,7 +32,6 @@ #define TRANSFORM_2D_H #include "core/math/rect2.h" // also includes vector2, math_funcs, and ustring -#include "core/pool_vector.h" struct Transform2D { // Warning #1: basis of Transform2D is stored differently from Basis. In terms of elements array, the basis matrix looks like "on paper": @@ -112,8 +111,8 @@ struct Transform2D { _FORCE_INLINE_ Vector2 xform_inv(const Vector2 &p_vec) const; _FORCE_INLINE_ Rect2 xform(const Rect2 &p_rect) const; _FORCE_INLINE_ Rect2 xform_inv(const Rect2 &p_rect) const; - _FORCE_INLINE_ PoolVector<Vector2> xform(const PoolVector<Vector2> &p_array) const; - _FORCE_INLINE_ PoolVector<Vector2> xform_inv(const PoolVector<Vector2> &p_array) const; + _FORCE_INLINE_ Vector<Vector2> xform(const Vector<Vector2> &p_array) const; + _FORCE_INLINE_ Vector<Vector2> xform_inv(const Vector<Vector2> &p_array) const; operator String() const; @@ -203,13 +202,13 @@ Rect2 Transform2D::xform_inv(const Rect2 &p_rect) const { return new_rect; } -PoolVector<Vector2> Transform2D::xform(const PoolVector<Vector2> &p_array) const { +Vector<Vector2> Transform2D::xform(const Vector<Vector2> &p_array) const { - PoolVector<Vector2> array; + Vector<Vector2> array; array.resize(p_array.size()); - PoolVector<Vector2>::Read r = p_array.read(); - PoolVector<Vector2>::Write w = array.write(); + const Vector2 *r = p_array.ptr(); + Vector2 *w = array.ptrw(); for (int i = 0; i < p_array.size(); ++i) { w[i] = xform(r[i]); @@ -217,13 +216,13 @@ PoolVector<Vector2> Transform2D::xform(const PoolVector<Vector2> &p_array) const return array; } -PoolVector<Vector2> Transform2D::xform_inv(const PoolVector<Vector2> &p_array) const { +Vector<Vector2> Transform2D::xform_inv(const Vector<Vector2> &p_array) const { - PoolVector<Vector2> array; + Vector<Vector2> array; array.resize(p_array.size()); - PoolVector<Vector2>::Read r = p_array.read(); - PoolVector<Vector2>::Write w = array.write(); + const Vector2 *r = p_array.ptr(); + Vector2 *w = array.ptrw(); for (int i = 0; i < p_array.size(); ++i) { w[i] = xform_inv(r[i]); diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp index 53d4ea0a96..01d38cf24e 100644 --- a/core/math/triangle_mesh.cpp +++ b/core/math/triangle_mesh.cpp @@ -89,7 +89,7 @@ int TriangleMesh::_create_bvh(BVH *p_bvh, BVH **p_bb, int p_from, int p_size, in return index; } -void TriangleMesh::get_indices(PoolVector<int> *r_triangles_indices) const { +void TriangleMesh::get_indices(Vector<int> *r_triangles_indices) const { if (!valid) return; @@ -97,10 +97,10 @@ void TriangleMesh::get_indices(PoolVector<int> *r_triangles_indices) const { const int triangles_num = triangles.size(); // Parse vertices indices - PoolVector<Triangle>::Read triangles_read = triangles.read(); + const Triangle *triangles_read = triangles.ptr(); r_triangles_indices->resize(triangles_num * 3); - PoolVector<int>::Write r_indices_write = r_triangles_indices->write(); + int *r_indices_write = r_triangles_indices->ptrw(); for (int i = 0; i < triangles_num; ++i) { r_indices_write[3 * i + 0] = triangles_read[i].indices[0]; @@ -109,7 +109,7 @@ void TriangleMesh::get_indices(PoolVector<int> *r_triangles_indices) const { } } -void TriangleMesh::create(const PoolVector<Vector3> &p_faces) { +void TriangleMesh::create(const Vector<Vector3> &p_faces) { valid = false; @@ -119,7 +119,7 @@ void TriangleMesh::create(const PoolVector<Vector3> &p_faces) { triangles.resize(fc); bvh.resize(fc * 3); //will never be larger than this (todo make better) - PoolVector<BVH>::Write bw = bvh.write(); + BVH *bw = bvh.ptrw(); { @@ -127,8 +127,8 @@ void TriangleMesh::create(const PoolVector<Vector3> &p_faces) { //except for the Set for repeated triangles, everything //goes in-place. - PoolVector<Vector3>::Read r = p_faces.read(); - PoolVector<Triangle>::Write w = triangles.write(); + const Vector3 *r = p_faces.ptr(); + Triangle *w = triangles.ptrw(); Map<Vector3, int> db; for (int i = 0; i < fc; i++) { @@ -164,15 +164,15 @@ void TriangleMesh::create(const PoolVector<Vector3> &p_faces) { } vertices.resize(db.size()); - PoolVector<Vector3>::Write vw = vertices.write(); + Vector3 *vw = vertices.ptrw(); for (Map<Vector3, int>::Element *E = db.front(); E; E = E->next()) { vw[E->get()] = E->key(); } } - PoolVector<BVH *> bwptrs; + Vector<BVH *> bwptrs; bwptrs.resize(fc); - PoolVector<BVH *>::Write bwp = bwptrs.write(); + BVH **bwp = bwptrs.ptrw(); for (int i = 0; i < fc; i++) { bwp[i] = &bw[i]; @@ -180,9 +180,8 @@ void TriangleMesh::create(const PoolVector<Vector3> &p_faces) { max_depth = 0; int max_alloc = fc; - _create_bvh(bw.ptr(), bwp.ptr(), 0, fc, 1, max_depth, max_alloc); + _create_bvh(bw, bwp, 0, fc, 1, max_depth, max_alloc); - bw.release(); //clearup bvh.resize(max_alloc); //resize back valid = true; @@ -208,13 +207,11 @@ Vector3 TriangleMesh::get_area_normal(const AABB &p_aabb) const { int level = 0; - PoolVector<Triangle>::Read trianglesr = triangles.read(); - PoolVector<Vector3>::Read verticesr = vertices.read(); - PoolVector<BVH>::Read bvhr = bvh.read(); + const Triangle *triangleptr = triangles.ptr(); + // const Vector3 *verticesr = vertices.ptr(); + const BVH *bvhptr = bvh.ptr(); - const Triangle *triangleptr = trianglesr.ptr(); int pos = bvh.size() - 1; - const BVH *bvhptr = bvhr.ptr(); stack[0] = pos; while (true) { @@ -304,14 +301,11 @@ bool TriangleMesh::intersect_segment(const Vector3 &p_begin, const Vector3 &p_en int level = 0; - PoolVector<Triangle>::Read trianglesr = triangles.read(); - PoolVector<Vector3>::Read verticesr = vertices.read(); - PoolVector<BVH>::Read bvhr = bvh.read(); + const Triangle *triangleptr = triangles.ptr(); + const Vector3 *vertexptr = vertices.ptr(); + const BVH *bvhptr = bvh.ptr(); - const Triangle *triangleptr = trianglesr.ptr(); - const Vector3 *vertexptr = verticesr.ptr(); int pos = bvh.size() - 1; - const BVH *bvhptr = bvhr.ptr(); stack[0] = pos; while (true) { @@ -419,14 +413,11 @@ bool TriangleMesh::intersect_ray(const Vector3 &p_begin, const Vector3 &p_dir, V int level = 0; - PoolVector<Triangle>::Read trianglesr = triangles.read(); - PoolVector<Vector3>::Read verticesr = vertices.read(); - PoolVector<BVH>::Read bvhr = bvh.read(); + const Triangle *triangleptr = triangles.ptr(); + const Vector3 *vertexptr = vertices.ptr(); + const BVH *bvhptr = bvh.ptr(); - const Triangle *triangleptr = trianglesr.ptr(); - const Vector3 *vertexptr = verticesr.ptr(); int pos = bvh.size() - 1; - const BVH *bvhptr = bvhr.ptr(); stack[0] = pos; while (true) { @@ -529,14 +520,11 @@ bool TriangleMesh::intersect_convex_shape(const Plane *p_planes, int p_plane_cou int level = 0; - PoolVector<Triangle>::Read trianglesr = triangles.read(); - PoolVector<Vector3>::Read verticesr = vertices.read(); - PoolVector<BVH>::Read bvhr = bvh.read(); + const Triangle *triangleptr = triangles.ptr(); + const Vector3 *vertexptr = vertices.ptr(); + const BVH *bvhptr = bvh.ptr(); - const Triangle *triangleptr = trianglesr.ptr(); - const Vector3 *vertexptr = verticesr.ptr(); int pos = bvh.size() - 1; - const BVH *bvhptr = bvhr.ptr(); stack[0] = pos; while (true) { @@ -645,16 +633,13 @@ bool TriangleMesh::inside_convex_shape(const Plane *p_planes, int p_plane_count, int level = 0; - PoolVector<Triangle>::Read trianglesr = triangles.read(); - PoolVector<Vector3>::Read verticesr = vertices.read(); - PoolVector<BVH>::Read bvhr = bvh.read(); + const Triangle *triangleptr = triangles.ptr(); + const Vector3 *vertexptr = vertices.ptr(); + const BVH *bvhptr = bvh.ptr(); Transform scale(Basis().scaled(p_scale)); - const Triangle *triangleptr = trianglesr.ptr(); - const Vector3 *vertexptr = verticesr.ptr(); int pos = bvh.size() - 1; - const BVH *bvhptr = bvhr.ptr(); stack[0] = pos; while (true) { @@ -732,18 +717,18 @@ bool TriangleMesh::is_valid() const { return valid; } -PoolVector<Face3> TriangleMesh::get_faces() const { +Vector<Face3> TriangleMesh::get_faces() const { if (!valid) - return PoolVector<Face3>(); + return Vector<Face3>(); - PoolVector<Face3> faces; + Vector<Face3> faces; int ts = triangles.size(); faces.resize(triangles.size()); - PoolVector<Face3>::Write w = faces.write(); - PoolVector<Triangle>::Read r = triangles.read(); - PoolVector<Vector3>::Read rv = vertices.read(); + Face3 *w = faces.ptrw(); + const Triangle *r = triangles.ptr(); + const Vector3 *rv = vertices.ptr(); for (int i = 0; i < ts; i++) { for (int j = 0; j < 3; j++) { @@ -751,7 +736,6 @@ PoolVector<Face3> TriangleMesh::get_faces() const { } } - w.release(); return faces; } diff --git a/core/math/triangle_mesh.h b/core/math/triangle_mesh.h index 575a78b0b5..fdbfb90465 100644 --- a/core/math/triangle_mesh.h +++ b/core/math/triangle_mesh.h @@ -44,8 +44,8 @@ class TriangleMesh : public Reference { int indices[3]; }; - PoolVector<Triangle> triangles; - PoolVector<Vector3> vertices; + Vector<Triangle> triangles; + Vector<Vector3> vertices; struct BVH { @@ -82,7 +82,7 @@ class TriangleMesh : public Reference { int _create_bvh(BVH *p_bvh, BVH **p_bb, int p_from, int p_size, int p_depth, int &max_depth, int &max_alloc); - PoolVector<BVH> bvh; + Vector<BVH> bvh; int max_depth; bool valid; @@ -93,13 +93,13 @@ public: bool intersect_convex_shape(const Plane *p_planes, int p_plane_count) const; bool inside_convex_shape(const Plane *p_planes, int p_plane_count, Vector3 p_scale = Vector3(1, 1, 1)) const; Vector3 get_area_normal(const AABB &p_aabb) const; - PoolVector<Face3> get_faces() const; + Vector<Face3> get_faces() const; - PoolVector<Triangle> get_triangles() const { return triangles; } - PoolVector<Vector3> get_vertices() const { return vertices; } - void get_indices(PoolVector<int> *r_triangles_indices) const; + Vector<Triangle> get_triangles() const { return triangles; } + Vector<Vector3> get_vertices() const { return vertices; } + void get_indices(Vector<int> *r_triangles_indices) const; - void create(const PoolVector<Vector3> &p_faces); + void create(const Vector<Vector3> &p_faces); TriangleMesh(); }; diff --git a/core/method_ptrcall.h b/core/method_ptrcall.h index 118970de80..6ccf41229f 100644 --- a/core/method_ptrcall.h +++ b/core/method_ptrcall.h @@ -129,13 +129,13 @@ MAKE_PTRARG(NodePath); MAKE_PTRARG(RID); MAKE_PTRARG(Dictionary); MAKE_PTRARG(Array); -MAKE_PTRARG(PoolByteArray); -MAKE_PTRARG(PoolIntArray); -MAKE_PTRARG(PoolRealArray); -MAKE_PTRARG(PoolStringArray); -MAKE_PTRARG(PoolVector2Array); -MAKE_PTRARG(PoolVector3Array); -MAKE_PTRARG(PoolColorArray); +MAKE_PTRARG(PackedByteArray); +MAKE_PTRARG(PackedIntArray); +MAKE_PTRARG(PackedRealArray); +MAKE_PTRARG(PackedStringArray); +MAKE_PTRARG(PackedVector2Array); +MAKE_PTRARG(PackedVector3Array); +MAKE_PTRARG(PackedColorArray); MAKE_PTRARG_BY_REFERENCE(Variant); //this is for Object @@ -185,95 +185,96 @@ struct PtrToArg<ObjectID> { //this is for the special cases used by Variant -#define MAKE_VECARG(m_type) \ - template <> \ - struct PtrToArg<Vector<m_type> > { \ - _FORCE_INLINE_ static Vector<m_type> convert(const void *p_ptr) { \ - const PoolVector<m_type> *dvs = reinterpret_cast<const PoolVector<m_type> *>(p_ptr); \ - Vector<m_type> ret; \ - int len = dvs->size(); \ - ret.resize(len); \ - { \ - PoolVector<m_type>::Read r = dvs->read(); \ - for (int i = 0; i < len; i++) { \ - ret.write[i] = r[i]; \ - } \ - } \ - return ret; \ - } \ - _FORCE_INLINE_ static void encode(Vector<m_type> p_vec, void *p_ptr) { \ - PoolVector<m_type> *dv = reinterpret_cast<PoolVector<m_type> *>(p_ptr); \ - int len = p_vec.size(); \ - dv->resize(len); \ - { \ - PoolVector<m_type>::Write w = dv->write(); \ - for (int i = 0; i < len; i++) { \ - w[i] = p_vec[i]; \ - } \ - } \ - } \ - }; \ - template <> \ - struct PtrToArg<const Vector<m_type> &> { \ - _FORCE_INLINE_ static Vector<m_type> convert(const void *p_ptr) { \ - const PoolVector<m_type> *dvs = reinterpret_cast<const PoolVector<m_type> *>(p_ptr); \ - Vector<m_type> ret; \ - int len = dvs->size(); \ - ret.resize(len); \ - { \ - PoolVector<m_type>::Read r = dvs->read(); \ - for (int i = 0; i < len; i++) { \ - ret.write[i] = r[i]; \ - } \ - } \ - return ret; \ - } \ +#define MAKE_VECARG(m_type) \ + template <> \ + struct PtrToArg<Vector<m_type> > { \ + _FORCE_INLINE_ static Vector<m_type> convert(const void *p_ptr) { \ + const Vector<m_type> *dvs = reinterpret_cast<const Vector<m_type> *>(p_ptr); \ + Vector<m_type> ret; \ + int len = dvs->size(); \ + ret.resize(len); \ + { \ + const m_type *r = dvs->ptr(); \ + for (int i = 0; i < len; i++) { \ + ret.write[i] = r[i]; \ + } \ + } \ + return ret; \ + } \ + _FORCE_INLINE_ static void encode(Vector<m_type> p_vec, void *p_ptr) { \ + Vector<m_type> *dv = reinterpret_cast<Vector<m_type> *>(p_ptr); \ + int len = p_vec.size(); \ + dv->resize(len); \ + { \ + m_type *w = dv->ptrw(); \ + for (int i = 0; i < len; i++) { \ + w[i] = p_vec[i]; \ + } \ + } \ + } \ + }; \ + template <> \ + struct PtrToArg<const Vector<m_type> &> { \ + _FORCE_INLINE_ static Vector<m_type> convert(const void *p_ptr) { \ + const Vector<m_type> *dvs = reinterpret_cast<const Vector<m_type> *>(p_ptr); \ + Vector<m_type> ret; \ + int len = dvs->size(); \ + ret.resize(len); \ + { \ + const m_type *r = dvs->ptr(); \ + for (int i = 0; i < len; i++) { \ + ret.write[i] = r[i]; \ + } \ + } \ + return ret; \ + } \ } -#define MAKE_VECARG_ALT(m_type, m_type_alt) \ - template <> \ - struct PtrToArg<Vector<m_type_alt> > { \ - _FORCE_INLINE_ static Vector<m_type_alt> convert(const void *p_ptr) { \ - const PoolVector<m_type> *dvs = reinterpret_cast<const PoolVector<m_type> *>(p_ptr); \ - Vector<m_type_alt> ret; \ - int len = dvs->size(); \ - ret.resize(len); \ - { \ - PoolVector<m_type>::Read r = dvs->read(); \ - for (int i = 0; i < len; i++) { \ - ret.write[i] = r[i]; \ - } \ - } \ - return ret; \ - } \ - _FORCE_INLINE_ static void encode(Vector<m_type_alt> p_vec, void *p_ptr) { \ - PoolVector<m_type> *dv = reinterpret_cast<PoolVector<m_type> *>(p_ptr); \ - int len = p_vec.size(); \ - dv->resize(len); \ - { \ - PoolVector<m_type>::Write w = dv->write(); \ - for (int i = 0; i < len; i++) { \ - w[i] = p_vec[i]; \ - } \ - } \ - } \ - }; \ - template <> \ - struct PtrToArg<const Vector<m_type_alt> &> { \ - _FORCE_INLINE_ static Vector<m_type_alt> convert(const void *p_ptr) { \ - const PoolVector<m_type> *dvs = reinterpret_cast<const PoolVector<m_type> *>(p_ptr); \ - Vector<m_type_alt> ret; \ - int len = dvs->size(); \ - ret.resize(len); \ - { \ - PoolVector<m_type>::Read r = dvs->read(); \ - for (int i = 0; i < len; i++) { \ - ret.write[i] = r[i]; \ - } \ - } \ - return ret; \ - } \ +#define MAKE_VECARG_ALT(m_type, m_type_alt) \ + template <> \ + struct PtrToArg<Vector<m_type_alt> > { \ + _FORCE_INLINE_ static Vector<m_type_alt> convert(const void *p_ptr) { \ + const Vector<m_type> *dvs = reinterpret_cast<const Vector<m_type> *>(p_ptr); \ + Vector<m_type_alt> ret; \ + int len = dvs->size(); \ + ret.resize(len); \ + { \ + const m_type *r = dvs->ptr(); \ + for (int i = 0; i < len; i++) { \ + ret.write[i] = r[i]; \ + } \ + } \ + return ret; \ + } \ + _FORCE_INLINE_ static void encode(Vector<m_type_alt> p_vec, void *p_ptr) { \ + Vector<m_type> *dv = reinterpret_cast<Vector<m_type> *>(p_ptr); \ + int len = p_vec.size(); \ + dv->resize(len); \ + { \ + m_type *w = dv->ptrw(); \ + for (int i = 0; i < len; i++) { \ + w[i] = p_vec[i]; \ + } \ + } \ + } \ + }; \ + template <> \ + struct PtrToArg<const Vector<m_type_alt> &> { \ + _FORCE_INLINE_ static Vector<m_type_alt> convert(const void *p_ptr) { \ + const Vector<m_type> *dvs = reinterpret_cast<const Vector<m_type> *>(p_ptr); \ + Vector<m_type_alt> ret; \ + int len = dvs->size(); \ + ret.resize(len); \ + { \ + const m_type *r = dvs->ptr(); \ + for (int i = 0; i < len; i++) { \ + ret.write[i] = r[i]; \ + } \ + } \ + return ret; \ + } \ } +/* MAKE_VECARG(String); MAKE_VECARG(uint8_t); MAKE_VECARG(int); @@ -281,6 +282,7 @@ MAKE_VECARG(float); MAKE_VECARG(Vector2); MAKE_VECARG(Vector3); MAKE_VECARG(Color); +*/ MAKE_VECARG_ALT(String, StringName); //for stuff that gets converted to Array vectors @@ -324,52 +326,52 @@ MAKE_VECARR(Variant); MAKE_VECARR(RID); MAKE_VECARR(Plane); -#define MAKE_DVECARR(m_type) \ - template <> \ - struct PtrToArg<PoolVector<m_type> > { \ - _FORCE_INLINE_ static PoolVector<m_type> convert(const void *p_ptr) { \ - const Array *arr = reinterpret_cast<const Array *>(p_ptr); \ - PoolVector<m_type> ret; \ - int len = arr->size(); \ - ret.resize(len); \ - { \ - PoolVector<m_type>::Write w = ret.write(); \ - for (int i = 0; i < len; i++) { \ - w[i] = (*arr)[i]; \ - } \ - } \ - return ret; \ - } \ - _FORCE_INLINE_ static void encode(PoolVector<m_type> p_vec, void *p_ptr) { \ - Array *arr = reinterpret_cast<Array *>(p_ptr); \ - int len = p_vec.size(); \ - arr->resize(len); \ - { \ - PoolVector<m_type>::Read r = p_vec.read(); \ - for (int i = 0; i < len; i++) { \ - (*arr)[i] = r[i]; \ - } \ - } \ - } \ - }; \ - template <> \ - struct PtrToArg<const PoolVector<m_type> &> { \ - _FORCE_INLINE_ static PoolVector<m_type> convert(const void *p_ptr) { \ - const Array *arr = reinterpret_cast<const Array *>(p_ptr); \ - PoolVector<m_type> ret; \ - int len = arr->size(); \ - ret.resize(len); \ - { \ - PoolVector<m_type>::Write w = ret.write(); \ - for (int i = 0; i < len; i++) { \ - w[i] = (*arr)[i]; \ - } \ - } \ - return ret; \ - } \ +#define MAKE_DVECARR(m_type) \ + template <> \ + struct PtrToArg<Vector<m_type> > { \ + _FORCE_INLINE_ static Vector<m_type> convert(const void *p_ptr) { \ + const Array *arr = reinterpret_cast<const Array *>(p_ptr); \ + Vector<m_type> ret; \ + int len = arr->size(); \ + ret.resize(len); \ + { \ + m_type *w = ret.ptrw(); \ + for (int i = 0; i < len; i++) { \ + w[i] = (*arr)[i]; \ + } \ + } \ + return ret; \ + } \ + _FORCE_INLINE_ static void encode(Vector<m_type> p_vec, void *p_ptr) { \ + Array *arr = reinterpret_cast<Array *>(p_ptr); \ + int len = p_vec.size(); \ + arr->resize(len); \ + { \ + const m_type *r = p_vec.ptr(); \ + for (int i = 0; i < len; i++) { \ + (*arr)[i] = r[i]; \ + } \ + } \ + } \ + }; \ + template <> \ + struct PtrToArg<const Vector<m_type> &> { \ + _FORCE_INLINE_ static Vector<m_type> convert(const void *p_ptr) { \ + const Array *arr = reinterpret_cast<const Array *>(p_ptr); \ + Vector<m_type> ret; \ + int len = arr->size(); \ + ret.resize(len); \ + { \ + m_type *w = ret.ptrw(); \ + for (int i = 0; i < len; i++) { \ + w[i] = (*arr)[i]; \ + } \ + } \ + return ret; \ + } \ } -MAKE_DVECARR(Plane); +//MAKE_DVECARR(Plane); //for special case StringName #define MAKE_STRINGCONV(m_type) \ @@ -418,15 +420,15 @@ MAKE_STRINGCONV(StringName); MAKE_STRINGCONV_BY_REFERENCE(IP_Address); template <> -struct PtrToArg<PoolVector<Face3> > { - _FORCE_INLINE_ static PoolVector<Face3> convert(const void *p_ptr) { - const PoolVector<Vector3> *dvs = reinterpret_cast<const PoolVector<Vector3> *>(p_ptr); - PoolVector<Face3> ret; +struct PtrToArg<Vector<Face3> > { + _FORCE_INLINE_ static Vector<Face3> convert(const void *p_ptr) { + const Vector<Vector3> *dvs = reinterpret_cast<const Vector<Vector3> *>(p_ptr); + Vector<Face3> ret; int len = dvs->size() / 3; ret.resize(len); { - PoolVector<Vector3>::Read r = dvs->read(); - PoolVector<Face3>::Write w = ret.write(); + const Vector3 *r = dvs->ptr(); + Face3 *w = ret.ptrw(); for (int i = 0; i < len; i++) { w[i].vertex[0] = r[i * 3 + 0]; w[i].vertex[1] = r[i * 3 + 1]; @@ -435,13 +437,13 @@ struct PtrToArg<PoolVector<Face3> > { } return ret; } - _FORCE_INLINE_ static void encode(PoolVector<Face3> p_vec, void *p_ptr) { - PoolVector<Vector3> *arr = reinterpret_cast<PoolVector<Vector3> *>(p_ptr); + _FORCE_INLINE_ static void encode(Vector<Face3> p_vec, void *p_ptr) { + Vector<Vector3> *arr = reinterpret_cast<Vector<Vector3> *>(p_ptr); int len = p_vec.size(); arr->resize(len * 3); { - PoolVector<Face3>::Read r = p_vec.read(); - PoolVector<Vector3>::Write w = arr->write(); + const Face3 *r = p_vec.ptr(); + Vector3 *w = arr->ptrw(); for (int i = 0; i < len; i++) { w[i * 3 + 0] = r[i].vertex[0]; w[i * 3 + 1] = r[i].vertex[1]; @@ -451,15 +453,15 @@ struct PtrToArg<PoolVector<Face3> > { } }; template <> -struct PtrToArg<const PoolVector<Face3> &> { - _FORCE_INLINE_ static PoolVector<Face3> convert(const void *p_ptr) { - const PoolVector<Vector3> *dvs = reinterpret_cast<const PoolVector<Vector3> *>(p_ptr); - PoolVector<Face3> ret; +struct PtrToArg<const Vector<Face3> &> { + _FORCE_INLINE_ static Vector<Face3> convert(const void *p_ptr) { + const Vector<Vector3> *dvs = reinterpret_cast<const Vector<Vector3> *>(p_ptr); + Vector<Face3> ret; int len = dvs->size() / 3; ret.resize(len); { - PoolVector<Vector3>::Read r = dvs->read(); - PoolVector<Face3>::Write w = ret.write(); + const Vector3 *r = dvs->ptr(); + Face3 *w = ret.ptrw(); for (int i = 0; i < len; i++) { w[i].vertex[0] = r[i * 3 + 0]; w[i].vertex[1] = r[i * 3 + 1]; diff --git a/core/object.cpp b/core/object.cpp index 9a5cfe5c22..0a7a46a7d2 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1075,9 +1075,9 @@ Array Object::_get_method_list_bind() const { return ret; } -PoolVector<String> Object::_get_meta_list_bind() const { +Vector<String> Object::_get_meta_list_bind() const { - PoolVector<String> _metaret; + Vector<String> _metaret; List<Variant> keys; metadata.get_key_list(&keys); diff --git a/core/object.h b/core/object.h index 6a229afaea..afbdbda814 100644 --- a/core/object.h +++ b/core/object.h @@ -563,7 +563,7 @@ protected: return &_class_name; } - PoolVector<String> _get_meta_list_bind() const; + Vector<String> _get_meta_list_bind() const; Array _get_property_list_bind() const; Array _get_method_list_bind() const; diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp index 2917351a2f..30cfaa7617 100644 --- a/core/os/file_access.cpp +++ b/core/os/file_access.cpp @@ -408,17 +408,17 @@ int FileAccess::get_buffer(uint8_t *p_dst, int p_length) const { } String FileAccess::get_as_utf8_string() const { - PoolVector<uint8_t> sourcef; + Vector<uint8_t> sourcef; int len = get_len(); sourcef.resize(len + 1); - PoolVector<uint8_t>::Write w = sourcef.write(); - int r = get_buffer(w.ptr(), len); + uint8_t *w = sourcef.ptrw(); + int r = get_buffer(w, len); ERR_FAIL_COND_V(r != len, String()); w[len] = 0; String s; - if (s.parse_utf8((const char *)w.ptr())) { + if (s.parse_utf8((const char *)w)) { return String(); } return s; diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp index 6020c4b219..61bcb7dd32 100644 --- a/core/os/main_loop.cpp +++ b/core/os/main_loop.cpp @@ -46,7 +46,7 @@ void MainLoop::_bind_methods() { BIND_VMETHOD(MethodInfo("_initialize")); BIND_VMETHOD(MethodInfo(Variant::BOOL, "_iteration", PropertyInfo(Variant::REAL, "delta"))); BIND_VMETHOD(MethodInfo(Variant::BOOL, "_idle", PropertyInfo(Variant::REAL, "delta"))); - BIND_VMETHOD(MethodInfo("_drop_files", PropertyInfo(Variant::POOL_STRING_ARRAY, "files"), PropertyInfo(Variant::INT, "from_screen"))); + BIND_VMETHOD(MethodInfo("_drop_files", PropertyInfo(Variant::PACKED_STRING_ARRAY, "files"), PropertyInfo(Variant::INT, "from_screen"))); BIND_VMETHOD(MethodInfo("_finalize")); BIND_VMETHOD(MethodInfo("_global_menu_action", PropertyInfo(Variant::NIL, "id"), PropertyInfo(Variant::NIL, "meta"))); diff --git a/core/os/memory.h b/core/os/memory.h index e45f97e0c8..207149b57e 100644 --- a/core/os/memory.h +++ b/core/os/memory.h @@ -143,7 +143,7 @@ T *memnew_arr_template(size_t p_elements, const char *p_descr = "") { if (p_elements == 0) return 0; /** overloading operator new[] cannot be done , because it may not return the real allocated address (it may pad the 'element count' before the actual array). Because of that, it must be done by hand. This is the - same strategy used by std::vector, and the PoolVector class, so it should be safe.*/ + same strategy used by std::vector, and the Vector class, so it should be safe.*/ size_t len = sizeof(T) * p_elements; uint64_t *mem = (uint64_t *)Memory::alloc_static(len, true); diff --git a/core/os/midi_driver.cpp b/core/os/midi_driver.cpp index 3e020a1585..6ebec50ff0 100644 --- a/core/os/midi_driver.cpp +++ b/core/os/midi_driver.cpp @@ -121,9 +121,9 @@ void MIDIDriver::receive_input_packet(uint64_t timestamp, uint8_t *data, uint32_ id->parse_input_event(event); } -PoolStringArray MIDIDriver::get_connected_inputs() { +PackedStringArray MIDIDriver::get_connected_inputs() { - PoolStringArray list; + PackedStringArray list; return list; } diff --git a/core/os/midi_driver.h b/core/os/midi_driver.h index 26dbdce151..4f53feb43e 100644 --- a/core/os/midi_driver.h +++ b/core/os/midi_driver.h @@ -50,7 +50,7 @@ public: virtual Error open() = 0; virtual void close() = 0; - virtual PoolStringArray get_connected_inputs(); + virtual PackedStringArray get_connected_inputs(); static void receive_input_packet(uint64_t timestamp, uint8_t *data, uint32_t length); diff --git a/core/os/os.cpp b/core/os/os.cpp index d1b6ccab54..9a65d537ac 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -416,10 +416,6 @@ uint64_t OS::get_static_memory_usage() const { return Memory::get_mem_usage(); } -uint64_t OS::get_dynamic_memory_usage() const { - - return MemoryPool::total_memory; -} uint64_t OS::get_static_memory_peak_usage() const { @@ -712,12 +708,12 @@ List<String> OS::get_restart_on_exit_arguments() const { return restart_commandline; } -PoolStringArray OS::get_connected_midi_inputs() { +PackedStringArray OS::get_connected_midi_inputs() { if (MIDIDriver::get_singleton()) return MIDIDriver::get_singleton()->get_connected_inputs(); - PoolStringArray list; + PackedStringArray list; return list; } diff --git a/core/os/os.h b/core/os/os.h index e4661e4583..77391c3a8b 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -185,7 +185,7 @@ public: virtual int get_audio_driver_count() const; virtual const char *get_audio_driver_name(int p_driver) const; - virtual PoolStringArray get_connected_midi_inputs(); + virtual PackedStringArray get_connected_midi_inputs(); virtual void open_midi_inputs(); virtual void close_midi_inputs(); @@ -390,7 +390,6 @@ public: virtual uint64_t get_static_memory_usage() const; virtual uint64_t get_static_memory_peak_usage() const; - virtual uint64_t get_dynamic_memory_usage() const; virtual uint64_t get_free_static_memory() const; RenderThreadMode get_render_thread_mode() const { return _render_thread_mode; } diff --git a/core/packed_data_container.cpp b/core/packed_data_container.cpp index f8f51c4c75..ae5f89e870 100644 --- a/core/packed_data_container.cpp +++ b/core/packed_data_container.cpp @@ -80,20 +80,20 @@ Variant PackedDataContainer::_iter_get_ofs(const Variant &p_iter, uint32_t p_off if (pos < 0 || pos >= size) return Variant(); - PoolVector<uint8_t>::Read rd = data.read(); + const uint8_t *rd = data.ptr(); const uint8_t *r = &rd[p_offset]; uint32_t type = decode_uint32(r); bool err = false; if (type == TYPE_ARRAY) { - uint32_t vpos = decode_uint32(rd.ptr() + p_offset + 8 + pos * 4); - return _get_at_ofs(vpos, rd.ptr(), err); + uint32_t vpos = decode_uint32(rd + p_offset + 8 + pos * 4); + return _get_at_ofs(vpos, rd, err); } else if (type == TYPE_DICT) { - uint32_t vpos = decode_uint32(rd.ptr() + p_offset + 8 + pos * 12 + 4); - return _get_at_ofs(vpos, rd.ptr(), err); + uint32_t vpos = decode_uint32(rd + p_offset + 8 + pos * 12 + 4); + return _get_at_ofs(vpos, rd, err); } else { ERR_FAIL_V(Variant()); } @@ -127,7 +127,7 @@ Variant PackedDataContainer::_get_at_ofs(uint32_t p_ofs, const uint8_t *p_buf, b uint32_t PackedDataContainer::_type_at_ofs(uint32_t p_ofs) const { - PoolVector<uint8_t>::Read rd = data.read(); + const uint8_t *rd = data.ptr(); const uint8_t *r = &rd[p_ofs]; uint32_t type = decode_uint32(r); @@ -136,8 +136,8 @@ uint32_t PackedDataContainer::_type_at_ofs(uint32_t p_ofs) const { int PackedDataContainer::_size(uint32_t p_ofs) const { - PoolVector<uint8_t>::Read rd = data.read(); - ERR_FAIL_COND_V(!rd.ptr(), 0); + const uint8_t *rd = data.ptr(); + ERR_FAIL_COND_V(!rd, 0); const uint8_t *r = &rd[p_ofs]; uint32_t type = decode_uint32(r); @@ -157,7 +157,7 @@ int PackedDataContainer::_size(uint32_t p_ofs) const { Variant PackedDataContainer::_key_at_ofs(uint32_t p_ofs, const Variant &p_key, bool &err) const { - PoolVector<uint8_t>::Read rd = data.read(); + const uint8_t *rd = data.ptr(); const uint8_t *r = &rd[p_ofs]; uint32_t type = decode_uint32(r); @@ -172,7 +172,7 @@ Variant PackedDataContainer::_key_at_ofs(uint32_t p_ofs, const Variant &p_key, b return Variant(); } uint32_t ofs = decode_uint32(r + 8 + 4 * idx); - return _get_at_ofs(ofs, rd.ptr(), err); + return _get_at_ofs(ofs, rd, err); } else { err = true; @@ -188,12 +188,12 @@ Variant PackedDataContainer::_key_at_ofs(uint32_t p_ofs, const Variant &p_key, b for (uint32_t i = 0; i < len; i++) { uint32_t khash = decode_uint32(r + 8 + i * 12 + 0); if (khash == hash) { - Variant key = _get_at_ofs(decode_uint32(r + 8 + i * 12 + 4), rd.ptr(), err); + Variant key = _get_at_ofs(decode_uint32(r + 8 + i * 12 + 4), rd, err); if (err) return Variant(); if (key == p_key) { //key matches, return value - return _get_at_ofs(decode_uint32(r + 8 + i * 12 + 8), rd.ptr(), err); + return _get_at_ofs(decode_uint32(r + 8 + i * 12 + 8), rd, err); } found = true; } else { @@ -240,13 +240,13 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd case Variant::AABB: case Variant::BASIS: case Variant::TRANSFORM: - case Variant::POOL_BYTE_ARRAY: - case Variant::POOL_INT_ARRAY: - case Variant::POOL_REAL_ARRAY: - case Variant::POOL_STRING_ARRAY: - case Variant::POOL_VECTOR2_ARRAY: - case Variant::POOL_VECTOR3_ARRAY: - case Variant::POOL_COLOR_ARRAY: + case Variant::PACKED_BYTE_ARRAY: + case Variant::PACKED_INT_ARRAY: + case Variant::PACKED_REAL_ARRAY: + case Variant::PACKED_STRING_ARRAY: + case Variant::PACKED_VECTOR2_ARRAY: + case Variant::PACKED_VECTOR3_ARRAY: + case Variant::PACKED_COLOR_ARRAY: case Variant::NODE_PATH: { uint32_t pos = tmpdata.size(); @@ -335,19 +335,19 @@ Error PackedDataContainer::pack(const Variant &p_data) { _pack(p_data, tmpdata, string_cache); datalen = tmpdata.size(); data.resize(tmpdata.size()); - PoolVector<uint8_t>::Write w = data.write(); - copymem(w.ptr(), tmpdata.ptr(), tmpdata.size()); + uint8_t *w = data.ptrw(); + copymem(w, tmpdata.ptr(), tmpdata.size()); return OK; } -void PackedDataContainer::_set_data(const PoolVector<uint8_t> &p_data) { +void PackedDataContainer::_set_data(const Vector<uint8_t> &p_data) { data = p_data; datalen = data.size(); } -PoolVector<uint8_t> PackedDataContainer::_get_data() const { +Vector<uint8_t> PackedDataContainer::_get_data() const { return data; } @@ -375,7 +375,7 @@ void PackedDataContainer::_bind_methods() { ClassDB::bind_method(D_METHOD("pack", "value"), &PackedDataContainer::pack); ClassDB::bind_method(D_METHOD("size"), &PackedDataContainer::size); - ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "__data__"), "_set_data", "_get_data"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_BYTE_ARRAY, "__data__"), "_set_data", "_get_data"); } PackedDataContainer::PackedDataContainer() { diff --git a/core/packed_data_container.h b/core/packed_data_container.h index b534169077..852fdcd0d3 100644 --- a/core/packed_data_container.h +++ b/core/packed_data_container.h @@ -48,7 +48,7 @@ class PackedDataContainer : public Resource { bool operator<(const DictKey &p_key) const { return hash < p_key.hash; } }; - PoolVector<uint8_t> data; + Vector<uint8_t> data; int datalen; uint32_t _pack(const Variant &p_data, Vector<uint8_t> &tmpdata, Map<String, uint32_t> &string_cache); @@ -68,8 +68,8 @@ class PackedDataContainer : public Resource { int _size(uint32_t p_ofs) const; protected: - 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; static void _bind_methods(); public: diff --git a/core/pool_vector.cpp b/core/pool_vector.cpp deleted file mode 100644 index d8d53f07e9..0000000000 --- a/core/pool_vector.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/*************************************************************************/ -/* pool_vector.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "pool_vector.h" - -Mutex *pool_vector_lock = NULL; - -PoolAllocator *MemoryPool::memory_pool = NULL; -uint8_t *MemoryPool::pool_memory = NULL; -size_t *MemoryPool::pool_size = NULL; - -MemoryPool::Alloc *MemoryPool::allocs = NULL; -MemoryPool::Alloc *MemoryPool::free_list = NULL; -uint32_t MemoryPool::alloc_count = 0; -uint32_t MemoryPool::allocs_used = 0; -Mutex *MemoryPool::alloc_mutex = NULL; - -size_t MemoryPool::total_memory = 0; -size_t MemoryPool::max_memory = 0; - -void MemoryPool::setup(uint32_t p_max_allocs) { - - allocs = memnew_arr(Alloc, p_max_allocs); - alloc_count = p_max_allocs; - allocs_used = 0; - - for (uint32_t i = 0; i < alloc_count - 1; i++) { - - allocs[i].free_list = &allocs[i + 1]; - } - - free_list = &allocs[0]; - - alloc_mutex = Mutex::create(); -} - -void MemoryPool::cleanup() { - - memdelete_arr(allocs); - memdelete(alloc_mutex); - - ERR_FAIL_COND_MSG(allocs_used > 0, "There are still MemoryPool allocs in use at exit!"); -} diff --git a/core/pool_vector.h b/core/pool_vector.h deleted file mode 100644 index 01c40a237d..0000000000 --- a/core/pool_vector.h +++ /dev/null @@ -1,648 +0,0 @@ -/*************************************************************************/ -/* pool_vector.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef POOL_VECTOR_H -#define POOL_VECTOR_H - -#include "core/os/copymem.h" -#include "core/os/memory.h" -#include "core/os/rw_lock.h" -#include "core/pool_allocator.h" -#include "core/safe_refcount.h" -#include "core/ustring.h" - -struct MemoryPool { - - //avoid accessing these directly, must be public for template access - - static PoolAllocator *memory_pool; - static uint8_t *pool_memory; - static size_t *pool_size; - - struct Alloc { - - SafeRefCount refcount; - uint32_t lock; - void *mem; - PoolAllocator::ID pool_id; - size_t size; - - Alloc *free_list; - - Alloc() : - lock(0), - mem(NULL), - pool_id(POOL_ALLOCATOR_INVALID_ID), - size(0), - free_list(NULL) { - } - }; - - static Alloc *allocs; - static Alloc *free_list; - static uint32_t alloc_count; - static uint32_t allocs_used; - static Mutex *alloc_mutex; - static size_t total_memory; - static size_t max_memory; - - static void setup(uint32_t p_max_allocs = (1 << 16)); - static void cleanup(); -}; - -template <class T> -class PoolVector { - - MemoryPool::Alloc *alloc; - - void _copy_on_write() { - - if (!alloc) - return; - - // ERR_FAIL_COND(alloc->lock>0); should not be illegal to lock this for copy on write, as it's a copy on write after all - - // Refcount should not be zero, otherwise it's a misuse of COW - if (alloc->refcount.get() == 1) - return; //nothing to do - - //must allocate something - - MemoryPool::alloc_mutex->lock(); - if (MemoryPool::allocs_used == MemoryPool::alloc_count) { - MemoryPool::alloc_mutex->unlock(); - ERR_FAIL_MSG("All memory pool allocations are in use, can't COW."); - } - - MemoryPool::Alloc *old_alloc = alloc; - - //take one from the free list - alloc = MemoryPool::free_list; - MemoryPool::free_list = alloc->free_list; - //increment the used counter - MemoryPool::allocs_used++; - - //copy the alloc data - alloc->size = old_alloc->size; - alloc->refcount.init(); - alloc->pool_id = POOL_ALLOCATOR_INVALID_ID; - alloc->lock = 0; - -#ifdef DEBUG_ENABLED - MemoryPool::total_memory += alloc->size; - if (MemoryPool::total_memory > MemoryPool::max_memory) { - MemoryPool::max_memory = MemoryPool::total_memory; - } -#endif - - MemoryPool::alloc_mutex->unlock(); - - if (MemoryPool::memory_pool) { - - } else { - alloc->mem = memalloc(alloc->size); - } - - { - Write w; - w._ref(alloc); - Read r; - r._ref(old_alloc); - - int cur_elements = alloc->size / sizeof(T); - T *dst = (T *)w.ptr(); - const T *src = (const T *)r.ptr(); - for (int i = 0; i < cur_elements; i++) { - memnew_placement(&dst[i], T(src[i])); - } - } - - if (old_alloc->refcount.unref()) { - //this should never happen but.. - -#ifdef DEBUG_ENABLED - MemoryPool::alloc_mutex->lock(); - MemoryPool::total_memory -= old_alloc->size; - MemoryPool::alloc_mutex->unlock(); -#endif - - { - Write w; - w._ref(old_alloc); - - int cur_elements = old_alloc->size / sizeof(T); - T *elems = (T *)w.ptr(); - for (int i = 0; i < cur_elements; i++) { - elems[i].~T(); - } - } - - if (MemoryPool::memory_pool) { - //resize memory pool - //if none, create - //if some resize - } else { - - memfree(old_alloc->mem); - old_alloc->mem = NULL; - old_alloc->size = 0; - - MemoryPool::alloc_mutex->lock(); - old_alloc->free_list = MemoryPool::free_list; - MemoryPool::free_list = old_alloc; - MemoryPool::allocs_used--; - MemoryPool::alloc_mutex->unlock(); - } - } - } - - void _reference(const PoolVector &p_pool_vector) { - - if (alloc == p_pool_vector.alloc) - return; - - _unreference(); - - if (!p_pool_vector.alloc) { - return; - } - - if (p_pool_vector.alloc->refcount.ref()) { - alloc = p_pool_vector.alloc; - } - } - - void _unreference() { - - if (!alloc) - return; - - if (!alloc->refcount.unref()) { - alloc = NULL; - return; - } - - //must be disposed! - - { - int cur_elements = alloc->size / sizeof(T); - - // Don't use write() here because it could otherwise provoke COW, - // which is not desirable here because we are destroying the last reference anyways - Write w; - // Reference to still prevent other threads from touching the alloc - w._ref(alloc); - - for (int i = 0; i < cur_elements; i++) { - - w[i].~T(); - } - } - -#ifdef DEBUG_ENABLED - MemoryPool::alloc_mutex->lock(); - MemoryPool::total_memory -= alloc->size; - MemoryPool::alloc_mutex->unlock(); -#endif - - if (MemoryPool::memory_pool) { - //resize memory pool - //if none, create - //if some resize - } else { - - memfree(alloc->mem); - alloc->mem = NULL; - alloc->size = 0; - - MemoryPool::alloc_mutex->lock(); - alloc->free_list = MemoryPool::free_list; - MemoryPool::free_list = alloc; - MemoryPool::allocs_used--; - MemoryPool::alloc_mutex->unlock(); - } - - alloc = NULL; - } - -public: - class Access { - friend class PoolVector; - - protected: - MemoryPool::Alloc *alloc; - T *mem; - - _FORCE_INLINE_ void _ref(MemoryPool::Alloc *p_alloc) { - alloc = p_alloc; - if (alloc) { - if (atomic_increment(&alloc->lock) == 1) { - if (MemoryPool::memory_pool) { - //lock it and get mem - } - } - - mem = (T *)alloc->mem; - } - } - - _FORCE_INLINE_ void _unref() { - - if (alloc) { - if (atomic_decrement(&alloc->lock) == 0) { - if (MemoryPool::memory_pool) { - //put mem back - } - } - - mem = NULL; - alloc = NULL; - } - } - - Access() { - alloc = NULL; - mem = NULL; - } - - public: - virtual ~Access() { - _unref(); - } - - void release() { - _unref(); - } - }; - - class Read : public Access { - public: - _FORCE_INLINE_ const T &operator[](int p_index) const { return this->mem[p_index]; } - _FORCE_INLINE_ const T *ptr() const { return this->mem; } - - void operator=(const Read &p_read) { - if (this->alloc == p_read.alloc) - return; - this->_unref(); - this->_ref(p_read.alloc); - } - - Read(const Read &p_read) { - this->_ref(p_read.alloc); - } - - Read() {} - }; - - class Write : public Access { - public: - _FORCE_INLINE_ T &operator[](int p_index) const { return this->mem[p_index]; } - _FORCE_INLINE_ T *ptr() const { return this->mem; } - - void operator=(const Write &p_read) { - if (this->alloc == p_read.alloc) - return; - this->_unref(); - this->_ref(p_read.alloc); - } - - Write(const Write &p_read) { - this->_ref(p_read.alloc); - } - - Write() {} - }; - - Read read() const { - - Read r; - if (alloc) { - r._ref(alloc); - } - return r; - } - Write write() { - - Write w; - if (alloc) { - _copy_on_write(); //make sure there is only one being acessed - w._ref(alloc); - } - return w; - } - - template <class MC> - void fill_with(const MC &p_mc) { - - int c = p_mc.size(); - resize(c); - Write w = write(); - int idx = 0; - for (const typename MC::Element *E = p_mc.front(); E; E = E->next()) { - - w[idx++] = E->get(); - } - } - - void remove(int p_index) { - - int s = size(); - ERR_FAIL_INDEX(p_index, s); - Write w = write(); - for (int i = p_index; i < s - 1; i++) { - - w[i] = w[i + 1]; - }; - w = Write(); - resize(s - 1); - } - - inline int size() const; - inline bool empty() const; - T get(int p_index) const; - void set(int p_index, const T &p_val); - void push_back(const T &p_val); - void append(const T &p_val) { push_back(p_val); } - void append_array(const PoolVector<T> &p_arr) { - int ds = p_arr.size(); - if (ds == 0) - return; - int bs = size(); - resize(bs + ds); - Write w = write(); - Read r = p_arr.read(); - for (int i = 0; i < ds; i++) - w[bs + i] = r[i]; - } - - PoolVector<T> subarray(int p_from, int p_to) { - - if (p_from < 0) { - p_from = size() + p_from; - } - if (p_to < 0) { - p_to = size() + p_to; - } - - ERR_FAIL_INDEX_V(p_from, size(), PoolVector<T>()); - ERR_FAIL_INDEX_V(p_to, size(), PoolVector<T>()); - - PoolVector<T> slice; - int span = 1 + p_to - p_from; - slice.resize(span); - Read r = read(); - Write w = slice.write(); - for (int i = 0; i < span; ++i) { - w[i] = r[p_from + i]; - } - - return slice; - } - - Error insert(int p_pos, const T &p_val) { - - int s = size(); - ERR_FAIL_INDEX_V(p_pos, s + 1, ERR_INVALID_PARAMETER); - resize(s + 1); - { - Write w = write(); - for (int i = s; i > p_pos; i--) - w[i] = w[i - 1]; - w[p_pos] = p_val; - } - - return OK; - } - - String join(String delimiter) { - String rs = ""; - int s = size(); - Read r = read(); - for (int i = 0; i < s; i++) { - rs += r[i] + delimiter; - } - rs.erase(rs.length() - delimiter.length(), delimiter.length()); - return rs; - } - - bool is_locked() const { return alloc && alloc->lock > 0; } - - inline T operator[](int p_index) const; - - Error resize(int p_size); - - void invert(); - - void operator=(const PoolVector &p_pool_vector) { _reference(p_pool_vector); } - PoolVector() { alloc = NULL; } - PoolVector(const PoolVector &p_pool_vector) { - alloc = NULL; - _reference(p_pool_vector); - } - ~PoolVector() { _unreference(); } -}; - -template <class T> -int PoolVector<T>::size() const { - - return alloc ? alloc->size / sizeof(T) : 0; -} - -template <class T> -bool PoolVector<T>::empty() const { - - return alloc ? alloc->size == 0 : true; -} - -template <class T> -T PoolVector<T>::get(int p_index) const { - - return operator[](p_index); -} - -template <class T> -void PoolVector<T>::set(int p_index, const T &p_val) { - - ERR_FAIL_INDEX(p_index, size()); - - Write w = write(); - w[p_index] = p_val; -} - -template <class T> -void PoolVector<T>::push_back(const T &p_val) { - - resize(size() + 1); - set(size() - 1, p_val); -} - -template <class T> -T PoolVector<T>::operator[](int p_index) const { - - CRASH_BAD_INDEX(p_index, size()); - - Read r = read(); - return r[p_index]; -} - -template <class T> -Error PoolVector<T>::resize(int p_size) { - - ERR_FAIL_COND_V_MSG(p_size < 0, ERR_INVALID_PARAMETER, "Size of PoolVector cannot be negative."); - - if (alloc == NULL) { - - if (p_size == 0) - return OK; //nothing to do here - - //must allocate something - MemoryPool::alloc_mutex->lock(); - if (MemoryPool::allocs_used == MemoryPool::alloc_count) { - MemoryPool::alloc_mutex->unlock(); - ERR_FAIL_V_MSG(ERR_OUT_OF_MEMORY, "All memory pool allocations are in use."); - } - - //take one from the free list - alloc = MemoryPool::free_list; - MemoryPool::free_list = alloc->free_list; - //increment the used counter - MemoryPool::allocs_used++; - - //cleanup the alloc - alloc->size = 0; - alloc->refcount.init(); - alloc->pool_id = POOL_ALLOCATOR_INVALID_ID; - MemoryPool::alloc_mutex->unlock(); - - } else { - - ERR_FAIL_COND_V_MSG(alloc->lock > 0, ERR_LOCKED, "Can't resize PoolVector if locked."); //can't resize if locked! - } - - size_t new_size = sizeof(T) * p_size; - - if (alloc->size == new_size) - return OK; //nothing to do - - if (p_size == 0) { - _unreference(); - return OK; - } - - _copy_on_write(); // make it unique - -#ifdef DEBUG_ENABLED - MemoryPool::alloc_mutex->lock(); - MemoryPool::total_memory -= alloc->size; - MemoryPool::total_memory += new_size; - if (MemoryPool::total_memory > MemoryPool::max_memory) { - MemoryPool::max_memory = MemoryPool::total_memory; - } - MemoryPool::alloc_mutex->unlock(); -#endif - - int cur_elements = alloc->size / sizeof(T); - - if (p_size > cur_elements) { - - if (MemoryPool::memory_pool) { - //resize memory pool - //if none, create - //if some resize - } else { - - if (alloc->size == 0) { - alloc->mem = memalloc(new_size); - } else { - alloc->mem = memrealloc(alloc->mem, new_size); - } - } - - alloc->size = new_size; - - Write w = write(); - - for (int i = cur_elements; i < p_size; i++) { - - memnew_placement(&w[i], T); - } - - } else { - - { - Write w = write(); - for (int i = p_size; i < cur_elements; i++) { - - w[i].~T(); - } - } - - if (MemoryPool::memory_pool) { - //resize memory pool - //if none, create - //if some resize - } else { - - if (new_size == 0) { - memfree(alloc->mem); - alloc->mem = NULL; - alloc->size = 0; - - MemoryPool::alloc_mutex->lock(); - alloc->free_list = MemoryPool::free_list; - MemoryPool::free_list = alloc; - MemoryPool::allocs_used--; - MemoryPool::alloc_mutex->unlock(); - - } else { - alloc->mem = memrealloc(alloc->mem, new_size); - alloc->size = new_size; - } - } - } - - return OK; -} - -template <class T> -void PoolVector<T>::invert() { - T temp; - Write w = write(); - int s = size(); - int half_s = s / 2; - - for (int i = 0; i < half_s; i++) { - temp = w[i]; - w[i] = w[s - i - 1]; - w[s - i - 1] = temp; - } -} - -#endif // POOL_VECTOR_H diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 59d7e82850..90487bda0d 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -1023,14 +1023,14 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF("audio/default_bus_layout", "res://default_bus_layout.tres"); custom_prop_info["audio/default_bus_layout"] = PropertyInfo(Variant::STRING, "audio/default_bus_layout", PROPERTY_HINT_FILE, "*.tres"); - PoolStringArray extensions = PoolStringArray(); + PackedStringArray extensions = PackedStringArray(); extensions.push_back("gd"); if (Engine::get_singleton()->has_singleton("GodotSharp")) extensions.push_back("cs"); extensions.push_back("shader"); GLOBAL_DEF("editor/search_in_file_extensions", extensions); - custom_prop_info["editor/search_in_file_extensions"] = PropertyInfo(Variant::POOL_STRING_ARRAY, "editor/search_in_file_extensions"); + custom_prop_info["editor/search_in_file_extensions"] = PropertyInfo(Variant::PACKED_STRING_ARRAY, "editor/search_in_file_extensions"); GLOBAL_DEF("editor/script_templates_search_path", "res://script_templates"); custom_prop_info["editor/script_templates_search_path"] = PropertyInfo(Variant::STRING, "editor/script_templates_search_path", PROPERTY_HINT_DIR); diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index 91d9289563..82f9e847e3 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -98,7 +98,6 @@ void register_core_types() { ObjectDB::setup(); ResourceCache::setup(); - MemoryPool::setup(); _global_mutex = Mutex::create(); @@ -316,6 +315,4 @@ void unregister_core_types() { memdelete(_global_mutex); _global_mutex = NULL; //still needed at a few places }; - - MemoryPool::cleanup(); } diff --git a/core/script_language.h b/core/script_language.h index 788f5d6976..2209f78fe4 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -313,7 +313,7 @@ public: virtual bool supports_builtin_mode() const = 0; virtual bool can_inherit_from_file() { return false; } virtual int find_function(const String &p_function, const String &p_code) const = 0; - virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const = 0; + virtual String make_function(const String &p_class, const String &p_name, const PackedStringArray &p_args) const = 0; virtual Error open_in_external_editor(const Ref<Script> &p_script, int p_line, int p_col) { return ERR_UNAVAILABLE; } virtual bool overrides_external_editor() { return false; } diff --git a/core/translation.cpp b/core/translation.cpp index cf76de1c9e..17c23b86cd 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -794,9 +794,9 @@ static const char *locale_renames[][2] = { /////////////////////////////////////////////// -PoolVector<String> Translation::_get_messages() const { +Vector<String> Translation::_get_messages() const { - PoolVector<String> msgs; + Vector<String> msgs; msgs.resize(translation_map.size() * 2); int idx = 0; for (const Map<StringName, StringName>::Element *E = translation_map.front(); E; E = E->next()) { @@ -809,9 +809,9 @@ PoolVector<String> Translation::_get_messages() const { return msgs; } -PoolVector<String> Translation::_get_message_list() const { +Vector<String> Translation::_get_message_list() const { - PoolVector<String> msgs; + Vector<String> msgs; msgs.resize(translation_map.size()); int idx = 0; for (const Map<StringName, StringName>::Element *E = translation_map.front(); E; E = E->next()) { @@ -823,12 +823,12 @@ PoolVector<String> Translation::_get_message_list() const { return msgs; } -void Translation::_set_messages(const PoolVector<String> &p_messages) { +void Translation::_set_messages(const Vector<String> &p_messages) { int msg_count = p_messages.size(); ERR_FAIL_COND(msg_count % 2); - PoolVector<String>::Read r = p_messages.read(); + const String *r = p_messages.ptr(); for (int i = 0; i < msg_count; i += 2) { @@ -898,7 +898,7 @@ void Translation::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_messages"), &Translation::_set_messages); ClassDB::bind_method(D_METHOD("_get_messages"), &Translation::_get_messages); - ADD_PROPERTY(PropertyInfo(Variant::POOL_STRING_ARRAY, "messages", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_messages", "_get_messages"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_STRING_ARRAY, "messages", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_messages", "_get_messages"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "locale"), "set_locale", "get_locale"); } @@ -1146,12 +1146,12 @@ TranslationServer *TranslationServer::singleton = NULL; bool TranslationServer::_load_translations(const String &p_from) { if (ProjectSettings::get_singleton()->has_setting(p_from)) { - PoolVector<String> translations = ProjectSettings::get_singleton()->get(p_from); + Vector<String> translations = ProjectSettings::get_singleton()->get(p_from); int tcount = translations.size(); if (tcount) { - PoolVector<String>::Read r = translations.read(); + const String *r = translations.ptr(); for (int i = 0; i < tcount; i++) { diff --git a/core/translation.h b/core/translation.h index 8f56b7271d..0448ea56c5 100644 --- a/core/translation.h +++ b/core/translation.h @@ -42,10 +42,10 @@ class Translation : public Resource { String locale; Map<StringName, StringName> translation_map; - PoolVector<String> _get_message_list() const; + Vector<String> _get_message_list() const; - PoolVector<String> _get_messages() const; - void _set_messages(const PoolVector<String> &p_messages); + Vector<String> _get_messages() const; + void _set_messages(const Vector<String> &p_messages); protected: static void _bind_methods(); diff --git a/core/type_info.h b/core/type_info.h index 9ca6d7fe73..379735fd67 100644 --- a/core/type_info.h +++ b/core/type_info.h @@ -155,20 +155,17 @@ MAKE_TYPE_INFO(NodePath, Variant::NODE_PATH) MAKE_TYPE_INFO(RID, Variant::_RID) MAKE_TYPE_INFO(Dictionary, Variant::DICTIONARY) MAKE_TYPE_INFO(Array, Variant::ARRAY) -MAKE_TYPE_INFO(PoolByteArray, Variant::POOL_BYTE_ARRAY) -MAKE_TYPE_INFO(PoolIntArray, Variant::POOL_INT_ARRAY) -MAKE_TYPE_INFO(PoolRealArray, Variant::POOL_REAL_ARRAY) -MAKE_TYPE_INFO(PoolStringArray, Variant::POOL_STRING_ARRAY) -MAKE_TYPE_INFO(PoolVector2Array, Variant::POOL_VECTOR2_ARRAY) -MAKE_TYPE_INFO(PoolVector3Array, Variant::POOL_VECTOR3_ARRAY) -MAKE_TYPE_INFO(PoolColorArray, Variant::POOL_COLOR_ARRAY) +MAKE_TYPE_INFO(PackedByteArray, Variant::PACKED_BYTE_ARRAY) +MAKE_TYPE_INFO(PackedIntArray, Variant::PACKED_INT_ARRAY) +MAKE_TYPE_INFO(PackedRealArray, Variant::PACKED_REAL_ARRAY) +MAKE_TYPE_INFO(PackedStringArray, Variant::PACKED_STRING_ARRAY) +MAKE_TYPE_INFO(PackedVector2Array, Variant::PACKED_VECTOR2_ARRAY) +MAKE_TYPE_INFO(PackedVector3Array, Variant::PACKED_VECTOR3_ARRAY) +MAKE_TYPE_INFO(PackedColorArray, Variant::PACKED_COLOR_ARRAY) MAKE_TYPE_INFO(StringName, Variant::STRING) MAKE_TYPE_INFO(IP_Address, Variant::STRING) -class BSP_Tree; -MAKE_TYPE_INFO(BSP_Tree, Variant::DICTIONARY) - //objectID template <> struct GetTypeInfo<ObjectID> { @@ -216,21 +213,25 @@ struct GetTypeInfo<const Variant &> { } \ }; -MAKE_TEMPLATE_TYPE_INFO(Vector, uint8_t, Variant::POOL_BYTE_ARRAY) -MAKE_TEMPLATE_TYPE_INFO(Vector, int, Variant::POOL_INT_ARRAY) -MAKE_TEMPLATE_TYPE_INFO(Vector, float, Variant::POOL_REAL_ARRAY) -MAKE_TEMPLATE_TYPE_INFO(Vector, String, Variant::POOL_STRING_ARRAY) -MAKE_TEMPLATE_TYPE_INFO(Vector, Vector2, Variant::POOL_VECTOR2_ARRAY) -MAKE_TEMPLATE_TYPE_INFO(Vector, Vector3, Variant::POOL_VECTOR3_ARRAY) -MAKE_TEMPLATE_TYPE_INFO(Vector, Color, Variant::POOL_COLOR_ARRAY) - MAKE_TEMPLATE_TYPE_INFO(Vector, Variant, Variant::ARRAY) MAKE_TEMPLATE_TYPE_INFO(Vector, RID, Variant::ARRAY) MAKE_TEMPLATE_TYPE_INFO(Vector, Plane, Variant::ARRAY) -MAKE_TEMPLATE_TYPE_INFO(Vector, StringName, Variant::POOL_STRING_ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, Face3, Variant::PACKED_VECTOR3_ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, StringName, Variant::PACKED_STRING_ARRAY) + +/* +MAKE_TEMPLATE_TYPE_INFO(Vector, uint8_t, Variant::PACKED_BYTE_ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, int, Variant::PACKED_INT_ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, float, Variant::PACKED_REAL_ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, String, Variant::PACKED_STRING_ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, Vector2, Variant::PACKED_VECTOR2_ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, Vector3, Variant::PACKED_VECTOR3_ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, Color, Variant::PACKED_COLOR_ARRAY) -MAKE_TEMPLATE_TYPE_INFO(PoolVector, Plane, Variant::ARRAY) -MAKE_TEMPLATE_TYPE_INFO(PoolVector, Face3, Variant::POOL_VECTOR3_ARRAY) + +MAKE_TEMPLATE_TYPE_INFO(Vector, Plane, Variant::ARRAY) +MAKE_TEMPLATE_TYPE_INFO(Vector, Face3, Variant::PACKED_VECTOR3_ARRAY) +*/ template <typename T> struct GetTypeInfo<T *, typename EnableIf<TypeInherits<Object, T>::value>::type> { diff --git a/core/variant.cpp b/core/variant.cpp index c2ffe3721f..b849a83cb4 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -145,38 +145,38 @@ String Variant::get_type_name(Variant::Type p_type) { } break; // arrays - case POOL_BYTE_ARRAY: { + case PACKED_BYTE_ARRAY: { - return "PoolByteArray"; + return "PackedByteArray"; } break; - case POOL_INT_ARRAY: { + case PACKED_INT_ARRAY: { - return "PoolIntArray"; + return "PackedIntArray"; } break; - case POOL_REAL_ARRAY: { + case PACKED_REAL_ARRAY: { - return "PoolRealArray"; + return "PackedRealArray"; } break; - case POOL_STRING_ARRAY: { + case PACKED_STRING_ARRAY: { - return "PoolStringArray"; + return "PackedStringArray"; } break; - case POOL_VECTOR2_ARRAY: { + case PACKED_VECTOR2_ARRAY: { - return "PoolVector2Array"; + return "PackedVector2Array"; } break; - case POOL_VECTOR3_ARRAY: { + case PACKED_VECTOR3_ARRAY: { - return "PoolVector3Array"; + return "PackedVector3Array"; } break; - case POOL_COLOR_ARRAY: { + case PACKED_COLOR_ARRAY: { - return "PoolColorArray"; + return "PackedColorArray"; } break; default: { @@ -329,20 +329,20 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { case ARRAY: { static const Type valid[] = { - POOL_BYTE_ARRAY, - POOL_INT_ARRAY, - POOL_STRING_ARRAY, - POOL_REAL_ARRAY, - POOL_COLOR_ARRAY, - POOL_VECTOR2_ARRAY, - POOL_VECTOR3_ARRAY, + PACKED_BYTE_ARRAY, + PACKED_INT_ARRAY, + PACKED_STRING_ARRAY, + PACKED_REAL_ARRAY, + PACKED_COLOR_ARRAY, + PACKED_VECTOR2_ARRAY, + PACKED_VECTOR3_ARRAY, NIL }; valid_types = valid; } break; // arrays - case POOL_BYTE_ARRAY: { + case PACKED_BYTE_ARRAY: { static const Type valid[] = { ARRAY, @@ -351,7 +351,7 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { valid_types = valid; } break; - case POOL_INT_ARRAY: { + case PACKED_INT_ARRAY: { static const Type valid[] = { ARRAY, @@ -359,7 +359,7 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { }; valid_types = valid; } break; - case POOL_REAL_ARRAY: { + case PACKED_REAL_ARRAY: { static const Type valid[] = { ARRAY, @@ -368,7 +368,7 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { valid_types = valid; } break; - case POOL_STRING_ARRAY: { + case PACKED_STRING_ARRAY: { static const Type valid[] = { ARRAY, @@ -376,7 +376,7 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { }; valid_types = valid; } break; - case POOL_VECTOR2_ARRAY: { + case PACKED_VECTOR2_ARRAY: { static const Type valid[] = { ARRAY, @@ -385,7 +385,7 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { valid_types = valid; } break; - case POOL_VECTOR3_ARRAY: { + case PACKED_VECTOR3_ARRAY: { static const Type valid[] = { ARRAY, @@ -394,7 +394,7 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { valid_types = valid; } break; - case POOL_COLOR_ARRAY: { + case PACKED_COLOR_ARRAY: { static const Type valid[] = { ARRAY, @@ -576,20 +576,20 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type case ARRAY: { static const Type valid[] = { - POOL_BYTE_ARRAY, - POOL_INT_ARRAY, - POOL_STRING_ARRAY, - POOL_REAL_ARRAY, - POOL_COLOR_ARRAY, - POOL_VECTOR2_ARRAY, - POOL_VECTOR3_ARRAY, + PACKED_BYTE_ARRAY, + PACKED_INT_ARRAY, + PACKED_STRING_ARRAY, + PACKED_REAL_ARRAY, + PACKED_COLOR_ARRAY, + PACKED_VECTOR2_ARRAY, + PACKED_VECTOR3_ARRAY, NIL }; valid_types = valid; } break; // arrays - case POOL_BYTE_ARRAY: { + case PACKED_BYTE_ARRAY: { static const Type valid[] = { ARRAY, @@ -598,7 +598,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type valid_types = valid; } break; - case POOL_INT_ARRAY: { + case PACKED_INT_ARRAY: { static const Type valid[] = { ARRAY, @@ -606,7 +606,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type }; valid_types = valid; } break; - case POOL_REAL_ARRAY: { + case PACKED_REAL_ARRAY: { static const Type valid[] = { ARRAY, @@ -615,7 +615,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type valid_types = valid; } break; - case POOL_STRING_ARRAY: { + case PACKED_STRING_ARRAY: { static const Type valid[] = { ARRAY, @@ -623,7 +623,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type }; valid_types = valid; } break; - case POOL_VECTOR2_ARRAY: { + case PACKED_VECTOR2_ARRAY: { static const Type valid[] = { ARRAY, @@ -632,7 +632,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type valid_types = valid; } break; - case POOL_VECTOR3_ARRAY: { + case PACKED_VECTOR3_ARRAY: { static const Type valid[] = { ARRAY, @@ -641,7 +641,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type valid_types = valid; } break; - case POOL_COLOR_ARRAY: { + case PACKED_COLOR_ARRAY: { static const Type valid[] = { ARRAY, @@ -809,39 +809,39 @@ bool Variant::is_zero() const { } break; // arrays - case POOL_BYTE_ARRAY: { + case PACKED_BYTE_ARRAY: { - return reinterpret_cast<const PoolVector<uint8_t> *>(_data._mem)->size() == 0; + return reinterpret_cast<const Vector<uint8_t> *>(_data._mem)->size() == 0; } break; - case POOL_INT_ARRAY: { + case PACKED_INT_ARRAY: { - return reinterpret_cast<const PoolVector<int> *>(_data._mem)->size() == 0; + return reinterpret_cast<const Vector<int> *>(_data._mem)->size() == 0; } break; - case POOL_REAL_ARRAY: { + case PACKED_REAL_ARRAY: { - return reinterpret_cast<const PoolVector<real_t> *>(_data._mem)->size() == 0; + return reinterpret_cast<const Vector<real_t> *>(_data._mem)->size() == 0; } break; - case POOL_STRING_ARRAY: { + case PACKED_STRING_ARRAY: { - return reinterpret_cast<const PoolVector<String> *>(_data._mem)->size() == 0; + return reinterpret_cast<const Vector<String> *>(_data._mem)->size() == 0; } break; - case POOL_VECTOR2_ARRAY: { + case PACKED_VECTOR2_ARRAY: { - return reinterpret_cast<const PoolVector<Vector2> *>(_data._mem)->size() == 0; + return reinterpret_cast<const Vector<Vector2> *>(_data._mem)->size() == 0; } break; - case POOL_VECTOR3_ARRAY: { + case PACKED_VECTOR3_ARRAY: { - return reinterpret_cast<const PoolVector<Vector3> *>(_data._mem)->size() == 0; + return reinterpret_cast<const Vector<Vector3> *>(_data._mem)->size() == 0; } break; - case POOL_COLOR_ARRAY: { + case PACKED_COLOR_ARRAY: { - return reinterpret_cast<const PoolVector<Color> *>(_data._mem)->size() == 0; + return reinterpret_cast<const Vector<Color> *>(_data._mem)->size() == 0; } break; default: { @@ -1039,39 +1039,39 @@ void Variant::reference(const Variant &p_variant) { } break; // arrays - case POOL_BYTE_ARRAY: { + case PACKED_BYTE_ARRAY: { - memnew_placement(_data._mem, PoolVector<uint8_t>(*reinterpret_cast<const PoolVector<uint8_t> *>(p_variant._data._mem))); + memnew_placement(_data._mem, Vector<uint8_t>(*reinterpret_cast<const Vector<uint8_t> *>(p_variant._data._mem))); } break; - case POOL_INT_ARRAY: { + case PACKED_INT_ARRAY: { - memnew_placement(_data._mem, PoolVector<int>(*reinterpret_cast<const PoolVector<int> *>(p_variant._data._mem))); + memnew_placement(_data._mem, Vector<int>(*reinterpret_cast<const Vector<int> *>(p_variant._data._mem))); } break; - case POOL_REAL_ARRAY: { + case PACKED_REAL_ARRAY: { - memnew_placement(_data._mem, PoolVector<real_t>(*reinterpret_cast<const PoolVector<real_t> *>(p_variant._data._mem))); + memnew_placement(_data._mem, Vector<real_t>(*reinterpret_cast<const Vector<real_t> *>(p_variant._data._mem))); } break; - case POOL_STRING_ARRAY: { + case PACKED_STRING_ARRAY: { - memnew_placement(_data._mem, PoolVector<String>(*reinterpret_cast<const PoolVector<String> *>(p_variant._data._mem))); + memnew_placement(_data._mem, Vector<String>(*reinterpret_cast<const Vector<String> *>(p_variant._data._mem))); } break; - case POOL_VECTOR2_ARRAY: { + case PACKED_VECTOR2_ARRAY: { - memnew_placement(_data._mem, PoolVector<Vector2>(*reinterpret_cast<const PoolVector<Vector2> *>(p_variant._data._mem))); + memnew_placement(_data._mem, Vector<Vector2>(*reinterpret_cast<const Vector<Vector2> *>(p_variant._data._mem))); } break; - case POOL_VECTOR3_ARRAY: { + case PACKED_VECTOR3_ARRAY: { - memnew_placement(_data._mem, PoolVector<Vector3>(*reinterpret_cast<const PoolVector<Vector3> *>(p_variant._data._mem))); + memnew_placement(_data._mem, Vector<Vector3>(*reinterpret_cast<const Vector<Vector3> *>(p_variant._data._mem))); } break; - case POOL_COLOR_ARRAY: { + case PACKED_COLOR_ARRAY: { - memnew_placement(_data._mem, PoolVector<Color>(*reinterpret_cast<const PoolVector<Color> *>(p_variant._data._mem))); + memnew_placement(_data._mem, Vector<Color>(*reinterpret_cast<const Vector<Color> *>(p_variant._data._mem))); } break; default: { @@ -1158,33 +1158,33 @@ void Variant::clear() { reinterpret_cast<Array *>(_data._mem)->~Array(); } break; // arrays - case POOL_BYTE_ARRAY: { + case PACKED_BYTE_ARRAY: { - reinterpret_cast<PoolVector<uint8_t> *>(_data._mem)->~PoolVector<uint8_t>(); + reinterpret_cast<Vector<uint8_t> *>(_data._mem)->~Vector<uint8_t>(); } break; - case POOL_INT_ARRAY: { + case PACKED_INT_ARRAY: { - reinterpret_cast<PoolVector<int> *>(_data._mem)->~PoolVector<int>(); + reinterpret_cast<Vector<int> *>(_data._mem)->~Vector<int>(); } break; - case POOL_REAL_ARRAY: { + case PACKED_REAL_ARRAY: { - reinterpret_cast<PoolVector<real_t> *>(_data._mem)->~PoolVector<real_t>(); + reinterpret_cast<Vector<real_t> *>(_data._mem)->~Vector<real_t>(); } break; - case POOL_STRING_ARRAY: { + case PACKED_STRING_ARRAY: { - reinterpret_cast<PoolVector<String> *>(_data._mem)->~PoolVector<String>(); + reinterpret_cast<Vector<String> *>(_data._mem)->~Vector<String>(); } break; - case POOL_VECTOR2_ARRAY: { + case PACKED_VECTOR2_ARRAY: { - reinterpret_cast<PoolVector<Vector2> *>(_data._mem)->~PoolVector<Vector2>(); + reinterpret_cast<Vector<Vector2> *>(_data._mem)->~Vector<Vector2>(); } break; - case POOL_VECTOR3_ARRAY: { + case PACKED_VECTOR3_ARRAY: { - reinterpret_cast<PoolVector<Vector3> *>(_data._mem)->~PoolVector<Vector3>(); + reinterpret_cast<Vector<Vector3> *>(_data._mem)->~Vector<Vector3>(); } break; - case POOL_COLOR_ARRAY: { + case PACKED_COLOR_ARRAY: { - reinterpret_cast<PoolVector<Color> *>(_data._mem)->~PoolVector<Color>(); + reinterpret_cast<Vector<Color> *>(_data._mem)->~Vector<Color>(); } break; default: { } /* not needed */ @@ -1529,9 +1529,9 @@ String Variant::stringify(List<const void *> &stack) const { return str; } break; - case POOL_VECTOR2_ARRAY: { + case PACKED_VECTOR2_ARRAY: { - PoolVector<Vector2> vec = operator PoolVector<Vector2>(); + Vector<Vector2> vec = operator Vector<Vector2>(); String str("["); for (int i = 0; i < vec.size(); i++) { @@ -1542,9 +1542,9 @@ String Variant::stringify(List<const void *> &stack) const { str += "]"; return str; } break; - case POOL_VECTOR3_ARRAY: { + case PACKED_VECTOR3_ARRAY: { - PoolVector<Vector3> vec = operator PoolVector<Vector3>(); + Vector<Vector3> vec = operator Vector<Vector3>(); String str("["); for (int i = 0; i < vec.size(); i++) { @@ -1555,9 +1555,9 @@ String Variant::stringify(List<const void *> &stack) const { str += "]"; return str; } break; - case POOL_STRING_ARRAY: { + case PACKED_STRING_ARRAY: { - PoolVector<String> vec = operator PoolVector<String>(); + Vector<String> vec = operator Vector<String>(); String str("["); for (int i = 0; i < vec.size(); i++) { @@ -1568,9 +1568,9 @@ String Variant::stringify(List<const void *> &stack) const { str += "]"; return str; } break; - case POOL_INT_ARRAY: { + case PACKED_INT_ARRAY: { - PoolVector<int> vec = operator PoolVector<int>(); + Vector<int> vec = operator Vector<int>(); String str("["); for (int i = 0; i < vec.size(); i++) { @@ -1581,9 +1581,9 @@ String Variant::stringify(List<const void *> &stack) const { str += "]"; return str; } break; - case POOL_REAL_ARRAY: { + case PACKED_REAL_ARRAY: { - PoolVector<real_t> vec = operator PoolVector<real_t>(); + Vector<real_t> vec = operator Vector<real_t>(); String str("["); for (int i = 0; i < vec.size(); i++) { @@ -1858,26 +1858,26 @@ inline DA _convert_array_from_variant(const Variant &p_variant) { case Variant::ARRAY: { return _convert_array<DA, Array>(p_variant.operator Array()); } - case Variant::POOL_BYTE_ARRAY: { - return _convert_array<DA, PoolVector<uint8_t> >(p_variant.operator PoolVector<uint8_t>()); + case Variant::PACKED_BYTE_ARRAY: { + return _convert_array<DA, Vector<uint8_t> >(p_variant.operator Vector<uint8_t>()); } - case Variant::POOL_INT_ARRAY: { - return _convert_array<DA, PoolVector<int> >(p_variant.operator PoolVector<int>()); + case Variant::PACKED_INT_ARRAY: { + return _convert_array<DA, Vector<int> >(p_variant.operator Vector<int>()); } - case Variant::POOL_REAL_ARRAY: { - return _convert_array<DA, PoolVector<real_t> >(p_variant.operator PoolVector<real_t>()); + case Variant::PACKED_REAL_ARRAY: { + return _convert_array<DA, Vector<real_t> >(p_variant.operator Vector<real_t>()); } - case Variant::POOL_STRING_ARRAY: { - return _convert_array<DA, PoolVector<String> >(p_variant.operator PoolVector<String>()); + case Variant::PACKED_STRING_ARRAY: { + return _convert_array<DA, Vector<String> >(p_variant.operator Vector<String>()); } - case Variant::POOL_VECTOR2_ARRAY: { - return _convert_array<DA, PoolVector<Vector2> >(p_variant.operator PoolVector<Vector2>()); + case Variant::PACKED_VECTOR2_ARRAY: { + return _convert_array<DA, Vector<Vector2> >(p_variant.operator Vector<Vector2>()); } - case Variant::POOL_VECTOR3_ARRAY: { - return _convert_array<DA, PoolVector<Vector3> >(p_variant.operator PoolVector<Vector3>()); + case Variant::PACKED_VECTOR3_ARRAY: { + return _convert_array<DA, Vector<Vector3> >(p_variant.operator Vector<Vector3>()); } - case Variant::POOL_COLOR_ARRAY: { - return _convert_array<DA, PoolVector<Color> >(p_variant.operator PoolVector<Color>()); + case Variant::PACKED_COLOR_ARRAY: { + return _convert_array<DA, Vector<Color> >(p_variant.operator Vector<Color>()); } default: { return DA(); @@ -1893,56 +1893,56 @@ Variant::operator Array() const { return _convert_array_from_variant<Array>(*this); } -Variant::operator PoolVector<uint8_t>() const { +Variant::operator Vector<uint8_t>() const { - if (type == POOL_BYTE_ARRAY) - return *reinterpret_cast<const PoolVector<uint8_t> *>(_data._mem); + if (type == PACKED_BYTE_ARRAY) + return *reinterpret_cast<const Vector<uint8_t> *>(_data._mem); else - return _convert_array_from_variant<PoolVector<uint8_t> >(*this); + return _convert_array_from_variant<Vector<uint8_t> >(*this); } -Variant::operator PoolVector<int>() const { +Variant::operator Vector<int>() const { - if (type == POOL_INT_ARRAY) - return *reinterpret_cast<const PoolVector<int> *>(_data._mem); + if (type == PACKED_INT_ARRAY) + return *reinterpret_cast<const Vector<int> *>(_data._mem); else - return _convert_array_from_variant<PoolVector<int> >(*this); + return _convert_array_from_variant<Vector<int> >(*this); } -Variant::operator PoolVector<real_t>() const { +Variant::operator Vector<real_t>() const { - if (type == POOL_REAL_ARRAY) - return *reinterpret_cast<const PoolVector<real_t> *>(_data._mem); + if (type == PACKED_REAL_ARRAY) + return *reinterpret_cast<const Vector<real_t> *>(_data._mem); else - return _convert_array_from_variant<PoolVector<real_t> >(*this); + return _convert_array_from_variant<Vector<real_t> >(*this); } -Variant::operator PoolVector<String>() const { +Variant::operator Vector<String>() const { - if (type == POOL_STRING_ARRAY) - return *reinterpret_cast<const PoolVector<String> *>(_data._mem); + if (type == PACKED_STRING_ARRAY) + return *reinterpret_cast<const Vector<String> *>(_data._mem); else - return _convert_array_from_variant<PoolVector<String> >(*this); + return _convert_array_from_variant<Vector<String> >(*this); } -Variant::operator PoolVector<Vector3>() const { +Variant::operator Vector<Vector3>() const { - if (type == POOL_VECTOR3_ARRAY) - return *reinterpret_cast<const PoolVector<Vector3> *>(_data._mem); + if (type == PACKED_VECTOR3_ARRAY) + return *reinterpret_cast<const Vector<Vector3> *>(_data._mem); else - return _convert_array_from_variant<PoolVector<Vector3> >(*this); + return _convert_array_from_variant<Vector<Vector3> >(*this); } -Variant::operator PoolVector<Vector2>() const { +Variant::operator Vector<Vector2>() const { - if (type == POOL_VECTOR2_ARRAY) - return *reinterpret_cast<const PoolVector<Vector2> *>(_data._mem); + if (type == PACKED_VECTOR2_ARRAY) + return *reinterpret_cast<const Vector<Vector2> *>(_data._mem); else - return _convert_array_from_variant<PoolVector<Vector2> >(*this); + return _convert_array_from_variant<Vector<Vector2> >(*this); } -Variant::operator PoolVector<Color>() const { +Variant::operator Vector<Color>() const { - if (type == POOL_COLOR_ARRAY) - return *reinterpret_cast<const PoolVector<Color> *>(_data._mem); + if (type == PACKED_COLOR_ARRAY) + return *reinterpret_cast<const Vector<Color> *>(_data._mem); else - return _convert_array_from_variant<PoolVector<Color> >(*this); + return _convert_array_from_variant<Vector<Color> >(*this); } /* helpers */ @@ -1957,33 +1957,16 @@ Variant::operator Vector<RID>() const { return rids; } -Variant::operator Vector<Vector2>() const { - - PoolVector<Vector2> from = operator PoolVector<Vector2>(); - Vector<Vector2> to; - int len = from.size(); - if (len == 0) - return Vector<Vector2>(); - to.resize(len); - PoolVector<Vector2>::Read r = from.read(); - Vector2 *w = to.ptrw(); - for (int i = 0; i < len; i++) { - - w[i] = r[i]; - } - return to; -} - -Variant::operator PoolVector<Plane>() const { +Variant::operator Vector<Plane>() const { Array va = operator Array(); - PoolVector<Plane> planes; + Vector<Plane> planes; int va_size = va.size(); if (va_size == 0) return planes; planes.resize(va_size); - PoolVector<Plane>::Write w = planes.write(); + Plane *w = planes.ptrw(); for (int i = 0; i < va_size; i++) w[i] = va[i]; @@ -1991,17 +1974,17 @@ Variant::operator PoolVector<Plane>() const { return planes; } -Variant::operator PoolVector<Face3>() const { +Variant::operator Vector<Face3>() const { - PoolVector<Vector3> va = operator PoolVector<Vector3>(); - PoolVector<Face3> faces; + Vector<Vector3> va = operator Vector<Vector3>(); + Vector<Face3> faces; int va_size = va.size(); if (va_size == 0) return faces; faces.resize(va_size / 3); - PoolVector<Face3>::Write w = faces.write(); - PoolVector<Vector3>::Read r = va.read(); + Face3 *w = faces.ptrw(); + const Vector3 *r = va.ptr(); for (int i = 0; i < va_size; i++) w[i / 3].vertex[i % 3] = r[i]; @@ -2009,87 +1992,24 @@ Variant::operator PoolVector<Face3>() const { return faces; } -Variant::operator Vector<Plane>() const { +Variant::operator Vector<Variant>() const { Array va = operator Array(); - Vector<Plane> planes; + Vector<Variant> variants; int va_size = va.size(); if (va_size == 0) - return planes; - - planes.resize(va_size); + return variants; + variants.resize(va_size); + Variant *w = variants.ptrw(); for (int i = 0; i < va_size; i++) - planes.write[i] = va[i]; + w[i] = variants[i]; - return planes; -} - -Variant::operator Vector<Variant>() const { - - Array from = operator Array(); - Vector<Variant> to; - int len = from.size(); - to.resize(len); - for (int i = 0; i < len; i++) { - - to.write[i] = from[i]; - } - return to; -} - -Variant::operator Vector<uint8_t>() const { - - PoolVector<uint8_t> from = operator PoolVector<uint8_t>(); - Vector<uint8_t> to; - int len = from.size(); - to.resize(len); - for (int i = 0; i < len; i++) { - - to.write[i] = from[i]; - } - return to; -} -Variant::operator Vector<int>() const { - - PoolVector<int> from = operator PoolVector<int>(); - Vector<int> to; - int len = from.size(); - to.resize(len); - for (int i = 0; i < len; i++) { - - to.write[i] = from[i]; - } - return to; -} -Variant::operator Vector<real_t>() const { - - PoolVector<real_t> from = operator PoolVector<real_t>(); - Vector<real_t> to; - int len = from.size(); - to.resize(len); - for (int i = 0; i < len; i++) { - - to.write[i] = from[i]; - } - return to; -} - -Variant::operator Vector<String>() const { - - PoolVector<String> from = operator PoolVector<String>(); - Vector<String> to; - int len = from.size(); - to.resize(len); - for (int i = 0; i < len; i++) { - - to.write[i] = from[i]; - } - return to; + return variants; } Variant::operator Vector<StringName>() const { - PoolVector<String> from = operator PoolVector<String>(); + Vector<String> from = operator Vector<String>(); Vector<StringName> to; int len = from.size(); to.resize(len); @@ -2100,39 +2020,6 @@ Variant::operator Vector<StringName>() const { return to; } -Variant::operator Vector<Vector3>() const { - - PoolVector<Vector3> from = operator PoolVector<Vector3>(); - Vector<Vector3> to; - int len = from.size(); - if (len == 0) - return Vector<Vector3>(); - to.resize(len); - PoolVector<Vector3>::Read r = from.read(); - Vector3 *w = to.ptrw(); - for (int i = 0; i < len; i++) { - - w[i] = r[i]; - } - return to; -} -Variant::operator Vector<Color>() const { - - PoolVector<Color> from = operator PoolVector<Color>(); - Vector<Color> to; - int len = from.size(); - if (len == 0) - return Vector<Color>(); - to.resize(len); - PoolVector<Color>::Read r = from.read(); - Color *w = to.ptrw(); - for (int i = 0; i < len; i++) { - - w[i] = r[i]; - } - return to; -} - Variant::operator Margin() const { return (Margin) operator int(); @@ -2144,9 +2031,9 @@ Variant::operator Orientation() const { Variant::operator IP_Address() const { - if (type == POOL_REAL_ARRAY || type == POOL_INT_ARRAY || type == POOL_BYTE_ARRAY) { + if (type == PACKED_REAL_ARRAY || type == PACKED_INT_ARRAY || type == PACKED_BYTE_ARRAY) { - PoolVector<int> addr = operator PoolVector<int>(); + Vector<int> addr = operator Vector<int>(); if (addr.size() == 4) { return IP_Address(addr.get(0), addr.get(1), addr.get(2), addr.get(3)); } @@ -2368,20 +2255,6 @@ Variant::Variant(const Array &p_array) { memnew_placement(_data._mem, Array(p_array)); } -Variant::Variant(const PoolVector<Plane> &p_array) { - - type = ARRAY; - - Array *plane_array = memnew_placement(_data._mem, Array); - - plane_array->resize(p_array.size()); - - for (int i = 0; i < p_array.size(); i++) { - - plane_array->operator[](i) = Variant(p_array[i]); - } -} - Variant::Variant(const Vector<Plane> &p_array) { type = ARRAY; @@ -2410,68 +2283,52 @@ Variant::Variant(const Vector<RID> &p_array) { } } -Variant::Variant(const Vector<Vector2> &p_array) { - - type = NIL; - PoolVector<Vector2> v; - int len = p_array.size(); - if (len > 0) { - v.resize(len); - PoolVector<Vector2>::Write w = v.write(); - const Vector2 *r = p_array.ptr(); +Variant::Variant(const Vector<uint8_t> &p_raw_array) { - for (int i = 0; i < len; i++) - w[i] = r[i]; - } - *this = v; -} - -Variant::Variant(const PoolVector<uint8_t> &p_raw_array) { - - type = POOL_BYTE_ARRAY; - memnew_placement(_data._mem, PoolVector<uint8_t>(p_raw_array)); + type = PACKED_BYTE_ARRAY; + memnew_placement(_data._mem, Vector<uint8_t>(p_raw_array)); } -Variant::Variant(const PoolVector<int> &p_int_array) { +Variant::Variant(const Vector<int> &p_int_array) { - type = POOL_INT_ARRAY; - memnew_placement(_data._mem, PoolVector<int>(p_int_array)); + type = PACKED_INT_ARRAY; + memnew_placement(_data._mem, Vector<int>(p_int_array)); } -Variant::Variant(const PoolVector<real_t> &p_real_array) { +Variant::Variant(const Vector<real_t> &p_real_array) { - type = POOL_REAL_ARRAY; - memnew_placement(_data._mem, PoolVector<real_t>(p_real_array)); + type = PACKED_REAL_ARRAY; + memnew_placement(_data._mem, Vector<real_t>(p_real_array)); } -Variant::Variant(const PoolVector<String> &p_string_array) { +Variant::Variant(const Vector<String> &p_string_array) { - type = POOL_STRING_ARRAY; - memnew_placement(_data._mem, PoolVector<String>(p_string_array)); + type = PACKED_STRING_ARRAY; + memnew_placement(_data._mem, Vector<String>(p_string_array)); } -Variant::Variant(const PoolVector<Vector3> &p_vector3_array) { +Variant::Variant(const Vector<Vector3> &p_vector3_array) { - type = POOL_VECTOR3_ARRAY; - memnew_placement(_data._mem, PoolVector<Vector3>(p_vector3_array)); + type = PACKED_VECTOR3_ARRAY; + memnew_placement(_data._mem, Vector<Vector3>(p_vector3_array)); } -Variant::Variant(const PoolVector<Vector2> &p_vector2_array) { +Variant::Variant(const Vector<Vector2> &p_vector2_array) { - type = POOL_VECTOR2_ARRAY; - memnew_placement(_data._mem, PoolVector<Vector2>(p_vector2_array)); + type = PACKED_VECTOR2_ARRAY; + memnew_placement(_data._mem, Vector<Vector2>(p_vector2_array)); } -Variant::Variant(const PoolVector<Color> &p_color_array) { +Variant::Variant(const Vector<Color> &p_color_array) { - type = POOL_COLOR_ARRAY; - memnew_placement(_data._mem, PoolVector<Color>(p_color_array)); + type = PACKED_COLOR_ARRAY; + memnew_placement(_data._mem, Vector<Color>(p_color_array)); } -Variant::Variant(const PoolVector<Face3> &p_face_array) { +Variant::Variant(const Vector<Face3> &p_face_array) { - PoolVector<Vector3> vertices; + Vector<Vector3> vertices; int face_count = p_face_array.size(); vertices.resize(face_count * 3); if (face_count) { - PoolVector<Face3>::Read r = p_face_array.read(); - PoolVector<Vector3>::Write w = vertices.write(); + const Face3 *r = p_face_array.ptr(); + Vector3 *w = vertices.ptrw(); for (int i = 0; i < face_count; i++) { @@ -2486,93 +2343,20 @@ Variant::Variant(const PoolVector<Face3> &p_face_array) { } /* helpers */ - Variant::Variant(const Vector<Variant> &p_array) { - - type = NIL; - Array v; - int len = p_array.size(); - v.resize(len); - for (int i = 0; i < len; i++) - v.set(i, p_array[i]); - *this = v; -} - -Variant::Variant(const Vector<uint8_t> &p_array) { - - type = NIL; - PoolVector<uint8_t> v; - int len = p_array.size(); - v.resize(len); - for (int i = 0; i < len; i++) - v.set(i, p_array[i]); - *this = v; -} - -Variant::Variant(const Vector<int> &p_array) { - - type = NIL; - PoolVector<int> v; - int len = p_array.size(); - v.resize(len); - for (int i = 0; i < len; i++) - v.set(i, p_array[i]); - *this = v; -} - -Variant::Variant(const Vector<real_t> &p_array) { - type = NIL; - PoolVector<real_t> v; - int len = p_array.size(); - v.resize(len); - for (int i = 0; i < len; i++) - v.set(i, p_array[i]); - *this = v; -} - -Variant::Variant(const Vector<String> &p_array) { - - type = NIL; - PoolVector<String> v; - int len = p_array.size(); - v.resize(len); - for (int i = 0; i < len; i++) - v.set(i, p_array[i]); - *this = v; -} - -Variant::Variant(const Vector<StringName> &p_array) { - - type = NIL; - PoolVector<String> v; - int len = p_array.size(); - v.resize(len); - for (int i = 0; i < len; i++) - v.set(i, p_array[i]); - *this = v; -} - -Variant::Variant(const Vector<Vector3> &p_array) { - - type = NIL; - PoolVector<Vector3> v; - int len = p_array.size(); - if (len > 0) { - v.resize(len); - PoolVector<Vector3>::Write w = v.write(); - const Vector3 *r = p_array.ptr(); - - for (int i = 0; i < len; i++) - w[i] = r[i]; + Array arr; + arr.resize(p_array.size()); + for (int i = 0; i < p_array.size(); i++) { + arr[i] = p_array[i]; } - *this = v; + *this = arr; } -Variant::Variant(const Vector<Color> &p_array) { +Variant::Variant(const Vector<StringName> &p_array) { type = NIL; - PoolVector<Color> v; + Vector<String> v; int len = p_array.size(); v.resize(len); for (int i = 0; i < len; i++) @@ -2699,33 +2483,33 @@ void Variant::operator=(const Variant &p_variant) { } break; // arrays - case POOL_BYTE_ARRAY: { + case PACKED_BYTE_ARRAY: { - *reinterpret_cast<PoolVector<uint8_t> *>(_data._mem) = *reinterpret_cast<const PoolVector<uint8_t> *>(p_variant._data._mem); + *reinterpret_cast<Vector<uint8_t> *>(_data._mem) = *reinterpret_cast<const Vector<uint8_t> *>(p_variant._data._mem); } break; - case POOL_INT_ARRAY: { + case PACKED_INT_ARRAY: { - *reinterpret_cast<PoolVector<int> *>(_data._mem) = *reinterpret_cast<const PoolVector<int> *>(p_variant._data._mem); + *reinterpret_cast<Vector<int> *>(_data._mem) = *reinterpret_cast<const Vector<int> *>(p_variant._data._mem); } break; - case POOL_REAL_ARRAY: { + case PACKED_REAL_ARRAY: { - *reinterpret_cast<PoolVector<real_t> *>(_data._mem) = *reinterpret_cast<const PoolVector<real_t> *>(p_variant._data._mem); + *reinterpret_cast<Vector<real_t> *>(_data._mem) = *reinterpret_cast<const Vector<real_t> *>(p_variant._data._mem); } break; - case POOL_STRING_ARRAY: { + case PACKED_STRING_ARRAY: { - *reinterpret_cast<PoolVector<String> *>(_data._mem) = *reinterpret_cast<const PoolVector<String> *>(p_variant._data._mem); + *reinterpret_cast<Vector<String> *>(_data._mem) = *reinterpret_cast<const Vector<String> *>(p_variant._data._mem); } break; - case POOL_VECTOR2_ARRAY: { + case PACKED_VECTOR2_ARRAY: { - *reinterpret_cast<PoolVector<Vector2> *>(_data._mem) = *reinterpret_cast<const PoolVector<Vector2> *>(p_variant._data._mem); + *reinterpret_cast<Vector<Vector2> *>(_data._mem) = *reinterpret_cast<const Vector<Vector2> *>(p_variant._data._mem); } break; - case POOL_VECTOR3_ARRAY: { + case PACKED_VECTOR3_ARRAY: { - *reinterpret_cast<PoolVector<Vector3> *>(_data._mem) = *reinterpret_cast<const PoolVector<Vector3> *>(p_variant._data._mem); + *reinterpret_cast<Vector<Vector3> *>(_data._mem) = *reinterpret_cast<const Vector<Vector3> *>(p_variant._data._mem); } break; - case POOL_COLOR_ARRAY: { + case PACKED_COLOR_ARRAY: { - *reinterpret_cast<PoolVector<Color> *>(_data._mem) = *reinterpret_cast<const PoolVector<Color> *>(p_variant._data._mem); + *reinterpret_cast<Vector<Color> *>(_data._mem) = *reinterpret_cast<const Vector<Color> *>(p_variant._data._mem); } break; default: { } @@ -2898,51 +2682,51 @@ uint32_t Variant::hash() const { return arr.hash(); } break; - case POOL_BYTE_ARRAY: { + case PACKED_BYTE_ARRAY: { - const PoolVector<uint8_t> &arr = *reinterpret_cast<const PoolVector<uint8_t> *>(_data._mem); + const Vector<uint8_t> &arr = *reinterpret_cast<const Vector<uint8_t> *>(_data._mem); int len = arr.size(); if (likely(len)) { - PoolVector<uint8_t>::Read r = arr.read(); + const uint8_t *r = arr.ptr(); return hash_djb2_buffer((uint8_t *)&r[0], len); } else { return hash_djb2_one_64(0); } } break; - case POOL_INT_ARRAY: { + case PACKED_INT_ARRAY: { - const PoolVector<int> &arr = *reinterpret_cast<const PoolVector<int> *>(_data._mem); + const Vector<int> &arr = *reinterpret_cast<const Vector<int> *>(_data._mem); int len = arr.size(); if (likely(len)) { - PoolVector<int>::Read r = arr.read(); + const int *r = arr.ptr(); return hash_djb2_buffer((uint8_t *)&r[0], len * sizeof(int)); } else { return hash_djb2_one_64(0); } } break; - case POOL_REAL_ARRAY: { + case PACKED_REAL_ARRAY: { - const PoolVector<real_t> &arr = *reinterpret_cast<const PoolVector<real_t> *>(_data._mem); + const Vector<real_t> &arr = *reinterpret_cast<const Vector<real_t> *>(_data._mem); int len = arr.size(); if (likely(len)) { - PoolVector<real_t>::Read r = arr.read(); + const real_t *r = arr.ptr(); return hash_djb2_buffer((uint8_t *)&r[0], len * sizeof(real_t)); } else { return hash_djb2_one_float(0.0); } } break; - case POOL_STRING_ARRAY: { + case PACKED_STRING_ARRAY: { uint32_t hash = 5831; - const PoolVector<String> &arr = *reinterpret_cast<const PoolVector<String> *>(_data._mem); + const Vector<String> &arr = *reinterpret_cast<const Vector<String> *>(_data._mem); int len = arr.size(); if (likely(len)) { - PoolVector<String>::Read r = arr.read(); + const String *r = arr.ptr(); for (int i = 0; i < len; i++) { hash = hash_djb2_one_32(r[i].hash(), hash); @@ -2951,14 +2735,14 @@ uint32_t Variant::hash() const { return hash; } break; - case POOL_VECTOR2_ARRAY: { + case PACKED_VECTOR2_ARRAY: { uint32_t hash = 5831; - const PoolVector<Vector2> &arr = *reinterpret_cast<const PoolVector<Vector2> *>(_data._mem); + const Vector<Vector2> &arr = *reinterpret_cast<const Vector<Vector2> *>(_data._mem); int len = arr.size(); if (likely(len)) { - PoolVector<Vector2>::Read r = arr.read(); + const Vector2 *r = arr.ptr(); for (int i = 0; i < len; i++) { hash = hash_djb2_one_float(r[i].x, hash); @@ -2968,14 +2752,14 @@ uint32_t Variant::hash() const { return hash; } break; - case POOL_VECTOR3_ARRAY: { + case PACKED_VECTOR3_ARRAY: { uint32_t hash = 5831; - const PoolVector<Vector3> &arr = *reinterpret_cast<const PoolVector<Vector3> *>(_data._mem); + const Vector<Vector3> &arr = *reinterpret_cast<const Vector<Vector3> *>(_data._mem); int len = arr.size(); if (likely(len)) { - PoolVector<Vector3>::Read r = arr.read(); + const Vector3 *r = arr.ptr(); for (int i = 0; i < len; i++) { hash = hash_djb2_one_float(r[i].x, hash); @@ -2986,14 +2770,14 @@ uint32_t Variant::hash() const { return hash; } break; - case POOL_COLOR_ARRAY: { + case PACKED_COLOR_ARRAY: { uint32_t hash = 5831; - const PoolVector<Color> &arr = *reinterpret_cast<const PoolVector<Color> *>(_data._mem); + const Vector<Color> &arr = *reinterpret_cast<const Vector<Color> *>(_data._mem); int len = arr.size(); if (likely(len)) { - PoolVector<Color>::Read r = arr.read(); + const Color *r = arr.ptr(); for (int i = 0; i < len; i++) { hash = hash_djb2_one_float(r[i].r, hash); @@ -3036,21 +2820,21 @@ uint32_t Variant::hash() const { (hash_compare_scalar((p_lhs).b, (p_rhs).b)) && \ (hash_compare_scalar((p_lhs).a, (p_rhs).a)) -#define hash_compare_pool_array(p_lhs, p_rhs, p_type, p_compare_func) \ - const PoolVector<p_type> &l = *reinterpret_cast<const PoolVector<p_type> *>(p_lhs); \ - const PoolVector<p_type> &r = *reinterpret_cast<const PoolVector<p_type> *>(p_rhs); \ - \ - if (l.size() != r.size()) \ - return false; \ - \ - PoolVector<p_type>::Read lr = l.read(); \ - PoolVector<p_type>::Read rr = r.read(); \ - \ - for (int i = 0; i < l.size(); ++i) { \ - if (!p_compare_func((lr[i]), (rr[i]))) \ - return false; \ - } \ - \ +#define hash_compare_pool_array(p_lhs, p_rhs, p_type, p_compare_func) \ + const Vector<p_type> &l = *reinterpret_cast<const Vector<p_type> *>(p_lhs); \ + const Vector<p_type> &r = *reinterpret_cast<const Vector<p_type> *>(p_rhs); \ + \ + if (l.size() != r.size()) \ + return false; \ + \ + const p_type *lr = l.ptr(); \ + const p_type *rr = r.ptr(); \ + \ + for (int i = 0; i < l.size(); ++i) { \ + if (!p_compare_func((lr[i]), (rr[i]))) \ + return false; \ + } \ + \ return true bool Variant::hash_compare(const Variant &p_variant) const { @@ -3166,19 +2950,19 @@ bool Variant::hash_compare(const Variant &p_variant) const { return true; } break; - case POOL_REAL_ARRAY: { + case PACKED_REAL_ARRAY: { hash_compare_pool_array(_data._mem, p_variant._data._mem, real_t, hash_compare_scalar); } break; - case POOL_VECTOR2_ARRAY: { + case PACKED_VECTOR2_ARRAY: { hash_compare_pool_array(_data._mem, p_variant._data._mem, Vector2, hash_compare_vector2); } break; - case POOL_VECTOR3_ARRAY: { + case PACKED_VECTOR3_ARRAY: { hash_compare_pool_array(_data._mem, p_variant._data._mem, Vector3, hash_compare_vector3); } break; - case POOL_COLOR_ARRAY: { + case PACKED_COLOR_ARRAY: { hash_compare_pool_array(_data._mem, p_variant._data._mem, Color, hash_compare_color); } break; diff --git a/core/variant.h b/core/variant.h index bb3840932d..51f23b4b49 100644 --- a/core/variant.h +++ b/core/variant.h @@ -45,7 +45,7 @@ #include "core/math/vector3.h" #include "core/node_path.h" #include "core/object_id.h" -#include "core/pool_vector.h" + #include "core/rid.h" #include "core/ustring.h" @@ -56,13 +56,13 @@ class Control; // helper struct PropertyInfo; struct MethodInfo; -typedef PoolVector<uint8_t> PoolByteArray; -typedef PoolVector<int> PoolIntArray; -typedef PoolVector<real_t> PoolRealArray; -typedef PoolVector<String> PoolStringArray; -typedef PoolVector<Vector2> PoolVector2Array; -typedef PoolVector<Vector3> PoolVector3Array; -typedef PoolVector<Color> PoolColorArray; +typedef Vector<uint8_t> PackedByteArray; +typedef Vector<int> PackedIntArray; +typedef Vector<real_t> PackedRealArray; +typedef Vector<String> PackedStringArray; +typedef Vector<Vector2> PackedVector2Array; +typedef Vector<Vector3> PackedVector3Array; +typedef Vector<Color> PackedColorArray; // Temporary workaround until c++11 alignas() #ifdef __GNUC__ @@ -105,13 +105,13 @@ public: ARRAY, // arrays - POOL_BYTE_ARRAY, // 20 - POOL_INT_ARRAY, - POOL_REAL_ARRAY, - POOL_STRING_ARRAY, - POOL_VECTOR2_ARRAY, - POOL_VECTOR3_ARRAY, // 25 - POOL_COLOR_ARRAY, + PACKED_BYTE_ARRAY, // 20 + PACKED_INT_ARRAY, + PACKED_REAL_ARRAY, + PACKED_STRING_ARRAY, + PACKED_VECTOR2_ARRAY, + PACKED_VECTOR3_ARRAY, // 25 + PACKED_COLOR_ARRAY, VARIANT_MAX @@ -205,27 +205,19 @@ public: operator Dictionary() const; operator Array() const; - operator PoolVector<uint8_t>() const; - operator PoolVector<int>() const; - operator PoolVector<real_t>() const; - operator PoolVector<String>() const; - operator PoolVector<Vector3>() const; - operator PoolVector<Color>() const; - operator PoolVector<Plane>() const; - operator PoolVector<Face3>() const; - - operator Vector<Variant>() const; operator Vector<uint8_t>() const; operator Vector<int>() const; operator Vector<real_t>() const; operator Vector<String>() const; - operator Vector<StringName>() const; operator Vector<Vector3>() const; operator Vector<Color>() const; + operator Vector<Plane>() const; + operator Vector<Face3>() const; + + operator Vector<Variant>() const; + operator Vector<StringName>() const; operator Vector<RID>() const; operator Vector<Vector2>() const; - operator PoolVector<Vector2>() const; - operator Vector<Plane>() const; // some core type enums to convert to operator Margin() const; @@ -273,27 +265,19 @@ public: Variant(const Dictionary &p_dictionary); Variant(const Array &p_array); - Variant(const PoolVector<Plane> &p_array); // helper - Variant(const PoolVector<uint8_t> &p_raw_array); - Variant(const PoolVector<int> &p_int_array); - Variant(const PoolVector<real_t> &p_real_array); - Variant(const PoolVector<String> &p_string_array); - Variant(const PoolVector<Vector3> &p_vector3_array); - Variant(const PoolVector<Color> &p_color_array); - Variant(const PoolVector<Face3> &p_face_array); + Variant(const Vector<Plane> &p_array); // helper + Variant(const Vector<uint8_t> &p_raw_array); + Variant(const Vector<int> &p_int_array); + Variant(const Vector<real_t> &p_real_array); + Variant(const Vector<String> &p_string_array); + Variant(const Vector<Vector3> &p_vector3_array); + Variant(const Vector<Color> &p_color_array); + Variant(const Vector<Face3> &p_face_array); Variant(const Vector<Variant> &p_array); - Variant(const Vector<uint8_t> &p_array); - Variant(const Vector<int> &p_array); - Variant(const Vector<real_t> &p_array); - Variant(const Vector<String> &p_array); Variant(const Vector<StringName> &p_array); - Variant(const Vector<Vector3> &p_array); - Variant(const Vector<Color> &p_array); - Variant(const Vector<Plane> &p_array); // helper Variant(const Vector<RID> &p_array); // helper Variant(const Vector<Vector2> &p_array); // helper - Variant(const PoolVector<Vector2> &p_vector2_array); // helper Variant(const IP_Address &p_address); diff --git a/core/variant_call.cpp b/core/variant_call.cpp index ac995d1c78..6506da58d4 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -317,17 +317,16 @@ struct _VariantCall { String *s = reinterpret_cast<String *>(p_self._data._mem); if (s->empty()) { - r_ret = PoolByteArray(); + r_ret = PackedByteArray(); return; } CharString charstr = s->ascii(); - PoolByteArray retval; + PackedByteArray retval; size_t len = charstr.length(); retval.resize(len); - PoolByteArray::Write w = retval.write(); - copymem(w.ptr(), charstr.ptr(), len); - w.release(); + uint8_t *w = retval.ptrw(); + copymem(w, charstr.ptr(), len); r_ret = retval; } @@ -336,17 +335,16 @@ struct _VariantCall { String *s = reinterpret_cast<String *>(p_self._data._mem); if (s->empty()) { - r_ret = PoolByteArray(); + r_ret = PackedByteArray(); return; } CharString charstr = s->utf8(); - PoolByteArray retval; + PackedByteArray retval; size_t len = charstr.length(); retval.resize(len); - PoolByteArray::Write w = retval.write(); - copymem(w.ptr(), charstr.ptr(), len); - w.release(); + uint8_t *w = retval.ptrw(); + copymem(w, charstr.ptr(), len); r_ret = retval; } @@ -554,15 +552,15 @@ struct _VariantCall { VCALL_LOCALMEM0R(Array, max); VCALL_LOCALMEM0R(Array, min); - static void _call_PoolByteArray_get_string_from_ascii(Variant &r_ret, Variant &p_self, const Variant **p_args) { + static void _call_PackedByteArray_get_string_from_ascii(Variant &r_ret, Variant &p_self, const Variant **p_args) { - PoolByteArray *ba = reinterpret_cast<PoolByteArray *>(p_self._data._mem); + PackedByteArray *ba = reinterpret_cast<PackedByteArray *>(p_self._data._mem); String s; if (ba->size() > 0) { - PoolByteArray::Read r = ba->read(); + const uint8_t *r = ba->ptr(); CharString cs; cs.resize(ba->size() + 1); - copymem(cs.ptrw(), r.ptr(), ba->size()); + copymem(cs.ptrw(), r, ba->size()); cs[ba->size()] = 0; s = cs.get_data(); @@ -570,26 +568,26 @@ struct _VariantCall { r_ret = s; } - static void _call_PoolByteArray_get_string_from_utf8(Variant &r_ret, Variant &p_self, const Variant **p_args) { + static void _call_PackedByteArray_get_string_from_utf8(Variant &r_ret, Variant &p_self, const Variant **p_args) { - PoolByteArray *ba = reinterpret_cast<PoolByteArray *>(p_self._data._mem); + PackedByteArray *ba = reinterpret_cast<PackedByteArray *>(p_self._data._mem); String s; if (ba->size() > 0) { - PoolByteArray::Read r = ba->read(); - s.parse_utf8((const char *)r.ptr(), ba->size()); + const uint8_t *r = ba->ptr(); + s.parse_utf8((const char *)r, ba->size()); } r_ret = s; } - static void _call_PoolByteArray_compress(Variant &r_ret, Variant &p_self, const Variant **p_args) { + static void _call_PackedByteArray_compress(Variant &r_ret, Variant &p_self, const Variant **p_args) { - PoolByteArray *ba = reinterpret_cast<PoolByteArray *>(p_self._data._mem); - PoolByteArray compressed; + PackedByteArray *ba = reinterpret_cast<PackedByteArray *>(p_self._data._mem); + PackedByteArray compressed; if (ba->size() > 0) { Compression::Mode mode = (Compression::Mode)(int)(*p_args[0]); compressed.resize(Compression::get_max_compressed_buffer_size(ba->size(), mode)); - int result = Compression::compress(compressed.write().ptr(), ba->read().ptr(), ba->size(), mode); + int result = Compression::compress(compressed.ptrw(), ba->ptr(), ba->size(), mode); result = result >= 0 ? result : 0; compressed.resize(result); @@ -597,10 +595,10 @@ struct _VariantCall { r_ret = compressed; } - static void _call_PoolByteArray_decompress(Variant &r_ret, Variant &p_self, const Variant **p_args) { + static void _call_PackedByteArray_decompress(Variant &r_ret, Variant &p_self, const Variant **p_args) { - PoolByteArray *ba = reinterpret_cast<PoolByteArray *>(p_self._data._mem); - PoolByteArray decompressed; + PackedByteArray *ba = reinterpret_cast<PackedByteArray *>(p_self._data._mem); + PackedByteArray decompressed; Compression::Mode mode = (Compression::Mode)(int)(*p_args[1]); int buffer_size = (int)(*p_args[0]); @@ -611,7 +609,7 @@ struct _VariantCall { } decompressed.resize(buffer_size); - int result = Compression::decompress(decompressed.write().ptr(), buffer_size, ba->read().ptr(), ba->size(), mode); + int result = Compression::decompress(decompressed.ptrw(), buffer_size, ba->ptr(), ba->size(), mode); result = result >= 0 ? result : 0; decompressed.resize(result); @@ -619,102 +617,101 @@ struct _VariantCall { r_ret = decompressed; } - static void _call_PoolByteArray_hex_encode(Variant &r_ret, Variant &p_self, const Variant **p_args) { - PoolByteArray *ba = reinterpret_cast<PoolByteArray *>(p_self._data._mem); + static void _call_PackedByteArray_hex_encode(Variant &r_ret, Variant &p_self, const Variant **p_args) { + PackedByteArray *ba = reinterpret_cast<PackedByteArray *>(p_self._data._mem); if (ba->size() == 0) { r_ret = String(); return; } - PoolByteArray::Read r = ba->read(); + const uint8_t *r = ba->ptr(); String s = String::hex_encode_buffer(&r[0], ba->size()); r_ret = s; } - VCALL_LOCALMEM0R(PoolByteArray, size); - VCALL_LOCALMEM0R(PoolByteArray, empty); - VCALL_LOCALMEM2(PoolByteArray, set); - VCALL_LOCALMEM1R(PoolByteArray, get); - VCALL_LOCALMEM1(PoolByteArray, push_back); - VCALL_LOCALMEM1(PoolByteArray, resize); - VCALL_LOCALMEM2R(PoolByteArray, insert); - VCALL_LOCALMEM1(PoolByteArray, remove); - VCALL_LOCALMEM1(PoolByteArray, append); - VCALL_LOCALMEM1(PoolByteArray, append_array); - VCALL_LOCALMEM0(PoolByteArray, invert); - VCALL_LOCALMEM2R(PoolByteArray, subarray); - - VCALL_LOCALMEM0R(PoolIntArray, size); - VCALL_LOCALMEM0R(PoolIntArray, empty); - VCALL_LOCALMEM2(PoolIntArray, set); - VCALL_LOCALMEM1R(PoolIntArray, get); - VCALL_LOCALMEM1(PoolIntArray, push_back); - VCALL_LOCALMEM1(PoolIntArray, resize); - VCALL_LOCALMEM2R(PoolIntArray, insert); - VCALL_LOCALMEM1(PoolIntArray, remove); - VCALL_LOCALMEM1(PoolIntArray, append); - VCALL_LOCALMEM1(PoolIntArray, append_array); - VCALL_LOCALMEM0(PoolIntArray, invert); - - VCALL_LOCALMEM0R(PoolRealArray, size); - VCALL_LOCALMEM0R(PoolRealArray, empty); - VCALL_LOCALMEM2(PoolRealArray, set); - VCALL_LOCALMEM1R(PoolRealArray, get); - VCALL_LOCALMEM1(PoolRealArray, push_back); - VCALL_LOCALMEM1(PoolRealArray, resize); - VCALL_LOCALMEM2R(PoolRealArray, insert); - VCALL_LOCALMEM1(PoolRealArray, remove); - VCALL_LOCALMEM1(PoolRealArray, append); - VCALL_LOCALMEM1(PoolRealArray, append_array); - VCALL_LOCALMEM0(PoolRealArray, invert); - - VCALL_LOCALMEM0R(PoolStringArray, size); - VCALL_LOCALMEM0R(PoolStringArray, empty); - VCALL_LOCALMEM2(PoolStringArray, set); - VCALL_LOCALMEM1R(PoolStringArray, get); - VCALL_LOCALMEM1(PoolStringArray, push_back); - VCALL_LOCALMEM1(PoolStringArray, resize); - VCALL_LOCALMEM2R(PoolStringArray, insert); - VCALL_LOCALMEM1(PoolStringArray, remove); - VCALL_LOCALMEM1(PoolStringArray, append); - VCALL_LOCALMEM1(PoolStringArray, append_array); - VCALL_LOCALMEM0(PoolStringArray, invert); - VCALL_LOCALMEM1R(PoolStringArray, join); - - VCALL_LOCALMEM0R(PoolVector2Array, size); - VCALL_LOCALMEM0R(PoolVector2Array, empty); - VCALL_LOCALMEM2(PoolVector2Array, set); - VCALL_LOCALMEM1R(PoolVector2Array, get); - VCALL_LOCALMEM1(PoolVector2Array, push_back); - VCALL_LOCALMEM1(PoolVector2Array, resize); - VCALL_LOCALMEM2R(PoolVector2Array, insert); - VCALL_LOCALMEM1(PoolVector2Array, remove); - VCALL_LOCALMEM1(PoolVector2Array, append); - VCALL_LOCALMEM1(PoolVector2Array, append_array); - VCALL_LOCALMEM0(PoolVector2Array, invert); - - VCALL_LOCALMEM0R(PoolVector3Array, size); - VCALL_LOCALMEM0R(PoolVector3Array, empty); - VCALL_LOCALMEM2(PoolVector3Array, set); - VCALL_LOCALMEM1R(PoolVector3Array, get); - VCALL_LOCALMEM1(PoolVector3Array, push_back); - VCALL_LOCALMEM1(PoolVector3Array, resize); - VCALL_LOCALMEM2R(PoolVector3Array, insert); - VCALL_LOCALMEM1(PoolVector3Array, remove); - VCALL_LOCALMEM1(PoolVector3Array, append); - VCALL_LOCALMEM1(PoolVector3Array, append_array); - VCALL_LOCALMEM0(PoolVector3Array, invert); - - VCALL_LOCALMEM0R(PoolColorArray, size); - VCALL_LOCALMEM0R(PoolColorArray, empty); - VCALL_LOCALMEM2(PoolColorArray, set); - VCALL_LOCALMEM1R(PoolColorArray, get); - VCALL_LOCALMEM1(PoolColorArray, push_back); - VCALL_LOCALMEM1(PoolColorArray, resize); - VCALL_LOCALMEM2R(PoolColorArray, insert); - VCALL_LOCALMEM1(PoolColorArray, remove); - VCALL_LOCALMEM1(PoolColorArray, append); - VCALL_LOCALMEM1(PoolColorArray, append_array); - VCALL_LOCALMEM0(PoolColorArray, invert); + VCALL_LOCALMEM0R(PackedByteArray, size); + VCALL_LOCALMEM0R(PackedByteArray, empty); + VCALL_LOCALMEM2(PackedByteArray, set); + VCALL_LOCALMEM1R(PackedByteArray, get); + VCALL_LOCALMEM1(PackedByteArray, push_back); + VCALL_LOCALMEM1(PackedByteArray, resize); + VCALL_LOCALMEM2R(PackedByteArray, insert); + VCALL_LOCALMEM1(PackedByteArray, remove); + VCALL_LOCALMEM1(PackedByteArray, append); + VCALL_LOCALMEM1(PackedByteArray, append_array); + VCALL_LOCALMEM0(PackedByteArray, invert); + VCALL_LOCALMEM2R(PackedByteArray, subarray); + + VCALL_LOCALMEM0R(PackedIntArray, size); + VCALL_LOCALMEM0R(PackedIntArray, empty); + VCALL_LOCALMEM2(PackedIntArray, set); + VCALL_LOCALMEM1R(PackedIntArray, get); + VCALL_LOCALMEM1(PackedIntArray, push_back); + VCALL_LOCALMEM1(PackedIntArray, resize); + VCALL_LOCALMEM2R(PackedIntArray, insert); + VCALL_LOCALMEM1(PackedIntArray, remove); + VCALL_LOCALMEM1(PackedIntArray, append); + VCALL_LOCALMEM1(PackedIntArray, append_array); + VCALL_LOCALMEM0(PackedIntArray, invert); + + VCALL_LOCALMEM0R(PackedRealArray, size); + VCALL_LOCALMEM0R(PackedRealArray, empty); + VCALL_LOCALMEM2(PackedRealArray, set); + VCALL_LOCALMEM1R(PackedRealArray, get); + VCALL_LOCALMEM1(PackedRealArray, push_back); + VCALL_LOCALMEM1(PackedRealArray, resize); + VCALL_LOCALMEM2R(PackedRealArray, insert); + VCALL_LOCALMEM1(PackedRealArray, remove); + VCALL_LOCALMEM1(PackedRealArray, append); + VCALL_LOCALMEM1(PackedRealArray, append_array); + VCALL_LOCALMEM0(PackedRealArray, invert); + + VCALL_LOCALMEM0R(PackedStringArray, size); + VCALL_LOCALMEM0R(PackedStringArray, empty); + VCALL_LOCALMEM2(PackedStringArray, set); + VCALL_LOCALMEM1R(PackedStringArray, get); + VCALL_LOCALMEM1(PackedStringArray, push_back); + VCALL_LOCALMEM1(PackedStringArray, resize); + VCALL_LOCALMEM2R(PackedStringArray, insert); + VCALL_LOCALMEM1(PackedStringArray, remove); + VCALL_LOCALMEM1(PackedStringArray, append); + VCALL_LOCALMEM1(PackedStringArray, append_array); + VCALL_LOCALMEM0(PackedStringArray, invert); + + VCALL_LOCALMEM0R(PackedVector2Array, size); + VCALL_LOCALMEM0R(PackedVector2Array, empty); + VCALL_LOCALMEM2(PackedVector2Array, set); + VCALL_LOCALMEM1R(PackedVector2Array, get); + VCALL_LOCALMEM1(PackedVector2Array, push_back); + VCALL_LOCALMEM1(PackedVector2Array, resize); + VCALL_LOCALMEM2R(PackedVector2Array, insert); + VCALL_LOCALMEM1(PackedVector2Array, remove); + VCALL_LOCALMEM1(PackedVector2Array, append); + VCALL_LOCALMEM1(PackedVector2Array, append_array); + VCALL_LOCALMEM0(PackedVector2Array, invert); + + VCALL_LOCALMEM0R(PackedVector3Array, size); + VCALL_LOCALMEM0R(PackedVector3Array, empty); + VCALL_LOCALMEM2(PackedVector3Array, set); + VCALL_LOCALMEM1R(PackedVector3Array, get); + VCALL_LOCALMEM1(PackedVector3Array, push_back); + VCALL_LOCALMEM1(PackedVector3Array, resize); + VCALL_LOCALMEM2R(PackedVector3Array, insert); + VCALL_LOCALMEM1(PackedVector3Array, remove); + VCALL_LOCALMEM1(PackedVector3Array, append); + VCALL_LOCALMEM1(PackedVector3Array, append_array); + VCALL_LOCALMEM0(PackedVector3Array, invert); + + VCALL_LOCALMEM0R(PackedColorArray, size); + VCALL_LOCALMEM0R(PackedColorArray, empty); + VCALL_LOCALMEM2(PackedColorArray, set); + VCALL_LOCALMEM1R(PackedColorArray, get); + VCALL_LOCALMEM1(PackedColorArray, push_back); + VCALL_LOCALMEM1(PackedColorArray, resize); + VCALL_LOCALMEM2R(PackedColorArray, insert); + VCALL_LOCALMEM1(PackedColorArray, remove); + VCALL_LOCALMEM1(PackedColorArray, append); + VCALL_LOCALMEM1(PackedColorArray, append_array); + VCALL_LOCALMEM0(PackedColorArray, invert); #define VCALL_PTR0(m_type, m_method) \ static void _call_##m_type##_##m_method(Variant &r_ret, Variant &p_self, const Variant **p_args) { reinterpret_cast<m_type *>(p_self._data._ptr)->m_method(); } @@ -781,7 +778,7 @@ struct _VariantCall { case Variant::VECTOR2: r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform(p_args[0]->operator Vector2()); return; case Variant::RECT2: r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform(p_args[0]->operator Rect2()); return; - case Variant::POOL_VECTOR2_ARRAY: r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform(p_args[0]->operator PoolVector2Array()); return; + case Variant::PACKED_VECTOR2_ARRAY: r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform(p_args[0]->operator PackedVector2Array()); return; default: r_ret = Variant(); } } @@ -792,7 +789,7 @@ struct _VariantCall { case Variant::VECTOR2: r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Vector2()); return; case Variant::RECT2: r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Rect2()); return; - case Variant::POOL_VECTOR2_ARRAY: r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform_inv(p_args[0]->operator PoolVector2Array()); return; + case Variant::PACKED_VECTOR2_ARRAY: r_ret = reinterpret_cast<Transform2D *>(p_self._data._ptr)->xform_inv(p_args[0]->operator PackedVector2Array()); return; default: r_ret = Variant(); } } @@ -850,7 +847,7 @@ struct _VariantCall { case Variant::VECTOR3: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator Vector3()); return; case Variant::PLANE: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator Plane()); return; case Variant::AABB: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator ::AABB()); return; - case Variant::POOL_VECTOR3_ARRAY: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator ::PoolVector3Array()); return; + case Variant::PACKED_VECTOR3_ARRAY: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator ::PackedVector3Array()); return; default: r_ret = Variant(); } } @@ -862,7 +859,7 @@ struct _VariantCall { case Variant::VECTOR3: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Vector3()); return; case Variant::PLANE: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Plane()); return; case Variant::AABB: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator ::AABB()); return; - case Variant::POOL_VECTOR3_ARRAY: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator ::PoolVector3Array()); return; + case Variant::PACKED_VECTOR3_ARRAY: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator ::PackedVector3Array()); return; default: r_ret = Variant(); } } @@ -1172,14 +1169,14 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i case DICTIONARY: return Dictionary(); case ARRAY: return Array(); // 20 - case POOL_BYTE_ARRAY: return PoolByteArray(); - case POOL_INT_ARRAY: return PoolIntArray(); - case POOL_REAL_ARRAY: return PoolRealArray(); - case POOL_STRING_ARRAY: return PoolStringArray(); - case POOL_VECTOR2_ARRAY: - return PoolVector2Array(); // 25 - case POOL_VECTOR3_ARRAY: return PoolVector3Array(); - case POOL_COLOR_ARRAY: return PoolColorArray(); + case PACKED_BYTE_ARRAY: return PackedByteArray(); + case PACKED_INT_ARRAY: return PackedIntArray(); + case PACKED_REAL_ARRAY: return PackedRealArray(); + case PACKED_STRING_ARRAY: return PackedStringArray(); + case PACKED_VECTOR2_ARRAY: + return PackedVector2Array(); // 25 + case PACKED_VECTOR3_ARRAY: return PackedVector3Array(); + case PACKED_COLOR_ARRAY: return PackedColorArray(); default: return Variant(); } @@ -1229,14 +1226,14 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i return p_args[0]->operator Array(); // 20 // arrays - case POOL_BYTE_ARRAY: return (PoolByteArray(*p_args[0])); - case POOL_INT_ARRAY: return (PoolIntArray(*p_args[0])); - case POOL_REAL_ARRAY: return (PoolRealArray(*p_args[0])); - case POOL_STRING_ARRAY: return (PoolStringArray(*p_args[0])); - case POOL_VECTOR2_ARRAY: - return (PoolVector2Array(*p_args[0])); // 25 - case POOL_VECTOR3_ARRAY: return (PoolVector3Array(*p_args[0])); - case POOL_COLOR_ARRAY: return (PoolColorArray(*p_args[0])); + case PACKED_BYTE_ARRAY: return (PackedByteArray(*p_args[0])); + case PACKED_INT_ARRAY: return (PackedIntArray(*p_args[0])); + case PACKED_REAL_ARRAY: return (PackedRealArray(*p_args[0])); + case PACKED_STRING_ARRAY: return (PackedStringArray(*p_args[0])); + case PACKED_VECTOR2_ARRAY: + return (PackedVector2Array(*p_args[0])); // 25 + case PACKED_VECTOR3_ARRAY: return (PackedVector3Array(*p_args[0])); + case PACKED_COLOR_ARRAY: return (PackedColorArray(*p_args[0])); default: return Variant(); } } else if (p_argcount >= 1) { @@ -1543,7 +1540,7 @@ void register_variant_methods() { ADDFUNC1R(STRING, BOOL, String, ends_with, STRING, "text", varray()); ADDFUNC1R(STRING, BOOL, String, is_subsequence_of, STRING, "text", varray()); ADDFUNC1R(STRING, BOOL, String, is_subsequence_ofi, STRING, "text", varray()); - ADDFUNC0R(STRING, POOL_STRING_ARRAY, String, bigrams, varray()); + ADDFUNC0R(STRING, PACKED_STRING_ARRAY, String, bigrams, varray()); ADDFUNC1R(STRING, REAL, String, similarity, STRING, "text", varray()); ADDFUNC2R(STRING, STRING, String, format, NIL, "values", STRING, "placeholder", varray("{_}")); @@ -1552,9 +1549,9 @@ void register_variant_methods() { ADDFUNC1R(STRING, STRING, String, repeat, INT, "count", varray()); ADDFUNC2R(STRING, STRING, String, insert, INT, "position", STRING, "what", varray()); ADDFUNC0R(STRING, STRING, String, capitalize, varray()); - ADDFUNC3R(STRING, POOL_STRING_ARRAY, String, split, STRING, "delimiter", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0)); - ADDFUNC3R(STRING, POOL_STRING_ARRAY, String, rsplit, STRING, "delimiter", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0)); - ADDFUNC2R(STRING, POOL_REAL_ARRAY, String, split_floats, STRING, "delimiter", BOOL, "allow_empty", varray(true)); + ADDFUNC3R(STRING, PACKED_STRING_ARRAY, String, split, STRING, "delimiter", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0)); + ADDFUNC3R(STRING, PACKED_STRING_ARRAY, String, rsplit, STRING, "delimiter", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0)); + ADDFUNC2R(STRING, PACKED_REAL_ARRAY, String, split_floats, STRING, "delimiter", BOOL, "allow_empty", varray(true)); ADDFUNC0R(STRING, STRING, String, to_upper, varray()); ADDFUNC0R(STRING, STRING, String, to_lower, varray()); @@ -1575,9 +1572,9 @@ void register_variant_methods() { ADDFUNC0R(STRING, STRING, String, md5_text, varray()); ADDFUNC0R(STRING, STRING, String, sha1_text, varray()); ADDFUNC0R(STRING, STRING, String, sha256_text, varray()); - ADDFUNC0R(STRING, POOL_BYTE_ARRAY, String, md5_buffer, varray()); - ADDFUNC0R(STRING, POOL_BYTE_ARRAY, String, sha1_buffer, varray()); - ADDFUNC0R(STRING, POOL_BYTE_ARRAY, String, sha256_buffer, varray()); + ADDFUNC0R(STRING, PACKED_BYTE_ARRAY, String, md5_buffer, varray()); + ADDFUNC0R(STRING, PACKED_BYTE_ARRAY, String, sha1_buffer, varray()); + ADDFUNC0R(STRING, PACKED_BYTE_ARRAY, String, sha256_buffer, varray()); ADDFUNC0R(STRING, BOOL, String, empty, varray()); ADDFUNC1R(STRING, STRING, String, humanize_size, INT, "size", varray()); ADDFUNC0R(STRING, BOOL, String, is_abs_path, varray()); @@ -1608,8 +1605,8 @@ void register_variant_methods() { ADDFUNC1R(STRING, STRING, String, trim_prefix, STRING, "prefix", varray()); ADDFUNC1R(STRING, STRING, String, trim_suffix, STRING, "suffix", varray()); - ADDFUNC0R(STRING, POOL_BYTE_ARRAY, String, to_ascii, varray()); - ADDFUNC0R(STRING, POOL_BYTE_ARRAY, String, to_utf8, varray()); + ADDFUNC0R(STRING, PACKED_BYTE_ARRAY, String, to_ascii, varray()); + ADDFUNC0R(STRING, PACKED_BYTE_ARRAY, String, to_utf8, varray()); ADDFUNC0R(VECTOR2, REAL, Vector2, angle, varray()); ADDFUNC1R(VECTOR2, REAL, Vector2, angle_to, VECTOR2, "to", varray()); @@ -1790,90 +1787,89 @@ void register_variant_methods() { ADDFUNC0R(ARRAY, NIL, Array, max, varray()); ADDFUNC0R(ARRAY, NIL, Array, min, varray()); - ADDFUNC0R(POOL_BYTE_ARRAY, INT, PoolByteArray, size, varray()); - ADDFUNC0R(POOL_BYTE_ARRAY, BOOL, PoolByteArray, empty, varray()); - ADDFUNC2(POOL_BYTE_ARRAY, NIL, PoolByteArray, set, INT, "idx", INT, "byte", varray()); - ADDFUNC1(POOL_BYTE_ARRAY, NIL, PoolByteArray, push_back, INT, "byte", varray()); - ADDFUNC1(POOL_BYTE_ARRAY, NIL, PoolByteArray, append, INT, "byte", varray()); - ADDFUNC1(POOL_BYTE_ARRAY, NIL, PoolByteArray, append_array, POOL_BYTE_ARRAY, "array", varray()); - ADDFUNC1(POOL_BYTE_ARRAY, NIL, PoolByteArray, remove, INT, "idx", varray()); - ADDFUNC2R(POOL_BYTE_ARRAY, INT, PoolByteArray, insert, INT, "idx", INT, "byte", varray()); - ADDFUNC1(POOL_BYTE_ARRAY, NIL, PoolByteArray, resize, INT, "idx", varray()); - ADDFUNC0(POOL_BYTE_ARRAY, NIL, PoolByteArray, invert, varray()); - ADDFUNC2R(POOL_BYTE_ARRAY, POOL_BYTE_ARRAY, PoolByteArray, subarray, INT, "from", INT, "to", varray()); - - ADDFUNC0R(POOL_BYTE_ARRAY, STRING, PoolByteArray, get_string_from_ascii, varray()); - ADDFUNC0R(POOL_BYTE_ARRAY, STRING, PoolByteArray, get_string_from_utf8, varray()); - ADDFUNC0R(POOL_BYTE_ARRAY, STRING, PoolByteArray, hex_encode, varray()); - ADDFUNC1R(POOL_BYTE_ARRAY, POOL_BYTE_ARRAY, PoolByteArray, compress, INT, "compression_mode", varray(0)); - ADDFUNC2R(POOL_BYTE_ARRAY, POOL_BYTE_ARRAY, PoolByteArray, decompress, INT, "buffer_size", INT, "compression_mode", varray(0)); - - ADDFUNC0R(POOL_INT_ARRAY, INT, PoolIntArray, size, varray()); - ADDFUNC0R(POOL_INT_ARRAY, BOOL, PoolIntArray, empty, varray()); - ADDFUNC2(POOL_INT_ARRAY, NIL, PoolIntArray, set, INT, "idx", INT, "integer", varray()); - ADDFUNC1(POOL_INT_ARRAY, NIL, PoolIntArray, push_back, INT, "integer", varray()); - ADDFUNC1(POOL_INT_ARRAY, NIL, PoolIntArray, append, INT, "integer", varray()); - ADDFUNC1(POOL_INT_ARRAY, NIL, PoolIntArray, append_array, POOL_INT_ARRAY, "array", varray()); - ADDFUNC1(POOL_INT_ARRAY, NIL, PoolIntArray, remove, INT, "idx", varray()); - ADDFUNC2R(POOL_INT_ARRAY, INT, PoolIntArray, insert, INT, "idx", INT, "integer", varray()); - ADDFUNC1(POOL_INT_ARRAY, NIL, PoolIntArray, resize, INT, "idx", varray()); - ADDFUNC0(POOL_INT_ARRAY, NIL, PoolIntArray, invert, varray()); - - ADDFUNC0R(POOL_REAL_ARRAY, INT, PoolRealArray, size, varray()); - ADDFUNC0R(POOL_REAL_ARRAY, BOOL, PoolRealArray, empty, varray()); - ADDFUNC2(POOL_REAL_ARRAY, NIL, PoolRealArray, set, INT, "idx", REAL, "value", varray()); - ADDFUNC1(POOL_REAL_ARRAY, NIL, PoolRealArray, push_back, REAL, "value", varray()); - ADDFUNC1(POOL_REAL_ARRAY, NIL, PoolRealArray, append, REAL, "value", varray()); - ADDFUNC1(POOL_REAL_ARRAY, NIL, PoolRealArray, append_array, POOL_REAL_ARRAY, "array", varray()); - ADDFUNC1(POOL_REAL_ARRAY, NIL, PoolRealArray, remove, INT, "idx", varray()); - ADDFUNC2R(POOL_REAL_ARRAY, INT, PoolRealArray, insert, INT, "idx", REAL, "value", varray()); - ADDFUNC1(POOL_REAL_ARRAY, NIL, PoolRealArray, resize, INT, "idx", varray()); - ADDFUNC0(POOL_REAL_ARRAY, NIL, PoolRealArray, invert, varray()); - - ADDFUNC0R(POOL_STRING_ARRAY, INT, PoolStringArray, size, varray()); - ADDFUNC0R(POOL_STRING_ARRAY, BOOL, PoolStringArray, empty, varray()); - ADDFUNC2(POOL_STRING_ARRAY, NIL, PoolStringArray, set, INT, "idx", STRING, "string", varray()); - ADDFUNC1(POOL_STRING_ARRAY, NIL, PoolStringArray, push_back, STRING, "string", varray()); - ADDFUNC1(POOL_STRING_ARRAY, NIL, PoolStringArray, append, STRING, "string", varray()); - ADDFUNC1(POOL_STRING_ARRAY, NIL, PoolStringArray, append_array, POOL_STRING_ARRAY, "array", varray()); - ADDFUNC1(POOL_STRING_ARRAY, NIL, PoolStringArray, remove, INT, "idx", varray()); - ADDFUNC2R(POOL_STRING_ARRAY, INT, PoolStringArray, insert, INT, "idx", STRING, "string", varray()); - ADDFUNC1(POOL_STRING_ARRAY, NIL, PoolStringArray, resize, INT, "idx", varray()); - ADDFUNC0(POOL_STRING_ARRAY, NIL, PoolStringArray, invert, varray()); - ADDFUNC1(POOL_STRING_ARRAY, STRING, PoolStringArray, join, STRING, "delimiter", varray()); - - ADDFUNC0R(POOL_VECTOR2_ARRAY, INT, PoolVector2Array, size, varray()); - ADDFUNC0R(POOL_VECTOR2_ARRAY, BOOL, PoolVector2Array, empty, varray()); - ADDFUNC2(POOL_VECTOR2_ARRAY, NIL, PoolVector2Array, set, INT, "idx", VECTOR2, "vector2", varray()); - ADDFUNC1(POOL_VECTOR2_ARRAY, NIL, PoolVector2Array, push_back, VECTOR2, "vector2", varray()); - ADDFUNC1(POOL_VECTOR2_ARRAY, NIL, PoolVector2Array, append, VECTOR2, "vector2", varray()); - ADDFUNC1(POOL_VECTOR2_ARRAY, NIL, PoolVector2Array, append_array, POOL_VECTOR2_ARRAY, "array", varray()); - ADDFUNC1(POOL_VECTOR2_ARRAY, NIL, PoolVector2Array, remove, INT, "idx", varray()); - ADDFUNC2R(POOL_VECTOR2_ARRAY, INT, PoolVector2Array, insert, INT, "idx", VECTOR2, "vector2", varray()); - ADDFUNC1(POOL_VECTOR2_ARRAY, NIL, PoolVector2Array, resize, INT, "idx", varray()); - ADDFUNC0(POOL_VECTOR2_ARRAY, NIL, PoolVector2Array, invert, varray()); - - ADDFUNC0R(POOL_VECTOR3_ARRAY, INT, PoolVector3Array, size, varray()); - ADDFUNC0R(POOL_VECTOR3_ARRAY, BOOL, PoolVector3Array, empty, varray()); - ADDFUNC2(POOL_VECTOR3_ARRAY, NIL, PoolVector3Array, set, INT, "idx", VECTOR3, "vector3", varray()); - ADDFUNC1(POOL_VECTOR3_ARRAY, NIL, PoolVector3Array, push_back, VECTOR3, "vector3", varray()); - ADDFUNC1(POOL_VECTOR3_ARRAY, NIL, PoolVector3Array, append, VECTOR3, "vector3", varray()); - ADDFUNC1(POOL_VECTOR3_ARRAY, NIL, PoolVector3Array, append_array, POOL_VECTOR3_ARRAY, "array", varray()); - ADDFUNC1(POOL_VECTOR3_ARRAY, NIL, PoolVector3Array, remove, INT, "idx", varray()); - ADDFUNC2R(POOL_VECTOR3_ARRAY, INT, PoolVector3Array, insert, INT, "idx", VECTOR3, "vector3", varray()); - ADDFUNC1(POOL_VECTOR3_ARRAY, NIL, PoolVector3Array, resize, INT, "idx", varray()); - ADDFUNC0(POOL_VECTOR3_ARRAY, NIL, PoolVector3Array, invert, varray()); - - ADDFUNC0R(POOL_COLOR_ARRAY, INT, PoolColorArray, size, varray()); - ADDFUNC0R(POOL_COLOR_ARRAY, BOOL, PoolColorArray, empty, varray()); - ADDFUNC2(POOL_COLOR_ARRAY, NIL, PoolColorArray, set, INT, "idx", COLOR, "color", varray()); - ADDFUNC1(POOL_COLOR_ARRAY, NIL, PoolColorArray, push_back, COLOR, "color", varray()); - ADDFUNC1(POOL_COLOR_ARRAY, NIL, PoolColorArray, append, COLOR, "color", varray()); - ADDFUNC1(POOL_COLOR_ARRAY, NIL, PoolColorArray, append_array, POOL_COLOR_ARRAY, "array", varray()); - ADDFUNC1(POOL_COLOR_ARRAY, NIL, PoolColorArray, remove, INT, "idx", varray()); - ADDFUNC2R(POOL_COLOR_ARRAY, INT, PoolColorArray, insert, INT, "idx", COLOR, "color", varray()); - ADDFUNC1(POOL_COLOR_ARRAY, NIL, PoolColorArray, resize, INT, "idx", varray()); - ADDFUNC0(POOL_COLOR_ARRAY, NIL, PoolColorArray, invert, varray()); + ADDFUNC0R(PACKED_BYTE_ARRAY, INT, PackedByteArray, size, varray()); + ADDFUNC0R(PACKED_BYTE_ARRAY, BOOL, PackedByteArray, empty, varray()); + ADDFUNC2(PACKED_BYTE_ARRAY, NIL, PackedByteArray, set, INT, "idx", INT, "byte", varray()); + ADDFUNC1(PACKED_BYTE_ARRAY, NIL, PackedByteArray, push_back, INT, "byte", varray()); + ADDFUNC1(PACKED_BYTE_ARRAY, NIL, PackedByteArray, append, INT, "byte", varray()); + ADDFUNC1(PACKED_BYTE_ARRAY, NIL, PackedByteArray, append_array, PACKED_BYTE_ARRAY, "array", varray()); + ADDFUNC1(PACKED_BYTE_ARRAY, NIL, PackedByteArray, remove, INT, "idx", varray()); + ADDFUNC2R(PACKED_BYTE_ARRAY, INT, PackedByteArray, insert, INT, "idx", INT, "byte", varray()); + ADDFUNC1(PACKED_BYTE_ARRAY, NIL, PackedByteArray, resize, INT, "idx", varray()); + ADDFUNC0(PACKED_BYTE_ARRAY, NIL, PackedByteArray, invert, varray()); + ADDFUNC2R(PACKED_BYTE_ARRAY, PACKED_BYTE_ARRAY, PackedByteArray, subarray, INT, "from", INT, "to", varray()); + + ADDFUNC0R(PACKED_BYTE_ARRAY, STRING, PackedByteArray, get_string_from_ascii, varray()); + ADDFUNC0R(PACKED_BYTE_ARRAY, STRING, PackedByteArray, get_string_from_utf8, varray()); + ADDFUNC0R(PACKED_BYTE_ARRAY, STRING, PackedByteArray, hex_encode, varray()); + ADDFUNC1R(PACKED_BYTE_ARRAY, PACKED_BYTE_ARRAY, PackedByteArray, compress, INT, "compression_mode", varray(0)); + ADDFUNC2R(PACKED_BYTE_ARRAY, PACKED_BYTE_ARRAY, PackedByteArray, decompress, INT, "buffer_size", INT, "compression_mode", varray(0)); + + ADDFUNC0R(PACKED_INT_ARRAY, INT, PackedIntArray, size, varray()); + ADDFUNC0R(PACKED_INT_ARRAY, BOOL, PackedIntArray, empty, varray()); + ADDFUNC2(PACKED_INT_ARRAY, NIL, PackedIntArray, set, INT, "idx", INT, "integer", varray()); + ADDFUNC1(PACKED_INT_ARRAY, NIL, PackedIntArray, push_back, INT, "integer", varray()); + ADDFUNC1(PACKED_INT_ARRAY, NIL, PackedIntArray, append, INT, "integer", varray()); + ADDFUNC1(PACKED_INT_ARRAY, NIL, PackedIntArray, append_array, PACKED_INT_ARRAY, "array", varray()); + ADDFUNC1(PACKED_INT_ARRAY, NIL, PackedIntArray, remove, INT, "idx", varray()); + ADDFUNC2R(PACKED_INT_ARRAY, INT, PackedIntArray, insert, INT, "idx", INT, "integer", varray()); + ADDFUNC1(PACKED_INT_ARRAY, NIL, PackedIntArray, resize, INT, "idx", varray()); + ADDFUNC0(PACKED_INT_ARRAY, NIL, PackedIntArray, invert, varray()); + + ADDFUNC0R(PACKED_REAL_ARRAY, INT, PackedRealArray, size, varray()); + ADDFUNC0R(PACKED_REAL_ARRAY, BOOL, PackedRealArray, empty, varray()); + ADDFUNC2(PACKED_REAL_ARRAY, NIL, PackedRealArray, set, INT, "idx", REAL, "value", varray()); + ADDFUNC1(PACKED_REAL_ARRAY, NIL, PackedRealArray, push_back, REAL, "value", varray()); + ADDFUNC1(PACKED_REAL_ARRAY, NIL, PackedRealArray, append, REAL, "value", varray()); + ADDFUNC1(PACKED_REAL_ARRAY, NIL, PackedRealArray, append_array, PACKED_REAL_ARRAY, "array", varray()); + ADDFUNC1(PACKED_REAL_ARRAY, NIL, PackedRealArray, remove, INT, "idx", varray()); + ADDFUNC2R(PACKED_REAL_ARRAY, INT, PackedRealArray, insert, INT, "idx", REAL, "value", varray()); + ADDFUNC1(PACKED_REAL_ARRAY, NIL, PackedRealArray, resize, INT, "idx", varray()); + ADDFUNC0(PACKED_REAL_ARRAY, NIL, PackedRealArray, invert, varray()); + + ADDFUNC0R(PACKED_STRING_ARRAY, INT, PackedStringArray, size, varray()); + ADDFUNC0R(PACKED_STRING_ARRAY, BOOL, PackedStringArray, empty, varray()); + ADDFUNC2(PACKED_STRING_ARRAY, NIL, PackedStringArray, set, INT, "idx", STRING, "string", varray()); + ADDFUNC1(PACKED_STRING_ARRAY, NIL, PackedStringArray, push_back, STRING, "string", varray()); + ADDFUNC1(PACKED_STRING_ARRAY, NIL, PackedStringArray, append, STRING, "string", varray()); + ADDFUNC1(PACKED_STRING_ARRAY, NIL, PackedStringArray, append_array, PACKED_STRING_ARRAY, "array", varray()); + ADDFUNC1(PACKED_STRING_ARRAY, NIL, PackedStringArray, remove, INT, "idx", varray()); + ADDFUNC2R(PACKED_STRING_ARRAY, INT, PackedStringArray, insert, INT, "idx", STRING, "string", varray()); + ADDFUNC1(PACKED_STRING_ARRAY, NIL, PackedStringArray, resize, INT, "idx", varray()); + ADDFUNC0(PACKED_STRING_ARRAY, NIL, PackedStringArray, invert, varray()); + + ADDFUNC0R(PACKED_VECTOR2_ARRAY, INT, PackedVector2Array, size, varray()); + ADDFUNC0R(PACKED_VECTOR2_ARRAY, BOOL, PackedVector2Array, empty, varray()); + ADDFUNC2(PACKED_VECTOR2_ARRAY, NIL, PackedVector2Array, set, INT, "idx", VECTOR2, "vector2", varray()); + ADDFUNC1(PACKED_VECTOR2_ARRAY, NIL, PackedVector2Array, push_back, VECTOR2, "vector2", varray()); + ADDFUNC1(PACKED_VECTOR2_ARRAY, NIL, PackedVector2Array, append, VECTOR2, "vector2", varray()); + ADDFUNC1(PACKED_VECTOR2_ARRAY, NIL, PackedVector2Array, append_array, PACKED_VECTOR2_ARRAY, "array", varray()); + ADDFUNC1(PACKED_VECTOR2_ARRAY, NIL, PackedVector2Array, remove, INT, "idx", varray()); + ADDFUNC2R(PACKED_VECTOR2_ARRAY, INT, PackedVector2Array, insert, INT, "idx", VECTOR2, "vector2", varray()); + ADDFUNC1(PACKED_VECTOR2_ARRAY, NIL, PackedVector2Array, resize, INT, "idx", varray()); + ADDFUNC0(PACKED_VECTOR2_ARRAY, NIL, PackedVector2Array, invert, varray()); + + ADDFUNC0R(PACKED_VECTOR3_ARRAY, INT, PackedVector3Array, size, varray()); + ADDFUNC0R(PACKED_VECTOR3_ARRAY, BOOL, PackedVector3Array, empty, varray()); + ADDFUNC2(PACKED_VECTOR3_ARRAY, NIL, PackedVector3Array, set, INT, "idx", VECTOR3, "vector3", varray()); + ADDFUNC1(PACKED_VECTOR3_ARRAY, NIL, PackedVector3Array, push_back, VECTOR3, "vector3", varray()); + ADDFUNC1(PACKED_VECTOR3_ARRAY, NIL, PackedVector3Array, append, VECTOR3, "vector3", varray()); + ADDFUNC1(PACKED_VECTOR3_ARRAY, NIL, PackedVector3Array, append_array, PACKED_VECTOR3_ARRAY, "array", varray()); + ADDFUNC1(PACKED_VECTOR3_ARRAY, NIL, PackedVector3Array, remove, INT, "idx", varray()); + ADDFUNC2R(PACKED_VECTOR3_ARRAY, INT, PackedVector3Array, insert, INT, "idx", VECTOR3, "vector3", varray()); + ADDFUNC1(PACKED_VECTOR3_ARRAY, NIL, PackedVector3Array, resize, INT, "idx", varray()); + ADDFUNC0(PACKED_VECTOR3_ARRAY, NIL, PackedVector3Array, invert, varray()); + + ADDFUNC0R(PACKED_COLOR_ARRAY, INT, PackedColorArray, size, varray()); + ADDFUNC0R(PACKED_COLOR_ARRAY, BOOL, PackedColorArray, empty, varray()); + ADDFUNC2(PACKED_COLOR_ARRAY, NIL, PackedColorArray, set, INT, "idx", COLOR, "color", varray()); + ADDFUNC1(PACKED_COLOR_ARRAY, NIL, PackedColorArray, push_back, COLOR, "color", varray()); + ADDFUNC1(PACKED_COLOR_ARRAY, NIL, PackedColorArray, append, COLOR, "color", varray()); + ADDFUNC1(PACKED_COLOR_ARRAY, NIL, PackedColorArray, append_array, PACKED_COLOR_ARRAY, "array", varray()); + ADDFUNC1(PACKED_COLOR_ARRAY, NIL, PackedColorArray, remove, INT, "idx", varray()); + ADDFUNC2R(PACKED_COLOR_ARRAY, INT, PackedColorArray, insert, INT, "idx", COLOR, "color", varray()); + ADDFUNC1(PACKED_COLOR_ARRAY, NIL, PackedColorArray, resize, INT, "idx", varray()); + ADDFUNC0(PACKED_COLOR_ARRAY, NIL, PackedColorArray, invert, varray()); //pointerbased diff --git a/core/variant_op.cpp b/core/variant_op.cpp index c7a52b0347..566c87dac1 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -38,33 +38,33 @@ CASE_TYPE(PREFIX, OP, INT) \ CASE_TYPE_ALL_BUT_INT(PREFIX, OP) -#define CASE_TYPE_ALL_BUT_INT(PREFIX, OP) \ - CASE_TYPE(PREFIX, OP, NIL) \ - CASE_TYPE(PREFIX, OP, BOOL) \ - CASE_TYPE(PREFIX, OP, REAL) \ - CASE_TYPE(PREFIX, OP, STRING) \ - CASE_TYPE(PREFIX, OP, VECTOR2) \ - CASE_TYPE(PREFIX, OP, RECT2) \ - CASE_TYPE(PREFIX, OP, VECTOR3) \ - CASE_TYPE(PREFIX, OP, TRANSFORM2D) \ - CASE_TYPE(PREFIX, OP, PLANE) \ - CASE_TYPE(PREFIX, OP, QUAT) \ - CASE_TYPE(PREFIX, OP, AABB) \ - CASE_TYPE(PREFIX, OP, BASIS) \ - CASE_TYPE(PREFIX, OP, TRANSFORM) \ - CASE_TYPE(PREFIX, OP, COLOR) \ - CASE_TYPE(PREFIX, OP, NODE_PATH) \ - CASE_TYPE(PREFIX, OP, _RID) \ - CASE_TYPE(PREFIX, OP, OBJECT) \ - CASE_TYPE(PREFIX, OP, DICTIONARY) \ - CASE_TYPE(PREFIX, OP, ARRAY) \ - CASE_TYPE(PREFIX, OP, POOL_BYTE_ARRAY) \ - CASE_TYPE(PREFIX, OP, POOL_INT_ARRAY) \ - CASE_TYPE(PREFIX, OP, POOL_REAL_ARRAY) \ - CASE_TYPE(PREFIX, OP, POOL_STRING_ARRAY) \ - CASE_TYPE(PREFIX, OP, POOL_VECTOR2_ARRAY) \ - CASE_TYPE(PREFIX, OP, POOL_VECTOR3_ARRAY) \ - CASE_TYPE(PREFIX, OP, POOL_COLOR_ARRAY) +#define CASE_TYPE_ALL_BUT_INT(PREFIX, OP) \ + CASE_TYPE(PREFIX, OP, NIL) \ + CASE_TYPE(PREFIX, OP, BOOL) \ + CASE_TYPE(PREFIX, OP, REAL) \ + CASE_TYPE(PREFIX, OP, STRING) \ + CASE_TYPE(PREFIX, OP, VECTOR2) \ + CASE_TYPE(PREFIX, OP, RECT2) \ + CASE_TYPE(PREFIX, OP, VECTOR3) \ + CASE_TYPE(PREFIX, OP, TRANSFORM2D) \ + CASE_TYPE(PREFIX, OP, PLANE) \ + CASE_TYPE(PREFIX, OP, QUAT) \ + CASE_TYPE(PREFIX, OP, AABB) \ + CASE_TYPE(PREFIX, OP, BASIS) \ + CASE_TYPE(PREFIX, OP, TRANSFORM) \ + CASE_TYPE(PREFIX, OP, COLOR) \ + CASE_TYPE(PREFIX, OP, NODE_PATH) \ + CASE_TYPE(PREFIX, OP, _RID) \ + CASE_TYPE(PREFIX, OP, OBJECT) \ + CASE_TYPE(PREFIX, OP, DICTIONARY) \ + CASE_TYPE(PREFIX, OP, ARRAY) \ + CASE_TYPE(PREFIX, OP, PACKED_BYTE_ARRAY) \ + CASE_TYPE(PREFIX, OP, PACKED_INT_ARRAY) \ + CASE_TYPE(PREFIX, OP, PACKED_REAL_ARRAY) \ + CASE_TYPE(PREFIX, OP, PACKED_STRING_ARRAY) \ + CASE_TYPE(PREFIX, OP, PACKED_VECTOR2_ARRAY) \ + CASE_TYPE(PREFIX, OP, PACKED_VECTOR3_ARRAY) \ + CASE_TYPE(PREFIX, OP, PACKED_COLOR_ARRAY) #ifdef __GNUC__ #define TYPE(PREFIX, OP, TYPE) &&PREFIX##_##OP##_##TYPE @@ -91,13 +91,13 @@ TYPE(PREFIX, OP, OBJECT), \ TYPE(PREFIX, OP, DICTIONARY), \ TYPE(PREFIX, OP, ARRAY), \ - TYPE(PREFIX, OP, POOL_BYTE_ARRAY), \ - TYPE(PREFIX, OP, POOL_INT_ARRAY), \ - TYPE(PREFIX, OP, POOL_REAL_ARRAY), \ - TYPE(PREFIX, OP, POOL_STRING_ARRAY), \ - TYPE(PREFIX, OP, POOL_VECTOR2_ARRAY), \ - TYPE(PREFIX, OP, POOL_VECTOR3_ARRAY), \ - TYPE(PREFIX, OP, POOL_COLOR_ARRAY), \ + TYPE(PREFIX, OP, PACKED_BYTE_ARRAY), \ + TYPE(PREFIX, OP, PACKED_INT_ARRAY), \ + TYPE(PREFIX, OP, PACKED_REAL_ARRAY), \ + TYPE(PREFIX, OP, PACKED_STRING_ARRAY), \ + TYPE(PREFIX, OP, PACKED_VECTOR2_ARRAY), \ + TYPE(PREFIX, OP, PACKED_VECTOR3_ARRAY), \ + TYPE(PREFIX, OP, PACKED_COLOR_ARRAY), \ } /* clang-format on */ @@ -357,16 +357,16 @@ bool Variant::booleanize() const { if (p_a.type != p_b.type) \ _RETURN_FAIL \ \ - const PoolVector<m_type> &array_a = *reinterpret_cast<const PoolVector<m_type> *>(p_a._data._mem); \ - const PoolVector<m_type> &array_b = *reinterpret_cast<const PoolVector<m_type> *>(p_b._data._mem); \ + const Vector<m_type> &array_a = *reinterpret_cast<const Vector<m_type> *>(p_a._data._mem); \ + const Vector<m_type> &array_b = *reinterpret_cast<const Vector<m_type> *>(p_b._data._mem); \ \ int a_len = array_a.size(); \ if (a_len m_opa array_b.size()) { \ _RETURN(m_ret_s); \ } else { \ \ - PoolVector<m_type>::Read ra = array_a.read(); \ - PoolVector<m_type>::Read rb = array_b.read(); \ + const m_type *ra = array_a.ptr(); \ + const m_type *rb = array_b.ptr(); \ \ for (int i = 0; i < a_len; i++) { \ if (ra[i] m_opb rb[i]) \ @@ -376,16 +376,16 @@ bool Variant::booleanize() const { _RETURN(m_ret_def); \ } -#define DEFAULT_OP_ARRAY_ADD(m_prefix, m_op_name, m_name, m_type) \ - CASE_TYPE(m_prefix, m_op_name, m_name) { \ - if (p_a.type != p_b.type) \ - _RETURN_FAIL; \ - \ - const PoolVector<m_type> &array_a = *reinterpret_cast<const PoolVector<m_type> *>(p_a._data._mem); \ - const PoolVector<m_type> &array_b = *reinterpret_cast<const PoolVector<m_type> *>(p_b._data._mem); \ - PoolVector<m_type> sum = array_a; \ - sum.append_array(array_b); \ - _RETURN(sum); \ +#define DEFAULT_OP_ARRAY_ADD(m_prefix, m_op_name, m_name, m_type) \ + CASE_TYPE(m_prefix, m_op_name, m_name) { \ + if (p_a.type != p_b.type) \ + _RETURN_FAIL; \ + \ + const Vector<m_type> &array_a = *reinterpret_cast<const Vector<m_type> *>(p_a._data._mem); \ + const Vector<m_type> &array_b = *reinterpret_cast<const Vector<m_type> *>(p_b._data._mem); \ + Vector<m_type> sum = array_a; \ + sum.append_array(array_b); \ + _RETURN(sum); \ } void Variant::evaluate(const Operator &p_op, const Variant &p_a, @@ -473,13 +473,13 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_STR_NULL(math, OP_EQUAL, NODE_PATH, ==, NodePath); DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, _RID, ==, RID); - DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_BYTE_ARRAY, uint8_t); - DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_INT_ARRAY, int); - DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_REAL_ARRAY, real_t); - DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_STRING_ARRAY, String); - DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_VECTOR2_ARRAY, Vector2); - DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_VECTOR3_ARRAY, Vector3); - DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, POOL_COLOR_ARRAY, Color); + DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, PACKED_BYTE_ARRAY, uint8_t); + DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, PACKED_INT_ARRAY, int); + DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, PACKED_REAL_ARRAY, real_t); + DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, PACKED_STRING_ARRAY, String); + DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, PACKED_VECTOR2_ARRAY, Vector2); + DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, PACKED_VECTOR3_ARRAY, Vector3); + DEFAULT_OP_ARRAY_EQ(math, OP_EQUAL, PACKED_COLOR_ARRAY, Color); } SWITCH_OP(math, OP_NOT_EQUAL, p_a.type) { @@ -563,13 +563,13 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_STR_NULL(math, OP_NOT_EQUAL, NODE_PATH, !=, NodePath); DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, _RID, !=, RID); - DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_BYTE_ARRAY, uint8_t); - DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_INT_ARRAY, int); - DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_REAL_ARRAY, real_t); - DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_STRING_ARRAY, String); - DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_VECTOR2_ARRAY, Vector2); - DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_VECTOR3_ARRAY, Vector3); - DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_COLOR_ARRAY, Color); + DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, PACKED_BYTE_ARRAY, uint8_t); + DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, PACKED_INT_ARRAY, int); + DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, PACKED_REAL_ARRAY, real_t); + DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, PACKED_STRING_ARRAY, String); + DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, PACKED_VECTOR2_ARRAY, Vector2); + DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, PACKED_VECTOR3_ARRAY, Vector3); + DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, PACKED_COLOR_ARRAY, Color); } SWITCH_OP(math, OP_LESS, p_a.type) { @@ -617,13 +617,13 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_LOCALMEM(math, OP_LESS, VECTOR2, <, Vector2); DEFAULT_OP_LOCALMEM(math, OP_LESS, VECTOR3, <, Vector3); DEFAULT_OP_LOCALMEM(math, OP_LESS, _RID, <, RID); - DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_BYTE_ARRAY, uint8_t); - DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_INT_ARRAY, int); - DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_REAL_ARRAY, real_t); - DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_STRING_ARRAY, String); - DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_VECTOR2_ARRAY, Vector3); - DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_VECTOR3_ARRAY, Vector3); - DEFAULT_OP_ARRAY_LT(math, OP_LESS, POOL_COLOR_ARRAY, Color); + DEFAULT_OP_ARRAY_LT(math, OP_LESS, PACKED_BYTE_ARRAY, uint8_t); + DEFAULT_OP_ARRAY_LT(math, OP_LESS, PACKED_INT_ARRAY, int); + DEFAULT_OP_ARRAY_LT(math, OP_LESS, PACKED_REAL_ARRAY, real_t); + DEFAULT_OP_ARRAY_LT(math, OP_LESS, PACKED_STRING_ARRAY, String); + DEFAULT_OP_ARRAY_LT(math, OP_LESS, PACKED_VECTOR2_ARRAY, Vector3); + DEFAULT_OP_ARRAY_LT(math, OP_LESS, PACKED_VECTOR3_ARRAY, Vector3); + DEFAULT_OP_ARRAY_LT(math, OP_LESS, PACKED_COLOR_ARRAY, Color); CASE_TYPE(math, OP_LESS, NIL) CASE_TYPE(math, OP_LESS, RECT2) @@ -666,13 +666,13 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_LESS_EQUAL, NODE_PATH) CASE_TYPE(math, OP_LESS_EQUAL, DICTIONARY) CASE_TYPE(math, OP_LESS_EQUAL, ARRAY) - CASE_TYPE(math, OP_LESS_EQUAL, POOL_BYTE_ARRAY); - CASE_TYPE(math, OP_LESS_EQUAL, POOL_INT_ARRAY); - CASE_TYPE(math, OP_LESS_EQUAL, POOL_REAL_ARRAY); - CASE_TYPE(math, OP_LESS_EQUAL, POOL_STRING_ARRAY); - CASE_TYPE(math, OP_LESS_EQUAL, POOL_VECTOR2_ARRAY); - CASE_TYPE(math, OP_LESS_EQUAL, POOL_VECTOR3_ARRAY); - CASE_TYPE(math, OP_LESS_EQUAL, POOL_COLOR_ARRAY); + CASE_TYPE(math, OP_LESS_EQUAL, PACKED_BYTE_ARRAY); + CASE_TYPE(math, OP_LESS_EQUAL, PACKED_INT_ARRAY); + CASE_TYPE(math, OP_LESS_EQUAL, PACKED_REAL_ARRAY); + CASE_TYPE(math, OP_LESS_EQUAL, PACKED_STRING_ARRAY); + CASE_TYPE(math, OP_LESS_EQUAL, PACKED_VECTOR2_ARRAY); + CASE_TYPE(math, OP_LESS_EQUAL, PACKED_VECTOR3_ARRAY); + CASE_TYPE(math, OP_LESS_EQUAL, PACKED_COLOR_ARRAY); _RETURN_FAIL; } @@ -721,13 +721,13 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER, VECTOR2, <, Vector2); DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER, VECTOR3, <, Vector3); DEFAULT_OP_LOCALMEM_REV(math, OP_GREATER, _RID, <, RID); - DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_BYTE_ARRAY, uint8_t); - DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_INT_ARRAY, int); - DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_REAL_ARRAY, real_t); - DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_STRING_ARRAY, String); - DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_VECTOR2_ARRAY, Vector3); - DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_VECTOR3_ARRAY, Vector3); - DEFAULT_OP_ARRAY_GT(math, OP_GREATER, POOL_COLOR_ARRAY, Color); + DEFAULT_OP_ARRAY_GT(math, OP_GREATER, PACKED_BYTE_ARRAY, uint8_t); + DEFAULT_OP_ARRAY_GT(math, OP_GREATER, PACKED_INT_ARRAY, int); + DEFAULT_OP_ARRAY_GT(math, OP_GREATER, PACKED_REAL_ARRAY, real_t); + DEFAULT_OP_ARRAY_GT(math, OP_GREATER, PACKED_STRING_ARRAY, String); + DEFAULT_OP_ARRAY_GT(math, OP_GREATER, PACKED_VECTOR2_ARRAY, Vector3); + DEFAULT_OP_ARRAY_GT(math, OP_GREATER, PACKED_VECTOR3_ARRAY, Vector3); + DEFAULT_OP_ARRAY_GT(math, OP_GREATER, PACKED_COLOR_ARRAY, Color); CASE_TYPE(math, OP_GREATER, NIL) CASE_TYPE(math, OP_GREATER, RECT2) @@ -770,13 +770,13 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_GREATER_EQUAL, NODE_PATH) CASE_TYPE(math, OP_GREATER_EQUAL, DICTIONARY) CASE_TYPE(math, OP_GREATER_EQUAL, ARRAY) - CASE_TYPE(math, OP_GREATER_EQUAL, POOL_BYTE_ARRAY); - CASE_TYPE(math, OP_GREATER_EQUAL, POOL_INT_ARRAY); - CASE_TYPE(math, OP_GREATER_EQUAL, POOL_REAL_ARRAY); - CASE_TYPE(math, OP_GREATER_EQUAL, POOL_STRING_ARRAY); - CASE_TYPE(math, OP_GREATER_EQUAL, POOL_VECTOR2_ARRAY); - CASE_TYPE(math, OP_GREATER_EQUAL, POOL_VECTOR3_ARRAY); - CASE_TYPE(math, OP_GREATER_EQUAL, POOL_COLOR_ARRAY); + CASE_TYPE(math, OP_GREATER_EQUAL, PACKED_BYTE_ARRAY); + CASE_TYPE(math, OP_GREATER_EQUAL, PACKED_INT_ARRAY); + CASE_TYPE(math, OP_GREATER_EQUAL, PACKED_REAL_ARRAY); + CASE_TYPE(math, OP_GREATER_EQUAL, PACKED_STRING_ARRAY); + CASE_TYPE(math, OP_GREATER_EQUAL, PACKED_VECTOR2_ARRAY); + CASE_TYPE(math, OP_GREATER_EQUAL, PACKED_VECTOR3_ARRAY); + CASE_TYPE(math, OP_GREATER_EQUAL, PACKED_COLOR_ARRAY); _RETURN_FAIL; } @@ -806,13 +806,13 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_LOCALMEM(math, OP_ADD, QUAT, +, Quat); DEFAULT_OP_LOCALMEM(math, OP_ADD, COLOR, +, Color); - DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_BYTE_ARRAY, uint8_t); - DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_INT_ARRAY, int); - DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_REAL_ARRAY, real_t); - DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_STRING_ARRAY, String); - DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_VECTOR2_ARRAY, Vector2); - DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_VECTOR3_ARRAY, Vector3); - DEFAULT_OP_ARRAY_ADD(math, OP_ADD, POOL_COLOR_ARRAY, Color); + DEFAULT_OP_ARRAY_ADD(math, OP_ADD, PACKED_BYTE_ARRAY, uint8_t); + DEFAULT_OP_ARRAY_ADD(math, OP_ADD, PACKED_INT_ARRAY, int); + DEFAULT_OP_ARRAY_ADD(math, OP_ADD, PACKED_REAL_ARRAY, real_t); + DEFAULT_OP_ARRAY_ADD(math, OP_ADD, PACKED_STRING_ARRAY, String); + DEFAULT_OP_ARRAY_ADD(math, OP_ADD, PACKED_VECTOR2_ARRAY, Vector2); + DEFAULT_OP_ARRAY_ADD(math, OP_ADD, PACKED_VECTOR3_ARRAY, Vector3); + DEFAULT_OP_ARRAY_ADD(math, OP_ADD, PACKED_COLOR_ARRAY, Color); CASE_TYPE(math, OP_ADD, NIL) CASE_TYPE(math, OP_ADD, BOOL) @@ -851,13 +851,13 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_SUBTRACT, OBJECT) CASE_TYPE(math, OP_SUBTRACT, DICTIONARY) CASE_TYPE(math, OP_SUBTRACT, ARRAY) - CASE_TYPE(math, OP_SUBTRACT, POOL_BYTE_ARRAY); - CASE_TYPE(math, OP_SUBTRACT, POOL_INT_ARRAY); - CASE_TYPE(math, OP_SUBTRACT, POOL_REAL_ARRAY); - CASE_TYPE(math, OP_SUBTRACT, POOL_STRING_ARRAY); - CASE_TYPE(math, OP_SUBTRACT, POOL_VECTOR2_ARRAY); - CASE_TYPE(math, OP_SUBTRACT, POOL_VECTOR3_ARRAY); - CASE_TYPE(math, OP_SUBTRACT, POOL_COLOR_ARRAY); + CASE_TYPE(math, OP_SUBTRACT, PACKED_BYTE_ARRAY); + CASE_TYPE(math, OP_SUBTRACT, PACKED_INT_ARRAY); + CASE_TYPE(math, OP_SUBTRACT, PACKED_REAL_ARRAY); + CASE_TYPE(math, OP_SUBTRACT, PACKED_STRING_ARRAY); + CASE_TYPE(math, OP_SUBTRACT, PACKED_VECTOR2_ARRAY); + CASE_TYPE(math, OP_SUBTRACT, PACKED_VECTOR3_ARRAY); + CASE_TYPE(math, OP_SUBTRACT, PACKED_COLOR_ARRAY); _RETURN_FAIL; } @@ -930,13 +930,13 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_MULTIPLY, OBJECT) CASE_TYPE(math, OP_MULTIPLY, DICTIONARY) CASE_TYPE(math, OP_MULTIPLY, ARRAY) - CASE_TYPE(math, OP_MULTIPLY, POOL_BYTE_ARRAY); - CASE_TYPE(math, OP_MULTIPLY, POOL_INT_ARRAY); - CASE_TYPE(math, OP_MULTIPLY, POOL_REAL_ARRAY); - CASE_TYPE(math, OP_MULTIPLY, POOL_STRING_ARRAY); - CASE_TYPE(math, OP_MULTIPLY, POOL_VECTOR2_ARRAY); - CASE_TYPE(math, OP_MULTIPLY, POOL_VECTOR3_ARRAY); - CASE_TYPE(math, OP_MULTIPLY, POOL_COLOR_ARRAY); + CASE_TYPE(math, OP_MULTIPLY, PACKED_BYTE_ARRAY); + CASE_TYPE(math, OP_MULTIPLY, PACKED_INT_ARRAY); + CASE_TYPE(math, OP_MULTIPLY, PACKED_REAL_ARRAY); + CASE_TYPE(math, OP_MULTIPLY, PACKED_STRING_ARRAY); + CASE_TYPE(math, OP_MULTIPLY, PACKED_VECTOR2_ARRAY); + CASE_TYPE(math, OP_MULTIPLY, PACKED_VECTOR3_ARRAY); + CASE_TYPE(math, OP_MULTIPLY, PACKED_COLOR_ARRAY); _RETURN_FAIL; } @@ -973,13 +973,13 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_DIVIDE, OBJECT) CASE_TYPE(math, OP_DIVIDE, DICTIONARY) CASE_TYPE(math, OP_DIVIDE, ARRAY) - CASE_TYPE(math, OP_DIVIDE, POOL_BYTE_ARRAY); - CASE_TYPE(math, OP_DIVIDE, POOL_INT_ARRAY); - CASE_TYPE(math, OP_DIVIDE, POOL_REAL_ARRAY); - CASE_TYPE(math, OP_DIVIDE, POOL_STRING_ARRAY); - CASE_TYPE(math, OP_DIVIDE, POOL_VECTOR2_ARRAY); - CASE_TYPE(math, OP_DIVIDE, POOL_VECTOR3_ARRAY); - CASE_TYPE(math, OP_DIVIDE, POOL_COLOR_ARRAY); + CASE_TYPE(math, OP_DIVIDE, PACKED_BYTE_ARRAY); + CASE_TYPE(math, OP_DIVIDE, PACKED_INT_ARRAY); + CASE_TYPE(math, OP_DIVIDE, PACKED_REAL_ARRAY); + CASE_TYPE(math, OP_DIVIDE, PACKED_STRING_ARRAY); + CASE_TYPE(math, OP_DIVIDE, PACKED_VECTOR2_ARRAY); + CASE_TYPE(math, OP_DIVIDE, PACKED_VECTOR3_ARRAY); + CASE_TYPE(math, OP_DIVIDE, PACKED_COLOR_ARRAY); _RETURN_FAIL; } @@ -1005,13 +1005,13 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_POSITIVE, OBJECT) CASE_TYPE(math, OP_POSITIVE, DICTIONARY) CASE_TYPE(math, OP_POSITIVE, ARRAY) - CASE_TYPE(math, OP_POSITIVE, POOL_BYTE_ARRAY) - CASE_TYPE(math, OP_POSITIVE, POOL_INT_ARRAY) - CASE_TYPE(math, OP_POSITIVE, POOL_REAL_ARRAY) - CASE_TYPE(math, OP_POSITIVE, POOL_STRING_ARRAY) - CASE_TYPE(math, OP_POSITIVE, POOL_VECTOR2_ARRAY) - CASE_TYPE(math, OP_POSITIVE, POOL_VECTOR3_ARRAY) - CASE_TYPE(math, OP_POSITIVE, POOL_COLOR_ARRAY) + CASE_TYPE(math, OP_POSITIVE, PACKED_BYTE_ARRAY) + CASE_TYPE(math, OP_POSITIVE, PACKED_INT_ARRAY) + CASE_TYPE(math, OP_POSITIVE, PACKED_REAL_ARRAY) + CASE_TYPE(math, OP_POSITIVE, PACKED_STRING_ARRAY) + CASE_TYPE(math, OP_POSITIVE, PACKED_VECTOR2_ARRAY) + CASE_TYPE(math, OP_POSITIVE, PACKED_VECTOR3_ARRAY) + CASE_TYPE(math, OP_POSITIVE, PACKED_COLOR_ARRAY) _RETURN_FAIL; } @@ -1038,13 +1038,13 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_NEGATE, OBJECT) CASE_TYPE(math, OP_NEGATE, DICTIONARY) CASE_TYPE(math, OP_NEGATE, ARRAY) - CASE_TYPE(math, OP_NEGATE, POOL_BYTE_ARRAY) - CASE_TYPE(math, OP_NEGATE, POOL_INT_ARRAY) - CASE_TYPE(math, OP_NEGATE, POOL_REAL_ARRAY) - CASE_TYPE(math, OP_NEGATE, POOL_STRING_ARRAY) - CASE_TYPE(math, OP_NEGATE, POOL_VECTOR2_ARRAY) - CASE_TYPE(math, OP_NEGATE, POOL_VECTOR3_ARRAY) - CASE_TYPE(math, OP_NEGATE, POOL_COLOR_ARRAY) + CASE_TYPE(math, OP_NEGATE, PACKED_BYTE_ARRAY) + CASE_TYPE(math, OP_NEGATE, PACKED_INT_ARRAY) + CASE_TYPE(math, OP_NEGATE, PACKED_REAL_ARRAY) + CASE_TYPE(math, OP_NEGATE, PACKED_STRING_ARRAY) + CASE_TYPE(math, OP_NEGATE, PACKED_VECTOR2_ARRAY) + CASE_TYPE(math, OP_NEGATE, PACKED_VECTOR3_ARRAY) + CASE_TYPE(math, OP_NEGATE, PACKED_COLOR_ARRAY) _RETURN_FAIL; } @@ -1098,13 +1098,13 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_MODULE, OBJECT) CASE_TYPE(math, OP_MODULE, DICTIONARY) CASE_TYPE(math, OP_MODULE, ARRAY) - CASE_TYPE(math, OP_MODULE, POOL_BYTE_ARRAY) - CASE_TYPE(math, OP_MODULE, POOL_INT_ARRAY) - CASE_TYPE(math, OP_MODULE, POOL_REAL_ARRAY) - CASE_TYPE(math, OP_MODULE, POOL_STRING_ARRAY) - CASE_TYPE(math, OP_MODULE, POOL_VECTOR2_ARRAY) - CASE_TYPE(math, OP_MODULE, POOL_VECTOR3_ARRAY) - CASE_TYPE(math, OP_MODULE, POOL_COLOR_ARRAY) + CASE_TYPE(math, OP_MODULE, PACKED_BYTE_ARRAY) + CASE_TYPE(math, OP_MODULE, PACKED_INT_ARRAY) + CASE_TYPE(math, OP_MODULE, PACKED_REAL_ARRAY) + CASE_TYPE(math, OP_MODULE, PACKED_STRING_ARRAY) + CASE_TYPE(math, OP_MODULE, PACKED_VECTOR2_ARRAY) + CASE_TYPE(math, OP_MODULE, PACKED_VECTOR3_ARRAY) + CASE_TYPE(math, OP_MODULE, PACKED_COLOR_ARRAY) _RETURN_FAIL; } @@ -1725,10 +1725,10 @@ Variant Variant::get_named(const StringName &p_index, bool *r_valid) const { } break; #define DEFAULT_OP_DVECTOR_SET(m_name, dv_type, skip_cond) \ - DEFAULT_OP_ARRAY_CMD(m_name, PoolVector<dv_type>, if (skip_cond) return;, arr->set(index, p_value); return ) + DEFAULT_OP_ARRAY_CMD(m_name, Vector<dv_type>, if (skip_cond) return;, arr->set(index, p_value); return ) #define DEFAULT_OP_DVECTOR_GET(m_name, dv_type) \ - DEFAULT_OP_ARRAY_CMD(m_name, const PoolVector<dv_type>, ;, return arr->get(index)) + DEFAULT_OP_ARRAY_CMD(m_name, const Vector<dv_type>, ;, return arr->get(index)) void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) { @@ -2197,13 +2197,13 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) return; } break; DEFAULT_OP_ARRAY_CMD(ARRAY, Array, ;, (*arr)[index] = p_value; return ) // 20 - DEFAULT_OP_DVECTOR_SET(POOL_BYTE_ARRAY, uint8_t, p_value.type != Variant::REAL && p_value.type != Variant::INT) - DEFAULT_OP_DVECTOR_SET(POOL_INT_ARRAY, int, p_value.type != Variant::REAL && p_value.type != Variant::INT) - DEFAULT_OP_DVECTOR_SET(POOL_REAL_ARRAY, real_t, p_value.type != Variant::REAL && p_value.type != Variant::INT) - DEFAULT_OP_DVECTOR_SET(POOL_STRING_ARRAY, String, p_value.type != Variant::STRING) - DEFAULT_OP_DVECTOR_SET(POOL_VECTOR2_ARRAY, Vector2, p_value.type != Variant::VECTOR2) // 25 - DEFAULT_OP_DVECTOR_SET(POOL_VECTOR3_ARRAY, Vector3, p_value.type != Variant::VECTOR3) - DEFAULT_OP_DVECTOR_SET(POOL_COLOR_ARRAY, Color, p_value.type != Variant::COLOR) + DEFAULT_OP_DVECTOR_SET(PACKED_BYTE_ARRAY, uint8_t, p_value.type != Variant::REAL && p_value.type != Variant::INT) + DEFAULT_OP_DVECTOR_SET(PACKED_INT_ARRAY, int, p_value.type != Variant::REAL && p_value.type != Variant::INT) + DEFAULT_OP_DVECTOR_SET(PACKED_REAL_ARRAY, real_t, p_value.type != Variant::REAL && p_value.type != Variant::INT) + DEFAULT_OP_DVECTOR_SET(PACKED_STRING_ARRAY, String, p_value.type != Variant::STRING) + DEFAULT_OP_DVECTOR_SET(PACKED_VECTOR2_ARRAY, Vector2, p_value.type != Variant::VECTOR2) // 25 + DEFAULT_OP_DVECTOR_SET(PACKED_VECTOR3_ARRAY, Vector3, p_value.type != Variant::VECTOR3) + DEFAULT_OP_DVECTOR_SET(PACKED_COLOR_ARRAY, Color, p_value.type != Variant::COLOR) default: return; } @@ -2569,13 +2569,13 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const { } } break; DEFAULT_OP_ARRAY_CMD(ARRAY, const Array, ;, return (*arr)[index]) // 20 - DEFAULT_OP_DVECTOR_GET(POOL_BYTE_ARRAY, uint8_t) - DEFAULT_OP_DVECTOR_GET(POOL_INT_ARRAY, int) - DEFAULT_OP_DVECTOR_GET(POOL_REAL_ARRAY, real_t) - DEFAULT_OP_DVECTOR_GET(POOL_STRING_ARRAY, String) - DEFAULT_OP_DVECTOR_GET(POOL_VECTOR2_ARRAY, Vector2) // 25 - DEFAULT_OP_DVECTOR_GET(POOL_VECTOR3_ARRAY, Vector3) - DEFAULT_OP_DVECTOR_GET(POOL_COLOR_ARRAY, Color) + DEFAULT_OP_DVECTOR_GET(PACKED_BYTE_ARRAY, uint8_t) + DEFAULT_OP_DVECTOR_GET(PACKED_INT_ARRAY, int) + DEFAULT_OP_DVECTOR_GET(PACKED_REAL_ARRAY, real_t) + DEFAULT_OP_DVECTOR_GET(PACKED_STRING_ARRAY, String) + DEFAULT_OP_DVECTOR_GET(PACKED_VECTOR2_ARRAY, Vector2) // 25 + DEFAULT_OP_DVECTOR_GET(PACKED_VECTOR3_ARRAY, Vector3) + DEFAULT_OP_DVECTOR_GET(PACKED_COLOR_ARRAY, Color) default: return Variant(); } @@ -2651,14 +2651,14 @@ bool Variant::in(const Variant &p_index, bool *r_valid) const { return false; } break; - case POOL_BYTE_ARRAY: { + case PACKED_BYTE_ARRAY: { if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::REAL) { int index = p_index; - const PoolVector<uint8_t> *arr = reinterpret_cast<const PoolVector<uint8_t> *>(_data._mem); + const Vector<uint8_t> *arr = reinterpret_cast<const Vector<uint8_t> *>(_data._mem); int l = arr->size(); if (l) { - PoolVector<uint8_t>::Read r = arr->read(); + const uint8_t *r = arr->ptr(); for (int i = 0; i < l; i++) { if (r[i] == index) return true; @@ -2669,14 +2669,14 @@ bool Variant::in(const Variant &p_index, bool *r_valid) const { } } break; - case POOL_INT_ARRAY: { + case PACKED_INT_ARRAY: { if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::REAL) { int index = p_index; - const PoolVector<int> *arr = reinterpret_cast<const PoolVector<int> *>(_data._mem); + const Vector<int> *arr = reinterpret_cast<const Vector<int> *>(_data._mem); int l = arr->size(); if (l) { - PoolVector<int>::Read r = arr->read(); + const int *r = arr->ptr(); for (int i = 0; i < l; i++) { if (r[i] == index) return true; @@ -2686,15 +2686,15 @@ bool Variant::in(const Variant &p_index, bool *r_valid) const { return false; } } break; - case POOL_REAL_ARRAY: { + case PACKED_REAL_ARRAY: { if (p_index.get_type() == Variant::INT || p_index.get_type() == Variant::REAL) { real_t index = p_index; - const PoolVector<real_t> *arr = reinterpret_cast<const PoolVector<real_t> *>(_data._mem); + const Vector<real_t> *arr = reinterpret_cast<const Vector<real_t> *>(_data._mem); int l = arr->size(); if (l) { - PoolVector<real_t>::Read r = arr->read(); + const real_t *r = arr->ptr(); for (int i = 0; i < l; i++) { if (r[i] == index) return true; @@ -2705,15 +2705,15 @@ bool Variant::in(const Variant &p_index, bool *r_valid) const { } } break; - case POOL_STRING_ARRAY: { + case PACKED_STRING_ARRAY: { if (p_index.get_type() == Variant::STRING) { String index = p_index; - const PoolVector<String> *arr = reinterpret_cast<const PoolVector<String> *>(_data._mem); + const Vector<String> *arr = reinterpret_cast<const Vector<String> *>(_data._mem); int l = arr->size(); if (l) { - PoolVector<String>::Read r = arr->read(); + const String *r = arr->ptr(); for (int i = 0; i < l; i++) { if (r[i] == index) return true; @@ -2724,15 +2724,15 @@ bool Variant::in(const Variant &p_index, bool *r_valid) const { } } break; //25 - case POOL_VECTOR2_ARRAY: { + case PACKED_VECTOR2_ARRAY: { if (p_index.get_type() == Variant::VECTOR2) { Vector2 index = p_index; - const PoolVector<Vector2> *arr = reinterpret_cast<const PoolVector<Vector2> *>(_data._mem); + const Vector<Vector2> *arr = reinterpret_cast<const Vector<Vector2> *>(_data._mem); int l = arr->size(); if (l) { - PoolVector<Vector2>::Read r = arr->read(); + const Vector2 *r = arr->ptr(); for (int i = 0; i < l; i++) { if (r[i] == index) return true; @@ -2743,15 +2743,15 @@ bool Variant::in(const Variant &p_index, bool *r_valid) const { } } break; - case POOL_VECTOR3_ARRAY: { + case PACKED_VECTOR3_ARRAY: { if (p_index.get_type() == Variant::VECTOR3) { Vector3 index = p_index; - const PoolVector<Vector3> *arr = reinterpret_cast<const PoolVector<Vector3> *>(_data._mem); + const Vector<Vector3> *arr = reinterpret_cast<const Vector<Vector3> *>(_data._mem); int l = arr->size(); if (l) { - PoolVector<Vector3>::Read r = arr->read(); + const Vector3 *r = arr->ptr(); for (int i = 0; i < l; i++) { if (r[i] == index) return true; @@ -2762,16 +2762,16 @@ bool Variant::in(const Variant &p_index, bool *r_valid) const { } } break; - case POOL_COLOR_ARRAY: { + case PACKED_COLOR_ARRAY: { if (p_index.get_type() == Variant::COLOR) { Color index = p_index; - const PoolVector<Color> *arr = reinterpret_cast<const PoolVector<Color> *>(_data._mem); + const Vector<Color> *arr = reinterpret_cast<const Vector<Color> *>(_data._mem); int l = arr->size(); if (l) { - PoolVector<Color>::Read r = arr->read(); + const Color *r = arr->ptr(); for (int i = 0; i < l; i++) { if (r[i] == index) return true; @@ -2902,13 +2902,13 @@ void Variant::get_property_list(List<PropertyInfo> *p_list) const { } } break; case ARRAY: // 20 - case POOL_BYTE_ARRAY: - case POOL_INT_ARRAY: - case POOL_REAL_ARRAY: - case POOL_STRING_ARRAY: - case POOL_VECTOR2_ARRAY: // 25 - case POOL_VECTOR3_ARRAY: - case POOL_COLOR_ARRAY: { + case PACKED_BYTE_ARRAY: + case PACKED_INT_ARRAY: + case PACKED_REAL_ARRAY: + case PACKED_STRING_ARRAY: + case PACKED_VECTOR2_ARRAY: // 25 + case PACKED_VECTOR3_ARRAY: + case PACKED_COLOR_ARRAY: { //nothing } break; @@ -3012,56 +3012,56 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const { r_iter = 0; return true; } break; - case POOL_BYTE_ARRAY: { - const PoolVector<uint8_t> *arr = reinterpret_cast<const PoolVector<uint8_t> *>(_data._mem); + case PACKED_BYTE_ARRAY: { + const Vector<uint8_t> *arr = reinterpret_cast<const Vector<uint8_t> *>(_data._mem); if (arr->size() == 0) return false; r_iter = 0; return true; } break; - case POOL_INT_ARRAY: { - const PoolVector<int> *arr = reinterpret_cast<const PoolVector<int> *>(_data._mem); + case PACKED_INT_ARRAY: { + const Vector<int> *arr = reinterpret_cast<const Vector<int> *>(_data._mem); if (arr->size() == 0) return false; r_iter = 0; return true; } break; - case POOL_REAL_ARRAY: { - const PoolVector<real_t> *arr = reinterpret_cast<const PoolVector<real_t> *>(_data._mem); + case PACKED_REAL_ARRAY: { + const Vector<real_t> *arr = reinterpret_cast<const Vector<real_t> *>(_data._mem); if (arr->size() == 0) return false; r_iter = 0; return true; } break; - case POOL_STRING_ARRAY: { - const PoolVector<String> *arr = reinterpret_cast<const PoolVector<String> *>(_data._mem); + case PACKED_STRING_ARRAY: { + const Vector<String> *arr = reinterpret_cast<const Vector<String> *>(_data._mem); if (arr->size() == 0) return false; r_iter = 0; return true; } break; - case POOL_VECTOR2_ARRAY: { + case PACKED_VECTOR2_ARRAY: { - const PoolVector<Vector2> *arr = reinterpret_cast<const PoolVector<Vector2> *>(_data._mem); + const Vector<Vector2> *arr = reinterpret_cast<const Vector<Vector2> *>(_data._mem); if (arr->size() == 0) return false; r_iter = 0; return true; } break; - case POOL_VECTOR3_ARRAY: { + case PACKED_VECTOR3_ARRAY: { - const PoolVector<Vector3> *arr = reinterpret_cast<const PoolVector<Vector3> *>(_data._mem); + const Vector<Vector3> *arr = reinterpret_cast<const Vector<Vector3> *>(_data._mem); if (arr->size() == 0) return false; r_iter = 0; return true; } break; - case POOL_COLOR_ARRAY: { + case PACKED_COLOR_ARRAY: { - const PoolVector<Color> *arr = reinterpret_cast<const PoolVector<Color> *>(_data._mem); + const Vector<Color> *arr = reinterpret_cast<const Vector<Color> *>(_data._mem); if (arr->size() == 0) return false; r_iter = 0; @@ -3187,8 +3187,8 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const { r_iter = idx; return true; } break; - case POOL_BYTE_ARRAY: { - const PoolVector<uint8_t> *arr = reinterpret_cast<const PoolVector<uint8_t> *>(_data._mem); + case PACKED_BYTE_ARRAY: { + const Vector<uint8_t> *arr = reinterpret_cast<const Vector<uint8_t> *>(_data._mem); int idx = r_iter; idx++; if (idx >= arr->size()) @@ -3197,8 +3197,8 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const { return true; } break; - case POOL_INT_ARRAY: { - const PoolVector<int> *arr = reinterpret_cast<const PoolVector<int> *>(_data._mem); + case PACKED_INT_ARRAY: { + const Vector<int> *arr = reinterpret_cast<const Vector<int> *>(_data._mem); int idx = r_iter; idx++; if (idx >= arr->size()) @@ -3207,8 +3207,8 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const { return true; } break; - case POOL_REAL_ARRAY: { - const PoolVector<real_t> *arr = reinterpret_cast<const PoolVector<real_t> *>(_data._mem); + case PACKED_REAL_ARRAY: { + const Vector<real_t> *arr = reinterpret_cast<const Vector<real_t> *>(_data._mem); int idx = r_iter; idx++; if (idx >= arr->size()) @@ -3217,8 +3217,8 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const { return true; } break; - case POOL_STRING_ARRAY: { - const PoolVector<String> *arr = reinterpret_cast<const PoolVector<String> *>(_data._mem); + case PACKED_STRING_ARRAY: { + const Vector<String> *arr = reinterpret_cast<const Vector<String> *>(_data._mem); int idx = r_iter; idx++; if (idx >= arr->size()) @@ -3226,9 +3226,9 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const { r_iter = idx; return true; } break; - case POOL_VECTOR2_ARRAY: { + case PACKED_VECTOR2_ARRAY: { - const PoolVector<Vector2> *arr = reinterpret_cast<const PoolVector<Vector2> *>(_data._mem); + const Vector<Vector2> *arr = reinterpret_cast<const Vector<Vector2> *>(_data._mem); int idx = r_iter; idx++; if (idx >= arr->size()) @@ -3236,9 +3236,9 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const { r_iter = idx; return true; } break; - case POOL_VECTOR3_ARRAY: { + case PACKED_VECTOR3_ARRAY: { - const PoolVector<Vector3> *arr = reinterpret_cast<const PoolVector<Vector3> *>(_data._mem); + const Vector<Vector3> *arr = reinterpret_cast<const Vector<Vector3> *>(_data._mem); int idx = r_iter; idx++; if (idx >= arr->size()) @@ -3246,9 +3246,9 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const { r_iter = idx; return true; } break; - case POOL_COLOR_ARRAY: { + case PACKED_COLOR_ARRAY: { - const PoolVector<Color> *arr = reinterpret_cast<const PoolVector<Color> *>(_data._mem); + const Vector<Color> *arr = reinterpret_cast<const Vector<Color> *>(_data._mem); int idx = r_iter; idx++; if (idx >= arr->size()) @@ -3334,8 +3334,8 @@ Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const { #endif return arr->get(idx); } break; - case POOL_BYTE_ARRAY: { - const PoolVector<uint8_t> *arr = reinterpret_cast<const PoolVector<uint8_t> *>(_data._mem); + case PACKED_BYTE_ARRAY: { + const Vector<uint8_t> *arr = reinterpret_cast<const Vector<uint8_t> *>(_data._mem); int idx = r_iter; #ifdef DEBUG_ENABLED if (idx < 0 || idx >= arr->size()) { @@ -3345,8 +3345,8 @@ Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const { #endif return arr->get(idx); } break; - case POOL_INT_ARRAY: { - const PoolVector<int> *arr = reinterpret_cast<const PoolVector<int> *>(_data._mem); + case PACKED_INT_ARRAY: { + const Vector<int> *arr = reinterpret_cast<const Vector<int> *>(_data._mem); int idx = r_iter; #ifdef DEBUG_ENABLED if (idx < 0 || idx >= arr->size()) { @@ -3356,8 +3356,8 @@ Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const { #endif return arr->get(idx); } break; - case POOL_REAL_ARRAY: { - const PoolVector<real_t> *arr = reinterpret_cast<const PoolVector<real_t> *>(_data._mem); + case PACKED_REAL_ARRAY: { + const Vector<real_t> *arr = reinterpret_cast<const Vector<real_t> *>(_data._mem); int idx = r_iter; #ifdef DEBUG_ENABLED if (idx < 0 || idx >= arr->size()) { @@ -3367,8 +3367,8 @@ Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const { #endif return arr->get(idx); } break; - case POOL_STRING_ARRAY: { - const PoolVector<String> *arr = reinterpret_cast<const PoolVector<String> *>(_data._mem); + case PACKED_STRING_ARRAY: { + const Vector<String> *arr = reinterpret_cast<const Vector<String> *>(_data._mem); int idx = r_iter; #ifdef DEBUG_ENABLED if (idx < 0 || idx >= arr->size()) { @@ -3378,9 +3378,9 @@ Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const { #endif return arr->get(idx); } break; - case POOL_VECTOR2_ARRAY: { + case PACKED_VECTOR2_ARRAY: { - const PoolVector<Vector2> *arr = reinterpret_cast<const PoolVector<Vector2> *>(_data._mem); + const Vector<Vector2> *arr = reinterpret_cast<const Vector<Vector2> *>(_data._mem); int idx = r_iter; #ifdef DEBUG_ENABLED if (idx < 0 || idx >= arr->size()) { @@ -3390,9 +3390,9 @@ Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const { #endif return arr->get(idx); } break; - case POOL_VECTOR3_ARRAY: { + case PACKED_VECTOR3_ARRAY: { - const PoolVector<Vector3> *arr = reinterpret_cast<const PoolVector<Vector3> *>(_data._mem); + const Vector<Vector3> *arr = reinterpret_cast<const Vector<Vector3> *>(_data._mem); int idx = r_iter; #ifdef DEBUG_ENABLED if (idx < 0 || idx >= arr->size()) { @@ -3402,9 +3402,9 @@ Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const { #endif return arr->get(idx); } break; - case POOL_COLOR_ARRAY: { + case PACKED_COLOR_ARRAY: { - const PoolVector<Color> *arr = reinterpret_cast<const PoolVector<Color> *>(_data._mem); + const Vector<Color> *arr = reinterpret_cast<const Vector<Color> *>(_data._mem); int idx = r_iter; #ifdef DEBUG_ENABLED if (idx < 0 || idx >= arr->size()) { @@ -3658,25 +3658,25 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant & r_dst = a; } return; - case POOL_BYTE_ARRAY: { + case PACKED_BYTE_ARRAY: { r_dst = a; } return; - case POOL_INT_ARRAY: { - const PoolVector<int> *arr_a = reinterpret_cast<const PoolVector<int> *>(a._data._mem); - const PoolVector<int> *arr_b = reinterpret_cast<const PoolVector<int> *>(b._data._mem); + case PACKED_INT_ARRAY: { + const Vector<int> *arr_a = reinterpret_cast<const Vector<int> *>(a._data._mem); + const Vector<int> *arr_b = reinterpret_cast<const Vector<int> *>(b._data._mem); int sz = arr_a->size(); if (sz == 0 || arr_b->size() != sz) { r_dst = a; } else { - PoolVector<int> v; + Vector<int> v; v.resize(sz); { - PoolVector<int>::Write vw = v.write(); - PoolVector<int>::Read ar = arr_a->read(); - PoolVector<int>::Read br = arr_b->read(); + int *vw = v.ptrw(); + const int *ar = arr_a->ptr(); + const int *br = arr_b->ptr(); Variant va; for (int i = 0; i < sz; i++) { @@ -3688,21 +3688,21 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant & } } return; - case POOL_REAL_ARRAY: { - const PoolVector<real_t> *arr_a = reinterpret_cast<const PoolVector<real_t> *>(a._data._mem); - const PoolVector<real_t> *arr_b = reinterpret_cast<const PoolVector<real_t> *>(b._data._mem); + case PACKED_REAL_ARRAY: { + const Vector<real_t> *arr_a = reinterpret_cast<const Vector<real_t> *>(a._data._mem); + const Vector<real_t> *arr_b = reinterpret_cast<const Vector<real_t> *>(b._data._mem); int sz = arr_a->size(); if (sz == 0 || arr_b->size() != sz) { r_dst = a; } else { - PoolVector<real_t> v; + Vector<real_t> v; v.resize(sz); { - PoolVector<real_t>::Write vw = v.write(); - PoolVector<real_t>::Read ar = arr_a->read(); - PoolVector<real_t>::Read br = arr_b->read(); + real_t *vw = v.ptrw(); + const real_t *ar = arr_a->ptr(); + const real_t *br = arr_b->ptr(); Variant va; for (int i = 0; i < sz; i++) { @@ -3714,25 +3714,25 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant & } } return; - case POOL_STRING_ARRAY: { + case PACKED_STRING_ARRAY: { r_dst = a; } return; - case POOL_VECTOR2_ARRAY: { - const PoolVector<Vector2> *arr_a = reinterpret_cast<const PoolVector<Vector2> *>(a._data._mem); - const PoolVector<Vector2> *arr_b = reinterpret_cast<const PoolVector<Vector2> *>(b._data._mem); + case PACKED_VECTOR2_ARRAY: { + const Vector<Vector2> *arr_a = reinterpret_cast<const Vector<Vector2> *>(a._data._mem); + const Vector<Vector2> *arr_b = reinterpret_cast<const Vector<Vector2> *>(b._data._mem); int sz = arr_a->size(); if (sz == 0 || arr_b->size() != sz) { r_dst = a; } else { - PoolVector<Vector2> v; + Vector<Vector2> v; v.resize(sz); { - PoolVector<Vector2>::Write vw = v.write(); - PoolVector<Vector2>::Read ar = arr_a->read(); - PoolVector<Vector2>::Read br = arr_b->read(); + Vector2 *vw = v.ptrw(); + const Vector2 *ar = arr_a->ptr(); + const Vector2 *br = arr_b->ptr(); for (int i = 0; i < sz; i++) { vw[i] = ar[i].linear_interpolate(br[i], c); @@ -3742,22 +3742,22 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant & } } return; - case POOL_VECTOR3_ARRAY: { + case PACKED_VECTOR3_ARRAY: { - const PoolVector<Vector3> *arr_a = reinterpret_cast<const PoolVector<Vector3> *>(a._data._mem); - const PoolVector<Vector3> *arr_b = reinterpret_cast<const PoolVector<Vector3> *>(b._data._mem); + const Vector<Vector3> *arr_a = reinterpret_cast<const Vector<Vector3> *>(a._data._mem); + const Vector<Vector3> *arr_b = reinterpret_cast<const Vector<Vector3> *>(b._data._mem); int sz = arr_a->size(); if (sz == 0 || arr_b->size() != sz) { r_dst = a; } else { - PoolVector<Vector3> v; + Vector<Vector3> v; v.resize(sz); { - PoolVector<Vector3>::Write vw = v.write(); - PoolVector<Vector3>::Read ar = arr_a->read(); - PoolVector<Vector3>::Read br = arr_b->read(); + Vector3 *vw = v.ptrw(); + const Vector3 *ar = arr_a->ptr(); + const Vector3 *br = arr_b->ptr(); for (int i = 0; i < sz; i++) { vw[i] = ar[i].linear_interpolate(br[i], c); @@ -3767,21 +3767,21 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant & } } return; - case POOL_COLOR_ARRAY: { - const PoolVector<Color> *arr_a = reinterpret_cast<const PoolVector<Color> *>(a._data._mem); - const PoolVector<Color> *arr_b = reinterpret_cast<const PoolVector<Color> *>(b._data._mem); + case PACKED_COLOR_ARRAY: { + const Vector<Color> *arr_a = reinterpret_cast<const Vector<Color> *>(a._data._mem); + const Vector<Color> *arr_b = reinterpret_cast<const Vector<Color> *>(b._data._mem); int sz = arr_a->size(); if (sz == 0 || arr_b->size() != sz) { r_dst = a; } else { - PoolVector<Color> v; + Vector<Color> v; v.resize(sz); { - PoolVector<Color>::Write vw = v.write(); - PoolVector<Color>::Read ar = arr_a->read(); - PoolVector<Color>::Read br = arr_b->read(); + Color *vw = v.ptrw(); + const Color *ar = arr_a->ptr(); + const Color *br = arr_b->ptr(); for (int i = 0; i < sz; i++) { vw[i] = ar[i].linear_interpolate(br[i], c); diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index 996b25308e..f036e00ed5 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -861,18 +861,18 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, } } - } else if (id == "PoolByteArray" || id == "ByteArray") { + } else if (id == "PackedByteArray" || id == "PoolByteArray" || id == "ByteArray") { Vector<uint8_t> args; Error err = _parse_construct<uint8_t>(p_stream, args, line, r_err_str); if (err) return err; - PoolVector<uint8_t> arr; + Vector<uint8_t> arr; { int len = args.size(); arr.resize(len); - PoolVector<uint8_t>::Write w = arr.write(); + uint8_t *w = arr.ptrw(); for (int i = 0; i < len; i++) { w[i] = args[i]; } @@ -882,18 +882,18 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, return OK; - } else if (id == "PoolIntArray" || id == "IntArray") { + } else if (id == "PackedIntArray" || id == "PoolIntArray" || id == "IntArray") { Vector<int> args; Error err = _parse_construct<int>(p_stream, args, line, r_err_str); if (err) return err; - PoolVector<int> arr; + Vector<int> arr; { int len = args.size(); arr.resize(len); - PoolVector<int>::Write w = arr.write(); + int *w = arr.ptrw(); for (int i = 0; i < len; i++) { w[i] = int(args[i]); } @@ -903,18 +903,18 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, return OK; - } else if (id == "PoolRealArray" || id == "FloatArray") { + } else if (id == "PackedRealArray" || id == "PoolRealArray" || id == "FloatArray") { Vector<float> args; Error err = _parse_construct<float>(p_stream, args, line, r_err_str); if (err) return err; - PoolVector<float> arr; + Vector<float> arr; { int len = args.size(); arr.resize(len); - PoolVector<float>::Write w = arr.write(); + float *w = arr.ptrw(); for (int i = 0; i < len; i++) { w[i] = args[i]; } @@ -923,7 +923,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, value = arr; return OK; - } else if (id == "PoolStringArray" || id == "StringArray") { + } else if (id == "PackedStringArray" || id == "PoolStringArray" || id == "StringArray") { get_token(p_stream, token, line, r_err_str); if (token.type != TK_PARENTHESIS_OPEN) { @@ -960,11 +960,11 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, cs.push_back(token.value); } - PoolVector<String> arr; + Vector<String> arr; { int len = cs.size(); arr.resize(len); - PoolVector<String>::Write w = arr.write(); + String *w = arr.ptrw(); for (int i = 0; i < len; i++) { w[i] = cs[i]; } @@ -974,18 +974,18 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, return OK; - } else if (id == "PoolVector2Array" || id == "Vector2Array") { + } else if (id == "PackedVector2Array" || id == "PoolVector2Array" || id == "Vector2Array") { Vector<float> args; Error err = _parse_construct<float>(p_stream, args, line, r_err_str); if (err) return err; - PoolVector<Vector2> arr; + Vector<Vector2> arr; { int len = args.size() / 2; arr.resize(len); - PoolVector<Vector2>::Write w = arr.write(); + Vector2 *w = arr.ptrw(); for (int i = 0; i < len; i++) { w[i] = Vector2(args[i * 2 + 0], args[i * 2 + 1]); } @@ -995,18 +995,18 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, return OK; - } else if (id == "PoolVector3Array" || id == "Vector3Array") { + } else if (id == "PackedVector3Array" || id == "PoolVector3Array" || id == "Vector3Array") { Vector<float> args; Error err = _parse_construct<float>(p_stream, args, line, r_err_str); if (err) return err; - PoolVector<Vector3> arr; + Vector<Vector3> arr; { int len = args.size() / 3; arr.resize(len); - PoolVector<Vector3>::Write w = arr.write(); + Vector3 *w = arr.ptrw(); for (int i = 0; i < len; i++) { w[i] = Vector3(args[i * 3 + 0], args[i * 3 + 1], args[i * 3 + 2]); } @@ -1016,18 +1016,18 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, return OK; - } else if (id == "PoolColorArray" || id == "ColorArray") { + } else if (id == "PackedColorArray" || id == "PoolColorArray" || id == "ColorArray") { Vector<float> args; Error err = _parse_construct<float>(p_stream, args, line, r_err_str); if (err) return err; - PoolVector<Color> arr; + Vector<Color> arr; { int len = args.size() / 4; arr.resize(len); - PoolVector<Color>::Write w = arr.write(); + Color *w = arr.ptrw(); for (int i = 0; i < len; i++) { w[i] = Color(args[i * 4 + 0], args[i * 4 + 1], args[i * 4 + 2], args[i * 4 + 3]); } @@ -1609,14 +1609,14 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str } break; - case Variant::POOL_BYTE_ARRAY: { + case Variant::PACKED_BYTE_ARRAY: { - p_store_string_func(p_store_string_ud, "PoolByteArray( "); + p_store_string_func(p_store_string_ud, "PackedByteArray( "); String s; - PoolVector<uint8_t> data = p_variant; + Vector<uint8_t> data = p_variant; int len = data.size(); - PoolVector<uint8_t>::Read r = data.read(); - const uint8_t *ptr = r.ptr(); + const uint8_t *ptr = data.ptr(); + for (int i = 0; i < len; i++) { if (i > 0) @@ -1628,13 +1628,12 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud, " )"); } break; - case Variant::POOL_INT_ARRAY: { + case Variant::PACKED_INT_ARRAY: { - p_store_string_func(p_store_string_ud, "PoolIntArray( "); - PoolVector<int> data = p_variant; + p_store_string_func(p_store_string_ud, "PackedIntArray( "); + Vector<int> data = p_variant; int len = data.size(); - PoolVector<int>::Read r = data.read(); - const int *ptr = r.ptr(); + const int *ptr = data.ptr(); for (int i = 0; i < len; i++) { @@ -1647,13 +1646,12 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud, " )"); } break; - case Variant::POOL_REAL_ARRAY: { + case Variant::PACKED_REAL_ARRAY: { - p_store_string_func(p_store_string_ud, "PoolRealArray( "); - PoolVector<real_t> data = p_variant; + p_store_string_func(p_store_string_ud, "PackedRealArray( "); + Vector<real_t> data = p_variant; int len = data.size(); - PoolVector<real_t>::Read r = data.read(); - const real_t *ptr = r.ptr(); + const real_t *ptr = data.ptr(); for (int i = 0; i < len; i++) { @@ -1665,13 +1663,13 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud, " )"); } break; - case Variant::POOL_STRING_ARRAY: { + case Variant::PACKED_STRING_ARRAY: { - p_store_string_func(p_store_string_ud, "PoolStringArray( "); - PoolVector<String> data = p_variant; + p_store_string_func(p_store_string_ud, "PackedStringArray( "); + Vector<String> data = p_variant; int len = data.size(); - PoolVector<String>::Read r = data.read(); - const String *ptr = r.ptr(); + const String *ptr = data.ptr(); + String s; //write_string("\n"); @@ -1686,13 +1684,12 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud, " )"); } break; - case Variant::POOL_VECTOR2_ARRAY: { + case Variant::PACKED_VECTOR2_ARRAY: { - p_store_string_func(p_store_string_ud, "PoolVector2Array( "); - PoolVector<Vector2> data = p_variant; + p_store_string_func(p_store_string_ud, "PackedVector2Array( "); + Vector<Vector2> data = p_variant; int len = data.size(); - PoolVector<Vector2>::Read r = data.read(); - const Vector2 *ptr = r.ptr(); + const Vector2 *ptr = data.ptr(); for (int i = 0; i < len; i++) { @@ -1704,13 +1701,12 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud, " )"); } break; - case Variant::POOL_VECTOR3_ARRAY: { + case Variant::PACKED_VECTOR3_ARRAY: { - p_store_string_func(p_store_string_ud, "PoolVector3Array( "); - PoolVector<Vector3> data = p_variant; + p_store_string_func(p_store_string_ud, "PackedVector3Array( "); + Vector<Vector3> data = p_variant; int len = data.size(); - PoolVector<Vector3>::Read r = data.read(); - const Vector3 *ptr = r.ptr(); + const Vector3 *ptr = data.ptr(); for (int i = 0; i < len; i++) { @@ -1722,14 +1718,13 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud, " )"); } break; - case Variant::POOL_COLOR_ARRAY: { + case Variant::PACKED_COLOR_ARRAY: { - p_store_string_func(p_store_string_ud, "PoolColorArray( "); + p_store_string_func(p_store_string_ud, "PackedColorArray( "); - PoolVector<Color> data = p_variant; + Vector<Color> data = p_variant; int len = data.size(); - PoolVector<Color>::Read r = data.read(); - const Color *ptr = r.ptr(); + const Color *ptr = data.ptr(); for (int i = 0; i < len; i++) { diff --git a/core/vector.h b/core/vector.h index 44add2c4d7..d3476679ff 100644 --- a/core/vector.h +++ b/core/vector.h @@ -34,7 +34,7 @@ /** * @class Vector * @author Juan Linietsky - * Vector container. Regular Vector Container. Use with care and for smaller arrays when possible. Use PoolVector for large arrays. + * Vector container. Regular Vector Container. Use with care and for smaller arrays when possible. Use Vector for large arrays. */ #include "core/cowdata.h" @@ -64,12 +64,13 @@ private: public: bool push_back(T p_elem); + _FORCE_INLINE_ bool append(const T &p_elem) { return push_back(p_elem); } //alias void remove(int p_index) { _cowdata.remove(p_index); } void erase(const T &p_val) { int idx = find(p_val); if (idx >= 0) remove(idx); - }; + } void invert(); _FORCE_INLINE_ T *ptrw() { return _cowdata.ptrw(); } @@ -123,6 +124,30 @@ public: return *this; } + Vector<T> subarray(int p_from, int p_to) const { + + if (p_from < 0) { + p_from = size() + p_from; + } + if (p_to < 0) { + p_to = size() + p_to; + } + + ERR_FAIL_INDEX_V(p_from, size(), Vector<T>()); + ERR_FAIL_INDEX_V(p_to, size(), Vector<T>()); + + Vector<T> slice; + int span = 1 + p_to - p_from; + slice.resize(span); + const T *r = ptr(); + T *w = slice.ptrw(); + for (int i = 0; i < span; ++i) { + w[i] = r[p_from + i]; + } + + return slice; + } + _FORCE_INLINE_ ~Vector() {} }; diff --git a/drivers/alsamidi/midi_driver_alsamidi.cpp b/drivers/alsamidi/midi_driver_alsamidi.cpp index 6121a44b36..670d7e0a4a 100644 --- a/drivers/alsamidi/midi_driver_alsamidi.cpp +++ b/drivers/alsamidi/midi_driver_alsamidi.cpp @@ -189,9 +189,9 @@ void MIDIDriverALSAMidi::unlock() const { mutex->unlock(); } -PoolStringArray MIDIDriverALSAMidi::get_connected_inputs() { +PackedStringArray MIDIDriverALSAMidi::get_connected_inputs() { - PoolStringArray list; + PackedStringArray list; lock(); for (int i = 0; i < connected_inputs.size(); i++) { diff --git a/drivers/alsamidi/midi_driver_alsamidi.h b/drivers/alsamidi/midi_driver_alsamidi.h index 354fcce147..9900d90553 100644 --- a/drivers/alsamidi/midi_driver_alsamidi.h +++ b/drivers/alsamidi/midi_driver_alsamidi.h @@ -59,7 +59,7 @@ public: virtual Error open(); virtual void close(); - virtual PoolStringArray get_connected_inputs(); + virtual PackedStringArray get_connected_inputs(); MIDIDriverALSAMidi(); virtual ~MIDIDriverALSAMidi(); diff --git a/drivers/coremidi/midi_driver_coremidi.cpp b/drivers/coremidi/midi_driver_coremidi.cpp index 99628c7fe3..d807896e61 100644 --- a/drivers/coremidi/midi_driver_coremidi.cpp +++ b/drivers/coremidi/midi_driver_coremidi.cpp @@ -93,9 +93,9 @@ void MIDIDriverCoreMidi::close() { } } -PoolStringArray MIDIDriverCoreMidi::get_connected_inputs() { +PackedStringArray MIDIDriverCoreMidi::get_connected_inputs() { - PoolStringArray list; + PackedStringArray list; for (int i = 0; i < connected_sources.size(); i++) { MIDIEndpointRef source = connected_sources[i]; diff --git a/drivers/coremidi/midi_driver_coremidi.h b/drivers/coremidi/midi_driver_coremidi.h index f32644e80c..e8b4481c20 100644 --- a/drivers/coremidi/midi_driver_coremidi.h +++ b/drivers/coremidi/midi_driver_coremidi.h @@ -52,7 +52,7 @@ public: virtual Error open(); virtual void close(); - PoolStringArray get_connected_inputs(); + PackedStringArray get_connected_inputs(); MIDIDriverCoreMidi(); virtual ~MIDIDriverCoreMidi(); diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h index 990a0dc455..fb23370863 100644 --- a/drivers/dummy/rasterizer_dummy.h +++ b/drivers/dummy/rasterizer_dummy.h @@ -134,12 +134,12 @@ public: struct DummySurface { uint32_t format; VS::PrimitiveType primitive; - PoolVector<uint8_t> array; + Vector<uint8_t> array; int vertex_count; - PoolVector<uint8_t> index_array; + Vector<uint8_t> index_array; int index_count; AABB aabb; - Vector<PoolVector<uint8_t> > blend_shapes; + Vector<Vector<uint8_t> > blend_shapes; Vector<AABB> bone_aabbs; }; @@ -295,7 +295,7 @@ public: return mesh_owner.make_rid(mesh); } - void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::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>()) { + void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::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>()) { DummyMesh *m = mesh_owner.getornull(p_mesh); ERR_FAIL_COND(!m); @@ -334,7 +334,7 @@ public: return m->blend_shape_mode; } - void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) {} + void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) {} void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) {} RID mesh_surface_get_material(RID p_mesh, int p_surface) const { return RID(); } @@ -352,15 +352,15 @@ public: return m->surfaces[p_surface].index_count; } - PoolVector<uint8_t> mesh_surface_get_array(RID p_mesh, int p_surface) const { + Vector<uint8_t> mesh_surface_get_array(RID p_mesh, int p_surface) const { DummyMesh *m = mesh_owner.getornull(p_mesh); - ERR_FAIL_COND_V(!m, PoolVector<uint8_t>()); + ERR_FAIL_COND_V(!m, Vector<uint8_t>()); return m->surfaces[p_surface].array; } - PoolVector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const { + Vector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const { DummyMesh *m = mesh_owner.getornull(p_mesh); - ERR_FAIL_COND_V(!m, PoolVector<uint8_t>()); + ERR_FAIL_COND_V(!m, Vector<uint8_t>()); return m->surfaces[p_surface].index_array; } @@ -384,9 +384,9 @@ public: return m->surfaces[p_surface].aabb; } - Vector<PoolVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const { + Vector<Vector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const { DummyMesh *m = mesh_owner.getornull(p_mesh); - ERR_FAIL_COND_V(!m, Vector<PoolVector<uint8_t> >()); + ERR_FAIL_COND_V(!m, Vector<Vector<uint8_t> >()); return m->surfaces[p_surface].blend_shapes; } @@ -436,7 +436,7 @@ public: Color multimesh_instance_get_color(RID p_multimesh, int p_index) const { return Color(); } Color multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const { return Color(); } - void multimesh_set_as_bulk_array(RID p_multimesh, const PoolVector<float> &p_array) {} + void multimesh_set_as_bulk_array(RID p_multimesh, const Vector<float> &p_array) {} void multimesh_set_visible_instances(RID p_multimesh, int p_visible) {} int multimesh_get_visible_instances(RID p_multimesh) const { return 0; } @@ -555,9 +555,9 @@ public: void gi_probe_set_to_cell_xform(RID p_probe, const Transform &p_xform) {} Transform gi_probe_get_to_cell_xform(RID p_probe) const { return Transform(); } - void gi_probe_set_dynamic_data(RID p_probe, const PoolVector<int> &p_data) {} - PoolVector<int> gi_probe_get_dynamic_data(RID p_probe) const { - PoolVector<int> p; + void gi_probe_set_dynamic_data(RID p_probe, const Vector<int> &p_data) {} + Vector<int> gi_probe_get_dynamic_data(RID p_probe) const { + Vector<int> p; return p; } @@ -620,7 +620,7 @@ public: struct LightmapCapture : public Instantiable { - PoolVector<LightmapCaptureOctree> octree; + Vector<LightmapCaptureOctree> octree; AABB bounds; Transform cell_xform; int cell_subdiv; @@ -634,15 +634,15 @@ public: mutable RID_PtrOwner<LightmapCapture> lightmap_capture_data_owner; void lightmap_capture_set_bounds(RID p_capture, const AABB &p_bounds) {} AABB lightmap_capture_get_bounds(RID p_capture) const { return AABB(); } - void lightmap_capture_set_octree(RID p_capture, const PoolVector<uint8_t> &p_octree) {} + void lightmap_capture_set_octree(RID p_capture, const Vector<uint8_t> &p_octree) {} RID lightmap_capture_create() { LightmapCapture *capture = memnew(LightmapCapture); return lightmap_capture_data_owner.make_rid(capture); } - PoolVector<uint8_t> lightmap_capture_get_octree(RID p_capture) const { + Vector<uint8_t> lightmap_capture_get_octree(RID p_capture) const { const LightmapCapture *capture = lightmap_capture_data_owner.getornull(p_capture); - ERR_FAIL_COND_V(!capture, PoolVector<uint8_t>()); - return PoolVector<uint8_t>(); + ERR_FAIL_COND_V(!capture, Vector<uint8_t>()); + return Vector<uint8_t>(); } void lightmap_capture_set_octree_cell_transform(RID p_capture, const Transform &p_xform) {} Transform lightmap_capture_get_octree_cell_transform(RID p_capture) const { return Transform(); } @@ -650,7 +650,7 @@ public: int lightmap_capture_get_octree_cell_subdiv(RID p_capture) const { return 0; } void lightmap_capture_set_energy(RID p_capture, float p_energy) {} float lightmap_capture_get_energy(RID p_capture) const { return 0.0; } - const PoolVector<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const { + const Vector<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const { const LightmapCapture *capture = lightmap_capture_data_owner.getornull(p_capture); ERR_FAIL_COND_V(!capture, NULL); return &capture->octree; @@ -711,7 +711,7 @@ public: /* LIGHT SHADOW MAPPING */ RID canvas_light_occluder_create() { return RID(); } - void canvas_light_occluder_set_polylines(RID p_occluder, const PoolVector<Vector2> &p_lines) {} + void canvas_light_occluder_set_polylines(RID p_occluder, const Vector<Vector2> &p_lines) {} VS::InstanceType get_base_type(RID p_rid) const { if (mesh_owner.owns(p_rid)) { diff --git a/drivers/dummy/texture_loader_dummy.cpp b/drivers/dummy/texture_loader_dummy.cpp index bf51d76527..aff7bbd1bc 100644 --- a/drivers/dummy/texture_loader_dummy.cpp +++ b/drivers/dummy/texture_loader_dummy.cpp @@ -43,7 +43,7 @@ RES ResourceFormatDummyTexture::load(const String &p_path, const String &p_origi Image::Format fmt = Image::FORMAT_RGB8; int rowsize = 3 * width; - PoolVector<uint8_t> dstbuff; + Vector<uint8_t> dstbuff; dstbuff.resize(rowsize * height); diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp index 2e35bd0ccf..c433886545 100644 --- a/drivers/gles2/rasterizer_scene_gles2.cpp +++ b/drivers/gles2/rasterizer_scene_gles2.cpp @@ -1500,7 +1500,7 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste //use transform buffer workflow ERR_FAIL_COND(p_skeleton->use_2d); - PoolVector<float> &transform_buffer = storage->resources.skeleton_transform_cpu_buffer; + Vector<float> &transform_buffer = storage->resources.skeleton_transform_cpu_buffer; if (!s->attribs[VS::ARRAY_BONES].enabled || !s->attribs[VS::ARRAY_WEIGHTS].enabled) { break; // the whole instance has a skeleton, but this surface is not affected by it. @@ -1517,10 +1517,10 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste const size_t bone_weight_stride = s->attribs[VS::ARRAY_WEIGHTS].stride; { - PoolVector<float>::Write write = transform_buffer.write(); + float *write = transform_buffer.ptrw(); float *buffer = write.ptr(); - PoolVector<uint8_t>::Read vertex_array_read = s->data.read(); + const uint8_t *vertex_array_read = s->data.ptr(); const uint8_t *vertex_data = vertex_array_read.ptr(); for (int i = 0; i < s->array_len; i++) { diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index 245531a935..fa45aeeda8 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -750,7 +750,7 @@ void RasterizerStorageGLES2::texture_set_data(RID p_texture, const Ref<Image> &p } texture->data_size = img->get_data().size(); - PoolVector<uint8_t>::Read read = img->get_data().read(); + const uint8_t *read = img->get_data().ptr(); ERR_FAIL_COND(!read.ptr()); glActiveTexture(GL_TEXTURE0); @@ -888,12 +888,12 @@ Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, int p_layer) bool compressed; _get_gl_image_and_format(Ref<Image>(), texture->format, texture->flags, real_format, gl_format, gl_internal_format, gl_type, compressed, false); - PoolVector<uint8_t> data; + Vector<uint8_t> data; int data_size = Image::get_image_data_size(texture->alloc_width, texture->alloc_height, real_format, texture->mipmaps > 1); data.resize(data_size * 2); //add some memory at the end, just in case for buggy drivers - PoolVector<uint8_t>::Write wb = data.write(); + uint8_t *wb = data.ptrw(); glActiveTexture(GL_TEXTURE0); @@ -930,12 +930,12 @@ Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, int p_layer) bool compressed; _get_gl_image_and_format(Ref<Image>(), texture->format, texture->flags, real_format, gl_format, gl_internal_format, gl_type, compressed, texture->resize_to_po2); - PoolVector<uint8_t> data; + Vector<uint8_t> data; int data_size = Image::get_image_data_size(texture->alloc_width, texture->alloc_height, Image::FORMAT_RGBA8, false); data.resize(data_size * 2); //add some memory at the end, just in case for buggy drivers - PoolVector<uint8_t>::Write wb = data.write(); + uint8_t *wb = data.ptrw(); GLuint temp_framebuffer; glGenFramebuffers(1, &temp_framebuffer); @@ -1681,7 +1681,7 @@ void RasterizerStorageGLES2::shader_get_param_list(RID p_shader, List<PropertyIn case ShaderLanguage::TYPE_UVEC3: case ShaderLanguage::TYPE_IVEC4: case ShaderLanguage::TYPE_UVEC4: { - pi.type = Variant::POOL_INT_ARRAY; + pi.type = Variant::PACKED_INT_ARRAY; } break; case ShaderLanguage::TYPE_FLOAT: { @@ -2081,7 +2081,7 @@ RID RasterizerStorageGLES2::mesh_create() { return mesh_owner.make_rid(mesh); } -static PoolVector<uint8_t> _unpack_half_floats(const PoolVector<uint8_t> &array, uint32_t &format, int p_vertices) { +static Vector<uint8_t> _unpack_half_floats(const Vector<uint8_t> &array, uint32_t &format, int p_vertices) { uint32_t p_format = format; @@ -2223,11 +2223,11 @@ static PoolVector<uint8_t> _unpack_half_floats(const PoolVector<uint8_t> &array, dst_stride += dst_size[i]; } - PoolVector<uint8_t> ret; + Vector<uint8_t> ret; ret.resize(p_vertices * dst_stride); - PoolVector<uint8_t>::Read r = array.read(); - PoolVector<uint8_t>::Write w = ret.write(); + const uint8_t *r = array.ptr(); + uint8_t *w = ret.ptrw(); int src_offset = 0; int dst_offset = 0; @@ -2270,7 +2270,7 @@ static PoolVector<uint8_t> _unpack_half_floats(const PoolVector<uint8_t> &array, return ret; } -void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS::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_aabbs) { +void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS::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_aabbs) { Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND(!mesh); @@ -2457,18 +2457,18 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS: } //validate sizes - PoolVector<uint8_t> array = p_array; + Vector<uint8_t> array = p_array; int array_size = stride * p_vertex_count; int index_array_size = 0; if (array.size() != array_size && array.size() + p_vertex_count * 2 == array_size) { //old format, convert - array = PoolVector<uint8_t>(); + array = Vector<uint8_t>(); array.resize(p_array.size() + p_vertex_count * 2); - PoolVector<uint8_t>::Write w = array.write(); - PoolVector<uint8_t>::Read r = p_array.read(); + uint8_t *w = array.ptrw(); + const uint8_t *r = p_array.ptr(); uint16_t *w16 = (uint16_t *)w.ptr(); const uint16_t *r16 = (uint16_t *)r.ptr(); @@ -2492,7 +2492,7 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS: if (!config.support_half_float_vertices && uses_half_float) { uint32_t new_format = p_format; - PoolVector<uint8_t> unpacked_array = _unpack_half_floats(array, new_format, p_vertex_count); + Vector<uint8_t> unpacked_array = _unpack_half_floats(array, new_format, p_vertex_count); mesh_add_surface(p_mesh, new_format, p_primitive, unpacked_array, p_vertex_count, p_index_array, p_index_count, p_aabb, p_blend_shapes, p_bone_aabbs); return; //do not go any further, above function used unpacked stuff will be used instead. @@ -2549,7 +2549,7 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS: // Okay, now the OpenGL stuff, wheeeeey \o/ { - PoolVector<uint8_t>::Read vr = array.read(); + const uint8_t *vr = array.ptr(); glGenBuffers(1, &surface->vertex_id); glBindBuffer(GL_ARRAY_BUFFER, surface->vertex_id); @@ -2558,7 +2558,7 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS: glBindBuffer(GL_ARRAY_BUFFER, 0); if (p_format & VS::ARRAY_FORMAT_INDEX) { - PoolVector<uint8_t>::Read ir = p_index_array.read(); + const uint8_t *ir = p_index_array.ptr(); glGenBuffers(1, &surface->index_id); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, surface->index_id); @@ -2578,7 +2578,7 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS: Surface::BlendShape mt; - PoolVector<uint8_t>::Read vr = p_blend_shapes[i].read(); + const uint8_t *vr = p_blend_shapes[i].ptr(); surface->total_data_size += array_size; @@ -2628,7 +2628,7 @@ VS::BlendShapeMode RasterizerStorageGLES2::mesh_get_blend_shape_mode(RID p_mesh) return mesh->blend_shape_mode; } -void RasterizerStorageGLES2::mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) { +void RasterizerStorageGLES2::mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) { Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND(!mesh); @@ -2637,7 +2637,7 @@ void RasterizerStorageGLES2::mesh_surface_update_region(RID p_mesh, int p_surfac int total_size = p_data.size(); ERR_FAIL_COND(p_offset + total_size > mesh->surfaces[p_surface]->array_byte_size); - PoolVector<uint8_t>::Read r = p_data.read(); + const uint8_t *r = p_data.ptr(); glBindBuffer(GL_ARRAY_BUFFER, mesh->surfaces[p_surface]->vertex_id); glBufferSubData(GL_ARRAY_BUFFER, p_offset, total_size, r.ptr()); @@ -2689,11 +2689,11 @@ int RasterizerStorageGLES2::mesh_surface_get_array_index_len(RID p_mesh, int p_s return mesh->surfaces[p_surface]->index_array_len; } -PoolVector<uint8_t> RasterizerStorageGLES2::mesh_surface_get_array(RID p_mesh, int p_surface) const { +Vector<uint8_t> RasterizerStorageGLES2::mesh_surface_get_array(RID p_mesh, int p_surface) const { const Mesh *mesh = mesh_owner.getornull(p_mesh); - ERR_FAIL_COND_V(!mesh, PoolVector<uint8_t>()); - ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), PoolVector<uint8_t>()); + ERR_FAIL_COND_V(!mesh, Vector<uint8_t>()); + ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), Vector<uint8_t>()); Surface *surface = mesh->surfaces[p_surface]; #ifndef TOOLS_ENABLED @@ -2702,10 +2702,10 @@ PoolVector<uint8_t> RasterizerStorageGLES2::mesh_surface_get_array(RID p_mesh, i return surface->data; } -PoolVector<uint8_t> RasterizerStorageGLES2::mesh_surface_get_index_array(RID p_mesh, int p_surface) const { +Vector<uint8_t> RasterizerStorageGLES2::mesh_surface_get_index_array(RID p_mesh, int p_surface) const { const Mesh *mesh = mesh_owner.getornull(p_mesh); - ERR_FAIL_COND_V(!mesh, PoolVector<uint8_t>()); - ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), PoolVector<uint8_t>()); + ERR_FAIL_COND_V(!mesh, Vector<uint8_t>()); + ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), Vector<uint8_t>()); Surface *surface = mesh->surfaces[p_surface]; @@ -2737,10 +2737,10 @@ AABB RasterizerStorageGLES2::mesh_surface_get_aabb(RID p_mesh, int p_surface) co return mesh->surfaces[p_surface]->aabb; } -Vector<PoolVector<uint8_t> > RasterizerStorageGLES2::mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const { +Vector<Vector<uint8_t> > RasterizerStorageGLES2::mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const { const Mesh *mesh = mesh_owner.getornull(p_mesh); - ERR_FAIL_COND_V(!mesh, Vector<PoolVector<uint8_t> >()); - ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), Vector<PoolVector<uint8_t> >()); + ERR_FAIL_COND_V(!mesh, Vector<Vector<uint8_t> >()); + ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), Vector<Vector<uint8_t> >()); #ifndef TOOLS_ENABLED ERR_PRINT("OpenGL ES 2.0 does not allow retrieving mesh array data"); #endif @@ -3332,7 +3332,7 @@ Color RasterizerStorageGLES2::multimesh_instance_get_custom_data(RID p_multimesh return Color(); } -void RasterizerStorageGLES2::multimesh_set_as_bulk_array(RID p_multimesh, const PoolVector<float> &p_array) { +void RasterizerStorageGLES2::multimesh_set_as_bulk_array(RID p_multimesh, const Vector<float> &p_array) { MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); ERR_FAIL_COND(!multimesh); ERR_FAIL_COND(!multimesh->data.ptr()); @@ -3341,7 +3341,7 @@ void RasterizerStorageGLES2::multimesh_set_as_bulk_array(RID p_multimesh, const ERR_FAIL_COND(dsize != p_array.size()); - PoolVector<float>::Read r = p_array.read(); + const float *r = p_array.ptr(); ERR_FAIL_COND(!r.ptr()); copymem(multimesh->data.ptrw(), r.ptr(), dsize * sizeof(float)); @@ -3767,7 +3767,7 @@ void RasterizerStorageGLES2::skeleton_set_base_transform_2d(RID p_skeleton, cons skeleton->base_transform_2d = p_base_transform; } -void RasterizerStorageGLES2::_update_skeleton_transform_buffer(const PoolVector<float> &p_data, size_t p_size) { +void RasterizerStorageGLES2::_update_skeleton_transform_buffer(const Vector<float> &p_data, size_t p_size) { glBindBuffer(GL_ARRAY_BUFFER, resources.skeleton_transform_buffer); @@ -3776,9 +3776,9 @@ void RasterizerStorageGLES2::_update_skeleton_transform_buffer(const PoolVector< resources.skeleton_transform_buffer_size = p_size; - glBufferData(GL_ARRAY_BUFFER, p_size * sizeof(float), p_data.read().ptr(), GL_DYNAMIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, p_size * sizeof(float), p_data.ptr(), GL_DYNAMIC_DRAW); } else { - glBufferSubData(GL_ARRAY_BUFFER, 0, p_size * sizeof(float), p_data.read().ptr()); + glBufferSubData(GL_ARRAY_BUFFER, 0, p_size * sizeof(float), p_data.ptr()); } glBindBuffer(GL_ARRAY_BUFFER, 0); @@ -4298,11 +4298,11 @@ Transform RasterizerStorageGLES2::gi_probe_get_to_cell_xform(RID p_probe) const return Transform(); } -void RasterizerStorageGLES2::gi_probe_set_dynamic_data(RID p_probe, const PoolVector<int> &p_data) { +void RasterizerStorageGLES2::gi_probe_set_dynamic_data(RID p_probe, const Vector<int> &p_data) { } -PoolVector<int> RasterizerStorageGLES2::gi_probe_get_dynamic_data(RID p_probe) const { - return PoolVector<int>(); +Vector<int> RasterizerStorageGLES2::gi_probe_get_dynamic_data(RID p_probe) const { + return Vector<int>(); } void RasterizerStorageGLES2::gi_probe_set_dynamic_range(RID p_probe, int p_range) { @@ -4389,7 +4389,7 @@ AABB RasterizerStorageGLES2::lightmap_capture_get_bounds(RID p_capture) const { ERR_FAIL_COND_V(!capture, AABB()); return capture->bounds; } -void RasterizerStorageGLES2::lightmap_capture_set_octree(RID p_capture, const PoolVector<uint8_t> &p_octree) { +void RasterizerStorageGLES2::lightmap_capture_set_octree(RID p_capture, const Vector<uint8_t> &p_octree) { LightmapCapture *capture = lightmap_capture_data_owner.getornull(p_capture); ERR_FAIL_COND(!capture); @@ -4398,25 +4398,25 @@ void RasterizerStorageGLES2::lightmap_capture_set_octree(RID p_capture, const Po capture->octree.resize(p_octree.size() / sizeof(LightmapCaptureOctree)); if (p_octree.size()) { - PoolVector<LightmapCaptureOctree>::Write w = capture->octree.write(); - PoolVector<uint8_t>::Read r = p_octree.read(); + LightmapCaptureOctree *w = capture->octree.ptrw(); + const uint8_t *r = p_octree.ptr(); copymem(w.ptr(), r.ptr(), p_octree.size()); } capture->instance_change_notify(true, false); } -PoolVector<uint8_t> RasterizerStorageGLES2::lightmap_capture_get_octree(RID p_capture) const { +Vector<uint8_t> RasterizerStorageGLES2::lightmap_capture_get_octree(RID p_capture) const { const LightmapCapture *capture = lightmap_capture_data_owner.getornull(p_capture); - ERR_FAIL_COND_V(!capture, PoolVector<uint8_t>()); + ERR_FAIL_COND_V(!capture, Vector<uint8_t>()); if (capture->octree.size() == 0) - return PoolVector<uint8_t>(); + return Vector<uint8_t>(); - PoolVector<uint8_t> ret; + Vector<uint8_t> ret; ret.resize(capture->octree.size() * sizeof(LightmapCaptureOctree)); { - PoolVector<LightmapCaptureOctree>::Read r = capture->octree.read(); - PoolVector<uint8_t>::Write w = ret.write(); + const LightmapCaptureOctree *r = capture->octree.ptr(); + uint8_t *w = ret.ptrw(); copymem(w.ptr(), r.ptr(), ret.size()); } @@ -4461,7 +4461,7 @@ float RasterizerStorageGLES2::lightmap_capture_get_energy(RID p_capture) const { return capture->energy; } -const PoolVector<RasterizerStorage::LightmapCaptureOctree> *RasterizerStorageGLES2::lightmap_capture_get_octree_ptr(RID p_capture) const { +const Vector<RasterizerStorage::LightmapCaptureOctree> *RasterizerStorageGLES2::lightmap_capture_get_octree_ptr(RID p_capture) const { const LightmapCapture *capture = lightmap_capture_data_owner.getornull(p_capture); ERR_FAIL_COND_V(!capture, NULL); return &capture->octree; @@ -5449,7 +5449,7 @@ RID RasterizerStorageGLES2::canvas_light_occluder_create() { return canvas_occluder_owner.make_rid(co); } -void RasterizerStorageGLES2::canvas_light_occluder_set_polylines(RID p_occluder, const PoolVector<Vector2> &p_lines) { +void RasterizerStorageGLES2::canvas_light_occluder_set_polylines(RID p_occluder, const Vector<Vector2> &p_lines) { CanvasOccluder *co = canvas_occluder_owner.getornull(p_occluder); ERR_FAIL_COND(!co); @@ -5470,17 +5470,17 @@ void RasterizerStorageGLES2::canvas_light_occluder_set_polylines(RID p_occluder, if (p_lines.size()) { - PoolVector<float> geometry; - PoolVector<uint16_t> indices; + Vector<float> geometry; + Vector<uint16_t> indices; int lc = p_lines.size(); geometry.resize(lc * 6); indices.resize(lc * 3); - PoolVector<float>::Write vw = geometry.write(); - PoolVector<uint16_t>::Write iw = indices.write(); + float *vw = geometry.ptrw(); + uint16_t *iw = indices.ptrw(); - PoolVector<Vector2>::Read lr = p_lines.read(); + const Vector2 *lr = p_lines.ptr(); const int POLY_HEIGHT = 16384; diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h index a6aae400ca..6fbfe57778 100644 --- a/drivers/gles2/rasterizer_storage_gles2.h +++ b/drivers/gles2/rasterizer_storage_gles2.h @@ -31,7 +31,6 @@ #ifndef RASTERIZERSTORAGEGLES2_H #define RASTERIZERSTORAGEGLES2_H -#include "core/pool_vector.h" #include "core/self_list.h" #include "servers/visual/rasterizer.h" #include "servers/visual/shader_language.h" @@ -125,7 +124,7 @@ public: size_t skeleton_transform_buffer_size; GLuint skeleton_transform_buffer; - PoolVector<float> skeleton_transform_cpu_buffer; + Vector<float> skeleton_transform_cpu_buffer; } resources; @@ -649,9 +648,9 @@ public: bool active; - PoolVector<uint8_t> data; - PoolVector<uint8_t> index_data; - Vector<PoolVector<uint8_t> > blend_shape_data; + Vector<uint8_t> data; + Vector<uint8_t> index_data; + Vector<Vector<uint8_t> > blend_shape_data; int total_data_size; @@ -703,7 +702,7 @@ public: virtual RID mesh_create(); - virtual void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::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>()); + virtual void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::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>()); virtual void mesh_set_blend_shape_count(RID p_mesh, int p_amount); virtual int mesh_get_blend_shape_count(RID p_mesh) const; @@ -711,7 +710,7 @@ public: virtual void mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode); virtual VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const; - virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data); + virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data); virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material); virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const; @@ -719,14 +718,14 @@ public: virtual int mesh_surface_get_array_len(RID p_mesh, int p_surface) const; virtual int mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const; - virtual PoolVector<uint8_t> mesh_surface_get_array(RID p_mesh, int p_surface) const; - virtual PoolVector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const; + virtual Vector<uint8_t> mesh_surface_get_array(RID p_mesh, int p_surface) const; + virtual Vector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const; virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const; virtual VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const; virtual AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const; - virtual Vector<PoolVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const; + virtual Vector<Vector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const; virtual Vector<AABB> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const; virtual void mesh_remove_surface(RID p_mesh, int p_surface); @@ -803,7 +802,7 @@ public: virtual Color multimesh_instance_get_color(RID p_multimesh, int p_index) const; virtual Color multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const; - virtual void multimesh_set_as_bulk_array(RID p_multimesh, const PoolVector<float> &p_array); + virtual void multimesh_set_as_bulk_array(RID p_multimesh, const Vector<float> &p_array); virtual void multimesh_set_visible_instances(RID p_multimesh, int p_visible); virtual int multimesh_get_visible_instances(RID p_multimesh) const; @@ -902,7 +901,7 @@ public: virtual Transform2D skeleton_bone_get_transform_2d(RID p_skeleton, int p_bone) const; virtual void skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform); - void _update_skeleton_transform_buffer(const PoolVector<float> &p_data, size_t p_size); + void _update_skeleton_transform_buffer(const Vector<float> &p_data, size_t p_size); /* Light API */ @@ -1030,8 +1029,8 @@ public: virtual void gi_probe_set_to_cell_xform(RID p_probe, const Transform &p_xform); virtual Transform gi_probe_get_to_cell_xform(RID p_probe) const; - virtual void gi_probe_set_dynamic_data(RID p_probe, const PoolVector<int> &p_data); - virtual PoolVector<int> gi_probe_get_dynamic_data(RID p_probe) const; + virtual void gi_probe_set_dynamic_data(RID p_probe, const Vector<int> &p_data); + virtual Vector<int> gi_probe_get_dynamic_data(RID p_probe) const; virtual void gi_probe_set_dynamic_range(RID p_probe, int p_range); virtual int gi_probe_get_dynamic_range(RID p_probe) const; @@ -1064,7 +1063,7 @@ public: struct LightmapCapture : public Instantiable { - PoolVector<LightmapCaptureOctree> octree; + Vector<LightmapCaptureOctree> octree; AABB bounds; Transform cell_xform; int cell_subdiv; @@ -1080,15 +1079,15 @@ public: virtual RID lightmap_capture_create(); virtual void lightmap_capture_set_bounds(RID p_capture, const AABB &p_bounds); virtual AABB lightmap_capture_get_bounds(RID p_capture) const; - virtual void lightmap_capture_set_octree(RID p_capture, const PoolVector<uint8_t> &p_octree); - virtual PoolVector<uint8_t> lightmap_capture_get_octree(RID p_capture) const; + virtual void lightmap_capture_set_octree(RID p_capture, const Vector<uint8_t> &p_octree); + virtual Vector<uint8_t> lightmap_capture_get_octree(RID p_capture) const; virtual void lightmap_capture_set_octree_cell_transform(RID p_capture, const Transform &p_xform); virtual Transform lightmap_capture_get_octree_cell_transform(RID p_capture) const; virtual void lightmap_capture_set_octree_cell_subdiv(RID p_capture, int p_subdiv); virtual int lightmap_capture_get_octree_cell_subdiv(RID p_capture) const; virtual void lightmap_capture_set_energy(RID p_capture, float p_energy); virtual float lightmap_capture_get_energy(RID p_capture) const; - virtual const PoolVector<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const; + virtual const Vector<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const; /* PARTICLES */ void update_particles(); @@ -1271,14 +1270,14 @@ public: GLuint vertex_id; // 0 means, unconfigured GLuint index_id; // 0 means, unconfigured - PoolVector<Vector2> lines; + Vector<Vector2> lines; int len; }; RID_PtrOwner<CanvasOccluder> canvas_occluder_owner; virtual RID canvas_light_occluder_create(); - virtual void canvas_light_occluder_set_polylines(RID p_occluder, const PoolVector<Vector2> &p_lines); + virtual void canvas_light_occluder_set_polylines(RID p_occluder, const Vector<Vector2> &p_lines); virtual VS::InstanceType get_base_type(RID p_rid) const; diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp index eb7d196e1d..4cb93a821c 100644 --- a/drivers/png/image_loader_png.cpp +++ b/drivers/png/image_loader_png.cpp @@ -39,19 +39,19 @@ Error ImageLoaderPNG::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale) { const size_t buffer_size = f->get_len(); - PoolVector<uint8_t> file_buffer; + Vector<uint8_t> file_buffer; Error err = file_buffer.resize(buffer_size); if (err) { f->close(); return err; } { - PoolVector<uint8_t>::Write writer = file_buffer.write(); - f->get_buffer(writer.ptr(), buffer_size); + uint8_t *writer = file_buffer.ptrw(); + f->get_buffer(writer, buffer_size); f->close(); } - PoolVector<uint8_t>::Read reader = file_buffer.read(); - return PNGDriverCommon::png_to_image(reader.ptr(), buffer_size, p_image); + const uint8_t *reader = file_buffer.ptr(); + return PNGDriverCommon::png_to_image(reader, buffer_size, p_image); } void ImageLoaderPNG::get_recognized_extensions(List<String> *p_extensions) const { @@ -70,34 +70,34 @@ Ref<Image> ImageLoaderPNG::load_mem_png(const uint8_t *p_png, int p_size) { return img; } -Ref<Image> ImageLoaderPNG::lossless_unpack_png(const PoolVector<uint8_t> &p_data) { +Ref<Image> ImageLoaderPNG::lossless_unpack_png(const Vector<uint8_t> &p_data) { const int len = p_data.size(); ERR_FAIL_COND_V(len < 4, Ref<Image>()); - PoolVector<uint8_t>::Read r = p_data.read(); + const uint8_t *r = p_data.ptr(); ERR_FAIL_COND_V(r[0] != 'P' || r[1] != 'N' || r[2] != 'G' || r[3] != ' ', Ref<Image>()); return load_mem_png(&r[4], len - 4); } -PoolVector<uint8_t> ImageLoaderPNG::lossless_pack_png(const Ref<Image> &p_image) { +Vector<uint8_t> ImageLoaderPNG::lossless_pack_png(const Ref<Image> &p_image) { - PoolVector<uint8_t> out_buffer; + Vector<uint8_t> out_buffer; // add Godot's own "PNG " prefix if (out_buffer.resize(4) != OK) { - ERR_FAIL_V(PoolVector<uint8_t>()); + ERR_FAIL_V(Vector<uint8_t>()); } // scope for writer lifetime { // must be closed before call to image_to_png - PoolVector<uint8_t>::Write writer = out_buffer.write(); - copymem(writer.ptr(), "PNG ", 4); + uint8_t *writer = out_buffer.ptrw(); + copymem(writer, "PNG ", 4); } Error err = PNGDriverCommon::image_to_png(p_image, out_buffer); if (err) { - ERR_FAIL_V(PoolVector<uint8_t>()); + ERR_FAIL_V(Vector<uint8_t>()); } return out_buffer; diff --git a/drivers/png/image_loader_png.h b/drivers/png/image_loader_png.h index 57f8aa314d..0154be0398 100644 --- a/drivers/png/image_loader_png.h +++ b/drivers/png/image_loader_png.h @@ -35,8 +35,8 @@ class ImageLoaderPNG : public ImageFormatLoader { private: - static PoolVector<uint8_t> lossless_pack_png(const Ref<Image> &p_image); - static Ref<Image> lossless_unpack_png(const PoolVector<uint8_t> &p_data); + static Vector<uint8_t> lossless_pack_png(const Ref<Image> &p_image); + static Ref<Image> lossless_unpack_png(const Vector<uint8_t> &p_data); static Ref<Image> load_mem_png(const uint8_t *p_png, int p_size); public: diff --git a/drivers/png/png_driver_common.cpp b/drivers/png/png_driver_common.cpp index 750d00eb59..efd488fd5c 100644 --- a/drivers/png/png_driver_common.cpp +++ b/drivers/png/png_driver_common.cpp @@ -101,16 +101,16 @@ Error png_to_image(const uint8_t *p_source, size_t p_size, Ref<Image> p_image) { } const png_uint_32 stride = PNG_IMAGE_ROW_STRIDE(png_img); - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; Error err = buffer.resize(PNG_IMAGE_BUFFER_SIZE(png_img, stride)); if (err) { png_image_free(&png_img); // only required when we return before finish_read return err; } - PoolVector<uint8_t>::Write writer = buffer.write(); + uint8_t *writer = buffer.ptrw(); // read image data to buffer and release libpng resources - success = png_image_finish_read(&png_img, NULL, writer.ptr(), stride, NULL); + success = png_image_finish_read(&png_img, NULL, writer, stride, NULL); ERR_FAIL_COND_V_MSG(check_error(png_img), ERR_FILE_CORRUPT, png_img.message); ERR_FAIL_COND_V(!success, ERR_FILE_CORRUPT); @@ -120,7 +120,7 @@ Error png_to_image(const uint8_t *p_source, size_t p_size, Ref<Image> p_image) { return OK; } -Error image_to_png(const Ref<Image> &p_image, PoolVector<uint8_t> &p_buffer) { +Error image_to_png(const Ref<Image> &p_image, Vector<uint8_t> &p_buffer) { Ref<Image> source_image = p_image->duplicate(); @@ -158,8 +158,8 @@ Error image_to_png(const Ref<Image> &p_image, PoolVector<uint8_t> &p_buffer) { } } - const PoolVector<uint8_t> image_data = source_image->get_data(); - const PoolVector<uint8_t>::Read reader = image_data.read(); + const Vector<uint8_t> image_data = source_image->get_data(); + const uint8_t *reader = image_data.ptr(); // we may be passed a buffer with existing content we're expected to append to const int buffer_offset = p_buffer.size(); @@ -173,9 +173,9 @@ Error image_to_png(const Ref<Image> &p_image, PoolVector<uint8_t> &p_buffer) { Error err = p_buffer.resize(buffer_offset + png_size_estimate); ERR_FAIL_COND_V(err, err); - PoolVector<uint8_t>::Write writer = p_buffer.write(); + uint8_t *writer = p_buffer.ptrw(); success = png_image_write_to_memory(&png_img, &writer[buffer_offset], - &compressed_size, 0, reader.ptr(), 0, NULL); + &compressed_size, 0, reader, 0, NULL); ERR_FAIL_COND_V_MSG(check_error(png_img), FAILED, png_img.message); } if (!success) { @@ -187,9 +187,9 @@ Error image_to_png(const Ref<Image> &p_image, PoolVector<uint8_t> &p_buffer) { Error err = p_buffer.resize(buffer_offset + compressed_size); ERR_FAIL_COND_V(err, err); - PoolVector<uint8_t>::Write writer = p_buffer.write(); + uint8_t *writer = p_buffer.ptrw(); success = png_image_write_to_memory(&png_img, &writer[buffer_offset], - &compressed_size, 0, reader.ptr(), 0, NULL); + &compressed_size, 0, reader, 0, NULL); ERR_FAIL_COND_V_MSG(check_error(png_img), FAILED, png_img.message); ERR_FAIL_COND_V(!success, FAILED); } diff --git a/drivers/png/png_driver_common.h b/drivers/png/png_driver_common.h index ee1d32ce68..12129f034e 100644 --- a/drivers/png/png_driver_common.h +++ b/drivers/png/png_driver_common.h @@ -32,7 +32,6 @@ #define PNG_DRIVER_COMMON_H #include "core/image.h" -#include "core/pool_vector.h" namespace PNGDriverCommon { @@ -41,7 +40,7 @@ Error png_to_image(const uint8_t *p_source, size_t p_size, Ref<Image> p_image); // Append p_image, as a png, to p_buffer. // Contents of p_buffer is unspecified if error returned. -Error image_to_png(const Ref<Image> &p_image, PoolVector<uint8_t> &p_buffer); +Error image_to_png(const Ref<Image> &p_image, Vector<uint8_t> &p_buffer); } // namespace PNGDriverCommon diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp index 566bfbcc1d..2380c2685f 100644 --- a/drivers/png/resource_saver_png.cpp +++ b/drivers/png/resource_saver_png.cpp @@ -51,15 +51,15 @@ Error ResourceSaverPNG::save(const String &p_path, const RES &p_resource, uint32 Error ResourceSaverPNG::save_image(const String &p_path, const Ref<Image> &p_img) { - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; Error err = PNGDriverCommon::image_to_png(p_img, buffer); ERR_FAIL_COND_V_MSG(err, err, "Can't convert image to PNG."); FileAccess *file = FileAccess::open(p_path, FileAccess::WRITE, &err); ERR_FAIL_COND_V_MSG(err, err, vformat("Can't save PNG at path: '%s'.", p_path)); - PoolVector<uint8_t>::Read reader = buffer.read(); + const uint8_t *reader = buffer.ptr(); - file->store_buffer(reader.ptr(), buffer.size()); + file->store_buffer(reader, buffer.size()); if (file->get_error() != OK && file->get_error() != ERR_FILE_EOF) { memdelete(file); return ERR_CANT_CREATE; @@ -71,11 +71,11 @@ Error ResourceSaverPNG::save_image(const String &p_path, const Ref<Image> &p_img return OK; } -PoolVector<uint8_t> ResourceSaverPNG::save_image_to_buffer(const Ref<Image> &p_img) { +Vector<uint8_t> ResourceSaverPNG::save_image_to_buffer(const Ref<Image> &p_img) { - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; Error err = PNGDriverCommon::image_to_png(p_img, buffer); - ERR_FAIL_COND_V_MSG(err, PoolVector<uint8_t>(), "Can't convert image to PNG."); + ERR_FAIL_COND_V_MSG(err, Vector<uint8_t>(), "Can't convert image to PNG."); return buffer; } diff --git a/drivers/png/resource_saver_png.h b/drivers/png/resource_saver_png.h index 2cac20991a..c32b383521 100644 --- a/drivers/png/resource_saver_png.h +++ b/drivers/png/resource_saver_png.h @@ -37,7 +37,7 @@ class ResourceSaverPNG : public ResourceFormatSaver { public: static Error save_image(const String &p_path, const Ref<Image> &p_img); - static PoolVector<uint8_t> save_image_to_buffer(const Ref<Image> &p_img); + static Vector<uint8_t> save_image_to_buffer(const Ref<Image> &p_img); virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0); virtual bool recognize(const RES &p_resource) const; diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index 1eb6f204f2..7f7c787da2 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -1557,7 +1557,7 @@ void RenderingDeviceVulkan::_buffer_memory_barrier(VkBuffer buffer, uint64_t p_f /**** TEXTURE ****/ /*****************/ -RID RenderingDeviceVulkan::texture_create(const TextureFormat &p_format, const TextureView &p_view, const Vector<PoolVector<uint8_t> > &p_data) { +RID RenderingDeviceVulkan::texture_create(const TextureFormat &p_format, const TextureView &p_view, const Vector<Vector<uint8_t> > &p_data) { _THREAD_SAFE_METHOD_ @@ -2077,7 +2077,7 @@ RID RenderingDeviceVulkan::texture_create_shared_from_slice(const TextureView &p return id; } -Error RenderingDeviceVulkan::texture_update(RID p_texture, uint32_t p_layer, const PoolVector<uint8_t> &p_data, bool p_sync_with_draw) { +Error RenderingDeviceVulkan::texture_update(RID p_texture, uint32_t p_layer, const Vector<uint8_t> &p_data, bool p_sync_with_draw) { _THREAD_SAFE_METHOD_ @@ -2121,7 +2121,7 @@ Error RenderingDeviceVulkan::texture_update(RID p_texture, uint32_t p_layer, con uint32_t region_size = texture_upload_region_size_px; - PoolVector<uint8_t>::Read r = p_data.read(); + const uint8_t *r = p_data.ptr(); VkCommandBuffer command_buffer = p_sync_with_draw ? frames[frame].draw_command_buffer : frames[frame].setup_command_buffer; @@ -2153,7 +2153,7 @@ Error RenderingDeviceVulkan::texture_update(RID p_texture, uint32_t p_layer, con uint32_t depth; uint32_t image_total = get_image_format_required_size(texture->format, texture->width, texture->height, texture->depth, mm_i + 1, &width, &height, &depth); - const uint8_t *read_ptr_mipmap = r.ptr() + mipmap_offset; + const uint8_t *read_ptr_mipmap = r + mipmap_offset; image_size = image_total - mipmap_offset; for (uint32_t z = 0; z < depth; z++) { //for 3D textures, depth may be > 0 @@ -2288,12 +2288,12 @@ Error RenderingDeviceVulkan::texture_update(RID p_texture, uint32_t p_layer, con return OK; } -PoolVector<uint8_t> RenderingDeviceVulkan::_texture_get_data_from_image(Texture *tex, VkImage p_image, VmaAllocation p_allocation, uint32_t p_layer, bool p_2d) { +Vector<uint8_t> RenderingDeviceVulkan::_texture_get_data_from_image(Texture *tex, VkImage p_image, VmaAllocation p_allocation, uint32_t p_layer, bool p_2d) { uint32_t width, height, depth; uint32_t image_size = get_image_format_required_size(tex->format, tex->width, tex->height, p_2d ? 1 : tex->depth, tex->mipmaps, &width, &height, &depth); - PoolVector<uint8_t> image_data; + Vector<uint8_t> image_data; image_data.resize(image_size); void *img_mem; @@ -2305,14 +2305,14 @@ PoolVector<uint8_t> RenderingDeviceVulkan::_texture_get_data_from_image(Texture uint32_t pixel_size = get_image_format_pixel_size(tex->format); { - PoolVector<uint8_t>::Write w = image_data.write(); + uint8_t *w = image_data.ptrw(); uint32_t mipmap_offset = 0; for (uint32_t mm_i = 0; mm_i < tex->mipmaps; mm_i++) { uint32_t image_total = get_image_format_required_size(tex->format, tex->width, tex->height, p_2d ? 1 : tex->depth, mm_i + 1, &width, &height, &depth); - uint8_t *write_ptr_mipmap = w.ptr() + mipmap_offset; + uint8_t *write_ptr_mipmap = w + mipmap_offset; image_size = image_total - mipmap_offset; VkImageSubresource image_sub_resorce; @@ -2355,23 +2355,23 @@ PoolVector<uint8_t> RenderingDeviceVulkan::_texture_get_data_from_image(Texture return image_data; } -PoolVector<uint8_t> RenderingDeviceVulkan::texture_get_data(RID p_texture, uint32_t p_layer) { +Vector<uint8_t> RenderingDeviceVulkan::texture_get_data(RID p_texture, uint32_t p_layer) { _THREAD_SAFE_METHOD_ Texture *tex = texture_owner.getornull(p_texture); - ERR_FAIL_COND_V(!tex, PoolVector<uint8_t>()); + ERR_FAIL_COND_V(!tex, Vector<uint8_t>()); - ERR_FAIL_COND_V_MSG(tex->bound, PoolVector<uint8_t>(), + ERR_FAIL_COND_V_MSG(tex->bound, Vector<uint8_t>(), "Texture can't be retrieved while a render pass that uses it is being created. Ensure render pass is finalized (and that it was created with RENDER_PASS_CONTENTS_FINISH) to unbind this texture."); - ERR_FAIL_COND_V_MSG(!(tex->usage_flags & TEXTURE_USAGE_CAN_COPY_FROM_BIT), PoolVector<uint8_t>(), + ERR_FAIL_COND_V_MSG(!(tex->usage_flags & TEXTURE_USAGE_CAN_COPY_FROM_BIT), Vector<uint8_t>(), "Texture requires the TEXTURE_USAGE_CAN_COPY_FROM_BIT in order to be retrieved."); uint32_t layer_count = tex->layers; if (tex->type == TEXTURE_TYPE_CUBE || tex->type == TEXTURE_TYPE_CUBE_ARRAY) { layer_count *= 6; } - ERR_FAIL_COND_V(p_layer >= layer_count, PoolVector<uint8_t>()); + ERR_FAIL_COND_V(p_layer >= layer_count, Vector<uint8_t>()); if (tex->usage_flags & TEXTURE_USAGE_CPU_READ_BIT) { //does not need anything fancy, map and read. @@ -2469,15 +2469,15 @@ PoolVector<uint8_t> RenderingDeviceVulkan::texture_get_data(RID p_texture, uint3 void *buffer_mem; VkResult vkerr = vmaMapMemory(allocator, tmp_buffer.allocation, &buffer_mem); if (vkerr) { - ERR_FAIL_V(PoolVector<uint8_t>()); + ERR_FAIL_V(Vector<uint8_t>()); } - PoolVector<uint8_t> buffer_data; + Vector<uint8_t> buffer_data; { buffer_data.resize(buffer_size); - PoolVector<uint8_t>::Write w = buffer_data.write(); - copymem(w.ptr(), buffer_mem, buffer_size); + uint8_t *w = buffer_data.ptrw(); + copymem(w, buffer_mem, buffer_size); } vmaUnmapMemory(allocator, tmp_buffer.allocation); @@ -3135,7 +3135,7 @@ RID RenderingDeviceVulkan::sampler_create(const SamplerState &p_state) { /**** VERTEX ARRAY ****/ /**********************/ -RID RenderingDeviceVulkan::vertex_buffer_create(uint32_t p_size_bytes, const PoolVector<uint8_t> &p_data) { +RID RenderingDeviceVulkan::vertex_buffer_create(uint32_t p_size_bytes, const Vector<uint8_t> &p_data) { _THREAD_SAFE_METHOD_ @@ -3145,8 +3145,8 @@ RID RenderingDeviceVulkan::vertex_buffer_create(uint32_t p_size_bytes, const Poo _buffer_allocate(&buffer, p_size_bytes, VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, VMA_MEMORY_USAGE_GPU_ONLY); if (p_data.size()) { uint64_t data_size = p_data.size(); - PoolVector<uint8_t>::Read r = p_data.read(); - _buffer_update(&buffer, 0, r.ptr(), data_size); + const uint8_t *r = p_data.ptr(); + _buffer_update(&buffer, 0, r, data_size); _buffer_memory_barrier(buffer.buffer, 0, data_size, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT, false); } @@ -3263,7 +3263,7 @@ RID RenderingDeviceVulkan::vertex_array_create(uint32_t p_vertex_count, VertexFo return id; } -RID RenderingDeviceVulkan::index_buffer_create(uint32_t p_index_count, IndexBufferFormat p_format, const PoolVector<uint8_t> &p_data, bool p_use_restart_indices) { +RID RenderingDeviceVulkan::index_buffer_create(uint32_t p_index_count, IndexBufferFormat p_format, const Vector<uint8_t> &p_data, bool p_use_restart_indices) { _THREAD_SAFE_METHOD_ @@ -3279,9 +3279,9 @@ RID RenderingDeviceVulkan::index_buffer_create(uint32_t p_index_count, IndexBuff index_buffer.max_index = 0; ERR_FAIL_COND_V_MSG((uint32_t)p_data.size() != size_bytes, RID(), "Default index buffer initializer array size (" + itos(p_data.size()) + ") does not match format required size (" + itos(size_bytes) + ")."); - PoolVector<uint8_t>::Read r = p_data.read(); + const uint8_t *r = p_data.ptr(); if (p_format == INDEX_BUFFER_FORMAT_UINT16) { - const uint16_t *index16 = (const uint16_t *)r.ptr(); + const uint16_t *index16 = (const uint16_t *)r; for (uint32_t i = 0; i < p_index_count; i++) { if (p_use_restart_indices && index16[i] == 0xFFFF) { continue; //restart index, ingnore @@ -3289,7 +3289,7 @@ RID RenderingDeviceVulkan::index_buffer_create(uint32_t p_index_count, IndexBuff index_buffer.max_index = MAX(index16[i], index_buffer.max_index); } } else { - const uint32_t *index32 = (const uint32_t *)r.ptr(); + const uint32_t *index32 = (const uint32_t *)r; for (uint32_t i = 0; i < p_index_count; i++) { if (p_use_restart_indices && index32[i] == 0xFFFFFFFF) { continue; //restart index, ingnore @@ -3306,8 +3306,8 @@ RID RenderingDeviceVulkan::index_buffer_create(uint32_t p_index_count, IndexBuff _buffer_allocate(&index_buffer, size_bytes, VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT, VMA_MEMORY_USAGE_GPU_ONLY); if (p_data.size()) { uint64_t data_size = p_data.size(); - PoolVector<uint8_t>::Read r = p_data.read(); - _buffer_update(&index_buffer, 0, r.ptr(), data_size); + const uint8_t *r = p_data.ptr(); + _buffer_update(&index_buffer, 0, r, data_size); _buffer_memory_barrier(index_buffer.buffer, 0, data_size, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_INDEX_READ_BIT, false); } return index_buffer_owner.make_rid(index_buffer); @@ -3606,8 +3606,8 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages { SpvReflectShaderModule module; - PoolVector<uint8_t>::Read spirv = p_stages[i].spir_v.read(); - SpvReflectResult result = spvReflectCreateShaderModule(p_stages[i].spir_v.size(), spirv.ptr(), &module); + const uint8_t *spirv = p_stages[i].spir_v.ptr(); + SpvReflectResult result = spvReflectCreateShaderModule(p_stages[i].spir_v.size(), spirv, &module); ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, RID(), "Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "' failed parsing shader."); @@ -3872,9 +3872,9 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages shader_module_create_info.pNext = NULL; shader_module_create_info.flags = 0; shader_module_create_info.codeSize = p_stages[i].spir_v.size(); - PoolVector<uint8_t>::Read r = p_stages[i].spir_v.read(); + const uint8_t *r = p_stages[i].spir_v.ptr(); - shader_module_create_info.pCode = (const uint32_t *)r.ptr(); + shader_module_create_info.pCode = (const uint32_t *)r; VkShaderModule module; VkResult res = vkCreateShaderModule(device, &shader_module_create_info, NULL, &module); @@ -4016,7 +4016,7 @@ uint32_t RenderingDeviceVulkan::shader_get_vertex_input_attribute_mask(RID p_sha /**** UNIFORMS ****/ /******************/ -RID RenderingDeviceVulkan::uniform_buffer_create(uint32_t p_size_bytes, const PoolVector<uint8_t> &p_data) { +RID RenderingDeviceVulkan::uniform_buffer_create(uint32_t p_size_bytes, const Vector<uint8_t> &p_data) { _THREAD_SAFE_METHOD_ @@ -4027,14 +4027,14 @@ RID RenderingDeviceVulkan::uniform_buffer_create(uint32_t p_size_bytes, const Po ERR_FAIL_COND_V(err != OK, RID()); if (p_data.size()) { uint64_t data_size = p_data.size(); - PoolVector<uint8_t>::Read r = p_data.read(); - _buffer_update(&buffer, 0, r.ptr(), data_size); + const uint8_t *r = p_data.ptr(); + _buffer_update(&buffer, 0, r, data_size); _buffer_memory_barrier(buffer.buffer, 0, data_size, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_UNIFORM_READ_BIT, false); } return uniform_buffer_owner.make_rid(buffer); } -RID RenderingDeviceVulkan::storage_buffer_create(uint32_t p_size_bytes, const PoolVector<uint8_t> &p_data) { +RID RenderingDeviceVulkan::storage_buffer_create(uint32_t p_size_bytes, const Vector<uint8_t> &p_data) { _THREAD_SAFE_METHOD_ @@ -4046,14 +4046,14 @@ RID RenderingDeviceVulkan::storage_buffer_create(uint32_t p_size_bytes, const Po if (p_data.size()) { uint64_t data_size = p_data.size(); - PoolVector<uint8_t>::Read r = p_data.read(); - _buffer_update(&buffer, 0, r.ptr(), data_size); + const uint8_t *r = p_data.ptr(); + _buffer_update(&buffer, 0, r, data_size); _buffer_memory_barrier(buffer.buffer, 0, data_size, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT, false); } return storage_buffer_owner.make_rid(buffer); } -RID RenderingDeviceVulkan::texture_buffer_create(uint32_t p_size_elements, DataFormat p_format, const PoolVector<uint8_t> &p_data) { +RID RenderingDeviceVulkan::texture_buffer_create(uint32_t p_size_elements, DataFormat p_format, const Vector<uint8_t> &p_data) { _THREAD_SAFE_METHOD_ @@ -4069,8 +4069,8 @@ RID RenderingDeviceVulkan::texture_buffer_create(uint32_t p_size_elements, DataF if (p_data.size()) { uint64_t data_size = p_data.size(); - PoolVector<uint8_t>::Read r = p_data.read(); - _buffer_update(&texture_buffer.buffer, 0, r.ptr(), data_size); + const uint8_t *r = p_data.ptr(); + _buffer_update(&texture_buffer.buffer, 0, r, data_size); _buffer_memory_barrier(texture_buffer.buffer.buffer, 0, data_size, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT, false); } @@ -4689,7 +4689,7 @@ Error RenderingDeviceVulkan::buffer_update(RID p_buffer, uint32_t p_offset, uint return err; } -PoolVector<uint8_t> RenderingDeviceVulkan::buffer_get_data(RID p_buffer) { +Vector<uint8_t> RenderingDeviceVulkan::buffer_get_data(RID p_buffer) { _THREAD_SAFE_METHOD_ @@ -4703,7 +4703,7 @@ PoolVector<uint8_t> RenderingDeviceVulkan::buffer_get_data(RID p_buffer) { } else if (storage_buffer_owner.owns(p_buffer)) { buffer = storage_buffer_owner.getornull(p_buffer); } else { - ERR_FAIL_V_MSG(PoolVector<uint8_t>(), "Buffer is either invalid or this type of buffer can't be retrieved. Only Index and Vertex buffers allow retrieving."); + ERR_FAIL_V_MSG(Vector<uint8_t>(), "Buffer is either invalid or this type of buffer can't be retrieved. Only Index and Vertex buffers allow retrieving."); } VkCommandBuffer command_buffer = frames[frame].setup_command_buffer; @@ -4720,15 +4720,15 @@ PoolVector<uint8_t> RenderingDeviceVulkan::buffer_get_data(RID p_buffer) { void *buffer_mem; VkResult vkerr = vmaMapMemory(allocator, tmp_buffer.allocation, &buffer_mem); if (vkerr) { - ERR_FAIL_V(PoolVector<uint8_t>()); + ERR_FAIL_V(Vector<uint8_t>()); } - PoolVector<uint8_t> buffer_data; + Vector<uint8_t> buffer_data; { buffer_data.resize(buffer->size); - PoolVector<uint8_t>::Write w = buffer_data.write(); - copymem(w.ptr(), buffer_mem, buffer->size); + uint8_t *w = buffer_data.ptrw(); + copymem(w, buffer_mem, buffer->size); } vmaUnmapMemory(allocator, tmp_buffer.allocation); diff --git a/drivers/vulkan/rendering_device_vulkan.h b/drivers/vulkan/rendering_device_vulkan.h index 8ef24d319b..05534e75ef 100644 --- a/drivers/vulkan/rendering_device_vulkan.h +++ b/drivers/vulkan/rendering_device_vulkan.h @@ -150,7 +150,7 @@ class RenderingDeviceVulkan : public RenderingDevice { RID_Owner<Texture, true> texture_owner; uint32_t texture_upload_region_size_px; - PoolVector<uint8_t> _texture_get_data_from_image(Texture *tex, VkImage p_image, VmaAllocation p_allocation, uint32_t p_layer, bool p_2d = false); + Vector<uint8_t> _texture_get_data_from_image(Texture *tex, VkImage p_image, VmaAllocation p_allocation, uint32_t p_layer, bool p_2d = false); /*****************/ /**** SAMPLER ****/ @@ -966,12 +966,12 @@ class RenderingDeviceVulkan : public RenderingDevice { void _free_rids(T &p_owner, const char *p_type); public: - virtual RID texture_create(const TextureFormat &p_format, const TextureView &p_view, const Vector<PoolVector<uint8_t> > &p_data = Vector<PoolVector<uint8_t> >()); + virtual RID texture_create(const TextureFormat &p_format, const TextureView &p_view, const Vector<Vector<uint8_t> > &p_data = Vector<Vector<uint8_t> >()); virtual RID texture_create_shared(const TextureView &p_view, RID p_with_texture); virtual RID texture_create_shared_from_slice(const TextureView &p_view, RID p_with_texture, uint32_t p_layer, uint32_t p_mipmap, TextureSliceType p_slice_type = TEXTURE_SLICE_2D); - virtual Error texture_update(RID p_texture, uint32_t p_layer, const PoolVector<uint8_t> &p_data, bool p_sync_with_draw = false); - virtual PoolVector<uint8_t> texture_get_data(RID p_texture, uint32_t p_layer); + virtual Error texture_update(RID p_texture, uint32_t p_layer, const Vector<uint8_t> &p_data, bool p_sync_with_draw = false); + virtual Vector<uint8_t> texture_get_data(RID p_texture, uint32_t p_layer); virtual bool texture_is_format_supported_for_usage(DataFormat p_format, uint32_t p_usage) const; virtual bool texture_is_shared(RID p_texture); @@ -1001,13 +1001,13 @@ public: /**** VERTEX ARRAY ****/ /**********************/ - virtual RID vertex_buffer_create(uint32_t p_size_bytes, const PoolVector<uint8_t> &p_data = PoolVector<uint8_t>()); + virtual RID vertex_buffer_create(uint32_t p_size_bytes, const Vector<uint8_t> &p_data = Vector<uint8_t>()); // Internally reference counted, this ID is warranted to be unique for the same description, but needs to be freed as many times as it was allocated virtual VertexFormatID vertex_format_create(const Vector<VertexDescription> &p_vertex_formats); virtual RID vertex_array_create(uint32_t p_vertex_count, VertexFormatID p_vertex_format, const Vector<RID> &p_src_buffers); - virtual RID index_buffer_create(uint32_t p_size_indices, IndexBufferFormat p_format, const PoolVector<uint8_t> &p_data = PoolVector<uint8_t>(), bool p_use_restart_indices = false); + virtual RID index_buffer_create(uint32_t p_size_indices, IndexBufferFormat p_format, const Vector<uint8_t> &p_data = Vector<uint8_t>(), bool p_use_restart_indices = false); virtual RID index_array_create(RID p_index_buffer, uint32_t p_index_offset, uint32_t p_index_count); @@ -1022,15 +1022,15 @@ public: /**** UNIFORM ****/ /*****************/ - virtual RID uniform_buffer_create(uint32_t p_size_bytes, const PoolVector<uint8_t> &p_data = PoolVector<uint8_t>()); - virtual RID storage_buffer_create(uint32_t p_size_bytes, const PoolVector<uint8_t> &p_data = PoolVector<uint8_t>()); - virtual RID texture_buffer_create(uint32_t p_size_elements, DataFormat p_format, const PoolVector<uint8_t> &p_data = PoolVector<uint8_t>()); + virtual RID uniform_buffer_create(uint32_t p_size_bytes, const Vector<uint8_t> &p_data = Vector<uint8_t>()); + virtual RID storage_buffer_create(uint32_t p_size_bytes, const Vector<uint8_t> &p_data = Vector<uint8_t>()); + virtual RID texture_buffer_create(uint32_t p_size_elements, DataFormat p_format, const Vector<uint8_t> &p_data = Vector<uint8_t>()); virtual RID uniform_set_create(const Vector<Uniform> &p_uniforms, RID p_shader, uint32_t p_shader_set); virtual bool uniform_set_is_valid(RID p_uniform_set); virtual Error buffer_update(RID p_buffer, uint32_t p_offset, uint32_t p_size, const void *p_data, bool p_sync_with_draw = false); //works for any buffer - virtual PoolVector<uint8_t> buffer_get_data(RID p_buffer); + virtual Vector<uint8_t> buffer_get_data(RID p_buffer); /*************************/ /**** RENDER PIPELINE ****/ diff --git a/drivers/winmidi/midi_driver_winmidi.cpp b/drivers/winmidi/midi_driver_winmidi.cpp index 01c194b7d8..57fb9b0e57 100644 --- a/drivers/winmidi/midi_driver_winmidi.cpp +++ b/drivers/winmidi/midi_driver_winmidi.cpp @@ -66,9 +66,9 @@ Error MIDIDriverWinMidi::open() { return OK; } -PoolStringArray MIDIDriverWinMidi::get_connected_inputs() { +PackedStringArray MIDIDriverWinMidi::get_connected_inputs() { - PoolStringArray list; + PackedStringArray list; for (int i = 0; i < connected_sources.size(); i++) { HMIDIIN midi_in = connected_sources[i]; diff --git a/drivers/winmidi/midi_driver_winmidi.h b/drivers/winmidi/midi_driver_winmidi.h index a689d3a500..c240c8c7aa 100644 --- a/drivers/winmidi/midi_driver_winmidi.h +++ b/drivers/winmidi/midi_driver_winmidi.h @@ -51,7 +51,7 @@ public: virtual Error open(); virtual void close(); - virtual PoolStringArray get_connected_inputs(); + virtual PackedStringArray get_connected_inputs(); MIDIDriverWinMidi(); virtual ~MIDIDriverWinMidi(); diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index deabb06e1a..c2c9a88bf0 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -555,12 +555,12 @@ void ConnectionsDock::_make_or_edit_connection() { add_script_function = !found_inherited_function; } - PoolStringArray script_function_args; + PackedStringArray script_function_args; if (add_script_function) { // Pick up args here before "it" is deleted by update_tree. script_function_args = it->get_metadata(0).operator Dictionary()["args"]; for (int i = 0; i < cToMake.binds.size(); i++) { - script_function_args.append("extra_arg_" + itos(i) + ":" + Variant::get_type_name(cToMake.binds[i].get_type())); + script_function_args.push_back("extra_arg_" + itos(i) + ":" + Variant::get_type_name(cToMake.binds[i].get_type())); } } @@ -943,7 +943,7 @@ void ConnectionsDock::update_tree() { StringName signal_name = mi.name; String signaldesc = "("; - PoolStringArray argnames; + PackedStringArray argnames; if (mi.arguments.size()) { for (int i = 0; i < mi.arguments.size(); i++) { diff --git a/editor/doc/doc_dump.cpp b/editor/doc/doc_dump.cpp index 5f7fa53ee7..4763091b8e 100644 --- a/editor/doc/doc_dump.cpp +++ b/editor/doc/doc_dump.cpp @@ -184,12 +184,12 @@ void DocDump::dump(const String &p_file) { case Variant::AABB: case Variant::BASIS: case Variant::COLOR: - case Variant::POOL_BYTE_ARRAY: - case Variant::POOL_INT_ARRAY: - case Variant::POOL_REAL_ARRAY: - case Variant::POOL_STRING_ARRAY: - case Variant::POOL_VECTOR3_ARRAY: - case Variant::POOL_COLOR_ARRAY: + case Variant::PACKED_BYTE_ARRAY: + case Variant::PACKED_INT_ARRAY: + case Variant::PACKED_REAL_ARRAY: + case Variant::PACKED_STRING_ARRAY: + case Variant::PACKED_VECTOR3_ARRAY: + case Variant::PACKED_COLOR_ARRAY: default_arg_text = Variant::get_type_name(default_arg.get_type()) + "(" + default_arg_text + ")"; break; case Variant::OBJECT: diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index 549b15d6f9..77a23fb336 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -521,7 +521,7 @@ Variant EditorAutoloadSettings::get_drag_data_fw(const Point2 &p_point, Control if (autoload_cache.size() <= 1) return false; - PoolStringArray autoloads; + PackedStringArray autoloads; TreeItem *next = tree->get_next_selected(NULL); @@ -612,7 +612,7 @@ void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant & } Dictionary drop_data = p_data; - PoolStringArray autoloads = drop_data["autoloads"]; + PackedStringArray autoloads = drop_data["autoloads"]; Vector<int> orders; orders.resize(autoload_cache.size()); diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index f638df28a8..47ed6a15bb 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -582,14 +582,14 @@ String EditorExportPlugin::get_ios_cpp_code() const { return ios_cpp_code; } -void EditorExportPlugin::_export_file_script(const String &p_path, const String &p_type, const PoolVector<String> &p_features) { +void EditorExportPlugin::_export_file_script(const String &p_path, const String &p_type, const Vector<String> &p_features) { if (get_script_instance()) { get_script_instance()->call("_export_file", p_path, p_type, p_features); } } -void EditorExportPlugin::_export_begin_script(const PoolVector<String> &p_features, bool p_debug, const String &p_path, int p_flags) { +void EditorExportPlugin::_export_begin_script(const Vector<String> &p_features, bool p_debug, const String &p_path, int p_flags) { if (get_script_instance()) { get_script_instance()->call("_export_begin", p_features, p_debug, p_path, p_flags); @@ -625,8 +625,8 @@ void EditorExportPlugin::_bind_methods() { ClassDB::bind_method(D_METHOD("add_ios_cpp_code", "code"), &EditorExportPlugin::add_ios_cpp_code); ClassDB::bind_method(D_METHOD("skip"), &EditorExportPlugin::skip); - BIND_VMETHOD(MethodInfo("_export_file", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::STRING, "type"), PropertyInfo(Variant::POOL_STRING_ARRAY, "features"))); - BIND_VMETHOD(MethodInfo("_export_begin", PropertyInfo(Variant::POOL_STRING_ARRAY, "features"), PropertyInfo(Variant::BOOL, "is_debug"), PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::INT, "flags"))); + BIND_VMETHOD(MethodInfo("_export_file", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::STRING, "type"), PropertyInfo(Variant::PACKED_STRING_ARRAY, "features"))); + BIND_VMETHOD(MethodInfo("_export_begin", PropertyInfo(Variant::PACKED_STRING_ARRAY, "features"), PropertyInfo(Variant::BOOL, "is_debug"), PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::INT, "flags"))); BIND_VMETHOD(MethodInfo("_export_end")); } @@ -731,7 +731,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & FeatureContainers feature_containers = get_feature_containers(p_preset); Set<String> &features = feature_containers.features; - PoolVector<String> &features_pv = feature_containers.features_pv; + Vector<String> &features_pv = feature_containers.features_pv; //store everything in the export medium int idx = 0; diff --git a/editor/editor_export.h b/editor/editor_export.h index 19651b2c62..139d672cb8 100644 --- a/editor/editor_export.h +++ b/editor/editor_export.h @@ -188,7 +188,7 @@ private: struct FeatureContainers { Set<String> features; - PoolVector<String> features_pv; + Vector<String> features_pv; }; void _export_find_resources(EditorFileSystemDirectory *p_dir, Set<String> &p_paths); @@ -310,8 +310,8 @@ class EditorExportPlugin : public Reference { ios_cpp_code = ""; } - void _export_file_script(const String &p_path, const String &p_type, const PoolVector<String> &p_features); - void _export_begin_script(const PoolVector<String> &p_features, bool p_debug, const String &p_path, int p_flags); + void _export_file_script(const String &p_path, const String &p_type, const Vector<String> &p_features); + void _export_begin_script(const Vector<String> &p_features, bool p_debug, const String &p_path, int p_flags); void _export_end_script(); protected: diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index c869768c6c..8858db48df 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -347,7 +347,7 @@ void EditorFileDialog::_action_pressed() { String fbase = dir_access->get_current_dir(); - PoolVector<String> files; + Vector<String> files; for (int i = 0; i < item_list->get_item_count(); i++) { if (item_list->is_selected(i)) files.push_back(fbase.plus_file(item_list->get_item_text(i))); @@ -1419,7 +1419,7 @@ void EditorFileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("invalidate"), &EditorFileDialog::invalidate); 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"))); ADD_PROPERTY(PropertyInfo(Variant::INT, "access", PROPERTY_HINT_ENUM, "Resources,User data,File system"), "set_access", "get_access"); diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 107ecac3b0..b5ec08ef60 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -2100,8 +2100,8 @@ void EditorFileSystem::_bind_methods() { ADD_SIGNAL(MethodInfo("filesystem_changed")); ADD_SIGNAL(MethodInfo("sources_changed", PropertyInfo(Variant::BOOL, "exist"))); - ADD_SIGNAL(MethodInfo("resources_reimported", PropertyInfo(Variant::POOL_STRING_ARRAY, "resources"))); - ADD_SIGNAL(MethodInfo("resources_reload", PropertyInfo(Variant::POOL_STRING_ARRAY, "resources"))); + ADD_SIGNAL(MethodInfo("resources_reimported", PropertyInfo(Variant::PACKED_STRING_ARRAY, "resources"))); + ADD_SIGNAL(MethodInfo("resources_reload", PropertyInfo(Variant::PACKED_STRING_ARRAY, "resources"))); } void EditorFileSystem::_update_extensions() { diff --git a/editor/editor_folding.cpp b/editor/editor_folding.cpp index 475f16f12f..8308cd760b 100644 --- a/editor/editor_folding.cpp +++ b/editor/editor_folding.cpp @@ -34,12 +34,12 @@ #include "editor_inspector.h" #include "editor_settings.h" -PoolVector<String> EditorFolding::_get_unfolds(const Object *p_object) { +Vector<String> EditorFolding::_get_unfolds(const Object *p_object) { - PoolVector<String> sections; + Vector<String> sections; sections.resize(p_object->editor_get_section_folding().size()); if (sections.size()) { - PoolVector<String>::Write w = sections.write(); + String *w = sections.ptrw(); int idx = 0; for (const Set<String>::Element *E = p_object->editor_get_section_folding().front(); E; E = E->next()) { w[idx++] = E->get(); @@ -52,7 +52,7 @@ PoolVector<String> EditorFolding::_get_unfolds(const Object *p_object) { void EditorFolding::save_resource_folding(const RES &p_resource, const String &p_path) { Ref<ConfigFile> config; config.instance(); - PoolVector<String> unfolds = _get_unfolds(p_resource.ptr()); + Vector<String> unfolds = _get_unfolds(p_resource.ptr()); config->set_value("folding", "sections_unfolded", unfolds); String file = p_path.get_file() + "-folding-" + p_path.md5_text() + ".cfg"; @@ -60,10 +60,10 @@ void EditorFolding::save_resource_folding(const RES &p_resource, const String &p config->save(file); } -void EditorFolding::_set_unfolds(Object *p_object, const PoolVector<String> &p_unfolds) { +void EditorFolding::_set_unfolds(Object *p_object, const Vector<String> &p_unfolds) { int uc = p_unfolds.size(); - PoolVector<String>::Read r = p_unfolds.read(); + const String *r = p_unfolds.ptr(); p_object->editor_clear_section_folding(); for (int i = 0; i < uc; i++) { p_object->editor_set_section_unfold(r[i], true); @@ -82,7 +82,7 @@ void EditorFolding::load_resource_folding(RES p_resource, const String &p_path) return; } - PoolVector<String> unfolds; + Vector<String> unfolds; if (config->has_section_key("folding", "sections_unfolded")) { unfolds = config->get_value("folding", "sections_unfolded"); @@ -103,7 +103,7 @@ void EditorFolding::_fill_folds(const Node *p_root, const Node *p_node, Array &p if (p_node->is_displayed_folded()) { nodes_folded.push_back(p_root->get_path_to(p_node)); } - PoolVector<String> unfolds = _get_unfolds(p_node); + Vector<String> unfolds = _get_unfolds(p_node); if (unfolds.size()) { p_folds.push_back(p_root->get_path_to(p_node)); @@ -118,7 +118,7 @@ void EditorFolding::_fill_folds(const Node *p_root, const Node *p_node, Array &p RES res = p_node->get(E->get().name); if (res.is_valid() && !resources.has(res) && res->get_path() != String() && !res->get_path().is_resource_file()) { - PoolVector<String> res_unfolds = _get_unfolds(res.ptr()); + Vector<String> res_unfolds = _get_unfolds(res.ptr()); resource_folds.push_back(res->get_path()); resource_folds.push_back(res_unfolds); resources.insert(res); @@ -184,7 +184,7 @@ void EditorFolding::load_scene_folding(Node *p_scene, const String &p_path) { for (int i = 0; i < unfolds.size(); i += 2) { NodePath path2 = unfolds[i]; - PoolVector<String> un = unfolds[i + 1]; + Vector<String> un = unfolds[i + 1]; Node *node = p_scene->get_node_or_null(path2); if (!node) { continue; @@ -202,7 +202,7 @@ void EditorFolding::load_scene_folding(Node *p_scene, const String &p_path) { continue; } - PoolVector<String> unfolds2 = res_unfolds[i + 1]; + Vector<String> unfolds2 = res_unfolds[i + 1]; _set_unfolds(res.ptr(), unfolds2); } diff --git a/editor/editor_folding.h b/editor/editor_folding.h index cc49b062d0..5220907fe7 100644 --- a/editor/editor_folding.h +++ b/editor/editor_folding.h @@ -35,8 +35,8 @@ class EditorFolding { - PoolVector<String> _get_unfolds(const Object *p_object); - void _set_unfolds(Object *p_object, const PoolVector<String> &p_unfolds); + Vector<String> _get_unfolds(const Object *p_object); + void _set_unfolds(Object *p_object, const Vector<String> &p_unfolds); void _fill_folds(const Node *p_root, const Node *p_node, Array &p_folds, Array &resource_folds, Array &nodes_folded, Set<RES> &resources); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 6d2b891dc6..b16ec26fd1 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -829,7 +829,7 @@ void EditorProperty::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_red"), "set_draw_red", "is_draw_red"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keying"), "set_keying", "is_keying"); ADD_SIGNAL(MethodInfo("property_changed", PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT))); - ADD_SIGNAL(MethodInfo("multiple_properties_changed", PropertyInfo(Variant::POOL_STRING_ARRAY, "properties"), PropertyInfo(Variant::ARRAY, "value"))); + ADD_SIGNAL(MethodInfo("multiple_properties_changed", PropertyInfo(Variant::PACKED_STRING_ARRAY, "properties"), PropertyInfo(Variant::ARRAY, "value"))); ADD_SIGNAL(MethodInfo("property_keyed", PropertyInfo(Variant::STRING, "property"))); ADD_SIGNAL(MethodInfo("property_keyed_with_value", PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT))); ADD_SIGNAL(MethodInfo("property_checked", PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::STRING, "bool"))); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 24656410e8..6a6485575f 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -547,7 +547,7 @@ void EditorNode::_on_plugin_ready(Object *p_script, const String &p_activate_nam push_item(script.operator->()); } -void EditorNode::_resources_changed(const PoolVector<String> &p_resources) { +void EditorNode::_resources_changed(const Vector<String> &p_resources) { List<Ref<Resource> > changed; @@ -3052,7 +3052,7 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled, String addon_path = String("res://addons").plus_file(p_addon).plus_file("plugin.cfg"); if (!DirAccess::exists(addon_path.get_base_dir())) { ProjectSettings *ps = ProjectSettings::get_singleton(); - PoolStringArray enabled_plugins = ps->get("editor_plugins/enabled"); + PackedStringArray enabled_plugins = ps->get("editor_plugins/enabled"); for (int i = 0; i < enabled_plugins.size(); ++i) { if (enabled_plugins.get(i) == p_addon) { enabled_plugins.remove(i); @@ -5519,7 +5519,7 @@ void EditorNode::_bind_methods() { ADD_SIGNAL(MethodInfo("pause_pressed")); ADD_SIGNAL(MethodInfo("stop_pressed")); ADD_SIGNAL(MethodInfo("request_help_search")); - ADD_SIGNAL(MethodInfo("script_add_function_request", PropertyInfo(Variant::OBJECT, "obj"), PropertyInfo(Variant::STRING, "function"), PropertyInfo(Variant::POOL_STRING_ARRAY, "args"))); + ADD_SIGNAL(MethodInfo("script_add_function_request", PropertyInfo(Variant::OBJECT, "obj"), PropertyInfo(Variant::STRING, "function"), PropertyInfo(Variant::PACKED_STRING_ARRAY, "args"))); ADD_SIGNAL(MethodInfo("resource_saved", PropertyInfo(Variant::OBJECT, "obj"))); } diff --git a/editor/editor_node.h b/editor/editor_node.h index bd2c3d73ae..ef9be0677d 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -639,7 +639,7 @@ private: static void _resource_saved(RES p_resource, const String &p_path); static void _resource_loaded(RES p_resource, const String &p_path); - void _resources_changed(const PoolVector<String> &p_resources); + void _resources_changed(const Vector<String> &p_resources); void _feature_profile_changed(); bool _is_class_editor_disabled_by_feature_profile(const StringName &p_class); diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index ce847d02eb..2135e70de3 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -688,7 +688,7 @@ void EditorPlugin::apply_changes() { void EditorPlugin::get_breakpoints(List<String> *p_breakpoints) { if (get_script_instance() && get_script_instance()->has_method("get_breakpoints")) { - PoolStringArray arr = get_script_instance()->call("get_breakpoints"); + PackedStringArray arr = get_script_instance()->call("get_breakpoints"); for (int i = 0; i < arr.size(); i++) p_breakpoints->push_back(arr[i]); } @@ -743,8 +743,8 @@ void EditorPlugin::remove_scene_import_plugin(const Ref<EditorSceneImporter> &p_ ResourceImporterScene::get_singleton()->remove_importer(p_importer); } -int find(const PoolStringArray &a, const String &v) { - PoolStringArray::Read r = a.read(); +int find(const PackedStringArray &a, const String &v) { + const String *r = a.ptr(); for (int j = 0; j < a.size(); ++j) { if (r[j] == v) { return j; @@ -872,7 +872,7 @@ void EditorPlugin::_bind_methods() { ClassDB::add_virtual_method(get_class_static(), MethodInfo("clear")); ClassDB::add_virtual_method(get_class_static(), MethodInfo("save_external_data")); ClassDB::add_virtual_method(get_class_static(), MethodInfo("apply_changes")); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::POOL_STRING_ARRAY, "get_breakpoints")); + ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::PACKED_STRING_ARRAY, "get_breakpoints")); ClassDB::add_virtual_method(get_class_static(), MethodInfo("set_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"))); ClassDB::add_virtual_method(get_class_static(), MethodInfo("get_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"))); ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "build")); diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp index 3ac4fcc21b..96a4551763 100644 --- a/editor/editor_profiler.cpp +++ b/editor/editor_profiler.cpp @@ -175,7 +175,7 @@ void EditorProfiler::_update_plot() { graph_image.resize(desired_len); } - PoolVector<uint8_t>::Write wr = graph_image.write(); + uint8_t *wr = graph_image.ptrw(); const Color background_color = get_color("dark_color_2", "Editor"); // Clear the previous frame and set the background color. @@ -342,8 +342,6 @@ void EditorProfiler::_update_plot() { } } - wr.release(); - Ref<Image> img; img.instance(); img->create(w, h, 0, Image::FORMAT_RGBA8, graph_image); diff --git a/editor/editor_profiler.h b/editor/editor_profiler.h index f8accdf6d2..0a442ddd5c 100644 --- a/editor/editor_profiler.h +++ b/editor/editor_profiler.h @@ -103,7 +103,7 @@ private: Button *clear_button; TextureRect *graph; Ref<ImageTexture> graph_texture; - PoolVector<uint8_t> graph_image; + Vector<uint8_t> graph_image; Tree *variables; HSplitContainer *h_split; diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 905e928c5a..a93bc6169e 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -3353,39 +3353,39 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ editor->setup(Variant::ARRAY, p_hint_text); add_property_editor(p_path, editor); } break; - case Variant::POOL_BYTE_ARRAY: { + case Variant::PACKED_BYTE_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_BYTE_ARRAY); + editor->setup(Variant::PACKED_BYTE_ARRAY); add_property_editor(p_path, editor); } break; // 20 - case Variant::POOL_INT_ARRAY: { + case Variant::PACKED_INT_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_INT_ARRAY); + editor->setup(Variant::PACKED_INT_ARRAY); add_property_editor(p_path, editor); } break; - case Variant::POOL_REAL_ARRAY: { + case Variant::PACKED_REAL_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_REAL_ARRAY); + editor->setup(Variant::PACKED_REAL_ARRAY); add_property_editor(p_path, editor); } break; - case Variant::POOL_STRING_ARRAY: { + case Variant::PACKED_STRING_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_STRING_ARRAY); + editor->setup(Variant::PACKED_STRING_ARRAY); add_property_editor(p_path, editor); } break; - case Variant::POOL_VECTOR2_ARRAY: { + case Variant::PACKED_VECTOR2_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_VECTOR2_ARRAY); + editor->setup(Variant::PACKED_VECTOR2_ARRAY); add_property_editor(p_path, editor); } break; - case Variant::POOL_VECTOR3_ARRAY: { + case Variant::PACKED_VECTOR3_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_VECTOR3_ARRAY); + editor->setup(Variant::PACKED_VECTOR3_ARRAY); add_property_editor(p_path, editor); } break; // 25 - case Variant::POOL_COLOR_ARRAY: { + case Variant::PACKED_COLOR_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_COLOR_ARRAY); + editor->setup(Variant::PACKED_COLOR_ARRAY); add_property_editor(p_path, editor); } break; default: { diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index 0dc67b298f..86b2642faa 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -229,32 +229,32 @@ void EditorPropertyArray::update_property() { } break; // arrays - case Variant::POOL_BYTE_ARRAY: { - arrtype = "PoolByteArray"; + case Variant::PACKED_BYTE_ARRAY: { + arrtype = "PackedByteArray"; } break; - case Variant::POOL_INT_ARRAY: { - arrtype = "PoolIntArray"; + case Variant::PACKED_INT_ARRAY: { + arrtype = "PackedIntArray"; } break; - case Variant::POOL_REAL_ARRAY: { + case Variant::PACKED_REAL_ARRAY: { arrtype = "PoolFloatArray"; } break; - case Variant::POOL_STRING_ARRAY: { + case Variant::PACKED_STRING_ARRAY: { - arrtype = "PoolStringArray"; + arrtype = "PackedStringArray"; } break; - case Variant::POOL_VECTOR2_ARRAY: { + case Variant::PACKED_VECTOR2_ARRAY: { - arrtype = "PoolVector2Array"; + arrtype = "PackedVector2Array"; } break; - case Variant::POOL_VECTOR3_ARRAY: { - arrtype = "PoolVector3Array"; + case Variant::PACKED_VECTOR3_ARRAY: { + arrtype = "PackedVector3Array"; } break; - case Variant::POOL_COLOR_ARRAY: { - arrtype = "PoolColorArray"; + case Variant::PACKED_COLOR_ARRAY: { + arrtype = "PackedColorArray"; } break; default: { } @@ -846,46 +846,46 @@ void EditorPropertyDictionary::update_property() { } break; // arrays - case Variant::POOL_BYTE_ARRAY: { + case Variant::PACKED_BYTE_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_BYTE_ARRAY); + editor->setup(Variant::PACKED_BYTE_ARRAY); prop = editor; } break; - case Variant::POOL_INT_ARRAY: { + case Variant::PACKED_INT_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_INT_ARRAY); + editor->setup(Variant::PACKED_INT_ARRAY); prop = editor; } break; - case Variant::POOL_REAL_ARRAY: { + case Variant::PACKED_REAL_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_REAL_ARRAY); + editor->setup(Variant::PACKED_REAL_ARRAY); prop = editor; } break; - case Variant::POOL_STRING_ARRAY: { + case Variant::PACKED_STRING_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_STRING_ARRAY); + editor->setup(Variant::PACKED_STRING_ARRAY); prop = editor; } break; - case Variant::POOL_VECTOR2_ARRAY: { + case Variant::PACKED_VECTOR2_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_VECTOR2_ARRAY); + editor->setup(Variant::PACKED_VECTOR2_ARRAY); prop = editor; } break; - case Variant::POOL_VECTOR3_ARRAY: { + case Variant::PACKED_VECTOR3_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_VECTOR3_ARRAY); + editor->setup(Variant::PACKED_VECTOR3_ARRAY); prop = editor; } break; - case Variant::POOL_COLOR_ARRAY: { + case Variant::PACKED_COLOR_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_COLOR_ARRAY); + editor->setup(Variant::PACKED_COLOR_ARRAY); prop = editor; } break; default: { diff --git a/editor/editor_visual_profiler.cpp b/editor/editor_visual_profiler.cpp index 1b68a89181..579ac2e9ab 100644 --- a/editor/editor_visual_profiler.cpp +++ b/editor/editor_visual_profiler.cpp @@ -161,7 +161,7 @@ void EditorVisualProfiler::_update_plot() { graph_image.resize(desired_len); } - PoolVector<uint8_t>::Write wr = graph_image.write(); + uint8_t *wr = graph_image.ptrw(); //clear for (int i = 0; i < desired_len; i += 4) { @@ -305,8 +305,6 @@ void EditorVisualProfiler::_update_plot() { } } - wr.release(); - Ref<Image> img; img.instance(); img->create(w, h, 0, Image::FORMAT_RGBA8, graph_image); diff --git a/editor/editor_visual_profiler.h b/editor/editor_visual_profiler.h index b4c03b227e..5194c08b96 100644 --- a/editor/editor_visual_profiler.h +++ b/editor/editor_visual_profiler.h @@ -78,7 +78,7 @@ private: TextureRect *graph; Ref<ImageTexture> graph_texture; - PoolVector<uint8_t> graph_image; + Vector<uint8_t> graph_image; Tree *variables; HSplitContainer *h_split; CheckBox *frame_relative; diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index 7ed6688154..9f957cadc8 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -350,7 +350,7 @@ void ExportTemplateManager::ok_pressed() { template_open->popup_centered_ratio(); } -void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data) { +void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data) { if (p_status != HTTPRequest::RESULT_SUCCESS || p_code != 200) { EditorNode::get_singleton()->show_warning(TTR("Error getting the list of mirrors.")); @@ -359,8 +359,8 @@ void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_ String mirror_str; { - PoolByteArray::Read r = p_data.read(); - mirror_str.parse_utf8((const char *)r.ptr(), p_data.size()); + const uint8_t *r = p_data.ptr(); + mirror_str.parse_utf8((const char *)r, p_data.size()); } template_list_state->hide(); @@ -396,7 +396,7 @@ void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_ return; } } -void ExportTemplateManager::_http_download_templates_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data) { +void ExportTemplateManager::_http_download_templates_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data) { switch (p_status) { diff --git a/editor/export_template_manager.h b/editor/export_template_manager.h index 96e61a6569..6ebc7fd131 100644 --- a/editor/export_template_manager.h +++ b/editor/export_template_manager.h @@ -72,8 +72,8 @@ class ExportTemplateManager : public ConfirmationDialog { virtual void ok_pressed(); bool _install_from_file(const String &p_file, bool p_use_progress = true); - void _http_download_mirror_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data); - void _http_download_templates_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data); + void _http_download_mirror_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data); + void _http_download_templates_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data); void _begin_template_download(const String &p_url); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index a3def15532..b32f90f7b9 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -2506,7 +2506,7 @@ void FileSystemDock::_bind_methods() { ClassDB::bind_method(D_METHOD("_feature_profile_changed"), &FileSystemDock::_feature_profile_changed); ADD_SIGNAL(MethodInfo("inherit", PropertyInfo(Variant::STRING, "file"))); - ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::POOL_STRING_ARRAY, "files"))); + ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::PACKED_STRING_ARRAY, "files"))); ADD_SIGNAL(MethodInfo("file_removed", PropertyInfo(Variant::STRING, "file"))); ADD_SIGNAL(MethodInfo("folder_removed", PropertyInfo(Variant::STRING, "folder"))); diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 095e1b804a..f4bc6ae4be 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -47,7 +47,7 @@ const char *FindInFiles::SIGNAL_RESULT_FOUND = "result_found"; const char *FindInFiles::SIGNAL_FINISHED = "finished"; -// TODO Would be nice in Vector and PoolVectors +// TODO Would be nice in Vector and Vectors template <typename T> inline void pop_back(T &container) { container.resize(container.size() - 1); @@ -132,8 +132,8 @@ void FindInFiles::start() { // Init search _current_dir = ""; - PoolStringArray init_folder; - init_folder.append(_root_dir); + PackedStringArray init_folder; + init_folder.push_back(_root_dir); _folders_stack.clear(); _folders_stack.push_back(init_folder); @@ -168,7 +168,7 @@ void FindInFiles::_iterate() { // Scan folders first so we can build a list of files and have progress info later - PoolStringArray &folders_to_scan = _folders_stack.write[_folders_stack.size() - 1]; + PackedStringArray &folders_to_scan = _folders_stack.write[_folders_stack.size() - 1]; if (folders_to_scan.size() != 0) { // Scan one folder below @@ -178,7 +178,7 @@ void FindInFiles::_iterate() { _current_dir = _current_dir.plus_file(folder_name); - PoolStringArray sub_dirs; + PackedStringArray sub_dirs; _scan_dir("res://" + _current_dir, sub_dirs); _folders_stack.push_back(sub_dirs); @@ -219,7 +219,7 @@ float FindInFiles::get_progress() const { return 0; } -void FindInFiles::_scan_dir(String path, PoolStringArray &out_folders) { +void FindInFiles::_scan_dir(String path, PackedStringArray &out_folders) { DirAccessRef dir = DirAccess::open(path); if (!dir) { @@ -242,7 +242,7 @@ void FindInFiles::_scan_dir(String path, PoolStringArray &out_folders) { continue; if (dir->current_is_dir()) - out_folders.append(file); + out_folders.push_back(file); else { String file_ext = file.get_extension(); @@ -823,7 +823,7 @@ void FindInFilesPanel::_on_replace_all_clicked() { String replace_text = get_replace_text(); - PoolStringArray modified_files; + PackedStringArray modified_files; for (Map<String, TreeItem *>::Element *E = _file_items.front(); E; E = E->next()) { @@ -844,7 +844,7 @@ void FindInFilesPanel::_on_replace_all_clicked() { if (locations.size() != 0) { // Results are sorted by file, so we can batch replaces apply_replaces_in_file(fpath, locations, replace_text); - modified_files.append(fpath); + modified_files.push_back(fpath); } } diff --git a/editor/find_in_files.h b/editor/find_in_files.h index 243f59096a..5dc4ef5e19 100644 --- a/editor/find_in_files.h +++ b/editor/find_in_files.h @@ -69,7 +69,7 @@ protected: private: void _process(); void _iterate(); - void _scan_dir(String path, PoolStringArray &out_folders); + void _scan_dir(String path, PackedStringArray &out_folders); void _scan_file(String fpath); // Config @@ -82,7 +82,7 @@ private: // State bool _searching; String _current_dir; - Vector<PoolStringArray> _folders_stack; + Vector<PackedStringArray> _folders_stack; Vector<String> _files_to_scan; int _initial_files_count; }; diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index c0d84b61b4..f9e8977924 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -764,10 +764,10 @@ Vector<double> EditorSceneImporterGLTF::_decode_accessor(GLTFState &state, const return dst_buffer; } -PoolVector<int> EditorSceneImporterGLTF::_decode_accessor_as_ints(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex) { +Vector<int> EditorSceneImporterGLTF::_decode_accessor_as_ints(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex) { const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex); - PoolVector<int> ret; + Vector<int> ret; if (attribs.size() == 0) return ret; @@ -776,7 +776,7 @@ PoolVector<int> EditorSceneImporterGLTF::_decode_accessor_as_ints(GLTFState &sta const int ret_size = attribs.size(); ret.resize(ret_size); { - PoolVector<int>::Write w = ret.write(); + int *w = ret.ptrw(); for (int i = 0; i < ret_size; i++) { w[i] = int(attribs_ptr[i]); } @@ -784,10 +784,10 @@ PoolVector<int> EditorSceneImporterGLTF::_decode_accessor_as_ints(GLTFState &sta return ret; } -PoolVector<float> EditorSceneImporterGLTF::_decode_accessor_as_floats(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex) { +Vector<float> EditorSceneImporterGLTF::_decode_accessor_as_floats(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex) { const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex); - PoolVector<float> ret; + Vector<float> ret; if (attribs.size() == 0) return ret; @@ -796,7 +796,7 @@ PoolVector<float> EditorSceneImporterGLTF::_decode_accessor_as_floats(GLTFState const int ret_size = attribs.size(); ret.resize(ret_size); { - PoolVector<float>::Write w = ret.write(); + float *w = ret.ptrw(); for (int i = 0; i < ret_size; i++) { w[i] = float(attribs_ptr[i]); } @@ -804,10 +804,10 @@ PoolVector<float> EditorSceneImporterGLTF::_decode_accessor_as_floats(GLTFState return ret; } -PoolVector<Vector2> EditorSceneImporterGLTF::_decode_accessor_as_vec2(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex) { +Vector<Vector2> EditorSceneImporterGLTF::_decode_accessor_as_vec2(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex) { const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex); - PoolVector<Vector2> ret; + Vector<Vector2> ret; if (attribs.size() == 0) return ret; @@ -817,7 +817,7 @@ PoolVector<Vector2> EditorSceneImporterGLTF::_decode_accessor_as_vec2(GLTFState const int ret_size = attribs.size() / 2; ret.resize(ret_size); { - PoolVector<Vector2>::Write w = ret.write(); + Vector2 *w = ret.ptrw(); for (int i = 0; i < ret_size; i++) { w[i] = Vector2(attribs_ptr[i * 2 + 0], attribs_ptr[i * 2 + 1]); } @@ -825,10 +825,10 @@ PoolVector<Vector2> EditorSceneImporterGLTF::_decode_accessor_as_vec2(GLTFState return ret; } -PoolVector<Vector3> EditorSceneImporterGLTF::_decode_accessor_as_vec3(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex) { +Vector<Vector3> EditorSceneImporterGLTF::_decode_accessor_as_vec3(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex) { const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex); - PoolVector<Vector3> ret; + Vector<Vector3> ret; if (attribs.size() == 0) return ret; @@ -838,7 +838,7 @@ PoolVector<Vector3> EditorSceneImporterGLTF::_decode_accessor_as_vec3(GLTFState const int ret_size = attribs.size() / 3; ret.resize(ret_size); { - PoolVector<Vector3>::Write w = ret.write(); + Vector3 *w = ret.ptrw(); for (int i = 0; i < ret_size; i++) { w[i] = Vector3(attribs_ptr[i * 3 + 0], attribs_ptr[i * 3 + 1], attribs_ptr[i * 3 + 2]); } @@ -846,10 +846,10 @@ PoolVector<Vector3> EditorSceneImporterGLTF::_decode_accessor_as_vec3(GLTFState return ret; } -PoolVector<Color> EditorSceneImporterGLTF::_decode_accessor_as_color(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex) { +Vector<Color> EditorSceneImporterGLTF::_decode_accessor_as_color(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex) { const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex); - PoolVector<Color> ret; + Vector<Color> ret; if (attribs.size() == 0) return ret; @@ -866,7 +866,7 @@ PoolVector<Color> EditorSceneImporterGLTF::_decode_accessor_as_color(GLTFState & const int ret_size = attribs.size() / vec_len; ret.resize(ret_size); { - PoolVector<Color>::Write w = ret.write(); + Color *w = ret.ptrw(); for (int i = 0; i < ret_size; i++) { w[i] = Color(attribs_ptr[i * vec_len + 0], attribs_ptr[i * vec_len + 1], attribs_ptr[i * vec_len + 2], vec_len == 4 ? attribs_ptr[i * 4 + 3] : 1.0); } @@ -1021,10 +1021,10 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { array[Mesh::ARRAY_BONES] = _decode_accessor_as_ints(state, a["JOINTS_0"], true); } if (a.has("WEIGHTS_0")) { - PoolVector<float> weights = _decode_accessor_as_floats(state, a["WEIGHTS_0"], true); + Vector<float> weights = _decode_accessor_as_floats(state, a["WEIGHTS_0"], true); { //gltf does not seem to normalize the weights for some reason.. int wc = weights.size(); - PoolVector<float>::Write w = weights.write(); + float *w = weights.ptrw(); for (int k = 0; k < wc; k += 4) { float total = 0.0; @@ -1044,13 +1044,13 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { } if (p.has("indices")) { - PoolVector<int> indices = _decode_accessor_as_ints(state, p["indices"], false); + Vector<int> indices = _decode_accessor_as_ints(state, p["indices"], false); if (primitive == Mesh::PRIMITIVE_TRIANGLES) { //swap around indices, convert ccw to cw for front face const int is = indices.size(); - const PoolVector<int>::Write w = indices.write(); + int *w = indices.ptrw(); for (int k = 0; k < is; k += 3) { SWAP(w[k + 1], w[k + 2]); } @@ -1059,13 +1059,13 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { } else if (primitive == Mesh::PRIMITIVE_TRIANGLES) { //generate indices because they need to be swapped for CW/CCW - const PoolVector<Vector3> &vertices = array[Mesh::ARRAY_VERTEX]; + const Vector<Vector3> &vertices = array[Mesh::ARRAY_VERTEX]; ERR_FAIL_COND_V(vertices.size() == 0, ERR_PARSE_ERROR); - PoolVector<int> indices; + Vector<int> indices; const int vs = vertices.size(); indices.resize(vs); { - const PoolVector<int>::Write w = indices.write(); + int *w = indices.ptrw(); for (int k = 0; k < vs; k += 3) { w[k] = k; w[k + 1] = k + 2; @@ -1127,8 +1127,8 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { array_copy[Mesh::ARRAY_INDEX] = Variant(); if (t.has("POSITION")) { - PoolVector<Vector3> varr = _decode_accessor_as_vec3(state, t["POSITION"], true); - const PoolVector<Vector3> src_varr = array[Mesh::ARRAY_VERTEX]; + Vector<Vector3> varr = _decode_accessor_as_vec3(state, t["POSITION"], true); + const Vector<Vector3> src_varr = array[Mesh::ARRAY_VERTEX]; const int size = src_varr.size(); ERR_FAIL_COND_V(size == 0, ERR_PARSE_ERROR); { @@ -1136,9 +1136,9 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { const int max_idx = varr.size(); varr.resize(size); - const PoolVector<Vector3>::Write w_varr = varr.write(); - const PoolVector<Vector3>::Read r_varr = varr.read(); - const PoolVector<Vector3>::Read r_src_varr = src_varr.read(); + Vector3 *w_varr = varr.ptrw(); + const Vector3 *r_varr = varr.ptr(); + const Vector3 *r_src_varr = src_varr.ptr(); for (int l = 0; l < size; l++) { if (l < max_idx) { w_varr[l] = r_varr[l] + r_src_varr[l]; @@ -1150,17 +1150,17 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { array_copy[Mesh::ARRAY_VERTEX] = varr; } if (t.has("NORMAL")) { - PoolVector<Vector3> narr = _decode_accessor_as_vec3(state, t["NORMAL"], true); - const PoolVector<Vector3> src_narr = array[Mesh::ARRAY_NORMAL]; + Vector<Vector3> narr = _decode_accessor_as_vec3(state, t["NORMAL"], true); + const Vector<Vector3> src_narr = array[Mesh::ARRAY_NORMAL]; int size = src_narr.size(); ERR_FAIL_COND_V(size == 0, ERR_PARSE_ERROR); { int max_idx = narr.size(); narr.resize(size); - const PoolVector<Vector3>::Write w_narr = narr.write(); - const PoolVector<Vector3>::Read r_narr = narr.read(); - const PoolVector<Vector3>::Read r_src_narr = src_narr.read(); + Vector3 *w_narr = narr.ptrw(); + const Vector3 *r_narr = narr.ptr(); + const Vector3 *r_src_narr = src_narr.ptr(); for (int l = 0; l < size; l++) { if (l < max_idx) { w_narr[l] = r_narr[l] + r_src_narr[l]; @@ -1172,11 +1172,11 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { array_copy[Mesh::ARRAY_NORMAL] = narr; } if (t.has("TANGENT")) { - const PoolVector<Vector3> tangents_v3 = _decode_accessor_as_vec3(state, t["TANGENT"], true); - const PoolVector<float> src_tangents = array[Mesh::ARRAY_TANGENT]; + const Vector<Vector3> tangents_v3 = _decode_accessor_as_vec3(state, t["TANGENT"], true); + const Vector<float> src_tangents = array[Mesh::ARRAY_TANGENT]; ERR_FAIL_COND_V(src_tangents.size() == 0, ERR_PARSE_ERROR); - PoolVector<float> tangents_v4; + Vector<float> tangents_v4; { @@ -1184,10 +1184,10 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) { int size4 = src_tangents.size(); tangents_v4.resize(size4); - const PoolVector<float>::Write w4 = tangents_v4.write(); + float *w4 = tangents_v4.ptrw(); - const PoolVector<Vector3>::Read r3 = tangents_v3.read(); - const PoolVector<float>::Read r4 = src_tangents.read(); + const Vector3 *r3 = tangents_v3.ptr(); + const float *r4 = src_tangents.ptr(); for (int l = 0; l < size4 / 4; l++) { @@ -2397,9 +2397,9 @@ Error EditorSceneImporterGLTF::_parse_animations(GLTFState &state) { } } - const PoolVector<float> times = _decode_accessor_as_floats(state, input, false); + const Vector<float> times = _decode_accessor_as_floats(state, input, false); if (path == "translation") { - const PoolVector<Vector3> translations = _decode_accessor_as_vec3(state, output, false); + const Vector<Vector3> translations = _decode_accessor_as_vec3(state, output, false); track->translation_track.interpolation = interp; track->translation_track.times = Variant(times); //convert via variant track->translation_track.values = Variant(translations); //convert via variant @@ -2409,12 +2409,12 @@ Error EditorSceneImporterGLTF::_parse_animations(GLTFState &state) { track->rotation_track.times = Variant(times); //convert via variant track->rotation_track.values = rotations; //convert via variant } else if (path == "scale") { - const PoolVector<Vector3> scales = _decode_accessor_as_vec3(state, output, false); + const Vector<Vector3> scales = _decode_accessor_as_vec3(state, output, false); track->scale_track.interpolation = interp; track->scale_track.times = Variant(times); //convert via variant track->scale_track.values = Variant(scales); //convert via variant } else if (path == "weights") { - const PoolVector<float> weights = _decode_accessor_as_floats(state, output, false); + const Vector<float> weights = _decode_accessor_as_floats(state, output, false); ERR_FAIL_INDEX_V(state.nodes[node]->mesh, state.meshes.size(), ERR_PARSE_ERROR); const GLTFMesh *mesh = &state.meshes[state.nodes[node]->mesh]; @@ -2427,7 +2427,7 @@ Error EditorSceneImporterGLTF::_parse_animations(GLTFState &state) { ERR_FAIL_COND_V_MSG(weights.size() != expected_value_count, ERR_PARSE_ERROR, "Invalid weight data, expected " + itos(expected_value_count) + " weight values, got " + itos(weights.size()) + " instead."); const int wlen = weights.size() / wc; - PoolVector<float>::Read r = weights.read(); + const float *r = weights.ptr(); for (int k = 0; k < wc; k++) { //separate tracks, having them together is not such a good idea GLTFAnimation::Channel<float> cf; cf.interpolation = interp; diff --git a/editor/import/editor_scene_importer_gltf.h b/editor/import/editor_scene_importer_gltf.h index a4a715d17c..72d5b04e67 100644 --- a/editor/import/editor_scene_importer_gltf.h +++ b/editor/import/editor_scene_importer_gltf.h @@ -352,11 +352,11 @@ class EditorSceneImporterGLTF : public EditorSceneImporter { Error _decode_buffer_view(GLTFState &state, double *dst, const GLTFBufferViewIndex p_buffer_view, const int skip_every, const int skip_bytes, const int element_size, const int count, const GLTFType type, const int component_count, const int component_type, const int component_size, const bool normalized, const int byte_offset, const bool for_vertex); Vector<double> _decode_accessor(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex); - PoolVector<float> _decode_accessor_as_floats(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex); - PoolVector<int> _decode_accessor_as_ints(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex); - PoolVector<Vector2> _decode_accessor_as_vec2(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex); - PoolVector<Vector3> _decode_accessor_as_vec3(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex); - PoolVector<Color> _decode_accessor_as_color(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex); + Vector<float> _decode_accessor_as_floats(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex); + Vector<int> _decode_accessor_as_ints(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex); + Vector<Vector2> _decode_accessor_as_vec2(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex); + Vector<Vector3> _decode_accessor_as_vec3(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex); + Vector<Color> _decode_accessor_as_color(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex); Vector<Quat> _decode_accessor_as_quat(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex); Vector<Transform2D> _decode_accessor_as_xform2d(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex); Vector<Basis> _decode_accessor_as_basis(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex); diff --git a/editor/import/resource_importer_bitmask.cpp b/editor/import/resource_importer_bitmask.cpp index c6fdbd1378..22989b81e4 100644 --- a/editor/import/resource_importer_bitmask.cpp +++ b/editor/import/resource_importer_bitmask.cpp @@ -94,7 +94,6 @@ Error ResourceImporterBitMap::import(const String &p_source_file, const String & Ref<BitMap> bitmap; bitmap.instance(); bitmap->create(Size2(w, h)); - image->lock(); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { diff --git a/editor/import/resource_importer_layered_texture.cpp b/editor/import/resource_importer_layered_texture.cpp index 9ea2911c63..d472070808 100644 --- a/editor/import/resource_importer_layered_texture.cpp +++ b/editor/import/resource_importer_layered_texture.cpp @@ -187,11 +187,11 @@ void ResourceImporterLayeredTexture::_save_tex(const Vector<Ref<Image> > &p_imag image->shrink_x2(); } - PoolVector<uint8_t> data = Image::lossless_packer(image); + Vector<uint8_t> data = Image::lossless_packer(image); int data_len = data.size(); f->store_32(data_len); - PoolVector<uint8_t>::Read r = data.read(); + const uint8_t* r = data.ptr(); f->store_buffer(r.ptr(), data_len); } @@ -210,10 +210,10 @@ void ResourceImporterLayeredTexture::_save_tex(const Vector<Ref<Image> > &p_imag f->store_32(p_compress_mode); // 0 - lossless (PNG), 1 - vram, 2 - uncompressed } - PoolVector<uint8_t> data = image->get_data(); + Vector<uint8_t> data = image->get_data(); int dl = data.size(); - PoolVector<uint8_t>::Read r = data.read(); + const uint8_t* r = data.ptr(); f->store_buffer(r.ptr(), dl); } break; case COMPRESS_UNCOMPRESSED: { @@ -226,10 +226,10 @@ void ResourceImporterLayeredTexture::_save_tex(const Vector<Ref<Image> > &p_imag image->clear_mipmaps(); } - PoolVector<uint8_t> data = image->get_data(); + Vector<uint8_t> data = image->get_data(); int dl = data.size(); - PoolVector<uint8_t>::Read r = data.read(); + const uint8_t* r = data.ptr(); f->store_buffer(r.ptr(), dl); diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index aa7346efe8..7144bc04c8 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -242,12 +242,12 @@ void ResourceImporterTexture::save_to_stex_format(FileAccess *f, const Ref<Image for (int i = 0; i < p_image->get_mipmap_count() + 1; i++) { - PoolVector<uint8_t> data = Image::lossless_packer(p_image->get_image_from_mipmap(i)); + Vector<uint8_t> data = Image::lossless_packer(p_image->get_image_from_mipmap(i)); int data_len = data.size(); f->store_32(data_len); - PoolVector<uint8_t>::Read r = data.read(); - f->store_buffer(r.ptr(), data_len); + const uint8_t *r = data.ptr(); + f->store_buffer(r, data_len); } } break; @@ -261,12 +261,12 @@ void ResourceImporterTexture::save_to_stex_format(FileAccess *f, const Ref<Image for (int i = 0; i < p_image->get_mipmap_count() + 1; i++) { - PoolVector<uint8_t> data = Image::lossy_packer(p_image->get_image_from_mipmap(i), p_lossy_quality); + Vector<uint8_t> data = Image::lossy_packer(p_image->get_image_from_mipmap(i), p_lossy_quality); int data_len = data.size(); f->store_32(data_len); - PoolVector<uint8_t>::Read r = data.read(); - f->store_buffer(r.ptr(), data_len); + const uint8_t *r = data.ptr(); + f->store_buffer(r, data_len); } } break; case COMPRESS_VRAM_COMPRESSED: { @@ -285,10 +285,10 @@ void ResourceImporterTexture::save_to_stex_format(FileAccess *f, const Ref<Image f->store_32(image->get_mipmap_count()); f->store_32(image->get_format()); - PoolVector<uint8_t> data = image->get_data(); + Vector<uint8_t> data = image->get_data(); int dl = data.size(); - PoolVector<uint8_t>::Read r = data.read(); - f->store_buffer(r.ptr(), dl); + const uint8_t *r = data.ptr(); + f->store_buffer(r, dl); } break; case COMPRESS_VRAM_UNCOMPRESSED: { @@ -298,11 +298,11 @@ void ResourceImporterTexture::save_to_stex_format(FileAccess *f, const Ref<Image f->store_32(p_image->get_mipmap_count()); f->store_32(p_image->get_format()); - PoolVector<uint8_t> data = p_image->get_data(); + Vector<uint8_t> data = p_image->get_data(); int dl = data.size(); - PoolVector<uint8_t>::Read r = data.read(); + const uint8_t *r = data.ptr(); - f->store_buffer(r.ptr(), dl); + f->store_buffer(r, dl); } break; case COMPRESS_BASIS_UNIVERSAL: { @@ -315,12 +315,12 @@ void ResourceImporterTexture::save_to_stex_format(FileAccess *f, const Ref<Image for (int i = 0; i < p_image->get_mipmap_count() + 1; i++) { - PoolVector<uint8_t> data = Image::basis_universal_packer(p_image->get_image_from_mipmap(i), p_channels); + Vector<uint8_t> data = Image::basis_universal_packer(p_image->get_image_from_mipmap(i), p_channels); int data_len = data.size(); f->store_32(data_len); - PoolVector<uint8_t>::Read r = data.read(); - f->store_buffer(r.ptr(), data_len); + const uint8_t *r = data.ptr(); + f->store_buffer(r, data_len); } } break; } @@ -476,13 +476,11 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String int height = image->get_height(); int width = image->get_width(); - image->lock(); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { image->set_pixel(i, j, image->get_pixel(i, j).inverted()); } } - image->unlock(); } if (compress_mode == COMPRESS_BASIS_UNIVERSAL && image->get_format() >= Image::FORMAT_RF) { diff --git a/editor/import/resource_importer_texture_atlas.cpp b/editor/import/resource_importer_texture_atlas.cpp index 00a25ec886..4291d6f2d7 100644 --- a/editor/import/resource_importer_texture_atlas.cpp +++ b/editor/import/resource_importer_texture_atlas.cpp @@ -286,12 +286,10 @@ Error ResourceImporterTextureAtlas::import_group_file(const String &p_group_file new_atlas.instance(); new_atlas->create(atlas_width, atlas_height, false, Image::FORMAT_RGBA8); - new_atlas->lock(); - for (int i = 0; i < pack_data_files.size(); i++) { PackData &pack_data = pack_data_files.write[i]; - pack_data.image->lock(); + for (int j = 0; j < pack_data.chart_pieces.size(); j++) { const EditorAtlasPacker::Chart &chart = charts[pack_data.chart_pieces[j]]; for (int k = 0; k < chart.faces.size(); k++) { @@ -304,9 +302,7 @@ Error ResourceImporterTextureAtlas::import_group_file(const String &p_group_file _plot_triangle(positions, chart.final_offset, chart.transposed, new_atlas, pack_data.image); } } - pack_data.image->unlock(); } - new_atlas->unlock(); //save the atlas @@ -350,9 +346,9 @@ Error ResourceImporterTextureAtlas::import_group_file(const String &p_group_file for (int i = 0; i < pack_data.chart_pieces.size(); i++) { const EditorAtlasPacker::Chart &chart = charts[pack_data.chart_pieces[i]]; - PoolVector<Vector2> vertices; - PoolVector<int> indices; - PoolVector<Vector2> uvs; + Vector<Vector2> vertices; + Vector<int> indices; + Vector<Vector2> uvs; int vc = chart.vertices.size(); int fc = chart.faces.size(); vertices.resize(vc); @@ -360,9 +356,9 @@ Error ResourceImporterTextureAtlas::import_group_file(const String &p_group_file indices.resize(fc * 3); { - PoolVector<Vector2>::Write vw = vertices.write(); - PoolVector<int>::Write iw = indices.write(); - PoolVector<Vector2>::Write uvw = uvs.write(); + Vector2 *vw = vertices.ptrw(); + int *iw = indices.ptrw(); + Vector2 *uvw = uvs.ptrw(); for (int j = 0; j < vc; j++) { vw[j] = chart.vertices[j]; diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp index 2d43fa089d..b65209d204 100644 --- a/editor/import/resource_importer_wav.cpp +++ b/editor/import/resource_importer_wav.cpp @@ -467,7 +467,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s is16 = false; } - PoolVector<uint8_t> dst_data; + Vector<uint8_t> dst_data; AudioStreamSample::Format dst_format; if (compression == 1) { @@ -490,8 +490,8 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s right.write[i] = data[i * 2 + 1]; } - PoolVector<uint8_t> bleft; - PoolVector<uint8_t> bright; + Vector<uint8_t> bleft; + Vector<uint8_t> bright; _compress_ima_adpcm(left, bleft); _compress_ima_adpcm(right, bright); @@ -499,9 +499,9 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s int dl = bleft.size(); dst_data.resize(dl * 2); - PoolVector<uint8_t>::Write w = dst_data.write(); - PoolVector<uint8_t>::Read rl = bleft.read(); - PoolVector<uint8_t>::Read rr = bright.read(); + uint8_t *w = dst_data.ptrw(); + const uint8_t *rl = bleft.ptr(); + const uint8_t *rr = bright.ptr(); for (int i = 0; i < dl; i++) { w[i * 2 + 0] = rl[i]; @@ -514,7 +514,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s dst_format = is16 ? AudioStreamSample::FORMAT_16_BITS : AudioStreamSample::FORMAT_8_BITS; dst_data.resize(data.size() * (is16 ? 2 : 1)); { - PoolVector<uint8_t>::Write w = dst_data.write(); + uint8_t *w = dst_data.ptrw(); int ds = data.size(); for (int i = 0; i < ds; i++) { diff --git a/editor/import/resource_importer_wav.h b/editor/import/resource_importer_wav.h index 59d33feef0..6df5b88b13 100644 --- a/editor/import/resource_importer_wav.h +++ b/editor/import/resource_importer_wav.h @@ -49,7 +49,7 @@ public: virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const; virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const; - static void _compress_ima_adpcm(const Vector<float> &p_data, PoolVector<uint8_t> &dst_data) { + static void _compress_ima_adpcm(const Vector<float> &p_data, Vector<uint8_t> &dst_data) { /*p_sample_data->data = (void*)malloc(len); xm_s8 *dataptr=(xm_s8*)p_sample_data->data;*/ @@ -76,10 +76,10 @@ public: datalen++; dst_data.resize(datalen / 2 + 4); - PoolVector<uint8_t>::Write w = dst_data.write(); + uint8_t *w = dst_data.ptrw(); int i, step_idx = 0, prev = 0; - uint8_t *out = w.ptr(); + uint8_t *out = w; //int16_t xm_prev=0; const float *in = p_data.ptr(); diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index b2d132b3da..2d038d11ad 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -150,7 +150,7 @@ void AbstractPolygon2DEditor::_action_add_polygon(const Variant &p_polygon) { void AbstractPolygon2DEditor::_action_remove_polygon(int p_idx) { - _action_set_polygon(p_idx, _get_polygon(p_idx), PoolVector<Vector2>()); + _action_set_polygon(p_idx, _get_polygon(p_idx), Vector<Vector2>()); } void AbstractPolygon2DEditor::_action_set_polygon(int p_idx, const Variant &p_polygon) { @@ -256,7 +256,7 @@ void AbstractPolygon2DEditor::_wip_close() { undo_redo->create_action(TTR("Create Polygon")); _action_add_polygon(wip); if (_has_uv()) { - undo_redo->add_do_method(_get_node(), "set_uv", PoolVector<Vector2>()); + undo_redo->add_do_method(_get_node(), "set_uv", Vector<Vector2>()); undo_redo->add_undo_method(_get_node(), "set_uv", _get_node()->get("uv")); } _commit_action(); @@ -584,7 +584,7 @@ void AbstractPolygon2DEditor::forward_canvas_draw_over_viewport(Control *p_overl if (wip_active && wip_destructive && j != -1) continue; - PoolVector<Vector2> points; + Vector<Vector2> points; Vector2 offset; if (wip_active && j == edited_point.polygon) { @@ -703,7 +703,7 @@ void AbstractPolygon2DEditor::_bind_methods() { void AbstractPolygon2DEditor::remove_point(const Vertex &p_vertex) { - PoolVector<Vector2> vertices = _get_polygon(p_vertex.polygon); + Vector<Vector2> vertices = _get_polygon(p_vertex.polygon); if (vertices.size() > (_is_line() ? 2 : 3)) { @@ -744,7 +744,7 @@ AbstractPolygon2DEditor::PosVertex AbstractPolygon2DEditor::closest_point(const for (int j = 0; j < n_polygons; j++) { - PoolVector<Vector2> points = _get_polygon(j); + Vector<Vector2> points = _get_polygon(j); const Vector2 offset = _get_offset(j); const int n_points = points.size(); @@ -777,7 +777,7 @@ AbstractPolygon2DEditor::PosVertex AbstractPolygon2DEditor::closest_edge_point(c for (int j = 0; j < n_polygons; j++) { - PoolVector<Vector2> points = _get_polygon(j); + Vector<Vector2> points = _get_polygon(j); const Vector2 offset = _get_offset(j); const int n_points = points.size(); const int n_segments = n_points - (_is_line() ? 1 : 0); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index a479703527..3d47dd46db 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -166,9 +166,8 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const // Overlay and thumbnail need the same format for `blend_rect` to work. thumbnail->convert(Image::FORMAT_RGBA8); - thumbnail->lock(); + thumbnail->blend_rect(overlay, overlay->get_used_rect(), overlay_pos); - thumbnail->unlock(); Ref<ImageTexture> tex; tex.instance(); @@ -322,7 +321,7 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() { } /////////////////////////////////////////////////////////////////////////////////// -void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data) { +void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data) { String error_text; @@ -710,12 +709,12 @@ void EditorAssetLibrary::_select_asset(int p_id) { _api_request("asset/" + itos(p_id), REQUESTING_ASSET); } -void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByteArray &p_data, int p_queue_id) { +void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PackedByteArray &p_data, int p_queue_id) { Object *obj = ObjectDB::get_instance(image_queue[p_queue_id].target); if (obj) { bool image_set = false; - PoolByteArray image_data = p_data; + PackedByteArray image_data = p_data; if (use_cache) { String cache_filename_base = EditorSettings::get_singleton()->get_cache_dir().plus_file("assetimage_" + image_queue[p_queue_id].image_url.md5_text()); @@ -723,12 +722,12 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt FileAccess *file = FileAccess::open(cache_filename_base + ".data", FileAccess::READ); if (file) { - PoolByteArray cached_data; + PackedByteArray cached_data; int len = file->get_32(); cached_data.resize(len); - PoolByteArray::Write w = cached_data.write(); - file->get_buffer(w.ptr(), len); + uint8_t *w = cached_data.ptrw(); + file->get_buffer(w, len); image_data = cached_data; file->close(); @@ -737,17 +736,17 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt } int len = image_data.size(); - PoolByteArray::Read r = image_data.read(); + const uint8_t *r = image_data.ptr(); Ref<Image> image = Ref<Image>(memnew(Image)); uint8_t png_signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 }; uint8_t jpg_signature[3] = { 255, 216, 255 }; - if (r.ptr()) { + if (r) { if ((memcmp(&r[0], &png_signature[0], 8) == 0) && Image::_png_mem_loader_func) { - image->copy_internals_from(Image::_png_mem_loader_func(r.ptr(), len)); + image->copy_internals_from(Image::_png_mem_loader_func(r, len)); } else if ((memcmp(&r[0], &jpg_signature[0], 3) == 0) && Image::_jpg_mem_loader_func) { - image->copy_internals_from(Image::_jpg_mem_loader_func(r.ptr(), len)); + image->copy_internals_from(Image::_jpg_mem_loader_func(r, len)); } } @@ -790,7 +789,7 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt } } -void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data, int p_queue_id) { +void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data, int p_queue_id) { ERR_FAIL_COND(!image_queue.has(p_queue_id)); @@ -811,11 +810,11 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons } int len = p_data.size(); - PoolByteArray::Read r = p_data.read(); + const uint8_t *r = p_data.ptr(); file = FileAccess::open(cache_filename_base + ".data", FileAccess::WRITE); if (file) { file->store_32(len); - file->store_buffer(r.ptr(), len); + file->store_buffer(r, len); file->close(); memdelete(file); } @@ -899,7 +898,7 @@ void EditorAssetLibrary::_request_image(ObjectID p_for, String p_image_url, Imag add_child(iq.request); - _image_update(true, false, PoolByteArray(), iq.queue_id); + _image_update(true, false, PackedByteArray(), iq.queue_id); _update_image_queue(); } @@ -1068,14 +1067,14 @@ void EditorAssetLibrary::_api_request(const String &p_request, RequestType p_req request->request(host + "/" + p_request + p_arguments); } -void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data) { +void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data) { String str; { int datalen = p_data.size(); - PoolByteArray::Read r = p_data.read(); - str.parse_utf8((const char *)r.ptr(), datalen); + const uint8_t *r = p_data.ptr(); + str.parse_utf8((const char *)r, datalen); } bool error_abort = true; diff --git a/editor/plugins/asset_library_editor_plugin.h b/editor/plugins/asset_library_editor_plugin.h index e13d8a6149..536a855d03 100644 --- a/editor/plugins/asset_library_editor_plugin.h +++ b/editor/plugins/asset_library_editor_plugin.h @@ -156,7 +156,7 @@ class EditorAssetLibraryItemDownload : public PanelContainer { void _close(); void _install(); void _make_request(); - void _http_download_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data); + void _http_download_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data); protected: void _notification(int p_what); @@ -250,8 +250,8 @@ class EditorAssetLibrary : public PanelContainer { int last_queue_id; Map<int, ImageQueue> image_queue; - void _image_update(bool use_cache, bool final, const PoolByteArray &p_data, int p_queue_id); - void _image_request_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data, int p_queue_id); + void _image_update(bool use_cache, bool final, const PackedByteArray &p_data, int p_queue_id); + void _image_request_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data, int p_queue_id); void _request_image(ObjectID p_for, String p_image_url, ImageType p_type, int p_image_index); void _update_image_queue(); @@ -286,8 +286,8 @@ class EditorAssetLibrary : public PanelContainer { void _rerun_search(int p_ignore); void _search_text_entered(const String &p_text = ""); void _api_request(const String &p_request, RequestType p_request_type, const String &p_arguments = ""); - void _http_request_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data); - void _http_download_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data); + void _http_request_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data); + void _http_download_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data); void _repository_changed(int p_repository_id); void _support_toggled(int p_support); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index f7a3b50052..3ab7fdb39c 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -5987,7 +5987,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String & if (default_type == "NinePatchRect") { editor_data->get_undo_redo().add_do_property(child, "rect/size", texture_size); } else if (default_type == "Polygon2D") { - PoolVector<Vector2> list; + Vector<Vector2> list; list.push_back(Vector2(0, 0)); list.push_back(Vector2(texture_size.width, 0)); list.push_back(Vector2(texture_size.width, texture_size.height)); diff --git a/editor/plugins/collision_polygon_editor_plugin.cpp b/editor/plugins/collision_polygon_editor_plugin.cpp index 3de67589ee..9aa9b6cda5 100644 --- a/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/editor/plugins/collision_polygon_editor_plugin.cpp @@ -470,11 +470,11 @@ void Polygon3DEditor::_polygon_draw() { Array a; a.resize(Mesh::ARRAY_MAX); - PoolVector<Vector3> va; + Vector<Vector3> va; { va.resize(poly.size()); - PoolVector<Vector3>::Write w = va.write(); + Vector3 *w = va.ptrw(); for (int i = 0; i < poly.size(); i++) { Vector2 p, p2; diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp index 655048c271..80f5e26d48 100644 --- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp @@ -118,8 +118,8 @@ void CPUParticles2DEditorPlugin::_generate_emission_mask() { int vpc = 0; { - PoolVector<uint8_t> data = img->get_data(); - PoolVector<uint8_t>::Read r = data.read(); + Vector<uint8_t> data = img->get_data(); + const uint8_t *r = data.ptr(); for (int i = 0; i < s.width; i++) { for (int j = 0; j < s.height; j++) { @@ -198,9 +198,9 @@ void CPUParticles2DEditorPlugin::_generate_emission_mask() { ERR_FAIL_COND_MSG(valid_positions.size() == 0, "No pixels with transparency > 128 in image..."); if (capture_colors) { - PoolColorArray pca; + PackedColorArray pca; pca.resize(vpc); - PoolColorArray::Write pcaw = pca.write(); + Color *pcaw = pca.ptrw(); for (int i = 0; i < vpc; i += 1) { Color color; color.r = valid_colors[i * 4 + 0] / 255.0f; @@ -214,9 +214,9 @@ void CPUParticles2DEditorPlugin::_generate_emission_mask() { if (valid_normals.size()) { particles->set_emission_shape(CPUParticles2D::EMISSION_SHAPE_DIRECTED_POINTS); - PoolVector2Array norms; + PackedVector2Array norms; norms.resize(valid_normals.size()); - PoolVector2Array::Write normsw = norms.write(); + Vector2 *normsw = norms.ptrw(); for (int i = 0; i < valid_normals.size(); i += 1) { normsw[i] = valid_normals[i]; } @@ -226,9 +226,9 @@ void CPUParticles2DEditorPlugin::_generate_emission_mask() { } { - PoolVector2Array points; + PackedVector2Array points; points.resize(valid_positions.size()); - PoolVector2Array::Write pointsw = points.write(); + Vector2 *pointsw = points.ptrw(); for (int i = 0; i < valid_positions.size(); i += 1) { pointsw[i] = valid_positions[i]; } diff --git a/editor/plugins/cpu_particles_editor_plugin.cpp b/editor/plugins/cpu_particles_editor_plugin.cpp index 2074ba6b99..be3e9cd8e0 100644 --- a/editor/plugins/cpu_particles_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_editor_plugin.cpp @@ -80,8 +80,8 @@ void CPUParticlesEditor::edit(CPUParticles *p_particles) { void CPUParticlesEditor::_generate_emission_points() { /// hacer codigo aca - PoolVector<Vector3> points; - PoolVector<Vector3> normals; + Vector<Vector3> points; + Vector<Vector3> normals; if (!_generate(points, normals)) { return; diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 0af983f780..62a3ff9b58 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -802,8 +802,6 @@ Ref<Texture2D> CurvePreviewGenerator::generate(const Ref<Resource> &p_from, cons im.create(thumbnail_size, thumbnail_size / 2, 0, Image::FORMAT_RGBA8); - im.lock(); - Color bg_color(0.1, 0.1, 0.1, 1.0); for (int i = 0; i < thumbnail_size; i++) { for (int j = 0; j < thumbnail_size / 2; j++) { @@ -844,8 +842,6 @@ Ref<Texture2D> CurvePreviewGenerator::generate(const Ref<Resource> &p_from, cons prev_y = y; } - im.unlock(); - Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture)); ptex->create_from_image(img_ref); diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 6e8aef0aea..3c173ab783 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -47,8 +47,6 @@ void post_process_preview(Ref<Image> p_image) { if (p_image->get_format() != Image::FORMAT_RGBA8) p_image->convert(Image::FORMAT_RGBA8); - p_image->lock(); - const int w = p_image->get_width(); const int h = p_image->get_height(); @@ -70,8 +68,6 @@ void post_process_preview(Ref<Image> p_image) { } } } - - p_image->unlock(); } bool EditorTexturePreviewPlugin::handles(const String &p_type) const { @@ -207,19 +203,19 @@ Ref<Texture2D> EditorBitmapPreviewPlugin::generate(const RES &p_from, const Size return Ref<Texture2D>(); } - PoolVector<uint8_t> data; + Vector<uint8_t> data; data.resize(bm->get_size().width * bm->get_size().height); { - PoolVector<uint8_t>::Write w = data.write(); + uint8_t *w = data.ptrw(); for (int i = 0; i < bm->get_size().width; i++) { for (int j = 0; j < bm->get_size().height; j++) { if (bm->get_bit(Point2i(i, j))) { - w[j * bm->get_size().width + i] = 255; + w[j * (int)bm->get_size().width + i] = 255; } else { - w[j * bm->get_size().width + i] = 0; + w[j * (int)bm->get_size().width + i] = 0; } } } @@ -396,10 +392,10 @@ EditorMaterialPreviewPlugin::EditorMaterialPreviewPlugin() { int lons = 32; float radius = 1.0; - PoolVector<Vector3> vertices; - PoolVector<Vector3> normals; - PoolVector<Vector2> uvs; - PoolVector<float> tangents; + Vector<Vector3> vertices; + Vector<Vector3> normals; + Vector<Vector2> uvs; + Vector<float> tangents; Basis tt = Basis(Vector3(0, 1, 0), Math_PI * 0.5); for (int i = 1; i <= lats; i++) { @@ -522,8 +518,6 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const RES &p_from, const Size Color text_color = EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"); Color symbol_color = EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"); - img->lock(); - if (bg_color.a == 0) bg_color = Color(0, 0, 0, 0); bg_color.a = MAX(bg_color.a, 0.2); // some background @@ -593,8 +587,6 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const RES &p_from, const Size col++; } - img->unlock(); - post_process_preview(img); Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture)); @@ -617,14 +609,14 @@ Ref<Texture2D> EditorAudioStreamPreviewPlugin::generate(const RES &p_from, const Ref<AudioStream> stream = p_from; ERR_FAIL_COND_V(stream.is_null(), Ref<Texture2D>()); - PoolVector<uint8_t> img; + Vector<uint8_t> img; int w = p_size.x; int h = p_size.y; img.resize(w * h * 3); - PoolVector<uint8_t>::Write imgdata = img.write(); - uint8_t *imgw = imgdata.ptr(); + uint8_t *imgdata = img.ptrw(); + uint8_t *imgw = imgdata; Ref<AudioStreamPlayback> playback = stream->instance_playback(); ERR_FAIL_COND_V(playback.is_null(), Ref<Texture2D>()); @@ -680,7 +672,6 @@ Ref<Texture2D> EditorAudioStreamPreviewPlugin::generate(const RES &p_from, const } } - imgdata.release(); //post_process_preview(img); Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture)); diff --git a/editor/plugins/mesh_instance_editor_plugin.cpp b/editor/plugins/mesh_instance_editor_plugin.cpp index aaba6406c7..574646956e 100644 --- a/editor/plugins/mesh_instance_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_editor_plugin.cpp @@ -327,24 +327,24 @@ void MeshInstanceEditor::_create_uv_lines(int p_layer) { continue; Array a = mesh->surface_get_arrays(i); - PoolVector<Vector2> uv = a[p_layer == 0 ? Mesh::ARRAY_TEX_UV : Mesh::ARRAY_TEX_UV2]; + Vector<Vector2> uv = a[p_layer == 0 ? Mesh::ARRAY_TEX_UV : Mesh::ARRAY_TEX_UV2]; if (uv.size() == 0) { err_dialog->set_text(TTR("Model has no UV in this layer")); err_dialog->popup_centered_minsize(); return; } - PoolVector<Vector2>::Read r = uv.read(); + const Vector2 *r = uv.ptr(); - PoolVector<int> indices = a[Mesh::ARRAY_INDEX]; - PoolVector<int>::Read ri; + Vector<int> indices = a[Mesh::ARRAY_INDEX]; + const int *ri; int ic; bool use_indices; if (indices.size()) { ic = indices.size(); - ri = indices.read(); + ri = indices.ptr(); use_indices = true; } else { ic = uv.size(); diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index ddd27b5e97..4b7fd6399b 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -124,7 +124,7 @@ void MultiMeshEditor::_populate() { Transform geom_xform = node->get_global_transform().affine_inverse() * ss_instance->get_global_transform(); - PoolVector<Face3> geometry = ss_instance->get_faces(VisualInstance::FACES_SOLID); + Vector<Face3> geometry = ss_instance->get_faces(VisualInstance::FACES_SOLID); if (geometry.size() == 0) { @@ -136,7 +136,7 @@ void MultiMeshEditor::_populate() { //make all faces local int gc = geometry.size(); - PoolVector<Face3>::Write w = geometry.write(); + Face3 *w = geometry.ptrw(); for (int i = 0; i < gc; i++) { for (int j = 0; j < 3; j++) { @@ -144,13 +144,11 @@ void MultiMeshEditor::_populate() { } } - w.release(); - - PoolVector<Face3> faces = geometry; + Vector<Face3> faces = geometry; int facecount = faces.size(); ERR_FAIL_COND_MSG(!facecount, "Parent has no solid faces to populate."); - PoolVector<Face3>::Read r = faces.read(); + const Face3 *r = faces.ptr(); float area_accum = 0; Map<float, int> triangle_area_map; diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index 3a48673d8e..2e149a0f65 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -191,8 +191,8 @@ void Particles2DEditorPlugin::_generate_emission_mask() { int vpc = 0; { - PoolVector<uint8_t> data = img->get_data(); - PoolVector<uint8_t>::Read r = data.read(); + Vector<uint8_t> data = img->get_data(); + const uint8_t *r = data.ptr(); for (int i = 0; i < s.width; i++) { for (int j = 0; j < s.height; j++) { @@ -270,7 +270,7 @@ void Particles2DEditorPlugin::_generate_emission_mask() { ERR_FAIL_COND_MSG(valid_positions.size() == 0, "No pixels with transparency > 128 in image..."); - PoolVector<uint8_t> texdata; + Vector<uint8_t> texdata; int w = 2048; int h = (vpc / 2048) + 1; @@ -278,8 +278,8 @@ void Particles2DEditorPlugin::_generate_emission_mask() { texdata.resize(w * h * 2 * sizeof(float)); { - PoolVector<uint8_t>::Write tw = texdata.write(); - float *twf = (float *)tw.ptr(); + uint8_t *tw = texdata.ptrw(); + float *twf = (float *)tw; for (int i = 0; i < vpc; i++) { twf[i * 2 + 0] = valid_positions[i].x; @@ -299,11 +299,11 @@ void Particles2DEditorPlugin::_generate_emission_mask() { if (capture_colors) { - PoolVector<uint8_t> colordata; + Vector<uint8_t> colordata; colordata.resize(w * h * 4); //use RG texture { - PoolVector<uint8_t>::Write tw = colordata.write(); + uint8_t *tw = colordata.ptrw(); for (int i = 0; i < vpc * 4; i++) { tw[i] = valid_colors[i]; @@ -321,12 +321,12 @@ void Particles2DEditorPlugin::_generate_emission_mask() { if (valid_normals.size()) { pm->set_emission_shape(ParticlesMaterial::EMISSION_SHAPE_DIRECTED_POINTS); - PoolVector<uint8_t> normdata; + Vector<uint8_t> normdata; normdata.resize(w * h * 2 * sizeof(float)); //use RG texture { - PoolVector<uint8_t>::Write tw = normdata.write(); - float *twf = (float *)tw.ptr(); + uint8_t *tw = normdata.ptrw(); + float *twf = (float *)tw; for (int i = 0; i < vpc; i++) { twf[i * 2 + 0] = valid_normals[i].x; twf[i * 2 + 1] = valid_normals[i].y; diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index cb29e11b9d..940874846f 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -35,7 +35,7 @@ #include "scene/3d/cpu_particles.h" #include "scene/resources/particles_material.h" -bool ParticlesEditorBase::_generate(PoolVector<Vector3> &points, PoolVector<Vector3> &normals) { +bool ParticlesEditorBase::_generate(Vector<Vector3> &points, Vector<Vector3> &normals) { bool use_normals = emission_fill->get_selected() == 1; @@ -93,7 +93,7 @@ bool ParticlesEditorBase::_generate(PoolVector<Vector3> &points, PoolVector<Vect return false; } - PoolVector<Face3>::Read r = geometry.read(); + const Face3 *r = geometry.ptr(); AABB aabb; @@ -191,7 +191,7 @@ void ParticlesEditorBase::_node_selected(const NodePath &p_path) { Transform geom_xform = base_node->get_global_transform().affine_inverse() * vi->get_global_transform(); int gc = geometry.size(); - PoolVector<Face3>::Write w = geometry.write(); + Face3 *w = geometry.ptrw(); for (int i = 0; i < gc; i++) { for (int j = 0; j < 3; j++) { @@ -199,8 +199,6 @@ void ParticlesEditorBase::_node_selected(const NodePath &p_path) { } } - w.release(); - emission_dialog->popup_centered(Size2(300, 130)); } @@ -379,8 +377,8 @@ void ParticlesEditor::edit(Particles *p_particles) { void ParticlesEditor::_generate_emission_points() { /// hacer codigo aca - PoolVector<Vector3> points; - PoolVector<Vector3> normals; + Vector<Vector3> points; + Vector<Vector3> normals; if (!_generate(points, normals)) { return; @@ -391,14 +389,14 @@ void ParticlesEditor::_generate_emission_points() { int w = 2048; int h = (point_count / 2048) + 1; - PoolVector<uint8_t> point_img; + Vector<uint8_t> point_img; point_img.resize(w * h * 3 * sizeof(float)); { - PoolVector<uint8_t>::Write iw = point_img.write(); - zeromem(iw.ptr(), w * h * 3 * sizeof(float)); - PoolVector<Vector3>::Read r = points.read(); - float *wf = (float *)iw.ptr(); + uint8_t *iw = point_img.ptrw(); + zeromem(iw, w * h * 3 * sizeof(float)); + const Vector3 *r = points.ptr(); + float *wf = (float *)iw; for (int i = 0; i < point_count; i++) { wf[i * 3 + 0] = r[i].x; wf[i * 3 + 1] = r[i].y; @@ -420,14 +418,14 @@ void ParticlesEditor::_generate_emission_points() { material->set_emission_point_count(point_count); material->set_emission_point_texture(tex); - PoolVector<uint8_t> point_img2; + Vector<uint8_t> point_img2; point_img2.resize(w * h * 3 * sizeof(float)); { - PoolVector<uint8_t>::Write iw = point_img2.write(); - zeromem(iw.ptr(), w * h * 3 * sizeof(float)); - PoolVector<Vector3>::Read r = normals.read(); - float *wf = (float *)iw.ptr(); + uint8_t *iw = point_img2.ptrw(); + zeromem(iw, w * h * 3 * sizeof(float)); + const Vector3 *r = normals.ptr(); + float *wf = (float *)iw; for (int i = 0; i < point_count; i++) { wf[i * 3 + 0] = r[i].x; wf[i * 3 + 1] = r[i].y; diff --git a/editor/plugins/particles_editor_plugin.h b/editor/plugins/particles_editor_plugin.h index 4b20d00670..5419b7d3d5 100644 --- a/editor/plugins/particles_editor_plugin.h +++ b/editor/plugins/particles_editor_plugin.h @@ -53,9 +53,9 @@ protected: SpinBox *emission_amount; OptionButton *emission_fill; - PoolVector<Face3> geometry; + Vector<Face3> geometry; - bool _generate(PoolVector<Vector3> &points, PoolVector<Vector3> &normals); + bool _generate(Vector<Vector3> &points, Vector<Vector3> &normals); virtual void _generate_emission_points() = 0; void _node_selected(const NodePath &p_path); diff --git a/editor/plugins/path_editor_plugin.cpp b/editor/plugins/path_editor_plugin.cpp index 92f21d8428..75c9776f0f 100644 --- a/editor/plugins/path_editor_plugin.cpp +++ b/editor/plugins/path_editor_plugin.cpp @@ -229,14 +229,14 @@ void PathSpatialGizmo::redraw() { if (c.is_null()) return; - PoolVector<Vector3> v3a = c->tessellate(); - //PoolVector<Vector3> v3a=c->get_baked_points(); + Vector<Vector3> v3a = c->tessellate(); + //Vector<Vector3> v3a=c->get_baked_points(); int v3s = v3a.size(); if (v3s == 0) return; Vector<Vector3> v3p; - PoolVector<Vector3>::Read r = v3a.read(); + const Vector3 *r = v3a.ptr(); // BUG: the following won't work when v3s, avoid drawing as a temporary workaround. for (int i = 0; i < v3s - 1; i++) { @@ -315,7 +315,7 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera *p_camera, const Ref<Inp if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb->get_control()))) { //click into curve, break it down - PoolVector<Vector3> v3a = c->tessellate(); + Vector<Vector3> v3a = c->tessellate(); int idx = 0; int rc = v3a.size(); int closest_seg = -1; @@ -323,7 +323,7 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera *p_camera, const Ref<Inp float closest_d = 1e20; if (rc >= 2) { - PoolVector<Vector3>::Read r = v3a.read(); + const Vector3 *r = v3a.ptr(); if (p_camera->unproject_position(gt.xform(c->get_point_position(0))).distance_to(mbpos) < click_dist) return false; //nope, existing diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 14e22625d9..8b0adbafa2 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -125,12 +125,12 @@ void Polygon2DEditor::_sync_bones() { } else { for (int i = 0; i < skeleton->get_bone_count(); i++) { NodePath path = skeleton->get_path_to(skeleton->get_bone(i)); - PoolVector<float> weights; + Vector<float> weights; int wc = node->get_polygon().size(); for (int j = 0; j < prev_bones.size(); j += 2) { NodePath pvp = prev_bones[j]; - PoolVector<float> pv = prev_bones[j + 1]; + Vector<float> pv = prev_bones[j + 1]; if (pvp == path && pv.size() == wc) { weights = pv; } @@ -138,7 +138,7 @@ void Polygon2DEditor::_sync_bones() { if (weights.size() == 0) { //create them weights.resize(node->get_polygon().size()); - PoolVector<float>::Write w = weights.write(); + float *w = weights.ptrw(); for (int j = 0; j < wc; j++) { w[j] = 0.0; } @@ -293,8 +293,8 @@ void Polygon2DEditor::_menu_option(int p_option) { return; } - PoolVector<Vector2> points = node->get_polygon(); - PoolVector<Vector2> uvs = node->get_uv(); + Vector<Vector2> points = node->get_polygon(); + Vector<Vector2> uvs = node->get_uv(); if (uvs.size() != points.size()) { undo_redo->create_action(TTR("Create UV Map")); undo_redo->add_do_method(node, "set_uv", points); @@ -312,10 +312,10 @@ void Polygon2DEditor::_menu_option(int p_option) { } break; case UVEDIT_POLYGON_TO_UV: { - PoolVector<Vector2> points = node->get_polygon(); + Vector<Vector2> points = node->get_polygon(); if (points.size() == 0) break; - PoolVector<Vector2> uvs = node->get_uv(); + Vector<Vector2> uvs = node->get_uv(); undo_redo->create_action(TTR("Create UV Map")); undo_redo->add_do_method(node, "set_uv", points); undo_redo->add_undo_method(node, "set_uv", uvs); @@ -325,8 +325,8 @@ void Polygon2DEditor::_menu_option(int p_option) { } break; case UVEDIT_UV_TO_POLYGON: { - PoolVector<Vector2> points = node->get_polygon(); - PoolVector<Vector2> uvs = node->get_uv(); + Vector<Vector2> points = node->get_polygon(); + Vector<Vector2> uvs = node->get_uv(); if (uvs.size() == 0) break; @@ -339,11 +339,11 @@ void Polygon2DEditor::_menu_option(int p_option) { } break; case UVEDIT_UV_CLEAR: { - PoolVector<Vector2> uvs = node->get_uv(); + Vector<Vector2> uvs = node->get_uv(); if (uvs.size() == 0) break; undo_redo->create_action(TTR("Create UV Map")); - undo_redo->add_do_method(node, "set_uv", PoolVector<Vector2>()); + undo_redo->add_do_method(node, "set_uv", Vector<Vector2>()); undo_redo->add_undo_method(node, "set_uv", uvs); undo_redo->add_do_method(uv_edit_draw, "update"); undo_redo->add_undo_method(uv_edit_draw, "update"); @@ -567,7 +567,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { undo_redo->add_do_method(node, "set_vertex_colors", uv_create_colors_prev); undo_redo->add_undo_method(node, "set_vertex_colors", node->get_vertex_colors()); for (int i = 0; i < node->get_bone_count(); i++) { - PoolVector<float> bonew = node->get_bone_weights(i); + Vector<float> bonew = node->get_bone_weights(i); bonew.push_back(0); undo_redo->add_do_method(node, "set_bone_weights", i, bonew); undo_redo->add_undo_method(node, "set_bone_weights", i, node->get_bone_weights(i)); @@ -622,7 +622,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { undo_redo->add_do_method(node, "set_vertex_colors", uv_create_colors_prev); undo_redo->add_undo_method(node, "set_vertex_colors", node->get_vertex_colors()); for (int i = 0; i < node->get_bone_count(); i++) { - PoolVector<float> bonew = node->get_bone_weights(i); + Vector<float> bonew = node->get_bone_weights(i); bonew.remove(closest); undo_redo->add_do_method(node, "set_bone_weights", i, bonew); undo_redo->add_undo_method(node, "set_bone_weights", i, node->get_bone_weights(i)); @@ -712,7 +712,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { int erase_index = -1; for (int i = polygons.size() - 1; i >= 0; i--) { - PoolVector<int> points = polygons[i]; + Vector<int> points = polygons[i]; Vector<Vector2> polys; polys.resize(points.size()); for (int j = 0; j < polys.size(); j++) { @@ -832,7 +832,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { } break; case UV_MODE_EDIT_POINT: { - PoolVector<Vector2> uv_new = points_prev; + Vector<Vector2> uv_new = points_prev; uv_new.set(point_drag_index, uv_new[point_drag_index] + drag); if (uv_edit_mode[0]->is_pressed()) { //edit uv @@ -843,7 +843,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { } break; case UV_MODE_MOVE: { - PoolVector<Vector2> uv_new = points_prev; + Vector<Vector2> uv_new = points_prev; for (int i = 0; i < uv_new.size(); i++) uv_new.set(i, uv_new[i] + drag); @@ -856,7 +856,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { case UV_MODE_ROTATE: { Vector2 center; - PoolVector<Vector2> uv_new = points_prev; + Vector<Vector2> uv_new = points_prev; for (int i = 0; i < uv_new.size(); i++) center += points_prev[i]; @@ -879,7 +879,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { case UV_MODE_SCALE: { Vector2 center; - PoolVector<Vector2> uv_new = points_prev; + Vector<Vector2> uv_new = points_prev; for (int i = 0; i < uv_new.size(); i++) center += points_prev[i]; @@ -914,7 +914,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { } if (bone_painting) { - PoolVector<float> painted_weights = node->get_bone_weights(bone_painting_bone); + Vector<float> painted_weights = node->get_bone_weights(bone_painting_bone); { int pc = painted_weights.size(); @@ -925,9 +925,9 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { amount = -amount; } - PoolVector<float>::Write w = painted_weights.write(); - PoolVector<float>::Read r = prev_weights.read(); - PoolVector<Vector2>::Read rv = points_prev.read(); + float *w = painted_weights.ptrw(); + const float *r = prev_weights.ptr(); + const Vector2 *rv = points_prev.ptr(); for (int i = 0; i < pc; i++) { if (mtx.xform(rv[i]).distance_to(bone_paint_pos) < radius) { @@ -1024,14 +1024,14 @@ void Polygon2DEditor::_uv_draw() { Array polygons = node->get_polygons(); - PoolVector<Vector2> uvs; + Vector<Vector2> uvs; if (uv_edit_mode[0]->is_pressed()) { //edit uv uvs = node->get_uv(); } else { //edit polygon uvs = node->get_polygon(); } - PoolVector<float>::Read weight_r; + const float *weight_r; if (uv_edit_mode[3]->is_pressed()) { int bone_selected = -1; @@ -1045,7 +1045,7 @@ void Polygon2DEditor::_uv_draw() { if (bone_selected != -1 && node->get_bone_weights(bone_selected).size() == uvs.size()) { - weight_r = node->get_bone_weights(bone_selected).read(); + weight_r = node->get_bone_weights(bone_selected).ptr(); } } @@ -1094,7 +1094,7 @@ void Polygon2DEditor::_uv_draw() { for (int i = 0; i < polygons.size(); i++) { - PoolVector<int> points = polygons[i]; + Vector<int> points = polygons[i]; Vector<Vector2> polypoints; for (int j = 0; j < points.size(); j++) { int next = (j + 1) % points.size(); @@ -1116,7 +1116,7 @@ void Polygon2DEditor::_uv_draw() { for (int i = 0; i < uvs.size(); i++) { - if (weight_r.ptr()) { + if (weight_r) { Vector2 draw_pos = mtx.xform(uvs[i]); float weight = weight_r[i]; uv_edit_draw->draw_rect(Rect2(draw_pos - Vector2(2, 2) * EDSCALE, Vector2(5, 5) * EDSCALE), Color(weight, weight, weight, 1.0), Math::round(EDSCALE)); diff --git a/editor/plugins/polygon_2d_editor_plugin.h b/editor/plugins/polygon_2d_editor_plugin.h index 1454a03325..2b00b50e5c 100644 --- a/editor/plugins/polygon_2d_editor_plugin.h +++ b/editor/plugins/polygon_2d_editor_plugin.h @@ -88,7 +88,7 @@ class Polygon2DEditor : public AbstractPolygon2DEditor { Label *bone_paint_radius_label; bool bone_painting; int bone_painting_bone; - PoolVector<float> prev_weights; + Vector<float> prev_weights; Vector2 bone_paint_pos; AcceptDialog *grid_settings; @@ -97,10 +97,10 @@ class Polygon2DEditor : public AbstractPolygon2DEditor { Vector2 uv_draw_ofs; float uv_draw_zoom; - PoolVector<Vector2> points_prev; - PoolVector<Vector2> uv_create_uv_prev; - PoolVector<Vector2> uv_create_poly_prev; - PoolVector<Color> uv_create_colors_prev; + Vector<Vector2> points_prev; + Vector<Vector2> uv_create_uv_prev; + Vector<Vector2> uv_create_poly_prev; + Vector<Color> uv_create_colors_prev; int uv_create_prev_internal_vertices; Array uv_create_bones_prev; Array polygons_prev; diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 76312df20a..f12be18c21 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2309,7 +2309,7 @@ void ScriptEditor::_editor_stop() { } } -void ScriptEditor::_add_callback(Object *p_obj, const String &p_function, const PoolStringArray &p_args) { +void ScriptEditor::_add_callback(Object *p_obj, const String &p_function, const PackedStringArray &p_args) { ERR_FAIL_COND(!p_obj); Ref<Script> script = p_obj->get_script(); @@ -3099,7 +3099,7 @@ void ScriptEditor::_start_find_in_files(bool with_replace) { editor->make_bottom_panel_item_visible(find_in_files); } -void ScriptEditor::_on_find_in_files_modified_files(PoolStringArray paths) { +void ScriptEditor::_on_find_in_files_modified_files(PackedStringArray paths) { _test_script_times_on_disk(); _update_modified_scripts_for_external_editor(); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 4087b7cd55..ec84bcb461 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -107,7 +107,7 @@ public: virtual void tag_saved_version() = 0; virtual void reload(bool p_soft) {} virtual void get_breakpoints(List<int> *p_breakpoints) = 0; - virtual void add_callback(const String &p_function, PoolStringArray p_args) = 0; + virtual void add_callback(const String &p_function, PackedStringArray p_args) = 0; virtual void update_settings() = 0; virtual void set_debugger_active(bool p_active) = 0; virtual bool can_lose_focus_on_node_selection() { return true; } @@ -321,7 +321,7 @@ class ScriptEditor : public PanelContainer { int edit_pass; - void _add_callback(Object *p_obj, const String &p_function, const PoolStringArray &p_args); + void _add_callback(Object *p_obj, const String &p_function, const PackedStringArray &p_args); void _res_saved_callback(const Ref<Resource> &p_res); bool trim_trailing_whitespace_on_save; @@ -408,7 +408,7 @@ class ScriptEditor : public PanelContainer { void _on_replace_in_files_requested(String text); void _on_find_in_files_result_selected(String fpath, int line_number, int begin, int end); void _start_find_in_files(bool with_replace); - void _on_find_in_files_modified_files(PoolStringArray paths); + void _on_find_in_files_modified_files(PackedStringArray paths); static void _open_script_request(const String &p_path); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 778febaf8a..9f1e2f0353 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -306,13 +306,13 @@ void ScriptTextEditor::_set_theme_for_script() { text_edit->add_keyword_color("RID", basetype_color); text_edit->add_keyword_color("Dictionary", basetype_color); text_edit->add_keyword_color("Array", basetype_color); - text_edit->add_keyword_color("PoolByteArray", basetype_color); - text_edit->add_keyword_color("PoolIntArray", basetype_color); - text_edit->add_keyword_color("PoolRealArray", basetype_color); - text_edit->add_keyword_color("PoolStringArray", basetype_color); - text_edit->add_keyword_color("PoolVector2Array", basetype_color); - text_edit->add_keyword_color("PoolVector3Array", basetype_color); - text_edit->add_keyword_color("PoolColorArray", basetype_color); + text_edit->add_keyword_color("PackedByteArray", basetype_color); + text_edit->add_keyword_color("PackedIntArray", basetype_color); + text_edit->add_keyword_color("PackedRealArray", basetype_color); + text_edit->add_keyword_color("PackedStringArray", basetype_color); + text_edit->add_keyword_color("PackedVector2Array", basetype_color); + text_edit->add_keyword_color("PackedVector3Array", basetype_color); + text_edit->add_keyword_color("PackedColorArray", basetype_color); //colorize engine types List<StringName> types; @@ -424,7 +424,7 @@ void ScriptTextEditor::_notification(int p_what) { } } -void ScriptTextEditor::add_callback(const String &p_function, PoolStringArray p_args) { +void ScriptTextEditor::add_callback(const String &p_function, PackedStringArray p_args) { String code = code_editor->get_text_edit()->get_text(); int pos = script->get_language()->find_function(p_function, code); @@ -1212,7 +1212,7 @@ void ScriptTextEditor::_edit_option(int p_op) { Expression expression; Vector<String> lines = code_editor->get_text_edit()->get_selection_text().split("\n"); - PoolStringArray results; + PackedStringArray results; for (int i = 0; i < lines.size(); i++) { String line = lines[i]; @@ -1221,17 +1221,17 @@ void ScriptTextEditor::_edit_option(int p_op) { if (expression.parse(line) == OK) { Variant result = expression.execute(Array(), Variant(), false); if (expression.get_error_text() == "") { - results.append(whitespace + result.get_construct_string()); + results.push_back(whitespace + result.get_construct_string()); } else { - results.append(line); + results.push_back(line); } } else { - results.append(line); + results.push_back(line); } } code_editor->get_text_edit()->begin_complex_operation(); //prevents creating a two-step undo - code_editor->get_text_edit()->insert_text_at_cursor(results.join("\n")); + code_editor->get_text_edit()->insert_text_at_cursor(String("\n").join(results)); code_editor->get_text_edit()->end_complex_operation(); } break; case SEARCH_FIND: { diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index 359f0b0019..e23160d029 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -220,7 +220,7 @@ public: virtual void reload(bool p_soft); virtual void get_breakpoints(List<int> *p_breakpoints); - virtual void add_callback(const String &p_function, PoolStringArray p_args); + virtual void add_callback(const String &p_function, PackedStringArray p_args); virtual void update_settings(); virtual bool show_members_overview(); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index e916f6f028..88b4f011ee 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -5181,8 +5181,8 @@ void SpatialEditor::_update_gizmos_menu_theme() { void SpatialEditor::_init_grid() { - PoolVector<Color> grid_colors[3]; - PoolVector<Vector3> grid_points[3]; + Vector<Color> grid_colors[3]; + Vector<Vector3> grid_points[3]; Color primary_grid_color = EditorSettings::get_singleton()->get("editors/3d/primary_grid_color"); Color secondary_grid_color = EditorSettings::get_singleton()->get("editors/3d/secondary_grid_color"); diff --git a/editor/plugins/sprite_editor_plugin.cpp b/editor/plugins/sprite_editor_plugin.cpp index 2736bbfd3a..e69440b5bb 100644 --- a/editor/plugins/sprite_editor_plugin.cpp +++ b/editor/plugins/sprite_editor_plugin.cpp @@ -358,13 +358,13 @@ void SpriteEditor::_convert_to_polygon_2d_node() { for (int i = 0; i < computed_outline_lines.size(); i++) total_point_count += computed_outline_lines[i].size(); - PoolVector2Array polygon; + PackedVector2Array polygon; polygon.resize(total_point_count); - PoolVector2Array::Write polygon_write = polygon.write(); + Vector2 *polygon_write = polygon.ptrw(); - PoolVector2Array uvs; + PackedVector2Array uvs; uvs.resize(total_point_count); - PoolVector2Array::Write uvs_write = uvs.write(); + Vector2 *uvs_write = uvs.ptrw(); int current_point_index = 0; @@ -376,9 +376,9 @@ void SpriteEditor::_convert_to_polygon_2d_node() { Vector<Vector2> outline = computed_outline_lines[i]; Vector<Vector2> uv_outline = outline_lines[i]; - PoolIntArray pia; + PackedIntArray pia; pia.resize(outline.size()); - PoolIntArray::Write pia_write = pia.write(); + int *pia_write = pia.ptrw(); for (int pi = 0; pi < outline.size(); pi++) { polygon_write[current_point_index] = outline[pi]; @@ -442,9 +442,9 @@ void SpriteEditor::_create_light_occluder_2d_node() { Ref<OccluderPolygon2D> polygon; polygon.instance(); - PoolVector2Array a; + PackedVector2Array a; a.resize(outline.size()); - PoolVector2Array::Write aw = a.write(); + Vector2 *aw = a.ptrw(); for (int io = 0; io < outline.size(); io++) { aw[io] = outline[io]; } diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 2d756af213..9e8ce7ac4a 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -245,7 +245,7 @@ void SpriteFramesEditor::_notification(int p_what) { } } -void SpriteFramesEditor::_file_load_request(const PoolVector<String> &p_path, int p_at_pos) { +void SpriteFramesEditor::_file_load_request(const Vector<String> &p_path, int p_at_pos) { ERR_FAIL_COND(!frames->has_animation(edited_anim)); @@ -852,7 +852,7 @@ void SpriteFramesEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da if (String(d["type"]) == "files") { - PoolVector<String> files = d["files"]; + Vector<String> files = d["files"]; _file_load_request(files, at_pos); } diff --git a/editor/plugins/sprite_frames_editor_plugin.h b/editor/plugins/sprite_frames_editor_plugin.h index aa683605ed..1fa93b5c47 100644 --- a/editor/plugins/sprite_frames_editor_plugin.h +++ b/editor/plugins/sprite_frames_editor_plugin.h @@ -86,7 +86,7 @@ class SpriteFramesEditor : public HSplitContainer { void _load_pressed(); void _load_scene_pressed(); - void _file_load_request(const PoolVector<String> &p_path, int p_at_pos = -1); + void _file_load_request(const Vector<String> &p_path, int p_at_pos = -1); void _copy_pressed(); void _paste_pressed(); void _empty_pressed(); diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index 69f1bcfa2e..357af5ecd8 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -185,7 +185,7 @@ void TextEditor::set_edited_resource(const RES &p_res) { code_editor->update_line_and_column(); } -void TextEditor::add_callback(const String &p_function, PoolStringArray p_args) { +void TextEditor::add_callback(const String &p_function, PackedStringArray p_args) { } void TextEditor::set_debugger_active(bool p_active) { diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h index c976cd87f1..c80052e7ba 100644 --- a/editor/plugins/text_editor.h +++ b/editor/plugins/text_editor.h @@ -147,7 +147,7 @@ public: virtual bool can_lose_focus_on_node_selection() { return true; } virtual void set_debugger_active(bool p_active); virtual void set_tooltip_request_func(String p_method, Object *p_obj); - virtual void add_callback(const String &p_function, PoolStringArray p_args); + virtual void add_callback(const String &p_function, PackedStringArray p_args); virtual Control *get_edit_menu(); virtual void clear_edit_menu(); diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 425a759dac..145263a5ab 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -598,7 +598,7 @@ void TileMapEditor::_pick_tile(const Point2 &p_pos) { CanvasItemEditor::get_singleton()->update_viewport(); } -PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool erase, bool preview) { +Vector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool erase, bool preview) { int prev_id = node->get_cell(p_start.x, p_start.y); Vector<int> ids; @@ -607,14 +607,14 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era ids = get_selected_tiles(); if (ids.size() == 0 || ids[0] == TileMap::INVALID_CELL) - return PoolVector<Vector2>(); + return Vector<Vector2>(); } else if (prev_id == TileMap::INVALID_CELL) { - return PoolVector<Vector2>(); + return Vector<Vector2>(); } if (ids.size() == 1 && ids[0] == prev_id) { // Same ID, nothing to change - return PoolVector<Vector2>(); + return Vector<Vector2>(); } Rect2i r = node->get_used_rect(); @@ -640,14 +640,14 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era if (invalidate_cache) { for (int i = 0; i < area; ++i) bucket_cache_visited[i] = false; - bucket_cache = PoolVector<Vector2>(); + bucket_cache = Vector<Vector2>(); bucket_cache_tile = prev_id; bucket_cache_rect = r; bucket_queue.clear(); } } - PoolVector<Vector2> points; + Vector<Vector2> points; Vector<Vector2> non_preview_cache; int count = 0; int limit = 0; @@ -698,10 +698,10 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era return preview ? bucket_cache : points; } -void TileMapEditor::_fill_points(const PoolVector<Vector2> &p_points, const Dictionary &p_op) { +void TileMapEditor::_fill_points(const Vector<Vector2> &p_points, const Dictionary &p_op) { int len = p_points.size(); - PoolVector<Vector2>::Read pr = p_points.read(); + const Vector2 *pr = p_points.ptr(); Vector<int> ids = p_op["id"]; bool xf = p_op["flip_h"]; @@ -716,10 +716,10 @@ void TileMapEditor::_fill_points(const PoolVector<Vector2> &p_points, const Dict node->update_dirty_bitmask(); } -void TileMapEditor::_erase_points(const PoolVector<Vector2> &p_points) { +void TileMapEditor::_erase_points(const Vector<Vector2> &p_points) { int len = p_points.size(); - PoolVector<Vector2>::Read pr = p_points.read(); + const Vector2 *pr = p_points.ptr(); for (int i = 0; i < len; i++) { @@ -882,8 +882,8 @@ void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p void TileMapEditor::_draw_fill_preview(Control *p_viewport, int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Point2i &p_autotile_coord, const Transform2D &p_xform) { - PoolVector<Vector2> points = _bucket_fill(p_point, false, true); - PoolVector<Vector2>::Read pr = points.read(); + Vector<Vector2> points = _bucket_fill(p_point, false, true); + const Vector2 *pr = points.ptr(); int len = points.size(); for (int i = 0; i < len; ++i) { @@ -1109,7 +1109,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { } else if (tool == TOOL_BUCKET) { - PoolVector<Vector2> points = _bucket_fill(over_tile); + Vector<Vector2> points = _bucket_fill(over_tile); if (points.size() == 0) return false; @@ -1216,7 +1216,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { pop["flip_v"] = node->is_cell_y_flipped(over_tile.x, over_tile.y); pop["transpose"] = node->is_cell_transposed(over_tile.x, over_tile.y); - PoolVector<Vector2> points = _bucket_fill(over_tile, true); + Vector<Vector2> points = _bucket_fill(over_tile, true); if (points.size() == 0) return false; diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h index 927f0887bb..74969d3e64 100644 --- a/editor/plugins/tile_map_editor_plugin.h +++ b/editor/plugins/tile_map_editor_plugin.h @@ -123,7 +123,7 @@ class TileMapEditor : public VBoxContainer { bool *bucket_cache_visited; Rect2i bucket_cache_rect; int bucket_cache_tile; - PoolVector<Vector2> bucket_cache; + Vector<Vector2> bucket_cache; List<Point2i> bucket_queue; struct CellOp { @@ -164,10 +164,10 @@ class TileMapEditor : public VBoxContainer { void _pick_tile(const Point2 &p_pos); - PoolVector<Vector2> _bucket_fill(const Point2i &p_start, bool erase = false, bool preview = false); + Vector<Vector2> _bucket_fill(const Point2i &p_start, bool erase = false, bool preview = false); - void _fill_points(const PoolVector<Vector2> &p_points, const Dictionary &p_op); - void _erase_points(const PoolVector<Vector2> &p_points); + void _fill_points(const Vector<Vector2> &p_points, const Dictionary &p_op); + void _erase_points(const Vector<Vector2> &p_points); void _select(const Point2i &p_from, const Point2i &p_to); void _erase_selection(); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index ce865510b4..4fea504f7d 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -251,7 +251,7 @@ void TileSetEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, C if (String(d["type"]) == "files") { - PoolVector<String> files = d["files"]; + Vector<String> files = d["files"]; _on_textures_added(files); } @@ -750,7 +750,7 @@ void TileSetEditor::_on_texture_list_selected(int p_index) { workspace->update(); } -void TileSetEditor::_on_textures_added(const PoolStringArray &p_paths) { +void TileSetEditor::_on_textures_added(const PackedStringArray &p_paths) { int invalid_count = 0; for (int i = 0; i < p_paths.size(); i++) { Ref<Texture2D> t = Ref<Texture2D>(ResourceLoader::load(p_paths[i])); @@ -1618,16 +1618,14 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) { if (dragging_point >= 0) { dragging_point = -1; - PoolVector<Vector2> polygon; + Vector<Vector2> polygon; polygon.resize(current_shape.size()); - PoolVector<Vector2>::Write w = polygon.write(); + Vector2 *w = polygon.ptrw(); for (int i = 0; i < current_shape.size(); i++) { w[i] = current_shape[i] - shape_anchor; } - w.release(); - undo_redo->create_action(TTR("Edit Occlusion Polygon")); undo_redo->add_do_method(edited_occlusion_shape.ptr(), "set_polygon", polygon); undo_redo->add_undo_method(edited_occlusion_shape.ptr(), "set_polygon", edited_occlusion_shape->get_polygon()); @@ -1639,18 +1637,16 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) { if (dragging_point >= 0) { dragging_point = -1; - PoolVector<Vector2> polygon; + Vector<Vector2> polygon; Vector<int> indices; polygon.resize(current_shape.size()); - PoolVector<Vector2>::Write w = polygon.write(); + Vector2 *w = polygon.ptrw(); for (int i = 0; i < current_shape.size(); i++) { w[i] = current_shape[i] - shape_anchor; indices.push_back(i); } - w.release(); - undo_redo->create_action(TTR("Edit Navigation Polygon")); undo_redo->add_do_method(edited_navigation_shape.ptr(), "set_vertices", polygon); undo_redo->add_undo_method(edited_navigation_shape.ptr(), "set_vertices", edited_navigation_shape->get_vertices()); @@ -1983,7 +1979,7 @@ void TileSetEditor::_set_edited_shape_points(const Vector<Vector2> &points) { undo_redo->add_do_method(convex.ptr(), "set_points", points); undo_redo->add_undo_method(convex.ptr(), "set_points", _get_edited_shape_points()); } else if (concave.is_valid()) { - PoolVector2Array segments; + PackedVector2Array segments; for (int i = 0; i < points.size() - 1; i++) { segments.push_back(points[i]); segments.push_back(points[i + 1]); @@ -2782,7 +2778,7 @@ void TileSetEditor::draw_polygon_shapes() { colors.push_back(c_bg); } } else { - PoolVector<Vector2> vertices = shape->get_vertices(); + Vector<Vector2> vertices = shape->get_vertices(); for (int j = 0; j < shape->get_polygon(0).size(); j++) { polygon.push_back(vertices[shape->get_polygon(0)[j]] + anchor); colors.push_back(c_bg); @@ -2830,7 +2826,7 @@ void TileSetEditor::draw_polygon_shapes() { colors.push_back(c_bg); } } else { - PoolVector<Vector2> vertices = shape->get_vertices(); + Vector<Vector2> vertices = shape->get_vertices(); for (int j = 0; j < shape->get_polygon(0).size(); j++) { polygon.push_back(vertices[shape->get_polygon(0)[j]] + anchor); colors.push_back(c_bg); @@ -2917,15 +2913,14 @@ void TileSetEditor::close_shape(const Vector2 &shape_anchor) { } else if (edit_mode == EDITMODE_OCCLUSION) { Ref<OccluderPolygon2D> shape = memnew(OccluderPolygon2D); - PoolVector<Vector2> polygon; + Vector<Vector2> polygon; polygon.resize(current_shape.size()); - PoolVector<Vector2>::Write w = polygon.write(); + Vector2 *w = polygon.ptrw(); for (int i = 0; i < current_shape.size(); i++) { w[i] = current_shape[i] - shape_anchor; } - w.release(); shape->set_polygon(polygon); undo_redo->create_action(TTR("Create Occlusion Polygon")); @@ -2943,17 +2938,16 @@ void TileSetEditor::close_shape(const Vector2 &shape_anchor) { } else if (edit_mode == EDITMODE_NAVIGATION) { Ref<NavigationPolygon> shape = memnew(NavigationPolygon); - PoolVector<Vector2> polygon; + Vector<Vector2> polygon; Vector<int> indices; polygon.resize(current_shape.size()); - PoolVector<Vector2>::Write w = polygon.write(); + Vector2 *w = polygon.ptrw(); for (int i = 0; i < current_shape.size(); i++) { w[i] = current_shape[i] - shape_anchor; indices.push_back(i); } - w.release(); shape->set_vertices(polygon); shape->add_polygon(indices); @@ -2975,7 +2969,7 @@ void TileSetEditor::close_shape(const Vector2 &shape_anchor) { void TileSetEditor::select_coord(const Vector2 &coord) { _update_tile_data(); - current_shape = PoolVector2Array(); + current_shape = PackedVector2Array(); if (get_current_tile() == -1) return; Rect2 current_tile_region = tileset->tile_get_region(get_current_tile()); @@ -3006,7 +3000,7 @@ void TileSetEditor::select_coord(const Vector2 &coord) { current_shape.resize(0); if (edited_navigation_shape.is_valid()) { if (edited_navigation_shape->get_polygon_count() > 0) { - PoolVector<Vector2> vertices = edited_navigation_shape->get_vertices(); + Vector<Vector2> vertices = edited_navigation_shape->get_vertices(); for (int i = 0; i < edited_navigation_shape->get_polygon(0).size(); i++) { current_shape.push_back(vertices[edited_navigation_shape->get_polygon(0)[i]] + current_tile_region.position); } @@ -3055,7 +3049,7 @@ void TileSetEditor::select_coord(const Vector2 &coord) { current_shape.resize(0); if (edited_navigation_shape.is_valid()) { if (edited_navigation_shape->get_polygon_count() > 0) { - PoolVector<Vector2> vertices = edited_navigation_shape->get_vertices(); + Vector<Vector2> vertices = edited_navigation_shape->get_vertices(); for (int i = 0; i < edited_navigation_shape->get_polygon(0).size(); i++) { current_shape.push_back(vertices[edited_navigation_shape->get_polygon(0)[i]] + shape_anchor); } diff --git a/editor/plugins/tile_set_editor_plugin.h b/editor/plugins/tile_set_editor_plugin.h index 26340824a0..7b49e2ece2 100644 --- a/editor/plugins/tile_set_editor_plugin.h +++ b/editor/plugins/tile_set_editor_plugin.h @@ -123,7 +123,7 @@ class TileSetEditor : public HSplitContainer { Rect2 edited_region; bool draw_edited_region; Vector2 edited_shape_coord; - PoolVector2Array current_shape; + PackedVector2Array current_shape; Map<Vector2i, SubtileData> current_tile_data; Map<Vector2, uint32_t> bitmask_map_copy; @@ -178,7 +178,7 @@ class TileSetEditor : public HSplitContainer { Variant get_drag_data_fw(const Point2 &p_point, Control *p_from); bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from); - void _file_load_request(const PoolVector<String> &p_path, int p_at_pos = -1); + void _file_load_request(const Vector<String> &p_path, int p_at_pos = -1); protected: static void _bind_methods(); @@ -195,7 +195,7 @@ private: void _on_tileset_toolbar_button_pressed(int p_index); void _on_tileset_toolbar_confirm(); void _on_texture_list_selected(int p_index); - void _on_textures_added(const PoolStringArray &p_paths); + void _on_textures_added(const PackedStringArray &p_paths); void _on_edit_mode_changed(int p_edit_mode); void _on_workspace_mode_changed(int p_workspace_mode); void _on_workspace_overlay_draw(); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index ecc140d7d2..6c8c1b44dc 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -2164,10 +2164,10 @@ void VisualShaderEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da saved_node_pos_dirty = true; _add_node(idx, add_options[idx].sub_func); } else if (d.has("files")) { - if (d["files"].get_type() == Variant::POOL_STRING_ARRAY) { + if (d["files"].get_type() == Variant::PACKED_STRING_ARRAY) { int j = 0; - PoolStringArray arr = d["files"]; + PackedStringArray arr = d["files"]; for (int i = 0; i < arr.size(); i++) { String type = ResourceLoader::get_resource_type(arr[i]); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index a1032130f8..1dbd7f46d7 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -2327,7 +2327,7 @@ void ProjectManager::_install_project(const String &p_zip_path, const String &p_ npdialog->show_dialog(); } -void ProjectManager::_files_dropped(PoolStringArray p_files, int p_screen) { +void ProjectManager::_files_dropped(PackedStringArray p_files, int p_screen) { Set<String> folders_set; DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); for (int i = 0; i < p_files.size(); i++) { @@ -2336,9 +2336,9 @@ void ProjectManager::_files_dropped(PoolStringArray p_files, int p_screen) { } memdelete(da); if (folders_set.size() > 0) { - PoolStringArray folders; + PackedStringArray folders; for (Set<String>::Element *E = folders_set.front(); E; E = E->next()) { - folders.append(E->get()); + folders.push_back(E->get()); } bool confirm = true; @@ -2369,7 +2369,7 @@ void ProjectManager::_files_dropped(PoolStringArray p_files, int p_screen) { } } -void ProjectManager::_scan_multiple_folders(PoolStringArray p_files) { +void ProjectManager::_scan_multiple_folders(PackedStringArray p_files) { for (int i = 0; i < p_files.size(); i++) { _scan_begin(p_files.get(i)); } diff --git a/editor/project_manager.h b/editor/project_manager.h index feeea9695d..8b9c769c59 100644 --- a/editor/project_manager.h +++ b/editor/project_manager.h @@ -111,8 +111,8 @@ class ProjectManager : public Control { void _dim_window(); void _unhandled_input(const Ref<InputEvent> &p_ev); - void _files_dropped(PoolStringArray p_files, int p_screen); - void _scan_multiple_folders(PoolStringArray p_files); + void _files_dropped(PackedStringArray p_files, int p_screen); + void _scan_multiple_folders(PackedStringArray p_files); void _on_order_option_changed(); void _on_filter_option_changed(); diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 6635f5cb47..83593477c7 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -1188,7 +1188,7 @@ void ProjectSettingsEditor::add_translation(const String &p_translation) { void ProjectSettingsEditor::_translation_add(const String &p_path) { - PoolStringArray translations = ProjectSettings::get_singleton()->get("locale/translations"); + PackedStringArray translations = ProjectSettings::get_singleton()->get("locale/translations"); for (int i = 0; i < translations.size(); i++) { @@ -1219,7 +1219,7 @@ void ProjectSettingsEditor::_translation_delete(Object *p_item, int p_column, in int idx = ti->get_metadata(0); - PoolStringArray translations = ProjectSettings::get_singleton()->get("locale/translations"); + PackedStringArray translations = ProjectSettings::get_singleton()->get("locale/translations"); ERR_FAIL_INDEX(idx, translations.size()); @@ -1253,7 +1253,7 @@ void ProjectSettingsEditor::_translation_res_add(const String &p_path) { if (remaps.has(p_path)) return; //pointless already has it - remaps[p_path] = PoolStringArray(); + remaps[p_path] = PackedStringArray(); undo_redo->create_action(TTR("Add Remapped Path")); undo_redo->add_do_property(ProjectSettings::get_singleton(), "locale/translation_remaps", remaps); @@ -1281,7 +1281,7 @@ void ProjectSettingsEditor::_translation_res_option_add(const String &p_path) { String key = k->get_metadata(0); ERR_FAIL_COND(!remaps.has(key)); - PoolStringArray r = remaps[key]; + PackedStringArray r = remaps[key]; r.push_back(p_path + ":" + "en"); remaps[key] = r; @@ -1328,7 +1328,7 @@ void ProjectSettingsEditor::_translation_res_option_changed() { ERR_FAIL_INDEX(which, langs.size()); ERR_FAIL_COND(!remaps.has(key)); - PoolStringArray r = remaps[key]; + PackedStringArray r = remaps[key]; ERR_FAIL_INDEX(idx, r.size()); if (translation_locales_idxs_remap.size() > which) { r.set(idx, path + ":" + langs[translation_locales_idxs_remap[which]]); @@ -1395,7 +1395,7 @@ void ProjectSettingsEditor::_translation_res_option_delete(Object *p_item, int p int idx = ed->get_metadata(0); ERR_FAIL_COND(!remaps.has(key)); - PoolStringArray r = remaps[key]; + PackedStringArray r = remaps[key]; ERR_FAIL_INDEX(idx, r.size()); r.remove(idx); remaps[key] = r; @@ -1506,7 +1506,7 @@ void ProjectSettingsEditor::_update_translations() { translation_list->set_hide_root(true); if (ProjectSettings::get_singleton()->has_setting("locale/translations")) { - PoolStringArray translations = ProjectSettings::get_singleton()->get("locale/translations"); + PackedStringArray translations = ProjectSettings::get_singleton()->get("locale/translations"); for (int i = 0; i < translations.size(); i++) { TreeItem *t = translation_list->create_item(root); @@ -1642,7 +1642,7 @@ void ProjectSettingsEditor::_update_translations() { t->select(0); translation_res_option_add_button->set_disabled(false); - PoolStringArray selected = remaps[keys[i]]; + PackedStringArray selected = remaps[keys[i]]; for (int j = 0; j < selected.size(); j++) { String s2 = selected[j]; diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index e6128f255d..cf4b83922d 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -1045,22 +1045,22 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: case Variant::DICTIONARY: { } break; - case Variant::POOL_BYTE_ARRAY: { + case Variant::PACKED_BYTE_ARRAY: { } break; - case Variant::POOL_INT_ARRAY: { + case Variant::PACKED_INT_ARRAY: { } break; - case Variant::POOL_REAL_ARRAY: { + case Variant::PACKED_REAL_ARRAY: { } break; - case Variant::POOL_STRING_ARRAY: { + case Variant::PACKED_STRING_ARRAY: { } break; - case Variant::POOL_VECTOR3_ARRAY: { + case Variant::PACKED_VECTOR3_ARRAY: { } break; - case Variant::POOL_COLOR_ARRAY: { + case Variant::PACKED_COLOR_ARRAY: { } break; default: { @@ -1697,22 +1697,22 @@ void CustomPropertyEditor::_modified(String p_string) { case Variant::DICTIONARY: { } break; - case Variant::POOL_BYTE_ARRAY: { + case Variant::PACKED_BYTE_ARRAY: { } break; - case Variant::POOL_INT_ARRAY: { + case Variant::PACKED_INT_ARRAY: { } break; - case Variant::POOL_REAL_ARRAY: { + case Variant::PACKED_REAL_ARRAY: { } break; - case Variant::POOL_STRING_ARRAY: { + case Variant::PACKED_STRING_ARRAY: { } break; - case Variant::POOL_VECTOR3_ARRAY: { + case Variant::PACKED_VECTOR3_ARRAY: { } break; - case Variant::POOL_COLOR_ARRAY: { + case Variant::PACKED_COLOR_ARRAY: { } break; default: { diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp index 1de5099c4a..8cc1448b7a 100644 --- a/editor/property_selector.cpp +++ b/editor/property_selector.cpp @@ -141,13 +141,13 @@ void PropertySelector::_update_search() { Control::get_icon("Object", "EditorIcons"), Control::get_icon("Dictionary", "EditorIcons"), Control::get_icon("Array", "EditorIcons"), - Control::get_icon("PoolByteArray", "EditorIcons"), - Control::get_icon("PoolIntArray", "EditorIcons"), - Control::get_icon("PoolRealArray", "EditorIcons"), - Control::get_icon("PoolStringArray", "EditorIcons"), - Control::get_icon("PoolVector2Array", "EditorIcons"), - Control::get_icon("PoolVector3Array", "EditorIcons"), - Control::get_icon("PoolColorArray", "EditorIcons") + Control::get_icon("PackedByteArray", "EditorIcons"), + Control::get_icon("PackedIntArray", "EditorIcons"), + Control::get_icon("PackedRealArray", "EditorIcons"), + Control::get_icon("PackedStringArray", "EditorIcons"), + Control::get_icon("PackedVector2Array", "EditorIcons"), + Control::get_icon("PackedVector3Array", "EditorIcons"), + Control::get_icon("PackedColorArray", "EditorIcons") }; for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 0e8a9146e1..ecaef4fb0f 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -1120,7 +1120,7 @@ void SceneTreeEditor::_bind_methods() { ADD_SIGNAL(MethodInfo("node_changed")); ADD_SIGNAL(MethodInfo("nodes_dragged")); ADD_SIGNAL(MethodInfo("nodes_rearranged", PropertyInfo(Variant::ARRAY, "paths"), PropertyInfo(Variant::NODE_PATH, "to_path"), PropertyInfo(Variant::INT, "type"))); - ADD_SIGNAL(MethodInfo("files_dropped", PropertyInfo(Variant::POOL_STRING_ARRAY, "files"), PropertyInfo(Variant::NODE_PATH, "to_path"), PropertyInfo(Variant::INT, "type"))); + ADD_SIGNAL(MethodInfo("files_dropped", PropertyInfo(Variant::PACKED_STRING_ARRAY, "files"), PropertyInfo(Variant::NODE_PATH, "to_path"), PropertyInfo(Variant::INT, "type"))); ADD_SIGNAL(MethodInfo("script_dropped", PropertyInfo(Variant::STRING, "file"), PropertyInfo(Variant::NODE_PATH, "to_path"))); ADD_SIGNAL(MethodInfo("rmb_pressed", PropertyInfo(Variant::VECTOR2, "position"))); diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 88d45d5dde..af740d9b4f 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -835,8 +835,8 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da perf_draw->update(); } else if (p_msg == "visual_profile") { uint64_t frame = p_data[0]; - PoolVector<String> names = p_data[1]; - PoolVector<real_t> values = p_data[2]; + Vector<String> names = p_data[1]; + Vector<real_t> values = p_data[2]; EditorVisualProfiler::Metric metric; metric.areas.resize(names.size()); @@ -847,8 +847,8 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da EditorVisualProfiler::Metric::Area *areas_ptr = metric.areas.ptrw(); int metric_count = names.size(); - PoolVector<String>::Read rs = names.read(); - PoolVector<real_t>::Read rr = values.read(); + const String *rs = names.ptr(); + const real_t *rr = values.ptr(); for (int i = 0; i < metric_count; i++) { diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index 1163621815..12a879edb8 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -214,10 +214,10 @@ void EditorSpatialGizmo::add_lines(const Vector<Vector3> &p_lines, const Ref<Mat a[Mesh::ARRAY_VERTEX] = p_lines; - PoolVector<Color> color; + Vector<Color> color; color.resize(p_lines.size()); { - PoolVector<Color>::Write w = color.write(); + Color *w = color.ptrw(); for (int i = 0; i < p_lines.size(); i++) { if (is_selected()) w[i] = Color(1, 1, 1, 0.8) * p_modulate; @@ -348,10 +348,10 @@ void EditorSpatialGizmo::add_handles(const Vector<Vector3> &p_handles, const Ref Array a; a.resize(VS::ARRAY_MAX); a[VS::ARRAY_VERTEX] = p_handles; - PoolVector<Color> colors; + Vector<Color> colors; { colors.resize(p_handles.size()); - PoolVector<Color>::Write w = colors.write(); + Color *w = colors.ptrw(); for (int i = 0; i < p_handles.size(); i++) { Color col(1, 1, 1, 1); @@ -410,8 +410,8 @@ void EditorSpatialGizmo::add_solid_box(Ref<Material> &p_material, Vector3 p_size cubem.set_size(p_size); Array arrays = cubem.surface_get_arrays(0); - PoolVector3Array vertex = arrays[VS::ARRAY_VERTEX]; - PoolVector3Array::Write w = vertex.write(); + PackedVector3Array vertex = arrays[VS::ARRAY_VERTEX]; + Vector3 *w = vertex.ptrw(); for (int i = 0; i < vertex.size(); ++i) { w[i] += p_position; @@ -1566,7 +1566,7 @@ Position3DSpatialGizmoPlugin::Position3DSpatialGizmoPlugin() { pos3d_mesh = Ref<ArrayMesh>(memnew(ArrayMesh)); cursor_points = Vector<Vector3>(); - PoolVector<Color> cursor_colors; + Vector<Color> cursor_colors; float cs = 0.25; cursor_points.push_back(Vector3(+cs, 0, 0)); cursor_points.push_back(Vector3(-cs, 0, 0)); @@ -3611,7 +3611,7 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { if (Object::cast_to<ConvexPolygonShape>(*s)) { - PoolVector<Vector3> points = Object::cast_to<ConvexPolygonShape>(*s)->get_points(); + Vector<Vector3> points = Object::cast_to<ConvexPolygonShape>(*s)->get_points(); if (points.size() > 3) { @@ -3748,8 +3748,8 @@ void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { if (navmeshie.is_null()) return; - PoolVector<Vector3> vertices = navmeshie->get_vertices(); - PoolVector<Vector3>::Read vr = vertices.read(); + Vector<Vector3> vertices = navmeshie->get_vertices(); + const Vector3 *vr = vertices.ptr(); List<Face3> faces; for (int i = 0; i < navmeshie->get_polygon_count(); i++) { Vector<int> p = navmeshie->get_polygon(i); @@ -3768,11 +3768,11 @@ void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { return; 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()) { diff --git a/main/performance.cpp b/main/performance.cpp index d829c6dfdc..c7e3a41aa6 100644 --- a/main/performance.cpp +++ b/main/performance.cpp @@ -49,9 +49,7 @@ void Performance::_bind_methods() { BIND_ENUM_CONSTANT(TIME_PROCESS); BIND_ENUM_CONSTANT(TIME_PHYSICS_PROCESS); BIND_ENUM_CONSTANT(MEMORY_STATIC); - BIND_ENUM_CONSTANT(MEMORY_DYNAMIC); BIND_ENUM_CONSTANT(MEMORY_STATIC_MAX); - BIND_ENUM_CONSTANT(MEMORY_DYNAMIC_MAX); BIND_ENUM_CONSTANT(MEMORY_MESSAGE_BUFFER_MAX); BIND_ENUM_CONSTANT(OBJECT_COUNT); BIND_ENUM_CONSTANT(OBJECT_RESOURCE_COUNT); @@ -95,9 +93,7 @@ String Performance::get_monitor_name(Monitor p_monitor) const { "time/process", "time/physics_process", "memory/static", - "memory/dynamic", "memory/static_max", - "memory/dynamic_max", "memory/msg_buf_max", "object/objects", "object/resources", @@ -133,9 +129,7 @@ float Performance::get_monitor(Monitor p_monitor) const { case TIME_PROCESS: return _process_time; case TIME_PHYSICS_PROCESS: return _physics_process_time; case MEMORY_STATIC: return Memory::get_mem_usage(); - case MEMORY_DYNAMIC: return MemoryPool::total_memory; case MEMORY_STATIC_MAX: return Memory::get_mem_max_usage(); - case MEMORY_DYNAMIC_MAX: return MemoryPool::max_memory; case MEMORY_MESSAGE_BUFFER_MAX: return MessageQueue::get_singleton()->get_max_buffer_usage(); case OBJECT_COUNT: return ObjectDB::get_object_count(); case OBJECT_RESOURCE_COUNT: return ResourceCache::get_cached_resource_count(); @@ -177,8 +171,6 @@ Performance::MonitorType Performance::get_monitor_type(Monitor p_monitor) const MONITOR_TYPE_MEMORY, MONITOR_TYPE_MEMORY, MONITOR_TYPE_MEMORY, - MONITOR_TYPE_MEMORY, - MONITOR_TYPE_MEMORY, MONITOR_TYPE_QUANTITY, MONITOR_TYPE_QUANTITY, MONITOR_TYPE_QUANTITY, diff --git a/main/performance.h b/main/performance.h index 638ddbe993..c0f6044ea0 100644 --- a/main/performance.h +++ b/main/performance.h @@ -55,9 +55,7 @@ public: TIME_PROCESS, TIME_PHYSICS_PROCESS, MEMORY_STATIC, - MEMORY_DYNAMIC, MEMORY_STATIC_MAX, - MEMORY_DYNAMIC_MAX, MEMORY_MESSAGE_BUFFER_MAX, OBJECT_COUNT, OBJECT_RESOURCE_COUNT, diff --git a/main/tests/test_astar.cpp b/main/tests/test_astar.cpp index dee107f0af..e82d885af2 100644 --- a/main/tests/test_astar.cpp +++ b/main/tests/test_astar.cpp @@ -68,7 +68,7 @@ public: bool test_abc() { ABCX abcx; - PoolVector<int> path = abcx.get_id_path(ABCX::A, ABCX::C); + Vector<int> path = abcx.get_id_path(ABCX::A, ABCX::C); bool ok = path.size() == 3; int i = 0; ok = ok && path[i++] == ABCX::A; @@ -79,7 +79,7 @@ bool test_abc() { bool test_abcx() { ABCX abcx; - PoolVector<int> path = abcx.get_id_path(ABCX::X, ABCX::C); + Vector<int> path = abcx.get_id_path(ABCX::X, ABCX::C); bool ok = path.size() == 4; int i = 0; ok = ok && path[i++] == ABCX::X; @@ -304,7 +304,7 @@ bool test_solutions() { for (int u = 0; u < N; u++) for (int v = 0; v < N; v++) if (u != v) { - PoolVector<int> route = a.get_id_path(u, v); + Vector<int> route = a.get_id_path(u, v); if (!Math::is_inf(d[u][v])) { // Reachable if (route.size() == 0) { diff --git a/main/tests/test_math.cpp b/main/tests/test_math.cpp index 2c4ba08c6d..d91503501d 100644 --- a/main/tests/test_math.cpp +++ b/main/tests/test_math.cpp @@ -451,34 +451,26 @@ MainLoop *test() { print_line("RGBE: " + Color(rd, gd, bd)); } - print_line("Dvectors: " + itos(MemoryPool::allocs_used)); - print_line("Mem used: " + itos(MemoryPool::total_memory)); - print_line("MAx mem used: " + itos(MemoryPool::max_memory)); - - PoolVector<int> ints; + Vector<int> ints; ints.resize(20); { - PoolVector<int>::Write w; - w = ints.write(); + int *w; + w = ints.ptrw(); for (int i = 0; i < ints.size(); i++) { w[i] = i; } } - PoolVector<int> posho = ints; + Vector<int> posho = ints; { - PoolVector<int>::Read r = posho.read(); + const int *r = posho.ptr(); for (int i = 0; i < posho.size(); i++) { print_line(itos(i) + " : " + itos(r[i])); } } - print_line("later Dvectors: " + itos(MemoryPool::allocs_used)); - print_line("later Mem used: " + itos(MemoryPool::total_memory)); - print_line("Mlater Ax mem used: " + itos(MemoryPool::max_memory)); - List<String> cmdlargs = OS::get_singleton()->get_cmdline_args(); if (cmdlargs.empty()) { diff --git a/main/tests/test_physics.cpp b/main/tests/test_physics.cpp index 3f4f91f8f4..43958a9493 100644 --- a/main/tests/test_physics.cpp +++ b/main/tests/test_physics.cpp @@ -143,7 +143,7 @@ protected: /* BOX SHAPE */ - PoolVector<Plane> box_planes = Geometry::build_box_planes(Vector3(0.5, 0.5, 0.5)); + Vector<Plane> box_planes = Geometry::build_box_planes(Vector3(0.5, 0.5, 0.5)); RID box_mesh = vs->mesh_create(); Geometry::MeshData box_data = Geometry::build_convex_mesh(box_planes); vs->mesh_add_surface_from_mesh_data(box_mesh, box_data); @@ -155,7 +155,7 @@ protected: /* CAPSULE SHAPE */ - PoolVector<Plane> capsule_planes = Geometry::build_capsule_planes(0.5, 0.7, 12, Vector3::AXIS_Z); + Vector<Plane> capsule_planes = Geometry::build_capsule_planes(0.5, 0.7, 12, Vector3::AXIS_Z); RID capsule_mesh = vs->mesh_create(); Geometry::MeshData capsule_data = Geometry::build_convex_mesh(capsule_planes); @@ -172,7 +172,7 @@ protected: /* CONVEX SHAPE */ - PoolVector<Plane> convex_planes = Geometry::build_cylinder_planes(0.5, 0.7, 5, Vector3::AXIS_Z); + Vector<Plane> convex_planes = Geometry::build_cylinder_planes(0.5, 0.7, 5, Vector3::AXIS_Z); RID convex_mesh = vs->mesh_create(); Geometry::MeshData convex_data = Geometry::build_convex_mesh(convex_planes); @@ -363,7 +363,7 @@ public: VisualServer *vs = VisualServer::get_singleton(); PhysicsServer *ps = PhysicsServer::get_singleton(); - PoolVector<Plane> capsule_planes = Geometry::build_capsule_planes(0.5, 1, 12, 5, Vector3::AXIS_Y); + Vector<Plane> capsule_planes = Geometry::build_capsule_planes(0.5, 1, 12, 5, Vector3::AXIS_Y); RID capsule_mesh = vs->mesh_create(); Geometry::MeshData capsule_data = Geometry::build_convex_mesh(capsule_planes); diff --git a/main/tests/test_physics_2d.cpp b/main/tests/test_physics_2d.cpp index 9c10fcbd56..160c25f43a 100644 --- a/main/tests/test_physics_2d.cpp +++ b/main/tests/test_physics_2d.cpp @@ -72,7 +72,7 @@ class TestPhysics2DMainLoop : public MainLoop { { - PoolVector<uint8_t> pixels; + Vector<uint8_t> pixels; pixels.resize(32 * 2 * 2); for (int i = 0; i < 2; i++) { @@ -97,7 +97,7 @@ class TestPhysics2DMainLoop : public MainLoop { { - PoolVector<uint8_t> pixels; + Vector<uint8_t> pixels; pixels.resize(32 * 32 * 2); for (int i = 0; i < 32; i++) { @@ -124,7 +124,7 @@ class TestPhysics2DMainLoop : public MainLoop { { - PoolVector<uint8_t> pixels; + Vector<uint8_t> pixels; pixels.resize(32 * 32 * 2); for (int i = 0; i < 32; i++) { @@ -151,7 +151,7 @@ class TestPhysics2DMainLoop : public MainLoop { { - PoolVector<uint8_t> pixels; + Vector<uint8_t> pixels; pixels.resize(32 * 64 * 2); for (int i = 0; i < 64; i++) { @@ -185,7 +185,7 @@ class TestPhysics2DMainLoop : public MainLoop { RID convex_polygon_shape = ps->convex_polygon_shape_create(); - PoolVector<Vector2> arr; + Vector<Vector2> arr; Point2 sb(32, 32); arr.push_back(Point2(20, 3) - sb); arr.push_back(Point2(58, 23) - sb); diff --git a/main/tests/test_render.cpp b/main/tests/test_render.cpp index 0e101fb566..62239a5cb5 100644 --- a/main/tests/test_render.cpp +++ b/main/tests/test_render.cpp @@ -81,7 +81,7 @@ public: Vector<Vector3> vts; /* - PoolVector<Plane> sp = Geometry::build_sphere_planes(2,5,5); + Vector<Plane> sp = Geometry::build_sphere_planes(2,5,5); Geometry::MeshData md2 = Geometry::build_convex_mesh(sp); vts=md2.vertices; */ diff --git a/modules/arkit/arkit_interface.h b/modules/arkit/arkit_interface.h index cb18350409..4f8f726816 100644 --- a/modules/arkit/arkit_interface.h +++ b/modules/arkit/arkit_interface.h @@ -62,7 +62,7 @@ private: Ref<CameraFeed> feed; int image_width[2]; int image_height[2]; - PoolVector<uint8_t> img_data[2]; + Vector<uint8_t> img_data[2]; struct anchor_map { ARVRPositionalTracker *tracker; diff --git a/modules/arkit/arkit_interface.mm b/modules/arkit/arkit_interface.mm index 1896a34e46..39447e8dab 100644 --- a/modules/arkit/arkit_interface.mm +++ b/modules/arkit/arkit_interface.mm @@ -488,7 +488,7 @@ void ARKitInterface::process() { img_data[0].resize(new_width * new_height); } - PoolVector<uint8_t>::Write w = img_data[0].write(); + uint8_t *w = img_data[0].write(); if (new_width == bytes_per_row) { memcpy(w.ptr(), dataY, new_width * new_height); } else { @@ -519,7 +519,7 @@ void ARKitInterface::process() { img_data[1].resize(2 * new_width * new_height); } - PoolVector<uint8_t>::Write w = img_data[1].write(); + uint8_t *w = img_data[1].write(); if ((2 * new_width) == bytes_per_row) { memcpy(w.ptr(), dataCbCr, 2 * new_width * new_height); } else { diff --git a/modules/assimp/editor_scene_importer_assimp.cpp b/modules/assimp/editor_scene_importer_assimp.cpp index 2e653f4c5d..01d49e7995 100644 --- a/modules/assimp/editor_scene_importer_assimp.cpp +++ b/modules/assimp/editor_scene_importer_assimp.cpp @@ -1217,17 +1217,17 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat const size_t num_vertices = ai_mesh->mAnimMeshes[j]->mNumVertices; array_copy[Mesh::ARRAY_INDEX] = Variant(); if (ai_mesh->mAnimMeshes[j]->HasPositions()) { - PoolVector3Array vertices; + PackedVector3Array vertices; vertices.resize(num_vertices); for (size_t l = 0; l < num_vertices; l++) { const aiVector3D ai_pos = ai_mesh->mAnimMeshes[j]->mVertices[l]; Vector3 position = Vector3(ai_pos.x, ai_pos.y, ai_pos.z); - vertices.write()[l] = position; + vertices.ptrw()[l] = position; } - PoolVector3Array new_vertices = array_copy[VisualServer::ARRAY_VERTEX].duplicate(true); + PackedVector3Array new_vertices = array_copy[VisualServer::ARRAY_VERTEX].duplicate(true); ERR_CONTINUE(vertices.size() != new_vertices.size()); for (int32_t l = 0; l < new_vertices.size(); l++) { - PoolVector3Array::Write w = new_vertices.write(); + Vector3 *w = new_vertices.ptrw(); w[l] = vertices[l]; } array_copy[VisualServer::ARRAY_VERTEX] = new_vertices; @@ -1235,53 +1235,53 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat int32_t color_set = 0; if (ai_mesh->mAnimMeshes[j]->HasVertexColors(color_set)) { - PoolColorArray colors; + PackedColorArray colors; colors.resize(num_vertices); for (size_t l = 0; l < num_vertices; l++) { const aiColor4D ai_color = ai_mesh->mAnimMeshes[j]->mColors[color_set][l]; Color color = Color(ai_color.r, ai_color.g, ai_color.b, ai_color.a); - colors.write()[l] = color; + colors.ptrw()[l] = color; } - PoolColorArray new_colors = array_copy[VisualServer::ARRAY_COLOR].duplicate(true); + PackedColorArray new_colors = array_copy[VisualServer::ARRAY_COLOR].duplicate(true); ERR_CONTINUE(colors.size() != new_colors.size()); for (int32_t l = 0; l < colors.size(); l++) { - PoolColorArray::Write w = new_colors.write(); + Color *w = new_colors.ptrw(); w[l] = colors[l]; } array_copy[VisualServer::ARRAY_COLOR] = new_colors; } if (ai_mesh->mAnimMeshes[j]->HasNormals()) { - PoolVector3Array normals; + PackedVector3Array normals; normals.resize(num_vertices); for (size_t l = 0; l < num_vertices; l++) { const aiVector3D ai_normal = ai_mesh->mAnimMeshes[j]->mNormals[l]; Vector3 normal = Vector3(ai_normal.x, ai_normal.y, ai_normal.z); - normals.write()[l] = normal; + normals.ptrw()[l] = normal; } - PoolVector3Array new_normals = array_copy[VisualServer::ARRAY_NORMAL].duplicate(true); + PackedVector3Array new_normals = array_copy[VisualServer::ARRAY_NORMAL].duplicate(true); ERR_CONTINUE(normals.size() != new_normals.size()); for (int l = 0; l < normals.size(); l++) { - PoolVector3Array::Write w = new_normals.write(); + Vector3 *w = new_normals.ptrw(); w[l] = normals[l]; } array_copy[VisualServer::ARRAY_NORMAL] = new_normals; } if (ai_mesh->mAnimMeshes[j]->HasTangentsAndBitangents()) { - PoolColorArray tangents; + PackedColorArray tangents; tangents.resize(num_vertices); - PoolColorArray::Write w = tangents.write(); + Color *w = tangents.ptrw(); for (size_t l = 0; l < num_vertices; l++) { AssimpUtils::calc_tangent_from_mesh(ai_mesh, j, l, l, w); } - PoolRealArray new_tangents = array_copy[VisualServer::ARRAY_TANGENT].duplicate(true); + PackedRealArray new_tangents = array_copy[VisualServer::ARRAY_TANGENT].duplicate(true); ERR_CONTINUE(new_tangents.size() != tangents.size() * 4); for (int32_t l = 0; l < tangents.size(); l++) { - new_tangents.write()[l + 0] = tangents[l].r; - new_tangents.write()[l + 1] = tangents[l].g; - new_tangents.write()[l + 2] = tangents[l].b; - new_tangents.write()[l + 3] = tangents[l].a; + new_tangents.ptrw()[l + 0] = tangents[l].r; + new_tangents.ptrw()[l + 1] = tangents[l].g; + new_tangents.ptrw()[l + 2] = tangents[l].b; + new_tangents.ptrw()[l + 3] = tangents[l].a; } array_copy[VisualServer::ARRAY_TANGENT] = new_tangents; } diff --git a/modules/assimp/import_utils.h b/modules/assimp/import_utils.h index d037efce21..80b67b5453 100644 --- a/modules/assimp/import_utils.h +++ b/modules/assimp/import_utils.h @@ -98,7 +98,7 @@ public: /** * calculate tangents for mesh data from assimp data */ - static void calc_tangent_from_mesh(const aiMesh *ai_mesh, int i, int tri_index, int index, PoolColorArray::Write &w) { + static void calc_tangent_from_mesh(const aiMesh *ai_mesh, int i, int tri_index, int index, Color *w) { const aiVector3D normals = ai_mesh->mAnimMeshes[i]->mNormals[tri_index]; const Vector3 godot_normal = Vector3(normals.x, normals.y, normals.z); const aiVector3D tangent = ai_mesh->mAnimMeshes[i]->mTangents[tri_index]; @@ -375,17 +375,17 @@ public: } else { Ref<Image> img; img.instance(); - PoolByteArray arr; + PackedByteArray arr; uint32_t size = tex->mWidth * tex->mHeight; arr.resize(size); - memcpy(arr.write().ptr(), tex->pcData, size); + memcpy(arr.ptrw(), tex->pcData, size); ERR_FAIL_COND_V(arr.size() % 4 != 0, Ref<Image>()); //ARGB8888 to RGBA8888 for (int32_t i = 0; i < arr.size() / 4; i++) { - arr.write().ptr()[(4 * i) + 3] = arr[(4 * i) + 0]; - arr.write().ptr()[(4 * i) + 0] = arr[(4 * i) + 1]; - arr.write().ptr()[(4 * i) + 1] = arr[(4 * i) + 2]; - arr.write().ptr()[(4 * i) + 2] = arr[(4 * i) + 3]; + arr.ptrw()[(4 * i) + 3] = arr[(4 * i) + 0]; + arr.ptrw()[(4 * i) + 0] = arr[(4 * i) + 1]; + arr.ptrw()[(4 * i) + 1] = arr[(4 * i) + 2]; + arr.ptrw()[(4 * i) + 2] = arr[(4 * i) + 3]; } img->create(tex->mWidth, tex->mHeight, true, Image::FORMAT_RGBA8, arr); ERR_FAIL_COND_V(img.is_null(), Ref<Image>()); diff --git a/modules/basis_universal/register_types.cpp b/modules/basis_universal/register_types.cpp index f5ae424b56..13f4d5fc48 100644 --- a/modules/basis_universal/register_types.cpp +++ b/modules/basis_universal/register_types.cpp @@ -52,9 +52,9 @@ enum BasisDecompressFormat { basist::etc1_global_selector_codebook *sel_codebook = nullptr; -static PoolVector<uint8_t> basis_universal_packer(const Ref<Image> &p_image, Image::UsedChannels p_channels) { +static Vector<uint8_t> basis_universal_packer(const Ref<Image> &p_image, Image::UsedChannels p_channels) { - PoolVector<uint8_t> budata; + Vector<uint8_t> budata; #ifdef TOOLS_ENABLED @@ -74,10 +74,10 @@ static PoolVector<uint8_t> basis_universal_packer(const Ref<Image> &p_image, Ima basisu::image buimg(image->get_width(), image->get_height()); { - PoolVector<uint8_t> vec = image->get_data(); - PoolVector<uint8_t>::Read r = vec.read(); + Vector<uint8_t> vec = image->get_data(); + const uint8_t *r = vec.ptr(); - memcpy(buimg.get_ptr(), r.ptr(), vec.size()); + memcpy(buimg.get_ptr(), r, vec.size()); } //image->save_png("pepeche.png"); @@ -145,10 +145,10 @@ static PoolVector<uint8_t> basis_universal_packer(const Ref<Image> &p_image, Ima budata.resize(buvec.size() + 4); { - PoolVector<uint8_t>::Write w = budata.write(); - uint32_t *decf = (uint32_t *)w.ptr(); + uint8_t *w = budata.ptrw(); + uint32_t *decf = (uint32_t *)w; *decf = decompress_format; - memcpy(w.ptr() + 4, &buvec[0], buvec.size()); + memcpy(w + 4, &buvec[0], buvec.size()); } } @@ -156,11 +156,11 @@ static PoolVector<uint8_t> basis_universal_packer(const Ref<Image> &p_image, Ima return budata; } -static Ref<Image> basis_universal_unpacker(const PoolVector<uint8_t> &p_buffer) { +static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) { Ref<Image> image; - PoolVector<uint8_t>::Read r = p_buffer.read(); - const uint8_t *ptr = r.ptr(); + const uint8_t *r = p_buffer.ptr(); + const uint8_t *ptr = r; int size = p_buffer.size(); basist::transcoder_texture_format format; @@ -241,12 +241,12 @@ static Ref<Image> basis_universal_unpacker(const PoolVector<uint8_t> &p_buffer) tr.get_image_info(ptr, size, info, 0); int block_size = basist::basis_get_bytes_per_block(format); - PoolVector<uint8_t> gpudata; + Vector<uint8_t> gpudata; gpudata.resize(info.m_total_blocks * block_size); { - PoolVector<uint8_t>::Write w = gpudata.write(); - uint8_t *dst = w.ptr(); + uint8_t *w = gpudata.ptrw(); + uint8_t *dst = w; for (int i = 0; i < gpudata.size(); i++) dst[i] = 0x00; diff --git a/modules/basis_universal/texture_basisu.cpp b/modules/basis_universal/texture_basisu.cpp index 3b3805157b..12f3241c98 100644 --- a/modules/basis_universal/texture_basisu.cpp +++ b/modules/basis_universal/texture_basisu.cpp @@ -44,7 +44,7 @@ void TextureBasisU::_bind_methods() { ClassDB::bind_method(D_METHOD("get_basisu_data"), &TextureBasisU::get_data); ClassDB::bind_method(D_METHOD("import"), &TextureBasisU::import); - ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "basisu_data"), "set_basisu_data", "get_basisu_data"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_BYTE_ARRAY, "basisu_data"), "set_basisu_data", "get_basisu_data"); }; @@ -81,13 +81,13 @@ uint32_t TextureBasisU::get_flags() const { }; -void TextureBasisU::set_basisu_data(const PoolVector<uint8_t>& p_data) { +void TextureBasisU::set_basisu_data(const Vector<uint8_t>& p_data) { #ifdef TOOLS_ENABLED data = p_data; #endif - PoolVector<uint8_t>::Read r = p_data.read(); + const uint8_t* r = p_data.ptr(); const void* ptr = r.ptr(); int size = p_data.size(); @@ -114,11 +114,11 @@ void TextureBasisU::set_basisu_data(const PoolVector<uint8_t>& p_data) { tex_size = Size2(info.m_width, info.m_height); int block_size = basist::basis_get_bytes_per_block(format); - PoolVector<uint8_t> gpudata; + Vector<uint8_t> gpudata; gpudata.resize(info.m_total_blocks * block_size); { - PoolVector<uint8_t>::Write w = gpudata.write(); + uint8_t* w = gpudata.ptrw(); uint8_t* dst = w.ptr(); for (int i=0; i<gpudata.size(); i++) dst[i] = 0x00; @@ -152,7 +152,7 @@ Error TextureBasisU::import(const Ref<Image>& p_img) { #ifdef TOOLS_ENABLED - PoolVector<uint8_t> budata; + Vector<uint8_t> budata; { Image::Format format = p_img->get_format(); @@ -168,9 +168,9 @@ Error TextureBasisU::import(const Ref<Image>& p_img) { basisu::image buimg(p_img->get_width(), p_img->get_height()); int size = p_img->get_width() * p_img->get_height() * 4; - PoolVector<uint8_t> vec = copy->get_data(); + Vector<uint8_t> vec = copy->get_data(); { - PoolVector<uint8_t>::Read r = vec.read(); + const uint8_t* r = vec.ptr(); memcpy(buimg.get_ptr(), r.ptr(), size); }; @@ -198,7 +198,7 @@ Error TextureBasisU::import(const Ref<Image>& p_img) { budata.resize(buvec.size()); { - PoolVector<uint8_t>::Write w = budata.write(); + uint8_t* w = budata.ptrw(); memcpy(w.ptr(), &buvec[0], budata.size()); }; }; @@ -213,7 +213,7 @@ Error TextureBasisU::import(const Ref<Image>& p_img) { }; -PoolVector<uint8_t> TextureBasisU::get_basisu_data() const { +Vector<uint8_t> TextureBasisU::get_basisu_data() const { return data; }; diff --git a/modules/basis_universal/texture_basisu.h b/modules/basis_universal/texture_basisu.h index 8474a63258..8de151ede0 100644 --- a/modules/basis_universal/texture_basisu.h +++ b/modules/basis_universal/texture_basisu.h @@ -47,7 +47,7 @@ class TextureBasisU : public Texture { uint32_t flags; - PoolVector<uint8_t> data; + Vector<uint8_t> data; static void _bind_methods(); @@ -64,9 +64,9 @@ public: Error import(const Ref<Image> &p_img); - void set_basisu_data(const PoolVector<uint8_t>& p_data); + void set_basisu_data(const Vector<uint8_t>& p_data); - PoolVector<uint8_t> get_basisu_data() const; + Vector<uint8_t> get_basisu_data() const; String get_img_path() const; TextureBasisU(); diff --git a/modules/bmp/image_loader_bmp.cpp b/modules/bmp/image_loader_bmp.cpp index 5ce6d59daa..71e5076e78 100644 --- a/modules/bmp/image_loader_bmp.cpp +++ b/modules/bmp/image_loader_bmp.cpp @@ -65,7 +65,7 @@ Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image, } // Image data (might be indexed) - PoolVector<uint8_t> data; + Vector<uint8_t> data; int data_len = 0; if (bits_per_pixel <= 8) { // indexed @@ -76,8 +76,8 @@ Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image, ERR_FAIL_COND_V(data_len == 0, ERR_BUG); err = data.resize(data_len); - PoolVector<uint8_t>::Write data_w = data.write(); - uint8_t *write_buffer = data_w.ptr(); + uint8_t *data_w = data.ptrw(); + uint8_t *write_buffer = data_w; const uint32_t width_bytes = width * bits_per_pixel / 8; const uint32_t line_width = (width_bytes + 3) & ~3; @@ -158,11 +158,11 @@ Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image, } else { // data is in indexed format, extend it // Palette data - PoolVector<uint8_t> palette_data; + Vector<uint8_t> palette_data; palette_data.resize(color_table_size * 4); - PoolVector<uint8_t>::Write palette_data_w = palette_data.write(); - uint8_t *pal = palette_data_w.ptr(); + uint8_t *palette_data_w = palette_data.ptrw(); + uint8_t *pal = palette_data_w; const uint8_t *cb = p_color_buffer; @@ -177,11 +177,11 @@ Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image, cb += 4; } // Extend palette to image - PoolVector<uint8_t> extended_data; + Vector<uint8_t> extended_data; extended_data.resize(data.size() * 4); - PoolVector<uint8_t>::Write ex_w = extended_data.write(); - uint8_t *dest = ex_w.ptr(); + uint8_t *ex_w = extended_data.ptrw(); + uint8_t *dest = ex_w; const int num_pixels = width * height; @@ -260,27 +260,27 @@ Error ImageLoaderBMP::load_image(Ref<Image> p_image, FileAccess *f, ERR_FAIL_COND_V(color_table_size == 0, ERR_BUG); } - PoolVector<uint8_t> bmp_color_table; + Vector<uint8_t> bmp_color_table; // Color table is usually 4 bytes per color -> [B][G][R][0] bmp_color_table.resize(color_table_size * 4); - PoolVector<uint8_t>::Write bmp_color_table_w = bmp_color_table.write(); - f->get_buffer(bmp_color_table_w.ptr(), color_table_size * 4); + uint8_t *bmp_color_table_w = bmp_color_table.ptrw(); + f->get_buffer(bmp_color_table_w, color_table_size * 4); f->seek(bmp_header.bmp_file_header.bmp_file_offset); uint32_t bmp_buffer_size = (bmp_header.bmp_file_header.bmp_file_size - bmp_header.bmp_file_header.bmp_file_offset); - PoolVector<uint8_t> bmp_buffer; + Vector<uint8_t> bmp_buffer; err = bmp_buffer.resize(bmp_buffer_size); if (err == OK) { - PoolVector<uint8_t>::Write bmp_buffer_w = bmp_buffer.write(); - f->get_buffer(bmp_buffer_w.ptr(), bmp_buffer_size); + uint8_t *bmp_buffer_w = bmp_buffer.ptrw(); + f->get_buffer(bmp_buffer_w, bmp_buffer_size); - PoolVector<uint8_t>::Read bmp_buffer_r = bmp_buffer.read(); - PoolVector<uint8_t>::Read bmp_color_table_r = bmp_color_table.read(); - err = convert_to_image(p_image, bmp_buffer_r.ptr(), - bmp_color_table_r.ptr(), color_table_size, bmp_header); + const uint8_t *bmp_buffer_r = bmp_buffer.ptr(); + const uint8_t *bmp_color_table_r = bmp_color_table.ptr(); + err = convert_to_image(p_image, bmp_buffer_r, + bmp_color_table_r, color_table_size, bmp_header); } f->close(); } diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp index f46db09e4a..1690950049 100644 --- a/modules/bullet/shape_bullet.cpp +++ b/modules/bullet/shape_bullet.cpp @@ -142,11 +142,11 @@ btScaledBvhTriangleMeshShape *ShapeBullet::create_shape_concave(btBvhTriangleMes } } -btHeightfieldTerrainShape *ShapeBullet::create_shape_height_field(PoolVector<real_t> &p_heights, int p_width, int p_depth, real_t p_min_height, real_t p_max_height) { +btHeightfieldTerrainShape *ShapeBullet::create_shape_height_field(Vector<real_t> &p_heights, int p_width, int p_depth, real_t p_min_height, real_t p_max_height) { const btScalar ignoredHeightScale(1); const int YAxis = 1; // 0=X, 1=Y, 2=Z const bool flipQuadEdges = false; - const void *heightsPtr = p_heights.read().ptr(); + const void *heightsPtr = p_heights.ptr(); btHeightfieldTerrainShape *heightfield = bulletnew(btHeightfieldTerrainShape(p_width, p_depth, heightsPtr, ignoredHeightScale, p_min_height, p_max_height, YAxis, PHY_FLOAT, flipQuadEdges)); @@ -370,7 +370,7 @@ ConcavePolygonShapeBullet::~ConcavePolygonShapeBullet() { delete meshShape->getTriangleInfoMap(); bulletdelete(meshShape); } - faces = PoolVector<Vector3>(); + faces = Vector<Vector3>(); } void ConcavePolygonShapeBullet::set_data(const Variant &p_data) { @@ -385,7 +385,7 @@ PhysicsServer::ShapeType ConcavePolygonShapeBullet::get_type() const { return PhysicsServer::SHAPE_CONCAVE_POLYGON; } -void ConcavePolygonShapeBullet::setup(PoolVector<Vector3> p_faces) { +void ConcavePolygonShapeBullet::setup(Vector<Vector3> p_faces) { faces = p_faces; if (meshShape) { /// Clear previous created shape @@ -401,8 +401,8 @@ void ConcavePolygonShapeBullet::setup(PoolVector<Vector3> p_faces) { btTriangleMesh *shapeInterface = bulletnew(btTriangleMesh); src_face_count /= 3; - PoolVector<Vector3>::Read r = p_faces.read(); - const Vector3 *facesr = r.ptr(); + const Vector3 *r = p_faces.ptr(); + const Vector3 *facesr = r; btVector3 supVec_0; btVector3 supVec_1; @@ -471,10 +471,10 @@ void HeightMapShapeBullet::set_data(const Variant &p_data) { // TODO This code will need adjustments if real_t is set to `double`, // because that precision is unnecessary for a heightmap and Bullet doesn't support it... - PoolVector<real_t> l_heights; + Vector<real_t> l_heights; Variant l_heights_v = d["heights"]; - if (l_heights_v.get_type() == Variant::POOL_REAL_ARRAY) { + if (l_heights_v.get_type() == Variant::PACKED_REAL_ARRAY) { // Ready-to-use heights can be passed l_heights = l_heights_v; @@ -491,13 +491,13 @@ void HeightMapShapeBullet::set_data(const Variant &p_data) { // We could convert here automatically but it's better to not be intrusive and let the caller do it if necessary. ERR_FAIL_COND(l_image->get_format() != Image::FORMAT_RF); - PoolByteArray im_data = l_image->get_data(); + PackedByteArray im_data = l_image->get_data(); l_heights.resize(l_image->get_width() * l_image->get_height()); - PoolRealArray::Write w = l_heights.write(); - PoolByteArray::Read r = im_data.read(); - float *rp = (float *)r.ptr(); + real_t *w = l_heights.ptrw(); + const uint8_t *r = im_data.ptr(); + float *rp = (float *)r; // At this point, `rp` could be used directly for Bullet, but I don't know how safe it would be. for (int i = 0; i < l_heights.size(); ++i) { @@ -505,7 +505,7 @@ void HeightMapShapeBullet::set_data(const Variant &p_data) { } } else { - ERR_FAIL_MSG("Expected PoolRealArray or float Image."); + ERR_FAIL_MSG("Expected PackedRealArray or float Image."); } ERR_FAIL_COND(l_width <= 0); @@ -515,7 +515,7 @@ void HeightMapShapeBullet::set_data(const Variant &p_data) { // Compute min and max heights if not specified. if (!d.has("min_height") && !d.has("max_height")) { - PoolVector<real_t>::Read r = l_heights.read(); + const real_t *r = l_heights.ptr(); int heights_size = l_heights.size(); for (int i = 0; i < heights_size; ++i) { @@ -540,7 +540,7 @@ PhysicsServer::ShapeType HeightMapShapeBullet::get_type() const { return PhysicsServer::SHAPE_HEIGHTMAP; } -void HeightMapShapeBullet::setup(PoolVector<real_t> &p_heights, int p_width, int p_depth, real_t p_min_height, real_t p_max_height) { +void HeightMapShapeBullet::setup(Vector<real_t> &p_heights, int p_width, int p_depth, real_t p_min_height, real_t p_max_height) { // TODO cell size must be tweaked using localScaling, which is a shared property for all Bullet shapes // If this array is resized outside of here, it should be preserved due to CoW diff --git a/modules/bullet/shape_bullet.h b/modules/bullet/shape_bullet.h index 8d3512cab4..27bf011ca1 100644 --- a/modules/bullet/shape_bullet.h +++ b/modules/bullet/shape_bullet.h @@ -90,7 +90,7 @@ public: /// IMPORTANT: Remember to delete the shape interface by calling: delete my_shape->getMeshInterface(); static class btConvexPointCloudShape *create_shape_convex(btAlignedObjectArray<btVector3> &p_vertices, const btVector3 &p_local_scaling = btVector3(1, 1, 1)); static class btScaledBvhTriangleMeshShape *create_shape_concave(btBvhTriangleMeshShape *p_mesh_shape, const btVector3 &p_local_scaling = btVector3(1, 1, 1)); - static class btHeightfieldTerrainShape *create_shape_height_field(PoolVector<real_t> &p_heights, int p_width, int p_depth, real_t p_min_height, real_t p_max_height); + static class btHeightfieldTerrainShape *create_shape_height_field(Vector<real_t> &p_heights, int p_width, int p_depth, real_t p_min_height, real_t p_max_height); static class btRayShape *create_shape_ray(real_t p_length, bool p_slips_on_slope); }; @@ -203,7 +203,7 @@ class ConcavePolygonShapeBullet : public ShapeBullet { class btBvhTriangleMeshShape *meshShape; public: - PoolVector<Vector3> faces; + Vector<Vector3> faces; ConcavePolygonShapeBullet(); virtual ~ConcavePolygonShapeBullet(); @@ -214,13 +214,13 @@ public: virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0); private: - void setup(PoolVector<Vector3> p_faces); + void setup(Vector<Vector3> p_faces); }; class HeightMapShapeBullet : public ShapeBullet { public: - PoolVector<real_t> heights; + Vector<real_t> heights; int width; int depth; real_t min_height; @@ -234,7 +234,7 @@ public: virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0); private: - void setup(PoolVector<real_t> &p_heights, int p_width, int p_depth, real_t p_min_height, real_t p_max_height); + void setup(Vector<real_t> &p_heights, int p_width, int p_depth, real_t p_min_height, real_t p_max_height); }; class RayShapeBullet : public ShapeBullet { diff --git a/modules/bullet/soft_body_bullet.cpp b/modules/bullet/soft_body_bullet.cpp index a7988279c0..f21206dd0d 100644 --- a/modules/bullet/soft_body_bullet.cpp +++ b/modules/bullet/soft_body_bullet.cpp @@ -184,7 +184,7 @@ void SoftBodyBullet::get_node_offset(int p_node_index, Vector3 &r_offset) const return; Array arrays = soft_mesh->surface_get_arrays(0); - PoolVector<Vector3> vertices(arrays[VS::ARRAY_VERTEX]); + Vector<Vector3> vertices(arrays[VS::ARRAY_VERTEX]); if (0 <= p_node_index && vertices.size() > p_node_index) { r_offset = vertices[p_node_index]; @@ -230,8 +230,8 @@ void SoftBodyBullet::reset_all_node_positions() { return; Array arrays = soft_mesh->surface_get_arrays(0); - PoolVector<Vector3> vs_vertices(arrays[VS::ARRAY_VERTEX]); - PoolVector<Vector3>::Read vs_vertices_read = vs_vertices.read(); + Vector<Vector3> vs_vertices(arrays[VS::ARRAY_VERTEX]); + const Vector3 *vs_vertices_read = vs_vertices.ptr(); for (int vertex_index = bt_soft_body->m_nodes.size() - 1; 0 <= vertex_index; --vertex_index) { @@ -320,7 +320,7 @@ void SoftBodyBullet::set_drag_coefficient(real_t p_val) { } } -void SoftBodyBullet::set_trimesh_body_shape(PoolVector<int> p_indices, PoolVector<Vector3> p_vertices) { +void SoftBodyBullet::set_trimesh_body_shape(Vector<int> p_indices, Vector<Vector3> p_vertices) { /// Assert the current soft body is destroyed destroy_soft_body(); @@ -339,7 +339,7 @@ void SoftBodyBullet::set_trimesh_body_shape(PoolVector<int> p_indices, PoolVecto const int vs_vertices_size(p_vertices.size()); - PoolVector<Vector3>::Read p_vertices_read = p_vertices.read(); + const Vector3 *p_vertices_read = p_vertices.ptr(); for (int vs_vertex_index = 0; vs_vertex_index < vs_vertices_size; ++vs_vertex_index) { @@ -366,7 +366,7 @@ void SoftBodyBullet::set_trimesh_body_shape(PoolVector<int> p_indices, PoolVecto { // Parse vertices to bullet bt_vertices.resize(indices_map_size * 3); - PoolVector<Vector3>::Read p_vertices_read = p_vertices.read(); + const Vector3 *p_vertices_read = p_vertices.ptr(); for (int i = 0; i < indices_map_size; ++i) { bt_vertices.write[3 * i + 0] = p_vertices_read[indices_table[i][0]].x; @@ -382,7 +382,7 @@ void SoftBodyBullet::set_trimesh_body_shape(PoolVector<int> p_indices, PoolVecto bt_triangles.resize(triangles_size * 3); - PoolVector<int>::Read p_indices_read = p_indices.read(); + const int *p_indices_read = p_indices.ptr(); for (int i = 0; i < triangles_size; ++i) { bt_triangles.write[3 * i + 0] = vs_indices_to_physics_table[p_indices_read[3 * i + 2]]; diff --git a/modules/bullet/soft_body_bullet.h b/modules/bullet/soft_body_bullet.h index b98116b073..2df8ce074f 100644 --- a/modules/bullet/soft_body_bullet.h +++ b/modules/bullet/soft_body_bullet.h @@ -152,7 +152,7 @@ public: _FORCE_INLINE_ real_t get_drag_coefficient() const { return drag_coefficient; } private: - void set_trimesh_body_shape(PoolVector<int> p_indices, PoolVector<Vector3> p_vertices); + void set_trimesh_body_shape(Vector<int> p_indices, Vector<Vector3> p_vertices); void setup_soft_body(); void pin_node(int p_node_index); diff --git a/modules/camera/camera_ios.mm b/modules/camera/camera_ios.mm index 8059277503..f01135f251 100644 --- a/modules/camera/camera_ios.mm +++ b/modules/camera/camera_ios.mm @@ -44,7 +44,7 @@ Ref<CameraFeed> feed; size_t width[2]; size_t height[2]; - PoolVector<uint8_t> img_data[2]; + Vector<uint8_t> img_data[2]; AVCaptureDeviceInput *input; AVCaptureVideoDataOutput *output; @@ -175,7 +175,7 @@ img_data[0].resize(new_width * new_height); } - PoolVector<uint8_t>::Write w = img_data[0].write(); + uint8_t *w = img_data[0].ptrw(); memcpy(w.ptr(), dataY, new_width * new_height); img[0].instance(); @@ -196,7 +196,7 @@ img_data[1].resize(2 * new_width * new_height); } - PoolVector<uint8_t>::Write w = img_data[1].write(); + uint8_t *w = img_data[1].ptrw(); memcpy(w.ptr(), dataCbCr, 2 * new_width * new_height); ///TODO GLES2 doesn't support FORMAT_RG8, need to do some form of conversion diff --git a/modules/camera/camera_osx.mm b/modules/camera/camera_osx.mm index 658ddb728b..9a72174723 100644 --- a/modules/camera/camera_osx.mm +++ b/modules/camera/camera_osx.mm @@ -42,7 +42,7 @@ Ref<CameraFeed> feed; size_t width[2]; size_t height[2]; - PoolVector<uint8_t> img_data[2]; + Vector<uint8_t> img_data[2]; AVCaptureDeviceInput *input; AVCaptureVideoDataOutput *output; @@ -159,8 +159,8 @@ img_data[0].resize(new_width * new_height); } - PoolVector<uint8_t>::Write w = img_data[0].write(); - memcpy(w.ptr(), dataY, new_width * new_height); + uint8_t *w = img_data[0].ptrw(); + memcpy(w, dataY, new_width * new_height); img[0].instance(); img[0]->create(new_width, new_height, 0, Image::FORMAT_R8, img_data[0]); @@ -177,8 +177,8 @@ img_data[1].resize(2 * new_width * new_height); } - PoolVector<uint8_t>::Write w = img_data[1].write(); - memcpy(w.ptr(), dataCbCr, 2 * new_width * new_height); + uint8_t *w = img_data[1].ptrw(); + memcpy(w, dataCbCr, 2 * new_width * new_height); ///TODO GLES2 doesn't support FORMAT_RG8, need to do some form of conversion img[1].instance(); diff --git a/modules/csg/csg.cpp b/modules/csg/csg.cpp index cc3bbed27f..36055ce840 100644 --- a/modules/csg/csg.cpp +++ b/modules/csg/csg.cpp @@ -39,7 +39,7 @@ void CSGBrush::clear() { faces.clear(); } -void CSGBrush::build_from_faces(const PoolVector<Vector3> &p_vertices, const PoolVector<Vector2> &p_uvs, const PoolVector<bool> &p_smooth, const PoolVector<Ref<Material> > &p_materials, const PoolVector<bool> &p_invert_faces) { +void CSGBrush::build_from_faces(const Vector<Vector3> &p_vertices, const Vector<Vector2> &p_uvs, const Vector<bool> &p_smooth, const Vector<Ref<Material> > &p_materials, const Vector<bool> &p_invert_faces) { clear(); @@ -47,15 +47,15 @@ void CSGBrush::build_from_faces(const PoolVector<Vector3> &p_vertices, const Poo ERR_FAIL_COND((vc % 3) != 0); - PoolVector<Vector3>::Read rv = p_vertices.read(); + const Vector3 *rv = p_vertices.ptr(); int uvc = p_uvs.size(); - PoolVector<Vector2>::Read ruv = p_uvs.read(); + const Vector2 *ruv = p_uvs.ptr(); int sc = p_smooth.size(); - PoolVector<bool>::Read rs = p_smooth.read(); + const bool *rs = p_smooth.ptr(); int mc = p_materials.size(); - PoolVector<Ref<Material> >::Read rm = p_materials.read(); + const Ref<Material> *rm = p_materials.ptr(); int ic = p_invert_faces.size(); - PoolVector<bool>::Read ri = p_invert_faces.read(); + const bool *ri = p_invert_faces.ptr(); Map<Ref<Material>, int> material_map; diff --git a/modules/csg/csg.h b/modules/csg/csg.h index a11e55c72a..472a96d5df 100644 --- a/modules/csg/csg.h +++ b/modules/csg/csg.h @@ -38,7 +38,7 @@ #include "core/math/transform.h" #include "core/math/vector3.h" #include "core/oa_hash_map.h" -#include "core/pool_vector.h" + #include "scene/resources/material.h" struct CSGBrush { @@ -58,7 +58,7 @@ struct CSGBrush { void _regen_face_aabbs(); //create a brush from faces - void build_from_faces(const PoolVector<Vector3> &p_vertices, const PoolVector<Vector2> &p_uvs, const PoolVector<bool> &p_smooth, const PoolVector<Ref<Material> > &p_materials, const PoolVector<bool> &p_invert_faces); + void build_from_faces(const Vector<Vector3> &p_vertices, const Vector<Vector2> &p_uvs, const Vector<bool> &p_smooth, const Vector<Ref<Material> > &p_materials, const Vector<bool> &p_invert_faces); void copy_from(const CSGBrush &p_brush, const Transform &p_xform); void clear(); diff --git a/modules/csg/csg_gizmos.cpp b/modules/csg/csg_gizmos.cpp index 49387606f3..1b63bccb06 100644 --- a/modules/csg/csg_gizmos.cpp +++ b/modules/csg/csg_gizmos.cpp @@ -336,12 +336,12 @@ void CSGShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { Ref<Material> handles_material = get_material("handles"); - PoolVector<Vector3> faces = cs->get_brush_faces(); + Vector<Vector3> faces = cs->get_brush_faces(); Vector<Vector3> lines; lines.resize(faces.size() * 2); { - PoolVector<Vector3>::Read r = faces.read(); + const Vector3 *r = faces.ptr(); for (int i = 0; i < lines.size(); i += 6) { int f = i / 6; diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 33e4e9748c..e0c0aa6a51 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -334,16 +334,16 @@ void CSGShape::_update_shape() { surfaces.write[i].material = n->materials[i]; } - surfaces.write[i].verticesw = surfaces.write[i].vertices.write(); - surfaces.write[i].normalsw = surfaces.write[i].normals.write(); - surfaces.write[i].uvsw = surfaces.write[i].uvs.write(); + surfaces.write[i].verticesw = surfaces.write[i].vertices.ptrw(); + surfaces.write[i].normalsw = surfaces.write[i].normals.ptrw(); + surfaces.write[i].uvsw = surfaces.write[i].uvs.ptrw(); if (calculate_tangents) { - surfaces.write[i].tansw = surfaces.write[i].tans.write(); + surfaces.write[i].tansw = surfaces.write[i].tans.ptrw(); } } //fill arrays - PoolVector<Vector3> physics_faces; + Vector<Vector3> physics_faces; bool fill_physics_faces = false; if (root_collision_shape.is_valid()) { physics_faces.resize(n->faces.size() * 3); @@ -351,10 +351,10 @@ void CSGShape::_update_shape() { } { - PoolVector<Vector3>::Write physicsw; + Vector3 *physicsw; if (fill_physics_faces) { - physicsw = physics_faces.write(); + physicsw = physics_faces.ptrw(); } for (int i = 0; i < n->faces.size(); i++) { @@ -435,12 +435,6 @@ void CSGShape::_update_shape() { have_tangents = genTangSpaceDefault(&msc); } - // unset write access - surfaces.write[i].verticesw.release(); - surfaces.write[i].normalsw.release(); - surfaces.write[i].uvsw.release(); - surfaces.write[i].tansw.release(); - if (surfaces[i].last_added == 0) continue; @@ -470,18 +464,18 @@ AABB CSGShape::get_aabb() const { return node_aabb; } -PoolVector<Vector3> CSGShape::get_brush_faces() { - ERR_FAIL_COND_V(!is_inside_tree(), PoolVector<Vector3>()); +Vector<Vector3> CSGShape::get_brush_faces() { + ERR_FAIL_COND_V(!is_inside_tree(), Vector<Vector3>()); CSGBrush *b = _get_brush(); if (!b) { - return PoolVector<Vector3>(); + return Vector<Vector3>(); } - PoolVector<Vector3> faces; + Vector<Vector3> faces; int fc = b->faces.size(); faces.resize(fc * 3); { - PoolVector<Vector3>::Write w = faces.write(); + Vector3 *w = faces.ptrw(); for (int i = 0; i < fc; i++) { w[i * 3 + 0] = b->faces[i].vertices[0]; w[i * 3 + 1] = b->faces[i].vertices[1]; @@ -492,9 +486,9 @@ PoolVector<Vector3> CSGShape::get_brush_faces() { return faces; } -PoolVector<Face3> CSGShape::get_faces(uint32_t p_usage_flags) const { +Vector<Face3> CSGShape::get_faces(uint32_t p_usage_flags) const { - return PoolVector<Face3>(); + return Vector<Face3>(); } void CSGShape::_notification(int p_what) { @@ -671,15 +665,15 @@ CSGCombiner::CSGCombiner() { ///////////////////// -CSGBrush *CSGPrimitive::_create_brush_from_arrays(const PoolVector<Vector3> &p_vertices, const PoolVector<Vector2> &p_uv, const PoolVector<bool> &p_smooth, const PoolVector<Ref<Material> > &p_materials) { +CSGBrush *CSGPrimitive::_create_brush_from_arrays(const Vector<Vector3> &p_vertices, const Vector<Vector2> &p_uv, const Vector<bool> &p_smooth, const Vector<Ref<Material> > &p_materials) { CSGBrush *brush = memnew(CSGBrush); - PoolVector<bool> invert; + Vector<bool> invert; invert.resize(p_vertices.size() / 3); { int ic = invert.size(); - PoolVector<bool>::Write w = invert.write(); + bool *w = invert.ptrw(); for (int i = 0; i < ic; i++) { w[i] = invert_faces; } @@ -721,10 +715,10 @@ CSGBrush *CSGMesh::_build_brush() { if (!mesh.is_valid()) return NULL; - PoolVector<Vector3> vertices; - PoolVector<bool> smooth; - PoolVector<Ref<Material> > materials; - PoolVector<Vector2> uvs; + Vector<Vector3> vertices; + Vector<bool> smooth; + Vector<Ref<Material> > materials; + Vector<Vector2> uvs; Ref<Material> material = get_material(); for (int i = 0; i < mesh->get_surface_count(); i++) { @@ -740,25 +734,25 @@ CSGBrush *CSGMesh::_build_brush() { ERR_FAIL_COND_V(arrays.size() == 0, NULL); } - PoolVector<Vector3> avertices = arrays[Mesh::ARRAY_VERTEX]; + Vector<Vector3> avertices = arrays[Mesh::ARRAY_VERTEX]; if (avertices.size() == 0) continue; - PoolVector<Vector3>::Read vr = avertices.read(); + const Vector3 *vr = avertices.ptr(); - PoolVector<Vector3> anormals = arrays[Mesh::ARRAY_NORMAL]; - PoolVector<Vector3>::Read nr; + Vector<Vector3> anormals = arrays[Mesh::ARRAY_NORMAL]; + const Vector3 *nr; bool nr_used = false; if (anormals.size()) { - nr = anormals.read(); + nr = anormals.ptr(); nr_used = true; } - PoolVector<Vector2> auvs = arrays[Mesh::ARRAY_TEX_UV]; - PoolVector<Vector2>::Read uvr; + Vector<Vector2> auvs = arrays[Mesh::ARRAY_TEX_UV]; + const Vector2 *uvr; bool uvr_used = false; if (auvs.size()) { - uvr = auvs.read(); + uvr = auvs.ptr(); uvr_used = true; } @@ -769,7 +763,7 @@ CSGBrush *CSGMesh::_build_brush() { mat = mesh->surface_get_material(i); } - PoolVector<int> aindices = arrays[Mesh::ARRAY_INDEX]; + Vector<int> aindices = arrays[Mesh::ARRAY_INDEX]; if (aindices.size()) { int as = vertices.size(); int is = aindices.size(); @@ -779,12 +773,12 @@ CSGBrush *CSGMesh::_build_brush() { materials.resize((as + is) / 3); uvs.resize(as + is); - PoolVector<Vector3>::Write vw = vertices.write(); - PoolVector<bool>::Write sw = smooth.write(); - PoolVector<Vector2>::Write uvw = uvs.write(); - PoolVector<Ref<Material> >::Write mw = materials.write(); + Vector3 *vw = vertices.ptrw(); + bool *sw = smooth.ptrw(); + Vector2 *uvw = uvs.ptrw(); + Ref<Material> *mw = materials.ptrw(); - PoolVector<int>::Read ir = aindices.read(); + const int *ir = aindices.ptr(); for (int j = 0; j < is; j += 3) { @@ -825,10 +819,10 @@ CSGBrush *CSGMesh::_build_brush() { uvs.resize(as + is); materials.resize((as + is) / 3); - PoolVector<Vector3>::Write vw = vertices.write(); - PoolVector<bool>::Write sw = smooth.write(); - PoolVector<Vector2>::Write uvw = uvs.write(); - PoolVector<Ref<Material> >::Write mw = materials.write(); + Vector3 *vw = vertices.ptrw(); + bool *sw = smooth.ptrw(); + Vector2 *uvw = uvs.ptrw(); + Ref<Material> *mw = materials.ptrw(); for (int j = 0; j < is; j += 3) { @@ -932,11 +926,11 @@ CSGBrush *CSGSphere::_build_brush() { bool invert_val = is_inverting_faces(); Ref<Material> material = get_material(); - PoolVector<Vector3> faces; - PoolVector<Vector2> uvs; - PoolVector<bool> smooth; - PoolVector<Ref<Material> > materials; - PoolVector<bool> invert; + Vector<Vector3> faces; + Vector<Vector2> uvs; + Vector<bool> smooth; + Vector<Ref<Material> > materials; + Vector<bool> invert; faces.resize(face_count * 3); uvs.resize(face_count * 3); @@ -947,11 +941,11 @@ CSGBrush *CSGSphere::_build_brush() { { - PoolVector<Vector3>::Write facesw = faces.write(); - PoolVector<Vector2>::Write uvsw = uvs.write(); - PoolVector<bool>::Write smoothw = smooth.write(); - PoolVector<Ref<Material> >::Write materialsw = materials.write(); - PoolVector<bool>::Write invertw = invert.write(); + Vector3 *facesw = faces.ptrw(); + Vector2 *uvsw = uvs.ptrw(); + bool *smoothw = smooth.ptrw(); + Ref<Material> *materialsw = materials.ptrw(); + bool *invertw = invert.ptrw(); int face = 0; @@ -1135,11 +1129,11 @@ CSGBrush *CSGBox::_build_brush() { bool invert_val = is_inverting_faces(); Ref<Material> material = get_material(); - PoolVector<Vector3> faces; - PoolVector<Vector2> uvs; - PoolVector<bool> smooth; - PoolVector<Ref<Material> > materials; - PoolVector<bool> invert; + Vector<Vector3> faces; + Vector<Vector2> uvs; + Vector<bool> smooth; + Vector<Ref<Material> > materials; + Vector<bool> invert; faces.resize(face_count * 3); uvs.resize(face_count * 3); @@ -1150,11 +1144,11 @@ CSGBrush *CSGBox::_build_brush() { { - PoolVector<Vector3>::Write facesw = faces.write(); - PoolVector<Vector2>::Write uvsw = uvs.write(); - PoolVector<bool>::Write smoothw = smooth.write(); - PoolVector<Ref<Material> >::Write materialsw = materials.write(); - PoolVector<bool>::Write invertw = invert.write(); + Vector3 *facesw = faces.ptrw(); + Vector2 *uvsw = uvs.ptrw(); + bool *smoothw = smooth.ptrw(); + Ref<Material> *materialsw = materials.ptrw(); + bool *invertw = invert.ptrw(); int face = 0; @@ -1313,11 +1307,11 @@ CSGBrush *CSGCylinder::_build_brush() { bool invert_val = is_inverting_faces(); Ref<Material> material = get_material(); - PoolVector<Vector3> faces; - PoolVector<Vector2> uvs; - PoolVector<bool> smooth; - PoolVector<Ref<Material> > materials; - PoolVector<bool> invert; + Vector<Vector3> faces; + Vector<Vector2> uvs; + Vector<bool> smooth; + Vector<Ref<Material> > materials; + Vector<bool> invert; faces.resize(face_count * 3); uvs.resize(face_count * 3); @@ -1328,11 +1322,11 @@ CSGBrush *CSGCylinder::_build_brush() { { - PoolVector<Vector3>::Write facesw = faces.write(); - PoolVector<Vector2>::Write uvsw = uvs.write(); - PoolVector<bool>::Write smoothw = smooth.write(); - PoolVector<Ref<Material> >::Write materialsw = materials.write(); - PoolVector<bool>::Write invertw = invert.write(); + Vector3 *facesw = faces.ptrw(); + Vector2 *uvsw = uvs.ptrw(); + bool *smoothw = smooth.ptrw(); + Ref<Material> *materialsw = materials.ptrw(); + bool *invertw = invert.ptrw(); int face = 0; @@ -1562,11 +1556,11 @@ CSGBrush *CSGTorus::_build_brush() { bool invert_val = is_inverting_faces(); Ref<Material> material = get_material(); - PoolVector<Vector3> faces; - PoolVector<Vector2> uvs; - PoolVector<bool> smooth; - PoolVector<Ref<Material> > materials; - PoolVector<bool> invert; + Vector<Vector3> faces; + Vector<Vector2> uvs; + Vector<bool> smooth; + Vector<Ref<Material> > materials; + Vector<bool> invert; faces.resize(face_count * 3); uvs.resize(face_count * 3); @@ -1577,11 +1571,11 @@ CSGBrush *CSGTorus::_build_brush() { { - PoolVector<Vector3>::Write facesw = faces.write(); - PoolVector<Vector2>::Write uvsw = uvs.write(); - PoolVector<bool>::Write smoothw = smooth.write(); - PoolVector<Ref<Material> >::Write materialsw = materials.write(); - PoolVector<bool>::Write invertw = invert.write(); + Vector3 *facesw = faces.ptrw(); + Vector2 *uvsw = uvs.ptrw(); + bool *smoothw = smooth.ptrw(); + Ref<Material> *materialsw = materials.ptrw(); + bool *invertw = invert.ptrw(); int face = 0; @@ -1856,11 +1850,11 @@ CSGBrush *CSGPolygon::_build_brush() { bool invert_val = is_inverting_faces(); Ref<Material> material = get_material(); - PoolVector<Vector3> faces; - PoolVector<Vector2> uvs; - PoolVector<bool> smooth; - PoolVector<Ref<Material> > materials; - PoolVector<bool> invert; + Vector<Vector3> faces; + Vector<Vector2> uvs; + Vector<bool> smooth; + Vector<Ref<Material> > materials; + Vector<bool> invert; faces.resize(face_count * 3); uvs.resize(face_count * 3); @@ -1872,11 +1866,11 @@ CSGBrush *CSGPolygon::_build_brush() { AABB aabb; //must be computed { - PoolVector<Vector3>::Write facesw = faces.write(); - PoolVector<Vector2>::Write uvsw = uvs.write(); - PoolVector<bool>::Write smoothw = smooth.write(); - PoolVector<Ref<Material> >::Write materialsw = materials.write(); - PoolVector<bool>::Write invertw = invert.write(); + Vector3 *facesw = faces.ptrw(); + Vector2 *uvsw = uvs.ptrw(); + bool *smoothw = smooth.ptrw(); + Ref<Material> *materialsw = materials.ptrw(); + bool *invertw = invert.ptrw(); int face = 0; @@ -2318,7 +2312,7 @@ void CSGPolygon::_bind_methods() { ClassDB::bind_method(D_METHOD("_path_exited"), &CSGPolygon::_path_exited); ClassDB::bind_method(D_METHOD("_path_changed"), &CSGPolygon::_path_changed); - 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::INT, "mode", PROPERTY_HINT_ENUM, "Depth,Spin,Path"), "set_mode", "get_mode"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "depth", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_depth", "get_depth"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "spin_degrees", PROPERTY_HINT_RANGE, "1,360,0.1"), "set_spin_degrees", "get_spin_degrees"); diff --git a/modules/csg/csg_shape.h b/modules/csg/csg_shape.h index 1098feea51..909437e39b 100644 --- a/modules/csg/csg_shape.h +++ b/modules/csg/csg_shape.h @@ -80,17 +80,17 @@ private: }; struct ShapeUpdateSurface { - PoolVector<Vector3> vertices; - PoolVector<Vector3> normals; - PoolVector<Vector2> uvs; - PoolVector<float> tans; + Vector<Vector3> vertices; + Vector<Vector3> normals; + Vector<Vector2> uvs; + Vector<float> tans; Ref<Material> material; int last_added; - PoolVector<Vector3>::Write verticesw; - PoolVector<Vector3>::Write normalsw; - PoolVector<Vector2>::Write uvsw; - PoolVector<float>::Write tansw; + Vector3 *verticesw; + Vector3 *normalsw; + Vector2 *uvsw; + float *tansw; }; //mikktspace callbacks @@ -122,10 +122,10 @@ public: void set_operation(Operation p_operation); Operation get_operation() const; - virtual PoolVector<Vector3> get_brush_faces(); + virtual Vector<Vector3> get_brush_faces(); 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; void set_use_collision(bool p_enable); bool is_using_collision() const; @@ -172,7 +172,7 @@ private: bool invert_faces; protected: - CSGBrush *_create_brush_from_arrays(const PoolVector<Vector3> &p_vertices, const PoolVector<Vector2> &p_uv, const PoolVector<bool> &p_smooth, const PoolVector<Ref<Material> > &p_materials); + CSGBrush *_create_brush_from_arrays(const Vector<Vector3> &p_vertices, const Vector<Vector2> &p_uv, const Vector<bool> &p_smooth, const Vector<Ref<Material> > &p_materials); static void _bind_methods(); public: diff --git a/modules/cvtt/image_compress_cvtt.cpp b/modules/cvtt/image_compress_cvtt.cpp index 4d762b7a7b..9dbaa88202 100644 --- a/modules/cvtt/image_compress_cvtt.cpp +++ b/modules/cvtt/image_compress_cvtt.cpp @@ -179,7 +179,7 @@ void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::UsedChann p_image->convert(Image::FORMAT_RGBH); } - PoolVector<uint8_t>::Read rb = p_image->get_data().read(); + const uint8_t *rb = p_image->get_data().ptr(); const uint16_t *source_data = reinterpret_cast<const uint16_t *>(&rb[0]); int pixel_element_count = w * h * 3; @@ -195,15 +195,15 @@ void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::UsedChann p_image->convert(Image::FORMAT_RGBA8); //still uses RGBA to convert } - PoolVector<uint8_t>::Read rb = p_image->get_data().read(); + const uint8_t *rb = p_image->get_data().ptr(); - PoolVector<uint8_t> data; + Vector<uint8_t> data; int target_size = Image::get_image_data_size(w, h, target_format, p_image->has_mipmaps()); int mm_count = p_image->has_mipmaps() ? Image::get_image_required_mipmaps(w, h, target_format) : 0; data.resize(target_size); int shift = Image::get_format_pixel_rshift(target_format); - PoolVector<uint8_t>::Write wb = data.write(); + uint8_t *wb = data.ptrw(); int dst_ofs = 0; @@ -219,7 +219,7 @@ void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::UsedChann int num_job_threads = OS::get_singleton()->can_use_threads() ? (OS::get_singleton()->get_processor_count() - 1) : 0; #endif - PoolVector<CVTTCompressionRowTask> tasks; + Vector<CVTTCompressionRowTask> tasks; for (int i = 0; i <= mm_count; i++) { @@ -254,12 +254,12 @@ void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::UsedChann } if (num_job_threads > 0) { - PoolVector<Thread *> threads; + Vector<Thread *> threads; threads.resize(num_job_threads); - PoolVector<Thread *>::Write threads_wb = threads.write(); + Thread **threads_wb = threads.ptrw(); - PoolVector<CVTTCompressionRowTask>::Read tasks_rb = tasks.read(); + const CVTTCompressionRowTask *tasks_rb = tasks.ptr(); job_queue.job_tasks = &tasks_rb[0]; job_queue.current_task = 0; @@ -304,14 +304,14 @@ void image_decompress_cvtt(Image *p_image) { int w = p_image->get_width(); int h = p_image->get_height(); - PoolVector<uint8_t>::Read rb = p_image->get_data().read(); + const uint8_t *rb = p_image->get_data().ptr(); - PoolVector<uint8_t> data; + Vector<uint8_t> data; int target_size = Image::get_image_data_size(w, h, target_format, p_image->has_mipmaps()); int mm_count = p_image->get_mipmap_count(); data.resize(target_size); - PoolVector<uint8_t>::Write wb = data.write(); + uint8_t *wb = data.ptrw(); int bytes_per_pixel = is_hdr ? 6 : 4; @@ -388,8 +388,5 @@ void image_decompress_cvtt(Image *p_image) { h >>= 1; } - rb.release(); - wb.release(); - p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data); } diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp index 5494744c48..a04989449c 100644 --- a/modules/dds/texture_loader_dds.cpp +++ b/modules/dds/texture_loader_dds.cpp @@ -222,7 +222,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path, if (!(flags & DDSD_MIPMAPCOUNT)) mipmaps = 1; - PoolVector<uint8_t> src_data; + Vector<uint8_t> src_data; const DDSFormatInfo &info = dds_format_info[dds_format]; uint32_t w = width; @@ -245,8 +245,8 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path, } src_data.resize(size); - PoolVector<uint8_t>::Write wb = src_data.write(); - f->get_buffer(wb.ptr(), size); + uint8_t *wb = src_data.ptrw(); + f->get_buffer(wb, size); } else if (info.palette) { @@ -278,8 +278,8 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path, } src_data.resize(size + 256 * colsize); - PoolVector<uint8_t>::Write wb = src_data.write(); - f->get_buffer(wb.ptr(), size); + uint8_t *wb = src_data.ptrw(); + f->get_buffer(wb, size); for (int i = 0; i < 256; i++) { @@ -309,8 +309,8 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path, size = size * 2; src_data.resize(size); - PoolVector<uint8_t>::Write wb = src_data.write(); - f->get_buffer(wb.ptr(), size); + uint8_t *wb = src_data.ptrw(); + f->get_buffer(wb, size); switch (dds_format) { diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp index 24ee8e458e..0dbd5ca905 100644 --- a/modules/etc/image_etc.cpp +++ b/modules/etc/image_etc.cpp @@ -143,16 +143,16 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f } } - PoolVector<uint8_t>::Read r = img->get_data().read(); - ERR_FAIL_COND(!r.ptr()); + const uint8_t *r = img->get_data().ptr(); + ERR_FAIL_COND(!r); unsigned int target_size = Image::get_image_data_size(imgw, imgh, etc_format, p_img->has_mipmaps()); int mmc = 1 + (p_img->has_mipmaps() ? Image::get_image_required_mipmaps(imgw, imgh, etc_format) : 0); - PoolVector<uint8_t> dst_data; + Vector<uint8_t> dst_data; dst_data.resize(target_size); - PoolVector<uint8_t>::Write w = dst_data.write(); + uint8_t *w = dst_data.ptrw(); // prepare parameters to be passed to etc2comp int num_cpus = OS::get_singleton()->get_processor_count(); diff --git a/modules/etc/texture_loader_pkm.cpp b/modules/etc/texture_loader_pkm.cpp index facdc2e473..e460c70cec 100644 --- a/modules/etc/texture_loader_pkm.cpp +++ b/modules/etc/texture_loader_pkm.cpp @@ -71,13 +71,12 @@ RES ResourceFormatPKM::load(const String &p_path, const String &p_original_path, h.origWidth = f->get_16(); h.origHeight = f->get_16(); - PoolVector<uint8_t> src_data; + Vector<uint8_t> src_data; uint32_t size = h.texWidth * h.texHeight / 2; src_data.resize(size); - PoolVector<uint8_t>::Write wb = src_data.write(); - f->get_buffer(wb.ptr(), size); - wb.release(); + uint8_t *wb = src_data.ptrw(); + f->get_buffer(wb, size); int mipmaps = h.format; int width = h.origWidth; diff --git a/modules/gdnative/arvr/arvr_interface_gdnative.h b/modules/gdnative/arvr/arvr_interface_gdnative.h index 1077bef994..e38eb435c6 100644 --- a/modules/gdnative/arvr/arvr_interface_gdnative.h +++ b/modules/gdnative/arvr/arvr_interface_gdnative.h @@ -75,8 +75,8 @@ public: virtual bool is_stereo(); virtual Transform get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform); - // we expose a PoolVector<float> version of this function to GDNative - PoolVector<float> _get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far); + // we expose a Vector<float> version of this function to GDNative + Vector<float> _get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far); // and a CameraMatrix version to ARVRServer virtual CameraMatrix get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far); diff --git a/modules/gdnative/gdnative/array.cpp b/modules/gdnative/gdnative/array.cpp index 4a0308edec..0c764ab8fd 100644 --- a/modules/gdnative/gdnative/array.cpp +++ b/modules/gdnative/gdnative/array.cpp @@ -34,7 +34,6 @@ #include "core/os/memory.h" #include "core/color.h" -#include "core/pool_vector.h" #include "core/variant.h" @@ -53,9 +52,9 @@ void GDAPI godot_array_new_copy(godot_array *r_dest, const godot_array *p_src) { memnew_placement(dest, Array(*src)); } -void GDAPI godot_array_new_pool_color_array(godot_array *r_dest, const godot_pool_color_array *p_pca) { +void GDAPI godot_array_new_packed_color_array(godot_array *r_dest, const godot_packed_color_array *p_pca) { Array *dest = (Array *)r_dest; - PoolVector<Color> *pca = (PoolVector<Color> *)p_pca; + Vector<Color> *pca = (Vector<Color> *)p_pca; memnew_placement(dest, Array); dest->resize(pca->size()); @@ -65,9 +64,9 @@ void GDAPI godot_array_new_pool_color_array(godot_array *r_dest, const godot_poo } } -void GDAPI godot_array_new_pool_vector3_array(godot_array *r_dest, const godot_pool_vector3_array *p_pv3a) { +void GDAPI godot_array_new_packed_vector3_array(godot_array *r_dest, const godot_packed_vector3_array *p_pv3a) { Array *dest = (Array *)r_dest; - PoolVector<Vector3> *pca = (PoolVector<Vector3> *)p_pv3a; + Vector<Vector3> *pca = (Vector<Vector3> *)p_pv3a; memnew_placement(dest, Array); dest->resize(pca->size()); @@ -77,9 +76,9 @@ void GDAPI godot_array_new_pool_vector3_array(godot_array *r_dest, const godot_p } } -void GDAPI godot_array_new_pool_vector2_array(godot_array *r_dest, const godot_pool_vector2_array *p_pv2a) { +void GDAPI godot_array_new_packed_vector2_array(godot_array *r_dest, const godot_packed_vector2_array *p_pv2a) { Array *dest = (Array *)r_dest; - PoolVector<Vector2> *pca = (PoolVector<Vector2> *)p_pv2a; + Vector<Vector2> *pca = (Vector<Vector2> *)p_pv2a; memnew_placement(dest, Array); dest->resize(pca->size()); @@ -89,9 +88,9 @@ void GDAPI godot_array_new_pool_vector2_array(godot_array *r_dest, const godot_p } } -void GDAPI godot_array_new_pool_string_array(godot_array *r_dest, const godot_pool_string_array *p_psa) { +void GDAPI godot_array_new_packed_string_array(godot_array *r_dest, const godot_packed_string_array *p_psa) { Array *dest = (Array *)r_dest; - PoolVector<String> *pca = (PoolVector<String> *)p_psa; + Vector<String> *pca = (Vector<String> *)p_psa; memnew_placement(dest, Array); dest->resize(pca->size()); @@ -101,9 +100,9 @@ void GDAPI godot_array_new_pool_string_array(godot_array *r_dest, const godot_po } } -void GDAPI godot_array_new_pool_real_array(godot_array *r_dest, const godot_pool_real_array *p_pra) { +void GDAPI godot_array_new_packed_real_array(godot_array *r_dest, const godot_packed_real_array *p_pra) { Array *dest = (Array *)r_dest; - PoolVector<godot_real> *pca = (PoolVector<godot_real> *)p_pra; + Vector<godot_real> *pca = (Vector<godot_real> *)p_pra; memnew_placement(dest, Array); dest->resize(pca->size()); @@ -113,9 +112,9 @@ void GDAPI godot_array_new_pool_real_array(godot_array *r_dest, const godot_pool } } -void GDAPI godot_array_new_pool_int_array(godot_array *r_dest, const godot_pool_int_array *p_pia) { +void GDAPI godot_array_new_packed_int_array(godot_array *r_dest, const godot_packed_int_array *p_pia) { Array *dest = (Array *)r_dest; - PoolVector<godot_int> *pca = (PoolVector<godot_int> *)p_pia; + Vector<godot_int> *pca = (Vector<godot_int> *)p_pia; memnew_placement(dest, Array); dest->resize(pca->size()); @@ -125,9 +124,9 @@ void GDAPI godot_array_new_pool_int_array(godot_array *r_dest, const godot_pool_ } } -void GDAPI godot_array_new_pool_byte_array(godot_array *r_dest, const godot_pool_byte_array *p_pba) { +void GDAPI godot_array_new_packed_byte_array(godot_array *r_dest, const godot_packed_byte_array *p_pba) { Array *dest = (Array *)r_dest; - PoolVector<uint8_t> *pca = (PoolVector<uint8_t> *)p_pba; + Vector<uint8_t> *pca = (Vector<uint8_t> *)p_pba; memnew_placement(dest, Array); dest->resize(pca->size()); diff --git a/modules/gdnative/gdnative/pool_arrays.cpp b/modules/gdnative/gdnative/pool_arrays.cpp index bae1290d59..589b4d4dfe 100644 --- a/modules/gdnative/gdnative/pool_arrays.cpp +++ b/modules/gdnative/gdnative/pool_arrays.cpp @@ -31,7 +31,7 @@ #include "gdnative/pool_arrays.h" #include "core/array.h" -#include "core/pool_vector.h" + #include "core/variant.h" #include "core/color.h" @@ -46,21 +46,21 @@ extern "C" { // byte -void GDAPI godot_pool_byte_array_new(godot_pool_byte_array *r_dest) { - PoolVector<uint8_t> *dest = (PoolVector<uint8_t> *)r_dest; - memnew_placement(dest, PoolVector<uint8_t>); +void GDAPI godot_packed_byte_array_new(godot_packed_byte_array *r_dest) { + Vector<uint8_t> *dest = (Vector<uint8_t> *)r_dest; + memnew_placement(dest, Vector<uint8_t>); } -void GDAPI godot_pool_byte_array_new_copy(godot_pool_byte_array *r_dest, const godot_pool_byte_array *p_src) { - PoolVector<uint8_t> *dest = (PoolVector<uint8_t> *)r_dest; - const PoolVector<uint8_t> *src = (const PoolVector<uint8_t> *)p_src; - memnew_placement(dest, PoolVector<uint8_t>(*src)); +void GDAPI godot_packed_byte_array_new_copy(godot_packed_byte_array *r_dest, const godot_packed_byte_array *p_src) { + Vector<uint8_t> *dest = (Vector<uint8_t> *)r_dest; + const Vector<uint8_t> *src = (const Vector<uint8_t> *)p_src; + memnew_placement(dest, Vector<uint8_t>(*src)); } -void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *r_dest, const godot_array *p_a) { - PoolVector<uint8_t> *dest = (PoolVector<uint8_t> *)r_dest; +void GDAPI godot_packed_byte_array_new_with_array(godot_packed_byte_array *r_dest, const godot_array *p_a) { + Vector<uint8_t> *dest = (Vector<uint8_t> *)r_dest; Array *a = (Array *)p_a; - memnew_placement(dest, PoolVector<uint8_t>); + memnew_placement(dest, Vector<uint8_t>); dest->resize(a->size()); for (int i = 0; i < a->size(); i++) { @@ -68,93 +68,83 @@ void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *r_dest, c } } -void GDAPI godot_pool_byte_array_append(godot_pool_byte_array *p_self, const uint8_t p_data) { - PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self; - self->append(p_data); +void GDAPI godot_packed_byte_array_append(godot_packed_byte_array *p_self, const uint8_t p_data) { + Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; + self->push_back(p_data); } -void GDAPI godot_pool_byte_array_append_array(godot_pool_byte_array *p_self, const godot_pool_byte_array *p_array) { - PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self; - PoolVector<uint8_t> *array = (PoolVector<uint8_t> *)p_array; +void GDAPI godot_packed_byte_array_append_array(godot_packed_byte_array *p_self, const godot_packed_byte_array *p_array) { + Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; + Vector<uint8_t> *array = (Vector<uint8_t> *)p_array; self->append_array(*array); } -godot_error GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data) { - PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self; +godot_error GDAPI godot_packed_byte_array_insert(godot_packed_byte_array *p_self, const godot_int p_idx, const uint8_t p_data) { + Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; return (godot_error)self->insert(p_idx, p_data); } -void GDAPI godot_pool_byte_array_invert(godot_pool_byte_array *p_self) { - PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self; +void GDAPI godot_packed_byte_array_invert(godot_packed_byte_array *p_self) { + Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; self->invert(); } -void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_self, const uint8_t p_data) { - PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self; +void GDAPI godot_packed_byte_array_push_back(godot_packed_byte_array *p_self, const uint8_t p_data) { + Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; self->push_back(p_data); } -void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_self, const godot_int p_idx) { - PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self; +void GDAPI godot_packed_byte_array_remove(godot_packed_byte_array *p_self, const godot_int p_idx) { + Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; self->remove(p_idx); } -void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_self, const godot_int p_size) { - PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self; +void GDAPI godot_packed_byte_array_resize(godot_packed_byte_array *p_self, const godot_int p_size) { + Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; self->resize(p_size); } -godot_pool_byte_array_read_access GDAPI *godot_pool_byte_array_read(const godot_pool_byte_array *p_self) { - const PoolVector<uint8_t> *self = (const PoolVector<uint8_t> *)p_self; - return (godot_pool_byte_array_read_access *)memnew(PoolVector<uint8_t>::Read(self->read())); -} - -godot_pool_byte_array_write_access GDAPI *godot_pool_byte_array_write(godot_pool_byte_array *p_self) { - PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self; - return (godot_pool_byte_array_write_access *)memnew(PoolVector<uint8_t>::Write(self->write())); -} - -void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data) { - PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self; +void GDAPI godot_packed_byte_array_set(godot_packed_byte_array *p_self, const godot_int p_idx, const uint8_t p_data) { + Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; self->set(p_idx, p_data); } -uint8_t GDAPI godot_pool_byte_array_get(const godot_pool_byte_array *p_self, const godot_int p_idx) { - const PoolVector<uint8_t> *self = (const PoolVector<uint8_t> *)p_self; +uint8_t GDAPI godot_packed_byte_array_get(const godot_packed_byte_array *p_self, const godot_int p_idx) { + const Vector<uint8_t> *self = (const Vector<uint8_t> *)p_self; return self->get(p_idx); } -godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_self) { - const PoolVector<uint8_t> *self = (const PoolVector<uint8_t> *)p_self; +godot_int GDAPI godot_packed_byte_array_size(const godot_packed_byte_array *p_self) { + const Vector<uint8_t> *self = (const Vector<uint8_t> *)p_self; return self->size(); } -godot_bool GDAPI godot_pool_byte_array_empty(const godot_pool_byte_array *p_self) { - const PoolVector<uint8_t> *self = (const PoolVector<uint8_t> *)p_self; +godot_bool GDAPI godot_packed_byte_array_empty(const godot_packed_byte_array *p_self) { + const Vector<uint8_t> *self = (const Vector<uint8_t> *)p_self; return self->empty(); } -void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_self) { - ((PoolVector<uint8_t> *)p_self)->~PoolVector(); +void GDAPI godot_packed_byte_array_destroy(godot_packed_byte_array *p_self) { + ((Vector<uint8_t> *)p_self)->~Vector(); } // int -void GDAPI godot_pool_int_array_new(godot_pool_int_array *r_dest) { - PoolVector<godot_int> *dest = (PoolVector<godot_int> *)r_dest; - memnew_placement(dest, PoolVector<godot_int>); +void GDAPI godot_packed_int_array_new(godot_packed_int_array *r_dest) { + Vector<godot_int> *dest = (Vector<godot_int> *)r_dest; + memnew_placement(dest, Vector<godot_int>); } -void GDAPI godot_pool_int_array_new_copy(godot_pool_int_array *r_dest, const godot_pool_int_array *p_src) { - PoolVector<godot_int> *dest = (PoolVector<godot_int> *)r_dest; - const PoolVector<godot_int> *src = (const PoolVector<godot_int> *)p_src; - memnew_placement(dest, PoolVector<godot_int>(*src)); +void GDAPI godot_packed_int_array_new_copy(godot_packed_int_array *r_dest, const godot_packed_int_array *p_src) { + Vector<godot_int> *dest = (Vector<godot_int> *)r_dest; + const Vector<godot_int> *src = (const Vector<godot_int> *)p_src; + memnew_placement(dest, Vector<godot_int>(*src)); } -void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *r_dest, const godot_array *p_a) { - PoolVector<godot_int> *dest = (PoolVector<godot_int> *)r_dest; +void GDAPI godot_packed_int_array_new_with_array(godot_packed_int_array *r_dest, const godot_array *p_a) { + Vector<godot_int> *dest = (Vector<godot_int> *)r_dest; Array *a = (Array *)p_a; - memnew_placement(dest, PoolVector<godot_int>); + memnew_placement(dest, Vector<godot_int>); dest->resize(a->size()); for (int i = 0; i < a->size(); i++) { @@ -162,93 +152,83 @@ void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *r_dest, con } } -void GDAPI godot_pool_int_array_append(godot_pool_int_array *p_self, const godot_int p_data) { - PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self; - self->append(p_data); +void GDAPI godot_packed_int_array_append(godot_packed_int_array *p_self, const godot_int p_data) { + Vector<godot_int> *self = (Vector<godot_int> *)p_self; + self->push_back(p_data); } -void GDAPI godot_pool_int_array_append_array(godot_pool_int_array *p_self, const godot_pool_int_array *p_array) { - PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self; - PoolVector<godot_int> *array = (PoolVector<godot_int> *)p_array; +void GDAPI godot_packed_int_array_append_array(godot_packed_int_array *p_self, const godot_packed_int_array *p_array) { + Vector<godot_int> *self = (Vector<godot_int> *)p_self; + Vector<godot_int> *array = (Vector<godot_int> *)p_array; self->append_array(*array); } -godot_error GDAPI godot_pool_int_array_insert(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data) { - PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self; +godot_error GDAPI godot_packed_int_array_insert(godot_packed_int_array *p_self, const godot_int p_idx, const godot_int p_data) { + Vector<godot_int> *self = (Vector<godot_int> *)p_self; return (godot_error)self->insert(p_idx, p_data); } -void GDAPI godot_pool_int_array_invert(godot_pool_int_array *p_self) { - PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self; +void GDAPI godot_packed_int_array_invert(godot_packed_int_array *p_self) { + Vector<godot_int> *self = (Vector<godot_int> *)p_self; self->invert(); } -void GDAPI godot_pool_int_array_push_back(godot_pool_int_array *p_self, const godot_int p_data) { - PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self; +void GDAPI godot_packed_int_array_push_back(godot_packed_int_array *p_self, const godot_int p_data) { + Vector<godot_int> *self = (Vector<godot_int> *)p_self; self->push_back(p_data); } -void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_self, const godot_int p_idx) { - PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self; +void GDAPI godot_packed_int_array_remove(godot_packed_int_array *p_self, const godot_int p_idx) { + Vector<godot_int> *self = (Vector<godot_int> *)p_self; self->remove(p_idx); } -void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_self, const godot_int p_size) { - PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self; +void GDAPI godot_packed_int_array_resize(godot_packed_int_array *p_self, const godot_int p_size) { + Vector<godot_int> *self = (Vector<godot_int> *)p_self; self->resize(p_size); } -godot_pool_int_array_read_access GDAPI *godot_pool_int_array_read(const godot_pool_int_array *p_self) { - const PoolVector<godot_int> *self = (const PoolVector<godot_int> *)p_self; - return (godot_pool_int_array_read_access *)memnew(PoolVector<godot_int>::Read(self->read())); -} - -godot_pool_int_array_write_access GDAPI *godot_pool_int_array_write(godot_pool_int_array *p_self) { - PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self; - return (godot_pool_int_array_write_access *)memnew(PoolVector<godot_int>::Write(self->write())); -} - -void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data) { - PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self; +void GDAPI godot_packed_int_array_set(godot_packed_int_array *p_self, const godot_int p_idx, const godot_int p_data) { + Vector<godot_int> *self = (Vector<godot_int> *)p_self; self->set(p_idx, p_data); } -godot_int GDAPI godot_pool_int_array_get(const godot_pool_int_array *p_self, const godot_int p_idx) { - const PoolVector<godot_int> *self = (const PoolVector<godot_int> *)p_self; +godot_int GDAPI godot_packed_int_array_get(const godot_packed_int_array *p_self, const godot_int p_idx) { + const Vector<godot_int> *self = (const Vector<godot_int> *)p_self; return self->get(p_idx); } -godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_self) { - const PoolVector<godot_int> *self = (const PoolVector<godot_int> *)p_self; +godot_int GDAPI godot_packed_int_array_size(const godot_packed_int_array *p_self) { + const Vector<godot_int> *self = (const Vector<godot_int> *)p_self; return self->size(); } -godot_bool GDAPI godot_pool_int_array_empty(const godot_pool_int_array *p_self) { - const PoolVector<godot_int> *self = (const PoolVector<godot_int> *)p_self; +godot_bool GDAPI godot_packed_int_array_empty(const godot_packed_int_array *p_self) { + const Vector<godot_int> *self = (const Vector<godot_int> *)p_self; return self->empty(); } -void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_self) { - ((PoolVector<godot_int> *)p_self)->~PoolVector(); +void GDAPI godot_packed_int_array_destroy(godot_packed_int_array *p_self) { + ((Vector<godot_int> *)p_self)->~Vector(); } // real -void GDAPI godot_pool_real_array_new(godot_pool_real_array *r_dest) { - PoolVector<godot_real> *dest = (PoolVector<godot_real> *)r_dest; - memnew_placement(dest, PoolVector<godot_real>); +void GDAPI godot_packed_real_array_new(godot_packed_real_array *r_dest) { + Vector<godot_real> *dest = (Vector<godot_real> *)r_dest; + memnew_placement(dest, Vector<godot_real>); } -void GDAPI godot_pool_real_array_new_copy(godot_pool_real_array *r_dest, const godot_pool_real_array *p_src) { - PoolVector<godot_real> *dest = (PoolVector<godot_real> *)r_dest; - const PoolVector<godot_real> *src = (const PoolVector<godot_real> *)p_src; - memnew_placement(dest, PoolVector<godot_real>(*src)); +void GDAPI godot_packed_real_array_new_copy(godot_packed_real_array *r_dest, const godot_packed_real_array *p_src) { + Vector<godot_real> *dest = (Vector<godot_real> *)r_dest; + const Vector<godot_real> *src = (const Vector<godot_real> *)p_src; + memnew_placement(dest, Vector<godot_real>(*src)); } -void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *r_dest, const godot_array *p_a) { - PoolVector<godot_real> *dest = (PoolVector<godot_real> *)r_dest; +void GDAPI godot_packed_real_array_new_with_array(godot_packed_real_array *r_dest, const godot_array *p_a) { + Vector<godot_real> *dest = (Vector<godot_real> *)r_dest; Array *a = (Array *)p_a; - memnew_placement(dest, PoolVector<godot_real>); + memnew_placement(dest, Vector<godot_real>); dest->resize(a->size()); for (int i = 0; i < a->size(); i++) { @@ -256,93 +236,83 @@ void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *r_dest, c } } -void GDAPI godot_pool_real_array_append(godot_pool_real_array *p_self, const godot_real p_data) { - PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self; - self->append(p_data); +void GDAPI godot_packed_real_array_append(godot_packed_real_array *p_self, const godot_real p_data) { + Vector<godot_real> *self = (Vector<godot_real> *)p_self; + self->push_back(p_data); } -void GDAPI godot_pool_real_array_append_array(godot_pool_real_array *p_self, const godot_pool_real_array *p_array) { - PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self; - PoolVector<godot_real> *array = (PoolVector<godot_real> *)p_array; +void GDAPI godot_packed_real_array_append_array(godot_packed_real_array *p_self, const godot_packed_real_array *p_array) { + Vector<godot_real> *self = (Vector<godot_real> *)p_self; + Vector<godot_real> *array = (Vector<godot_real> *)p_array; self->append_array(*array); } -godot_error GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data) { - PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self; +godot_error GDAPI godot_packed_real_array_insert(godot_packed_real_array *p_self, const godot_int p_idx, const godot_real p_data) { + Vector<godot_real> *self = (Vector<godot_real> *)p_self; return (godot_error)self->insert(p_idx, p_data); } -void GDAPI godot_pool_real_array_invert(godot_pool_real_array *p_self) { - PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self; +void GDAPI godot_packed_real_array_invert(godot_packed_real_array *p_self) { + Vector<godot_real> *self = (Vector<godot_real> *)p_self; self->invert(); } -void GDAPI godot_pool_real_array_push_back(godot_pool_real_array *p_self, const godot_real p_data) { - PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self; +void GDAPI godot_packed_real_array_push_back(godot_packed_real_array *p_self, const godot_real p_data) { + Vector<godot_real> *self = (Vector<godot_real> *)p_self; self->push_back(p_data); } -void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_self, const godot_int p_idx) { - PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self; +void GDAPI godot_packed_real_array_remove(godot_packed_real_array *p_self, const godot_int p_idx) { + Vector<godot_real> *self = (Vector<godot_real> *)p_self; self->remove(p_idx); } -void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_self, const godot_int p_size) { - PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self; +void GDAPI godot_packed_real_array_resize(godot_packed_real_array *p_self, const godot_int p_size) { + Vector<godot_real> *self = (Vector<godot_real> *)p_self; self->resize(p_size); } -godot_pool_real_array_read_access GDAPI *godot_pool_real_array_read(const godot_pool_real_array *p_self) { - const PoolVector<godot_real> *self = (const PoolVector<godot_real> *)p_self; - return (godot_pool_real_array_read_access *)memnew(PoolVector<godot_real>::Read(self->read())); -} - -godot_pool_int_array_write_access GDAPI *godot_pool_real_array_write(godot_pool_real_array *p_self) { - PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self; - return (godot_pool_real_array_write_access *)memnew(PoolVector<godot_real>::Write(self->write())); -} - -void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data) { - PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self; +void GDAPI godot_packed_real_array_set(godot_packed_real_array *p_self, const godot_int p_idx, const godot_real p_data) { + Vector<godot_real> *self = (Vector<godot_real> *)p_self; self->set(p_idx, p_data); } -godot_real GDAPI godot_pool_real_array_get(const godot_pool_real_array *p_self, const godot_int p_idx) { - const PoolVector<godot_real> *self = (const PoolVector<godot_real> *)p_self; +godot_real GDAPI godot_packed_real_array_get(const godot_packed_real_array *p_self, const godot_int p_idx) { + const Vector<godot_real> *self = (const Vector<godot_real> *)p_self; return self->get(p_idx); } -godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_self) { - const PoolVector<godot_real> *self = (const PoolVector<godot_real> *)p_self; +godot_int GDAPI godot_packed_real_array_size(const godot_packed_real_array *p_self) { + const Vector<godot_real> *self = (const Vector<godot_real> *)p_self; return self->size(); } -godot_bool GDAPI godot_pool_real_array_empty(const godot_pool_real_array *p_self) { - const PoolVector<godot_real> *self = (const PoolVector<godot_real> *)p_self; +godot_bool GDAPI godot_packed_real_array_empty(const godot_packed_real_array *p_self) { + const Vector<godot_real> *self = (const Vector<godot_real> *)p_self; return self->empty(); } -void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_self) { - ((PoolVector<godot_real> *)p_self)->~PoolVector(); +void GDAPI godot_packed_real_array_destroy(godot_packed_real_array *p_self) { + ((Vector<godot_real> *)p_self)->~Vector(); } // string -void GDAPI godot_pool_string_array_new(godot_pool_string_array *r_dest) { - PoolVector<String> *dest = (PoolVector<String> *)r_dest; - memnew_placement(dest, PoolVector<String>); +void GDAPI godot_packed_string_array_new(godot_packed_string_array *r_dest) { + Vector<String> *dest = (Vector<String> *)r_dest; + memnew_placement(dest, Vector<String>); } -void GDAPI godot_pool_string_array_new_copy(godot_pool_string_array *r_dest, const godot_pool_string_array *p_src) { - PoolVector<String> *dest = (PoolVector<String> *)r_dest; - const PoolVector<String> *src = (const PoolVector<String> *)p_src; - memnew_placement(dest, PoolVector<String>(*src)); +void GDAPI godot_packed_string_array_new_copy(godot_packed_string_array *r_dest, const godot_packed_string_array *p_src) { + Vector<String> *dest = (Vector<String> *)r_dest; + const Vector<String> *src = (const Vector<String> *)p_src; + memnew_placement(dest, Vector<String>(*src)); } -void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *r_dest, const godot_array *p_a) { - PoolVector<String> *dest = (PoolVector<String> *)r_dest; +void GDAPI godot_packed_string_array_new_with_array(godot_packed_string_array *r_dest, const godot_array *p_a) { + Vector<String> *dest = (Vector<String> *)r_dest; Array *a = (Array *)p_a; - memnew_placement(dest, PoolVector<String>); + memnew_placement(dest, Vector<String>); dest->resize(a->size()); for (int i = 0; i < a->size(); i++) { @@ -350,63 +320,53 @@ void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *r_des } } -void GDAPI godot_pool_string_array_append(godot_pool_string_array *p_self, const godot_string *p_data) { - PoolVector<String> *self = (PoolVector<String> *)p_self; +void GDAPI godot_packed_string_array_append(godot_packed_string_array *p_self, const godot_string *p_data) { + Vector<String> *self = (Vector<String> *)p_self; String &s = *(String *)p_data; - self->append(s); + self->push_back(s); } -void GDAPI godot_pool_string_array_append_array(godot_pool_string_array *p_self, const godot_pool_string_array *p_array) { - PoolVector<String> *self = (PoolVector<String> *)p_self; - PoolVector<String> *array = (PoolVector<String> *)p_array; +void GDAPI godot_packed_string_array_append_array(godot_packed_string_array *p_self, const godot_packed_string_array *p_array) { + Vector<String> *self = (Vector<String> *)p_self; + Vector<String> *array = (Vector<String> *)p_array; self->append_array(*array); } -godot_error GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data) { - PoolVector<String> *self = (PoolVector<String> *)p_self; +godot_error GDAPI godot_packed_string_array_insert(godot_packed_string_array *p_self, const godot_int p_idx, const godot_string *p_data) { + Vector<String> *self = (Vector<String> *)p_self; String &s = *(String *)p_data; return (godot_error)self->insert(p_idx, s); } -void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_self) { - PoolVector<String> *self = (PoolVector<String> *)p_self; +void GDAPI godot_packed_string_array_invert(godot_packed_string_array *p_self) { + Vector<String> *self = (Vector<String> *)p_self; self->invert(); } -void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_self, const godot_string *p_data) { - PoolVector<String> *self = (PoolVector<String> *)p_self; +void GDAPI godot_packed_string_array_push_back(godot_packed_string_array *p_self, const godot_string *p_data) { + Vector<String> *self = (Vector<String> *)p_self; String &s = *(String *)p_data; self->push_back(s); } -void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_self, const godot_int p_idx) { - PoolVector<String> *self = (PoolVector<String> *)p_self; +void GDAPI godot_packed_string_array_remove(godot_packed_string_array *p_self, const godot_int p_idx) { + Vector<String> *self = (Vector<String> *)p_self; self->remove(p_idx); } -void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_self, const godot_int p_size) { - PoolVector<String> *self = (PoolVector<String> *)p_self; +void GDAPI godot_packed_string_array_resize(godot_packed_string_array *p_self, const godot_int p_size) { + Vector<String> *self = (Vector<String> *)p_self; self->resize(p_size); } -godot_pool_string_array_read_access GDAPI *godot_pool_string_array_read(const godot_pool_string_array *p_self) { - const PoolVector<String> *self = (const PoolVector<String> *)p_self; - return (godot_pool_string_array_read_access *)memnew(PoolVector<String>::Read(self->read())); -} - -godot_pool_string_array_write_access GDAPI *godot_pool_string_array_write(godot_pool_string_array *p_self) { - PoolVector<String> *self = (PoolVector<String> *)p_self; - return (godot_pool_string_array_write_access *)memnew(PoolVector<String>::Write(self->write())); -} - -void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data) { - PoolVector<String> *self = (PoolVector<String> *)p_self; +void GDAPI godot_packed_string_array_set(godot_packed_string_array *p_self, const godot_int p_idx, const godot_string *p_data) { + Vector<String> *self = (Vector<String> *)p_self; String &s = *(String *)p_data; self->set(p_idx, s); } -godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_self, const godot_int p_idx) { - const PoolVector<String> *self = (const PoolVector<String> *)p_self; +godot_string GDAPI godot_packed_string_array_get(const godot_packed_string_array *p_self, const godot_int p_idx) { + const Vector<String> *self = (const Vector<String> *)p_self; godot_string str; String *s = (String *)&str; memnew_placement(s, String); @@ -414,37 +374,37 @@ godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_ return str; } -godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_self) { - const PoolVector<String> *self = (const PoolVector<String> *)p_self; +godot_int GDAPI godot_packed_string_array_size(const godot_packed_string_array *p_self) { + const Vector<String> *self = (const Vector<String> *)p_self; return self->size(); } -godot_bool GDAPI godot_pool_string_array_empty(const godot_pool_string_array *p_self) { - const PoolVector<String> *self = (const PoolVector<String> *)p_self; +godot_bool GDAPI godot_packed_string_array_empty(const godot_packed_string_array *p_self) { + const Vector<String> *self = (const Vector<String> *)p_self; return self->empty(); } -void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_self) { - ((PoolVector<String> *)p_self)->~PoolVector(); +void GDAPI godot_packed_string_array_destroy(godot_packed_string_array *p_self) { + ((Vector<String> *)p_self)->~Vector(); } // vector2 -void GDAPI godot_pool_vector2_array_new(godot_pool_vector2_array *r_dest) { - PoolVector<Vector2> *dest = (PoolVector<Vector2> *)r_dest; - memnew_placement(dest, PoolVector<Vector2>); +void GDAPI godot_packed_vector2_array_new(godot_packed_vector2_array *r_dest) { + Vector<Vector2> *dest = (Vector<Vector2> *)r_dest; + memnew_placement(dest, Vector<Vector2>); } -void GDAPI godot_pool_vector2_array_new_copy(godot_pool_vector2_array *r_dest, const godot_pool_vector2_array *p_src) { - PoolVector<Vector2> *dest = (PoolVector<Vector2> *)r_dest; - const PoolVector<Vector2> *src = (const PoolVector<Vector2> *)p_src; - memnew_placement(dest, PoolVector<Vector2>(*src)); +void GDAPI godot_packed_vector2_array_new_copy(godot_packed_vector2_array *r_dest, const godot_packed_vector2_array *p_src) { + Vector<Vector2> *dest = (Vector<Vector2> *)r_dest; + const Vector<Vector2> *src = (const Vector<Vector2> *)p_src; + memnew_placement(dest, Vector<Vector2>(*src)); } -void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *r_dest, const godot_array *p_a) { - PoolVector<Vector2> *dest = (PoolVector<Vector2> *)r_dest; +void GDAPI godot_packed_vector2_array_new_with_array(godot_packed_vector2_array *r_dest, const godot_array *p_a) { + Vector<Vector2> *dest = (Vector<Vector2> *)r_dest; Array *a = (Array *)p_a; - memnew_placement(dest, PoolVector<Vector2>); + memnew_placement(dest, Vector<Vector2>); dest->resize(a->size()); for (int i = 0; i < a->size(); i++) { @@ -452,100 +412,90 @@ void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *r_d } } -void GDAPI godot_pool_vector2_array_append(godot_pool_vector2_array *p_self, const godot_vector2 *p_data) { - PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self; +void GDAPI godot_packed_vector2_array_append(godot_packed_vector2_array *p_self, const godot_vector2 *p_data) { + Vector<Vector2> *self = (Vector<Vector2> *)p_self; Vector2 &s = *(Vector2 *)p_data; - self->append(s); + self->push_back(s); } -void GDAPI godot_pool_vector2_array_append_array(godot_pool_vector2_array *p_self, const godot_pool_vector2_array *p_array) { - PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self; - PoolVector<Vector2> *array = (PoolVector<Vector2> *)p_array; +void GDAPI godot_packed_vector2_array_append_array(godot_packed_vector2_array *p_self, const godot_packed_vector2_array *p_array) { + Vector<Vector2> *self = (Vector<Vector2> *)p_self; + Vector<Vector2> *array = (Vector<Vector2> *)p_array; self->append_array(*array); } -godot_error GDAPI godot_pool_vector2_array_insert(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data) { - PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self; +godot_error GDAPI godot_packed_vector2_array_insert(godot_packed_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data) { + Vector<Vector2> *self = (Vector<Vector2> *)p_self; Vector2 &s = *(Vector2 *)p_data; return (godot_error)self->insert(p_idx, s); } -void GDAPI godot_pool_vector2_array_invert(godot_pool_vector2_array *p_self) { - PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self; +void GDAPI godot_packed_vector2_array_invert(godot_packed_vector2_array *p_self) { + Vector<Vector2> *self = (Vector<Vector2> *)p_self; self->invert(); } -void GDAPI godot_pool_vector2_array_push_back(godot_pool_vector2_array *p_self, const godot_vector2 *p_data) { - PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self; +void GDAPI godot_packed_vector2_array_push_back(godot_packed_vector2_array *p_self, const godot_vector2 *p_data) { + Vector<Vector2> *self = (Vector<Vector2> *)p_self; Vector2 &s = *(Vector2 *)p_data; self->push_back(s); } -void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_self, const godot_int p_idx) { - PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self; +void GDAPI godot_packed_vector2_array_remove(godot_packed_vector2_array *p_self, const godot_int p_idx) { + Vector<Vector2> *self = (Vector<Vector2> *)p_self; self->remove(p_idx); } -void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_self, const godot_int p_size) { - PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self; +void GDAPI godot_packed_vector2_array_resize(godot_packed_vector2_array *p_self, const godot_int p_size) { + Vector<Vector2> *self = (Vector<Vector2> *)p_self; self->resize(p_size); } -godot_pool_vector2_array_read_access GDAPI *godot_pool_vector2_array_read(const godot_pool_vector2_array *p_self) { - const PoolVector<Vector2> *self = (const PoolVector<Vector2> *)p_self; - return (godot_pool_vector2_array_read_access *)memnew(PoolVector<Vector2>::Read(self->read())); -} - -godot_pool_vector2_array_write_access GDAPI *godot_pool_vector2_array_write(godot_pool_vector2_array *p_self) { - PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self; - return (godot_pool_vector2_array_write_access *)memnew(PoolVector<Vector2>::Write(self->write())); -} - -void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data) { - PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self; +void GDAPI godot_packed_vector2_array_set(godot_packed_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data) { + Vector<Vector2> *self = (Vector<Vector2> *)p_self; Vector2 &s = *(Vector2 *)p_data; self->set(p_idx, s); } -godot_vector2 GDAPI godot_pool_vector2_array_get(const godot_pool_vector2_array *p_self, const godot_int p_idx) { - const PoolVector<Vector2> *self = (const PoolVector<Vector2> *)p_self; +godot_vector2 GDAPI godot_packed_vector2_array_get(const godot_packed_vector2_array *p_self, const godot_int p_idx) { + const Vector<Vector2> *self = (const Vector<Vector2> *)p_self; godot_vector2 v; Vector2 *s = (Vector2 *)&v; *s = self->get(p_idx); return v; } -godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_self) { - const PoolVector<Vector2> *self = (const PoolVector<Vector2> *)p_self; +godot_int GDAPI godot_packed_vector2_array_size(const godot_packed_vector2_array *p_self) { + const Vector<Vector2> *self = (const Vector<Vector2> *)p_self; return self->size(); } -godot_bool GDAPI godot_pool_vector2_array_empty(const godot_pool_vector2_array *p_self) { - const PoolVector<Vector2> *self = (const PoolVector<Vector2> *)p_self; +godot_bool GDAPI godot_packed_vector2_array_empty(const godot_packed_vector2_array *p_self) { + const Vector<Vector2> *self = (const Vector<Vector2> *)p_self; return self->empty(); } -void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_self) { - ((PoolVector<Vector2> *)p_self)->~PoolVector(); +void GDAPI godot_packed_vector2_array_destroy(godot_packed_vector2_array *p_self) { + ((Vector<Vector2> *)p_self)->~Vector(); } // vector3 -void GDAPI godot_pool_vector3_array_new(godot_pool_vector3_array *r_dest) { - PoolVector<Vector3> *dest = (PoolVector<Vector3> *)r_dest; - memnew_placement(dest, PoolVector<Vector3>); +void GDAPI godot_packed_vector3_array_new(godot_packed_vector3_array *r_dest) { + Vector<Vector3> *dest = (Vector<Vector3> *)r_dest; + memnew_placement(dest, Vector<Vector3>); } -void GDAPI godot_pool_vector3_array_new_copy(godot_pool_vector3_array *r_dest, const godot_pool_vector3_array *p_src) { - PoolVector<Vector3> *dest = (PoolVector<Vector3> *)r_dest; - const PoolVector<Vector3> *src = (const PoolVector<Vector3> *)p_src; - memnew_placement(dest, PoolVector<Vector3>(*src)); +void GDAPI godot_packed_vector3_array_new_copy(godot_packed_vector3_array *r_dest, const godot_packed_vector3_array *p_src) { + Vector<Vector3> *dest = (Vector<Vector3> *)r_dest; + const Vector<Vector3> *src = (const Vector<Vector3> *)p_src; + memnew_placement(dest, Vector<Vector3>(*src)); } -void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *r_dest, const godot_array *p_a) { - PoolVector<Vector3> *dest = (PoolVector<Vector3> *)r_dest; +void GDAPI godot_packed_vector3_array_new_with_array(godot_packed_vector3_array *r_dest, const godot_array *p_a) { + Vector<Vector3> *dest = (Vector<Vector3> *)r_dest; Array *a = (Array *)p_a; - memnew_placement(dest, PoolVector<Vector3>); + memnew_placement(dest, Vector<Vector3>); dest->resize(a->size()); for (int i = 0; i < a->size(); i++) { @@ -553,100 +503,90 @@ void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *r_d } } -void GDAPI godot_pool_vector3_array_append(godot_pool_vector3_array *p_self, const godot_vector3 *p_data) { - PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self; +void GDAPI godot_packed_vector3_array_append(godot_packed_vector3_array *p_self, const godot_vector3 *p_data) { + Vector<Vector3> *self = (Vector<Vector3> *)p_self; Vector3 &s = *(Vector3 *)p_data; - self->append(s); + self->push_back(s); } -void GDAPI godot_pool_vector3_array_append_array(godot_pool_vector3_array *p_self, const godot_pool_vector3_array *p_array) { - PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self; - PoolVector<Vector3> *array = (PoolVector<Vector3> *)p_array; +void GDAPI godot_packed_vector3_array_append_array(godot_packed_vector3_array *p_self, const godot_packed_vector3_array *p_array) { + Vector<Vector3> *self = (Vector<Vector3> *)p_self; + Vector<Vector3> *array = (Vector<Vector3> *)p_array; self->append_array(*array); } -godot_error GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data) { - PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self; +godot_error GDAPI godot_packed_vector3_array_insert(godot_packed_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data) { + Vector<Vector3> *self = (Vector<Vector3> *)p_self; Vector3 &s = *(Vector3 *)p_data; return (godot_error)self->insert(p_idx, s); } -void GDAPI godot_pool_vector3_array_invert(godot_pool_vector3_array *p_self) { - PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self; +void GDAPI godot_packed_vector3_array_invert(godot_packed_vector3_array *p_self) { + Vector<Vector3> *self = (Vector<Vector3> *)p_self; self->invert(); } -void GDAPI godot_pool_vector3_array_push_back(godot_pool_vector3_array *p_self, const godot_vector3 *p_data) { - PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self; +void GDAPI godot_packed_vector3_array_push_back(godot_packed_vector3_array *p_self, const godot_vector3 *p_data) { + Vector<Vector3> *self = (Vector<Vector3> *)p_self; Vector3 &s = *(Vector3 *)p_data; self->push_back(s); } -void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_self, const godot_int p_idx) { - PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self; +void GDAPI godot_packed_vector3_array_remove(godot_packed_vector3_array *p_self, const godot_int p_idx) { + Vector<Vector3> *self = (Vector<Vector3> *)p_self; self->remove(p_idx); } -void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_self, const godot_int p_size) { - PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self; +void GDAPI godot_packed_vector3_array_resize(godot_packed_vector3_array *p_self, const godot_int p_size) { + Vector<Vector3> *self = (Vector<Vector3> *)p_self; self->resize(p_size); } -godot_pool_vector3_array_read_access GDAPI *godot_pool_vector3_array_read(const godot_pool_vector3_array *p_self) { - const PoolVector<Vector3> *self = (const PoolVector<Vector3> *)p_self; - return (godot_pool_vector3_array_read_access *)memnew(PoolVector<Vector3>::Read(self->read())); -} - -godot_pool_vector3_array_write_access GDAPI *godot_pool_vector3_array_write(godot_pool_vector3_array *p_self) { - PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self; - return (godot_pool_vector3_array_write_access *)memnew(PoolVector<Vector3>::Write(self->write())); -} - -void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data) { - PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self; +void GDAPI godot_packed_vector3_array_set(godot_packed_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data) { + Vector<Vector3> *self = (Vector<Vector3> *)p_self; Vector3 &s = *(Vector3 *)p_data; self->set(p_idx, s); } -godot_vector3 GDAPI godot_pool_vector3_array_get(const godot_pool_vector3_array *p_self, const godot_int p_idx) { - const PoolVector<Vector3> *self = (const PoolVector<Vector3> *)p_self; +godot_vector3 GDAPI godot_packed_vector3_array_get(const godot_packed_vector3_array *p_self, const godot_int p_idx) { + const Vector<Vector3> *self = (const Vector<Vector3> *)p_self; godot_vector3 v; Vector3 *s = (Vector3 *)&v; *s = self->get(p_idx); return v; } -godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_self) { - const PoolVector<Vector3> *self = (const PoolVector<Vector3> *)p_self; +godot_int GDAPI godot_packed_vector3_array_size(const godot_packed_vector3_array *p_self) { + const Vector<Vector3> *self = (const Vector<Vector3> *)p_self; return self->size(); } -godot_bool GDAPI godot_pool_vector3_array_empty(const godot_pool_vector3_array *p_self) { - const PoolVector<Vector3> *self = (const PoolVector<Vector3> *)p_self; +godot_bool GDAPI godot_packed_vector3_array_empty(const godot_packed_vector3_array *p_self) { + const Vector<Vector3> *self = (const Vector<Vector3> *)p_self; return self->empty(); } -void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_self) { - ((PoolVector<Vector3> *)p_self)->~PoolVector(); +void GDAPI godot_packed_vector3_array_destroy(godot_packed_vector3_array *p_self) { + ((Vector<Vector3> *)p_self)->~Vector(); } // color -void GDAPI godot_pool_color_array_new(godot_pool_color_array *r_dest) { - PoolVector<Color> *dest = (PoolVector<Color> *)r_dest; - memnew_placement(dest, PoolVector<Color>); +void GDAPI godot_packed_color_array_new(godot_packed_color_array *r_dest) { + Vector<Color> *dest = (Vector<Color> *)r_dest; + memnew_placement(dest, Vector<Color>); } -void GDAPI godot_pool_color_array_new_copy(godot_pool_color_array *r_dest, const godot_pool_color_array *p_src) { - PoolVector<Color> *dest = (PoolVector<Color> *)r_dest; - const PoolVector<Color> *src = (const PoolVector<Color> *)p_src; - memnew_placement(dest, PoolVector<Color>(*src)); +void GDAPI godot_packed_color_array_new_copy(godot_packed_color_array *r_dest, const godot_packed_color_array *p_src) { + Vector<Color> *dest = (Vector<Color> *)r_dest; + const Vector<Color> *src = (const Vector<Color> *)p_src; + memnew_placement(dest, Vector<Color>(*src)); } -void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *r_dest, const godot_array *p_a) { - PoolVector<Color> *dest = (PoolVector<Color> *)r_dest; +void GDAPI godot_packed_color_array_new_with_array(godot_packed_color_array *r_dest, const godot_array *p_a) { + Vector<Color> *dest = (Vector<Color> *)r_dest; Array *a = (Array *)p_a; - memnew_placement(dest, PoolVector<Color>); + memnew_placement(dest, Vector<Color>); dest->resize(a->size()); for (int i = 0; i < a->size(); i++) { @@ -654,327 +594,71 @@ void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *r_dest, } } -void GDAPI godot_pool_color_array_append(godot_pool_color_array *p_self, const godot_color *p_data) { - PoolVector<Color> *self = (PoolVector<Color> *)p_self; +void GDAPI godot_packed_color_array_append(godot_packed_color_array *p_self, const godot_color *p_data) { + Vector<Color> *self = (Vector<Color> *)p_self; Color &s = *(Color *)p_data; - self->append(s); + self->push_back(s); } -void GDAPI godot_pool_color_array_append_array(godot_pool_color_array *p_self, const godot_pool_color_array *p_array) { - PoolVector<Color> *self = (PoolVector<Color> *)p_self; - PoolVector<Color> *array = (PoolVector<Color> *)p_array; +void GDAPI godot_packed_color_array_append_array(godot_packed_color_array *p_self, const godot_packed_color_array *p_array) { + Vector<Color> *self = (Vector<Color> *)p_self; + Vector<Color> *array = (Vector<Color> *)p_array; self->append_array(*array); } -godot_error GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data) { - PoolVector<Color> *self = (PoolVector<Color> *)p_self; +godot_error GDAPI godot_packed_color_array_insert(godot_packed_color_array *p_self, const godot_int p_idx, const godot_color *p_data) { + Vector<Color> *self = (Vector<Color> *)p_self; Color &s = *(Color *)p_data; return (godot_error)self->insert(p_idx, s); } -void GDAPI godot_pool_color_array_invert(godot_pool_color_array *p_self) { - PoolVector<Color> *self = (PoolVector<Color> *)p_self; +void GDAPI godot_packed_color_array_invert(godot_packed_color_array *p_self) { + Vector<Color> *self = (Vector<Color> *)p_self; self->invert(); } -void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_self, const godot_color *p_data) { - PoolVector<Color> *self = (PoolVector<Color> *)p_self; +void GDAPI godot_packed_color_array_push_back(godot_packed_color_array *p_self, const godot_color *p_data) { + Vector<Color> *self = (Vector<Color> *)p_self; Color &s = *(Color *)p_data; self->push_back(s); } -void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_self, const godot_int p_idx) { - PoolVector<Color> *self = (PoolVector<Color> *)p_self; +void GDAPI godot_packed_color_array_remove(godot_packed_color_array *p_self, const godot_int p_idx) { + Vector<Color> *self = (Vector<Color> *)p_self; self->remove(p_idx); } -void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_self, const godot_int p_size) { - PoolVector<Color> *self = (PoolVector<Color> *)p_self; +void GDAPI godot_packed_color_array_resize(godot_packed_color_array *p_self, const godot_int p_size) { + Vector<Color> *self = (Vector<Color> *)p_self; self->resize(p_size); } -godot_pool_color_array_read_access GDAPI *godot_pool_color_array_read(const godot_pool_color_array *p_self) { - const PoolVector<Color> *self = (const PoolVector<Color> *)p_self; - return (godot_pool_color_array_read_access *)memnew(PoolVector<Color>::Read(self->read())); -} - -godot_pool_color_array_write_access GDAPI *godot_pool_color_array_write(godot_pool_color_array *p_self) { - PoolVector<Color> *self = (PoolVector<Color> *)p_self; - return (godot_pool_color_array_write_access *)memnew(PoolVector<Color>::Write(self->write())); -} - -void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data) { - PoolVector<Color> *self = (PoolVector<Color> *)p_self; +void GDAPI godot_packed_color_array_set(godot_packed_color_array *p_self, const godot_int p_idx, const godot_color *p_data) { + Vector<Color> *self = (Vector<Color> *)p_self; Color &s = *(Color *)p_data; self->set(p_idx, s); } -godot_color GDAPI godot_pool_color_array_get(const godot_pool_color_array *p_self, const godot_int p_idx) { - const PoolVector<Color> *self = (const PoolVector<Color> *)p_self; +godot_color GDAPI godot_packed_color_array_get(const godot_packed_color_array *p_self, const godot_int p_idx) { + const Vector<Color> *self = (const Vector<Color> *)p_self; godot_color v; Color *s = (Color *)&v; *s = self->get(p_idx); return v; } -godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_self) { - const PoolVector<Color> *self = (const PoolVector<Color> *)p_self; +godot_int GDAPI godot_packed_color_array_size(const godot_packed_color_array *p_self) { + const Vector<Color> *self = (const Vector<Color> *)p_self; return self->size(); } -godot_bool GDAPI godot_pool_color_array_empty(const godot_pool_color_array *p_self) { - const PoolVector<Color> *self = (const PoolVector<Color> *)p_self; +godot_bool GDAPI godot_packed_color_array_empty(const godot_packed_color_array *p_self) { + const Vector<Color> *self = (const Vector<Color> *)p_self; return self->empty(); } -void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self) { - ((PoolVector<Color> *)p_self)->~PoolVector(); -} - -// -// read accessor functions -// - -godot_pool_byte_array_read_access GDAPI *godot_pool_byte_array_read_access_copy(const godot_pool_byte_array_read_access *p_other) { - PoolVector<uint8_t>::Read *other = (PoolVector<uint8_t>::Read *)p_other; - return (godot_pool_byte_array_read_access *)memnew(PoolVector<uint8_t>::Read(*other)); -} -const uint8_t GDAPI *godot_pool_byte_array_read_access_ptr(const godot_pool_byte_array_read_access *p_read) { - const PoolVector<uint8_t>::Read *read = (const PoolVector<uint8_t>::Read *)p_read; - return read->ptr(); -} -void GDAPI godot_pool_byte_array_read_access_operator_assign(godot_pool_byte_array_read_access *p_read, godot_pool_byte_array_read_access *p_other) { - PoolVector<uint8_t>::Read *read = (PoolVector<uint8_t>::Read *)p_read; - PoolVector<uint8_t>::Read *other = (PoolVector<uint8_t>::Read *)p_other; - read->operator=(*other); -} -void GDAPI godot_pool_byte_array_read_access_destroy(godot_pool_byte_array_read_access *p_read) { - memdelete((PoolVector<uint8_t>::Read *)p_read); -} - -godot_pool_int_array_read_access GDAPI *godot_pool_int_array_read_access_copy(const godot_pool_int_array_read_access *p_other) { - PoolVector<godot_int>::Read *other = (PoolVector<godot_int>::Read *)p_other; - return (godot_pool_int_array_read_access *)memnew(PoolVector<godot_int>::Read(*other)); -} -const godot_int GDAPI *godot_pool_int_array_read_access_ptr(const godot_pool_int_array_read_access *p_read) { - const PoolVector<godot_int>::Read *read = (const PoolVector<godot_int>::Read *)p_read; - return read->ptr(); -} -void GDAPI godot_pool_int_array_read_access_operator_assign(godot_pool_int_array_read_access *p_read, godot_pool_int_array_read_access *p_other) { - PoolVector<godot_int>::Read *read = (PoolVector<godot_int>::Read *)p_read; - PoolVector<godot_int>::Read *other = (PoolVector<godot_int>::Read *)p_other; - read->operator=(*other); -} -void GDAPI godot_pool_int_array_read_access_destroy(godot_pool_int_array_read_access *p_read) { - memdelete((PoolVector<godot_int>::Read *)p_read); -} - -godot_pool_real_array_read_access GDAPI *godot_pool_real_array_read_access_copy(const godot_pool_real_array_read_access *p_other) { - PoolVector<godot_real>::Read *other = (PoolVector<godot_real>::Read *)p_other; - return (godot_pool_real_array_read_access *)memnew(PoolVector<godot_real>::Read(*other)); -} -const godot_real GDAPI *godot_pool_real_array_read_access_ptr(const godot_pool_real_array_read_access *p_read) { - const PoolVector<godot_real>::Read *read = (const PoolVector<godot_real>::Read *)p_read; - return read->ptr(); -} -void GDAPI godot_pool_real_array_read_access_operator_assign(godot_pool_real_array_read_access *p_read, godot_pool_real_array_read_access *p_other) { - PoolVector<godot_real>::Read *read = (PoolVector<godot_real>::Read *)p_read; - PoolVector<godot_real>::Read *other = (PoolVector<godot_real>::Read *)p_other; - read->operator=(*other); -} -void GDAPI godot_pool_real_array_read_access_destroy(godot_pool_real_array_read_access *p_read) { - memdelete((PoolVector<godot_real>::Read *)p_read); -} - -godot_pool_string_array_read_access GDAPI *godot_pool_string_array_read_access_copy(const godot_pool_string_array_read_access *p_other) { - PoolVector<String>::Read *other = (PoolVector<String>::Read *)p_other; - return (godot_pool_string_array_read_access *)memnew(PoolVector<String>::Read(*other)); -} -const godot_string GDAPI *godot_pool_string_array_read_access_ptr(const godot_pool_string_array_read_access *p_read) { - const PoolVector<String>::Read *read = (const PoolVector<String>::Read *)p_read; - return (const godot_string *)read->ptr(); -} -void GDAPI godot_pool_string_array_read_access_operator_assign(godot_pool_string_array_read_access *p_read, godot_pool_string_array_read_access *p_other) { - PoolVector<String>::Read *read = (PoolVector<String>::Read *)p_read; - PoolVector<String>::Read *other = (PoolVector<String>::Read *)p_other; - read->operator=(*other); -} -void GDAPI godot_pool_string_array_read_access_destroy(godot_pool_string_array_read_access *p_read) { - memdelete((PoolVector<String>::Read *)p_read); -} - -godot_pool_vector2_array_read_access GDAPI *godot_pool_vector2_array_read_access_copy(const godot_pool_vector2_array_read_access *p_other) { - PoolVector<Vector2>::Read *other = (PoolVector<Vector2>::Read *)p_other; - return (godot_pool_vector2_array_read_access *)memnew(PoolVector<Vector2>::Read(*other)); -} -const godot_vector2 GDAPI *godot_pool_vector2_array_read_access_ptr(const godot_pool_vector2_array_read_access *p_read) { - const PoolVector<Vector2>::Read *read = (const PoolVector<Vector2>::Read *)p_read; - return (const godot_vector2 *)read->ptr(); -} -void GDAPI godot_pool_vector2_array_read_access_operator_assign(godot_pool_vector2_array_read_access *p_read, godot_pool_vector2_array_read_access *p_other) { - PoolVector<Vector2>::Read *read = (PoolVector<Vector2>::Read *)p_read; - PoolVector<Vector2>::Read *other = (PoolVector<Vector2>::Read *)p_other; - read->operator=(*other); -} -void GDAPI godot_pool_vector2_array_read_access_destroy(godot_pool_vector2_array_read_access *p_read) { - memdelete((PoolVector<Vector2>::Read *)p_read); -} - -godot_pool_vector3_array_read_access GDAPI *godot_pool_vector3_array_read_access_copy(const godot_pool_vector3_array_read_access *p_other) { - PoolVector<Vector3>::Read *other = (PoolVector<Vector3>::Read *)p_other; - return (godot_pool_vector3_array_read_access *)memnew(PoolVector<Vector3>::Read(*other)); -} -const godot_vector3 GDAPI *godot_pool_vector3_array_read_access_ptr(const godot_pool_vector3_array_read_access *p_read) { - const PoolVector<Vector3>::Read *read = (const PoolVector<Vector3>::Read *)p_read; - return (const godot_vector3 *)read->ptr(); -} -void GDAPI godot_pool_vector3_array_read_access_operator_assign(godot_pool_vector3_array_read_access *p_read, godot_pool_vector3_array_read_access *p_other) { - PoolVector<Vector3>::Read *read = (PoolVector<Vector3>::Read *)p_read; - PoolVector<Vector3>::Read *other = (PoolVector<Vector3>::Read *)p_other; - read->operator=(*other); -} -void GDAPI godot_pool_vector3_array_read_access_destroy(godot_pool_vector3_array_read_access *p_read) { - memdelete((PoolVector<Vector2>::Read *)p_read); -} - -godot_pool_color_array_read_access GDAPI *godot_pool_color_array_read_access_copy(const godot_pool_color_array_read_access *p_other) { - PoolVector<Color>::Read *other = (PoolVector<Color>::Read *)p_other; - return (godot_pool_color_array_read_access *)memnew(PoolVector<Color>::Read(*other)); -} -const godot_color GDAPI *godot_pool_color_array_read_access_ptr(const godot_pool_color_array_read_access *p_read) { - const PoolVector<Color>::Read *read = (const PoolVector<Color>::Read *)p_read; - return (const godot_color *)read->ptr(); -} -void GDAPI godot_pool_color_array_read_access_operator_assign(godot_pool_color_array_read_access *p_read, godot_pool_color_array_read_access *p_other) { - PoolVector<Color>::Read *read = (PoolVector<Color>::Read *)p_read; - PoolVector<Color>::Read *other = (PoolVector<Color>::Read *)p_other; - read->operator=(*other); -} -void GDAPI godot_pool_color_array_read_access_destroy(godot_pool_color_array_read_access *p_read) { - memdelete((PoolVector<Color>::Read *)p_read); -} - -// -// write accessor functions -// - -godot_pool_byte_array_write_access GDAPI *godot_pool_byte_array_write_access_copy(const godot_pool_byte_array_write_access *p_other) { - PoolVector<uint8_t>::Write *other = (PoolVector<uint8_t>::Write *)p_other; - return (godot_pool_byte_array_write_access *)memnew(PoolVector<uint8_t>::Write(*other)); -} -uint8_t GDAPI *godot_pool_byte_array_write_access_ptr(const godot_pool_byte_array_write_access *p_write) { - PoolVector<uint8_t>::Write *write = (PoolVector<uint8_t>::Write *)p_write; - return write->ptr(); -} -void GDAPI godot_pool_byte_array_write_access_operator_assign(godot_pool_byte_array_write_access *p_write, godot_pool_byte_array_write_access *p_other) { - PoolVector<uint8_t>::Write *write = (PoolVector<uint8_t>::Write *)p_write; - PoolVector<uint8_t>::Write *other = (PoolVector<uint8_t>::Write *)p_other; - write->operator=(*other); -} -void GDAPI godot_pool_byte_array_write_access_destroy(godot_pool_byte_array_write_access *p_write) { - memdelete((PoolVector<uint8_t>::Write *)p_write); -} - -godot_pool_int_array_write_access GDAPI *godot_pool_int_array_write_access_copy(const godot_pool_int_array_write_access *p_other) { - PoolVector<godot_int>::Write *other = (PoolVector<godot_int>::Write *)p_other; - return (godot_pool_int_array_write_access *)memnew(PoolVector<godot_int>::Write(*other)); -} -godot_int GDAPI *godot_pool_int_array_write_access_ptr(const godot_pool_int_array_write_access *p_write) { - PoolVector<godot_int>::Write *write = (PoolVector<godot_int>::Write *)p_write; - return write->ptr(); -} -void GDAPI godot_pool_int_array_write_access_operator_assign(godot_pool_int_array_write_access *p_write, godot_pool_int_array_write_access *p_other) { - PoolVector<godot_int>::Write *write = (PoolVector<godot_int>::Write *)p_write; - PoolVector<godot_int>::Write *other = (PoolVector<godot_int>::Write *)p_other; - write->operator=(*other); -} -void GDAPI godot_pool_int_array_write_access_destroy(godot_pool_int_array_write_access *p_write) { - memdelete((PoolVector<godot_int>::Write *)p_write); -} - -godot_pool_real_array_write_access GDAPI *godot_pool_real_array_write_access_copy(const godot_pool_real_array_write_access *p_other) { - PoolVector<godot_real>::Write *other = (PoolVector<godot_real>::Write *)p_other; - return (godot_pool_real_array_write_access *)memnew(PoolVector<godot_real>::Write(*other)); -} -godot_real GDAPI *godot_pool_real_array_write_access_ptr(const godot_pool_real_array_write_access *p_write) { - PoolVector<godot_real>::Write *write = (PoolVector<godot_real>::Write *)p_write; - return write->ptr(); -} -void GDAPI godot_pool_real_array_write_access_operator_assign(godot_pool_real_array_write_access *p_write, godot_pool_real_array_write_access *p_other) { - PoolVector<godot_real>::Write *write = (PoolVector<godot_real>::Write *)p_write; - PoolVector<godot_real>::Write *other = (PoolVector<godot_real>::Write *)p_other; - write->operator=(*other); -} -void GDAPI godot_pool_real_array_write_access_destroy(godot_pool_real_array_write_access *p_write) { - memdelete((PoolVector<godot_real>::Write *)p_write); -} - -godot_pool_string_array_write_access GDAPI *godot_pool_string_array_write_access_copy(const godot_pool_string_array_write_access *p_other) { - PoolVector<String>::Write *other = (PoolVector<String>::Write *)p_other; - return (godot_pool_string_array_write_access *)memnew(PoolVector<String>::Write(*other)); -} -godot_string GDAPI *godot_pool_string_array_write_access_ptr(const godot_pool_string_array_write_access *p_write) { - PoolVector<String>::Write *write = (PoolVector<String>::Write *)p_write; - return (godot_string *)write->ptr(); -} -void GDAPI godot_pool_string_array_write_access_operator_assign(godot_pool_string_array_write_access *p_write, godot_pool_string_array_write_access *p_other) { - PoolVector<String>::Write *write = (PoolVector<String>::Write *)p_write; - PoolVector<String>::Write *other = (PoolVector<String>::Write *)p_other; - write->operator=(*other); -} -void GDAPI godot_pool_string_array_write_access_destroy(godot_pool_string_array_write_access *p_write) { - memdelete((PoolVector<String>::Write *)p_write); -} - -godot_pool_vector2_array_write_access GDAPI *godot_pool_vector2_array_write_access_copy(const godot_pool_vector2_array_write_access *p_other) { - PoolVector<Vector2>::Write *other = (PoolVector<Vector2>::Write *)p_other; - return (godot_pool_vector2_array_write_access *)memnew(PoolVector<Vector2>::Write(*other)); -} -godot_vector2 GDAPI *godot_pool_vector2_array_write_access_ptr(const godot_pool_vector2_array_write_access *p_write) { - PoolVector<Vector2>::Write *write = (PoolVector<Vector2>::Write *)p_write; - return (godot_vector2 *)write->ptr(); -} -void GDAPI godot_pool_vector2_array_write_access_operator_assign(godot_pool_vector2_array_write_access *p_write, godot_pool_vector2_array_write_access *p_other) { - PoolVector<Vector2>::Write *write = (PoolVector<Vector2>::Write *)p_write; - PoolVector<Vector2>::Write *other = (PoolVector<Vector2>::Write *)p_other; - write->operator=(*other); -} -void GDAPI godot_pool_vector2_array_write_access_destroy(godot_pool_vector2_array_write_access *p_write) { - memdelete((PoolVector<Vector2>::Write *)p_write); -} - -godot_pool_vector3_array_write_access GDAPI *godot_pool_vector3_array_write_access_copy(const godot_pool_vector3_array_write_access *p_other) { - PoolVector<Vector3>::Write *other = (PoolVector<Vector3>::Write *)p_other; - return (godot_pool_vector3_array_write_access *)memnew(PoolVector<Vector3>::Write(*other)); -} -godot_vector3 GDAPI *godot_pool_vector3_array_write_access_ptr(const godot_pool_vector3_array_write_access *p_write) { - PoolVector<Vector3>::Write *write = (PoolVector<Vector3>::Write *)p_write; - return (godot_vector3 *)write->ptr(); -} -void GDAPI godot_pool_vector3_array_write_access_operator_assign(godot_pool_vector3_array_write_access *p_write, godot_pool_vector3_array_write_access *p_other) { - PoolVector<Vector3>::Write *write = (PoolVector<Vector3>::Write *)p_write; - PoolVector<Vector3>::Write *other = (PoolVector<Vector3>::Write *)p_other; - write->operator=(*other); -} -void GDAPI godot_pool_vector3_array_write_access_destroy(godot_pool_vector3_array_write_access *p_write) { - memdelete((PoolVector<Vector3>::Write *)p_write); -} - -godot_pool_color_array_write_access GDAPI *godot_pool_color_array_write_access_copy(const godot_pool_color_array_write_access *p_other) { - PoolVector<Color>::Write *other = (PoolVector<Color>::Write *)p_other; - return (godot_pool_color_array_write_access *)memnew(PoolVector<Color>::Write(*other)); -} -godot_color GDAPI *godot_pool_color_array_write_access_ptr(const godot_pool_color_array_write_access *p_write) { - PoolVector<Color>::Write *write = (PoolVector<Color>::Write *)p_write; - return (godot_color *)write->ptr(); -} -void GDAPI godot_pool_color_array_write_access_operator_assign(godot_pool_color_array_write_access *p_write, godot_pool_color_array_write_access *p_other) { - PoolVector<Color>::Write *write = (PoolVector<Color>::Write *)p_write; - PoolVector<Color>::Write *other = (PoolVector<Color>::Write *)p_other; - write->operator=(*other); -} -void GDAPI godot_pool_color_array_write_access_destroy(godot_pool_color_array_write_access *p_write) { - memdelete((PoolVector<Color>::Write *)p_write); +void GDAPI godot_packed_color_array_destroy(godot_packed_color_array *p_self) { + ((Vector<Color> *)p_self)->~Vector(); } #ifdef __cplusplus diff --git a/modules/gdnative/gdnative/string.cpp b/modules/gdnative/gdnative/string.cpp index 59901f6139..4cb55900b0 100644 --- a/modules/gdnative/gdnative/string.cpp +++ b/modules/gdnative/gdnative/string.cpp @@ -1030,14 +1030,14 @@ uint32_t GDAPI godot_string_hash_utf8_chars_with_len(const wchar_t *p_str, godot return String::hash(p_str, p_len); } -godot_pool_byte_array GDAPI godot_string_md5_buffer(const godot_string *p_self) { +godot_packed_byte_array GDAPI godot_string_md5_buffer(const godot_string *p_self) { const String *self = (const String *)p_self; Vector<uint8_t> tmp_result = self->md5_buffer(); - godot_pool_byte_array result; - memnew_placement(&result, PoolByteArray); - PoolByteArray *proxy = (PoolByteArray *)&result; - PoolByteArray::Write proxy_writer = proxy->write(); + godot_packed_byte_array result; + memnew_placement(&result, PackedByteArray); + PackedByteArray *proxy = (PackedByteArray *)&result; + uint8_t *proxy_writer = proxy->ptrw(); proxy->resize(tmp_result.size()); for (int i = 0; i < tmp_result.size(); i++) { @@ -1055,14 +1055,14 @@ godot_string GDAPI godot_string_md5_text(const godot_string *p_self) { return result; } -godot_pool_byte_array GDAPI godot_string_sha256_buffer(const godot_string *p_self) { +godot_packed_byte_array GDAPI godot_string_sha256_buffer(const godot_string *p_self) { const String *self = (const String *)p_self; Vector<uint8_t> tmp_result = self->sha256_buffer(); - godot_pool_byte_array result; - memnew_placement(&result, PoolByteArray); - PoolByteArray *proxy = (PoolByteArray *)&result; - PoolByteArray::Write proxy_writer = proxy->write(); + godot_packed_byte_array result; + memnew_placement(&result, PackedByteArray); + PackedByteArray *proxy = (PackedByteArray *)&result; + uint8_t *proxy_writer = proxy->ptrw(); proxy->resize(tmp_result.size()); for (int i = 0; i < tmp_result.size(); i++) { @@ -1343,15 +1343,15 @@ godot_string GDAPI godot_string_rstrip(const godot_string *p_self, const godot_s return result; } -godot_pool_string_array GDAPI godot_string_rsplit(const godot_string *p_self, const godot_string *p_divisor, +godot_packed_string_array GDAPI godot_string_rsplit(const godot_string *p_self, const godot_string *p_divisor, const godot_bool p_allow_empty, const godot_int p_maxsplit) { const String *self = (const String *)p_self; String *divisor = (String *)p_divisor; - godot_pool_string_array result; - memnew_placement(&result, PoolStringArray); - PoolStringArray *proxy = (PoolStringArray *)&result; - PoolStringArray::Write proxy_writer = proxy->write(); + godot_packed_string_array result; + memnew_placement(&result, PackedStringArray); + PackedStringArray *proxy = (PackedStringArray *)&result; + String *proxy_writer = proxy->ptrw(); Vector<String> tmp_result = self->rsplit(*divisor, p_allow_empty, p_maxsplit); proxy->resize(tmp_result.size()); diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp index 33b378d9cc..176d5a0461 100644 --- a/modules/gdnative/gdnative/variant.cpp +++ b/modules/gdnative/gdnative/variant.cpp @@ -201,45 +201,45 @@ void GDAPI godot_variant_new_array(godot_variant *r_dest, const godot_array *p_a memnew_placement_custom(dest, Variant, Variant(*arr)); } -void GDAPI godot_variant_new_pool_byte_array(godot_variant *r_dest, const godot_pool_byte_array *p_pba) { +void GDAPI godot_variant_new_packed_byte_array(godot_variant *r_dest, const godot_packed_byte_array *p_pba) { Variant *dest = (Variant *)r_dest; - PoolByteArray *pba = (PoolByteArray *)p_pba; + PackedByteArray *pba = (PackedByteArray *)p_pba; memnew_placement_custom(dest, Variant, Variant(*pba)); } -void GDAPI godot_variant_new_pool_int_array(godot_variant *r_dest, const godot_pool_int_array *p_pia) { +void GDAPI godot_variant_new_packed_int_array(godot_variant *r_dest, const godot_packed_int_array *p_pia) { Variant *dest = (Variant *)r_dest; - PoolIntArray *pia = (PoolIntArray *)p_pia; + PackedIntArray *pia = (PackedIntArray *)p_pia; memnew_placement_custom(dest, Variant, Variant(*pia)); } -void GDAPI godot_variant_new_pool_real_array(godot_variant *r_dest, const godot_pool_real_array *p_pra) { +void GDAPI godot_variant_new_packed_real_array(godot_variant *r_dest, const godot_packed_real_array *p_pra) { Variant *dest = (Variant *)r_dest; - PoolRealArray *pra = (PoolRealArray *)p_pra; + PackedRealArray *pra = (PackedRealArray *)p_pra; memnew_placement_custom(dest, Variant, Variant(*pra)); } -void GDAPI godot_variant_new_pool_string_array(godot_variant *r_dest, const godot_pool_string_array *p_psa) { +void GDAPI godot_variant_new_packed_string_array(godot_variant *r_dest, const godot_packed_string_array *p_psa) { Variant *dest = (Variant *)r_dest; - PoolStringArray *psa = (PoolStringArray *)p_psa; + PackedStringArray *psa = (PackedStringArray *)p_psa; memnew_placement_custom(dest, Variant, Variant(*psa)); } -void GDAPI godot_variant_new_pool_vector2_array(godot_variant *r_dest, const godot_pool_vector2_array *p_pv2a) { +void GDAPI godot_variant_new_packed_vector2_array(godot_variant *r_dest, const godot_packed_vector2_array *p_pv2a) { Variant *dest = (Variant *)r_dest; - PoolVector2Array *pv2a = (PoolVector2Array *)p_pv2a; + PackedVector2Array *pv2a = (PackedVector2Array *)p_pv2a; memnew_placement_custom(dest, Variant, Variant(*pv2a)); } -void GDAPI godot_variant_new_pool_vector3_array(godot_variant *r_dest, const godot_pool_vector3_array *p_pv3a) { +void GDAPI godot_variant_new_packed_vector3_array(godot_variant *r_dest, const godot_packed_vector3_array *p_pv3a) { Variant *dest = (Variant *)r_dest; - PoolVector3Array *pv3a = (PoolVector3Array *)p_pv3a; + PackedVector3Array *pv3a = (PackedVector3Array *)p_pv3a; memnew_placement_custom(dest, Variant, Variant(*pv3a)); } -void GDAPI godot_variant_new_pool_color_array(godot_variant *r_dest, const godot_pool_color_array *p_pca) { +void GDAPI godot_variant_new_packed_color_array(godot_variant *r_dest, const godot_packed_color_array *p_pca) { Variant *dest = (Variant *)r_dest; - PoolColorArray *pca = (PoolColorArray *)p_pca; + PackedColorArray *pca = (PackedColorArray *)p_pca; memnew_placement_custom(dest, Variant, Variant(*pca)); } @@ -390,65 +390,65 @@ godot_array GDAPI godot_variant_as_array(const godot_variant *p_self) { return raw_dest; } -godot_pool_byte_array GDAPI godot_variant_as_pool_byte_array(const godot_variant *p_self) { - godot_pool_byte_array raw_dest; +godot_packed_byte_array GDAPI godot_variant_as_packed_byte_array(const godot_variant *p_self) { + godot_packed_byte_array raw_dest; const Variant *self = (const Variant *)p_self; - PoolByteArray *dest = (PoolByteArray *)&raw_dest; - memnew_placement(dest, PoolByteArray(self->operator PoolByteArray())); // operator = is overloaded by PoolByteArray + PackedByteArray *dest = (PackedByteArray *)&raw_dest; + memnew_placement(dest, PackedByteArray(self->operator PackedByteArray())); // operator = is overloaded by PackedByteArray *dest = *self; return raw_dest; } -godot_pool_int_array GDAPI godot_variant_as_pool_int_array(const godot_variant *p_self) { - godot_pool_int_array raw_dest; +godot_packed_int_array GDAPI godot_variant_as_packed_int_array(const godot_variant *p_self) { + godot_packed_int_array raw_dest; const Variant *self = (const Variant *)p_self; - PoolIntArray *dest = (PoolIntArray *)&raw_dest; - memnew_placement(dest, PoolIntArray(self->operator PoolIntArray())); // operator = is overloaded by PoolIntArray + PackedIntArray *dest = (PackedIntArray *)&raw_dest; + memnew_placement(dest, PackedIntArray(self->operator PackedIntArray())); // operator = is overloaded by PackedIntArray *dest = *self; return raw_dest; } -godot_pool_real_array GDAPI godot_variant_as_pool_real_array(const godot_variant *p_self) { - godot_pool_real_array raw_dest; +godot_packed_real_array GDAPI godot_variant_as_packed_real_array(const godot_variant *p_self) { + godot_packed_real_array raw_dest; const Variant *self = (const Variant *)p_self; - PoolRealArray *dest = (PoolRealArray *)&raw_dest; - memnew_placement(dest, PoolRealArray(self->operator PoolRealArray())); // operator = is overloaded by PoolRealArray + PackedRealArray *dest = (PackedRealArray *)&raw_dest; + memnew_placement(dest, PackedRealArray(self->operator PackedRealArray())); // operator = is overloaded by PackedRealArray *dest = *self; return raw_dest; } -godot_pool_string_array GDAPI godot_variant_as_pool_string_array(const godot_variant *p_self) { - godot_pool_string_array raw_dest; +godot_packed_string_array GDAPI godot_variant_as_packed_string_array(const godot_variant *p_self) { + godot_packed_string_array raw_dest; const Variant *self = (const Variant *)p_self; - PoolStringArray *dest = (PoolStringArray *)&raw_dest; - memnew_placement(dest, PoolStringArray(self->operator PoolStringArray())); // operator = is overloaded by PoolStringArray + PackedStringArray *dest = (PackedStringArray *)&raw_dest; + memnew_placement(dest, PackedStringArray(self->operator PackedStringArray())); // operator = is overloaded by PackedStringArray *dest = *self; return raw_dest; } -godot_pool_vector2_array GDAPI godot_variant_as_pool_vector2_array(const godot_variant *p_self) { - godot_pool_vector2_array raw_dest; +godot_packed_vector2_array GDAPI godot_variant_as_packed_vector2_array(const godot_variant *p_self) { + godot_packed_vector2_array raw_dest; const Variant *self = (const Variant *)p_self; - PoolVector2Array *dest = (PoolVector2Array *)&raw_dest; - memnew_placement(dest, PoolVector2Array(self->operator PoolVector2Array())); // operator = is overloaded by PoolVector2Array + PackedVector2Array *dest = (PackedVector2Array *)&raw_dest; + memnew_placement(dest, PackedVector2Array(self->operator PackedVector2Array())); // operator = is overloaded by PackedVector2Array *dest = *self; return raw_dest; } -godot_pool_vector3_array GDAPI godot_variant_as_pool_vector3_array(const godot_variant *p_self) { - godot_pool_vector3_array raw_dest; +godot_packed_vector3_array GDAPI godot_variant_as_packed_vector3_array(const godot_variant *p_self) { + godot_packed_vector3_array raw_dest; const Variant *self = (const Variant *)p_self; - PoolVector3Array *dest = (PoolVector3Array *)&raw_dest; - memnew_placement(dest, PoolVector3Array(self->operator PoolVector3Array())); // operator = is overloaded by PoolVector3Array + PackedVector3Array *dest = (PackedVector3Array *)&raw_dest; + memnew_placement(dest, PackedVector3Array(self->operator PackedVector3Array())); // operator = is overloaded by PackedVector3Array *dest = *self; return raw_dest; } -godot_pool_color_array GDAPI godot_variant_as_pool_color_array(const godot_variant *p_self) { - godot_pool_color_array raw_dest; +godot_packed_color_array GDAPI godot_variant_as_packed_color_array(const godot_variant *p_self) { + godot_packed_color_array raw_dest; const Variant *self = (const Variant *)p_self; - PoolColorArray *dest = (PoolColorArray *)&raw_dest; - memnew_placement(dest, PoolColorArray(self->operator PoolColorArray())); // operator = is overloaded by PoolColorArray + PackedColorArray *dest = (PackedColorArray *)&raw_dest; + memnew_placement(dest, PackedColorArray(self->operator PackedColorArray())); // operator = is overloaded by PackedColorArray *dest = *self; return raw_dest; } diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 6004b07965..e1d6c0c867 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -93,52 +93,52 @@ ] }, { - "name": "godot_pool_byte_array_empty", + "name": "godot_packed_byte_array_empty", "return_type": "godot_bool", "arguments": [ - ["const godot_pool_byte_array *", "p_self"] + ["const godot_packed_byte_array *", "p_self"] ] }, { - "name": "godot_pool_int_array_empty", + "name": "godot_packed_int_array_empty", "return_type": "godot_bool", "arguments": [ - ["const godot_pool_int_array *", "p_self"] + ["const godot_packed_int_array *", "p_self"] ] }, { - "name": "godot_pool_real_array_empty", + "name": "godot_packed_real_array_empty", "return_type": "godot_bool", "arguments": [ - ["const godot_pool_real_array *", "p_self"] + ["const godot_packed_real_array *", "p_self"] ] }, { - "name": "godot_pool_string_array_empty", + "name": "godot_packed_string_array_empty", "return_type": "godot_bool", "arguments": [ - ["const godot_pool_string_array *", "p_self"] + ["const godot_packed_string_array *", "p_self"] ] }, { - "name": "godot_pool_vector2_array_empty", + "name": "godot_packed_vector2_array_empty", "return_type": "godot_bool", "arguments": [ - ["const godot_pool_vector2_array *", "p_self"] + ["const godot_packed_vector2_array *", "p_self"] ] }, { - "name": "godot_pool_vector3_array_empty", + "name": "godot_packed_vector3_array_empty", "return_type": "godot_bool", "arguments": [ - ["const godot_pool_vector3_array *", "p_self"] + ["const godot_packed_vector3_array *", "p_self"] ] }, { - "name": "godot_pool_color_array_empty", + "name": "godot_packed_color_array_empty", "return_type": "godot_bool", "arguments": [ - ["const godot_pool_color_array *", "p_self"] + ["const godot_packed_color_array *", "p_self"] ] }, { @@ -352,7 +352,7 @@ }, { "name": "godot_string_rsplit", - "return_type": "godot_pool_string_array", + "return_type": "godot_packed_string_array", "arguments": [ ["const godot_string *", "p_self"], ["const godot_string *", "p_divisor"], @@ -1657,1277 +1657,773 @@ ] }, { - "name": "godot_pool_byte_array_new", + "name": "godot_packed_byte_array_new", "return_type": "void", "arguments": [ - ["godot_pool_byte_array *", "r_dest"] + ["godot_packed_byte_array *", "r_dest"] ] }, { - "name": "godot_pool_byte_array_new_copy", + "name": "godot_packed_byte_array_new_copy", "return_type": "void", "arguments": [ - ["godot_pool_byte_array *", "r_dest"], - ["const godot_pool_byte_array *", "p_src"] + ["godot_packed_byte_array *", "r_dest"], + ["const godot_packed_byte_array *", "p_src"] ] }, { - "name": "godot_pool_byte_array_new_with_array", + "name": "godot_packed_byte_array_new_with_array", "return_type": "void", "arguments": [ - ["godot_pool_byte_array *", "r_dest"], + ["godot_packed_byte_array *", "r_dest"], ["const godot_array *", "p_a"] ] }, { - "name": "godot_pool_byte_array_append", + "name": "godot_packed_byte_array_append", "return_type": "void", "arguments": [ - ["godot_pool_byte_array *", "p_self"], + ["godot_packed_byte_array *", "p_self"], ["const uint8_t", "p_data"] ] }, { - "name": "godot_pool_byte_array_append_array", + "name": "godot_packed_byte_array_append_array", "return_type": "void", "arguments": [ - ["godot_pool_byte_array *", "p_self"], - ["const godot_pool_byte_array *", "p_array"] + ["godot_packed_byte_array *", "p_self"], + ["const godot_packed_byte_array *", "p_array"] ] }, { - "name": "godot_pool_byte_array_insert", + "name": "godot_packed_byte_array_insert", "return_type": "godot_error", "arguments": [ - ["godot_pool_byte_array *", "p_self"], + ["godot_packed_byte_array *", "p_self"], ["const godot_int", "p_idx"], ["const uint8_t", "p_data"] ] }, { - "name": "godot_pool_byte_array_invert", + "name": "godot_packed_byte_array_invert", "return_type": "void", "arguments": [ - ["godot_pool_byte_array *", "p_self"] + ["godot_packed_byte_array *", "p_self"] ] }, { - "name": "godot_pool_byte_array_push_back", + "name": "godot_packed_byte_array_push_back", "return_type": "void", "arguments": [ - ["godot_pool_byte_array *", "p_self"], + ["godot_packed_byte_array *", "p_self"], ["const uint8_t", "p_data"] ] }, { - "name": "godot_pool_byte_array_remove", + "name": "godot_packed_byte_array_remove", "return_type": "void", "arguments": [ - ["godot_pool_byte_array *", "p_self"], + ["godot_packed_byte_array *", "p_self"], ["const godot_int", "p_idx"] ] }, { - "name": "godot_pool_byte_array_resize", + "name": "godot_packed_byte_array_resize", "return_type": "void", "arguments": [ - ["godot_pool_byte_array *", "p_self"], + ["godot_packed_byte_array *", "p_self"], ["const godot_int", "p_size"] ] }, { - "name": "godot_pool_byte_array_read", - "return_type": "godot_pool_byte_array_read_access *", - "arguments": [ - ["const godot_pool_byte_array *", "p_self"] - ] - }, - { - "name": "godot_pool_byte_array_write", - "return_type": "godot_pool_byte_array_write_access *", - "arguments": [ - ["godot_pool_byte_array *", "p_self"] - ] - }, - { - "name": "godot_pool_byte_array_set", + "name": "godot_packed_byte_array_set", "return_type": "void", "arguments": [ - ["godot_pool_byte_array *", "p_self"], + ["godot_packed_byte_array *", "p_self"], ["const godot_int", "p_idx"], ["const uint8_t", "p_data"] ] }, { - "name": "godot_pool_byte_array_get", + "name": "godot_packed_byte_array_get", "return_type": "uint8_t", "arguments": [ - ["const godot_pool_byte_array *", "p_self"], + ["const godot_packed_byte_array *", "p_self"], ["const godot_int", "p_idx"] ] }, { - "name": "godot_pool_byte_array_size", + "name": "godot_packed_byte_array_size", "return_type": "godot_int", "arguments": [ - ["const godot_pool_byte_array *", "p_self"] + ["const godot_packed_byte_array *", "p_self"] ] }, { - "name": "godot_pool_byte_array_destroy", + "name": "godot_packed_byte_array_destroy", "return_type": "void", "arguments": [ - ["godot_pool_byte_array *", "p_self"] + ["godot_packed_byte_array *", "p_self"] ] }, { - "name": "godot_pool_int_array_new", + "name": "godot_packed_int_array_new", "return_type": "void", "arguments": [ - ["godot_pool_int_array *", "r_dest"] + ["godot_packed_int_array *", "r_dest"] ] }, { - "name": "godot_pool_int_array_new_copy", + "name": "godot_packed_int_array_new_copy", "return_type": "void", "arguments": [ - ["godot_pool_int_array *", "r_dest"], - ["const godot_pool_int_array *", "p_src"] + ["godot_packed_int_array *", "r_dest"], + ["const godot_packed_int_array *", "p_src"] ] }, { - "name": "godot_pool_int_array_new_with_array", + "name": "godot_packed_int_array_new_with_array", "return_type": "void", "arguments": [ - ["godot_pool_int_array *", "r_dest"], + ["godot_packed_int_array *", "r_dest"], ["const godot_array *", "p_a"] ] }, { - "name": "godot_pool_int_array_append", + "name": "godot_packed_int_array_append", "return_type": "void", "arguments": [ - ["godot_pool_int_array *", "p_self"], + ["godot_packed_int_array *", "p_self"], ["const godot_int", "p_data"] ] }, { - "name": "godot_pool_int_array_append_array", + "name": "godot_packed_int_array_append_array", "return_type": "void", "arguments": [ - ["godot_pool_int_array *", "p_self"], - ["const godot_pool_int_array *", "p_array"] + ["godot_packed_int_array *", "p_self"], + ["const godot_packed_int_array *", "p_array"] ] }, { - "name": "godot_pool_int_array_insert", + "name": "godot_packed_int_array_insert", "return_type": "godot_error", "arguments": [ - ["godot_pool_int_array *", "p_self"], + ["godot_packed_int_array *", "p_self"], ["const godot_int", "p_idx"], ["const godot_int", "p_data"] ] }, { - "name": "godot_pool_int_array_invert", + "name": "godot_packed_int_array_invert", "return_type": "void", "arguments": [ - ["godot_pool_int_array *", "p_self"] + ["godot_packed_int_array *", "p_self"] ] }, { - "name": "godot_pool_int_array_push_back", + "name": "godot_packed_int_array_push_back", "return_type": "void", "arguments": [ - ["godot_pool_int_array *", "p_self"], + ["godot_packed_int_array *", "p_self"], ["const godot_int", "p_data"] ] }, { - "name": "godot_pool_int_array_remove", + "name": "godot_packed_int_array_remove", "return_type": "void", "arguments": [ - ["godot_pool_int_array *", "p_self"], + ["godot_packed_int_array *", "p_self"], ["const godot_int", "p_idx"] ] }, { - "name": "godot_pool_int_array_resize", + "name": "godot_packed_int_array_resize", "return_type": "void", "arguments": [ - ["godot_pool_int_array *", "p_self"], + ["godot_packed_int_array *", "p_self"], ["const godot_int", "p_size"] ] }, { - "name": "godot_pool_int_array_read", - "return_type": "godot_pool_int_array_read_access *", - "arguments": [ - ["const godot_pool_int_array *", "p_self"] - ] - }, - { - "name": "godot_pool_int_array_write", - "return_type": "godot_pool_int_array_write_access *", - "arguments": [ - ["godot_pool_int_array *", "p_self"] - ] - }, - { - "name": "godot_pool_int_array_set", + "name": "godot_packed_int_array_set", "return_type": "void", "arguments": [ - ["godot_pool_int_array *", "p_self"], + ["godot_packed_int_array *", "p_self"], ["const godot_int", "p_idx"], ["const godot_int", "p_data"] ] }, { - "name": "godot_pool_int_array_get", + "name": "godot_packed_int_array_get", "return_type": "godot_int", "arguments": [ - ["const godot_pool_int_array *", "p_self"], + ["const godot_packed_int_array *", "p_self"], ["const godot_int", "p_idx"] ] }, { - "name": "godot_pool_int_array_size", + "name": "godot_packed_int_array_size", "return_type": "godot_int", "arguments": [ - ["const godot_pool_int_array *", "p_self"] + ["const godot_packed_int_array *", "p_self"] ] }, { - "name": "godot_pool_int_array_destroy", + "name": "godot_packed_int_array_destroy", "return_type": "void", "arguments": [ - ["godot_pool_int_array *", "p_self"] + ["godot_packed_int_array *", "p_self"] ] }, { - "name": "godot_pool_real_array_new", + "name": "godot_packed_real_array_new", "return_type": "void", "arguments": [ - ["godot_pool_real_array *", "r_dest"] + ["godot_packed_real_array *", "r_dest"] ] }, { - "name": "godot_pool_real_array_new_copy", + "name": "godot_packed_real_array_new_copy", "return_type": "void", "arguments": [ - ["godot_pool_real_array *", "r_dest"], - ["const godot_pool_real_array *", "p_src"] + ["godot_packed_real_array *", "r_dest"], + ["const godot_packed_real_array *", "p_src"] ] }, { - "name": "godot_pool_real_array_new_with_array", + "name": "godot_packed_real_array_new_with_array", "return_type": "void", "arguments": [ - ["godot_pool_real_array *", "r_dest"], + ["godot_packed_real_array *", "r_dest"], ["const godot_array *", "p_a"] ] }, { - "name": "godot_pool_real_array_append", + "name": "godot_packed_real_array_append", "return_type": "void", "arguments": [ - ["godot_pool_real_array *", "p_self"], + ["godot_packed_real_array *", "p_self"], ["const godot_real", "p_data"] ] }, { - "name": "godot_pool_real_array_append_array", + "name": "godot_packed_real_array_append_array", "return_type": "void", "arguments": [ - ["godot_pool_real_array *", "p_self"], - ["const godot_pool_real_array *", "p_array"] + ["godot_packed_real_array *", "p_self"], + ["const godot_packed_real_array *", "p_array"] ] }, { - "name": "godot_pool_real_array_insert", + "name": "godot_packed_real_array_insert", "return_type": "godot_error", "arguments": [ - ["godot_pool_real_array *", "p_self"], + ["godot_packed_real_array *", "p_self"], ["const godot_int", "p_idx"], ["const godot_real", "p_data"] ] }, { - "name": "godot_pool_real_array_invert", + "name": "godot_packed_real_array_invert", "return_type": "void", "arguments": [ - ["godot_pool_real_array *", "p_self"] + ["godot_packed_real_array *", "p_self"] ] }, { - "name": "godot_pool_real_array_push_back", + "name": "godot_packed_real_array_push_back", "return_type": "void", "arguments": [ - ["godot_pool_real_array *", "p_self"], + ["godot_packed_real_array *", "p_self"], ["const godot_real", "p_data"] ] }, { - "name": "godot_pool_real_array_remove", + "name": "godot_packed_real_array_remove", "return_type": "void", "arguments": [ - ["godot_pool_real_array *", "p_self"], + ["godot_packed_real_array *", "p_self"], ["const godot_int", "p_idx"] ] }, { - "name": "godot_pool_real_array_resize", + "name": "godot_packed_real_array_resize", "return_type": "void", "arguments": [ - ["godot_pool_real_array *", "p_self"], + ["godot_packed_real_array *", "p_self"], ["const godot_int", "p_size"] ] }, { - "name": "godot_pool_real_array_read", - "return_type": "godot_pool_real_array_read_access *", - "arguments": [ - ["const godot_pool_real_array *", "p_self"] - ] - }, - { - "name": "godot_pool_real_array_write", - "return_type": "godot_pool_real_array_write_access *", - "arguments": [ - ["godot_pool_real_array *", "p_self"] - ] - }, - { - "name": "godot_pool_real_array_set", + "name": "godot_packed_real_array_set", "return_type": "void", "arguments": [ - ["godot_pool_real_array *", "p_self"], + ["godot_packed_real_array *", "p_self"], ["const godot_int", "p_idx"], ["const godot_real", "p_data"] ] }, { - "name": "godot_pool_real_array_get", + "name": "godot_packed_real_array_get", "return_type": "godot_real", "arguments": [ - ["const godot_pool_real_array *", "p_self"], + ["const godot_packed_real_array *", "p_self"], ["const godot_int", "p_idx"] ] }, { - "name": "godot_pool_real_array_size", + "name": "godot_packed_real_array_size", "return_type": "godot_int", "arguments": [ - ["const godot_pool_real_array *", "p_self"] + ["const godot_packed_real_array *", "p_self"] ] }, { - "name": "godot_pool_real_array_destroy", + "name": "godot_packed_real_array_destroy", "return_type": "void", "arguments": [ - ["godot_pool_real_array *", "p_self"] + ["godot_packed_real_array *", "p_self"] ] }, { - "name": "godot_pool_string_array_new", + "name": "godot_packed_string_array_new", "return_type": "void", "arguments": [ - ["godot_pool_string_array *", "r_dest"] + ["godot_packed_string_array *", "r_dest"] ] }, { - "name": "godot_pool_string_array_new_copy", + "name": "godot_packed_string_array_new_copy", "return_type": "void", "arguments": [ - ["godot_pool_string_array *", "r_dest"], - ["const godot_pool_string_array *", "p_src"] + ["godot_packed_string_array *", "r_dest"], + ["const godot_packed_string_array *", "p_src"] ] }, { - "name": "godot_pool_string_array_new_with_array", + "name": "godot_packed_string_array_new_with_array", "return_type": "void", "arguments": [ - ["godot_pool_string_array *", "r_dest"], + ["godot_packed_string_array *", "r_dest"], ["const godot_array *", "p_a"] ] }, { - "name": "godot_pool_string_array_append", + "name": "godot_packed_string_array_append", "return_type": "void", "arguments": [ - ["godot_pool_string_array *", "p_self"], + ["godot_packed_string_array *", "p_self"], ["const godot_string *", "p_data"] ] }, { - "name": "godot_pool_string_array_append_array", + "name": "godot_packed_string_array_append_array", "return_type": "void", "arguments": [ - ["godot_pool_string_array *", "p_self"], - ["const godot_pool_string_array *", "p_array"] + ["godot_packed_string_array *", "p_self"], + ["const godot_packed_string_array *", "p_array"] ] }, { - "name": "godot_pool_string_array_insert", + "name": "godot_packed_string_array_insert", "return_type": "godot_error", "arguments": [ - ["godot_pool_string_array *", "p_self"], + ["godot_packed_string_array *", "p_self"], ["const godot_int", "p_idx"], ["const godot_string *", "p_data"] ] }, { - "name": "godot_pool_string_array_invert", + "name": "godot_packed_string_array_invert", "return_type": "void", "arguments": [ - ["godot_pool_string_array *", "p_self"] + ["godot_packed_string_array *", "p_self"] ] }, { - "name": "godot_pool_string_array_push_back", + "name": "godot_packed_string_array_push_back", "return_type": "void", "arguments": [ - ["godot_pool_string_array *", "p_self"], + ["godot_packed_string_array *", "p_self"], ["const godot_string *", "p_data"] ] }, { - "name": "godot_pool_string_array_remove", + "name": "godot_packed_string_array_remove", "return_type": "void", "arguments": [ - ["godot_pool_string_array *", "p_self"], + ["godot_packed_string_array *", "p_self"], ["const godot_int", "p_idx"] ] }, { - "name": "godot_pool_string_array_resize", + "name": "godot_packed_string_array_resize", "return_type": "void", "arguments": [ - ["godot_pool_string_array *", "p_self"], + ["godot_packed_string_array *", "p_self"], ["const godot_int", "p_size"] ] }, { - "name": "godot_pool_string_array_read", - "return_type": "godot_pool_string_array_read_access *", - "arguments": [ - ["const godot_pool_string_array *", "p_self"] - ] - }, - { - "name": "godot_pool_string_array_write", - "return_type": "godot_pool_string_array_write_access *", - "arguments": [ - ["godot_pool_string_array *", "p_self"] - ] - }, - { - "name": "godot_pool_string_array_set", + "name": "godot_packed_string_array_set", "return_type": "void", "arguments": [ - ["godot_pool_string_array *", "p_self"], + ["godot_packed_string_array *", "p_self"], ["const godot_int", "p_idx"], ["const godot_string *", "p_data"] ] }, { - "name": "godot_pool_string_array_get", + "name": "godot_packed_string_array_get", "return_type": "godot_string", "arguments": [ - ["const godot_pool_string_array *", "p_self"], + ["const godot_packed_string_array *", "p_self"], ["const godot_int", "p_idx"] ] }, { - "name": "godot_pool_string_array_size", + "name": "godot_packed_string_array_size", "return_type": "godot_int", "arguments": [ - ["const godot_pool_string_array *", "p_self"] + ["const godot_packed_string_array *", "p_self"] ] }, { - "name": "godot_pool_string_array_destroy", + "name": "godot_packed_string_array_destroy", "return_type": "void", "arguments": [ - ["godot_pool_string_array *", "p_self"] + ["godot_packed_string_array *", "p_self"] ] }, { - "name": "godot_pool_vector2_array_new", + "name": "godot_packed_vector2_array_new", "return_type": "void", "arguments": [ - ["godot_pool_vector2_array *", "r_dest"] + ["godot_packed_vector2_array *", "r_dest"] ] }, { - "name": "godot_pool_vector2_array_new_copy", + "name": "godot_packed_vector2_array_new_copy", "return_type": "void", "arguments": [ - ["godot_pool_vector2_array *", "r_dest"], - ["const godot_pool_vector2_array *", "p_src"] + ["godot_packed_vector2_array *", "r_dest"], + ["const godot_packed_vector2_array *", "p_src"] ] }, { - "name": "godot_pool_vector2_array_new_with_array", + "name": "godot_packed_vector2_array_new_with_array", "return_type": "void", "arguments": [ - ["godot_pool_vector2_array *", "r_dest"], + ["godot_packed_vector2_array *", "r_dest"], ["const godot_array *", "p_a"] ] }, { - "name": "godot_pool_vector2_array_append", + "name": "godot_packed_vector2_array_append", "return_type": "void", "arguments": [ - ["godot_pool_vector2_array *", "p_self"], + ["godot_packed_vector2_array *", "p_self"], ["const godot_vector2 *", "p_data"] ] }, { - "name": "godot_pool_vector2_array_append_array", + "name": "godot_packed_vector2_array_append_array", "return_type": "void", "arguments": [ - ["godot_pool_vector2_array *", "p_self"], - ["const godot_pool_vector2_array *", "p_array"] + ["godot_packed_vector2_array *", "p_self"], + ["const godot_packed_vector2_array *", "p_array"] ] }, { - "name": "godot_pool_vector2_array_insert", + "name": "godot_packed_vector2_array_insert", "return_type": "godot_error", "arguments": [ - ["godot_pool_vector2_array *", "p_self"], + ["godot_packed_vector2_array *", "p_self"], ["const godot_int", "p_idx"], ["const godot_vector2 *", "p_data"] ] }, { - "name": "godot_pool_vector2_array_invert", + "name": "godot_packed_vector2_array_invert", "return_type": "void", "arguments": [ - ["godot_pool_vector2_array *", "p_self"] + ["godot_packed_vector2_array *", "p_self"] ] }, { - "name": "godot_pool_vector2_array_push_back", + "name": "godot_packed_vector2_array_push_back", "return_type": "void", "arguments": [ - ["godot_pool_vector2_array *", "p_self"], + ["godot_packed_vector2_array *", "p_self"], ["const godot_vector2 *", "p_data"] ] }, { - "name": "godot_pool_vector2_array_remove", + "name": "godot_packed_vector2_array_remove", "return_type": "void", "arguments": [ - ["godot_pool_vector2_array *", "p_self"], + ["godot_packed_vector2_array *", "p_self"], ["const godot_int", "p_idx"] ] }, { - "name": "godot_pool_vector2_array_resize", + "name": "godot_packed_vector2_array_resize", "return_type": "void", "arguments": [ - ["godot_pool_vector2_array *", "p_self"], + ["godot_packed_vector2_array *", "p_self"], ["const godot_int", "p_size"] ] }, { - "name": "godot_pool_vector2_array_read", - "return_type": "godot_pool_vector2_array_read_access *", - "arguments": [ - ["const godot_pool_vector2_array *", "p_self"] - ] - }, - { - "name": "godot_pool_vector2_array_write", - "return_type": "godot_pool_vector2_array_write_access *", - "arguments": [ - ["godot_pool_vector2_array *", "p_self"] - ] - }, - { - "name": "godot_pool_vector2_array_set", + "name": "godot_packed_vector2_array_set", "return_type": "void", "arguments": [ - ["godot_pool_vector2_array *", "p_self"], + ["godot_packed_vector2_array *", "p_self"], ["const godot_int", "p_idx"], ["const godot_vector2 *", "p_data"] ] }, { - "name": "godot_pool_vector2_array_get", + "name": "godot_packed_vector2_array_get", "return_type": "godot_vector2", "arguments": [ - ["const godot_pool_vector2_array *", "p_self"], + ["const godot_packed_vector2_array *", "p_self"], ["const godot_int", "p_idx"] ] }, { - "name": "godot_pool_vector2_array_size", + "name": "godot_packed_vector2_array_size", "return_type": "godot_int", "arguments": [ - ["const godot_pool_vector2_array *", "p_self"] + ["const godot_packed_vector2_array *", "p_self"] ] }, { - "name": "godot_pool_vector2_array_destroy", + "name": "godot_packed_vector2_array_destroy", "return_type": "void", "arguments": [ - ["godot_pool_vector2_array *", "p_self"] + ["godot_packed_vector2_array *", "p_self"] ] }, { - "name": "godot_pool_vector3_array_new", + "name": "godot_packed_vector3_array_new", "return_type": "void", "arguments": [ - ["godot_pool_vector3_array *", "r_dest"] + ["godot_packed_vector3_array *", "r_dest"] ] }, { - "name": "godot_pool_vector3_array_new_copy", + "name": "godot_packed_vector3_array_new_copy", "return_type": "void", "arguments": [ - ["godot_pool_vector3_array *", "r_dest"], - ["const godot_pool_vector3_array *", "p_src"] + ["godot_packed_vector3_array *", "r_dest"], + ["const godot_packed_vector3_array *", "p_src"] ] }, { - "name": "godot_pool_vector3_array_new_with_array", + "name": "godot_packed_vector3_array_new_with_array", "return_type": "void", "arguments": [ - ["godot_pool_vector3_array *", "r_dest"], + ["godot_packed_vector3_array *", "r_dest"], ["const godot_array *", "p_a"] ] }, { - "name": "godot_pool_vector3_array_append", + "name": "godot_packed_vector3_array_append", "return_type": "void", "arguments": [ - ["godot_pool_vector3_array *", "p_self"], + ["godot_packed_vector3_array *", "p_self"], ["const godot_vector3 *", "p_data"] ] }, { - "name": "godot_pool_vector3_array_append_array", + "name": "godot_packed_vector3_array_append_array", "return_type": "void", "arguments": [ - ["godot_pool_vector3_array *", "p_self"], - ["const godot_pool_vector3_array *", "p_array"] + ["godot_packed_vector3_array *", "p_self"], + ["const godot_packed_vector3_array *", "p_array"] ] }, { - "name": "godot_pool_vector3_array_insert", + "name": "godot_packed_vector3_array_insert", "return_type": "godot_error", "arguments": [ - ["godot_pool_vector3_array *", "p_self"], + ["godot_packed_vector3_array *", "p_self"], ["const godot_int", "p_idx"], ["const godot_vector3 *", "p_data"] ] }, { - "name": "godot_pool_vector3_array_invert", + "name": "godot_packed_vector3_array_invert", "return_type": "void", "arguments": [ - ["godot_pool_vector3_array *", "p_self"] + ["godot_packed_vector3_array *", "p_self"] ] }, { - "name": "godot_pool_vector3_array_push_back", + "name": "godot_packed_vector3_array_push_back", "return_type": "void", "arguments": [ - ["godot_pool_vector3_array *", "p_self"], + ["godot_packed_vector3_array *", "p_self"], ["const godot_vector3 *", "p_data"] ] }, { - "name": "godot_pool_vector3_array_remove", + "name": "godot_packed_vector3_array_remove", "return_type": "void", "arguments": [ - ["godot_pool_vector3_array *", "p_self"], + ["godot_packed_vector3_array *", "p_self"], ["const godot_int", "p_idx"] ] }, { - "name": "godot_pool_vector3_array_resize", + "name": "godot_packed_vector3_array_resize", "return_type": "void", "arguments": [ - ["godot_pool_vector3_array *", "p_self"], + ["godot_packed_vector3_array *", "p_self"], ["const godot_int", "p_size"] ] }, { - "name": "godot_pool_vector3_array_read", - "return_type": "godot_pool_vector3_array_read_access *", - "arguments": [ - ["const godot_pool_vector3_array *", "p_self"] - ] - }, - { - "name": "godot_pool_vector3_array_write", - "return_type": "godot_pool_vector3_array_write_access *", - "arguments": [ - ["godot_pool_vector3_array *", "p_self"] - ] - }, - { - "name": "godot_pool_vector3_array_set", + "name": "godot_packed_vector3_array_set", "return_type": "void", "arguments": [ - ["godot_pool_vector3_array *", "p_self"], + ["godot_packed_vector3_array *", "p_self"], ["const godot_int", "p_idx"], ["const godot_vector3 *", "p_data"] ] }, { - "name": "godot_pool_vector3_array_get", + "name": "godot_packed_vector3_array_get", "return_type": "godot_vector3", "arguments": [ - ["const godot_pool_vector3_array *", "p_self"], + ["const godot_packed_vector3_array *", "p_self"], ["const godot_int", "p_idx"] ] }, { - "name": "godot_pool_vector3_array_size", + "name": "godot_packed_vector3_array_size", "return_type": "godot_int", "arguments": [ - ["const godot_pool_vector3_array *", "p_self"] + ["const godot_packed_vector3_array *", "p_self"] ] }, { - "name": "godot_pool_vector3_array_destroy", + "name": "godot_packed_vector3_array_destroy", "return_type": "void", "arguments": [ - ["godot_pool_vector3_array *", "p_self"] + ["godot_packed_vector3_array *", "p_self"] ] }, { - "name": "godot_pool_color_array_new", + "name": "godot_packed_color_array_new", "return_type": "void", "arguments": [ - ["godot_pool_color_array *", "r_dest"] + ["godot_packed_color_array *", "r_dest"] ] }, { - "name": "godot_pool_color_array_new_copy", + "name": "godot_packed_color_array_new_copy", "return_type": "void", "arguments": [ - ["godot_pool_color_array *", "r_dest"], - ["const godot_pool_color_array *", "p_src"] + ["godot_packed_color_array *", "r_dest"], + ["const godot_packed_color_array *", "p_src"] ] }, { - "name": "godot_pool_color_array_new_with_array", + "name": "godot_packed_color_array_new_with_array", "return_type": "void", "arguments": [ - ["godot_pool_color_array *", "r_dest"], + ["godot_packed_color_array *", "r_dest"], ["const godot_array *", "p_a"] ] }, { - "name": "godot_pool_color_array_append", + "name": "godot_packed_color_array_append", "return_type": "void", "arguments": [ - ["godot_pool_color_array *", "p_self"], + ["godot_packed_color_array *", "p_self"], ["const godot_color *", "p_data"] ] }, { - "name": "godot_pool_color_array_append_array", + "name": "godot_packed_color_array_append_array", "return_type": "void", "arguments": [ - ["godot_pool_color_array *", "p_self"], - ["const godot_pool_color_array *", "p_array"] + ["godot_packed_color_array *", "p_self"], + ["const godot_packed_color_array *", "p_array"] ] }, { - "name": "godot_pool_color_array_insert", + "name": "godot_packed_color_array_insert", "return_type": "godot_error", "arguments": [ - ["godot_pool_color_array *", "p_self"], + ["godot_packed_color_array *", "p_self"], ["const godot_int", "p_idx"], ["const godot_color *", "p_data"] ] }, { - "name": "godot_pool_color_array_invert", + "name": "godot_packed_color_array_invert", "return_type": "void", "arguments": [ - ["godot_pool_color_array *", "p_self"] + ["godot_packed_color_array *", "p_self"] ] }, { - "name": "godot_pool_color_array_push_back", + "name": "godot_packed_color_array_push_back", "return_type": "void", "arguments": [ - ["godot_pool_color_array *", "p_self"], + ["godot_packed_color_array *", "p_self"], ["const godot_color *", "p_data"] ] }, { - "name": "godot_pool_color_array_remove", + "name": "godot_packed_color_array_remove", "return_type": "void", "arguments": [ - ["godot_pool_color_array *", "p_self"], + ["godot_packed_color_array *", "p_self"], ["const godot_int", "p_idx"] ] }, { - "name": "godot_pool_color_array_resize", + "name": "godot_packed_color_array_resize", "return_type": "void", "arguments": [ - ["godot_pool_color_array *", "p_self"], + ["godot_packed_color_array *", "p_self"], ["const godot_int", "p_size"] ] }, { - "name": "godot_pool_color_array_read", - "return_type": "godot_pool_color_array_read_access *", - "arguments": [ - ["const godot_pool_color_array *", "p_self"] - ] - }, - { - "name": "godot_pool_color_array_write", - "return_type": "godot_pool_color_array_write_access *", - "arguments": [ - ["godot_pool_color_array *", "p_self"] - ] - }, - { - "name": "godot_pool_color_array_set", + "name": "godot_packed_color_array_set", "return_type": "void", "arguments": [ - ["godot_pool_color_array *", "p_self"], + ["godot_packed_color_array *", "p_self"], ["const godot_int", "p_idx"], ["const godot_color *", "p_data"] ] }, { - "name": "godot_pool_color_array_get", + "name": "godot_packed_color_array_get", "return_type": "godot_color", "arguments": [ - ["const godot_pool_color_array *", "p_self"], + ["const godot_packed_color_array *", "p_self"], ["const godot_int", "p_idx"] ] }, { - "name": "godot_pool_color_array_size", + "name": "godot_packed_color_array_size", "return_type": "godot_int", "arguments": [ - ["const godot_pool_color_array *", "p_self"] - ] - }, - { - "name": "godot_pool_color_array_destroy", - "return_type": "void", - "arguments": [ - ["godot_pool_color_array *", "p_self"] - ] - }, - { - "name": "godot_pool_byte_array_read_access_copy", - "return_type": "godot_pool_byte_array_read_access *", - "arguments": [ - ["const godot_pool_byte_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_byte_array_read_access_ptr", - "return_type": "const uint8_t *", - "arguments": [ - ["const godot_pool_byte_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_byte_array_read_access_operator_assign", - "return_type": "void", - "arguments": [ - ["godot_pool_byte_array_read_access *", "p_read"], - ["godot_pool_byte_array_read_access *", "p_other"] - ] - }, - { - "name": "godot_pool_byte_array_read_access_destroy", - "return_type": "void", - "arguments": [ - ["godot_pool_byte_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_int_array_read_access_copy", - "return_type": "godot_pool_int_array_read_access *", - "arguments": [ - ["const godot_pool_int_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_int_array_read_access_ptr", - "return_type": "const godot_int *", - "arguments": [ - ["const godot_pool_int_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_int_array_read_access_operator_assign", - "return_type": "void", - "arguments": [ - ["godot_pool_int_array_read_access *", "p_read"], - ["godot_pool_int_array_read_access *", "p_other"] - ] - }, - { - "name": "godot_pool_int_array_read_access_destroy", - "return_type": "void", - "arguments": [ - ["godot_pool_int_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_real_array_read_access_copy", - "return_type": "godot_pool_real_array_read_access *", - "arguments": [ - ["const godot_pool_real_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_real_array_read_access_ptr", - "return_type": "const godot_real *", - "arguments": [ - ["const godot_pool_real_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_real_array_read_access_operator_assign", - "return_type": "void", - "arguments": [ - ["godot_pool_real_array_read_access *", "p_read"], - ["godot_pool_real_array_read_access *", "p_other"] - ] - }, - { - "name": "godot_pool_real_array_read_access_destroy", - "return_type": "void", - "arguments": [ - ["godot_pool_real_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_string_array_read_access_copy", - "return_type": "godot_pool_string_array_read_access *", - "arguments": [ - ["const godot_pool_string_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_string_array_read_access_ptr", - "return_type": "const godot_string *", - "arguments": [ - ["const godot_pool_string_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_string_array_read_access_operator_assign", - "return_type": "void", - "arguments": [ - ["godot_pool_string_array_read_access *", "p_read"], - ["godot_pool_string_array_read_access *", "p_other"] - ] - }, - { - "name": "godot_pool_string_array_read_access_destroy", - "return_type": "void", - "arguments": [ - ["godot_pool_string_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_vector2_array_read_access_copy", - "return_type": "godot_pool_vector2_array_read_access *", - "arguments": [ - ["const godot_pool_vector2_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_vector2_array_read_access_ptr", - "return_type": "const godot_vector2 *", - "arguments": [ - ["const godot_pool_vector2_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_vector2_array_read_access_operator_assign", - "return_type": "void", - "arguments": [ - ["godot_pool_vector2_array_read_access *", "p_read"], - ["godot_pool_vector2_array_read_access *", "p_other"] - ] - }, - { - "name": "godot_pool_vector2_array_read_access_destroy", - "return_type": "void", - "arguments": [ - ["godot_pool_vector2_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_vector3_array_read_access_copy", - "return_type": "godot_pool_vector3_array_read_access *", - "arguments": [ - ["const godot_pool_vector3_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_vector3_array_read_access_ptr", - "return_type": "const godot_vector3 *", - "arguments": [ - ["const godot_pool_vector3_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_vector3_array_read_access_operator_assign", - "return_type": "void", - "arguments": [ - ["godot_pool_vector3_array_read_access *", "p_read"], - ["godot_pool_vector3_array_read_access *", "p_other"] - ] - }, - { - "name": "godot_pool_vector3_array_read_access_destroy", - "return_type": "void", - "arguments": [ - ["godot_pool_vector3_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_color_array_read_access_copy", - "return_type": "godot_pool_color_array_read_access *", - "arguments": [ - ["const godot_pool_color_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_color_array_read_access_ptr", - "return_type": "const godot_color *", - "arguments": [ - ["const godot_pool_color_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_color_array_read_access_operator_assign", - "return_type": "void", - "arguments": [ - ["godot_pool_color_array_read_access *", "p_read"], - ["godot_pool_color_array_read_access *", "p_other"] - ] - }, - { - "name": "godot_pool_color_array_read_access_destroy", - "return_type": "void", - "arguments": [ - ["godot_pool_color_array_read_access *", "p_read"] - ] - }, - { - "name": "godot_pool_byte_array_write_access_copy", - "return_type": "godot_pool_byte_array_write_access *", - "arguments": [ - ["const godot_pool_byte_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_byte_array_write_access_ptr", - "return_type": "uint8_t *", - "arguments": [ - ["const godot_pool_byte_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_byte_array_write_access_operator_assign", - "return_type": "void", - "arguments": [ - ["godot_pool_byte_array_write_access *", "p_write"], - ["godot_pool_byte_array_write_access *", "p_other"] - ] - }, - { - "name": "godot_pool_byte_array_write_access_destroy", - "return_type": "void", - "arguments": [ - ["godot_pool_byte_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_int_array_write_access_copy", - "return_type": "godot_pool_int_array_write_access *", - "arguments": [ - ["const godot_pool_int_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_int_array_write_access_ptr", - "return_type": "godot_int *", - "arguments": [ - ["const godot_pool_int_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_int_array_write_access_operator_assign", - "return_type": "void", - "arguments": [ - ["godot_pool_int_array_write_access *", "p_write"], - ["godot_pool_int_array_write_access *", "p_other"] - ] - }, - { - "name": "godot_pool_int_array_write_access_destroy", - "return_type": "void", - "arguments": [ - ["godot_pool_int_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_real_array_write_access_copy", - "return_type": "godot_pool_real_array_write_access *", - "arguments": [ - ["const godot_pool_real_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_real_array_write_access_ptr", - "return_type": "godot_real *", - "arguments": [ - ["const godot_pool_real_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_real_array_write_access_operator_assign", - "return_type": "void", - "arguments": [ - ["godot_pool_real_array_write_access *", "p_write"], - ["godot_pool_real_array_write_access *", "p_other"] - ] - }, - { - "name": "godot_pool_real_array_write_access_destroy", - "return_type": "void", - "arguments": [ - ["godot_pool_real_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_string_array_write_access_copy", - "return_type": "godot_pool_string_array_write_access *", - "arguments": [ - ["const godot_pool_string_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_string_array_write_access_ptr", - "return_type": "godot_string *", - "arguments": [ - ["const godot_pool_string_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_string_array_write_access_operator_assign", - "return_type": "void", - "arguments": [ - ["godot_pool_string_array_write_access *", "p_write"], - ["godot_pool_string_array_write_access *", "p_other"] - ] - }, - { - "name": "godot_pool_string_array_write_access_destroy", - "return_type": "void", - "arguments": [ - ["godot_pool_string_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_vector2_array_write_access_copy", - "return_type": "godot_pool_vector2_array_write_access *", - "arguments": [ - ["const godot_pool_vector2_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_vector2_array_write_access_ptr", - "return_type": "godot_vector2 *", - "arguments": [ - ["const godot_pool_vector2_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_vector2_array_write_access_operator_assign", - "return_type": "void", - "arguments": [ - ["godot_pool_vector2_array_write_access *", "p_write"], - ["godot_pool_vector2_array_write_access *", "p_other"] - ] - }, - { - "name": "godot_pool_vector2_array_write_access_destroy", - "return_type": "void", - "arguments": [ - ["godot_pool_vector2_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_vector3_array_write_access_copy", - "return_type": "godot_pool_vector3_array_write_access *", - "arguments": [ - ["const godot_pool_vector3_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_vector3_array_write_access_ptr", - "return_type": "godot_vector3 *", - "arguments": [ - ["const godot_pool_vector3_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_vector3_array_write_access_operator_assign", - "return_type": "void", - "arguments": [ - ["godot_pool_vector3_array_write_access *", "p_write"], - ["godot_pool_vector3_array_write_access *", "p_other"] - ] - }, - { - "name": "godot_pool_vector3_array_write_access_destroy", - "return_type": "void", - "arguments": [ - ["godot_pool_vector3_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_color_array_write_access_copy", - "return_type": "godot_pool_color_array_write_access *", - "arguments": [ - ["const godot_pool_color_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_color_array_write_access_ptr", - "return_type": "godot_color *", - "arguments": [ - ["const godot_pool_color_array_write_access *", "p_write"] - ] - }, - { - "name": "godot_pool_color_array_write_access_operator_assign", - "return_type": "void", - "arguments": [ - ["godot_pool_color_array_write_access *", "p_write"], - ["godot_pool_color_array_write_access *", "p_other"] + ["const godot_packed_color_array *", "p_self"] ] }, { - "name": "godot_pool_color_array_write_access_destroy", + "name": "godot_packed_color_array_destroy", "return_type": "void", "arguments": [ - ["godot_pool_color_array_write_access *", "p_write"] + ["godot_packed_color_array *", "p_self"] ] }, { @@ -2946,59 +2442,59 @@ ] }, { - "name": "godot_array_new_pool_color_array", + "name": "godot_array_new_packed_color_array", "return_type": "void", "arguments": [ ["godot_array *", "r_dest"], - ["const godot_pool_color_array *", "p_pca"] + ["const godot_packed_color_array *", "p_pca"] ] }, { - "name": "godot_array_new_pool_vector3_array", + "name": "godot_array_new_packed_vector3_array", "return_type": "void", "arguments": [ ["godot_array *", "r_dest"], - ["const godot_pool_vector3_array *", "p_pv3a"] + ["const godot_packed_vector3_array *", "p_pv3a"] ] }, { - "name": "godot_array_new_pool_vector2_array", + "name": "godot_array_new_packed_vector2_array", "return_type": "void", "arguments": [ ["godot_array *", "r_dest"], - ["const godot_pool_vector2_array *", "p_pv2a"] + ["const godot_packed_vector2_array *", "p_pv2a"] ] }, { - "name": "godot_array_new_pool_string_array", + "name": "godot_array_new_packed_string_array", "return_type": "void", "arguments": [ ["godot_array *", "r_dest"], - ["const godot_pool_string_array *", "p_psa"] + ["const godot_packed_string_array *", "p_psa"] ] }, { - "name": "godot_array_new_pool_real_array", + "name": "godot_array_new_packed_real_array", "return_type": "void", "arguments": [ ["godot_array *", "r_dest"], - ["const godot_pool_real_array *", "p_pra"] + ["const godot_packed_real_array *", "p_pra"] ] }, { - "name": "godot_array_new_pool_int_array", + "name": "godot_array_new_packed_int_array", "return_type": "void", "arguments": [ ["godot_array *", "r_dest"], - ["const godot_pool_int_array *", "p_pia"] + ["const godot_packed_int_array *", "p_pia"] ] }, { - "name": "godot_array_new_pool_byte_array", + "name": "godot_array_new_packed_byte_array", "return_type": "void", "arguments": [ ["godot_array *", "r_dest"], - ["const godot_pool_byte_array *", "p_pba"] + ["const godot_packed_byte_array *", "p_pba"] ] }, { @@ -4555,59 +4051,59 @@ ] }, { - "name": "godot_variant_new_pool_byte_array", + "name": "godot_variant_new_packed_byte_array", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], - ["const godot_pool_byte_array *", "p_pba"] + ["const godot_packed_byte_array *", "p_pba"] ] }, { - "name": "godot_variant_new_pool_int_array", + "name": "godot_variant_new_packed_int_array", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], - ["const godot_pool_int_array *", "p_pia"] + ["const godot_packed_int_array *", "p_pia"] ] }, { - "name": "godot_variant_new_pool_real_array", + "name": "godot_variant_new_packed_real_array", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], - ["const godot_pool_real_array *", "p_pra"] + ["const godot_packed_real_array *", "p_pra"] ] }, { - "name": "godot_variant_new_pool_string_array", + "name": "godot_variant_new_packed_string_array", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], - ["const godot_pool_string_array *", "p_psa"] + ["const godot_packed_string_array *", "p_psa"] ] }, { - "name": "godot_variant_new_pool_vector2_array", + "name": "godot_variant_new_packed_vector2_array", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], - ["const godot_pool_vector2_array *", "p_pv2a"] + ["const godot_packed_vector2_array *", "p_pv2a"] ] }, { - "name": "godot_variant_new_pool_vector3_array", + "name": "godot_variant_new_packed_vector3_array", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], - ["const godot_pool_vector3_array *", "p_pv3a"] + ["const godot_packed_vector3_array *", "p_pv3a"] ] }, { - "name": "godot_variant_new_pool_color_array", + "name": "godot_variant_new_packed_color_array", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], - ["const godot_pool_color_array *", "p_pca"] + ["const godot_packed_color_array *", "p_pca"] ] }, { @@ -4751,50 +4247,50 @@ ] }, { - "name": "godot_variant_as_pool_byte_array", - "return_type": "godot_pool_byte_array", + "name": "godot_variant_as_packed_byte_array", + "return_type": "godot_packed_byte_array", "arguments": [ ["const godot_variant *", "p_self"] ] }, { - "name": "godot_variant_as_pool_int_array", - "return_type": "godot_pool_int_array", + "name": "godot_variant_as_packed_int_array", + "return_type": "godot_packed_int_array", "arguments": [ ["const godot_variant *", "p_self"] ] }, { - "name": "godot_variant_as_pool_real_array", - "return_type": "godot_pool_real_array", + "name": "godot_variant_as_packed_real_array", + "return_type": "godot_packed_real_array", "arguments": [ ["const godot_variant *", "p_self"] ] }, { - "name": "godot_variant_as_pool_string_array", - "return_type": "godot_pool_string_array", + "name": "godot_variant_as_packed_string_array", + "return_type": "godot_packed_string_array", "arguments": [ ["const godot_variant *", "p_self"] ] }, { - "name": "godot_variant_as_pool_vector2_array", - "return_type": "godot_pool_vector2_array", + "name": "godot_variant_as_packed_vector2_array", + "return_type": "godot_packed_vector2_array", "arguments": [ ["const godot_variant *", "p_self"] ] }, { - "name": "godot_variant_as_pool_vector3_array", - "return_type": "godot_pool_vector3_array", + "name": "godot_variant_as_packed_vector3_array", + "return_type": "godot_packed_vector3_array", "arguments": [ ["const godot_variant *", "p_self"] ] }, { - "name": "godot_variant_as_pool_color_array", - "return_type": "godot_pool_color_array", + "name": "godot_variant_as_packed_color_array", + "return_type": "godot_packed_color_array", "arguments": [ ["const godot_variant *", "p_self"] ] @@ -5782,7 +5278,7 @@ }, { "name": "godot_string_md5_buffer", - "return_type": "godot_pool_byte_array", + "return_type": "godot_packed_byte_array", "arguments": [ ["const godot_string *", "p_self"] ] @@ -5796,7 +5292,7 @@ }, { "name": "godot_string_sha256_buffer", - "return_type": "godot_pool_byte_array", + "return_type": "godot_packed_byte_array", "arguments": [ ["const godot_string *", "p_self"] ] diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp index 5ffab0f80e..a30b438e6f 100644 --- a/modules/gdnative/gdnative_library_editor_plugin.cpp +++ b/modules/gdnative/gdnative_library_editor_plugin.cpp @@ -168,7 +168,7 @@ void GDNativeLibraryEditor::_on_library_selected(const String &file) { _set_target_value(file_dialog->get_meta("section"), file_dialog->get_meta("target"), file); } -void GDNativeLibraryEditor::_on_dependencies_selected(const PoolStringArray &files) { +void GDNativeLibraryEditor::_on_dependencies_selected(const PackedStringArray &files) { _set_target_value(file_dialog->get_meta("section"), file_dialog->get_meta("target"), files); } diff --git a/modules/gdnative/gdnative_library_editor_plugin.h b/modules/gdnative/gdnative_library_editor_plugin.h index 7b59aaac38..b1274d08b3 100644 --- a/modules/gdnative/gdnative_library_editor_plugin.h +++ b/modules/gdnative/gdnative_library_editor_plugin.h @@ -77,7 +77,7 @@ protected: void _update_tree(); void _on_item_button(Object *item, int column, int id); void _on_library_selected(const String &file); - void _on_dependencies_selected(const PoolStringArray &files); + void _on_dependencies_selected(const PackedStringArray &files); void _on_filter_selected(int id); void _on_item_collapsed(Object *p_item); void _on_item_activated(); diff --git a/modules/gdnative/include/gdnative/array.h b/modules/gdnative/include/gdnative/array.h index 36b5c77875..e3114e9348 100644 --- a/modules/gdnative/include/gdnative/array.h +++ b/modules/gdnative/include/gdnative/array.h @@ -62,13 +62,13 @@ extern "C" { void GDAPI godot_array_new(godot_array *r_dest); void GDAPI godot_array_new_copy(godot_array *r_dest, const godot_array *p_src); -void GDAPI godot_array_new_pool_color_array(godot_array *r_dest, const godot_pool_color_array *p_pca); -void GDAPI godot_array_new_pool_vector3_array(godot_array *r_dest, const godot_pool_vector3_array *p_pv3a); -void GDAPI godot_array_new_pool_vector2_array(godot_array *r_dest, const godot_pool_vector2_array *p_pv2a); -void GDAPI godot_array_new_pool_string_array(godot_array *r_dest, const godot_pool_string_array *p_psa); -void GDAPI godot_array_new_pool_real_array(godot_array *r_dest, const godot_pool_real_array *p_pra); -void GDAPI godot_array_new_pool_int_array(godot_array *r_dest, const godot_pool_int_array *p_pia); -void GDAPI godot_array_new_pool_byte_array(godot_array *r_dest, const godot_pool_byte_array *p_pba); +void GDAPI godot_array_new_packed_color_array(godot_array *r_dest, const godot_packed_color_array *p_pca); +void GDAPI godot_array_new_packed_vector3_array(godot_array *r_dest, const godot_packed_vector3_array *p_pv3a); +void GDAPI godot_array_new_packed_vector2_array(godot_array *r_dest, const godot_packed_vector2_array *p_pv2a); +void GDAPI godot_array_new_packed_string_array(godot_array *r_dest, const godot_packed_string_array *p_psa); +void GDAPI godot_array_new_packed_real_array(godot_array *r_dest, const godot_packed_real_array *p_pra); +void GDAPI godot_array_new_packed_int_array(godot_array *r_dest, const godot_packed_int_array *p_pia); +void GDAPI godot_array_new_packed_byte_array(godot_array *r_dest, const godot_packed_byte_array *p_pba); void GDAPI godot_array_set(godot_array *p_self, const godot_int p_idx, const godot_variant *p_value); diff --git a/modules/gdnative/include/gdnative/pool_arrays.h b/modules/gdnative/include/gdnative/pool_arrays.h index 7d51b3cd5c..315fb7ada2 100644 --- a/modules/gdnative/include/gdnative/pool_arrays.h +++ b/modules/gdnative/include/gdnative/pool_arrays.h @@ -37,113 +37,81 @@ extern "C" { #include <stdint.h> -/////// Read Access +/////// PackedByteArray -#define GODOT_POOL_ARRAY_READ_ACCESS_SIZE 1 +#define GODOT_PACKED_BYTE_ARRAY_SIZE sizeof(void *) +#ifndef GODOT_CORE_API_GODOT_PACKED_BYTE_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_PACKED_BYTE_ARRAY_TYPE_DEFINED typedef struct { - uint8_t _dont_touch_that[GODOT_POOL_ARRAY_READ_ACCESS_SIZE]; -} godot_pool_array_read_access; - -typedef godot_pool_array_read_access godot_pool_byte_array_read_access; -typedef godot_pool_array_read_access godot_pool_int_array_read_access; -typedef godot_pool_array_read_access godot_pool_real_array_read_access; -typedef godot_pool_array_read_access godot_pool_string_array_read_access; -typedef godot_pool_array_read_access godot_pool_vector2_array_read_access; -typedef godot_pool_array_read_access godot_pool_vector3_array_read_access; -typedef godot_pool_array_read_access godot_pool_color_array_read_access; - -/////// Write Access - -#define GODOT_POOL_ARRAY_WRITE_ACCESS_SIZE 1 - -typedef struct { - uint8_t _dont_touch_that[GODOT_POOL_ARRAY_WRITE_ACCESS_SIZE]; -} godot_pool_array_write_access; - -typedef godot_pool_array_write_access godot_pool_byte_array_write_access; -typedef godot_pool_array_write_access godot_pool_int_array_write_access; -typedef godot_pool_array_write_access godot_pool_real_array_write_access; -typedef godot_pool_array_write_access godot_pool_string_array_write_access; -typedef godot_pool_array_write_access godot_pool_vector2_array_write_access; -typedef godot_pool_array_write_access godot_pool_vector3_array_write_access; -typedef godot_pool_array_write_access godot_pool_color_array_write_access; - -/////// PoolByteArray - -#define GODOT_POOL_BYTE_ARRAY_SIZE sizeof(void *) - -#ifndef GODOT_CORE_API_GODOT_POOL_BYTE_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_POOL_BYTE_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_POOL_BYTE_ARRAY_SIZE]; -} godot_pool_byte_array; + uint8_t _dont_touch_that[GODOT_PACKED_BYTE_ARRAY_SIZE]; +} godot_packed_byte_array; #endif -/////// PoolIntArray +/////// PackedIntArray -#define GODOT_POOL_INT_ARRAY_SIZE sizeof(void *) +#define GODOT_PACKED_INT_ARRAY_SIZE sizeof(void *) -#ifndef GODOT_CORE_API_GODOT_POOL_INT_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_POOL_INT_ARRAY_TYPE_DEFINED +#ifndef GODOT_CORE_API_GODOT_PACKED_INT_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_PACKED_INT_ARRAY_TYPE_DEFINED typedef struct { - uint8_t _dont_touch_that[GODOT_POOL_INT_ARRAY_SIZE]; -} godot_pool_int_array; + uint8_t _dont_touch_that[GODOT_PACKED_INT_ARRAY_SIZE]; +} godot_packed_int_array; #endif -/////// PoolRealArray +/////// PackedRealArray -#define GODOT_POOL_REAL_ARRAY_SIZE sizeof(void *) +#define GODOT_PACKED_REAL_ARRAY_SIZE sizeof(void *) -#ifndef GODOT_CORE_API_GODOT_POOL_REAL_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_POOL_REAL_ARRAY_TYPE_DEFINED +#ifndef GODOT_CORE_API_GODOT_PACKED_REAL_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_PACKED_REAL_ARRAY_TYPE_DEFINED typedef struct { - uint8_t _dont_touch_that[GODOT_POOL_REAL_ARRAY_SIZE]; -} godot_pool_real_array; + uint8_t _dont_touch_that[GODOT_PACKED_REAL_ARRAY_SIZE]; +} godot_packed_real_array; #endif -/////// PoolStringArray +/////// PackedStringArray -#define GODOT_POOL_STRING_ARRAY_SIZE sizeof(void *) +#define GODOT_PACKED_STRING_ARRAY_SIZE sizeof(void *) -#ifndef GODOT_CORE_API_GODOT_POOL_STRING_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_POOL_STRING_ARRAY_TYPE_DEFINED +#ifndef GODOT_CORE_API_GODOT_PACKED_STRING_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_PACKED_STRING_ARRAY_TYPE_DEFINED typedef struct { - uint8_t _dont_touch_that[GODOT_POOL_STRING_ARRAY_SIZE]; -} godot_pool_string_array; + uint8_t _dont_touch_that[GODOT_PACKED_STRING_ARRAY_SIZE]; +} godot_packed_string_array; #endif -/////// PoolVector2Array +/////// PackedVector2Array -#define GODOT_POOL_VECTOR2_ARRAY_SIZE sizeof(void *) +#define GODOT_PACKED_VECTOR2_ARRAY_SIZE sizeof(void *) -#ifndef GODOT_CORE_API_GODOT_POOL_VECTOR2_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_POOL_VECTOR2_ARRAY_TYPE_DEFINED +#ifndef GODOT_CORE_API_GODOT_PACKED_VECTOR2_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_PACKED_VECTOR2_ARRAY_TYPE_DEFINED typedef struct { - uint8_t _dont_touch_that[GODOT_POOL_VECTOR2_ARRAY_SIZE]; -} godot_pool_vector2_array; + uint8_t _dont_touch_that[GODOT_PACKED_VECTOR2_ARRAY_SIZE]; +} godot_packed_vector2_array; #endif -/////// PoolVector3Array +/////// PackedVector3Array -#define GODOT_POOL_VECTOR3_ARRAY_SIZE sizeof(void *) +#define GODOT_PACKED_VECTOR3_ARRAY_SIZE sizeof(void *) -#ifndef GODOT_CORE_API_GODOT_POOL_VECTOR3_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_POOL_VECTOR3_ARRAY_TYPE_DEFINED +#ifndef GODOT_CORE_API_GODOT_PACKED_VECTOR3_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_PACKED_VECTOR3_ARRAY_TYPE_DEFINED typedef struct { - uint8_t _dont_touch_that[GODOT_POOL_VECTOR3_ARRAY_SIZE]; -} godot_pool_vector3_array; + uint8_t _dont_touch_that[GODOT_PACKED_VECTOR3_ARRAY_SIZE]; +} godot_packed_vector3_array; #endif -/////// PoolColorArray +/////// PackedColorArray -#define GODOT_POOL_COLOR_ARRAY_SIZE sizeof(void *) +#define GODOT_PACKED_COLOR_ARRAY_SIZE sizeof(void *) -#ifndef GODOT_CORE_API_GODOT_POOL_COLOR_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_POOL_COLOR_ARRAY_TYPE_DEFINED +#ifndef GODOT_CORE_API_GODOT_PACKED_COLOR_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_PACKED_COLOR_ARRAY_TYPE_DEFINED typedef struct { - uint8_t _dont_touch_that[GODOT_POOL_COLOR_ARRAY_SIZE]; -} godot_pool_color_array; + uint8_t _dont_touch_that[GODOT_PACKED_COLOR_ARRAY_SIZE]; +} godot_packed_color_array; #endif // reduce extern "C" nesting for VS2013 @@ -164,312 +132,206 @@ extern "C" { // byte -void GDAPI godot_pool_byte_array_new(godot_pool_byte_array *r_dest); -void GDAPI godot_pool_byte_array_new_copy(godot_pool_byte_array *r_dest, const godot_pool_byte_array *p_src); -void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *r_dest, const godot_array *p_a); +void GDAPI godot_packed_byte_array_new(godot_packed_byte_array *r_dest); +void GDAPI godot_packed_byte_array_new_copy(godot_packed_byte_array *r_dest, const godot_packed_byte_array *p_src); +void GDAPI godot_packed_byte_array_new_with_array(godot_packed_byte_array *r_dest, const godot_array *p_a); -void GDAPI godot_pool_byte_array_append(godot_pool_byte_array *p_self, const uint8_t p_data); +void GDAPI godot_packed_byte_array_append(godot_packed_byte_array *p_self, const uint8_t p_data); -void GDAPI godot_pool_byte_array_append_array(godot_pool_byte_array *p_self, const godot_pool_byte_array *p_array); +void GDAPI godot_packed_byte_array_append_array(godot_packed_byte_array *p_self, const godot_packed_byte_array *p_array); -godot_error GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data); +godot_error GDAPI godot_packed_byte_array_insert(godot_packed_byte_array *p_self, const godot_int p_idx, const uint8_t p_data); -void GDAPI godot_pool_byte_array_invert(godot_pool_byte_array *p_self); +void GDAPI godot_packed_byte_array_invert(godot_packed_byte_array *p_self); -void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_self, const uint8_t p_data); +void GDAPI godot_packed_byte_array_push_back(godot_packed_byte_array *p_self, const uint8_t p_data); -void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_self, const godot_int p_idx); +void GDAPI godot_packed_byte_array_remove(godot_packed_byte_array *p_self, const godot_int p_idx); -void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_self, const godot_int p_size); +void GDAPI godot_packed_byte_array_resize(godot_packed_byte_array *p_self, const godot_int p_size); -godot_pool_byte_array_read_access GDAPI *godot_pool_byte_array_read(const godot_pool_byte_array *p_self); +void GDAPI godot_packed_byte_array_set(godot_packed_byte_array *p_self, const godot_int p_idx, const uint8_t p_data); +uint8_t GDAPI godot_packed_byte_array_get(const godot_packed_byte_array *p_self, const godot_int p_idx); -godot_pool_byte_array_write_access GDAPI *godot_pool_byte_array_write(godot_pool_byte_array *p_self); +godot_int GDAPI godot_packed_byte_array_size(const godot_packed_byte_array *p_self); -void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data); -uint8_t GDAPI godot_pool_byte_array_get(const godot_pool_byte_array *p_self, const godot_int p_idx); +godot_bool GDAPI godot_packed_byte_array_empty(const godot_packed_byte_array *p_self); -godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_self); - -godot_bool GDAPI godot_pool_byte_array_empty(const godot_pool_byte_array *p_self); - -void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_self); +void GDAPI godot_packed_byte_array_destroy(godot_packed_byte_array *p_self); // int -void GDAPI godot_pool_int_array_new(godot_pool_int_array *r_dest); -void GDAPI godot_pool_int_array_new_copy(godot_pool_int_array *r_dest, const godot_pool_int_array *p_src); -void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *r_dest, const godot_array *p_a); - -void GDAPI godot_pool_int_array_append(godot_pool_int_array *p_self, const godot_int p_data); +void GDAPI godot_packed_int_array_new(godot_packed_int_array *r_dest); +void GDAPI godot_packed_int_array_new_copy(godot_packed_int_array *r_dest, const godot_packed_int_array *p_src); +void GDAPI godot_packed_int_array_new_with_array(godot_packed_int_array *r_dest, const godot_array *p_a); -void GDAPI godot_pool_int_array_append_array(godot_pool_int_array *p_self, const godot_pool_int_array *p_array); +void GDAPI godot_packed_int_array_append(godot_packed_int_array *p_self, const godot_int p_data); -godot_error GDAPI godot_pool_int_array_insert(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data); +void GDAPI godot_packed_int_array_append_array(godot_packed_int_array *p_self, const godot_packed_int_array *p_array); -void GDAPI godot_pool_int_array_invert(godot_pool_int_array *p_self); +godot_error GDAPI godot_packed_int_array_insert(godot_packed_int_array *p_self, const godot_int p_idx, const godot_int p_data); -void GDAPI godot_pool_int_array_push_back(godot_pool_int_array *p_self, const godot_int p_data); +void GDAPI godot_packed_int_array_invert(godot_packed_int_array *p_self); -void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_self, const godot_int p_idx); +void GDAPI godot_packed_int_array_push_back(godot_packed_int_array *p_self, const godot_int p_data); -void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_self, const godot_int p_size); +void GDAPI godot_packed_int_array_remove(godot_packed_int_array *p_self, const godot_int p_idx); -godot_pool_int_array_read_access GDAPI *godot_pool_int_array_read(const godot_pool_int_array *p_self); +void GDAPI godot_packed_int_array_resize(godot_packed_int_array *p_self, const godot_int p_size); -godot_pool_int_array_write_access GDAPI *godot_pool_int_array_write(godot_pool_int_array *p_self); +void GDAPI godot_packed_int_array_set(godot_packed_int_array *p_self, const godot_int p_idx, const godot_int p_data); +godot_int GDAPI godot_packed_int_array_get(const godot_packed_int_array *p_self, const godot_int p_idx); -void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data); -godot_int GDAPI godot_pool_int_array_get(const godot_pool_int_array *p_self, const godot_int p_idx); +godot_int GDAPI godot_packed_int_array_size(const godot_packed_int_array *p_self); -godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_self); +godot_bool GDAPI godot_packed_int_array_empty(const godot_packed_int_array *p_self); -godot_bool GDAPI godot_pool_int_array_empty(const godot_pool_int_array *p_self); - -void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_self); +void GDAPI godot_packed_int_array_destroy(godot_packed_int_array *p_self); // real -void GDAPI godot_pool_real_array_new(godot_pool_real_array *r_dest); -void GDAPI godot_pool_real_array_new_copy(godot_pool_real_array *r_dest, const godot_pool_real_array *p_src); -void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *r_dest, const godot_array *p_a); - -void GDAPI godot_pool_real_array_append(godot_pool_real_array *p_self, const godot_real p_data); +void GDAPI godot_packed_real_array_new(godot_packed_real_array *r_dest); +void GDAPI godot_packed_real_array_new_copy(godot_packed_real_array *r_dest, const godot_packed_real_array *p_src); +void GDAPI godot_packed_real_array_new_with_array(godot_packed_real_array *r_dest, const godot_array *p_a); -void GDAPI godot_pool_real_array_append_array(godot_pool_real_array *p_self, const godot_pool_real_array *p_array); +void GDAPI godot_packed_real_array_append(godot_packed_real_array *p_self, const godot_real p_data); -godot_error GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data); +void GDAPI godot_packed_real_array_append_array(godot_packed_real_array *p_self, const godot_packed_real_array *p_array); -void GDAPI godot_pool_real_array_invert(godot_pool_real_array *p_self); +godot_error GDAPI godot_packed_real_array_insert(godot_packed_real_array *p_self, const godot_int p_idx, const godot_real p_data); -void GDAPI godot_pool_real_array_push_back(godot_pool_real_array *p_self, const godot_real p_data); +void GDAPI godot_packed_real_array_invert(godot_packed_real_array *p_self); -void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_self, const godot_int p_idx); +void GDAPI godot_packed_real_array_push_back(godot_packed_real_array *p_self, const godot_real p_data); -void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_self, const godot_int p_size); +void GDAPI godot_packed_real_array_remove(godot_packed_real_array *p_self, const godot_int p_idx); -godot_pool_real_array_read_access GDAPI *godot_pool_real_array_read(const godot_pool_real_array *p_self); +void GDAPI godot_packed_real_array_resize(godot_packed_real_array *p_self, const godot_int p_size); -godot_pool_real_array_write_access GDAPI *godot_pool_real_array_write(godot_pool_real_array *p_self); +void GDAPI godot_packed_real_array_set(godot_packed_real_array *p_self, const godot_int p_idx, const godot_real p_data); +godot_real GDAPI godot_packed_real_array_get(const godot_packed_real_array *p_self, const godot_int p_idx); -void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data); -godot_real GDAPI godot_pool_real_array_get(const godot_pool_real_array *p_self, const godot_int p_idx); +godot_int GDAPI godot_packed_real_array_size(const godot_packed_real_array *p_self); -godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_self); +godot_bool GDAPI godot_packed_real_array_empty(const godot_packed_real_array *p_self); -godot_bool GDAPI godot_pool_real_array_empty(const godot_pool_real_array *p_self); - -void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_self); +void GDAPI godot_packed_real_array_destroy(godot_packed_real_array *p_self); // string -void GDAPI godot_pool_string_array_new(godot_pool_string_array *r_dest); -void GDAPI godot_pool_string_array_new_copy(godot_pool_string_array *r_dest, const godot_pool_string_array *p_src); -void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *r_dest, const godot_array *p_a); - -void GDAPI godot_pool_string_array_append(godot_pool_string_array *p_self, const godot_string *p_data); - -void GDAPI godot_pool_string_array_append_array(godot_pool_string_array *p_self, const godot_pool_string_array *p_array); +void GDAPI godot_packed_string_array_new(godot_packed_string_array *r_dest); +void GDAPI godot_packed_string_array_new_copy(godot_packed_string_array *r_dest, const godot_packed_string_array *p_src); +void GDAPI godot_packed_string_array_new_with_array(godot_packed_string_array *r_dest, const godot_array *p_a); -godot_error GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data); +void GDAPI godot_packed_string_array_append(godot_packed_string_array *p_self, const godot_string *p_data); -void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_self); +void GDAPI godot_packed_string_array_append_array(godot_packed_string_array *p_self, const godot_packed_string_array *p_array); -void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_self, const godot_string *p_data); +godot_error GDAPI godot_packed_string_array_insert(godot_packed_string_array *p_self, const godot_int p_idx, const godot_string *p_data); -void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_self, const godot_int p_idx); +void GDAPI godot_packed_string_array_invert(godot_packed_string_array *p_self); -void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_self, const godot_int p_size); +void GDAPI godot_packed_string_array_push_back(godot_packed_string_array *p_self, const godot_string *p_data); -godot_pool_string_array_read_access GDAPI *godot_pool_string_array_read(const godot_pool_string_array *p_self); +void GDAPI godot_packed_string_array_remove(godot_packed_string_array *p_self, const godot_int p_idx); -godot_pool_string_array_write_access GDAPI *godot_pool_string_array_write(godot_pool_string_array *p_self); +void GDAPI godot_packed_string_array_resize(godot_packed_string_array *p_self, const godot_int p_size); -void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data); -godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_self, const godot_int p_idx); +void GDAPI godot_packed_string_array_set(godot_packed_string_array *p_self, const godot_int p_idx, const godot_string *p_data); +godot_string GDAPI godot_packed_string_array_get(const godot_packed_string_array *p_self, const godot_int p_idx); -godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_self); +godot_int GDAPI godot_packed_string_array_size(const godot_packed_string_array *p_self); -godot_bool GDAPI godot_pool_string_array_empty(const godot_pool_string_array *p_self); +godot_bool GDAPI godot_packed_string_array_empty(const godot_packed_string_array *p_self); -void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_self); +void GDAPI godot_packed_string_array_destroy(godot_packed_string_array *p_self); // vector2 -void GDAPI godot_pool_vector2_array_new(godot_pool_vector2_array *r_dest); -void GDAPI godot_pool_vector2_array_new_copy(godot_pool_vector2_array *r_dest, const godot_pool_vector2_array *p_src); -void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *r_dest, const godot_array *p_a); - -void GDAPI godot_pool_vector2_array_append(godot_pool_vector2_array *p_self, const godot_vector2 *p_data); - -void GDAPI godot_pool_vector2_array_append_array(godot_pool_vector2_array *p_self, const godot_pool_vector2_array *p_array); +void GDAPI godot_packed_vector2_array_new(godot_packed_vector2_array *r_dest); +void GDAPI godot_packed_vector2_array_new_copy(godot_packed_vector2_array *r_dest, const godot_packed_vector2_array *p_src); +void GDAPI godot_packed_vector2_array_new_with_array(godot_packed_vector2_array *r_dest, const godot_array *p_a); -godot_error GDAPI godot_pool_vector2_array_insert(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data); +void GDAPI godot_packed_vector2_array_append(godot_packed_vector2_array *p_self, const godot_vector2 *p_data); -void GDAPI godot_pool_vector2_array_invert(godot_pool_vector2_array *p_self); +void GDAPI godot_packed_vector2_array_append_array(godot_packed_vector2_array *p_self, const godot_packed_vector2_array *p_array); -void GDAPI godot_pool_vector2_array_push_back(godot_pool_vector2_array *p_self, const godot_vector2 *p_data); +godot_error GDAPI godot_packed_vector2_array_insert(godot_packed_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data); -void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_self, const godot_int p_idx); +void GDAPI godot_packed_vector2_array_invert(godot_packed_vector2_array *p_self); -void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_self, const godot_int p_size); +void GDAPI godot_packed_vector2_array_push_back(godot_packed_vector2_array *p_self, const godot_vector2 *p_data); -godot_pool_vector2_array_read_access GDAPI *godot_pool_vector2_array_read(const godot_pool_vector2_array *p_self); +void GDAPI godot_packed_vector2_array_remove(godot_packed_vector2_array *p_self, const godot_int p_idx); -godot_pool_vector2_array_write_access GDAPI *godot_pool_vector2_array_write(godot_pool_vector2_array *p_self); +void GDAPI godot_packed_vector2_array_resize(godot_packed_vector2_array *p_self, const godot_int p_size); -void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data); -godot_vector2 GDAPI godot_pool_vector2_array_get(const godot_pool_vector2_array *p_self, const godot_int p_idx); +void GDAPI godot_packed_vector2_array_set(godot_packed_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data); +godot_vector2 GDAPI godot_packed_vector2_array_get(const godot_packed_vector2_array *p_self, const godot_int p_idx); -godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_self); +godot_int GDAPI godot_packed_vector2_array_size(const godot_packed_vector2_array *p_self); -godot_bool GDAPI godot_pool_vector2_array_empty(const godot_pool_vector2_array *p_self); +godot_bool GDAPI godot_packed_vector2_array_empty(const godot_packed_vector2_array *p_self); -void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_self); +void GDAPI godot_packed_vector2_array_destroy(godot_packed_vector2_array *p_self); // vector3 -void GDAPI godot_pool_vector3_array_new(godot_pool_vector3_array *r_dest); -void GDAPI godot_pool_vector3_array_new_copy(godot_pool_vector3_array *r_dest, const godot_pool_vector3_array *p_src); -void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *r_dest, const godot_array *p_a); +void GDAPI godot_packed_vector3_array_new(godot_packed_vector3_array *r_dest); +void GDAPI godot_packed_vector3_array_new_copy(godot_packed_vector3_array *r_dest, const godot_packed_vector3_array *p_src); +void GDAPI godot_packed_vector3_array_new_with_array(godot_packed_vector3_array *r_dest, const godot_array *p_a); -void GDAPI godot_pool_vector3_array_append(godot_pool_vector3_array *p_self, const godot_vector3 *p_data); +void GDAPI godot_packed_vector3_array_append(godot_packed_vector3_array *p_self, const godot_vector3 *p_data); -void GDAPI godot_pool_vector3_array_append_array(godot_pool_vector3_array *p_self, const godot_pool_vector3_array *p_array); +void GDAPI godot_packed_vector3_array_append_array(godot_packed_vector3_array *p_self, const godot_packed_vector3_array *p_array); -godot_error GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data); +godot_error GDAPI godot_packed_vector3_array_insert(godot_packed_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data); -void GDAPI godot_pool_vector3_array_invert(godot_pool_vector3_array *p_self); +void GDAPI godot_packed_vector3_array_invert(godot_packed_vector3_array *p_self); -void GDAPI godot_pool_vector3_array_push_back(godot_pool_vector3_array *p_self, const godot_vector3 *p_data); +void GDAPI godot_packed_vector3_array_push_back(godot_packed_vector3_array *p_self, const godot_vector3 *p_data); -void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_self, const godot_int p_idx); +void GDAPI godot_packed_vector3_array_remove(godot_packed_vector3_array *p_self, const godot_int p_idx); -void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_self, const godot_int p_size); +void GDAPI godot_packed_vector3_array_resize(godot_packed_vector3_array *p_self, const godot_int p_size); -godot_pool_vector3_array_read_access GDAPI *godot_pool_vector3_array_read(const godot_pool_vector3_array *p_self); +void GDAPI godot_packed_vector3_array_set(godot_packed_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data); +godot_vector3 GDAPI godot_packed_vector3_array_get(const godot_packed_vector3_array *p_self, const godot_int p_idx); -godot_pool_vector3_array_write_access GDAPI *godot_pool_vector3_array_write(godot_pool_vector3_array *p_self); +godot_int GDAPI godot_packed_vector3_array_size(const godot_packed_vector3_array *p_self); -void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data); -godot_vector3 GDAPI godot_pool_vector3_array_get(const godot_pool_vector3_array *p_self, const godot_int p_idx); +godot_bool GDAPI godot_packed_vector3_array_empty(const godot_packed_vector3_array *p_self); -godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_self); - -godot_bool GDAPI godot_pool_vector3_array_empty(const godot_pool_vector3_array *p_self); - -void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_self); +void GDAPI godot_packed_vector3_array_destroy(godot_packed_vector3_array *p_self); // color -void GDAPI godot_pool_color_array_new(godot_pool_color_array *r_dest); -void GDAPI godot_pool_color_array_new_copy(godot_pool_color_array *r_dest, const godot_pool_color_array *p_src); -void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *r_dest, const godot_array *p_a); - -void GDAPI godot_pool_color_array_append(godot_pool_color_array *p_self, const godot_color *p_data); - -void GDAPI godot_pool_color_array_append_array(godot_pool_color_array *p_self, const godot_pool_color_array *p_array); - -godot_error GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data); - -void GDAPI godot_pool_color_array_invert(godot_pool_color_array *p_self); - -void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_self, const godot_color *p_data); - -void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_self, const godot_int p_idx); - -void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_self, const godot_int p_size); - -godot_pool_color_array_read_access GDAPI *godot_pool_color_array_read(const godot_pool_color_array *p_self); - -godot_pool_color_array_write_access GDAPI *godot_pool_color_array_write(godot_pool_color_array *p_self); - -void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data); -godot_color GDAPI godot_pool_color_array_get(const godot_pool_color_array *p_self, const godot_int p_idx); - -godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_self); - -godot_bool GDAPI godot_pool_color_array_empty(const godot_pool_color_array *p_self); - -void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self); - -// -// read accessor functions -// - -godot_pool_byte_array_read_access GDAPI *godot_pool_byte_array_read_access_copy(const godot_pool_byte_array_read_access *p_other); -const uint8_t GDAPI *godot_pool_byte_array_read_access_ptr(const godot_pool_byte_array_read_access *p_read); -void GDAPI godot_pool_byte_array_read_access_operator_assign(godot_pool_byte_array_read_access *p_read, godot_pool_byte_array_read_access *p_other); -void GDAPI godot_pool_byte_array_read_access_destroy(godot_pool_byte_array_read_access *p_read); - -godot_pool_int_array_read_access GDAPI *godot_pool_int_array_read_access_copy(const godot_pool_int_array_read_access *p_other); -const godot_int GDAPI *godot_pool_int_array_read_access_ptr(const godot_pool_int_array_read_access *p_read); -void GDAPI godot_pool_int_array_read_access_operator_assign(godot_pool_int_array_read_access *p_read, godot_pool_int_array_read_access *p_other); -void GDAPI godot_pool_int_array_read_access_destroy(godot_pool_int_array_read_access *p_read); - -godot_pool_real_array_read_access GDAPI *godot_pool_real_array_read_access_copy(const godot_pool_real_array_read_access *p_other); -const godot_real GDAPI *godot_pool_real_array_read_access_ptr(const godot_pool_real_array_read_access *p_read); -void GDAPI godot_pool_real_array_read_access_operator_assign(godot_pool_real_array_read_access *p_read, godot_pool_real_array_read_access *p_other); -void GDAPI godot_pool_real_array_read_access_destroy(godot_pool_real_array_read_access *p_read); - -godot_pool_string_array_read_access GDAPI *godot_pool_string_array_read_access_copy(const godot_pool_string_array_read_access *p_other); -const godot_string GDAPI *godot_pool_string_array_read_access_ptr(const godot_pool_string_array_read_access *p_read); -void GDAPI godot_pool_string_array_read_access_operator_assign(godot_pool_string_array_read_access *p_read, godot_pool_string_array_read_access *p_other); -void GDAPI godot_pool_string_array_read_access_destroy(godot_pool_string_array_read_access *p_read); +void GDAPI godot_packed_color_array_new(godot_packed_color_array *r_dest); +void GDAPI godot_packed_color_array_new_copy(godot_packed_color_array *r_dest, const godot_packed_color_array *p_src); +void GDAPI godot_packed_color_array_new_with_array(godot_packed_color_array *r_dest, const godot_array *p_a); -godot_pool_vector2_array_read_access GDAPI *godot_pool_vector2_array_read_access_copy(const godot_pool_vector2_array_read_access *p_other); -const godot_vector2 GDAPI *godot_pool_vector2_array_read_access_ptr(const godot_pool_vector2_array_read_access *p_read); -void GDAPI godot_pool_vector2_array_read_access_operator_assign(godot_pool_vector2_array_read_access *p_read, godot_pool_vector2_array_read_access *p_other); -void GDAPI godot_pool_vector2_array_read_access_destroy(godot_pool_vector2_array_read_access *p_read); +void GDAPI godot_packed_color_array_append(godot_packed_color_array *p_self, const godot_color *p_data); -godot_pool_vector3_array_read_access GDAPI *godot_pool_vector3_array_read_access_copy(const godot_pool_vector3_array_read_access *p_other); -const godot_vector3 GDAPI *godot_pool_vector3_array_read_access_ptr(const godot_pool_vector3_array_read_access *p_read); -void GDAPI godot_pool_vector3_array_read_access_operator_assign(godot_pool_vector3_array_read_access *p_read, godot_pool_vector3_array_read_access *p_other); -void GDAPI godot_pool_vector3_array_read_access_destroy(godot_pool_vector3_array_read_access *p_read); +void GDAPI godot_packed_color_array_append_array(godot_packed_color_array *p_self, const godot_packed_color_array *p_array); -godot_pool_color_array_read_access GDAPI *godot_pool_color_array_read_access_copy(const godot_pool_color_array_read_access *p_other); -const godot_color GDAPI *godot_pool_color_array_read_access_ptr(const godot_pool_color_array_read_access *p_read); -void GDAPI godot_pool_color_array_read_access_operator_assign(godot_pool_color_array_read_access *p_read, godot_pool_color_array_read_access *p_other); -void GDAPI godot_pool_color_array_read_access_destroy(godot_pool_color_array_read_access *p_read); +godot_error GDAPI godot_packed_color_array_insert(godot_packed_color_array *p_self, const godot_int p_idx, const godot_color *p_data); -// -// write accessor functions -// +void GDAPI godot_packed_color_array_invert(godot_packed_color_array *p_self); -godot_pool_byte_array_write_access GDAPI *godot_pool_byte_array_write_access_copy(const godot_pool_byte_array_write_access *p_other); -uint8_t GDAPI *godot_pool_byte_array_write_access_ptr(const godot_pool_byte_array_write_access *p_write); -void GDAPI godot_pool_byte_array_write_access_operator_assign(godot_pool_byte_array_write_access *p_write, godot_pool_byte_array_write_access *p_other); -void GDAPI godot_pool_byte_array_write_access_destroy(godot_pool_byte_array_write_access *p_write); +void GDAPI godot_packed_color_array_push_back(godot_packed_color_array *p_self, const godot_color *p_data); -godot_pool_int_array_write_access GDAPI *godot_pool_int_array_write_access_copy(const godot_pool_int_array_write_access *p_other); -godot_int GDAPI *godot_pool_int_array_write_access_ptr(const godot_pool_int_array_write_access *p_write); -void GDAPI godot_pool_int_array_write_access_operator_assign(godot_pool_int_array_write_access *p_write, godot_pool_int_array_write_access *p_other); -void GDAPI godot_pool_int_array_write_access_destroy(godot_pool_int_array_write_access *p_write); +void GDAPI godot_packed_color_array_remove(godot_packed_color_array *p_self, const godot_int p_idx); -godot_pool_real_array_write_access GDAPI *godot_pool_real_array_write_access_copy(const godot_pool_real_array_write_access *p_other); -godot_real GDAPI *godot_pool_real_array_write_access_ptr(const godot_pool_real_array_write_access *p_write); -void GDAPI godot_pool_real_array_write_access_operator_assign(godot_pool_real_array_write_access *p_write, godot_pool_real_array_write_access *p_other); -void GDAPI godot_pool_real_array_write_access_destroy(godot_pool_real_array_write_access *p_write); +void GDAPI godot_packed_color_array_resize(godot_packed_color_array *p_self, const godot_int p_size); -godot_pool_string_array_write_access GDAPI *godot_pool_string_array_write_access_copy(const godot_pool_string_array_write_access *p_other); -godot_string GDAPI *godot_pool_string_array_write_access_ptr(const godot_pool_string_array_write_access *p_write); -void GDAPI godot_pool_string_array_write_access_operator_assign(godot_pool_string_array_write_access *p_write, godot_pool_string_array_write_access *p_other); -void GDAPI godot_pool_string_array_write_access_destroy(godot_pool_string_array_write_access *p_write); +void GDAPI godot_packed_color_array_set(godot_packed_color_array *p_self, const godot_int p_idx, const godot_color *p_data); +godot_color GDAPI godot_packed_color_array_get(const godot_packed_color_array *p_self, const godot_int p_idx); -godot_pool_vector2_array_write_access GDAPI *godot_pool_vector2_array_write_access_copy(const godot_pool_vector2_array_write_access *p_other); -godot_vector2 GDAPI *godot_pool_vector2_array_write_access_ptr(const godot_pool_vector2_array_write_access *p_write); -void GDAPI godot_pool_vector2_array_write_access_operator_assign(godot_pool_vector2_array_write_access *p_write, godot_pool_vector2_array_write_access *p_other); -void GDAPI godot_pool_vector2_array_write_access_destroy(godot_pool_vector2_array_write_access *p_write); +godot_int GDAPI godot_packed_color_array_size(const godot_packed_color_array *p_self); -godot_pool_vector3_array_write_access GDAPI *godot_pool_vector3_array_write_access_copy(const godot_pool_vector3_array_write_access *p_other); -godot_vector3 GDAPI *godot_pool_vector3_array_write_access_ptr(const godot_pool_vector3_array_write_access *p_write); -void GDAPI godot_pool_vector3_array_write_access_operator_assign(godot_pool_vector3_array_write_access *p_write, godot_pool_vector3_array_write_access *p_other); -void GDAPI godot_pool_vector3_array_write_access_destroy(godot_pool_vector3_array_write_access *p_write); +godot_bool GDAPI godot_packed_color_array_empty(const godot_packed_color_array *p_self); -godot_pool_color_array_write_access GDAPI *godot_pool_color_array_write_access_copy(const godot_pool_color_array_write_access *p_other); -godot_color GDAPI *godot_pool_color_array_write_access_ptr(const godot_pool_color_array_write_access *p_write); -void GDAPI godot_pool_color_array_write_access_operator_assign(godot_pool_color_array_write_access *p_write, godot_pool_color_array_write_access *p_other); -void GDAPI godot_pool_color_array_write_access_destroy(godot_pool_color_array_write_access *p_write); +void GDAPI godot_packed_color_array_destroy(godot_packed_color_array *p_self); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/string.h b/modules/gdnative/include/gdnative/string.h index b676d21fb2..608978db76 100644 --- a/modules/gdnative/include/gdnative/string.h +++ b/modules/gdnative/include/gdnative/string.h @@ -209,9 +209,9 @@ uint32_t GDAPI godot_string_hash_chars(const char *p_cstr); uint32_t GDAPI godot_string_hash_chars_with_len(const char *p_cstr, godot_int p_len); uint32_t GDAPI godot_string_hash_utf8_chars(const wchar_t *p_str); uint32_t GDAPI godot_string_hash_utf8_chars_with_len(const wchar_t *p_str, godot_int p_len); -godot_pool_byte_array GDAPI godot_string_md5_buffer(const godot_string *p_self); +godot_packed_byte_array GDAPI godot_string_md5_buffer(const godot_string *p_self); godot_string GDAPI godot_string_md5_text(const godot_string *p_self); -godot_pool_byte_array GDAPI godot_string_sha256_buffer(const godot_string *p_self); +godot_packed_byte_array GDAPI godot_string_sha256_buffer(const godot_string *p_self); godot_string GDAPI godot_string_sha256_text(const godot_string *p_self); godot_bool godot_string_empty(const godot_string *p_self); @@ -252,7 +252,7 @@ godot_string GDAPI godot_string_dedent(const godot_string *p_self); godot_string GDAPI godot_string_trim_prefix(const godot_string *p_self, const godot_string *p_prefix); godot_string GDAPI godot_string_trim_suffix(const godot_string *p_self, const godot_string *p_suffix); godot_string GDAPI godot_string_rstrip(const godot_string *p_self, const godot_string *p_chars); -godot_pool_string_array GDAPI godot_string_rsplit(const godot_string *p_self, const godot_string *p_divisor, const godot_bool p_allow_empty, const godot_int p_maxsplit); +godot_packed_string_array GDAPI godot_string_rsplit(const godot_string *p_self, const godot_string *p_divisor, const godot_bool p_allow_empty, const godot_int p_maxsplit); void GDAPI godot_string_destroy(godot_string *p_self); diff --git a/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h index c65f7a28d2..4d70f1143c 100644 --- a/modules/gdnative/include/gdnative/variant.h +++ b/modules/gdnative/include/gdnative/variant.h @@ -76,13 +76,13 @@ typedef enum godot_variant_type { GODOT_VARIANT_TYPE_ARRAY, // 20 // arrays - GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY, - GODOT_VARIANT_TYPE_POOL_INT_ARRAY, - GODOT_VARIANT_TYPE_POOL_REAL_ARRAY, - GODOT_VARIANT_TYPE_POOL_STRING_ARRAY, - GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY, // 25 - GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY, - GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY, + GODOT_VARIANT_TYPE_PACKED_BYTE_ARRAY, + GODOT_VARIANT_TYPE_PACKED_INT_ARRAY, + GODOT_VARIANT_TYPE_PACKED_REAL_ARRAY, + GODOT_VARIANT_TYPE_PACKED_STRING_ARRAY, + GODOT_VARIANT_TYPE_PACKED_VECTOR2_ARRAY, // 25 + GODOT_VARIANT_TYPE_PACKED_VECTOR3_ARRAY, + GODOT_VARIANT_TYPE_PACKED_COLOR_ARRAY, } godot_variant_type; typedef enum godot_variant_call_error_error { @@ -194,13 +194,13 @@ void GDAPI godot_variant_new_rid(godot_variant *r_dest, const godot_rid *p_rid); void GDAPI godot_variant_new_object(godot_variant *r_dest, const godot_object *p_obj); void GDAPI godot_variant_new_dictionary(godot_variant *r_dest, const godot_dictionary *p_dict); void GDAPI godot_variant_new_array(godot_variant *r_dest, const godot_array *p_arr); -void GDAPI godot_variant_new_pool_byte_array(godot_variant *r_dest, const godot_pool_byte_array *p_pba); -void GDAPI godot_variant_new_pool_int_array(godot_variant *r_dest, const godot_pool_int_array *p_pia); -void GDAPI godot_variant_new_pool_real_array(godot_variant *r_dest, const godot_pool_real_array *p_pra); -void GDAPI godot_variant_new_pool_string_array(godot_variant *r_dest, const godot_pool_string_array *p_psa); -void GDAPI godot_variant_new_pool_vector2_array(godot_variant *r_dest, const godot_pool_vector2_array *p_pv2a); -void GDAPI godot_variant_new_pool_vector3_array(godot_variant *r_dest, const godot_pool_vector3_array *p_pv3a); -void GDAPI godot_variant_new_pool_color_array(godot_variant *r_dest, const godot_pool_color_array *p_pca); +void GDAPI godot_variant_new_packed_byte_array(godot_variant *r_dest, const godot_packed_byte_array *p_pba); +void GDAPI godot_variant_new_packed_int_array(godot_variant *r_dest, const godot_packed_int_array *p_pia); +void GDAPI godot_variant_new_packed_real_array(godot_variant *r_dest, const godot_packed_real_array *p_pra); +void GDAPI godot_variant_new_packed_string_array(godot_variant *r_dest, const godot_packed_string_array *p_psa); +void GDAPI godot_variant_new_packed_vector2_array(godot_variant *r_dest, const godot_packed_vector2_array *p_pv2a); +void GDAPI godot_variant_new_packed_vector3_array(godot_variant *r_dest, const godot_packed_vector3_array *p_pv3a); +void GDAPI godot_variant_new_packed_color_array(godot_variant *r_dest, const godot_packed_color_array *p_pca); godot_bool GDAPI godot_variant_as_bool(const godot_variant *p_self); uint64_t GDAPI godot_variant_as_uint(const godot_variant *p_self); @@ -222,13 +222,13 @@ godot_rid GDAPI godot_variant_as_rid(const godot_variant *p_self); godot_object GDAPI *godot_variant_as_object(const godot_variant *p_self); godot_dictionary GDAPI godot_variant_as_dictionary(const godot_variant *p_self); godot_array GDAPI godot_variant_as_array(const godot_variant *p_self); -godot_pool_byte_array GDAPI godot_variant_as_pool_byte_array(const godot_variant *p_self); -godot_pool_int_array GDAPI godot_variant_as_pool_int_array(const godot_variant *p_self); -godot_pool_real_array GDAPI godot_variant_as_pool_real_array(const godot_variant *p_self); -godot_pool_string_array GDAPI godot_variant_as_pool_string_array(const godot_variant *p_self); -godot_pool_vector2_array GDAPI godot_variant_as_pool_vector2_array(const godot_variant *p_self); -godot_pool_vector3_array GDAPI godot_variant_as_pool_vector3_array(const godot_variant *p_self); -godot_pool_color_array GDAPI godot_variant_as_pool_color_array(const godot_variant *p_self); +godot_packed_byte_array GDAPI godot_variant_as_packed_byte_array(const godot_variant *p_self); +godot_packed_int_array GDAPI godot_variant_as_packed_int_array(const godot_variant *p_self); +godot_packed_real_array GDAPI godot_variant_as_packed_real_array(const godot_variant *p_self); +godot_packed_string_array GDAPI godot_variant_as_packed_string_array(const godot_variant *p_self); +godot_packed_vector2_array GDAPI godot_variant_as_packed_vector2_array(const godot_variant *p_self); +godot_packed_vector3_array GDAPI godot_variant_as_packed_vector3_array(const godot_variant *p_self); +godot_packed_color_array GDAPI godot_variant_as_packed_color_array(const godot_variant *p_self); godot_variant GDAPI godot_variant_call(godot_variant *p_self, const godot_string *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant_call_error *r_error); diff --git a/modules/gdnative/include/pluginscript/godot_pluginscript.h b/modules/gdnative/include/pluginscript/godot_pluginscript.h index 210d3f7756..341e7f9e2b 100644 --- a/modules/gdnative/include/pluginscript/godot_pluginscript.h +++ b/modules/gdnative/include/pluginscript/godot_pluginscript.h @@ -129,9 +129,9 @@ typedef struct { godot_bool supports_builtin_mode; godot_string (*get_template_source_code)(godot_pluginscript_language_data *p_data, const godot_string *p_class_name, const godot_string *p_base_class_name); - godot_bool (*validate)(godot_pluginscript_language_data *p_data, const godot_string *p_script, int *r_line_error, int *r_col_error, godot_string *r_test_error, const godot_string *p_path, godot_pool_string_array *r_functions); + godot_bool (*validate)(godot_pluginscript_language_data *p_data, const godot_string *p_script, int *r_line_error, int *r_col_error, godot_string *r_test_error, const godot_string *p_path, godot_packed_string_array *r_functions); int (*find_function)(godot_pluginscript_language_data *p_data, const godot_string *p_function, const godot_string *p_code); // Can be NULL - godot_string (*make_function)(godot_pluginscript_language_data *p_data, const godot_string *p_class, const godot_string *p_name, const godot_pool_string_array *p_args); + godot_string (*make_function)(godot_pluginscript_language_data *p_data, const godot_string *p_class, const godot_string *p_name, const godot_packed_string_array *p_args); godot_error (*complete_code)(godot_pluginscript_language_data *p_data, const godot_string *p_code, const godot_string *p_path, godot_object *p_owner, godot_array *r_options, godot_bool *r_force, godot_string *r_call_hint); void (*auto_indent_code)(godot_pluginscript_language_data *p_data, godot_string *p_code, int p_from_line, int p_to_line); @@ -141,9 +141,9 @@ typedef struct { int (*debug_get_stack_level_line)(godot_pluginscript_language_data *p_data, int p_level); godot_string (*debug_get_stack_level_function)(godot_pluginscript_language_data *p_data, int p_level); godot_string (*debug_get_stack_level_source)(godot_pluginscript_language_data *p_data, int p_level); - void (*debug_get_stack_level_locals)(godot_pluginscript_language_data *p_data, int p_level, godot_pool_string_array *p_locals, godot_array *p_values, int p_max_subitems, int p_max_depth); - void (*debug_get_stack_level_members)(godot_pluginscript_language_data *p_data, int p_level, godot_pool_string_array *p_members, godot_array *p_values, int p_max_subitems, int p_max_depth); - void (*debug_get_globals)(godot_pluginscript_language_data *p_data, godot_pool_string_array *p_locals, godot_array *p_values, int p_max_subitems, int p_max_depth); + void (*debug_get_stack_level_locals)(godot_pluginscript_language_data *p_data, int p_level, godot_packed_string_array *p_locals, godot_array *p_values, int p_max_subitems, int p_max_depth); + void (*debug_get_stack_level_members)(godot_pluginscript_language_data *p_data, int p_level, godot_packed_string_array *p_members, godot_array *p_values, int p_max_subitems, int p_max_depth); + void (*debug_get_globals)(godot_pluginscript_language_data *p_data, godot_packed_string_array *p_locals, godot_array *p_values, int p_max_subitems, int p_max_depth); godot_string (*debug_parse_stack_level_expression)(godot_pluginscript_language_data *p_data, int p_level, const godot_string *p_expression, int p_max_subitems, int p_max_depth); // TODO: could this stuff be moved to the godot_pluginscript_language_desc ? diff --git a/modules/gdnative/include/videodecoder/godot_videodecoder.h b/modules/gdnative/include/videodecoder/godot_videodecoder.h index 714991ca72..3e91a2e9ac 100644 --- a/modules/gdnative/include/videodecoder/godot_videodecoder.h +++ b/modules/gdnative/include/videodecoder/godot_videodecoder.h @@ -54,7 +54,7 @@ typedef struct void (*seek)(void *, godot_real); void (*set_audio_track)(void *, godot_int); void (*update)(void *, godot_real); - godot_pool_byte_array *(*get_videoframe)(void *); + godot_packed_byte_array *(*get_videoframe)(void *); godot_int (*get_audioframe)(void *, float *, int); godot_int (*get_channels)(const void *); godot_int (*get_mix_rate)(const void *); diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index df85155ff5..a2be4807d7 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -1361,7 +1361,7 @@ bool NativeScriptLanguage::supports_builtin_mode() const { int NativeScriptLanguage::find_function(const String &p_function, const String &p_code) const { return -1; } -String NativeScriptLanguage::make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const { +String NativeScriptLanguage::make_function(const String &p_class, const String &p_name, const PackedStringArray &p_args) const { return ""; } void NativeScriptLanguage::auto_indent_code(String &p_code, int p_from_line, int p_to_line) const { diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h index 2ff08e32cd..58e4052368 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -352,7 +352,7 @@ public: virtual bool has_named_classes() const; virtual bool supports_builtin_mode() const; virtual int find_function(const String &p_function, const String &p_code) const; - virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const; + virtual String make_function(const String &p_class, const String &p_name, const PackedStringArray &p_args) const; virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const; virtual void add_global_constant(const StringName &p_variable, const Variant &p_value); virtual String debug_get_error() const; diff --git a/modules/gdnative/pluginscript/pluginscript_language.cpp b/modules/gdnative/pluginscript/pluginscript_language.cpp index 421d6e0a89..4e39f4b0a8 100644 --- a/modules/gdnative/pluginscript/pluginscript_language.cpp +++ b/modules/gdnative/pluginscript/pluginscript_language.cpp @@ -109,7 +109,7 @@ Ref<Script> PluginScriptLanguage::get_template(const String &p_class_name, const } bool PluginScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions, List<ScriptLanguage::Warning> *r_warnings, Set<int> *r_safe_lines) const { - PoolStringArray functions; + PackedStringArray functions; if (_desc.validate) { bool ret = _desc.validate( _data, @@ -118,7 +118,7 @@ bool PluginScriptLanguage::validate(const String &p_script, int &r_line_error, i &r_col_error, (godot_string *)&r_test_error, (godot_string *)&p_path, - (godot_pool_string_array *)&functions); + (godot_packed_string_array *)&functions); for (int i = 0; i < functions.size(); i++) { r_functions->push_back(functions[i]); } @@ -149,9 +149,9 @@ int PluginScriptLanguage::find_function(const String &p_function, const String & return -1; } -String PluginScriptLanguage::make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const { +String PluginScriptLanguage::make_function(const String &p_class, const String &p_name, const PackedStringArray &p_args) const { if (_desc.make_function) { - godot_string tmp = _desc.make_function(_data, (godot_string *)&p_class, (godot_string *)&p_name, (godot_pool_string_array *)&p_args); + godot_string tmp = _desc.make_function(_data, (godot_string *)&p_class, (godot_string *)&p_name, (godot_packed_string_array *)&p_args); String ret = *(String *)&tmp; godot_string_destroy(&tmp); return ret; @@ -336,9 +336,9 @@ String PluginScriptLanguage::debug_get_stack_level_source(int p_level) const { void PluginScriptLanguage::debug_get_stack_level_locals(int p_level, List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) { if (_desc.debug_get_stack_level_locals) { - PoolStringArray locals; + PackedStringArray locals; Array values; - _desc.debug_get_stack_level_locals(_data, p_level, (godot_pool_string_array *)&locals, (godot_array *)&values, p_max_subitems, p_max_depth); + _desc.debug_get_stack_level_locals(_data, p_level, (godot_packed_string_array *)&locals, (godot_array *)&values, p_max_subitems, p_max_depth); for (int i = 0; i < locals.size(); i++) { p_locals->push_back(locals[i]); } @@ -350,9 +350,9 @@ void PluginScriptLanguage::debug_get_stack_level_locals(int p_level, List<String void PluginScriptLanguage::debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems, int p_max_depth) { if (_desc.debug_get_stack_level_members) { - PoolStringArray members; + PackedStringArray members; Array values; - _desc.debug_get_stack_level_members(_data, p_level, (godot_pool_string_array *)&members, (godot_array *)&values, p_max_subitems, p_max_depth); + _desc.debug_get_stack_level_members(_data, p_level, (godot_packed_string_array *)&members, (godot_array *)&values, p_max_subitems, p_max_depth); for (int i = 0; i < members.size(); i++) { p_members->push_back(members[i]); } @@ -364,9 +364,9 @@ void PluginScriptLanguage::debug_get_stack_level_members(int p_level, List<Strin void PluginScriptLanguage::debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) { if (_desc.debug_get_globals) { - PoolStringArray locals; + PackedStringArray locals; Array values; - _desc.debug_get_globals(_data, (godot_pool_string_array *)&locals, (godot_array *)&values, p_max_subitems, p_max_depth); + _desc.debug_get_globals(_data, (godot_packed_string_array *)&locals, (godot_array *)&values, p_max_subitems, p_max_depth); for (int i = 0; i < locals.size(); i++) { p_locals->push_back(locals[i]); } diff --git a/modules/gdnative/pluginscript/pluginscript_language.h b/modules/gdnative/pluginscript/pluginscript_language.h index 145ab5599c..037d7a4948 100644 --- a/modules/gdnative/pluginscript/pluginscript_language.h +++ b/modules/gdnative/pluginscript/pluginscript_language.h @@ -80,7 +80,7 @@ public: virtual bool supports_builtin_mode() const; virtual bool can_inherit_from_file() { return true; } virtual int find_function(const String &p_function, const String &p_code) const; - virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const; + virtual String make_function(const String &p_class, const String &p_name, const PackedStringArray &p_args) const; virtual Error complete_code(const String &p_code, const String &p_path, Object *p_owner, List<ScriptCodeCompletionOption> *r_options, bool &r_force, String &r_call_hint); virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const; virtual void add_global_constant(const StringName &p_variable, const Variant &p_value); diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp index c370062262..fffb169129 100644 --- a/modules/gdnative/pluginscript/pluginscript_script.cpp +++ b/modules/gdnative/pluginscript/pluginscript_script.cpp @@ -428,22 +428,22 @@ ScriptLanguage *PluginScript::get_language() const { Error PluginScript::load_source_code(const String &p_path) { - PoolVector<uint8_t> sourcef; + Vector<uint8_t> sourcef; Error err; FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err); ERR_FAIL_COND_V_MSG(err, err, "Cannot open file '" + 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; - if (s.parse_utf8((const char *)w.ptr())) { + if (s.parse_utf8((const char *)w)) { ERR_FAIL_V_MSG(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."); } diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp index 4142f60ba6..e5d688afd4 100644 --- a/modules/gdnative/register_types.cpp +++ b/modules/gdnative/register_types.cpp @@ -325,7 +325,7 @@ void unregister_gdnative_types() { print_line(String("dict:\t" ) + itos(sizeof(Dictionary))); print_line(String("node_path:\t") + itos(sizeof(NodePath))); print_line(String("plane:\t") + itos(sizeof(Plane))); - print_line(String("poolarray:\t") + itos(sizeof(PoolByteArray))); + print_line(String("poolarray:\t") + itos(sizeof(PackedByteArray))); print_line(String("quat:\t") + itos(sizeof(Quat))); print_line(String("rect2:\t") + itos(sizeof(Rect2))); print_line(String("aabb:\t") + itos(sizeof(AABB))); diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.cpp b/modules/gdnative/videodecoder/video_stream_gdnative.cpp index 8dcafc1987..bd16563ff0 100644 --- a/modules/gdnative/videodecoder/video_stream_gdnative.cpp +++ b/modules/gdnative/videodecoder/video_stream_gdnative.cpp @@ -187,7 +187,7 @@ void VideoStreamPlaybackGDNative::update(float p_delta) { } void VideoStreamPlaybackGDNative::update_texture() { - PoolByteArray *pba = (PoolByteArray *)interface->get_videoframe(data_struct); + PackedByteArray *pba = (PackedByteArray *)interface->get_videoframe(data_struct); if (pba == NULL) { playing = false; diff --git a/modules/gdnavigation/nav_region.cpp b/modules/gdnavigation/nav_region.cpp index d2d9d8b517..0215821305 100644 --- a/modules/gdnavigation/nav_region.cpp +++ b/modules/gdnavigation/nav_region.cpp @@ -78,12 +78,12 @@ void NavRegion::update_polygons() { if (mesh.is_null()) return; - PoolVector<Vector3> vertices = mesh->get_vertices(); + Vector<Vector3> vertices = mesh->get_vertices(); int len = vertices.size(); if (len == 0) return; - PoolVector<Vector3>::Read vertices_r = vertices.read(); + const Vector3 *vertices_r = vertices.ptr(); polygons.resize(mesh->get_polygon_count()); diff --git a/modules/gdnavigation/navigation_mesh_generator.cpp b/modules/gdnavigation/navigation_mesh_generator.cpp index 04b86fabc5..7f8761dac8 100644 --- a/modules/gdnavigation/navigation_mesh_generator.cpp +++ b/modules/gdnavigation/navigation_mesh_generator.cpp @@ -90,13 +90,13 @@ void NavigationMeshGenerator::_add_mesh(const Ref<Mesh> &p_mesh, const Transform Array a = p_mesh->surface_get_arrays(i); - PoolVector<Vector3> mesh_vertices = a[Mesh::ARRAY_VERTEX]; - PoolVector<Vector3>::Read vr = mesh_vertices.read(); + Vector<Vector3> mesh_vertices = a[Mesh::ARRAY_VERTEX]; + const Vector3 *vr = mesh_vertices.ptr(); if (p_mesh->surface_get_format(i) & Mesh::ARRAY_FORMAT_INDEX) { - PoolVector<int> mesh_indices = a[Mesh::ARRAY_INDEX]; - PoolVector<int>::Read ir = mesh_indices.read(); + Vector<int> mesh_indices = a[Mesh::ARRAY_INDEX]; + const int *ir = mesh_indices.ptr(); for (int j = 0; j < mesh_vertices.size(); j++) { _add_vertex(p_xform.xform(vr[j]), p_verticies); @@ -123,7 +123,7 @@ void NavigationMeshGenerator::_add_mesh(const Ref<Mesh> &p_mesh, const Transform } } -void NavigationMeshGenerator::_add_faces(const PoolVector3Array &p_faces, const Transform &p_xform, Vector<float> &p_verticies, Vector<int> &p_indices) { +void NavigationMeshGenerator::_add_faces(const PackedVector3Array &p_faces, const Transform &p_xform, Vector<float> &p_verticies, Vector<int> &p_indices) { int face_count = p_faces.size() / 3; int current_vertex_count = p_verticies.size() / 3; @@ -227,7 +227,7 @@ void NavigationMeshGenerator::_parse_geometry(Transform p_accumulated_transform, Error err = QuickHull::build(varr, md); if (err == OK) { - PoolVector3Array faces; + PackedVector3Array faces; for (int j = 0; j < md.faces.size(); ++j) { Geometry::MeshData::Face face = md.faces[j]; @@ -279,11 +279,11 @@ void NavigationMeshGenerator::_parse_geometry(Transform p_accumulated_transform, void NavigationMeshGenerator::_convert_detail_mesh_to_native_navigation_mesh(const rcPolyMeshDetail *p_detail_mesh, Ref<NavigationMesh> p_nav_mesh) { - PoolVector<Vector3> nav_vertices; + Vector<Vector3> nav_vertices; for (int i = 0; i < p_detail_mesh->nverts; i++) { const float *v = &p_detail_mesh->verts[i * 3]; - nav_vertices.append(Vector3(v[0], v[1], v[2])); + nav_vertices.push_back(Vector3(v[0], v[1], v[2])); } p_nav_mesh->set_vertices(nav_vertices); @@ -562,7 +562,7 @@ void NavigationMeshGenerator::bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node) void NavigationMeshGenerator::clear(Ref<NavigationMesh> p_nav_mesh) { if (p_nav_mesh.is_valid()) { p_nav_mesh->clear_polygons(); - p_nav_mesh->set_vertices(PoolVector<Vector3>()); + p_nav_mesh->set_vertices(Vector<Vector3>()); } } diff --git a/modules/gdnavigation/navigation_mesh_generator.h b/modules/gdnavigation/navigation_mesh_generator.h index 107dee75e2..27a56e1d7a 100644 --- a/modules/gdnavigation/navigation_mesh_generator.h +++ b/modules/gdnavigation/navigation_mesh_generator.h @@ -51,7 +51,7 @@ protected: static void _add_vertex(const Vector3 &p_vec3, Vector<float> &p_verticies); static void _add_mesh(const Ref<Mesh> &p_mesh, const Transform &p_xform, Vector<float> &p_verticies, Vector<int> &p_indices); - static void _add_faces(const PoolVector3Array &p_faces, const Transform &p_xform, Vector<float> &p_verticies, Vector<int> &p_indices); + static void _add_faces(const PackedVector3Array &p_faces, const Transform &p_xform, Vector<float> &p_verticies, Vector<int> &p_indices); static void _parse_geometry(Transform p_accumulated_transform, Node *p_node, Vector<float> &p_verticies, Vector<int> &p_indices, int p_generate_from, uint32_t p_collision_mask, bool p_recurse_children); static void _convert_detail_mesh_to_native_navigation_mesh(const rcPolyMeshDetail *p_detail_mesh, Ref<NavigationMesh> p_nav_mesh); diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 07c74a2e26..a73276dda2 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -902,7 +902,7 @@ Error GDScript::load_byte_code(const String &p_path) { Error GDScript::load_source_code(const String &p_path) { - PoolVector<uint8_t> sourcef; + Vector<uint8_t> sourcef; Error err; FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err); if (err) { @@ -912,15 +912,15 @@ Error GDScript::load_source_code(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; - if (s.parse_utf8((const char *)w.ptr())) { + if (s.parse_utf8((const char *)w)) { ERR_FAIL_V_MSG(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."); } @@ -1986,7 +1986,7 @@ bool GDScriptLanguage::handles_global_class_type(const String &p_type) const { String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_base_type, String *r_icon_path) const { - PoolVector<uint8_t> sourcef; + Vector<uint8_t> sourcef; Error err; FileAccessRef f = FileAccess::open(p_path, FileAccess::READ, &err); if (err) { diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index 3d24f9b3f5..103de3304e 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -487,7 +487,7 @@ public: virtual bool supports_builtin_mode() const; virtual bool can_inherit_from_file() { return true; } virtual int find_function(const String &p_function, const String &p_code) const; - virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const; + virtual String make_function(const String &p_class, const String &p_name, const PackedStringArray &p_args) const; virtual Error complete_code(const String &p_code, const String &p_path, Object *p_owner, List<ScriptCodeCompletionOption> *r_options, bool &r_forced, String &r_call_hint); #ifdef TOOLS_ENABLED virtual Error lookup_code(const String &p_code, const String &p_symbol, const String &p_path, Object *p_owner, LookupResult &r_result); diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index c2c8ff5b99..52527b7da3 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -457,7 +457,7 @@ void GDScriptLanguage::get_public_constants(List<Pair<String, Variant> > *p_cons p_constants->push_back(nan); } -String GDScriptLanguage::make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const { +String GDScriptLanguage::make_function(const String &p_class, const String &p_name, const PackedStringArray &p_args) const { #ifdef TOOLS_ENABLED bool th = EditorSettings::get_singleton()->get_setting("text_editor/completion/add_type_hints"); @@ -2173,8 +2173,8 @@ static void _find_identifiers(const GDScriptCompletionContext &p_context, bool p static const char *_type_names[Variant::VARIANT_MAX] = { "null", "bool", "int", "float", "String", "Vector2", "Rect2", "Vector3", "Transform2D", "Plane", "Quat", "AABB", "Basis", "Transform", - "Color", "NodePath", "RID", "Object", "Dictionary", "Array", "PoolByteArray", "PoolIntArray", "PoolRealArray", "PoolStringArray", - "PoolVector2Array", "PoolVector3Array", "PoolColorArray" + "Color", "NodePath", "RID", "Object", "Dictionary", "Array", "PackedByteArray", "PackedIntArray", "PackedRealArray", "PackedStringArray", + "PackedVector2Array", "PackedVector3Array", "PackedColorArray" }; for (int i = 0; i < Variant::VARIANT_MAX; i++) { diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp index a46337d7dd..bd887fd303 100644 --- a/modules/gdscript/gdscript_functions.cpp +++ b/modules/gdscript/gdscript_functions.cpp @@ -856,7 +856,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ full_objects = *p_args[1]; } - PoolByteArray barr; + PackedByteArray barr; int len; Error err = encode_variant(*p_args[0], NULL, len, full_objects); if (err) { @@ -869,8 +869,8 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ barr.resize(len); { - PoolByteArray::Write w = barr.write(); - encode_variant(*p_args[0], w.ptr(), len, full_objects); + uint8_t *w = barr.ptrw(); + encode_variant(*p_args[0], w, len, full_objects); } r_ret = barr; } break; @@ -896,24 +896,24 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ allow_objects = *p_args[1]; } - if (p_args[0]->get_type() != Variant::POOL_BYTE_ARRAY) { + if (p_args[0]->get_type() != Variant::PACKED_BYTE_ARRAY) { r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 1; - r_error.expected = Variant::POOL_BYTE_ARRAY; + r_error.expected = Variant::PACKED_BYTE_ARRAY; r_ret = Variant(); return; } - PoolByteArray varr = *p_args[0]; + PackedByteArray varr = *p_args[0]; Variant ret; { - PoolByteArray::Read r = varr.read(); - Error err = decode_variant(ret, r.ptr(), varr.size(), NULL, allow_objects); + const uint8_t *r = varr.ptr(); + Error err = decode_variant(ret, r, varr.size(), NULL, allow_objects); if (err != OK) { r_ret = RTR("Not enough bytes for decoding bytes, or invalid format."); r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; - r_error.expected = Variant::POOL_BYTE_ARRAY; + r_error.expected = Variant::PACKED_BYTE_ARRAY; return; } } @@ -1390,39 +1390,39 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ Array d = *p_args[0]; r_ret = d.size(); } break; - case Variant::POOL_BYTE_ARRAY: { + case Variant::PACKED_BYTE_ARRAY: { - PoolVector<uint8_t> d = *p_args[0]; + Vector<uint8_t> d = *p_args[0]; r_ret = d.size(); } break; - case Variant::POOL_INT_ARRAY: { + case Variant::PACKED_INT_ARRAY: { - PoolVector<int> d = *p_args[0]; + Vector<int> d = *p_args[0]; r_ret = d.size(); } break; - case Variant::POOL_REAL_ARRAY: { + case Variant::PACKED_REAL_ARRAY: { - PoolVector<real_t> d = *p_args[0]; + Vector<real_t> d = *p_args[0]; r_ret = d.size(); } break; - case Variant::POOL_STRING_ARRAY: { + case Variant::PACKED_STRING_ARRAY: { - PoolVector<String> d = *p_args[0]; + Vector<String> d = *p_args[0]; r_ret = d.size(); } break; - case Variant::POOL_VECTOR2_ARRAY: { + case Variant::PACKED_VECTOR2_ARRAY: { - PoolVector<Vector2> d = *p_args[0]; + Vector<Vector2> d = *p_args[0]; r_ret = d.size(); } break; - case Variant::POOL_VECTOR3_ARRAY: { + case Variant::PACKED_VECTOR3_ARRAY: { - PoolVector<Vector3> d = *p_args[0]; + Vector<Vector3> d = *p_args[0]; r_ret = d.size(); } break; - case Variant::POOL_COLOR_ARRAY: { + case Variant::PACKED_COLOR_ARRAY: { - PoolVector<Color> d = *p_args[0]; + Vector<Color> d = *p_args[0]; r_ret = d.size(); } break; default: { @@ -1941,12 +1941,12 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) { MethodInfo mi("var2bytes", PropertyInfo(Variant::NIL, "var", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_NIL_IS_VARIANT), PropertyInfo(Variant::BOOL, "full_objects")); mi.default_arguments.push_back(false); - mi.return_val.type = Variant::POOL_BYTE_ARRAY; + mi.return_val.type = Variant::PACKED_BYTE_ARRAY; return mi; } break; case BYTES_TO_VAR: { - MethodInfo mi(Variant::NIL, "bytes2var", PropertyInfo(Variant::POOL_BYTE_ARRAY, "bytes"), PropertyInfo(Variant::BOOL, "allow_objects")); + MethodInfo mi(Variant::NIL, "bytes2var", PropertyInfo(Variant::PACKED_BYTE_ARRAY, "bytes"), PropertyInfo(Variant::BOOL, "allow_objects")); mi.default_arguments.push_back(false); mi.return_val.type = Variant::NIL; mi.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT; diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index fae6fbbb0c..33c6a55bfb 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -6596,13 +6596,13 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) { if (!error) { switch (base_type.builtin_type) { // Expect int or real as index - case Variant::POOL_BYTE_ARRAY: - case Variant::POOL_COLOR_ARRAY: - case Variant::POOL_INT_ARRAY: - case Variant::POOL_REAL_ARRAY: - case Variant::POOL_STRING_ARRAY: - case Variant::POOL_VECTOR2_ARRAY: - case Variant::POOL_VECTOR3_ARRAY: + case Variant::PACKED_BYTE_ARRAY: + case Variant::PACKED_COLOR_ARRAY: + case Variant::PACKED_INT_ARRAY: + case Variant::PACKED_REAL_ARRAY: + case Variant::PACKED_STRING_ARRAY: + case Variant::PACKED_VECTOR2_ARRAY: + case Variant::PACKED_VECTOR3_ARRAY: case Variant::ARRAY: case Variant::STRING: { error = index_type.builtin_type != Variant::INT && index_type.builtin_type != Variant::REAL; @@ -6646,13 +6646,13 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) { case Variant::STRING: case Variant::ARRAY: case Variant::DICTIONARY: - case Variant::POOL_BYTE_ARRAY: - case Variant::POOL_COLOR_ARRAY: - case Variant::POOL_INT_ARRAY: - case Variant::POOL_REAL_ARRAY: - case Variant::POOL_STRING_ARRAY: - case Variant::POOL_VECTOR2_ARRAY: - case Variant::POOL_VECTOR3_ARRAY: { + case Variant::PACKED_BYTE_ARRAY: + case Variant::PACKED_COLOR_ARRAY: + case Variant::PACKED_INT_ARRAY: + case Variant::PACKED_REAL_ARRAY: + case Variant::PACKED_STRING_ARRAY: + case Variant::PACKED_VECTOR2_ARRAY: + case Variant::PACKED_VECTOR3_ARRAY: { break; } default: { @@ -6698,34 +6698,34 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) { return DataType(); } break; // Return int - case Variant::POOL_BYTE_ARRAY: - case Variant::POOL_INT_ARRAY: { + case Variant::PACKED_BYTE_ARRAY: + case Variant::PACKED_INT_ARRAY: { result.builtin_type = Variant::INT; } break; // Return real - case Variant::POOL_REAL_ARRAY: + case Variant::PACKED_REAL_ARRAY: case Variant::VECTOR2: case Variant::VECTOR3: case Variant::QUAT: { result.builtin_type = Variant::REAL; } break; // Return color - case Variant::POOL_COLOR_ARRAY: { + case Variant::PACKED_COLOR_ARRAY: { result.builtin_type = Variant::COLOR; } break; // Return string - case Variant::POOL_STRING_ARRAY: + case Variant::PACKED_STRING_ARRAY: case Variant::STRING: { result.builtin_type = Variant::STRING; } break; // Return Vector2 - case Variant::POOL_VECTOR2_ARRAY: + case Variant::PACKED_VECTOR2_ARRAY: case Variant::TRANSFORM2D: case Variant::RECT2: { result.builtin_type = Variant::VECTOR2; } break; // Return Vector3 - case Variant::POOL_VECTOR3_ARRAY: + case Variant::PACKED_VECTOR3_ARRAY: case Variant::AABB: case Variant::BASIS: { result.builtin_type = Variant::VECTOR3; diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp index a0e0811c1f..b30f81959e 100644 --- a/modules/gdscript/gdscript_tokenizer.cpp +++ b/modules/gdscript/gdscript_tokenizer.cpp @@ -163,13 +163,13 @@ static const _bit _type_list[] = { { Variant::NODE_PATH, "NodePath" }, { Variant::DICTIONARY, "Dictionary" }, { Variant::ARRAY, "Array" }, - { Variant::POOL_BYTE_ARRAY, "PoolByteArray" }, - { Variant::POOL_INT_ARRAY, "PoolIntArray" }, - { Variant::POOL_REAL_ARRAY, "PoolRealArray" }, - { Variant::POOL_STRING_ARRAY, "PoolStringArray" }, - { Variant::POOL_VECTOR2_ARRAY, "PoolVector2Array" }, - { Variant::POOL_VECTOR3_ARRAY, "PoolVector3Array" }, - { Variant::POOL_COLOR_ARRAY, "PoolColorArray" }, + { Variant::PACKED_BYTE_ARRAY, "PackedByteArray" }, + { Variant::PACKED_INT_ARRAY, "PackedIntArray" }, + { Variant::PACKED_REAL_ARRAY, "PackedRealArray" }, + { Variant::PACKED_STRING_ARRAY, "PackedStringArray" }, + { Variant::PACKED_VECTOR2_ARRAY, "PackedVector2Array" }, + { Variant::PACKED_VECTOR3_ARRAY, "PackedVector3Array" }, + { Variant::PACKED_COLOR_ARRAY, "PackedColorArray" }, { Variant::VARIANT_MAX, NULL }, }; diff --git a/modules/gdscript/language_server/gdscript_language_protocol.cpp b/modules/gdscript/language_server/gdscript_language_protocol.cpp index 7133c6b4be..b2da5dfdbc 100644 --- a/modules/gdscript/language_server/gdscript_language_protocol.cpp +++ b/modules/gdscript/language_server/gdscript_language_protocol.cpp @@ -39,10 +39,10 @@ GDScriptLanguageProtocol *GDScriptLanguageProtocol::singleton = NULL; void GDScriptLanguageProtocol::on_data_received(int p_id) { lastest_client_id = p_id; Ref<WebSocketPeer> peer = server->get_peer(p_id); - PoolByteArray data; + PackedByteArray data; if (OK == peer->get_packet_buffer(data)) { String message; - message.parse_utf8((const char *)data.read().ptr(), data.size()); + message.parse_utf8((const char *)data.ptr(), data.size()); if (message.begins_with("Content-Length:")) return; String output = process_message(message); if (!output.empty()) { diff --git a/modules/glslang/register_types.cpp b/modules/glslang/register_types.cpp index 1e4481a6a0..d2b4a18fc7 100644 --- a/modules/glslang/register_types.cpp +++ b/modules/glslang/register_types.cpp @@ -142,9 +142,9 @@ static const TBuiltInResource default_builtin_resource = { } }; -static PoolVector<uint8_t> _compile_shader_glsl(RenderingDevice::ShaderStage p_stage, const String &p_source_code, RenderingDevice::ShaderLanguage p_language, String *r_error) { +static Vector<uint8_t> _compile_shader_glsl(RenderingDevice::ShaderStage p_stage, const String &p_source_code, RenderingDevice::ShaderLanguage p_language, String *r_error) { - PoolVector<uint8_t> ret; + Vector<uint8_t> ret; ERR_FAIL_COND_V(p_language == RenderingDevice::SHADER_LANGUAGE_HLSL, ret); @@ -224,8 +224,8 @@ static PoolVector<uint8_t> _compile_shader_glsl(RenderingDevice::ShaderStage p_s ret.resize(SpirV.size() * sizeof(uint32_t)); { - PoolVector<uint8_t>::Write w = ret.write(); - copymem(w.ptr(), &SpirV[0], SpirV.size() * sizeof(uint32_t)); + uint8_t *w = ret.ptrw(); + copymem(w, &SpirV[0], SpirV.size() * sizeof(uint32_t)); } return ret; diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 7fe58f8ce7..ba0449c046 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -49,9 +49,9 @@ bool GridMap::_set(const StringName &p_name, const Variant &p_value) { if (d.has("cells")) { - PoolVector<int> cells = d["cells"]; + Vector<int> cells = d["cells"]; int amount = cells.size(); - PoolVector<int>::Read r = cells.read(); + const int *r = cells.ptr(); ERR_FAIL_COND_V(amount % 3, false); // not even cell_map.clear(); for (int i = 0; i < amount / 3; i++) { @@ -103,10 +103,10 @@ bool GridMap::_get(const StringName &p_name, Variant &r_ret) const { Dictionary d; - PoolVector<int> cells; + Vector<int> cells; cells.resize(cell_map.size() * 3); { - PoolVector<int>::Write w = cells.write(); + int *w = cells.ptrw(); int i = 0; for (Map<IndexKey, Cell>::Element *E = cell_map.front(); E; E = E->next(), i++) { @@ -439,7 +439,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) { return true; } - PoolVector<Vector3> col_debug; + Vector<Vector3> col_debug; /* * foreach item in this octant, diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index 2144ff264f..43f5feb388 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -1370,9 +1370,9 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { { // Selection mesh create. - PoolVector<Vector3> lines; - PoolVector<Vector3> triangles; - PoolVector<Vector3> square[3]; + Vector<Vector3> lines; + Vector<Vector3> triangles; + Vector<Vector3> square[3]; for (int i = 0; i < 6; i++) { diff --git a/modules/hdr/image_loader_hdr.cpp b/modules/hdr/image_loader_hdr.cpp index 3fa7266f1a..c03ae4ab1f 100644 --- a/modules/hdr/image_loader_hdr.cpp +++ b/modules/hdr/image_loader_hdr.cpp @@ -63,15 +63,15 @@ Error ImageLoaderHDR::load_image(Ref<Image> p_image, FileAccess *f, bool p_force int width = f->get_line().to_int(); - PoolVector<uint8_t> imgdata; + Vector<uint8_t> imgdata; imgdata.resize(height * width * sizeof(uint32_t)); { - PoolVector<uint8_t>::Write w = imgdata.write(); + uint8_t *w = imgdata.ptrw(); - uint8_t *ptr = (uint8_t *)w.ptr(); + uint8_t *ptr = (uint8_t *)w; if (width < 8 || width >= 32768) { // Read flat data diff --git a/modules/jpg/image_loader_jpegd.cpp b/modules/jpg/image_loader_jpegd.cpp index a1f0f0ef6a..9e87d11ac1 100644 --- a/modules/jpg/image_loader_jpegd.cpp +++ b/modules/jpg/image_loader_jpegd.cpp @@ -57,13 +57,13 @@ Error jpeg_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p const int dst_bpl = image_width * comps; - PoolVector<uint8_t> data; + Vector<uint8_t> data; data.resize(dst_bpl * image_height); - PoolVector<uint8_t>::Write dw = data.write(); + uint8_t *dw = data.ptrw(); - jpgd::uint8 *pImage_data = (jpgd::uint8 *)dw.ptr(); + jpgd::uint8 *pImage_data = (jpgd::uint8 *)dw; for (int y = 0; y < image_height; y++) { const jpgd::uint8 *pScan_line; @@ -96,7 +96,6 @@ Error jpeg_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p else fmt = Image::FORMAT_RGB8; - dw.release(); p_image->create(image_width, image_height, 0, fmt, data); return OK; @@ -104,18 +103,18 @@ Error jpeg_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p Error ImageLoaderJPG::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale) { - PoolVector<uint8_t> src_image; + Vector<uint8_t> src_image; int src_image_len = f->get_len(); ERR_FAIL_COND_V(src_image_len == 0, ERR_FILE_CORRUPT); src_image.resize(src_image_len); - PoolVector<uint8_t>::Write w = src_image.write(); + uint8_t *w = src_image.ptrw(); f->get_buffer(&w[0], src_image_len); f->close(); - Error err = jpeg_load_image_from_buffer(p_image.ptr(), w.ptr(), src_image_len); + Error err = jpeg_load_image_from_buffer(p_image.ptr(), w, src_image_len); return err; } diff --git a/modules/mbedtls/crypto_mbedtls.cpp b/modules/mbedtls/crypto_mbedtls.cpp index 2bd80064e3..ee3c78aeb3 100644 --- a/modules/mbedtls/crypto_mbedtls.cpp +++ b/modules/mbedtls/crypto_mbedtls.cpp @@ -53,22 +53,22 @@ CryptoKey *CryptoKeyMbedTLS::create() { Error CryptoKeyMbedTLS::load(String p_path) { ERR_FAIL_COND_V_MSG(locks, ERR_ALREADY_IN_USE, "Key is in use"); - PoolByteArray out; + PackedByteArray out; FileAccess *f = FileAccess::open(p_path, FileAccess::READ); ERR_FAIL_COND_V_MSG(!f, ERR_INVALID_PARAMETER, "Cannot open CryptoKeyMbedTLS file '" + p_path + "'."); int flen = f->get_len(); out.resize(flen + 1); { - PoolByteArray::Write w = out.write(); - f->get_buffer(w.ptr(), flen); + uint8_t *w = out.ptrw(); + f->get_buffer(w, flen); w[flen] = 0; //end f string } memdelete(f); - int ret = mbedtls_pk_parse_key(&pkey, out.read().ptr(), out.size(), NULL, 0); + int ret = mbedtls_pk_parse_key(&pkey, out.ptr(), out.size(), NULL, 0); // We MUST zeroize the memory for safety! - mbedtls_platform_zeroize(out.write().ptr(), out.size()); + mbedtls_platform_zeroize(out.ptrw(), out.size()); ERR_FAIL_COND_V_MSG(ret, FAILED, "Error parsing private key '" + itos(ret) + "'."); return OK; @@ -102,20 +102,20 @@ X509Certificate *X509CertificateMbedTLS::create() { Error X509CertificateMbedTLS::load(String p_path) { ERR_FAIL_COND_V_MSG(locks, ERR_ALREADY_IN_USE, "Certificate is in use"); - PoolByteArray out; + PackedByteArray out; FileAccess *f = FileAccess::open(p_path, FileAccess::READ); ERR_FAIL_COND_V_MSG(!f, ERR_INVALID_PARAMETER, "Cannot open X509CertificateMbedTLS file '" + p_path + "'."); int flen = f->get_len(); out.resize(flen + 1); { - PoolByteArray::Write w = out.write(); - f->get_buffer(w.ptr(), flen); + uint8_t *w = out.ptrw(); + f->get_buffer(w, flen); w[flen] = 0; //end f string } memdelete(f); - int ret = mbedtls_x509_crt_parse(&cert, out.read().ptr(), out.size()); + int ret = mbedtls_x509_crt_parse(&cert, out.ptr(), out.size()); ERR_FAIL_COND_V_MSG(ret, FAILED, "Error parsing some certificates: " + itos(ret)); return OK; @@ -210,15 +210,15 @@ void CryptoMbedTLS::load_default_certificates(String p_path) { #ifdef BUILTIN_CERTS_ENABLED else { // Use builtin certs only if user did not override it in project settings. - PoolByteArray out; + PackedByteArray out; out.resize(_certs_uncompressed_size + 1); - PoolByteArray::Write w = out.write(); - Compression::decompress(w.ptr(), _certs_uncompressed_size, _certs_compressed, _certs_compressed_size, Compression::MODE_DEFLATE); + uint8_t *w = out.ptrw(); + Compression::decompress(w, _certs_uncompressed_size, _certs_compressed, _certs_compressed_size, Compression::MODE_DEFLATE); w[_certs_uncompressed_size] = 0; // Make sure it ends with string terminator #ifdef DEBUG_ENABLED print_verbose("Loaded builtin certs"); #endif - default_certs->load_from_memory(out.read().ptr(), out.size()); + default_certs->load_from_memory(out.ptr(), out.size()); } #endif } @@ -276,9 +276,9 @@ Ref<X509Certificate> CryptoMbedTLS::generate_self_signed_certificate(Ref<CryptoK return out; } -PoolByteArray CryptoMbedTLS::generate_random_bytes(int p_bytes) { - PoolByteArray out; +PackedByteArray CryptoMbedTLS::generate_random_bytes(int p_bytes) { + PackedByteArray out; out.resize(p_bytes); - mbedtls_ctr_drbg_random(&ctr_drbg, out.write().ptr(), p_bytes); + mbedtls_ctr_drbg_random(&ctr_drbg, out.ptrw(), p_bytes); return out; } diff --git a/modules/mbedtls/crypto_mbedtls.h b/modules/mbedtls/crypto_mbedtls.h index edb5841761..6c1c0e255d 100644 --- a/modules/mbedtls/crypto_mbedtls.h +++ b/modules/mbedtls/crypto_mbedtls.h @@ -113,7 +113,7 @@ public: static X509CertificateMbedTLS *get_default_certificates(); static void load_default_certificates(String p_path); - virtual PoolByteArray generate_random_bytes(int p_bytes); + virtual PackedByteArray generate_random_bytes(int p_bytes); virtual Ref<CryptoKey> generate_rsa(int p_bytes); virtual Ref<X509Certificate> generate_self_signed_certificate(Ref<CryptoKey> p_key, String p_issuer_name, String p_not_before, String p_not_after); diff --git a/modules/mbedtls/ssl_context_mbedtls.h b/modules/mbedtls/ssl_context_mbedtls.h index 9145e0fd72..01b8b3fd4d 100644 --- a/modules/mbedtls/ssl_context_mbedtls.h +++ b/modules/mbedtls/ssl_context_mbedtls.h @@ -34,7 +34,7 @@ #include "crypto_mbedtls.h" #include "core/os/file_access.h" -#include "core/pool_vector.h" + #include "core/reference.h" #include <mbedtls/config.h> @@ -48,7 +48,7 @@ class SSLContextMbedTLS : public Reference { protected: bool inited; - static PoolByteArray _read_file(String p_path); + static PackedByteArray _read_file(String p_path); public: Ref<X509CertificateMbedTLS> certs; diff --git a/modules/mono/build_scripts/make_android_mono_config.py b/modules/mono/build_scripts/make_android_mono_config.py index 8cad204d7b..0afd939c57 100644 --- a/modules/mono/build_scripts/make_android_mono_config.py +++ b/modules/mono/build_scripts/make_android_mono_config.py @@ -24,7 +24,7 @@ def generate_compressed_config(config_src, output_dir): #ifdef ANDROID_ENABLED #include "core/io/compression.h" -#include "core/pool_vector.h" + namespace { @@ -36,9 +36,9 @@ static const unsigned char config_compressed_data[] = { %s }; } // namespace String get_godot_android_mono_config() { - PoolVector<uint8_t> data; + Vector<uint8_t> data; data.resize(config_uncompressed_size); - PoolVector<uint8_t>::Write w = data.write(); + uint8_t* w = data.ptrw(); Compression::decompress(w.ptr(), config_uncompressed_size, config_compressed_data, config_compressed_size, Compression::MODE_DEFLATE); String s; diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index c722076fe2..15415d7655 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -428,24 +428,24 @@ static String variant_type_to_managed_name(const String &p_var_type_name) { if (p_var_type_name == Variant::get_type_name(Variant::ARRAY)) return "Collections.Array"; - if (p_var_type_name == Variant::get_type_name(Variant::POOL_BYTE_ARRAY)) + if (p_var_type_name == Variant::get_type_name(Variant::PACKED_BYTE_ARRAY)) return "byte[]"; - if (p_var_type_name == Variant::get_type_name(Variant::POOL_INT_ARRAY)) + if (p_var_type_name == Variant::get_type_name(Variant::PACKED_INT_ARRAY)) return "int[]"; - if (p_var_type_name == Variant::get_type_name(Variant::POOL_REAL_ARRAY)) { + if (p_var_type_name == Variant::get_type_name(Variant::PACKED_REAL_ARRAY)) { #ifdef REAL_T_IS_DOUBLE return "double[]"; #else return "float[]"; #endif } - if (p_var_type_name == Variant::get_type_name(Variant::POOL_STRING_ARRAY)) + if (p_var_type_name == Variant::get_type_name(Variant::PACKED_STRING_ARRAY)) return "string[]"; - if (p_var_type_name == Variant::get_type_name(Variant::POOL_VECTOR2_ARRAY)) + if (p_var_type_name == Variant::get_type_name(Variant::PACKED_VECTOR2_ARRAY)) return "Vector2[]"; - if (p_var_type_name == Variant::get_type_name(Variant::POOL_VECTOR3_ARRAY)) + if (p_var_type_name == Variant::get_type_name(Variant::PACKED_VECTOR3_ARRAY)) return "Vector3[]"; - if (p_var_type_name == Variant::get_type_name(Variant::POOL_COLOR_ARRAY)) + if (p_var_type_name == Variant::get_type_name(Variant::PACKED_COLOR_ARRAY)) return "Color[]"; Variant::Type var_types[] = { @@ -473,7 +473,7 @@ static String variant_type_to_managed_name(const String &p_var_type_name) { return "object"; } -String CSharpLanguage::make_function(const String &, const String &p_name, const PoolStringArray &p_args) const { +String CSharpLanguage::make_function(const String &, const String &p_name, const PackedStringArray &p_args) const { // FIXME // - Due to Godot's API limitation this just appends the function to the end of the file // - Use fully qualified name if there is ambiguity @@ -491,7 +491,7 @@ String CSharpLanguage::make_function(const String &, const String &p_name, const return s; } #else -String CSharpLanguage::make_function(const String &, const String &, const PoolStringArray &) const { +String CSharpLanguage::make_function(const String &, const String &, const PackedStringArray &) const { return String(); } #endif diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index 32a5b30c18..8ee741b4d2 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -432,7 +432,7 @@ public: virtual bool has_named_classes() const; virtual bool supports_builtin_mode() const; /* TODO? */ virtual int find_function(const String &p_function, const String &p_code) const { return -1; } - virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const; + virtual String make_function(const String &p_class, const String &p_name, const PackedStringArray &p_args) const; virtual String _get_indentation() const; /* TODO? */ virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const {} /* TODO */ virtual void add_global_constant(const StringName &p_variable, const Variant &p_value) {} diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 34f01ce3c6..0724d72ce6 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -503,23 +503,23 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf xml_output.append("<c>"); xml_output.append(tag); xml_output.append("</c>"); - } else if (tag == "PoolByteArray") { + } else if (tag == "PackedByteArray") { xml_output.append("<see cref=\"byte\"/>"); - } else if (tag == "PoolIntArray") { + } else if (tag == "PackedIntArray") { xml_output.append("<see cref=\"int\"/>"); - } else if (tag == "PoolRealArray") { + } else if (tag == "PackedRealArray") { #ifdef REAL_T_IS_DOUBLE xml_output.append("<see cref=\"double\"/>"); #else xml_output.append("<see cref=\"float\"/>"); #endif - } else if (tag == "PoolStringArray") { + } else if (tag == "PackedStringArray") { xml_output.append("<see cref=\"string\"/>"); - } else if (tag == "PoolVector2Array") { + } else if (tag == "PackedVector2Array") { xml_output.append("<see cref=\"" BINDINGS_NAMESPACE ".Vector2\"/>"); - } else if (tag == "PoolVector3Array") { + } else if (tag == "PackedVector3Array") { xml_output.append("<see cref=\"" BINDINGS_NAMESPACE ".Vector3\"/>"); - } else if (tag == "PoolColorArray") { + } else if (tag == "PackedColorArray") { xml_output.append("<see cref=\"" BINDINGS_NAMESPACE ".Color\"/>"); } else { const TypeInterface *target_itype = _get_type_or_null(TypeReference(tag)); @@ -2628,13 +2628,13 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar r_iarg.default_argument = "null"; break; case Variant::ARRAY: - case Variant::POOL_BYTE_ARRAY: - case Variant::POOL_INT_ARRAY: - case Variant::POOL_REAL_ARRAY: - case Variant::POOL_STRING_ARRAY: - case Variant::POOL_VECTOR2_ARRAY: - case Variant::POOL_VECTOR3_ARRAY: - case Variant::POOL_COLOR_ARRAY: + case Variant::PACKED_BYTE_ARRAY: + case Variant::PACKED_INT_ARRAY: + case Variant::PACKED_REAL_ARRAY: + case Variant::PACKED_STRING_ARRAY: + case Variant::PACKED_VECTOR2_ARRAY: + case Variant::PACKED_VECTOR3_ARRAY: + case Variant::PACKED_COLOR_ARRAY: r_iarg.default_argument = "new %s {}"; r_iarg.def_param_mode = ArgumentInterface::NULLABLE_REF; break; @@ -2914,20 +2914,20 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { #define INSERT_ARRAY(m_type, m_proxy_t) INSERT_ARRAY_FULL(m_type, m_type, m_proxy_t) - INSERT_ARRAY(PoolIntArray, int); - INSERT_ARRAY_FULL(PoolByteArray, PoolByteArray, byte); + INSERT_ARRAY(PackedIntArray, int); + INSERT_ARRAY_FULL(PackedByteArray, PackedByteArray, byte); #ifdef REAL_T_IS_DOUBLE - INSERT_ARRAY(PoolRealArray, double); + INSERT_ARRAY(PackedRealArray, double); #else - INSERT_ARRAY(PoolRealArray, float); + INSERT_ARRAY(PackedRealArray, float); #endif - INSERT_ARRAY(PoolStringArray, string); + INSERT_ARRAY(PackedStringArray, string); - INSERT_ARRAY(PoolColorArray, Color); - INSERT_ARRAY(PoolVector2Array, Vector2); - INSERT_ARRAY(PoolVector3Array, Vector3); + INSERT_ARRAY(PackedColorArray, Color); + INSERT_ARRAY(PackedVector2Array, Vector2); + INSERT_ARRAY(PackedVector3Array, Vector3); #undef INSERT_ARRAY diff --git a/modules/mono/glue/gd_glue.cpp b/modules/mono/glue/gd_glue.cpp index 17483c4457..ce81ea391d 100644 --- a/modules/mono/glue/gd_glue.cpp +++ b/modules/mono/glue/gd_glue.cpp @@ -44,8 +44,8 @@ MonoObject *godot_icall_GD_bytes2var(MonoArray *p_bytes, MonoBoolean p_allow_objects) { Variant ret; - PoolByteArray varr = GDMonoMarshal::mono_array_to_PoolByteArray(p_bytes); - PoolByteArray::Read r = varr.read(); + PackedByteArray varr = GDMonoMarshal::mono_array_to_PackedByteArray(p_bytes); + const uint8_t *r = varr.ptr(); Error err = decode_variant(ret, r.ptr(), varr.size(), NULL, p_allow_objects); if (err != OK) { ret = RTR("Not enough bytes for decoding bytes, or invalid format."); @@ -257,18 +257,18 @@ void godot_icall_GD_pushwarning(MonoString *p_str) { MonoArray *godot_icall_GD_var2bytes(MonoObject *p_var, MonoBoolean p_full_objects) { Variant var = GDMonoMarshal::mono_object_to_variant(p_var); - PoolByteArray barr; + PackedByteArray barr; int len; Error err = encode_variant(var, NULL, len, p_full_objects); ERR_FAIL_COND_V_MSG(err != OK, NULL, "Unexpected error encoding variable to bytes, likely unserializable type found (Object or RID)."); barr.resize(len); { - PoolByteArray::Write w = barr.write(); + uint8_t *w = barr.ptrw(); encode_variant(var, w.ptr(), len, p_full_objects); } - return GDMonoMarshal::PoolByteArray_to_mono_array(barr); + return GDMonoMarshal::PackedByteArray_to_mono_array(barr); } MonoString *godot_icall_GD_var2str(MonoObject *p_var) { diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp index 178647b968..21d78483ee 100644 --- a/modules/mono/mono_gd/gd_mono_field.cpp +++ b/modules/mono/mono_gd/gd_mono_field.cpp @@ -247,37 +247,37 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_ } if (array_type->eklass == CACHED_CLASS_RAW(uint8_t)) { - SET_FROM_ARRAY(PoolByteArray); + SET_FROM_ARRAY(PackedByteArray); break; } if (array_type->eklass == CACHED_CLASS_RAW(int32_t)) { - SET_FROM_ARRAY(PoolIntArray); + SET_FROM_ARRAY(PackedIntArray); break; } if (array_type->eklass == REAL_T_MONOCLASS) { - SET_FROM_ARRAY(PoolRealArray); + SET_FROM_ARRAY(PackedRealArray); break; } if (array_type->eklass == CACHED_CLASS_RAW(String)) { - SET_FROM_ARRAY(PoolStringArray); + SET_FROM_ARRAY(PackedStringArray); break; } if (array_type->eklass == CACHED_CLASS_RAW(Vector2)) { - SET_FROM_ARRAY(PoolVector2Array); + SET_FROM_ARRAY(PackedVector2Array); break; } if (array_type->eklass == CACHED_CLASS_RAW(Vector3)) { - SET_FROM_ARRAY(PoolVector3Array); + SET_FROM_ARRAY(PackedVector3Array); break; } if (array_type->eklass == CACHED_CLASS_RAW(Color)) { - SET_FROM_ARRAY(PoolColorArray); + SET_FROM_ARRAY(PackedColorArray); break; } @@ -434,26 +434,26 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_ MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator Array(), CACHED_CLASS(Array)); mono_field_set_value(p_object, mono_field, managed); } break; - case Variant::POOL_BYTE_ARRAY: { - SET_FROM_ARRAY(PoolByteArray); + case Variant::PACKED_BYTE_ARRAY: { + SET_FROM_ARRAY(PackedByteArray); } break; - case Variant::POOL_INT_ARRAY: { - SET_FROM_ARRAY(PoolIntArray); + case Variant::PACKED_INT_ARRAY: { + SET_FROM_ARRAY(PackedIntArray); } break; - case Variant::POOL_REAL_ARRAY: { - SET_FROM_ARRAY(PoolRealArray); + case Variant::PACKED_REAL_ARRAY: { + SET_FROM_ARRAY(PackedRealArray); } break; - case Variant::POOL_STRING_ARRAY: { - SET_FROM_ARRAY(PoolStringArray); + case Variant::PACKED_STRING_ARRAY: { + SET_FROM_ARRAY(PackedStringArray); } break; - case Variant::POOL_VECTOR2_ARRAY: { - SET_FROM_ARRAY(PoolVector2Array); + case Variant::PACKED_VECTOR2_ARRAY: { + SET_FROM_ARRAY(PackedVector2Array); } break; - case Variant::POOL_VECTOR3_ARRAY: { - SET_FROM_ARRAY(PoolVector3Array); + case Variant::PACKED_VECTOR3_ARRAY: { + SET_FROM_ARRAY(PackedVector3Array); } break; - case Variant::POOL_COLOR_ARRAY: { - SET_FROM_ARRAY(PoolColorArray); + case Variant::PACKED_COLOR_ARRAY: { + SET_FROM_ARRAY(PackedColorArray); } break; default: break; } diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp index 19d627218e..63890f6066 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.cpp +++ b/modules/mono/mono_gd/gd_mono_marshal.cpp @@ -113,25 +113,25 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) { return Variant::ARRAY; if (array_type->eklass == CACHED_CLASS_RAW(uint8_t)) - return Variant::POOL_BYTE_ARRAY; + return Variant::PACKED_BYTE_ARRAY; if (array_type->eklass == CACHED_CLASS_RAW(int32_t)) - return Variant::POOL_INT_ARRAY; + return Variant::PACKED_INT_ARRAY; if (array_type->eklass == REAL_T_MONOCLASS) - return Variant::POOL_REAL_ARRAY; + return Variant::PACKED_REAL_ARRAY; if (array_type->eklass == CACHED_CLASS_RAW(String)) - return Variant::POOL_STRING_ARRAY; + return Variant::PACKED_STRING_ARRAY; if (array_type->eklass == CACHED_CLASS_RAW(Vector2)) - return Variant::POOL_VECTOR2_ARRAY; + return Variant::PACKED_VECTOR2_ARRAY; if (array_type->eklass == CACHED_CLASS_RAW(Vector3)) - return Variant::POOL_VECTOR3_ARRAY; + return Variant::PACKED_VECTOR3_ARRAY; if (array_type->eklass == CACHED_CLASS_RAW(Color)) - return Variant::POOL_COLOR_ARRAY; + return Variant::PACKED_COLOR_ARRAY; } break; case MONO_TYPE_CLASS: { @@ -491,25 +491,25 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty return (MonoObject *)Array_to_mono_array(p_var->operator Array()); if (array_type->eklass == CACHED_CLASS_RAW(uint8_t)) - return (MonoObject *)PoolByteArray_to_mono_array(p_var->operator PoolByteArray()); + return (MonoObject *)PackedByteArray_to_mono_array(p_var->operator PackedByteArray()); if (array_type->eklass == CACHED_CLASS_RAW(int32_t)) - return (MonoObject *)PoolIntArray_to_mono_array(p_var->operator PoolIntArray()); + return (MonoObject *)PackedIntArray_to_mono_array(p_var->operator PackedIntArray()); if (array_type->eklass == REAL_T_MONOCLASS) - return (MonoObject *)PoolRealArray_to_mono_array(p_var->operator PoolRealArray()); + return (MonoObject *)PackedRealArray_to_mono_array(p_var->operator PackedRealArray()); if (array_type->eklass == CACHED_CLASS_RAW(String)) - return (MonoObject *)PoolStringArray_to_mono_array(p_var->operator PoolStringArray()); + return (MonoObject *)PackedStringArray_to_mono_array(p_var->operator PackedStringArray()); if (array_type->eklass == CACHED_CLASS_RAW(Vector2)) - return (MonoObject *)PoolVector2Array_to_mono_array(p_var->operator PoolVector2Array()); + return (MonoObject *)PackedVector2Array_to_mono_array(p_var->operator PackedVector2Array()); if (array_type->eklass == CACHED_CLASS_RAW(Vector3)) - return (MonoObject *)PoolVector3Array_to_mono_array(p_var->operator PoolVector3Array()); + return (MonoObject *)PackedVector3Array_to_mono_array(p_var->operator PackedVector3Array()); if (array_type->eklass == CACHED_CLASS_RAW(Color)) - return (MonoObject *)PoolColorArray_to_mono_array(p_var->operator PoolColorArray()); + return (MonoObject *)PackedColorArray_to_mono_array(p_var->operator PackedColorArray()); ERR_FAIL_V_MSG(NULL, "Attempted to convert Variant to a managed array of unmarshallable element type."); } break; @@ -638,20 +638,20 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty return GDMonoUtils::create_managed_from(p_var->operator Dictionary(), CACHED_CLASS(Dictionary)); case Variant::ARRAY: return GDMonoUtils::create_managed_from(p_var->operator Array(), CACHED_CLASS(Array)); - case Variant::POOL_BYTE_ARRAY: - return (MonoObject *)PoolByteArray_to_mono_array(p_var->operator PoolByteArray()); - case Variant::POOL_INT_ARRAY: - return (MonoObject *)PoolIntArray_to_mono_array(p_var->operator PoolIntArray()); - case Variant::POOL_REAL_ARRAY: - return (MonoObject *)PoolRealArray_to_mono_array(p_var->operator PoolRealArray()); - case Variant::POOL_STRING_ARRAY: - return (MonoObject *)PoolStringArray_to_mono_array(p_var->operator PoolStringArray()); - case Variant::POOL_VECTOR2_ARRAY: - return (MonoObject *)PoolVector2Array_to_mono_array(p_var->operator PoolVector2Array()); - case Variant::POOL_VECTOR3_ARRAY: - return (MonoObject *)PoolVector3Array_to_mono_array(p_var->operator PoolVector3Array()); - case Variant::POOL_COLOR_ARRAY: - return (MonoObject *)PoolColorArray_to_mono_array(p_var->operator PoolColorArray()); + case Variant::PACKED_BYTE_ARRAY: + return (MonoObject *)PackedByteArray_to_mono_array(p_var->operator PackedByteArray()); + case Variant::PACKED_INT_ARRAY: + return (MonoObject *)PackedIntArray_to_mono_array(p_var->operator PackedIntArray()); + case Variant::PACKED_REAL_ARRAY: + return (MonoObject *)PackedRealArray_to_mono_array(p_var->operator PackedRealArray()); + case Variant::PACKED_STRING_ARRAY: + return (MonoObject *)PackedStringArray_to_mono_array(p_var->operator PackedStringArray()); + case Variant::PACKED_VECTOR2_ARRAY: + return (MonoObject *)PackedVector2Array_to_mono_array(p_var->operator PackedVector2Array()); + case Variant::PACKED_VECTOR3_ARRAY: + return (MonoObject *)PackedVector3Array_to_mono_array(p_var->operator PackedVector3Array()); + case Variant::PACKED_COLOR_ARRAY: + return (MonoObject *)PackedColorArray_to_mono_array(p_var->operator PackedColorArray()); default: return NULL; } @@ -785,25 +785,25 @@ Variant mono_object_to_variant_impl(MonoObject *p_obj, const ManagedType &p_type return mono_array_to_Array((MonoArray *)p_obj); if (array_type->eklass == CACHED_CLASS_RAW(uint8_t)) - return mono_array_to_PoolByteArray((MonoArray *)p_obj); + return mono_array_to_PackedByteArray((MonoArray *)p_obj); if (array_type->eklass == CACHED_CLASS_RAW(int32_t)) - return mono_array_to_PoolIntArray((MonoArray *)p_obj); + return mono_array_to_PackedIntArray((MonoArray *)p_obj); if (array_type->eklass == REAL_T_MONOCLASS) - return mono_array_to_PoolRealArray((MonoArray *)p_obj); + return mono_array_to_PackedRealArray((MonoArray *)p_obj); if (array_type->eklass == CACHED_CLASS_RAW(String)) - return mono_array_to_PoolStringArray((MonoArray *)p_obj); + return mono_array_to_PackedStringArray((MonoArray *)p_obj); if (array_type->eklass == CACHED_CLASS_RAW(Vector2)) - return mono_array_to_PoolVector2Array((MonoArray *)p_obj); + return mono_array_to_PackedVector2Array((MonoArray *)p_obj); if (array_type->eklass == CACHED_CLASS_RAW(Vector3)) - return mono_array_to_PoolVector3Array((MonoArray *)p_obj); + return mono_array_to_PackedVector3Array((MonoArray *)p_obj); if (array_type->eklass == CACHED_CLASS_RAW(Color)) - return mono_array_to_PoolColorArray((MonoArray *)p_obj); + return mono_array_to_PackedColorArray((MonoArray *)p_obj); if (p_fail_with_err) { ERR_FAIL_V_MSG(Variant(), "Attempted to convert a managed array of unmarshallable element type to Variant."); @@ -987,8 +987,8 @@ Array mono_array_to_Array(MonoArray *p_array) { // TODO: Use memcpy where possible -MonoArray *PoolIntArray_to_mono_array(const PoolIntArray &p_array) { - PoolIntArray::Read r = p_array.read(); +MonoArray *PackedIntArray_to_mono_array(const PackedIntArray &p_array) { + const int *r = p_array.ptr(); MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(int32_t), p_array.size()); @@ -999,13 +999,13 @@ MonoArray *PoolIntArray_to_mono_array(const PoolIntArray &p_array) { return ret; } -PoolIntArray mono_array_to_PoolIntArray(MonoArray *p_array) { - PoolIntArray ret; +PackedIntArray mono_array_to_PackedIntArray(MonoArray *p_array) { + PackedIntArray ret; if (!p_array) return ret; int length = mono_array_length(p_array); ret.resize(length); - PoolIntArray::Write w = ret.write(); + int *w = ret.ptrw(); for (int i = 0; i < length; i++) { w[i] = mono_array_get(p_array, int32_t, i); @@ -1014,8 +1014,8 @@ PoolIntArray mono_array_to_PoolIntArray(MonoArray *p_array) { return ret; } -MonoArray *PoolByteArray_to_mono_array(const PoolByteArray &p_array) { - PoolByteArray::Read r = p_array.read(); +MonoArray *PackedByteArray_to_mono_array(const PackedByteArray &p_array) { + const uint8_t *r = p_array.ptr(); MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(uint8_t), p_array.size()); @@ -1026,13 +1026,13 @@ MonoArray *PoolByteArray_to_mono_array(const PoolByteArray &p_array) { return ret; } -PoolByteArray mono_array_to_PoolByteArray(MonoArray *p_array) { - PoolByteArray ret; +PackedByteArray mono_array_to_PackedByteArray(MonoArray *p_array) { + PackedByteArray ret; if (!p_array) return ret; int length = mono_array_length(p_array); ret.resize(length); - PoolByteArray::Write w = ret.write(); + uint8_t *w = ret.ptrw(); for (int i = 0; i < length; i++) { w[i] = mono_array_get(p_array, uint8_t, i); @@ -1041,8 +1041,8 @@ PoolByteArray mono_array_to_PoolByteArray(MonoArray *p_array) { return ret; } -MonoArray *PoolRealArray_to_mono_array(const PoolRealArray &p_array) { - PoolRealArray::Read r = p_array.read(); +MonoArray *PackedRealArray_to_mono_array(const PackedRealArray &p_array) { + const real_t *r = p_array.ptr(); MonoArray *ret = mono_array_new(mono_domain_get(), REAL_T_MONOCLASS, p_array.size()); @@ -1053,13 +1053,13 @@ MonoArray *PoolRealArray_to_mono_array(const PoolRealArray &p_array) { return ret; } -PoolRealArray mono_array_to_PoolRealArray(MonoArray *p_array) { - PoolRealArray ret; +PackedRealArray mono_array_to_PackedRealArray(MonoArray *p_array) { + PackedRealArray ret; if (!p_array) return ret; int length = mono_array_length(p_array); ret.resize(length); - PoolRealArray::Write w = ret.write(); + real_t *w = ret.ptrw(); for (int i = 0; i < length; i++) { w[i] = mono_array_get(p_array, real_t, i); @@ -1068,8 +1068,8 @@ PoolRealArray mono_array_to_PoolRealArray(MonoArray *p_array) { return ret; } -MonoArray *PoolStringArray_to_mono_array(const PoolStringArray &p_array) { - PoolStringArray::Read r = p_array.read(); +MonoArray *PackedStringArray_to_mono_array(const PackedStringArray &p_array) { + const String *r = p_array.ptr(); MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(String), p_array.size()); @@ -1081,13 +1081,13 @@ MonoArray *PoolStringArray_to_mono_array(const PoolStringArray &p_array) { return ret; } -PoolStringArray mono_array_to_PoolStringArray(MonoArray *p_array) { - PoolStringArray ret; +PackedStringArray mono_array_to_PackedStringArray(MonoArray *p_array) { + PackedStringArray ret; if (!p_array) return ret; int length = mono_array_length(p_array); ret.resize(length); - PoolStringArray::Write w = ret.write(); + String *w = ret.ptrw(); for (int i = 0; i < length; i++) { MonoString *elem = mono_array_get(p_array, MonoString *, i); @@ -1097,8 +1097,8 @@ PoolStringArray mono_array_to_PoolStringArray(MonoArray *p_array) { return ret; } -MonoArray *PoolColorArray_to_mono_array(const PoolColorArray &p_array) { - PoolColorArray::Read r = p_array.read(); +MonoArray *PackedColorArray_to_mono_array(const PackedColorArray &p_array) { + const Color *r = p_array.ptr(); MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(Color), p_array.size()); @@ -1110,13 +1110,13 @@ MonoArray *PoolColorArray_to_mono_array(const PoolColorArray &p_array) { return ret; } -PoolColorArray mono_array_to_PoolColorArray(MonoArray *p_array) { - PoolColorArray ret; +PackedColorArray mono_array_to_PackedColorArray(MonoArray *p_array) { + PackedColorArray ret; if (!p_array) return ret; int length = mono_array_length(p_array); ret.resize(length); - PoolColorArray::Write w = ret.write(); + Color *w = ret.ptrw(); for (int i = 0; i < length; i++) { w[i] = MARSHALLED_IN(Color, (M_Color *)mono_array_addr_with_size(p_array, sizeof(M_Color), i)); @@ -1125,8 +1125,8 @@ PoolColorArray mono_array_to_PoolColorArray(MonoArray *p_array) { return ret; } -MonoArray *PoolVector2Array_to_mono_array(const PoolVector2Array &p_array) { - PoolVector2Array::Read r = p_array.read(); +MonoArray *PackedVector2Array_to_mono_array(const PackedVector2Array &p_array) { + const Vector2 *r = p_array.ptr(); MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(Vector2), p_array.size()); @@ -1138,13 +1138,13 @@ MonoArray *PoolVector2Array_to_mono_array(const PoolVector2Array &p_array) { return ret; } -PoolVector2Array mono_array_to_PoolVector2Array(MonoArray *p_array) { - PoolVector2Array ret; +PackedVector2Array mono_array_to_PackedVector2Array(MonoArray *p_array) { + PackedVector2Array ret; if (!p_array) return ret; int length = mono_array_length(p_array); ret.resize(length); - PoolVector2Array::Write w = ret.write(); + Vector2 *w = ret.ptrw(); for (int i = 0; i < length; i++) { w[i] = MARSHALLED_IN(Vector2, (M_Vector2 *)mono_array_addr_with_size(p_array, sizeof(M_Vector2), i)); @@ -1153,8 +1153,8 @@ PoolVector2Array mono_array_to_PoolVector2Array(MonoArray *p_array) { return ret; } -MonoArray *PoolVector3Array_to_mono_array(const PoolVector3Array &p_array) { - PoolVector3Array::Read r = p_array.read(); +MonoArray *PackedVector3Array_to_mono_array(const PackedVector3Array &p_array) { + const Vector3 *r = p_array.ptr(); MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(Vector3), p_array.size()); @@ -1166,13 +1166,13 @@ MonoArray *PoolVector3Array_to_mono_array(const PoolVector3Array &p_array) { return ret; } -PoolVector3Array mono_array_to_PoolVector3Array(MonoArray *p_array) { - PoolVector3Array ret; +PackedVector3Array mono_array_to_PackedVector3Array(MonoArray *p_array) { + PackedVector3Array ret; if (!p_array) return ret; int length = mono_array_length(p_array); ret.resize(length); - PoolVector3Array::Write w = ret.write(); + Vector3 *w = ret.ptrw(); for (int i = 0; i < length; i++) { w[i] = MARSHALLED_IN(Vector3, (M_Vector3 *)mono_array_addr_with_size(p_array, sizeof(M_Vector3), i)); diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h index e662e7814e..d3527109ff 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.h +++ b/modules/mono/mono_gd/gd_mono_marshal.h @@ -127,40 +127,40 @@ String mono_object_to_variant_string(MonoObject *p_obj, MonoException **r_exc); MonoArray *Array_to_mono_array(const Array &p_array); Array mono_array_to_Array(MonoArray *p_array); -// PoolIntArray +// PackedIntArray -MonoArray *PoolIntArray_to_mono_array(const PoolIntArray &p_array); -PoolIntArray mono_array_to_PoolIntArray(MonoArray *p_array); +MonoArray *PackedIntArray_to_mono_array(const PackedIntArray &p_array); +PackedIntArray mono_array_to_PackedIntArray(MonoArray *p_array); -// PoolByteArray +// PackedByteArray -MonoArray *PoolByteArray_to_mono_array(const PoolByteArray &p_array); -PoolByteArray mono_array_to_PoolByteArray(MonoArray *p_array); +MonoArray *PackedByteArray_to_mono_array(const PackedByteArray &p_array); +PackedByteArray mono_array_to_PackedByteArray(MonoArray *p_array); -// PoolRealArray +// PackedRealArray -MonoArray *PoolRealArray_to_mono_array(const PoolRealArray &p_array); -PoolRealArray mono_array_to_PoolRealArray(MonoArray *p_array); +MonoArray *PackedRealArray_to_mono_array(const PackedRealArray &p_array); +PackedRealArray mono_array_to_PackedRealArray(MonoArray *p_array); -// PoolStringArray +// PackedStringArray -MonoArray *PoolStringArray_to_mono_array(const PoolStringArray &p_array); -PoolStringArray mono_array_to_PoolStringArray(MonoArray *p_array); +MonoArray *PackedStringArray_to_mono_array(const PackedStringArray &p_array); +PackedStringArray mono_array_to_PackedStringArray(MonoArray *p_array); -// PoolColorArray +// PackedColorArray -MonoArray *PoolColorArray_to_mono_array(const PoolColorArray &p_array); -PoolColorArray mono_array_to_PoolColorArray(MonoArray *p_array); +MonoArray *PackedColorArray_to_mono_array(const PackedColorArray &p_array); +PackedColorArray mono_array_to_PackedColorArray(MonoArray *p_array); -// PoolVector2Array +// PackedVector2Array -MonoArray *PoolVector2Array_to_mono_array(const PoolVector2Array &p_array); -PoolVector2Array mono_array_to_PoolVector2Array(MonoArray *p_array); +MonoArray *PackedVector2Array_to_mono_array(const PackedVector2Array &p_array); +PackedVector2Array mono_array_to_PackedVector2Array(MonoArray *p_array); -// PoolVector3Array +// PackedVector3Array -MonoArray *PoolVector3Array_to_mono_array(const PoolVector3Array &p_array); -PoolVector3Array mono_array_to_PoolVector3Array(MonoArray *p_array); +MonoArray *PackedVector3Array_to_mono_array(const PackedVector3Array &p_array); +PackedVector3Array mono_array_to_PackedVector3Array(MonoArray *p_array); // Structures diff --git a/modules/mono/utils/string_utils.cpp b/modules/mono/utils/string_utils.cpp index 911ac5c4a3..49c4fb3f73 100644 --- a/modules/mono/utils/string_utils.cpp +++ b/modules/mono/utils/string_utils.cpp @@ -162,22 +162,22 @@ String escape_csharp_keyword(const String &p_name) { #endif Error read_all_file_utf8(const String &p_path, String &r_content) { - PoolVector<uint8_t> sourcef; + Vector<uint8_t> sourcef; Error err; FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err); ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot open file '" + 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 source; - if (source.parse_utf8((const char *)w.ptr())) { + if (source.parse_utf8((const char *)w)) { ERR_FAIL_V(ERR_INVALID_DATA); } diff --git a/modules/opensimplex/open_simplex_noise.cpp b/modules/opensimplex/open_simplex_noise.cpp index bd187e6b5b..bd2dbd74a8 100644 --- a/modules/opensimplex/open_simplex_noise.cpp +++ b/modules/opensimplex/open_simplex_noise.cpp @@ -98,10 +98,10 @@ void OpenSimplexNoise::set_lacunarity(float p_lacunarity) { Ref<Image> OpenSimplexNoise::get_image(int p_width, int p_height) { - PoolVector<uint8_t> data; + Vector<uint8_t> data; data.resize(p_width * p_height * 4); - PoolVector<uint8_t>::Write wd8 = data.write(); + uint8_t *wd8 = data.ptrw(); for (int i = 0; i < p_height; i++) { for (int j = 0; j < p_width; j++) { @@ -121,10 +121,10 @@ Ref<Image> OpenSimplexNoise::get_image(int p_width, int p_height) { Ref<Image> OpenSimplexNoise::get_seamless_image(int p_size) { - PoolVector<uint8_t> data; + Vector<uint8_t> data; data.resize(p_size * p_size * 4); - PoolVector<uint8_t>::Write wd8 = data.write(); + uint8_t *wd8 = data.ptrw(); for (int i = 0; i < p_size; i++) { for (int j = 0; j < p_size; j++) { diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp index 36f2fe1ba1..dab4f64393 100644 --- a/modules/pvr/texture_loader_pvr.cpp +++ b/modules/pvr/texture_loader_pvr.cpp @@ -96,12 +96,12 @@ RES ResourceFormatPVR::load(const String &p_path, const String &p_original_path, print_line("surfcount: "+itos(surfcount)); */ - PoolVector<uint8_t> data; + Vector<uint8_t> data; data.resize(surfsize); ERR_FAIL_COND_V(data.size() == 0, RES()); - PoolVector<uint8_t>::Write w = data.write(); + uint8_t *w = data.ptrw(); f->get_buffer(&w[0], surfsize); err = f->get_error(); ERR_FAIL_COND_V(err != OK, RES()); @@ -152,8 +152,6 @@ RES ResourceFormatPVR::load(const String &p_path, const String &p_original_path, ERR_FAIL_V_MSG(RES(), "Unsupported format in PVR texture: " + itos(flags & 0xFF) + "."); } - w.release(); - Ref<Image> image = memnew(Image(width, height, mipmaps, format, data)); ERR_FAIL_COND_V(image->empty(), RES()); @@ -200,10 +198,10 @@ static void _compress_pvrtc4(Image *p_img) { new_img.instance(); new_img->create(img->get_width(), img->get_height(), img->has_mipmaps(), use_alpha ? Image::FORMAT_PVRTC4A : Image::FORMAT_PVRTC4); - PoolVector<uint8_t> data = new_img->get_data(); + Vector<uint8_t> data = new_img->get_data(); { - PoolVector<uint8_t>::Write wr = data.write(); - PoolVector<uint8_t>::Read r = img->get_data().read(); + uint8_t *wr = data.ptrw(); + const uint8_t *r = img->get_data().ptr(); for (int i = 0; i <= new_img->get_mipmap_count(); i++) { @@ -640,17 +638,14 @@ static void _pvrtc_decompress(Image *p_img) { bool _2bit = (p_img->get_format() == Image::FORMAT_PVRTC2 || p_img->get_format() == Image::FORMAT_PVRTC2A); - PoolVector<uint8_t> data = p_img->get_data(); - PoolVector<uint8_t>::Read r = data.read(); + Vector<uint8_t> data = p_img->get_data(); + const uint8_t *r = data.ptr(); - PoolVector<uint8_t> newdata; + Vector<uint8_t> newdata; newdata.resize(p_img->get_width() * p_img->get_height() * 4); - PoolVector<uint8_t>::Write w = newdata.write(); - - decompress_pvrtc((PVRTCBlock *)r.ptr(), _2bit, p_img->get_width(), p_img->get_height(), 0, (unsigned char *)w.ptr()); + uint8_t *w = newdata.ptrw(); - w.release(); - r.release(); + decompress_pvrtc((PVRTCBlock *)r, _2bit, p_img->get_width(), p_img->get_height(), 0, (unsigned char *)w); bool make_mipmaps = p_img->has_mipmaps(); p_img->create(p_img->get_width(), p_img->get_height(), false, Image::FORMAT_RGBA8, newdata); diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp index 2f680fd3d0..bb77f68590 100644 --- a/modules/squish/image_compress_squish.cpp +++ b/modules/squish/image_compress_squish.cpp @@ -37,13 +37,13 @@ void image_decompress_squish(Image *p_image) { int h = p_image->get_height(); Image::Format target_format = Image::FORMAT_RGBA8; - PoolVector<uint8_t> data; + Vector<uint8_t> data; int target_size = Image::get_image_data_size(w, h, target_format, p_image->has_mipmaps()); int mm_count = p_image->get_mipmap_count(); data.resize(target_size); - PoolVector<uint8_t>::Read rb = p_image->get_data().read(); - PoolVector<uint8_t>::Write wb = data.write(); + const uint8_t *rb = p_image->get_data().ptr(); + uint8_t *wb = data.ptrw(); int squish_flags = Image::FORMAT_MAX; if (p_image->get_format() == Image::FORMAT_DXT1) { @@ -137,14 +137,14 @@ void image_compress_squish(Image *p_image, float p_lossy_quality, Image::UsedCha } } - PoolVector<uint8_t> data; + Vector<uint8_t> data; int target_size = Image::get_image_data_size(w, h, target_format, p_image->has_mipmaps()); int mm_count = p_image->has_mipmaps() ? Image::get_image_required_mipmaps(w, h, target_format) : 0; data.resize(target_size); int shift = Image::get_format_pixel_rshift(target_format); - PoolVector<uint8_t>::Read rb = p_image->get_data().read(); - PoolVector<uint8_t>::Write wb = data.write(); + const uint8_t *rb = p_image->get_data().ptr(); + uint8_t *wb = data.ptrw(); int dst_ofs = 0; @@ -160,9 +160,6 @@ void image_compress_squish(Image *p_image, float p_lossy_quality, Image::UsedCha h = MAX(h / 2, 1); } - rb.release(); - wb.release(); - p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data); } } diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp index f2d0f5c9a6..6224db90e7 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp @@ -163,32 +163,32 @@ void AudioStreamOGGVorbis::clear_data() { } } -void AudioStreamOGGVorbis::set_data(const PoolVector<uint8_t> &p_data) { +void AudioStreamOGGVorbis::set_data(const Vector<uint8_t> &p_data) { int src_data_len = p_data.size(); #define MAX_TEST_MEM (1 << 20) uint32_t alloc_try = 1024; - PoolVector<char> alloc_mem; - PoolVector<char>::Write w; + Vector<char> alloc_mem; + char *w; stb_vorbis *ogg_stream = NULL; stb_vorbis_alloc ogg_alloc; while (alloc_try < MAX_TEST_MEM) { alloc_mem.resize(alloc_try); - w = alloc_mem.write(); + w = alloc_mem.ptrw(); - ogg_alloc.alloc_buffer = w.ptr(); + ogg_alloc.alloc_buffer = w; ogg_alloc.alloc_buffer_length_in_bytes = alloc_try; - PoolVector<uint8_t>::Read src_datar = p_data.read(); + const uint8_t *src_datar = p_data.ptr(); int error; - ogg_stream = stb_vorbis_open_memory((const unsigned char *)src_datar.ptr(), src_data_len, &error, &ogg_alloc); + ogg_stream = stb_vorbis_open_memory((const unsigned char *)src_datar, src_data_len, &error, &ogg_alloc); if (!ogg_stream && error == VORBIS_outofmem) { - w.release(); + alloc_try *= 2; } else { @@ -209,7 +209,7 @@ void AudioStreamOGGVorbis::set_data(const PoolVector<uint8_t> &p_data) { // free any existing data clear_data(); - data = AudioServer::get_singleton()->audio_data_alloc(src_data_len, src_datar.ptr()); + data = AudioServer::get_singleton()->audio_data_alloc(src_data_len, src_datar); data_len = src_data_len; break; @@ -217,15 +217,15 @@ void AudioStreamOGGVorbis::set_data(const PoolVector<uint8_t> &p_data) { } } -PoolVector<uint8_t> AudioStreamOGGVorbis::get_data() const { +Vector<uint8_t> AudioStreamOGGVorbis::get_data() const { - PoolVector<uint8_t> vdata; + Vector<uint8_t> vdata; if (data_len && data) { vdata.resize(data_len); { - PoolVector<uint8_t>::Write w = vdata.write(); - copymem(w.ptr(), data, data_len); + uint8_t *w = vdata.ptrw(); + copymem(w, data, data_len); } } @@ -265,7 +265,7 @@ void AudioStreamOGGVorbis::_bind_methods() { ClassDB::bind_method(D_METHOD("set_loop_offset", "seconds"), &AudioStreamOGGVorbis::set_loop_offset); ClassDB::bind_method(D_METHOD("get_loop_offset"), &AudioStreamOGGVorbis::get_loop_offset); - 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::BOOL, "loop"), "set_loop", "has_loop"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "loop_offset"), "set_loop_offset", "get_loop_offset"); } diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.h b/modules/stb_vorbis/audio_stream_ogg_vorbis.h index e909759acb..f296e8c19f 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.h +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.h @@ -102,8 +102,8 @@ public: virtual Ref<AudioStreamPlayback> instance_playback(); virtual String get_stream_name() const; - 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; virtual float get_length() const; //if supported, otherwise return 0 diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp index 06399f4005..ec89f2ac76 100644 --- a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp +++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp @@ -87,11 +87,11 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin size_t len = f->get_len(); - PoolVector<uint8_t> data; + Vector<uint8_t> data; data.resize(len); - PoolVector<uint8_t>::Write w = data.write(); + uint8_t *w = data.ptrw(); - f->get_buffer(w.ptr(), len); + f->get_buffer(w, len); memdelete(f); diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp index 7f91908a33..e9d30d015a 100644 --- a/modules/svg/image_loader_svg.cpp +++ b/modules/svg/image_loader_svg.cpp @@ -94,10 +94,10 @@ void ImageLoaderSVG::set_convert_colors(Dictionary *p_replace_color) { } } -Error ImageLoaderSVG::_create_image(Ref<Image> p_image, const PoolVector<uint8_t> *p_data, float p_scale, bool upsample, bool convert_colors) { +Error ImageLoaderSVG::_create_image(Ref<Image> p_image, const Vector<uint8_t> *p_data, float p_scale, bool upsample, bool convert_colors) { NSVGimage *svg_image; - PoolVector<uint8_t>::Read src_r = p_data->read(); - svg_image = nsvgParse((char *)src_r.ptr(), "px", 96); + const uint8_t *src_r = p_data->ptr(); + svg_image = nsvgParse((char *)src_r, "px", 96); if (svg_image == NULL) { ERR_PRINT("SVG Corrupted"); return ERR_FILE_CORRUPT; @@ -115,14 +115,13 @@ Error ImageLoaderSVG::_create_image(Ref<Image> p_image, const PoolVector<uint8_t const int h = (int)(svg_image->height * p_scale * upscale); ERR_FAIL_COND_V_MSG(h > Image::MAX_HEIGHT, ERR_PARAMETER_RANGE_ERROR, vformat("Can't create image from SVG with scale %s, the resulting image size exceeds max height.", rtos(p_scale))); - PoolVector<uint8_t> dst_image; + Vector<uint8_t> dst_image; dst_image.resize(w * h * 4); - PoolVector<uint8_t>::Write dw = dst_image.write(); + uint8_t *dw = dst_image.ptrw(); - rasterizer.rasterize(svg_image, 0, 0, p_scale * upscale, (unsigned char *)dw.ptr(), w, h, w * 4); + rasterizer.rasterize(svg_image, 0, 0, p_scale * upscale, (unsigned char *)dw, w, h, w * 4); - dw.release(); p_image->create(w, h, false, Image::FORMAT_RGBA8, dst_image); if (upsample) { p_image->shrink_x2(); @@ -136,10 +135,10 @@ Error ImageLoaderSVG::_create_image(Ref<Image> p_image, const PoolVector<uint8_t Error ImageLoaderSVG::create_image_from_string(Ref<Image> p_image, const char *p_svg_str, float p_scale, bool upsample, bool convert_colors) { size_t str_len = strlen(p_svg_str); - PoolVector<uint8_t> src_data; + Vector<uint8_t> src_data; src_data.resize(str_len + 1); - PoolVector<uint8_t>::Write src_w = src_data.write(); - memcpy(src_w.ptr(), p_svg_str, str_len + 1); + uint8_t *src_w = src_data.ptrw(); + memcpy(src_w, p_svg_str, str_len + 1); return _create_image(p_image, &src_data, p_scale, upsample, convert_colors); } @@ -147,11 +146,11 @@ Error ImageLoaderSVG::create_image_from_string(Ref<Image> p_image, const char *p Error ImageLoaderSVG::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale) { uint32_t size = f->get_len(); - PoolVector<uint8_t> src_image; + Vector<uint8_t> src_image; src_image.resize(size + 1); - PoolVector<uint8_t>::Write src_w = src_image.write(); - f->get_buffer(src_w.ptr(), size); - src_w.ptr()[size] = '\0'; + uint8_t *src_w = src_image.ptrw(); + f->get_buffer(src_w, size); + src_w[size] = '\0'; return _create_image(p_image, &src_image, p_scale, 1.0); } diff --git a/modules/svg/image_loader_svg.h b/modules/svg/image_loader_svg.h index 24cee82480..def2885199 100644 --- a/modules/svg/image_loader_svg.h +++ b/modules/svg/image_loader_svg.h @@ -60,7 +60,7 @@ class ImageLoaderSVG : public ImageFormatLoader { } replace_colors; static SVGRasterizer rasterizer; static void _convert_colors(NSVGimage *p_svg_image); - static Error _create_image(Ref<Image> p_image, const PoolVector<uint8_t> *p_data, float p_scale, bool upsample, bool convert_colors = false); + static Error _create_image(Ref<Image> p_image, const Vector<uint8_t> *p_data, float p_scale, bool upsample, bool convert_colors = false); public: static void set_convert_colors(Dictionary *p_replace_color = NULL); diff --git a/modules/tga/image_loader_tga.cpp b/modules/tga/image_loader_tga.cpp index 480016eb97..0e904fdd76 100644 --- a/modules/tga/image_loader_tga.cpp +++ b/modules/tga/image_loader_tga.cpp @@ -36,12 +36,12 @@ Error ImageLoaderTGA::decode_tga_rle(const uint8_t *p_compressed_buffer, size_t p_pixel_size, uint8_t *p_uncompressed_buffer, size_t p_output_size) { Error error; - PoolVector<uint8_t> pixels; + Vector<uint8_t> pixels; error = pixels.resize(p_pixel_size); if (error != OK) return error; - PoolVector<uint8_t>::Write pixels_w = pixels.write(); + uint8_t *pixels_w = pixels.ptrw(); size_t compressed_pos = 0; size_t output_pos = 0; @@ -55,12 +55,12 @@ Error ImageLoaderTGA::decode_tga_rle(const uint8_t *p_compressed_buffer, size_t if (c & 0x80) { for (size_t i = 0; i < p_pixel_size; i++) { - pixels_w.ptr()[i] = p_compressed_buffer[compressed_pos]; + pixels_w[i] = p_compressed_buffer[compressed_pos]; compressed_pos += 1; } for (size_t i = 0; i < count; i++) { for (size_t j = 0; j < p_pixel_size; j++) { - p_uncompressed_buffer[output_pos + j] = pixels_w.ptr()[j]; + p_uncompressed_buffer[output_pos + j] = pixels_w[j]; } output_pos += p_pixel_size; } @@ -116,9 +116,9 @@ Error ImageLoaderTGA::convert_to_image(Ref<Image> p_image, const uint8_t *p_buff x_end = -1; } - PoolVector<uint8_t> image_data; + Vector<uint8_t> image_data; image_data.resize(width * height * sizeof(uint32_t)); - PoolVector<uint8_t>::Write image_data_w = image_data.write(); + uint8_t *image_data_w = image_data.ptrw(); size_t i = 0; uint32_t x = x_start; @@ -199,8 +199,6 @@ Error ImageLoaderTGA::convert_to_image(Ref<Image> p_image, const uint8_t *p_buff } } - image_data_w.release(); - p_image->create(width, height, 0, Image::FORMAT_RGBA8, image_data); return OK; @@ -208,7 +206,7 @@ Error ImageLoaderTGA::convert_to_image(Ref<Image> p_image, const uint8_t *p_buff Error ImageLoaderTGA::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale) { - PoolVector<uint8_t> src_image; + Vector<uint8_t> src_image; int src_image_len = f->get_len(); ERR_FAIL_COND_V(src_image_len == 0, ERR_FILE_CORRUPT); ERR_FAIL_COND_V(src_image_len < (int)sizeof(tga_header_s), ERR_FILE_CORRUPT); @@ -259,49 +257,49 @@ Error ImageLoaderTGA::load_image(Ref<Image> p_image, FileAccess *f, bool p_force if (err == OK) { f->seek(f->get_position() + tga_header.id_length); - PoolVector<uint8_t> palette; + Vector<uint8_t> palette; if (has_color_map) { size_t color_map_size = tga_header.color_map_length * (tga_header.color_map_depth >> 3); err = palette.resize(color_map_size); if (err == OK) { - PoolVector<uint8_t>::Write palette_w = palette.write(); + uint8_t *palette_w = palette.ptrw(); f->get_buffer(&palette_w[0], color_map_size); } else { return OK; } } - PoolVector<uint8_t>::Write src_image_w = src_image.write(); + uint8_t *src_image_w = src_image.ptrw(); f->get_buffer(&src_image_w[0], src_image_len - f->get_position()); - PoolVector<uint8_t>::Read src_image_r = src_image.read(); + const uint8_t *src_image_r = src_image.ptr(); const size_t pixel_size = tga_header.pixel_depth >> 3; const size_t buffer_size = (tga_header.image_width * tga_header.image_height) * pixel_size; - PoolVector<uint8_t> uncompressed_buffer; + Vector<uint8_t> uncompressed_buffer; uncompressed_buffer.resize(buffer_size); - PoolVector<uint8_t>::Write uncompressed_buffer_w = uncompressed_buffer.write(); - PoolVector<uint8_t>::Read uncompressed_buffer_r; + uint8_t *uncompressed_buffer_w = uncompressed_buffer.ptrw(); + const uint8_t *uncompressed_buffer_r; const uint8_t *buffer = NULL; if (is_encoded) { - err = decode_tga_rle(src_image_r.ptr(), pixel_size, uncompressed_buffer_w.ptr(), buffer_size); + err = decode_tga_rle(src_image_r, pixel_size, uncompressed_buffer_w, buffer_size); if (err == OK) { - uncompressed_buffer_r = uncompressed_buffer.read(); - buffer = uncompressed_buffer_r.ptr(); + uncompressed_buffer_r = uncompressed_buffer.ptr(); + buffer = uncompressed_buffer_r; } } else { - buffer = src_image_r.ptr(); + buffer = src_image_r; }; if (err == OK) { - PoolVector<uint8_t>::Read palette_r = palette.read(); - err = convert_to_image(p_image, buffer, tga_header, palette_r.ptr(), is_monochrome); + const uint8_t *palette_r = palette.ptr(); + err = convert_to_image(p_image, buffer, tga_header, palette_r, is_monochrome); } } diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index de229745f5..a44ed0304d 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -87,8 +87,8 @@ void VideoStreamPlaybackTheora::video_write(void) { int pitch = 4; frame_data.resize(size.x * size.y * pitch); { - PoolVector<uint8_t>::Write w = frame_data.write(); - char *dst = (char *)w.ptr(); + uint8_t *w = frame_data.ptrw(); + char *dst = (char *)w; //uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y/2); diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h index c0a0faec4b..258b3a1cce 100644 --- a/modules/theora/video_stream_theora.h +++ b/modules/theora/video_stream_theora.h @@ -54,7 +54,7 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback { //Image frames[MAX_FRAMES]; Image::Format format; - PoolVector<uint8_t> frame_data; + Vector<uint8_t> frame_data; int frames_pending; FileAccess *file; String file_name; diff --git a/modules/tinyexr/image_loader_tinyexr.cpp b/modules/tinyexr/image_loader_tinyexr.cpp index 79cb135abb..41938f5b42 100644 --- a/modules/tinyexr/image_loader_tinyexr.cpp +++ b/modules/tinyexr/image_loader_tinyexr.cpp @@ -37,12 +37,12 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale) { - PoolVector<uint8_t> src_image; + Vector<uint8_t> src_image; int src_image_len = f->get_len(); ERR_FAIL_COND_V(src_image_len == 0, ERR_FILE_CORRUPT); src_image.resize(src_image_len); - PoolVector<uint8_t>::Write w = src_image.write(); + uint8_t *w = src_image.ptrw(); f->get_buffer(&w[0], src_image_len); @@ -60,13 +60,13 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f InitEXRHeader(&exr_header); - int ret = ParseEXRVersionFromMemory(&exr_version, w.ptr(), src_image_len); + int ret = ParseEXRVersionFromMemory(&exr_version, w, src_image_len); if (ret != TINYEXR_SUCCESS) { return ERR_FILE_CORRUPT; } - ret = ParseEXRHeaderFromMemory(&exr_header, &exr_version, w.ptr(), src_image_len, &err); + ret = ParseEXRHeaderFromMemory(&exr_header, &exr_version, w, src_image_len, &err); if (ret != TINYEXR_SUCCESS) { if (err) { ERR_PRINT(String(err)); @@ -82,7 +82,7 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f } InitEXRImage(&exr_image); - ret = LoadEXRImageFromMemory(&exr_image, &exr_header, w.ptr(), src_image_len, &err); + ret = LoadEXRImageFromMemory(&exr_image, &exr_header, w, src_image_len, &err); if (ret != TINYEXR_SUCCESS) { if (err) { ERR_PRINT(String(err)); @@ -136,7 +136,7 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f // EXR image data loaded, now parse it into Godot-friendly image data - PoolVector<uint8_t> imgdata; + Vector<uint8_t> imgdata; Image::Format format; int output_channels = 0; @@ -180,8 +180,8 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f } { - PoolVector<uint8_t>::Write wd = imgdata.write(); - uint16_t *iw = (uint16_t *)wd.ptr(); + uint8_t *wd = imgdata.ptrw(); + uint16_t *iw = (uint16_t *)wd; // Assume `out_rgba` have enough memory allocated. for (int tile_index = 0; tile_index < num_tiles; tile_index++) { @@ -235,8 +235,6 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f p_image->create(exr_image.width, exr_image.height, false, format, imgdata); - w.release(); - FreeEXRHeader(&exr_header); FreeEXRImage(&exr_image); diff --git a/modules/tinyexr/image_saver_tinyexr.cpp b/modules/tinyexr/image_saver_tinyexr.cpp index a0c01f7e65..05080289bd 100644 --- a/modules/tinyexr/image_saver_tinyexr.cpp +++ b/modules/tinyexr/image_saver_tinyexr.cpp @@ -159,7 +159,7 @@ Error save_exr(const String &p_path, const Ref<Image> &p_img, bool p_grayscale) // Godot does not support more than 4 channels, // so we can preallocate header infos on the stack and use only the subset we need - PoolByteArray channels[max_channels]; + PackedByteArray channels[max_channels]; unsigned char *channels_ptrs[max_channels]; EXRChannelInfo channel_infos[max_channels]; int pixel_types[max_channels]; @@ -188,25 +188,25 @@ Error save_exr(const String &p_path, const Ref<Image> &p_img, bool p_grayscale) const int *channel_mapping = channel_mappings[channel_count - 1]; { - PoolByteArray src_data = p_img->get_data(); - PoolByteArray::Read src_r = src_data.read(); + PackedByteArray src_data = p_img->get_data(); + const uint8_t *src_r = src_data.ptr(); for (int channel_index = 0; channel_index < channel_count; ++channel_index) { // De-interleave channels - PoolByteArray &dst = channels[channel_index]; + PackedByteArray &dst = channels[channel_index]; dst.resize(pixel_count * target_pixel_type_size); - PoolByteArray::Write dst_w = dst.write(); + uint8_t *dst_w = dst.ptrw(); if (src_pixel_type == SRC_FLOAT && target_pixel_type == TINYEXR_PIXELTYPE_FLOAT) { // Note: we don't save mipmaps CRASH_COND(src_data.size() < pixel_count * channel_count * target_pixel_type_size); - const float *src_rp = (float *)src_r.ptr(); - float *dst_wp = (float *)dst_w.ptr(); + const float *src_rp = (float *)src_r; + float *dst_wp = (float *)dst_w; for (int i = 0; i < pixel_count; ++i) { dst_wp[i] = src_rp[channel_index + i * channel_count]; @@ -216,8 +216,8 @@ Error save_exr(const String &p_path, const Ref<Image> &p_img, bool p_grayscale) CRASH_COND(src_data.size() < pixel_count * channel_count * target_pixel_type_size); - const uint16_t *src_rp = (uint16_t *)src_r.ptr(); - uint16_t *dst_wp = (uint16_t *)dst_w.ptr(); + const uint16_t *src_rp = (uint16_t *)src_r; + uint16_t *dst_wp = (uint16_t *)dst_w; for (int i = 0; i < pixel_count; ++i) { dst_wp[i] = src_rp[channel_index + i * channel_count]; @@ -227,8 +227,8 @@ Error save_exr(const String &p_path, const Ref<Image> &p_img, bool p_grayscale) CRASH_COND(src_data.size() < pixel_count * channel_count); - const uint8_t *src_rp = (uint8_t *)src_r.ptr(); - uint16_t *dst_wp = (uint16_t *)dst_w.ptr(); + const uint8_t *src_rp = (uint8_t *)src_r; + uint16_t *dst_wp = (uint16_t *)dst_w; for (int i = 0; i < pixel_count; ++i) { dst_wp[i] = Math::make_half_float(src_rp[channel_index + i * channel_count] / 255.f); @@ -240,7 +240,7 @@ Error save_exr(const String &p_path, const Ref<Image> &p_img, bool p_grayscale) int remapped_index = channel_mapping[channel_index]; - channels_ptrs[remapped_index] = dst_w.ptr(); + channels_ptrs[remapped_index] = dst_w; // No conversion pixel_types[remapped_index] = target_pixel_type; diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index e712190344..762566e9ae 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -2584,7 +2584,7 @@ int VisualScriptLanguage::find_function(const String &p_function, const String & return -1; } -String VisualScriptLanguage::make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const { +String VisualScriptLanguage::make_function(const String &p_class, const String &p_name, const PackedStringArray &p_args) const { return String(); } diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index d3569bb040..cc77f9d891 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -599,7 +599,7 @@ public: virtual bool has_named_classes() const; virtual bool supports_builtin_mode() const; virtual int find_function(const String &p_function, const String &p_code) const; - virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const; + virtual String make_function(const String &p_class, const String &p_name, const PackedStringArray &p_args) const; virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const; virtual void add_global_constant(const StringName &p_variable, const Variant &p_value); diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index 832c4c2cc4..e6c95c38b8 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -467,7 +467,7 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const case BYTES_TO_VAR: { if (p_idx == 0) - return PropertyInfo(Variant::POOL_BYTE_ARRAY, "bytes"); + return PropertyInfo(Variant::PACKED_BYTE_ARRAY, "bytes"); else return PropertyInfo(Variant::BOOL, "allow_objects"); } break; @@ -632,7 +632,7 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons } break; case VAR_TO_BYTES: { if (p_idx == 0) - t = Variant::POOL_BYTE_ARRAY; + t = Variant::PACKED_BYTE_ARRAY; else t = Variant::BOOL; @@ -1228,7 +1228,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in r_error.expected = Variant::BOOL; return; } - PoolByteArray barr; + PackedByteArray barr; int len; bool full_objects = *p_inputs[1]; Error err = encode_variant(*p_inputs[0], NULL, len, full_objects); @@ -1242,17 +1242,17 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in barr.resize(len); { - PoolByteArray::Write w = barr.write(); - encode_variant(*p_inputs[0], w.ptr(), len, full_objects); + uint8_t *w = barr.ptrw(); + encode_variant(*p_inputs[0], w, len, full_objects); } *r_return = barr; } break; case VisualScriptBuiltinFunc::BYTES_TO_VAR: { - if (p_inputs[0]->get_type() != Variant::POOL_BYTE_ARRAY) { + if (p_inputs[0]->get_type() != Variant::PACKED_BYTE_ARRAY) { r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; - r_error.expected = Variant::POOL_BYTE_ARRAY; + r_error.expected = Variant::PACKED_BYTE_ARRAY; return; } if (p_inputs[1]->get_type() != Variant::BOOL) { @@ -1262,17 +1262,17 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in return; } - PoolByteArray varr = *p_inputs[0]; + PackedByteArray varr = *p_inputs[0]; bool allow_objects = *p_inputs[1]; Variant ret; { - PoolByteArray::Read r = varr.read(); - Error err = decode_variant(ret, r.ptr(), varr.size(), NULL, allow_objects); + const uint8_t *r = varr.ptr(); + Error err = decode_variant(ret, r, varr.size(), NULL, allow_objects); if (err != OK) { r_error_str = RTR("Not enough bytes for decoding bytes, or invalid format."); r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; - r_error.expected = Variant::POOL_BYTE_ARRAY; + r_error.expected = Variant::PACKED_BYTE_ARRAY; return; } } diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 9a1125c375..8725563c9b 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -366,13 +366,13 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) { case Variant::DICTIONARY: color = Color(0.47, 0.93, 0.69); break; case Variant::ARRAY: color = Color(0.88, 0.88, 0.88); break; - case Variant::POOL_BYTE_ARRAY: color = Color(0.67, 0.96, 0.78); break; - case Variant::POOL_INT_ARRAY: color = Color(0.69, 0.86, 0.96); break; - case Variant::POOL_REAL_ARRAY: color = Color(0.59, 0.91, 0.97); break; - case Variant::POOL_STRING_ARRAY: color = Color(0.62, 0.77, 0.95); break; - case Variant::POOL_VECTOR2_ARRAY: color = Color(0.82, 0.7, 0.96); break; - case Variant::POOL_VECTOR3_ARRAY: color = Color(0.87, 0.61, 0.95); break; - case Variant::POOL_COLOR_ARRAY: color = Color(0.91, 1.0, 0.59); break; + case Variant::PACKED_BYTE_ARRAY: color = Color(0.67, 0.96, 0.78); break; + case Variant::PACKED_INT_ARRAY: color = Color(0.69, 0.86, 0.96); break; + case Variant::PACKED_REAL_ARRAY: color = Color(0.59, 0.91, 0.97); break; + case Variant::PACKED_STRING_ARRAY: color = Color(0.62, 0.77, 0.95); break; + case Variant::PACKED_VECTOR2_ARRAY: color = Color(0.82, 0.7, 0.96); break; + case Variant::PACKED_VECTOR3_ARRAY: color = Color(0.87, 0.61, 0.95); break; + case Variant::PACKED_COLOR_ARRAY: color = Color(0.91, 1.0, 0.59); break; default: color.set_hsv(p_type / float(Variant::VARIANT_MAX), 0.7, 0.7); @@ -403,13 +403,13 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) { case Variant::DICTIONARY: color = Color(0.34, 0.91, 0.62); break; case Variant::ARRAY: color = Color(0.45, 0.45, 0.45); break; - case Variant::POOL_BYTE_ARRAY: color = Color(0.38, 0.92, 0.6); break; - case Variant::POOL_INT_ARRAY: color = Color(0.38, 0.73, 0.92); break; - case Variant::POOL_REAL_ARRAY: color = Color(0.25, 0.83, 0.95); break; - case Variant::POOL_STRING_ARRAY: color = Color(0.38, 0.62, 0.92); break; - case Variant::POOL_VECTOR2_ARRAY: color = Color(0.62, 0.36, 0.92); break; - case Variant::POOL_VECTOR3_ARRAY: color = Color(0.79, 0.35, 0.92); break; - case Variant::POOL_COLOR_ARRAY: color = Color(0.57, 0.73, 0.0); break; + case Variant::PACKED_BYTE_ARRAY: color = Color(0.38, 0.92, 0.6); break; + case Variant::PACKED_INT_ARRAY: color = Color(0.38, 0.73, 0.92); break; + case Variant::PACKED_REAL_ARRAY: color = Color(0.25, 0.83, 0.95); break; + case Variant::PACKED_STRING_ARRAY: color = Color(0.38, 0.62, 0.92); break; + case Variant::PACKED_VECTOR2_ARRAY: color = Color(0.62, 0.36, 0.92); break; + case Variant::PACKED_VECTOR3_ARRAY: color = Color(0.79, 0.35, 0.92); break; + case Variant::PACKED_COLOR_ARRAY: color = Color(0.57, 0.73, 0.0); break; default: color.set_hsv(p_type / float(Variant::VARIANT_MAX), 0.3, 0.3); @@ -520,13 +520,13 @@ void VisualScriptEditor::_update_graph(int p_only_id) { Control::get_icon("MiniObject", "EditorIcons"), Control::get_icon("Dictionary", "EditorIcons"), Control::get_icon("Array", "EditorIcons"), - Control::get_icon("PoolByteArray", "EditorIcons"), - Control::get_icon("PoolIntArray", "EditorIcons"), - Control::get_icon("PoolRealArray", "EditorIcons"), - Control::get_icon("PoolStringArray", "EditorIcons"), - Control::get_icon("PoolVector2Array", "EditorIcons"), - Control::get_icon("PoolVector3Array", "EditorIcons"), - Control::get_icon("PoolColorArray", "EditorIcons") + Control::get_icon("PackedByteArray", "EditorIcons"), + Control::get_icon("PackedIntArray", "EditorIcons"), + Control::get_icon("PackedRealArray", "EditorIcons"), + Control::get_icon("PackedStringArray", "EditorIcons"), + Control::get_icon("PackedVector2Array", "EditorIcons"), + Control::get_icon("PackedVector3Array", "EditorIcons"), + Control::get_icon("PackedColorArray", "EditorIcons") }; Ref<Texture2D> seq_port = Control::get_icon("VisualShaderPort", "EditorIcons"); @@ -976,13 +976,13 @@ void VisualScriptEditor::_update_members() { Control::get_icon("MiniObject", "EditorIcons"), Control::get_icon("Dictionary", "EditorIcons"), Control::get_icon("Array", "EditorIcons"), - Control::get_icon("PoolByteArray", "EditorIcons"), - Control::get_icon("PoolIntArray", "EditorIcons"), - Control::get_icon("PoolRealArray", "EditorIcons"), - Control::get_icon("PoolStringArray", "EditorIcons"), - Control::get_icon("PoolVector2Array", "EditorIcons"), - Control::get_icon("PoolVector3Array", "EditorIcons"), - Control::get_icon("PoolColorArray", "EditorIcons") + Control::get_icon("PackedByteArray", "EditorIcons"), + Control::get_icon("PackedIntArray", "EditorIcons"), + Control::get_icon("PackedRealArray", "EditorIcons"), + Control::get_icon("PackedStringArray", "EditorIcons"), + Control::get_icon("PackedVector2Array", "EditorIcons"), + Control::get_icon("PackedVector3Array", "EditorIcons"), + Control::get_icon("PackedColorArray", "EditorIcons") }; List<StringName> var_names; @@ -2585,7 +2585,7 @@ void VisualScriptEditor::get_breakpoints(List<int> *p_breakpoints) { } } -void VisualScriptEditor::add_callback(const String &p_function, PoolStringArray p_args) { +void VisualScriptEditor::add_callback(const String &p_function, PackedStringArray p_args) { if (script->has_function(p_function)) { _update_members(); diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index 9f52d87b6a..9a2a42b160 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -313,7 +313,7 @@ public: virtual void tag_saved_version(); virtual void reload(bool p_soft); virtual void get_breakpoints(List<int> *p_breakpoints); - virtual void add_callback(const String &p_function, PoolStringArray p_args); + virtual void add_callback(const String &p_function, PackedStringArray p_args); virtual void update_settings(); virtual bool show_members_overview(); virtual void set_debugger_active(bool p_active); diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp index e8c02a41c4..ffcd355fa0 100644 --- a/modules/visual_script/visual_script_property_selector.cpp +++ b/modules/visual_script/visual_script_property_selector.cpp @@ -119,13 +119,13 @@ void VisualScriptPropertySelector::_update_search() { Control::get_icon("Object", "EditorIcons"), Control::get_icon("Dictionary", "EditorIcons"), Control::get_icon("Array", "EditorIcons"), - Control::get_icon("PoolByteArray", "EditorIcons"), - Control::get_icon("PoolIntArray", "EditorIcons"), - Control::get_icon("PoolRealArray", "EditorIcons"), - Control::get_icon("PoolStringArray", "EditorIcons"), - Control::get_icon("PoolVector2Array", "EditorIcons"), - Control::get_icon("PoolVector3Array", "EditorIcons"), - Control::get_icon("PoolColorArray", "EditorIcons") + Control::get_icon("PackedByteArray", "EditorIcons"), + Control::get_icon("PackedIntArray", "EditorIcons"), + Control::get_icon("PackedRealArray", "EditorIcons"), + Control::get_icon("PackedStringArray", "EditorIcons"), + Control::get_icon("PackedVector2Array", "EditorIcons"), + Control::get_icon("PackedVector3Array", "EditorIcons"), + Control::get_icon("PackedColorArray", "EditorIcons") }; { String b = String(E->get()); diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp index 54d34a48c5..5768392fe5 100644 --- a/modules/webm/video_stream_webm.cpp +++ b/modules/webm/video_stream_webm.cpp @@ -315,12 +315,12 @@ void VideoStreamPlaybackWebm::update(float p_delta) { if (err == VPXDecoder::NO_ERROR && image.w == webm->getWidth() && image.h == webm->getHeight()) { - PoolVector<uint8_t>::Write w = frame_data.write(); + uint8_t *w = frame_data.ptrw(); bool converted = false; if (image.chromaShiftW == 0 && image.chromaShiftH == 0 && image.cs == VPX_CS_SRGB) { - uint8_t *wp = w.ptr(); + uint8_t *wp = w; unsigned char *rRow = image.planes[2]; unsigned char *gRow = image.planes[0]; unsigned char *bRow = image.planes[1]; @@ -338,17 +338,17 @@ void VideoStreamPlaybackWebm::update(float p_delta) { converted = true; } else if (image.chromaShiftW == 1 && image.chromaShiftH == 1) { - yuv420_2_rgb8888(w.ptr(), image.planes[0], image.planes[1], image.planes[2], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2); + yuv420_2_rgb8888(w, image.planes[0], image.planes[1], image.planes[2], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2); //libyuv::I420ToARGB(image.planes[0], image.linesize[0], image.planes[2], image.linesize[2], image.planes[1], image.linesize[1], w.ptr(), image.w << 2, image.w, image.h); converted = true; } else if (image.chromaShiftW == 1 && image.chromaShiftH == 0) { - yuv422_2_rgb8888(w.ptr(), image.planes[0], image.planes[1], image.planes[2], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2); + yuv422_2_rgb8888(w, image.planes[0], image.planes[1], image.planes[2], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2); //libyuv::I422ToARGB(image.planes[0], image.linesize[0], image.planes[2], image.linesize[2], image.planes[1], image.linesize[1], w.ptr(), image.w << 2, image.w, image.h); converted = true; } else if (image.chromaShiftW == 0 && image.chromaShiftH == 0) { - yuv444_2_rgb8888(w.ptr(), image.planes[0], image.planes[1], image.planes[2], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2); + yuv444_2_rgb8888(w, image.planes[0], image.planes[1], image.planes[2], image.w, image.h, image.linesize[0], image.linesize[1], image.w << 2); //libyuv::I444ToARGB(image.planes[0], image.linesize[0], image.planes[2], image.linesize[2], image.planes[1], image.linesize[1], w.ptr(), image.w << 2, image.w, image.h); converted = true; } else if (image.chromaShiftW == 2 && image.chromaShiftH == 0) { diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h index f2a68dd701..a3d3c173f4 100644 --- a/modules/webm/video_stream_webm.h +++ b/modules/webm/video_stream_webm.h @@ -61,7 +61,7 @@ class VideoStreamPlaybackWebm : public VideoStreamPlayback { double delay_compensation; double time, video_frame_delay, video_pos; - PoolVector<uint8_t> frame_data; + Vector<uint8_t> frame_data; Ref<ImageTexture> texture; float *pcm; diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp index 7f4afa9a08..09a8985472 100644 --- a/modules/webp/image_loader_webp.cpp +++ b/modules/webp/image_loader_webp.cpp @@ -38,9 +38,9 @@ #include <webp/decode.h> #include <webp/encode.h> -static PoolVector<uint8_t> _webp_lossy_pack(const Ref<Image> &p_image, float p_quality) { +static Vector<uint8_t> _webp_lossy_pack(const Ref<Image> &p_image, float p_quality) { - ERR_FAIL_COND_V(p_image.is_null() || p_image->empty(), PoolVector<uint8_t>()); + ERR_FAIL_COND_V(p_image.is_null() || p_image->empty(), Vector<uint8_t>()); Ref<Image> img = p_image->duplicate(); if (img->detect_alpha()) @@ -49,37 +49,37 @@ static PoolVector<uint8_t> _webp_lossy_pack(const Ref<Image> &p_image, float p_q img->convert(Image::FORMAT_RGB8); Size2 s(img->get_width(), img->get_height()); - PoolVector<uint8_t> data = img->get_data(); - PoolVector<uint8_t>::Read r = data.read(); + Vector<uint8_t> data = img->get_data(); + const uint8_t *r = data.ptr(); uint8_t *dst_buff = NULL; size_t dst_size = 0; if (img->get_format() == Image::FORMAT_RGB8) { - dst_size = WebPEncodeRGB(r.ptr(), s.width, s.height, 3 * s.width, CLAMP(p_quality * 100.0, 0, 100.0), &dst_buff); + dst_size = WebPEncodeRGB(r, s.width, s.height, 3 * s.width, CLAMP(p_quality * 100.0, 0, 100.0), &dst_buff); } else { - dst_size = WebPEncodeRGBA(r.ptr(), s.width, s.height, 4 * s.width, CLAMP(p_quality * 100.0, 0, 100.0), &dst_buff); + dst_size = WebPEncodeRGBA(r, s.width, s.height, 4 * s.width, CLAMP(p_quality * 100.0, 0, 100.0), &dst_buff); } - ERR_FAIL_COND_V(dst_size == 0, PoolVector<uint8_t>()); - PoolVector<uint8_t> dst; + ERR_FAIL_COND_V(dst_size == 0, Vector<uint8_t>()); + Vector<uint8_t> dst; dst.resize(4 + dst_size); - PoolVector<uint8_t>::Write w = dst.write(); + uint8_t *w = dst.ptrw(); w[0] = 'W'; w[1] = 'E'; w[2] = 'B'; w[3] = 'P'; copymem(&w[4], dst_buff, dst_size); free(dst_buff); - w.release(); + return dst; } -static Ref<Image> _webp_lossy_unpack(const PoolVector<uint8_t> &p_buffer) { +static Ref<Image> _webp_lossy_unpack(const Vector<uint8_t> &p_buffer) { int size = p_buffer.size() - 4; ERR_FAIL_COND_V(size <= 0, Ref<Image>()); - PoolVector<uint8_t>::Read r = p_buffer.read(); + const uint8_t *r = p_buffer.ptr(); ERR_FAIL_COND_V(r[0] != 'W' || r[1] != 'E' || r[2] != 'B' || r[3] != 'P', Ref<Image>()); WebPBitstreamFeatures features; @@ -93,23 +93,21 @@ static Ref<Image> _webp_lossy_unpack(const PoolVector<uint8_t> &p_buffer) { print_line("alpha: "+itos(features.has_alpha)); */ - PoolVector<uint8_t> dst_image; + Vector<uint8_t> dst_image; int datasize = features.width * features.height * (features.has_alpha ? 4 : 3); dst_image.resize(datasize); - PoolVector<uint8_t>::Write dst_w = dst_image.write(); + uint8_t *dst_w = dst_image.ptrw(); bool errdec = false; if (features.has_alpha) { - errdec = WebPDecodeRGBAInto(&r[4], size, dst_w.ptr(), datasize, 4 * features.width) == NULL; + errdec = WebPDecodeRGBAInto(&r[4], size, dst_w, datasize, 4 * features.width) == NULL; } else { - errdec = WebPDecodeRGBInto(&r[4], size, dst_w.ptr(), datasize, 3 * features.width) == NULL; + errdec = WebPDecodeRGBInto(&r[4], size, dst_w, datasize, 3 * features.width) == NULL; } ERR_FAIL_COND_V_MSG(errdec, Ref<Image>(), "Failed decoding WebP image."); - dst_w.release(); - Ref<Image> img = memnew(Image(features.width, features.height, 0, features.has_alpha ? Image::FORMAT_RGBA8 : Image::FORMAT_RGB8, dst_image)); return img; } @@ -123,18 +121,17 @@ Error webp_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p ERR_FAIL_V(ERR_FILE_CORRUPT); } - PoolVector<uint8_t> dst_image; + Vector<uint8_t> dst_image; int datasize = features.width * features.height * (features.has_alpha ? 4 : 3); dst_image.resize(datasize); - PoolVector<uint8_t>::Write dst_w = dst_image.write(); + uint8_t *dst_w = dst_image.ptrw(); bool errdec = false; if (features.has_alpha) { - errdec = WebPDecodeRGBAInto(p_buffer, p_buffer_len, dst_w.ptr(), datasize, 4 * features.width) == NULL; + errdec = WebPDecodeRGBAInto(p_buffer, p_buffer_len, dst_w, datasize, 4 * features.width) == NULL; } else { - errdec = WebPDecodeRGBInto(p_buffer, p_buffer_len, dst_w.ptr(), datasize, 3 * features.width) == NULL; + errdec = WebPDecodeRGBInto(p_buffer, p_buffer_len, dst_w, datasize, 3 * features.width) == NULL; } - dst_w.release(); ERR_FAIL_COND_V_MSG(errdec, ERR_FILE_CORRUPT, "Failed decoding WebP image."); @@ -154,18 +151,18 @@ static Ref<Image> _webp_mem_loader_func(const uint8_t *p_png, int p_size) { Error ImageLoaderWEBP::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale) { - PoolVector<uint8_t> src_image; + Vector<uint8_t> src_image; int src_image_len = f->get_len(); ERR_FAIL_COND_V(src_image_len == 0, ERR_FILE_CORRUPT); src_image.resize(src_image_len); - PoolVector<uint8_t>::Write w = src_image.write(); + uint8_t *w = src_image.ptrw(); f->get_buffer(&w[0], src_image_len); f->close(); - Error err = webp_load_image_from_buffer(p_image.ptr(), w.ptr(), src_image_len); + Error err = webp_load_image_from_buffer(p_image.ptr(), w, src_image_len); return err; } diff --git a/modules/websocket/emws_peer.cpp b/modules/websocket/emws_peer.cpp index 588f38cffd..f396a1c812 100644 --- a/modules/websocket/emws_peer.cpp +++ b/modules/websocket/emws_peer.cpp @@ -90,7 +90,7 @@ Error EMWSPeer::get_packet(const uint8_t **r_buffer, int &r_buffer_size) { if (_in_buffer.packets_left() == 0) return ERR_UNAVAILABLE; - PoolVector<uint8_t>::Write rw = _packet_buffer.write(); + uint8_t *rw = _packet_buffer.ptrw(); int read = 0; Error err = _in_buffer.read_packet(rw.ptr(), _packet_buffer.size(), &_is_string, read); ERR_FAIL_COND_V(err != OK, err); diff --git a/modules/websocket/emws_peer.h b/modules/websocket/emws_peer.h index 43b42f9be6..6308ebe490 100644 --- a/modules/websocket/emws_peer.h +++ b/modules/websocket/emws_peer.h @@ -48,7 +48,7 @@ private: int peer_sock; WriteMode write_mode; - PoolVector<uint8_t> _packet_buffer; + Vector<uint8_t> _packet_buffer; PacketBuffer<uint8_t> _in_buffer; uint8_t _is_string; diff --git a/modules/websocket/emws_server.cpp b/modules/websocket/emws_server.cpp index 23faa05365..8ceefa42b6 100644 --- a/modules/websocket/emws_server.cpp +++ b/modules/websocket/emws_server.cpp @@ -53,8 +53,8 @@ Ref<WebSocketPeer> EMWSServer::get_peer(int p_id) const { return NULL; } -PoolVector<String> EMWSServer::get_protocols() const { - PoolVector<String> out; +Vector<String> EMWSServer::get_protocols() const { + Vector<String> out; return out; } diff --git a/modules/websocket/emws_server.h b/modules/websocket/emws_server.h index 869e59fe03..f273fd078f 100644 --- a/modules/websocket/emws_server.h +++ b/modules/websocket/emws_server.h @@ -53,7 +53,7 @@ public: void disconnect_peer(int p_peer_id, int p_code = 1000, String p_reason = ""); int get_max_packet_size() const; virtual void poll(); - virtual PoolVector<String> get_protocols() const; + virtual Vector<String> get_protocols() const; EMWSServer(); ~EMWSServer(); diff --git a/modules/websocket/websocket_multiplayer_peer.cpp b/modules/websocket/websocket_multiplayer_peer.cpp index 27ea50b524..5c01d44ede 100644 --- a/modules/websocket/websocket_multiplayer_peer.cpp +++ b/modules/websocket/websocket_multiplayer_peer.cpp @@ -127,12 +127,12 @@ Error WebSocketMultiplayerPeer::put_packet(const uint8_t *p_buffer, int p_buffer ERR_FAIL_COND_V_MSG(!_is_multiplayer, ERR_UNCONFIGURED, "Please use get_peer(ID).put_packet/var to communicate with peers when not using the MultiplayerAPI."); - PoolVector<uint8_t> buffer = _make_pkt(SYS_NONE, get_unique_id(), _target_peer, p_buffer, p_buffer_size); + Vector<uint8_t> buffer = _make_pkt(SYS_NONE, get_unique_id(), _target_peer, p_buffer, p_buffer_size); if (is_server()) { - return _server_relay(1, _target_peer, &(buffer.read()[0]), buffer.size()); + return _server_relay(1, _target_peer, &(buffer.ptr()[0]), buffer.size()); } else { - return get_peer(1)->put_packet(&(buffer.read()[0]), buffer.size()); + return get_peer(1)->put_packet(&(buffer.ptr()[0]), buffer.size()); } } @@ -183,16 +183,16 @@ void WebSocketMultiplayerPeer::_send_sys(Ref<WebSocketPeer> p_peer, uint8_t p_ty ERR_FAIL_COND(!p_peer.is_valid()); ERR_FAIL_COND(!p_peer->is_connected_to_host()); - PoolVector<uint8_t> message = _make_pkt(p_type, 1, 0, (uint8_t *)&p_peer_id, 4); - p_peer->put_packet(&(message.read()[0]), message.size()); + Vector<uint8_t> message = _make_pkt(p_type, 1, 0, (uint8_t *)&p_peer_id, 4); + p_peer->put_packet(&(message.ptr()[0]), message.size()); } -PoolVector<uint8_t> WebSocketMultiplayerPeer::_make_pkt(uint8_t p_type, int32_t p_from, int32_t p_to, const uint8_t *p_data, uint32_t p_data_size) { +Vector<uint8_t> WebSocketMultiplayerPeer::_make_pkt(uint8_t p_type, int32_t p_from, int32_t p_to, const uint8_t *p_data, uint32_t p_data_size) { - PoolVector<uint8_t> out; + Vector<uint8_t> out; out.resize(PROTO_SIZE + p_data_size); - PoolVector<uint8_t>::Write w = out.write(); + uint8_t *w = out.ptrw(); copymem(&w[0], &p_type, 1); copymem(&w[1], &p_from, 4); copymem(&w[5], &p_to, 4); diff --git a/modules/websocket/websocket_multiplayer_peer.h b/modules/websocket/websocket_multiplayer_peer.h index 27cb6e4eb7..579972ada2 100644 --- a/modules/websocket/websocket_multiplayer_peer.h +++ b/modules/websocket/websocket_multiplayer_peer.h @@ -41,7 +41,7 @@ class WebSocketMultiplayerPeer : public NetworkedMultiplayerPeer { GDCLASS(WebSocketMultiplayerPeer, NetworkedMultiplayerPeer); private: - PoolVector<uint8_t> _make_pkt(uint8_t p_type, int32_t p_from, int32_t p_to, const uint8_t *p_data, uint32_t p_data_size); + Vector<uint8_t> _make_pkt(uint8_t p_type, int32_t p_from, int32_t p_to, const uint8_t *p_data, uint32_t p_data_size); void _store_pkt(int32_t p_source, int32_t p_dest, const uint8_t *p_data, uint32_t p_data_size); Error _server_relay(int32_t p_from, int32_t p_to, const uint8_t *p_buffer, uint32_t p_buffer_size); diff --git a/modules/websocket/wsl_peer.cpp b/modules/websocket/wsl_peer.cpp index 08079145e4..ff32e83dc1 100644 --- a/modules/websocket/wsl_peer.cpp +++ b/modules/websocket/wsl_peer.cpp @@ -43,10 +43,10 @@ String WSLPeer::generate_key() { // Random key RandomNumberGenerator rng; rng.set_seed(OS::get_singleton()->get_unix_time()); - PoolVector<uint8_t> bkey; + Vector<uint8_t> bkey; int len = 16; // 16 bytes, as per RFC bkey.resize(len); - PoolVector<uint8_t>::Write w = bkey.write(); + uint8_t *w = bkey.ptrw(); for (int i = 0; i < len; i++) { w[i] = (uint8_t)rng.randi_range(0, 255); } @@ -260,10 +260,10 @@ Error WSLPeer::get_packet(const uint8_t **r_buffer, int &r_buffer_size) { return ERR_UNAVAILABLE; int read = 0; - PoolVector<uint8_t>::Write rw = _packet_buffer.write(); - _in_buffer.read_packet(rw.ptr(), _packet_buffer.size(), &_is_string, read); + uint8_t *rw = _packet_buffer.ptrw(); + _in_buffer.read_packet(rw, _packet_buffer.size(), &_is_string, read); - *r_buffer = rw.ptr(); + *r_buffer = rw; r_buffer_size = read; return OK; diff --git a/modules/websocket/wsl_peer.h b/modules/websocket/wsl_peer.h index f1c45ee859..00549cd9bc 100644 --- a/modules/websocket/wsl_peer.h +++ b/modules/websocket/wsl_peer.h @@ -86,7 +86,7 @@ private: // Our packet info is just a boolean (is_string), using uint8_t for it. PacketBuffer<uint8_t> _in_buffer; - PoolVector<uint8_t> _packet_buffer; + Vector<uint8_t> _packet_buffer; WriteMode write_mode; diff --git a/platform/android/api/java_class_wrapper.h b/platform/android/api/java_class_wrapper.h index 6c06d57ac1..2b13be2de4 100644 --- a/platform/android/api/java_class_wrapper.h +++ b/platform/android/api/java_class_wrapper.h @@ -126,34 +126,34 @@ class JavaClass : public Reference { case ARG_ARRAY_BIT | ARG_TYPE_VOID: r_type = Variant::NIL; break; case ARG_ARRAY_BIT | ARG_TYPE_BOOLEAN: r_type = Variant::ARRAY; break; case ARG_ARRAY_BIT | ARG_TYPE_BYTE: - r_type = Variant::POOL_BYTE_ARRAY; + r_type = Variant::PACKED_BYTE_ARRAY; likelihood = 1.0; break; case ARG_ARRAY_BIT | ARG_TYPE_CHAR: - r_type = Variant::POOL_BYTE_ARRAY; + r_type = Variant::PACKED_BYTE_ARRAY; likelihood = 0.5; break; case ARG_ARRAY_BIT | ARG_TYPE_SHORT: - r_type = Variant::POOL_INT_ARRAY; + r_type = Variant::PACKED_INT_ARRAY; likelihood = 0.3; break; case ARG_ARRAY_BIT | ARG_TYPE_INT: - r_type = Variant::POOL_INT_ARRAY; + r_type = Variant::PACKED_INT_ARRAY; likelihood = 1.0; break; case ARG_ARRAY_BIT | ARG_TYPE_LONG: - r_type = Variant::POOL_INT_ARRAY; + r_type = Variant::PACKED_INT_ARRAY; likelihood = 0.5; break; case ARG_ARRAY_BIT | ARG_TYPE_FLOAT: - r_type = Variant::POOL_REAL_ARRAY; + r_type = Variant::PACKED_REAL_ARRAY; likelihood = 1.0; break; case ARG_ARRAY_BIT | ARG_TYPE_DOUBLE: - r_type = Variant::POOL_REAL_ARRAY; + r_type = Variant::PACKED_REAL_ARRAY; likelihood = 0.5; break; - case ARG_ARRAY_BIT | ARG_TYPE_STRING: r_type = Variant::POOL_STRING_ARRAY; break; + case ARG_ARRAY_BIT | ARG_TYPE_STRING: r_type = Variant::PACKED_STRING_ARRAY; break; case ARG_ARRAY_BIT | ARG_TYPE_CLASS: r_type = Variant::ARRAY; break; } } diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 952bc3d28f..2679d9db92 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -701,7 +701,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { aperms++; } - PoolStringArray user_perms = p_preset->get("permissions/custom_permissions"); + PackedStringArray user_perms = p_preset->get("permissions/custom_permissions"); for (int i = 0; i < user_perms.size(); i++) { String user_perm = user_perms[i].strip_edges(); @@ -1310,11 +1310,11 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { working_image->resize(p_icon.dimensions, p_icon.dimensions, Image::Interpolation::INTERPOLATE_LANCZOS); } - PoolVector<uint8_t> png_buffer; + Vector<uint8_t> png_buffer; Error err = PNGDriverCommon::image_to_png(working_image, png_buffer); if (err == OK) { p_data.resize(png_buffer.size()); - memcpy(p_data.ptrw(), png_buffer.read().ptr(), p_data.size()); + memcpy(p_data.ptrw(), png_buffer.ptr(), p_data.size()); } else { String err_str = String("Failed to convert resized icon (") + p_processing_file_name + ") to png."; WARN_PRINT(err_str.utf8().get_data()); @@ -1398,7 +1398,7 @@ public: r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "architectures/" + abi), is_default)); } - r_options->push_back(ExportOption(PropertyInfo(Variant::POOL_STRING_ARRAY, "permissions/custom_permissions"), PoolStringArray())); + r_options->push_back(ExportOption(PropertyInfo(Variant::PACKED_STRING_ARRAY, "permissions/custom_permissions"), PackedStringArray())); const char **perms = android_perms; while (*perms) { diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp index dedb2ee114..d3d8304faf 100644 --- a/platform/android/java_godot_lib_jni.cpp +++ b/platform/android/java_godot_lib_jni.cpp @@ -123,9 +123,9 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a v.val.l = jStr; v.obj = jStr; } break; - case Variant::POOL_STRING_ARRAY: { + case Variant::PACKED_STRING_ARRAY: { - PoolVector<String> sarray = *p_arg; + Vector<String> sarray = *p_arg; jobjectArray arr = env->NewObjectArray(sarray.size(), env->FindClass("java/lang/String"), env->NewStringUTF("")); for (int j = 0; j < sarray.size(); j++) { @@ -182,30 +182,30 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a v.obj = jdict; } break; - case Variant::POOL_INT_ARRAY: { + case Variant::PACKED_INT_ARRAY: { - PoolVector<int> array = *p_arg; + Vector<int> array = *p_arg; jintArray arr = env->NewIntArray(array.size()); - PoolVector<int>::Read r = array.read(); + const int *r = array.ptr(); env->SetIntArrayRegion(arr, 0, array.size(), r.ptr()); v.val.l = arr; v.obj = arr; } break; - case Variant::POOL_BYTE_ARRAY: { - PoolVector<uint8_t> array = *p_arg; + case Variant::PACKED_BYTE_ARRAY: { + Vector<uint8_t> array = *p_arg; jbyteArray arr = env->NewByteArray(array.size()); - PoolVector<uint8_t>::Read r = array.read(); + const uint8_t *r = array.ptr(); env->SetByteArrayRegion(arr, 0, array.size(), reinterpret_cast<const signed char *>(r.ptr())); v.val.l = arr; v.obj = arr; } break; - case Variant::POOL_REAL_ARRAY: { + case Variant::PACKED_REAL_ARRAY: { - PoolVector<float> array = *p_arg; + Vector<float> array = *p_arg; jfloatArray arr = env->NewFloatArray(array.size()); - PoolVector<float>::Read r = array.read(); + const float *r = array.ptr(); env->SetFloatArrayRegion(arr, 0, array.size(), r.ptr()); v.val.l = arr; v.obj = arr; @@ -255,7 +255,7 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { jobjectArray arr = (jobjectArray)obj; int stringCount = env->GetArrayLength(arr); - PoolVector<String> sarr; + Vector<String> sarr; for (int i = 0; i < stringCount; i++) { jstring string = (jstring)env->GetObjectArrayElement(arr, i); @@ -285,10 +285,10 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { jintArray arr = (jintArray)obj; int fCount = env->GetArrayLength(arr); - PoolVector<int> sarr; + Vector<int> sarr; sarr.resize(fCount); - PoolVector<int>::Write w = sarr.write(); + int *w = sarr.ptrw(); env->GetIntArrayRegion(arr, 0, fCount, w.ptr()); w.release(); return sarr; @@ -298,10 +298,10 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { jbyteArray arr = (jbyteArray)obj; int fCount = env->GetArrayLength(arr); - PoolVector<uint8_t> sarr; + Vector<uint8_t> sarr; sarr.resize(fCount); - PoolVector<uint8_t>::Write w = sarr.write(); + uint8_t *w = sarr.ptrw(); env->GetByteArrayRegion(arr, 0, fCount, reinterpret_cast<signed char *>(w.ptr())); w.release(); return sarr; @@ -319,10 +319,10 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { jdoubleArray arr = (jdoubleArray)obj; int fCount = env->GetArrayLength(arr); - PoolRealArray sarr; + PackedRealArray sarr; sarr.resize(fCount); - PoolRealArray::Write w = sarr.write(); + real_t *w = sarr.ptrw(); for (int i = 0; i < fCount; i++) { @@ -337,10 +337,10 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { jfloatArray arr = (jfloatArray)obj; int fCount = env->GetArrayLength(arr); - PoolRealArray sarr; + PackedRealArray sarr; sarr.resize(fCount); - PoolRealArray::Write w = sarr.write(); + real_t *w = sarr.ptrw(); for (int i = 0; i < fCount; i++) { @@ -374,7 +374,7 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { jmethodID get_keys = env->GetMethodID(oclass, "get_keys", "()[Ljava/lang/String;"); jobjectArray arr = (jobjectArray)env->CallObjectMethod(obj, get_keys); - PoolStringArray keys = _jobject_to_variant(env, arr); + PackedStringArray keys = _jobject_to_variant(env, arr); env->DeleteLocalRef(arr); jmethodID get_values = env->GetMethodID(oclass, "get_values", "()[Ljava/lang/Object;"); @@ -497,7 +497,7 @@ public: ret = jstring_to_string((jstring)o, env); env->DeleteLocalRef(o); } break; - case Variant::POOL_STRING_ARRAY: { + case Variant::PACKED_STRING_ARRAY: { jobjectArray arr = (jobjectArray)env->CallObjectMethodA(instance, E->get().method, v); @@ -505,29 +505,29 @@ public: env->DeleteLocalRef(arr); } break; - case Variant::POOL_INT_ARRAY: { + case Variant::PACKED_INT_ARRAY: { jintArray arr = (jintArray)env->CallObjectMethodA(instance, E->get().method, v); int fCount = env->GetArrayLength(arr); - PoolVector<int> sarr; + Vector<int> sarr; sarr.resize(fCount); - PoolVector<int>::Write w = sarr.write(); + int *w = sarr.ptrw(); env->GetIntArrayRegion(arr, 0, fCount, w.ptr()); w.release(); ret = sarr; env->DeleteLocalRef(arr); } break; - case Variant::POOL_REAL_ARRAY: { + case Variant::PACKED_REAL_ARRAY: { jfloatArray arr = (jfloatArray)env->CallObjectMethodA(instance, E->get().method, v); int fCount = env->GetArrayLength(arr); - PoolVector<float> sarr; + Vector<float> sarr; sarr.resize(fCount); - PoolVector<float>::Write w = sarr.write(); + float *w = sarr.ptrw(); env->GetFloatArrayRegion(arr, 0, fCount, w.ptr()); w.release(); ret = sarr; @@ -1249,10 +1249,10 @@ static Variant::Type get_jni_type(const String &p_type) { { "float", Variant::REAL }, { "double", Variant::REAL }, { "java.lang.String", Variant::STRING }, - { "[I", Variant::POOL_INT_ARRAY }, - { "[B", Variant::POOL_BYTE_ARRAY }, - { "[F", Variant::POOL_REAL_ARRAY }, - { "[Ljava.lang.String;", Variant::POOL_STRING_ARRAY }, + { "[I", Variant::PACKED_INT_ARRAY }, + { "[B", Variant::PACKED_BYTE_ARRAY }, + { "[F", Variant::PACKED_REAL_ARRAY }, + { "[Ljava.lang.String;", Variant::PACKED_STRING_ARRAY }, { "org.godotengine.godot.Dictionary", Variant::DICTIONARY }, { NULL, Variant::NIL } }; diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 0767ce7638..7cef2351e3 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -447,9 +447,6 @@ void EditorExportPlatformIOS::_blend_and_rotate(Ref<Image> &p_dst, Ref<Image> &p ERR_FAIL_COND(p_dst.is_null()); ERR_FAIL_COND(p_src.is_null()); - p_dst->lock(); - p_src->lock(); - int sw = p_rot ? p_src->get_height() : p_src->get_width(); int sh = p_rot ? p_src->get_width() : p_src->get_height(); @@ -473,9 +470,6 @@ void EditorExportPlatformIOS::_blend_and_rotate(Ref<Image> &p_dst, Ref<Image> &p p_dst->set_pixel(x_pos + x, y_pos + y, dc); } } - - p_dst->unlock(); - p_src->unlock(); } struct IconInfo { diff --git a/platform/javascript/http_client_javascript.cpp b/platform/javascript/http_client_javascript.cpp index 2c2511a3a5..d7796cc4f4 100644 --- a/platform/javascript/http_client_javascript.cpp +++ b/platform/javascript/http_client_javascript.cpp @@ -103,12 +103,12 @@ Error HTTPClient::prepare_request(Method p_method, const String &p_url, const Ve return OK; } -Error HTTPClient::request_raw(Method p_method, const String &p_url, const Vector<String> &p_headers, const PoolVector<uint8_t> &p_body) { +Error HTTPClient::request_raw(Method p_method, const String &p_url, const Vector<String> &p_headers, const Vector<uint8_t> &p_body) { Error err = prepare_request(p_method, p_url, p_headers); if (err != OK) return err; - PoolByteArray::Read read = p_body.read(); + const uint8_t *read = p_body.ptr(); godot_xhr_send_data(xhr_id, read.ptr(), p_body.size()); return OK; } @@ -173,18 +173,18 @@ int HTTPClient::get_response_body_length() const { return polled_response.size(); } -PoolByteArray HTTPClient::read_response_body_chunk() { +PackedByteArray HTTPClient::read_response_body_chunk() { - ERR_FAIL_COND_V(status != STATUS_BODY, PoolByteArray()); + ERR_FAIL_COND_V(status != STATUS_BODY, PackedByteArray()); int to_read = MIN(read_limit, polled_response.size() - response_read_offset); - PoolByteArray chunk; + PackedByteArray chunk; chunk.resize(to_read); - PoolByteArray::Write write = chunk.write(); - PoolByteArray::Read read = polled_response.read(); + uint8_t *write = chunk.ptrw(); + const uint8_t *read = polled_response.ptr(); memcpy(write.ptr(), read.ptr() + response_read_offset, to_read); - write = PoolByteArray::Write(); - read = PoolByteArray::Read(); + write = uint8_t * (); + read = const uint8_t * (); response_read_offset += to_read; if (response_read_offset == polled_response.size()) { @@ -263,23 +263,23 @@ Error HTTPClient::poll() { status = STATUS_BODY; - PoolByteArray bytes; + PackedByteArray bytes; int len = godot_xhr_get_response_headers_length(xhr_id); bytes.resize(len + 1); - PoolByteArray::Write write = bytes.write(); + uint8_t *write = bytes.ptrw(); godot_xhr_get_response_headers(xhr_id, reinterpret_cast<char *>(write.ptr()), len); write[len] = 0; - write = PoolByteArray::Write(); + write = uint8_t * (); - PoolByteArray::Read read = bytes.read(); + const uint8_t *read = bytes.ptr(); polled_response_header = String::utf8(reinterpret_cast<const char *>(read.ptr())); - read = PoolByteArray::Read(); + read = const uint8_t * (); polled_response.resize(godot_xhr_get_response_length(xhr_id)); - write = polled_response.write(); + write = polled_response.ptrw(); godot_xhr_get_response(xhr_id, write.ptr(), polled_response.size()); - write = PoolByteArray::Write(); + write = uint8_t * (); break; } diff --git a/platform/javascript/javascript_eval.cpp b/platform/javascript/javascript_eval.cpp index d907222d24..ab045d359b 100644 --- a/platform/javascript/javascript_eval.cpp +++ b/platform/javascript/javascript_eval.cpp @@ -33,7 +33,7 @@ #include "api/javascript_eval.h" #include "emscripten.h" -extern "C" EMSCRIPTEN_KEEPALIVE uint8_t *resize_poolbytearray_and_open_write(PoolByteArray *p_arr, PoolByteArray::Write *r_write, int p_len) { +extern "C" EMSCRIPTEN_KEEPALIVE uint8_t *resize_PackedByteArray_and_open_write(PackedByteArray *p_arr, uint8_t **r_write, int p_len) { p_arr->resize(p_len); *r_write = p_arr->write(); @@ -48,8 +48,8 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) { char *s; } js_data; - PoolByteArray arr; - PoolByteArray::Write arr_write; + PackedByteArray arr; + uint8_t *arr_write; /* clang-format off */ Variant::Type return_type = static_cast<Variant::Type>(EM_ASM_INT({ @@ -114,9 +114,9 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) { eval_ret = new Uint8Array(eval_ret); } if (eval_ret instanceof Uint8Array) { - var bytes_ptr = ccall('resize_poolbytearray_and_open_write', 'number', ['number', 'number' ,'number'], [BYTEARRAY_PTR, BYTEARRAY_WRITE_PTR, eval_ret.length]); + var bytes_ptr = ccall('resize_PackedByteArray_and_open_write', 'number', ['number', 'number' ,'number'], [BYTEARRAY_PTR, BYTEARRAY_WRITE_PTR, eval_ret.length]); HEAPU8.set(eval_ret, bytes_ptr); - return 20; // POOL_BYTE_ARRAY + return 20; // PACKED_BYTE_ARRAY } break; } @@ -137,8 +137,8 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) { /* clang-format on */ return str; } - case Variant::POOL_BYTE_ARRAY: - arr_write = PoolByteArray::Write(); + case Variant::PACKED_BYTE_ARRAY: + arr_write = uint8_t * (); return arr; default: return Variant(); diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 8ba2b39c85..5acdc5f602 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -536,17 +536,17 @@ void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_s png_meta.height = texture_size.height; png_meta.format = PNG_FORMAT_RGBA; - PoolByteArray png; + PackedByteArray png; size_t len; - PoolByteArray::Read r = image->get_data().read(); + const uint8_t *r = image->get_data().ptr(); ERR_FAIL_COND(!png_image_write_get_memory_size(png_meta, len, 0, r.ptr(), 0, NULL)); png.resize(len); - PoolByteArray::Write w = png.write(); + uint8_t *w = png.ptrw(); ERR_FAIL_COND(!png_image_write_to_memory(&png_meta, w.ptr(), &len, 0, r.ptr(), 0, NULL)); - w = PoolByteArray::Write(); + w = uint8_t * (); - r = png.read(); + r = png.ptr(); char *object_url; /* clang-format off */ @@ -563,7 +563,7 @@ void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_s stringToUTF8(url, string_on_wasm_heap, length_bytes); }, r.ptr(), len, &object_url); /* clang-format on */ - r = PoolByteArray::Read(); + r = const uint8_t * (); String url = String::utf8(object_url) + "?" + itos(p_hotspot.x) + " " + itos(p_hotspot.y); @@ -1178,17 +1178,17 @@ void OS_JavaScript::set_icon(const Ref<Image> &p_icon) { png_meta.height = icon->get_height(); png_meta.format = PNG_FORMAT_RGBA; - PoolByteArray png; + PackedByteArray png; size_t len; - PoolByteArray::Read r = icon->get_data().read(); + const uint8_t *r = icon->get_data().ptr(); ERR_FAIL_COND(!png_image_write_get_memory_size(png_meta, len, 0, r.ptr(), 0, NULL)); png.resize(len); - PoolByteArray::Write w = png.write(); + uint8_t *w = png.ptrw(); ERR_FAIL_COND(!png_image_write_to_memory(&png_meta, w.ptr(), &len, 0, r.ptr(), 0, NULL)); - w = PoolByteArray::Write(); + w = uint8_t * (); - r = png.read(); + r = png.ptr(); /* clang-format off */ EM_ASM_ARGS({ var PNG_PTR = $0; diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 312987b8cb..dbe52da912 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -139,7 +139,7 @@ void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options) r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "codesign/timestamp"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "codesign/hardened_runtime"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "codesign/entitlements", PROPERTY_HINT_GLOBAL_FILE, "*.plist"), "")); - r_options->push_back(ExportOption(PropertyInfo(Variant::POOL_STRING_ARRAY, "codesign/custom_options"), PoolStringArray())); + r_options->push_back(ExportOption(PropertyInfo(Variant::PACKED_STRING_ARRAY, "codesign/custom_options"), PackedStringArray())); #endif r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), true)); @@ -147,7 +147,7 @@ void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options) r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2"), false)); } -void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector<uint8_t> &p_source, Vector<uint8_t> &p_dest) { +void _rgba8_to_packbits_encode(int p_ch, int p_size, Vector<uint8_t> &p_source, Vector<uint8_t> &p_dest) { int src_len = p_size * p_size; @@ -160,11 +160,11 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector<uint8_t> &p_sour int i = 0; while (i < src_len) { - uint8_t cur = p_source.read()[i * 4 + p_ch]; + uint8_t cur = p_source.ptr()[i * 4 + p_ch]; if (i < src_len - 2) { - if ((p_source.read()[(i + 1) * 4 + p_ch] == cur) && (p_source.read()[(i + 2) * 4 + p_ch] == cur)) { + if ((p_source.ptr()[(i + 1) * 4 + p_ch] == cur) && (p_source.ptr()[(i + 2) * 4 + p_ch] == cur)) { if (buf_size > 0) { result.write[res_size++] = (uint8_t)(buf_size - 1); copymem(&result.write[res_size], &buf, buf_size); @@ -176,7 +176,7 @@ void _rgba8_to_packbits_encode(int p_ch, int p_size, PoolVector<uint8_t> &p_sour bool hit_lim = true; for (int j = 3; j <= lim; j++) { - if (p_source.read()[(i + j) * 4 + p_ch] != cur) { + if (p_source.ptr()[(i + j) * 4 + p_ch] != cur) { hit_lim = false; i = i + j - 1; result.write[res_size++] = (uint8_t)(j - 3 + 0x80); @@ -278,7 +278,7 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_ DirAccess::remove_file_or_error(path); } else { - PoolVector<uint8_t> src_data = copy->get_data(); + Vector<uint8_t> src_data = copy->get_data(); //encode 24bit RGB RLE icon { @@ -302,7 +302,7 @@ void EditorExportPlatformOSX::_make_icon(const Ref<Image> &p_icon, Vector<uint8_ data.resize(data.size() + len + 8); for (int j = 0; j < len; j++) { - data.write[ofs + 8 + j] = src_data.read()[j * 4 + 3]; + data.write[ofs + 8 + j] = src_data.ptr()[j * 4 + 3]; } len += 8; len = BSWAP32(len); @@ -386,7 +386,7 @@ Error EditorExportPlatformOSX::_code_sign(const Ref<EditorExportPreset> &p_prese args.push_back(p_preset->get("codesign/entitlements")); } - PoolStringArray user_args = p_preset->get("codesign/custom_options"); + PackedStringArray user_args = p_preset->get("codesign/custom_options"); for (int i = 0; i < user_args.size(); i++) { String user_arg = user_args[i].strip_edges(); if (!user_arg.empty()) { diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index ca29c95f57..be25cab40b 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1892,10 +1892,6 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c uint8_t *pixels = [imgrep bitmapData]; int len = int(texture_size.width * texture_size.height); - PoolVector<uint8_t> data = image->get_data(); - PoolVector<uint8_t>::Read r = data.read(); - - image->lock(); for (int i = 0; i < len; i++) { int row_index = floor(i / texture_size.width) + atlas_rect.position.y; @@ -1915,8 +1911,6 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c pixels[i * 4 + 3] = alpha; } - image->unlock(); - NSImage *nsimage = [[NSImage alloc] initWithSize:NSMakeSize(texture_size.width, texture_size.height)]; [nsimage addRepresentation:imgrep]; @@ -2051,8 +2045,7 @@ void OS_OSX::set_icon(const Ref<Image> &p_icon) { uint8_t *pixels = [imgrep bitmapData]; int len = img->get_width() * img->get_height(); - PoolVector<uint8_t> data = img->get_data(); - PoolVector<uint8_t>::Read r = data.read(); + const uint8_t *r = img->get_data().ptr(); /* Premultiply the alpha channel */ for (int i = 0; i < len; i++) { diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp index 31501c2cd3..78a3fc8f79 100644 --- a/platform/windows/export/export.cpp +++ b/platform/windows/export/export.cpp @@ -85,7 +85,7 @@ void EditorExportPlatformWindows::get_export_options(List<ExportOption> *r_optio r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "codesign/timestamp_server_url"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "codesign/digest_algorithm", PROPERTY_HINT_ENUM, "SHA1,SHA256"), 1)); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "codesign/description"), "")); - r_options->push_back(ExportOption(PropertyInfo(Variant::POOL_STRING_ARRAY, "codesign/custom_options"), PoolStringArray())); + r_options->push_back(ExportOption(PropertyInfo(Variant::PACKED_STRING_ARRAY, "codesign/custom_options"), PackedStringArray())); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_FILE, "*.ico"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/file_version", PROPERTY_HINT_PLACEHOLDER_TEXT, "1.0.0"), "")); @@ -297,7 +297,7 @@ Error EditorExportPlatformWindows::_code_sign(const Ref<EditorExportPreset> &p_p } //user options - PoolStringArray user_args = p_preset->get("codesign/custom_options"); + PackedStringArray user_args = p_preset->get("codesign/custom_options"); for (int i = 0; i < user_args.size(); i++) { String user_arg = user_args[i].strip_edges(); if (!user_arg.empty()) { diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index cdcdf65e21..b9cd277657 100755..100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2567,7 +2567,6 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap // Create the BITMAP with alpha channel COLORREF *buffer = (COLORREF *)memalloc(sizeof(COLORREF) * image_size); - image->lock(); for (UINT index = 0; index < image_size; index++) { int row_index = floor(index / texture_size.width) + atlas_rect.position.y; int column_index = (index % int(texture_size.width)) + atlas_rect.position.x; @@ -2579,7 +2578,6 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap *(buffer + index) = image->get_pixel(column_index, row_index).to_argb32(); } - image->unlock(); // Using 4 channels, so 4 * 8 bits HBITMAP bitmap = CreateBitmap(texture_size.width, texture_size.height, 1, 4 * 8, buffer); @@ -2934,7 +2932,7 @@ void OS_Windows::set_icon(const Ref<Image> &p_icon) { encode_uint32(0, &icon_bmp[36]); uint8_t *wr = &icon_bmp[40]; - PoolVector<uint8_t>::Read r = icon->get_data().read(); + const uint8_t *r = icon->get_data().ptr(); for (int i = 0; i < h; i++) { diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 26170a8335..36e9681f5f 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -3076,8 +3076,6 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c // allocate memory to contain the whole file cursor_image->pixels = (XcursorPixel *)memalloc(size); - image->lock(); - for (XcursorPixel index = 0; index < image_size; index++) { int row_index = floor(index / texture_size.width) + atlas_rect.position.y; int column_index = (index % int(texture_size.width)) + atlas_rect.position.x; @@ -3090,8 +3088,6 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c *(cursor_image->pixels + index) = image->get_pixel(column_index, row_index).to_argb32(); } - image->unlock(); - ERR_FAIL_COND(cursor_image->pixels == NULL); // Save it for a further usage @@ -3269,10 +3265,10 @@ void OS_X11::set_icon(const Ref<Image> &p_icon) { pd.write[0] = w; pd.write[1] = h; - PoolVector<uint8_t>::Read r = img->get_data().read(); + const uint8_t *r = img->get_data().ptr(); long *wr = &pd.write[2]; - uint8_t const *pr = r.ptr(); + uint8_t const *pr = r; for (int i = 0; i < w * h; i++) { long v = 0; 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)); } } diff --git a/servers/audio/effects/audio_effect_record.cpp b/servers/audio/effects/audio_effect_record.cpp index 9be3a2d554..8f0c55ad83 100644 --- a/servers/audio/effects/audio_effect_record.cpp +++ b/servers/audio/effects/audio_effect_record.cpp @@ -215,7 +215,7 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const { AudioStreamSample::Format dst_format = format; bool stereo = true; //forcing mono is not implemented - PoolVector<uint8_t> dst_data; + Vector<uint8_t> dst_data; ERR_FAIL_COND_V(current_instance.is_null(), NULL); ERR_FAIL_COND_V(current_instance->recording_data.size() == 0, NULL); @@ -223,7 +223,7 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const { if (dst_format == AudioStreamSample::FORMAT_8_BITS) { int data_size = current_instance->recording_data.size(); dst_data.resize(data_size); - PoolVector<uint8_t>::Write w = dst_data.write(); + uint8_t *w = dst_data.ptrw(); for (int i = 0; i < data_size; i++) { int8_t v = CLAMP(current_instance->recording_data[i] * 128, -128, 127); @@ -232,7 +232,7 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const { } else if (dst_format == AudioStreamSample::FORMAT_16_BITS) { int data_size = current_instance->recording_data.size(); dst_data.resize(data_size * 2); - PoolVector<uint8_t>::Write w = dst_data.write(); + uint8_t *w = dst_data.ptrw(); for (int i = 0; i < data_size; i++) { int16_t v = CLAMP(current_instance->recording_data[i] * 32768, -32768, 32767); @@ -252,8 +252,8 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const { right.set(i, current_instance->recording_data[i * 2 + 1]); } - PoolVector<uint8_t> bleft; - PoolVector<uint8_t> bright; + Vector<uint8_t> bleft; + Vector<uint8_t> bright; ResourceImporterWAV::_compress_ima_adpcm(left, bleft); ResourceImporterWAV::_compress_ima_adpcm(right, bright); @@ -261,9 +261,9 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const { int dl = bleft.size(); dst_data.resize(dl * 2); - PoolVector<uint8_t>::Write w = dst_data.write(); - PoolVector<uint8_t>::Read rl = bleft.read(); - PoolVector<uint8_t>::Read rr = bright.read(); + uint8_t *w = dst_data.ptrw(); + const uint8_t *rl = bleft.ptr(); + const uint8_t *rr = bright.ptr(); for (int i = 0; i < dl; i++) { w[i * 2 + 0] = rl[i]; diff --git a/servers/audio/effects/audio_stream_generator.cpp b/servers/audio/effects/audio_stream_generator.cpp index 9e1019afbc..101dcddae7 100644 --- a/servers/audio/effects/audio_stream_generator.cpp +++ b/servers/audio/effects/audio_stream_generator.cpp @@ -99,17 +99,17 @@ bool AudioStreamGeneratorPlayback::push_frame(const Vector2 &p_frame) { bool AudioStreamGeneratorPlayback::can_push_buffer(int p_frames) const { return buffer.space_left() >= p_frames; } -bool AudioStreamGeneratorPlayback::push_buffer(const PoolVector2Array &p_frames) { +bool AudioStreamGeneratorPlayback::push_buffer(const PackedVector2Array &p_frames) { int to_write = p_frames.size(); if (buffer.space_left() < to_write) { return false; } - PoolVector2Array::Read r = p_frames.read(); + const Vector2 *r = p_frames.ptr(); if (sizeof(real_t) == 4) { //write directly - buffer.write((const AudioFrame *)r.ptr(), to_write); + buffer.write((const AudioFrame *)r, to_write); } else { //convert from double AudioFrame buf[2048]; diff --git a/servers/audio/effects/audio_stream_generator.h b/servers/audio/effects/audio_stream_generator.h index f1cd73d266..aee3459e17 100644 --- a/servers/audio/effects/audio_stream_generator.h +++ b/servers/audio/effects/audio_stream_generator.h @@ -85,7 +85,7 @@ public: bool push_frame(const Vector2 &p_frame); bool can_push_buffer(int p_frames) const; - bool push_buffer(const PoolVector2Array &p_frames); + bool push_buffer(const PackedVector2Array &p_frames); int get_frames_available() const; int get_skips() const; diff --git a/servers/audio_server.h b/servers/audio_server.h index eff66d4008..1d9e5100fa 100644 --- a/servers/audio_server.h +++ b/servers/audio_server.h @@ -104,7 +104,7 @@ public: virtual Error capture_stop() { return FAILED; } virtual void capture_set_device(const String &p_name) {} virtual String capture_get_device() { return "Default"; } - virtual Array capture_get_device_list(); // TODO: convert this and get_device_list to PoolStringArray + virtual Array capture_get_device_list(); // TODO: convert this and get_device_list to PackedStringArray virtual float get_latency() { return 0; } diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp index 7c92178803..4a6ed6be58 100644 --- a/servers/physics/shape_sw.cpp +++ b/servers/physics/shape_sw.cpp @@ -1106,9 +1106,9 @@ FaceShapeSW::FaceShapeSW() { configure(AABB()); } -PoolVector<Vector3> ConcavePolygonShapeSW::get_faces() const { +Vector<Vector3> ConcavePolygonShapeSW::get_faces() const { - PoolVector<Vector3> rfaces; + Vector<Vector3> rfaces; rfaces.resize(faces.size() * 3); for (int i = 0; i < faces.size(); i++) { @@ -1132,8 +1132,7 @@ void ConcavePolygonShapeSW::project_range(const Vector3 &p_normal, const Transfo r_max = 0; return; } - PoolVector<Vector3>::Read r = vertices.read(); - const Vector3 *vptr = r.ptr(); + const Vector3 *vptr = vertices.ptr(); for (int i = 0; i < count; i++) { @@ -1152,8 +1151,7 @@ Vector3 ConcavePolygonShapeSW::get_support(const Vector3 &p_normal) const { if (count == 0) return Vector3(); - PoolVector<Vector3>::Read r = vertices.read(); - const Vector3 *vptr = r.ptr(); + const Vector3 *vptr = vertices.ptr(); Vector3 n = p_normal; @@ -1231,9 +1229,9 @@ bool ConcavePolygonShapeSW::intersect_segment(const Vector3 &p_begin, const Vect return false; // unlock data - PoolVector<Face>::Read fr = faces.read(); - PoolVector<Vector3>::Read vr = vertices.read(); - PoolVector<BVH>::Read br = bvh.read(); + const Face *fr = faces.ptr(); + const Vector3 *vr = vertices.ptr(); + const BVH *br = bvh.ptr(); _SegmentCullParams params; params.from = p_begin; @@ -1241,9 +1239,9 @@ bool ConcavePolygonShapeSW::intersect_segment(const Vector3 &p_begin, const Vect params.collisions = 0; params.dir = (p_end - p_begin).normalized(); - params.faces = fr.ptr(); - params.vertices = vr.ptr(); - params.bvh = br.ptr(); + params.faces = fr; + params.vertices = vr; + params.bvh = br; params.min_d = 1e20; // cull @@ -1310,18 +1308,18 @@ void ConcavePolygonShapeSW::cull(const AABB &p_local_aabb, Callback p_callback, AABB local_aabb = p_local_aabb; // unlock data - PoolVector<Face>::Read fr = faces.read(); - PoolVector<Vector3>::Read vr = vertices.read(); - PoolVector<BVH>::Read br = bvh.read(); + const Face *fr = faces.ptr(); + const Vector3 *vr = vertices.ptr(); + const BVH *br = bvh.ptr(); FaceShapeSW face; // use this to send in the callback _CullParams params; params.aabb = local_aabb; params.face = &face; - params.faces = fr.ptr(); - params.vertices = vr.ptr(); - params.bvh = br.ptr(); + params.faces = fr; + params.vertices = vr; + params.bvh = br; params.callback = p_callback; params.userdata = p_userdata; @@ -1464,7 +1462,7 @@ void ConcavePolygonShapeSW::_fill_bvh(_VolumeSW_BVH *p_bvh_tree, BVH *p_bvh_arra memdelete(p_bvh_tree); } -void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) { +void ConcavePolygonShapeSW::_setup(Vector<Vector3> p_faces) { int src_face_count = p_faces.size(); if (src_face_count == 0) { @@ -1474,23 +1472,19 @@ void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) { ERR_FAIL_COND(src_face_count % 3); src_face_count /= 3; - PoolVector<Vector3>::Read r = p_faces.read(); - const Vector3 *facesr = r.ptr(); + const Vector3 *facesr = p_faces.ptr(); - PoolVector<_VolumeSW_BVH_Element> bvh_array; + Vector<_VolumeSW_BVH_Element> bvh_array; bvh_array.resize(src_face_count); - PoolVector<_VolumeSW_BVH_Element>::Write bvhw = bvh_array.write(); - _VolumeSW_BVH_Element *bvh_arrayw = bvhw.ptr(); + _VolumeSW_BVH_Element *bvh_arrayw = bvh_array.ptrw(); faces.resize(src_face_count); - PoolVector<Face>::Write w = faces.write(); - Face *facesw = w.ptr(); + Face *facesw = faces.ptrw(); vertices.resize(src_face_count * 3); - PoolVector<Vector3>::Write vw = vertices.write(); - Vector3 *verticesw = vw.ptr(); + Vector3 *verticesw = vertices.ptrw(); AABB _aabb; @@ -1514,16 +1508,12 @@ void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) { _aabb.merge_with(bvh_arrayw[i].aabb); } - w.release(); - vw.release(); - int count = 0; _VolumeSW_BVH *bvh_tree = _volume_sw_build_bvh(bvh_arrayw, src_face_count, count); bvh.resize(count + 1); - PoolVector<BVH>::Write bvhw2 = bvh.write(); - BVH *bvh_arrayw2 = bvhw2.ptr(); + BVH *bvh_arrayw2 = bvh.ptrw(); int idx = 0; _fill_bvh(bvh_tree, bvh_arrayw2, idx); @@ -1546,7 +1536,7 @@ ConcavePolygonShapeSW::ConcavePolygonShapeSW() { /* HEIGHT MAP SHAPE */ -PoolVector<real_t> HeightMapShapeSW::get_heights() const { +Vector<real_t> HeightMapShapeSW::get_heights() const { return heights; } @@ -1603,14 +1593,14 @@ Vector3 HeightMapShapeSW::get_moment_of_inertia(real_t p_mass) const { (p_mass / 3.0) * (extents.y * extents.y + extents.y * extents.y)); } -void HeightMapShapeSW::_setup(PoolVector<real_t> p_heights, int p_width, int p_depth, real_t p_cell_size) { +void HeightMapShapeSW::_setup(Vector<real_t> p_heights, int p_width, int p_depth, real_t p_cell_size) { heights = p_heights; width = p_width; depth = p_depth; cell_size = p_cell_size; - PoolVector<real_t>::Read r = heights.read(); + const real_t *r = heights.ptr(); AABB aabb; @@ -1643,7 +1633,7 @@ void HeightMapShapeSW::set_data(const Variant &p_data) { int width = d["width"]; int depth = d["depth"]; real_t cell_size = d["cell_size"]; - PoolVector<real_t> heights = d["heights"]; + Vector<real_t> heights = d["heights"]; ERR_FAIL_COND(width <= 0); ERR_FAIL_COND(depth <= 0); diff --git a/servers/physics/shape_sw.h b/servers/physics/shape_sw.h index 62a6cb7f29..eaae64be66 100644 --- a/servers/physics/shape_sw.h +++ b/servers/physics/shape_sw.h @@ -31,7 +31,6 @@ #ifndef SHAPE_SW_H #define SHAPE_SW_H -#include "core/math/bsp_tree.h" #include "core/math/geometry.h" #include "servers/physics_server.h" /* @@ -297,8 +296,8 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW { int indices[3]; }; - PoolVector<Face> faces; - PoolVector<Vector3> vertices; + Vector<Face> faces; + Vector<Vector3> vertices; struct BVH { @@ -309,7 +308,7 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW { int face_index; }; - PoolVector<BVH> bvh; + Vector<BVH> bvh; struct _CullParams { @@ -342,10 +341,10 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW { void _fill_bvh(_VolumeSW_BVH *p_bvh_tree, BVH *p_bvh_array, int &p_idx); - void _setup(PoolVector<Vector3> p_faces); + void _setup(Vector<Vector3> p_faces); public: - PoolVector<Vector3> get_faces() const; + Vector<Vector3> get_faces() const; virtual PhysicsServer::ShapeType get_type() const { return PhysicsServer::SHAPE_CONCAVE_POLYGON; } @@ -368,7 +367,7 @@ public: struct HeightMapShapeSW : public ConcaveShapeSW { - PoolVector<real_t> heights; + Vector<real_t> heights; int width; int depth; real_t cell_size; @@ -376,10 +375,10 @@ struct HeightMapShapeSW : public ConcaveShapeSW { //void _cull_segment(int p_idx,_SegmentCullParams *p_params) const; //void _cull(int p_idx,_CullParams *p_params) const; - void _setup(PoolVector<real_t> p_heights, int p_width, int p_depth, real_t p_cell_size); + void _setup(Vector<real_t> p_heights, int p_width, int p_depth, real_t p_cell_size); public: - PoolVector<real_t> get_heights() const; + Vector<real_t> get_heights() const; int get_width() const; int get_depth() const; real_t get_cell_size() const; @@ -468,16 +467,4 @@ struct MotionShapeSW : public ShapeSW { MotionShapeSW() { configure(AABB()); } }; -struct _ShapeTestConvexBSPSW { - - const BSP_Tree *bsp; - const ShapeSW *shape; - Transform transform; - - _FORCE_INLINE_ void project_range(const Vector3 &p_normal, real_t &r_min, real_t &r_max) const { - - shape->project_range(p_normal, transform, r_min, r_max); - } -}; - -#endif // SHAPESW_H +#endif // SHAPE_SW_H diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp index 75c604f0fa..86057e4078 100644 --- a/servers/physics_2d/shape_2d_sw.cpp +++ b/servers/physics_2d/shape_2d_sw.cpp @@ -639,19 +639,19 @@ real_t ConvexPolygonShape2DSW::get_moment_of_inertia(real_t p_mass, const Size2 void ConvexPolygonShape2DSW::set_data(const Variant &p_data) { - ERR_FAIL_COND(p_data.get_type() != Variant::POOL_VECTOR2_ARRAY && p_data.get_type() != Variant::POOL_REAL_ARRAY); + ERR_FAIL_COND(p_data.get_type() != Variant::PACKED_VECTOR2_ARRAY && p_data.get_type() != Variant::PACKED_REAL_ARRAY); if (points) memdelete_arr(points); points = NULL; point_count = 0; - if (p_data.get_type() == Variant::POOL_VECTOR2_ARRAY) { - PoolVector<Vector2> arr = p_data; + if (p_data.get_type() == Variant::PACKED_VECTOR2_ARRAY) { + Vector<Vector2> arr = p_data; ERR_FAIL_COND(arr.size() == 0); point_count = arr.size(); points = memnew_arr(Point, point_count); - PoolVector<Vector2>::Read r = arr.read(); + const Vector2 *r = arr.ptr(); for (int i = 0; i < point_count; i++) { points[i].pos = r[i]; @@ -665,12 +665,12 @@ void ConvexPolygonShape2DSW::set_data(const Variant &p_data) { } } else { - PoolVector<real_t> dvr = p_data; + Vector<real_t> dvr = p_data; point_count = dvr.size() / 4; ERR_FAIL_COND(point_count == 0); points = memnew_arr(Point, point_count); - PoolVector<real_t>::Read r = dvr.read(); + const real_t *r = dvr.ptr(); for (int i = 0; i < point_count; i++) { @@ -693,7 +693,7 @@ void ConvexPolygonShape2DSW::set_data(const Variant &p_data) { Variant ConvexPolygonShape2DSW::get_data() const { - PoolVector<Vector2> dvr; + Vector<Vector2> dvr; dvr.resize(point_count); @@ -899,13 +899,13 @@ int ConcavePolygonShape2DSW::_generate_bvh(BVH *p_bvh, int p_len, int p_depth) { void ConcavePolygonShape2DSW::set_data(const Variant &p_data) { - ERR_FAIL_COND(p_data.get_type() != Variant::POOL_VECTOR2_ARRAY && p_data.get_type() != Variant::POOL_REAL_ARRAY); + ERR_FAIL_COND(p_data.get_type() != Variant::PACKED_VECTOR2_ARRAY && p_data.get_type() != Variant::PACKED_REAL_ARRAY); Rect2 aabb; - if (p_data.get_type() == Variant::POOL_VECTOR2_ARRAY) { + if (p_data.get_type() == Variant::PACKED_VECTOR2_ARRAY) { - PoolVector<Vector2> p2arr = p_data; + Vector<Vector2> p2arr = p_data; int len = p2arr.size(); ERR_FAIL_COND(len % 2); @@ -919,7 +919,7 @@ void ConcavePolygonShape2DSW::set_data(const Variant &p_data) { return; } - PoolVector<Vector2>::Read arr = p2arr.read(); + const Vector2 *arr = p2arr.ptr(); Map<Point2, int> pointmap; for (int i = 0; i < len; i += 2) { @@ -976,18 +976,16 @@ void ConcavePolygonShape2DSW::set_data(const Variant &p_data) { } Variant ConcavePolygonShape2DSW::get_data() const { - PoolVector<Vector2> rsegments; + Vector<Vector2> rsegments; int len = segments.size(); rsegments.resize(len * 2); - PoolVector<Vector2>::Write w = rsegments.write(); + Vector2 *w = rsegments.ptrw(); for (int i = 0; i < len; i++) { w[(i << 1) + 0] = points[segments[i].points[0]]; w[(i << 1) + 1] = points[segments[i].points[1]]; } - w.release(); - return rsegments; } diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 08d2104f94..3274b15975 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -356,7 +356,7 @@ public: virtual void mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode) = 0; virtual VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const = 0; - virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) = 0; + virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) = 0; virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) = 0; virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const = 0; @@ -393,8 +393,8 @@ public: virtual Color multimesh_instance_get_color(RID p_multimesh, int p_index) const = 0; virtual Color multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const = 0; - virtual void multimesh_set_buffer(RID p_multimesh, const PoolVector<float> &p_buffer) = 0; - virtual PoolVector<float> multimesh_get_buffer(RID p_multimesh) const = 0; + virtual void multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_buffer) = 0; + virtual Vector<float> multimesh_get_buffer(RID p_multimesh) const = 0; virtual void multimesh_set_visible_instances(RID p_multimesh, int p_visible) = 0; virtual int multimesh_get_visible_instances(RID p_multimesh) const = 0; @@ -499,15 +499,15 @@ public: virtual RID gi_probe_create() = 0; - virtual void gi_probe_allocate(RID p_gi_probe, const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3i &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) = 0; + virtual void gi_probe_allocate(RID p_gi_probe, const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3i &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) = 0; virtual AABB gi_probe_get_bounds(RID p_gi_probe) const = 0; virtual Vector3i gi_probe_get_octree_size(RID p_gi_probe) const = 0; - virtual PoolVector<uint8_t> gi_probe_get_octree_cells(RID p_gi_probe) const = 0; - virtual PoolVector<uint8_t> gi_probe_get_data_cells(RID p_gi_probe) const = 0; - virtual PoolVector<uint8_t> gi_probe_get_distance_field(RID p_gi_probe) const = 0; + virtual Vector<uint8_t> gi_probe_get_octree_cells(RID p_gi_probe) const = 0; + virtual Vector<uint8_t> gi_probe_get_data_cells(RID p_gi_probe) const = 0; + virtual Vector<uint8_t> gi_probe_get_distance_field(RID p_gi_probe) const = 0; - virtual PoolVector<int> gi_probe_get_level_counts(RID p_gi_probe) const = 0; + virtual Vector<int> gi_probe_get_level_counts(RID p_gi_probe) const = 0; virtual Transform gi_probe_get_to_cell_xform(RID p_gi_probe) const = 0; virtual void gi_probe_set_dynamic_range(RID p_gi_probe, float p_range) = 0; @@ -558,15 +558,15 @@ public: virtual RID lightmap_capture_create() = 0; virtual void lightmap_capture_set_bounds(RID p_capture, const AABB &p_bounds) = 0; virtual AABB lightmap_capture_get_bounds(RID p_capture) const = 0; - virtual void lightmap_capture_set_octree(RID p_capture, const PoolVector<uint8_t> &p_octree) = 0; - virtual PoolVector<uint8_t> lightmap_capture_get_octree(RID p_capture) const = 0; + virtual void lightmap_capture_set_octree(RID p_capture, const Vector<uint8_t> &p_octree) = 0; + virtual Vector<uint8_t> lightmap_capture_get_octree(RID p_capture) const = 0; virtual void lightmap_capture_set_octree_cell_transform(RID p_capture, const Transform &p_xform) = 0; virtual Transform lightmap_capture_get_octree_cell_transform(RID p_capture) const = 0; virtual void lightmap_capture_set_octree_cell_subdiv(RID p_capture, int p_subdiv) = 0; virtual int lightmap_capture_get_octree_cell_subdiv(RID p_capture) const = 0; virtual void lightmap_capture_set_energy(RID p_capture, float p_energy) = 0; virtual float lightmap_capture_get_energy(RID p_capture) const = 0; - virtual const PoolVector<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const = 0; + virtual const Vector<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const = 0; /* PARTICLES */ @@ -1258,7 +1258,7 @@ public: virtual void light_update_shadow(RID p_rid, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders) = 0; virtual RID occluder_polygon_create() = 0; - virtual void occluder_polygon_set_shape_as_lines(RID p_occluder, const PoolVector<Vector2> &p_lines) = 0; + virtual void occluder_polygon_set_shape_as_lines(RID p_occluder, const Vector<Vector2> &p_lines) = 0; virtual void occluder_polygon_set_cull_mode(RID p_occluder, VS::CanvasOccluderPolygonCullMode p_mode) = 0; virtual void draw_window_margins(int *p_margins, RID *p_margin_textures) = 0; diff --git a/servers/visual/rasterizer_rd/light_cluster_builder.cpp b/servers/visual/rasterizer_rd/light_cluster_builder.cpp index 78011c22cc..943ef1c7fa 100644 --- a/servers/visual/rasterizer_rd/light_cluster_builder.cpp +++ b/servers/visual/rasterizer_rd/light_cluster_builder.cpp @@ -47,8 +47,8 @@ void LightClusterBuilder::bake_cluster() { float slice_depth = (z_near - z_far) / depth; - PoolVector<uint8_t>::Write cluster_dataw = cluster_data.write(); - Cell *cluster_data_ptr = (Cell *)cluster_dataw.ptr(); + uint8_t *cluster_dataw = cluster_data.ptrw(); + Cell *cluster_data_ptr = (Cell *)cluster_dataw; //clear the cluster zeromem(cluster_data_ptr, (width * height * depth * sizeof(Cell))); @@ -160,8 +160,7 @@ void LightClusterBuilder::bake_cluster() { //print_line("offset: " + itos(offset)); /* Step 3, Place item lists */ - PoolVector<uint32_t>::Write idsw = ids.write(); - uint32_t *ids_ptr = idsw.ptr(); + uint32_t *ids_ptr = ids.ptrw(); for (uint32_t i = 0; i < sort_id_count; i++) { const SortID &id = sort_ids[i]; @@ -173,12 +172,8 @@ void LightClusterBuilder::bake_cluster() { cell.item_pointers[id.item_type] = pointer | ((counter + 1) << COUNTER_SHIFT); } - cluster_dataw = PoolVector<uint8_t>::Write(); - RD::get_singleton()->texture_update(cluster_texture, 0, cluster_data, true); RD::get_singleton()->buffer_update(items_buffer, 0, offset * sizeof(uint32_t), ids_ptr, true); - - idsw = PoolVector<uint32_t>::Write(); } void LightClusterBuilder::setup(uint32_t p_width, uint32_t p_height, uint32_t p_depth) { diff --git a/servers/visual/rasterizer_rd/light_cluster_builder.h b/servers/visual/rasterizer_rd/light_cluster_builder.h index fd2bd612c3..83014a7dd0 100644 --- a/servers/visual/rasterizer_rd/light_cluster_builder.h +++ b/servers/visual/rasterizer_rd/light_cluster_builder.h @@ -104,7 +104,7 @@ private: uint32_t item_pointers[ITEM_TYPE_MAX]; }; - PoolVector<uint8_t> cluster_data; + Vector<uint8_t> cluster_data; RID cluster_texture; struct SortID { @@ -114,7 +114,7 @@ private: }; SortID *sort_ids = nullptr; - PoolVector<uint32_t> ids; + Vector<uint32_t> ids; uint32_t sort_id_count = 0; uint32_t sort_id_max = 0; RID items_buffer; diff --git a/servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp index 7012cb04cd..425221608b 100644 --- a/servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp +++ b/servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp @@ -271,7 +271,7 @@ RasterizerCanvas::PolygonID RasterizerCanvasRD::request_polygon(const Vector<int uint32_t buffer_size = stride * p_points.size(); - PoolVector<uint8_t> polygon_buffer; + Vector<uint8_t> polygon_buffer; polygon_buffer.resize(buffer_size * sizeof(float)); Vector<RD::VertexDescription> descriptions; descriptions.resize(4); @@ -279,9 +279,9 @@ RasterizerCanvas::PolygonID RasterizerCanvasRD::request_polygon(const Vector<int buffers.resize(4); { - PoolVector<uint8_t>::Read r = polygon_buffer.read(); - float *fptr = (float *)r.ptr(); - uint32_t *uptr = (uint32_t *)r.ptr(); + const uint8_t *r = polygon_buffer.ptr(); + float *fptr = (float *)r; + uint32_t *uptr = (uint32_t *)r; uint32_t base_offset = 0; { //vertices RD::VertexDescription vd; @@ -430,11 +430,11 @@ RasterizerCanvas::PolygonID RasterizerCanvasRD::request_polygon(const Vector<int if (p_indices.size()) { //create indices, as indices were requested - PoolVector<uint8_t> index_buffer; + Vector<uint8_t> index_buffer; index_buffer.resize(p_indices.size() * sizeof(int32_t)); { - PoolVector<uint8_t>::Write w = index_buffer.write(); - copymem(w.ptr(), p_indices.ptr(), sizeof(int32_t) * p_indices.size()); + uint8_t *w = index_buffer.ptrw(); + copymem(w, p_indices.ptr(), sizeof(int32_t) * p_indices.size()); } pb.index_buffer = RD::get_singleton()->index_buffer_create(p_indices.size(), RD::INDEX_BUFFER_FORMAT_UINT32, index_buffer); pb.indices = RD::get_singleton()->index_array_create(pb.index_buffer, 0, p_indices.size()); @@ -1707,7 +1707,7 @@ RID RasterizerCanvasRD::occluder_polygon_create() { return occluder_polygon_owner.make_rid(occluder); } -void RasterizerCanvasRD::occluder_polygon_set_shape_as_lines(RID p_occluder, const PoolVector<Vector2> &p_lines) { +void RasterizerCanvasRD::occluder_polygon_set_shape_as_lines(RID p_occluder, const Vector<Vector2> &p_lines) { OccluderPolygon *oc = occluder_polygon_owner.getornull(p_occluder); ERR_FAIL_COND(!oc); @@ -1727,20 +1727,20 @@ void RasterizerCanvasRD::occluder_polygon_set_shape_as_lines(RID p_occluder, con if (p_lines.size()) { - PoolVector<uint8_t> geometry; - PoolVector<uint8_t> indices; + Vector<uint8_t> geometry; + Vector<uint8_t> indices; int lc = p_lines.size(); geometry.resize(lc * 6 * sizeof(float)); indices.resize(lc * 3 * sizeof(uint16_t)); { - PoolVector<uint8_t>::Write vw = geometry.write(); - float *vwptr = (float *)vw.ptr(); - PoolVector<uint8_t>::Write iw = indices.write(); - uint16_t *iwptr = (uint16_t *)iw.ptr(); + uint8_t *vw = geometry.ptrw(); + float *vwptr = (float *)vw; + uint8_t *iw = indices.ptrw(); + uint16_t *iwptr = (uint16_t *)iw; - PoolVector<Vector2>::Read lr = p_lines.read(); + const Vector2 *lr = p_lines.ptr(); const int POLY_HEIGHT = 16384; @@ -1789,10 +1789,10 @@ void RasterizerCanvasRD::occluder_polygon_set_shape_as_lines(RID p_occluder, con } else { //update existing - PoolVector<uint8_t>::Read vr = geometry.read(); - RD::get_singleton()->buffer_update(oc->vertex_buffer, 0, geometry.size(), vr.ptr()); - PoolVector<uint8_t>::Read ir = indices.read(); - RD::get_singleton()->buffer_update(oc->index_buffer, 0, indices.size(), ir.ptr()); + const uint8_t *vr = geometry.ptr(); + RD::get_singleton()->buffer_update(oc->vertex_buffer, 0, geometry.size(), vr); + const uint8_t *ir = indices.ptr(); + RD::get_singleton()->buffer_update(oc->index_buffer, 0, indices.size(), ir); } } } @@ -2431,11 +2431,11 @@ RasterizerCanvasRD::RasterizerCanvasRD(RasterizerStorageRD *p_storage) { { // default index buffer - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; pv.resize(6 * 4); { - PoolVector<uint8_t>::Write w = pv.write(); - int *p32 = (int *)w.ptr(); + uint8_t *w = pv.ptrw(); + int *p32 = (int *)w; p32[0] = 0; p32[1] = 1; p32[2] = 2; @@ -2482,7 +2482,7 @@ bool RasterizerCanvasRD::free(RID p_rid) { light_set_use_shadow(p_rid, false, 64); canvas_light_owner.free(p_rid); } else if (occluder_polygon_owner.owns(p_rid)) { - occluder_polygon_set_shape_as_lines(p_rid, PoolVector<Vector2>()); + occluder_polygon_set_shape_as_lines(p_rid, Vector<Vector2>()); occluder_polygon_owner.free(p_rid); } else { return false; diff --git a/servers/visual/rasterizer_rd/rasterizer_canvas_rd.h b/servers/visual/rasterizer_rd/rasterizer_canvas_rd.h index 17560ea540..894a00a436 100644 --- a/servers/visual/rasterizer_rd/rasterizer_canvas_rd.h +++ b/servers/visual/rasterizer_rd/rasterizer_canvas_rd.h @@ -482,7 +482,7 @@ public: void light_update_shadow(RID p_rid, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders); RID occluder_polygon_create(); - void occluder_polygon_set_shape_as_lines(RID p_occluder, const PoolVector<Vector2> &p_lines); + void occluder_polygon_set_shape_as_lines(RID p_occluder, const Vector<Vector2> &p_lines); void occluder_polygon_set_cull_mode(RID p_occluder, VS::CanvasOccluderPolygonCullMode p_mode); void canvas_render_items(RID p_to_render_target, Item *p_item_list, const Color &p_modulate, Light *p_light_list, const Transform2D &p_canvas_transform); diff --git a/servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp index 4b8b3334b5..c05f5cead0 100644 --- a/servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp +++ b/servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp @@ -955,11 +955,11 @@ RasterizerEffectsRD::RasterizerEffectsRD() { default_mipmap_sampler = RD::get_singleton()->sampler_create(sampler); { //create index array for copy shaders - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; pv.resize(6 * 4); { - PoolVector<uint8_t>::Write w = pv.write(); - int *p32 = (int *)w.ptr(); + uint8_t *w = pv.ptrw(); + int *p32 = (int *)w; p32[0] = 0; p32[1] = 1; p32[2] = 2; diff --git a/servers/visual/rasterizer_rd/rasterizer_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_rd.cpp index 34be4817f6..de31d9b3b7 100644 --- a/servers/visual/rasterizer_rd/rasterizer_rd.cpp +++ b/servers/visual/rasterizer_rd/rasterizer_rd.cpp @@ -128,11 +128,11 @@ void RasterizerRD::initialize() { } { //create index array for copy shader - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; pv.resize(6 * 4); { - PoolVector<uint8_t>::Write w = pv.write(); - int *p32 = (int *)w.ptr(); + uint8_t *w = pv.ptrw(); + int *p32 = (int *)w; p32[0] = 0; p32[1] = 1; p32[2] = 2; diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp index 317ffb994f..7d5593c239 100644 --- a/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp +++ b/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp @@ -1406,7 +1406,7 @@ void RasterizerSceneRD::gi_probe_update(RID p_probe, bool p_update_light_instanc if (octree_size != Vector3i()) { //can create a 3D texture - PoolVector<int> levels = storage->gi_probe_get_level_counts(gi_probe->probe); + Vector<int> levels = storage->gi_probe_get_level_counts(gi_probe->probe); RD::TextureFormat tf; tf.format = RD::DATA_FORMAT_R8G8B8A8_UNORM; diff --git a/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp index 5203873b7b..9f6b1a2b35 100644 --- a/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp +++ b/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp @@ -584,8 +584,8 @@ RID RasterizerStorageRD::texture_2d_create(const Ref<Image> &p_image) { rd_view.swizzle_b = ret_format.swizzle_b; rd_view.swizzle_a = ret_format.swizzle_a; } - PoolVector<uint8_t> data = image->get_data(); //use image data - Vector<PoolVector<uint8_t> > data_slices; + Vector<uint8_t> data = image->get_data(); //use image data + Vector<Vector<uint8_t> > data_slices; data_slices.push_back(data); texture.rd_texture = RD::get_singleton()->texture_create(rd_format, rd_view, data_slices); ERR_FAIL_COND_V(texture.rd_texture.is_null(), RID()); @@ -720,13 +720,12 @@ RID RasterizerStorageRD::texture_2d_placeholder_create() { Ref<Image> image; image.instance(); image->create(4, 4, false, Image::FORMAT_RGBA8); - image->lock(); + for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { image->set_pixel(i, j, Color(1, 0, 1, 1)); } } - image->unlock(); return texture_2d_create(image); } @@ -749,7 +748,7 @@ Ref<Image> RasterizerStorageRD::texture_2d_get(RID p_texture) const { return tex->image_cache_2d; } #endif - PoolVector<uint8_t> data = RD::get_singleton()->texture_get_data(tex->rd_texture, 0); + Vector<uint8_t> data = RD::get_singleton()->texture_get_data(tex->rd_texture, 0); ERR_FAIL_COND_V(data.size() == 0, Ref<Image>()); Ref<Image> image; image.instance(); @@ -1195,11 +1194,11 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy } break; case ShaderLanguage::TYPE_IVEC2: { - PoolVector<int> iv = value; + Vector<int> iv = value; int s = iv.size(); int32_t *gui = (int32_t *)data; - PoolVector<int>::Read r = iv.read(); + const int *r = iv.ptr(); for (int i = 0; i < 2; i++) { if (i < s) @@ -1211,11 +1210,11 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy } break; case ShaderLanguage::TYPE_IVEC3: { - PoolVector<int> iv = value; + Vector<int> iv = value; int s = iv.size(); int32_t *gui = (int32_t *)data; - PoolVector<int>::Read r = iv.read(); + const int *r = iv.ptr(); for (int i = 0; i < 3; i++) { if (i < s) @@ -1226,11 +1225,11 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy } break; case ShaderLanguage::TYPE_IVEC4: { - PoolVector<int> iv = value; + Vector<int> iv = value; int s = iv.size(); int32_t *gui = (int32_t *)data; - PoolVector<int>::Read r = iv.read(); + const int *r = iv.ptr(); for (int i = 0; i < 4; i++) { if (i < s) @@ -1248,11 +1247,11 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy } break; case ShaderLanguage::TYPE_UVEC2: { - PoolVector<int> iv = value; + Vector<int> iv = value; int s = iv.size(); uint32_t *gui = (uint32_t *)data; - PoolVector<int>::Read r = iv.read(); + const int *r = iv.ptr(); for (int i = 0; i < 2; i++) { if (i < s) @@ -1262,11 +1261,11 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy } } break; case ShaderLanguage::TYPE_UVEC3: { - PoolVector<int> iv = value; + Vector<int> iv = value; int s = iv.size(); uint32_t *gui = (uint32_t *)data; - PoolVector<int>::Read r = iv.read(); + const int *r = iv.ptr(); for (int i = 0; i < 3; i++) { if (i < s) @@ -1277,11 +1276,11 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy } break; case ShaderLanguage::TYPE_UVEC4: { - PoolVector<int> iv = value; + Vector<int> iv = value; int s = iv.size(); uint32_t *gui = (uint32_t *)data; - PoolVector<int>::Read r = iv.read(); + const int *r = iv.ptr(); for (int i = 0; i < 4; i++) { if (i < s) @@ -1955,15 +1954,15 @@ VS::BlendShapeMode RasterizerStorageRD::mesh_get_blend_shape_mode(RID p_mesh) co return mesh->blend_shape_mode; } -void RasterizerStorageRD::mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) { +void RasterizerStorageRD::mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) { Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND(!mesh); ERR_FAIL_UNSIGNED_INDEX((uint32_t)p_surface, mesh->surface_count); ERR_FAIL_COND(p_data.size() == 0); uint64_t data_size = p_data.size(); - PoolVector<uint8_t>::Read r = p_data.read(); + const uint8_t *r = p_data.ptr(); - RD::get_singleton()->buffer_update(mesh->surfaces[p_surface]->vertex_buffer, p_offset, data_size, r.ptr()); + RD::get_singleton()->buffer_update(mesh->surfaces[p_surface]->vertex_buffer, p_offset, data_size, r); } void RasterizerStorageRD::mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) { @@ -2012,7 +2011,7 @@ VS::SurfaceData RasterizerStorageRD::mesh_get_surface(RID p_mesh, int p_surface) sd.bone_aabbs = s.bone_aabbs; for (int i = 0; i < s.blend_shapes.size(); i++) { - PoolVector<uint8_t> bs = RD::get_singleton()->buffer_get_data(s.blend_shapes[i]); + Vector<uint8_t> bs = RD::get_singleton()->buffer_get_data(s.blend_shapes[i]); sd.blend_shapes.push_back(bs); } @@ -2386,7 +2385,7 @@ void RasterizerStorageRD::multimesh_allocate(RID p_multimesh, int p_instances, V multimesh->buffer_set = false; //print_line("allocate, elements: " + itos(p_instances) + " 2D: " + itos(p_transform_format == VS::MULTIMESH_TRANSFORM_2D) + " colors " + itos(multimesh->uses_colors) + " data " + itos(multimesh->uses_custom_data) + " stride " + itos(multimesh->stride_cache) + " total size " + itos(multimesh->stride_cache * multimesh->instances)); - multimesh->data_cache = PoolVector<float>(); + multimesh->data_cache = Vector<float>(); multimesh->aabb = AABB(); multimesh->aabb_dirty = false; multimesh->visible_instances = MIN(multimesh->visible_instances, multimesh->instances); @@ -2421,9 +2420,9 @@ void RasterizerStorageRD::multimesh_set_mesh(RID p_multimesh, RID p_mesh) { } else if (multimesh->instances) { //need to re-create AABB unfortunately, calling this has a penalty if (multimesh->buffer_set) { - PoolVector<uint8_t> buffer = RD::get_singleton()->buffer_get_data(multimesh->buffer); - PoolVector<uint8_t>::Read r = buffer.read(); - const float *data = (const float *)r.ptr(); + Vector<uint8_t> buffer = RD::get_singleton()->buffer_get_data(multimesh->buffer); + const uint8_t *r = buffer.ptr(); + const float *data = (const float *)r; _multimesh_re_create_aabb(multimesh, data, multimesh->instances); } } @@ -2442,17 +2441,17 @@ void RasterizerStorageRD::_multimesh_make_local(MultiMesh *multimesh) const { // for this, the data must reside on CPU, so just copy it there. multimesh->data_cache.resize(multimesh->instances * multimesh->stride_cache); { - PoolVector<float>::Write w = multimesh->data_cache.write(); + float *w = multimesh->data_cache.ptrw(); if (multimesh->buffer_set) { - PoolVector<uint8_t> buffer = RD::get_singleton()->buffer_get_data(multimesh->buffer); + Vector<uint8_t> buffer = RD::get_singleton()->buffer_get_data(multimesh->buffer); { - PoolVector<uint8_t>::Read r = buffer.read(); - copymem(w.ptr(), r.ptr(), buffer.size()); + const uint8_t *r = buffer.ptr(); + copymem(w, r, buffer.size()); } } else { - zeromem(w.ptr(), multimesh->instances * multimesh->stride_cache * sizeof(float)); + zeromem(w, multimesh->instances * multimesh->stride_cache * sizeof(float)); } } uint32_t data_cache_dirty_region_count = (multimesh->instances - 1) / MULTIMESH_DIRTY_REGION_SIZE + 1; @@ -2564,9 +2563,9 @@ void RasterizerStorageRD::multimesh_instance_set_transform(RID p_multimesh, int _multimesh_make_local(multimesh); { - PoolVector<float>::Write w = multimesh->data_cache.write(); + float *w = multimesh->data_cache.ptrw(); - float *dataptr = w.ptr() + p_index * multimesh->stride_cache; + float *dataptr = w + p_index * multimesh->stride_cache; dataptr[0] = p_transform.basis.elements[0][0]; dataptr[1] = p_transform.basis.elements[0][1]; @@ -2595,9 +2594,9 @@ void RasterizerStorageRD::multimesh_instance_set_transform_2d(RID p_multimesh, i _multimesh_make_local(multimesh); { - PoolVector<float>::Write w = multimesh->data_cache.write(); + float *w = multimesh->data_cache.ptrw(); - float *dataptr = w.ptr() + p_index * multimesh->stride_cache; + float *dataptr = w + p_index * multimesh->stride_cache; dataptr[0] = p_transform.elements[0][0]; dataptr[1] = p_transform.elements[1][0]; @@ -2621,9 +2620,9 @@ void RasterizerStorageRD::multimesh_instance_set_color(RID p_multimesh, int p_in _multimesh_make_local(multimesh); { - PoolVector<float>::Write w = multimesh->data_cache.write(); + float *w = multimesh->data_cache.ptrw(); - float *dataptr = w.ptr() + p_index * multimesh->stride_cache + multimesh->color_offset_cache; + float *dataptr = w + p_index * multimesh->stride_cache + multimesh->color_offset_cache; dataptr[0] = p_color.r; dataptr[1] = p_color.g; @@ -2642,9 +2641,9 @@ void RasterizerStorageRD::multimesh_instance_set_custom_data(RID p_multimesh, in _multimesh_make_local(multimesh); { - PoolVector<float>::Write w = multimesh->data_cache.write(); + float *w = multimesh->data_cache.ptrw(); - float *dataptr = w.ptr() + p_index * multimesh->stride_cache + multimesh->custom_data_offset_cache; + float *dataptr = w + p_index * multimesh->stride_cache + multimesh->custom_data_offset_cache; dataptr[0] = p_color.r; dataptr[1] = p_color.g; @@ -2674,9 +2673,9 @@ Transform RasterizerStorageRD::multimesh_instance_get_transform(RID p_multimesh, Transform t; { - PoolVector<float>::Read r = multimesh->data_cache.read(); + const float *r = multimesh->data_cache.ptr(); - const float *dataptr = r.ptr() + p_index * multimesh->stride_cache; + const float *dataptr = r + p_index * multimesh->stride_cache; t.basis.elements[0][0] = dataptr[0]; t.basis.elements[0][1] = dataptr[1]; @@ -2705,9 +2704,9 @@ Transform2D RasterizerStorageRD::multimesh_instance_get_transform_2d(RID p_multi Transform2D t; { - PoolVector<float>::Read r = multimesh->data_cache.read(); + const float *r = multimesh->data_cache.ptr(); - const float *dataptr = r.ptr() + p_index * multimesh->stride_cache; + const float *dataptr = r + p_index * multimesh->stride_cache; t.elements[0][0] = dataptr[0]; t.elements[1][0] = dataptr[1]; @@ -2730,9 +2729,9 @@ Color RasterizerStorageRD::multimesh_instance_get_color(RID p_multimesh, int p_i Color c; { - PoolVector<float>::Read r = multimesh->data_cache.read(); + const float *r = multimesh->data_cache.ptr(); - const float *dataptr = r.ptr() + p_index * multimesh->stride_cache + multimesh->color_offset_cache; + const float *dataptr = r + p_index * multimesh->stride_cache + multimesh->color_offset_cache; c.r = dataptr[0]; c.g = dataptr[1]; @@ -2753,9 +2752,9 @@ Color RasterizerStorageRD::multimesh_instance_get_custom_data(RID p_multimesh, i Color c; { - PoolVector<float>::Read r = multimesh->data_cache.read(); + const float *r = multimesh->data_cache.ptr(); - const float *dataptr = r.ptr() + p_index * multimesh->stride_cache + multimesh->custom_data_offset_cache; + const float *dataptr = r + p_index * multimesh->stride_cache + multimesh->custom_data_offset_cache; c.r = dataptr[0]; c.g = dataptr[1]; @@ -2766,14 +2765,14 @@ Color RasterizerStorageRD::multimesh_instance_get_custom_data(RID p_multimesh, i return c; } -void RasterizerStorageRD::multimesh_set_buffer(RID p_multimesh, const PoolVector<float> &p_buffer) { +void RasterizerStorageRD::multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_buffer) { MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); ERR_FAIL_COND(!multimesh); ERR_FAIL_COND(p_buffer.size() != (multimesh->instances * (int)multimesh->stride_cache)); { - PoolVector<float>::Read r = p_buffer.read(); - RD::get_singleton()->buffer_update(multimesh->buffer, 0, p_buffer.size() * sizeof(float), r.ptr(), false); + const float *r = p_buffer.ptr(); + RD::get_singleton()->buffer_update(multimesh->buffer, 0, p_buffer.size() * sizeof(float), r, false); multimesh->buffer_set = true; } @@ -2792,30 +2791,30 @@ void RasterizerStorageRD::multimesh_set_buffer(RID p_multimesh, const PoolVector _multimesh_mark_all_dirty(multimesh, false, true); //update AABB } else if (multimesh->mesh.is_valid()) { //if we have a mesh set, we need to re-generate the AABB from the new data - PoolVector<float>::Read r = p_buffer.read(); - const float *data = r.ptr(); + const float *data = p_buffer.ptr(); + _multimesh_re_create_aabb(multimesh, data, multimesh->instances); multimesh->instance_dependency.instance_notify_changed(true, false); } } -PoolVector<float> RasterizerStorageRD::multimesh_get_buffer(RID p_multimesh) const { +Vector<float> RasterizerStorageRD::multimesh_get_buffer(RID p_multimesh) const { MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); - ERR_FAIL_COND_V(!multimesh, PoolVector<float>()); + ERR_FAIL_COND_V(!multimesh, Vector<float>()); if (multimesh->buffer.is_null()) { - return PoolVector<float>(); + return Vector<float>(); } else if (multimesh->data_cache.size()) { return multimesh->data_cache; } else { //get from memory - PoolVector<uint8_t> buffer = RD::get_singleton()->buffer_get_data(multimesh->buffer); - PoolVector<float> ret; + Vector<uint8_t> buffer = RD::get_singleton()->buffer_get_data(multimesh->buffer); + Vector<float> ret; ret.resize(multimesh->instances); { - PoolVector<float>::Write w = multimesh->data_cache.write(); - PoolVector<uint8_t>::Read r = buffer.read(); - copymem(w.ptr(), r.ptr(), buffer.size()); + float *w = multimesh->data_cache.ptrw(); + const uint8_t *r = buffer.ptr(); + copymem(w, r, buffer.size()); } return ret; @@ -2860,8 +2859,7 @@ void RasterizerStorageRD::_update_dirty_multimeshes() { MultiMesh *multimesh = multimesh_dirty_list; if (multimesh->data_cache.size()) { //may have been cleared, so only process if it exists - PoolVector<float>::Read r = multimesh->data_cache.read(); - const float *data = r.ptr(); + const float *data = multimesh->data_cache.ptr(); uint32_t visible_instances = multimesh->visible_instances >= 0 ? multimesh->visible_instances : multimesh->instances; @@ -3552,7 +3550,7 @@ RID RasterizerStorageRD::gi_probe_create() { return gi_probe_owner.make_rid(GIProbe()); } -void RasterizerStorageRD::gi_probe_allocate(RID p_gi_probe, const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3i &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 RasterizerStorageRD::gi_probe_allocate(RID p_gi_probe, const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3i &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) { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND(!gi_probe); @@ -3597,7 +3595,7 @@ void RasterizerStorageRD::gi_probe_allocate(RID p_gi_probe, const Transform &p_t tf.depth = gi_probe->octree_size.z; tf.type = RD::TEXTURE_TYPE_3D; tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_UPDATE_BIT | RD::TEXTURE_USAGE_CAN_COPY_FROM_BIT; - Vector<PoolVector<uint8_t> > s; + Vector<Vector<uint8_t> > s; s.push_back(p_distance_field); gi_probe->sdf_texture = RD::get_singleton()->texture_create(tf, RD::TextureView(), s); } @@ -3690,36 +3688,36 @@ Vector3i RasterizerStorageRD::gi_probe_get_octree_size(RID p_gi_probe) const { ERR_FAIL_COND_V(!gi_probe, Vector3i()); return gi_probe->octree_size; } -PoolVector<uint8_t> RasterizerStorageRD::gi_probe_get_octree_cells(RID p_gi_probe) const { +Vector<uint8_t> RasterizerStorageRD::gi_probe_get_octree_cells(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); - ERR_FAIL_COND_V(!gi_probe, PoolVector<uint8_t>()); + ERR_FAIL_COND_V(!gi_probe, Vector<uint8_t>()); if (gi_probe->octree_buffer.is_valid()) { return RD::get_singleton()->buffer_get_data(gi_probe->octree_buffer); } - return PoolVector<uint8_t>(); + return Vector<uint8_t>(); } -PoolVector<uint8_t> RasterizerStorageRD::gi_probe_get_data_cells(RID p_gi_probe) const { +Vector<uint8_t> RasterizerStorageRD::gi_probe_get_data_cells(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); - ERR_FAIL_COND_V(!gi_probe, PoolVector<uint8_t>()); + ERR_FAIL_COND_V(!gi_probe, Vector<uint8_t>()); if (gi_probe->data_buffer.is_valid()) { return RD::get_singleton()->buffer_get_data(gi_probe->data_buffer); } - return PoolVector<uint8_t>(); + return Vector<uint8_t>(); } -PoolVector<uint8_t> RasterizerStorageRD::gi_probe_get_distance_field(RID p_gi_probe) const { +Vector<uint8_t> RasterizerStorageRD::gi_probe_get_distance_field(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); - ERR_FAIL_COND_V(!gi_probe, PoolVector<uint8_t>()); + ERR_FAIL_COND_V(!gi_probe, Vector<uint8_t>()); if (gi_probe->data_buffer.is_valid()) { return RD::get_singleton()->texture_get_data(gi_probe->sdf_texture, 0); } - return PoolVector<uint8_t>(); + return Vector<uint8_t>(); } -PoolVector<int> RasterizerStorageRD::gi_probe_get_level_counts(RID p_gi_probe) const { +Vector<int> RasterizerStorageRD::gi_probe_get_level_counts(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); - ERR_FAIL_COND_V(!gi_probe, PoolVector<int>()); + ERR_FAIL_COND_V(!gi_probe, Vector<int>()); return gi_probe->level_counts; } @@ -4387,7 +4385,7 @@ bool RasterizerStorageRD::free(RID p_rid) { reflection_probe->instance_dependency.instance_notify_deleted(p_rid); reflection_probe_owner.free(p_rid); } else if (gi_probe_owner.owns(p_rid)) { - gi_probe_allocate(p_rid, Transform(), AABB(), Vector3i(), PoolVector<uint8_t>(), PoolVector<uint8_t>(), PoolVector<uint8_t>(), PoolVector<int>()); //deallocate + gi_probe_allocate(p_rid, Transform(), AABB(), Vector3i(), Vector<uint8_t>(), Vector<uint8_t>(), Vector<uint8_t>(), Vector<int>()); //deallocate GIProbe *gi_probe = gi_probe_owner.getornull(p_rid); gi_probe->instance_dependency.instance_notify_deleted(p_rid); gi_probe_owner.free(p_rid); @@ -4463,7 +4461,7 @@ RasterizerStorageRD::RasterizerStorageRD() { tformat.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_UPDATE_BIT; tformat.type = RD::TEXTURE_TYPE_2D; - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; pv.resize(16 * 4); for (int i = 0; i < 16; i++) { pv.set(i * 4 + 0, 255); @@ -4473,7 +4471,7 @@ RasterizerStorageRD::RasterizerStorageRD() { } { - Vector<PoolVector<uint8_t> > vpv; + Vector<Vector<uint8_t> > vpv; vpv.push_back(pv); default_rd_textures[DEFAULT_RD_TEXTURE_WHITE] = RD::get_singleton()->texture_create(tformat, RD::TextureView(), vpv); } @@ -4486,7 +4484,7 @@ RasterizerStorageRD::RasterizerStorageRD() { } { - Vector<PoolVector<uint8_t> > vpv; + Vector<Vector<uint8_t> > vpv; vpv.push_back(pv); default_rd_textures[DEFAULT_RD_TEXTURE_BLACK] = RD::get_singleton()->texture_create(tformat, RD::TextureView(), vpv); } @@ -4499,7 +4497,7 @@ RasterizerStorageRD::RasterizerStorageRD() { } { - Vector<PoolVector<uint8_t> > vpv; + Vector<Vector<uint8_t> > vpv; vpv.push_back(pv); default_rd_textures[DEFAULT_RD_TEXTURE_NORMAL] = RD::get_singleton()->texture_create(tformat, RD::TextureView(), vpv); } @@ -4512,7 +4510,7 @@ RasterizerStorageRD::RasterizerStorageRD() { } { - Vector<PoolVector<uint8_t> > vpv; + Vector<Vector<uint8_t> > vpv; vpv.push_back(pv); default_rd_textures[DEFAULT_RD_TEXTURE_ANISO] = RD::get_singleton()->texture_create(tformat, RD::TextureView(), vpv); } @@ -4537,7 +4535,7 @@ RasterizerStorageRD::RasterizerStorageRD() { tformat.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_UPDATE_BIT; tformat.type = RD::TEXTURE_TYPE_CUBE_ARRAY; - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; pv.resize(16 * 4); for (int i = 0; i < 16; i++) { pv.set(i * 4 + 0, 0); @@ -4547,7 +4545,7 @@ RasterizerStorageRD::RasterizerStorageRD() { } { - Vector<PoolVector<uint8_t> > vpv; + Vector<Vector<uint8_t> > vpv; for (int i = 0; i < 6; i++) { vpv.push_back(pv); } @@ -4565,7 +4563,7 @@ RasterizerStorageRD::RasterizerStorageRD() { tformat.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_UPDATE_BIT; tformat.type = RD::TEXTURE_TYPE_CUBE; - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; pv.resize(16 * 4); for (int i = 0; i < 16; i++) { pv.set(i * 4 + 0, 0); @@ -4575,7 +4573,7 @@ RasterizerStorageRD::RasterizerStorageRD() { } { - Vector<PoolVector<uint8_t> > vpv; + Vector<Vector<uint8_t> > vpv; for (int i = 0; i < 6; i++) { vpv.push_back(pv); } @@ -4593,7 +4591,7 @@ RasterizerStorageRD::RasterizerStorageRD() { tformat.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_UPDATE_BIT; tformat.type = RD::TEXTURE_TYPE_3D; - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; pv.resize(64 * 4); for (int i = 0; i < 64; i++) { pv.set(i * 4 + 0, 0); @@ -4603,7 +4601,7 @@ RasterizerStorageRD::RasterizerStorageRD() { } { - Vector<PoolVector<uint8_t> > vpv; + Vector<Vector<uint8_t> > vpv; vpv.push_back(pv); default_rd_textures[DEFAULT_RD_TEXTURE_3D_WHITE] = RD::get_singleton()->texture_create(tformat, RD::TextureView(), vpv); } @@ -4682,11 +4680,11 @@ RasterizerStorageRD::RasterizerStorageRD() { { //vertex - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; buffer.resize(sizeof(float) * 3); { - PoolVector<uint8_t>::Write w = buffer.write(); - float *fptr = (float *)w.ptr(); + uint8_t *w = buffer.ptrw(); + float *fptr = (float *)w; fptr[0] = 0.0; fptr[1] = 0.0; fptr[2] = 0.0; @@ -4695,11 +4693,11 @@ RasterizerStorageRD::RasterizerStorageRD() { } { //normal - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; buffer.resize(sizeof(float) * 3); { - PoolVector<uint8_t>::Write w = buffer.write(); - float *fptr = (float *)w.ptr(); + uint8_t *w = buffer.ptrw(); + float *fptr = (float *)w; fptr[0] = 1.0; fptr[1] = 0.0; fptr[2] = 0.0; @@ -4708,11 +4706,11 @@ RasterizerStorageRD::RasterizerStorageRD() { } { //tangent - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; buffer.resize(sizeof(float) * 4); { - PoolVector<uint8_t>::Write w = buffer.write(); - float *fptr = (float *)w.ptr(); + uint8_t *w = buffer.ptrw(); + float *fptr = (float *)w; fptr[0] = 1.0; fptr[1] = 0.0; fptr[2] = 0.0; @@ -4722,11 +4720,11 @@ RasterizerStorageRD::RasterizerStorageRD() { } { //color - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; buffer.resize(sizeof(float) * 4); { - PoolVector<uint8_t>::Write w = buffer.write(); - float *fptr = (float *)w.ptr(); + uint8_t *w = buffer.ptrw(); + float *fptr = (float *)w; fptr[0] = 1.0; fptr[1] = 1.0; fptr[2] = 1.0; @@ -4736,22 +4734,22 @@ RasterizerStorageRD::RasterizerStorageRD() { } { //tex uv 1 - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; buffer.resize(sizeof(float) * 2); { - PoolVector<uint8_t>::Write w = buffer.write(); - float *fptr = (float *)w.ptr(); + uint8_t *w = buffer.ptrw(); + float *fptr = (float *)w; fptr[0] = 0.0; fptr[1] = 0.0; } mesh_default_rd_buffers[DEFAULT_RD_BUFFER_TEX_UV] = RD::get_singleton()->vertex_buffer_create(buffer.size(), buffer); } { //tex uv 2 - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; buffer.resize(sizeof(float) * 2); { - PoolVector<uint8_t>::Write w = buffer.write(); - float *fptr = (float *)w.ptr(); + uint8_t *w = buffer.ptrw(); + float *fptr = (float *)w; fptr[0] = 0.0; fptr[1] = 0.0; } @@ -4759,11 +4757,11 @@ RasterizerStorageRD::RasterizerStorageRD() { } { //bones - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; buffer.resize(sizeof(uint32_t) * 4); { - PoolVector<uint8_t>::Write w = buffer.write(); - uint32_t *fptr = (uint32_t *)w.ptr(); + uint8_t *w = buffer.ptrw(); + uint32_t *fptr = (uint32_t *)w; fptr[0] = 0; fptr[1] = 0; fptr[2] = 0; @@ -4773,11 +4771,11 @@ RasterizerStorageRD::RasterizerStorageRD() { } { //weights - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; buffer.resize(sizeof(float) * 4); { - PoolVector<uint8_t>::Write w = buffer.write(); - float *fptr = (float *)w.ptr(); + uint8_t *w = buffer.ptrw(); + float *fptr = (float *)w; fptr[0] = 0.0; fptr[1] = 0.0; fptr[2] = 0.0; diff --git a/servers/visual/rasterizer_rd/rasterizer_storage_rd.h b/servers/visual/rasterizer_rd/rasterizer_storage_rd.h index 055737d65d..48097ffaac 100644 --- a/servers/visual/rasterizer_rd/rasterizer_storage_rd.h +++ b/servers/visual/rasterizer_rd/rasterizer_storage_rd.h @@ -306,7 +306,7 @@ private: uint32_t color_offset_cache = 0; uint32_t custom_data_offset_cache = 0; - PoolVector<float> data_cache; //used if individual setting is used + Vector<float> data_cache; //used if individual setting is used bool *data_cache_dirty_regions = nullptr; uint32_t data_cache_used_dirty_regions = 0; @@ -413,7 +413,7 @@ private: uint32_t octree_buffer_size = 0; uint32_t data_buffer_size = 0; - PoolVector<int> level_counts; + Vector<int> level_counts; int cell_count = 0; @@ -621,7 +621,7 @@ public: virtual void mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode); virtual VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const; - virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data); + virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data); virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material); virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const; @@ -747,8 +747,8 @@ public: Color multimesh_instance_get_color(RID p_multimesh, int p_index) const; Color multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const; - void multimesh_set_buffer(RID p_multimesh, const PoolVector<float> &p_buffer); - PoolVector<float> multimesh_get_buffer(RID p_multimesh) const; + void multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_buffer); + Vector<float> multimesh_get_buffer(RID p_multimesh) const; void multimesh_set_visible_instances(RID p_multimesh, int p_visible); int multimesh_get_visible_instances(RID p_multimesh) const; @@ -969,15 +969,15 @@ public: RID gi_probe_create(); - void gi_probe_allocate(RID p_gi_probe, const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3i &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 gi_probe_allocate(RID p_gi_probe, const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3i &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 gi_probe_get_bounds(RID p_gi_probe) const; Vector3i gi_probe_get_octree_size(RID p_gi_probe) const; - PoolVector<uint8_t> gi_probe_get_octree_cells(RID p_gi_probe) const; - PoolVector<uint8_t> gi_probe_get_data_cells(RID p_gi_probe) const; - PoolVector<uint8_t> gi_probe_get_distance_field(RID p_gi_probe) const; + Vector<uint8_t> gi_probe_get_octree_cells(RID p_gi_probe) const; + Vector<uint8_t> gi_probe_get_data_cells(RID p_gi_probe) const; + Vector<uint8_t> gi_probe_get_distance_field(RID p_gi_probe) const; - PoolVector<int> gi_probe_get_level_counts(RID p_gi_probe) const; + Vector<int> gi_probe_get_level_counts(RID p_gi_probe) const; Transform gi_probe_get_to_cell_xform(RID p_gi_probe) const; void gi_probe_set_dynamic_range(RID p_gi_probe, float p_range); @@ -1022,12 +1022,12 @@ public: void lightmap_capture_set_bounds(RID p_capture, const AABB &p_bounds) {} AABB lightmap_capture_get_bounds(RID p_capture) const { return AABB(); } - void lightmap_capture_set_octree(RID p_capture, const PoolVector<uint8_t> &p_octree) {} + void lightmap_capture_set_octree(RID p_capture, const Vector<uint8_t> &p_octree) {} RID lightmap_capture_create() { return RID(); } - PoolVector<uint8_t> lightmap_capture_get_octree(RID p_capture) const { - return PoolVector<uint8_t>(); + Vector<uint8_t> lightmap_capture_get_octree(RID p_capture) const { + return Vector<uint8_t>(); } void lightmap_capture_set_octree_cell_transform(RID p_capture, const Transform &p_xform) {} Transform lightmap_capture_get_octree_cell_transform(RID p_capture) const { return Transform(); } @@ -1035,7 +1035,7 @@ public: int lightmap_capture_get_octree_cell_subdiv(RID p_capture) const { return 0; } void lightmap_capture_set_energy(RID p_capture, float p_energy) {} float lightmap_capture_get_energy(RID p_capture) const { return 0.0; } - const PoolVector<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const { + const Vector<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const { return NULL; } diff --git a/servers/visual/rendering_device.cpp b/servers/visual/rendering_device.cpp index d7c88d5671..3c1795161d 100644 --- a/servers/visual/rendering_device.cpp +++ b/servers/visual/rendering_device.cpp @@ -46,15 +46,15 @@ void RenderingDevice::shader_set_cache_function(ShaderCacheFunction p_function) cache_function = p_function; } -PoolVector<uint8_t> RenderingDevice::shader_compile_from_source(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language, String *r_error, bool p_allow_cache) { +Vector<uint8_t> RenderingDevice::shader_compile_from_source(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language, String *r_error, bool p_allow_cache) { if (p_allow_cache && cache_function) { - PoolVector<uint8_t> cache = cache_function(p_stage, p_source_code, p_language); + Vector<uint8_t> cache = cache_function(p_stage, p_source_code, p_language); if (cache.size()) { return cache; } } - ERR_FAIL_COND_V(!compile_function, PoolVector<uint8_t>()); + ERR_FAIL_COND_V(!compile_function, Vector<uint8_t>()); return compile_function(p_stage, p_source_code, p_language, r_error); } diff --git a/servers/visual/rendering_device.h b/servers/visual/rendering_device.h index d7b13a739c..c3b937d5e2 100644 --- a/servers/visual/rendering_device.h +++ b/servers/visual/rendering_device.h @@ -55,8 +55,8 @@ public: SHADER_LANGUAGE_HLSL }; - typedef PoolVector<uint8_t> (*ShaderCompileFunction)(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language, String *r_error); - typedef PoolVector<uint8_t> (*ShaderCacheFunction)(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language); + typedef Vector<uint8_t> (*ShaderCompileFunction)(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language, String *r_error); + typedef Vector<uint8_t> (*ShaderCacheFunction)(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language); private: static ShaderCompileFunction compile_function; @@ -407,7 +407,7 @@ public: } }; - virtual RID texture_create(const TextureFormat &p_format, const TextureView &p_view, const Vector<PoolVector<uint8_t> > &p_data = Vector<PoolVector<uint8_t> >()) = 0; + virtual RID texture_create(const TextureFormat &p_format, const TextureView &p_view, const Vector<Vector<uint8_t> > &p_data = Vector<Vector<uint8_t> >()) = 0; virtual RID texture_create_shared(const TextureView &p_view, RID p_with_texture) = 0; enum TextureSliceType { @@ -418,8 +418,8 @@ public: virtual RID texture_create_shared_from_slice(const TextureView &p_view, RID p_with_texture, uint32_t p_layer, uint32_t p_mipmap, TextureSliceType p_slice_type = TEXTURE_SLICE_2D) = 0; - virtual Error texture_update(RID p_texture, uint32_t p_layer, const PoolVector<uint8_t> &p_data, bool p_sync_with_draw = false) = 0; //this function can be used from any thread and it takes effect at the begining of the frame, unless sync with draw is used, which is used to mix updates with draw calls - virtual PoolVector<uint8_t> texture_get_data(RID p_texture, uint32_t p_layer) = 0; // CPU textures will return immediately, while GPU textures will most likely force a flush + virtual Error texture_update(RID p_texture, uint32_t p_layer, const Vector<uint8_t> &p_data, bool p_sync_with_draw = false) = 0; //this function can be used from any thread and it takes effect at the begining of the frame, unless sync with draw is used, which is used to mix updates with draw calls + virtual Vector<uint8_t> texture_get_data(RID p_texture, uint32_t p_layer) = 0; // CPU textures will return immediately, while GPU textures will most likely force a flush virtual bool texture_is_format_supported_for_usage(DataFormat p_format, uint32_t p_usage) const = 0; virtual bool texture_is_shared(RID p_texture) = 0; @@ -542,7 +542,7 @@ public: frequency = VERTEX_FREQUENCY_VERTEX; } }; - virtual RID vertex_buffer_create(uint32_t p_size_bytes, const PoolVector<uint8_t> &p_data = PoolVector<uint8_t>()) = 0; + virtual RID vertex_buffer_create(uint32_t p_size_bytes, const Vector<uint8_t> &p_data = Vector<uint8_t>()) = 0; typedef int64_t VertexFormatID; @@ -555,21 +555,21 @@ public: INDEX_BUFFER_FORMAT_UINT32, }; - virtual RID index_buffer_create(uint32_t p_size_indices, IndexBufferFormat p_format, const PoolVector<uint8_t> &p_data = PoolVector<uint8_t>(), bool p_use_restart_indices = false) = 0; + virtual RID index_buffer_create(uint32_t p_size_indices, IndexBufferFormat p_format, const Vector<uint8_t> &p_data = Vector<uint8_t>(), bool p_use_restart_indices = false) = 0; virtual RID index_array_create(RID p_index_buffer, uint32_t p_index_offset, uint32_t p_index_count) = 0; /****************/ /**** SHADER ****/ /****************/ - virtual PoolVector<uint8_t> shader_compile_from_source(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language = SHADER_LANGUAGE_GLSL, String *r_error = NULL, bool p_allow_cache = true); + virtual Vector<uint8_t> shader_compile_from_source(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language = SHADER_LANGUAGE_GLSL, String *r_error = NULL, bool p_allow_cache = true); static void shader_set_compile_function(ShaderCompileFunction p_function); static void shader_set_cache_function(ShaderCacheFunction p_function); struct ShaderStageData { ShaderStage shader_stage; - PoolVector<uint8_t> spir_v; + Vector<uint8_t> spir_v; ShaderStageData() { shader_stage = SHADER_STAGE_VERTEX; @@ -597,9 +597,9 @@ public: UNIFORM_TYPE_MAX }; - virtual RID uniform_buffer_create(uint32_t p_size_bytes, const PoolVector<uint8_t> &p_data = PoolVector<uint8_t>()) = 0; - virtual RID storage_buffer_create(uint32_t p_size, const PoolVector<uint8_t> &p_data = PoolVector<uint8_t>()) = 0; - virtual RID texture_buffer_create(uint32_t p_size_elements, DataFormat p_format, const PoolVector<uint8_t> &p_data = PoolVector<uint8_t>()) = 0; + virtual RID uniform_buffer_create(uint32_t p_size_bytes, const Vector<uint8_t> &p_data = Vector<uint8_t>()) = 0; + virtual RID storage_buffer_create(uint32_t p_size, const Vector<uint8_t> &p_data = Vector<uint8_t>()) = 0; + virtual RID texture_buffer_create(uint32_t p_size_elements, DataFormat p_format, const Vector<uint8_t> &p_data = Vector<uint8_t>()) = 0; struct Uniform { UniformType type; @@ -622,7 +622,7 @@ public: virtual bool uniform_set_is_valid(RID p_uniform_set) = 0; virtual Error buffer_update(RID p_buffer, uint32_t p_offset, uint32_t p_size, const void *p_data, bool p_sync_with_draw = false) = 0; //this function can be used from any thread and it takes effect at the begining of the frame, unless sync with draw is used, which is used to mix updates with draw calls - virtual PoolVector<uint8_t> buffer_get_data(RID p_buffer) = 0; //this causes stall, only use to retrieve large buffers for saving + virtual Vector<uint8_t> buffer_get_data(RID p_buffer) = 0; //this causes stall, only use to retrieve large buffers for saving /*************************/ /**** RENDER PIPELINE ****/ diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index a7c18f184d..438ec2079c 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -2657,7 +2657,7 @@ PropertyInfo ShaderLanguage::uniform_to_property_info(const ShaderNode::Uniform case ShaderLanguage::TYPE_UVEC3: case ShaderLanguage::TYPE_UVEC4: { - pi.type = Variant::POOL_INT_ARRAY; + pi.type = Variant::PACKED_INT_ARRAY; } break; case ShaderLanguage::TYPE_FLOAT: { pi.type = Variant::REAL; diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp index 69f843eb4b..c1833fea44 100644 --- a/servers/visual/visual_server_canvas.cpp +++ b/servers/visual/visual_server_canvas.cpp @@ -1265,20 +1265,20 @@ RID VisualServerCanvas::canvas_occluder_polygon_create() { occluder_poly->occluder = VSG::canvas_render->occluder_polygon_create(); return canvas_light_occluder_polygon_owner.make_rid(occluder_poly); } -void VisualServerCanvas::canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const PoolVector<Vector2> &p_shape, bool p_closed) { +void VisualServerCanvas::canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const Vector<Vector2> &p_shape, bool p_closed) { if (p_shape.size() < 3) { canvas_occluder_polygon_set_shape_as_lines(p_occluder_polygon, p_shape); return; } - PoolVector<Vector2> lines; + Vector<Vector2> lines; int lc = p_shape.size() * 2; lines.resize(lc - (p_closed ? 0 : 2)); { - PoolVector<Vector2>::Write w = lines.write(); - PoolVector<Vector2>::Read r = p_shape.read(); + Vector2 *w = lines.ptrw(); + const Vector2 *r = p_shape.ptr(); int max = lc / 2; if (!p_closed) { @@ -1295,7 +1295,7 @@ void VisualServerCanvas::canvas_occluder_polygon_set_shape(RID p_occluder_polygo canvas_occluder_polygon_set_shape_as_lines(p_occluder_polygon, lines); } -void VisualServerCanvas::canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const PoolVector<Vector2> &p_shape) { +void VisualServerCanvas::canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const Vector<Vector2> &p_shape) { LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.getornull(p_occluder_polygon); ERR_FAIL_COND(!occluder_poly); @@ -1304,7 +1304,7 @@ void VisualServerCanvas::canvas_occluder_polygon_set_shape_as_lines(RID p_occlud int lc = p_shape.size(); occluder_poly->aabb = Rect2(); { - PoolVector<Vector2>::Read r = p_shape.read(); + const Vector2 *r = p_shape.ptr(); for (int i = 0; i < lc; i++) { if (i == 0) occluder_poly->aabb.position = r[i]; diff --git a/servers/visual/visual_server_canvas.h b/servers/visual/visual_server_canvas.h index c120a90314..dea4183752 100644 --- a/servers/visual/visual_server_canvas.h +++ b/servers/visual/visual_server_canvas.h @@ -257,8 +257,8 @@ public: void canvas_light_occluder_set_light_mask(RID p_occluder, int p_mask); RID canvas_occluder_polygon_create(); - void canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const PoolVector<Vector2> &p_shape, bool p_closed); - void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const PoolVector<Vector2> &p_shape); + void canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const Vector<Vector2> &p_shape, bool p_closed); + void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const Vector<Vector2> &p_shape); void canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon, VS::CanvasOccluderPolygonCullMode p_mode); diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 297f0727a0..4fea6082f4 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -233,7 +233,7 @@ public: BIND2(mesh_set_blend_shape_mode, RID, BlendShapeMode) BIND1RC(BlendShapeMode, mesh_get_blend_shape_mode, RID) - BIND4(mesh_surface_update_region, RID, int, int, const PoolVector<uint8_t> &) + BIND4(mesh_surface_update_region, RID, int, int, const Vector<uint8_t> &) BIND3(mesh_surface_set_material, RID, int, RID) BIND2RC(RID, mesh_surface_get_material, RID, int) @@ -268,8 +268,8 @@ public: BIND2RC(Color, multimesh_instance_get_color, RID, int) BIND2RC(Color, multimesh_instance_get_custom_data, RID, int) - BIND2(multimesh_set_buffer, RID, const PoolVector<float> &) - BIND1RC(PoolVector<float>, multimesh_get_buffer, RID) + BIND2(multimesh_set_buffer, RID, const Vector<float> &) + BIND1RC(Vector<float>, multimesh_get_buffer, RID) BIND2(multimesh_set_visible_instances, RID, int) BIND1RC(int, multimesh_get_visible_instances, RID) @@ -344,14 +344,14 @@ public: BIND0R(RID, gi_probe_create) - BIND8(gi_probe_allocate, RID, const Transform &, const AABB &, const Vector3i &, const PoolVector<uint8_t> &, const PoolVector<uint8_t> &, const PoolVector<uint8_t> &, const PoolVector<int> &) + BIND8(gi_probe_allocate, RID, const Transform &, const AABB &, const Vector3i &, const Vector<uint8_t> &, const Vector<uint8_t> &, const Vector<uint8_t> &, const Vector<int> &) BIND1RC(AABB, gi_probe_get_bounds, RID) BIND1RC(Vector3i, gi_probe_get_octree_size, RID) - BIND1RC(PoolVector<uint8_t>, gi_probe_get_octree_cells, RID) - BIND1RC(PoolVector<uint8_t>, gi_probe_get_data_cells, RID) - BIND1RC(PoolVector<uint8_t>, gi_probe_get_distance_field, RID) - BIND1RC(PoolVector<int>, gi_probe_get_level_counts, RID) + BIND1RC(Vector<uint8_t>, gi_probe_get_octree_cells, RID) + BIND1RC(Vector<uint8_t>, gi_probe_get_data_cells, RID) + BIND1RC(Vector<uint8_t>, gi_probe_get_distance_field, RID) + BIND1RC(Vector<int>, gi_probe_get_level_counts, RID) BIND1RC(Transform, gi_probe_get_to_cell_xform, RID) BIND2(gi_probe_set_dynamic_range, RID, float) @@ -391,8 +391,8 @@ public: BIND2(lightmap_capture_set_bounds, RID, const AABB &) BIND1RC(AABB, lightmap_capture_get_bounds, RID) - BIND2(lightmap_capture_set_octree, RID, const PoolVector<uint8_t> &) - BIND1RC(PoolVector<uint8_t>, lightmap_capture_get_octree, RID) + BIND2(lightmap_capture_set_octree, RID, const Vector<uint8_t> &) + BIND1RC(Vector<uint8_t>, lightmap_capture_get_octree, RID) BIND2(lightmap_capture_set_octree_cell_transform, RID, const Transform &) BIND1RC(Transform, lightmap_capture_get_octree_cell_transform, RID) @@ -686,8 +686,8 @@ public: BIND2(canvas_light_occluder_set_light_mask, RID, int) BIND0R(RID, canvas_occluder_polygon_create) - BIND3(canvas_occluder_polygon_set_shape, RID, const PoolVector<Vector2> &, bool) - BIND2(canvas_occluder_polygon_set_shape_as_lines, RID, const PoolVector<Vector2> &) + BIND3(canvas_occluder_polygon_set_shape, RID, const Vector<Vector2> &, bool) + BIND2(canvas_occluder_polygon_set_shape_as_lines, RID, const Vector<Vector2> &) BIND2(canvas_occluder_polygon_set_cull_mode, RID, CanvasOccluderPolygonCullMode) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 61c885cba3..1a9ecae23a 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -1313,7 +1313,7 @@ void VisualServerScene::_update_instance_lightmap_captures(Instance *p_instance) //this could use some sort of blending.. for (List<Instance *>::Element *E = geom->lightmap_captures.front(); E; E = E->next()) { - const PoolVector<RasterizerStorage::LightmapCaptureOctree> *octree = VSG::storage->lightmap_capture_get_octree_ptr(E->get()->base); + const Vector<RasterizerStorage::LightmapCaptureOctree> *octree = VSG::storage->lightmap_capture_get_octree_ptr(E->get()->base); //print_line("octree size: " + itos(octree->size())); if (octree->size() == 0) continue; @@ -1321,14 +1321,14 @@ void VisualServerScene::_update_instance_lightmap_captures(Instance *p_instance) int cell_subdiv = VSG::storage->lightmap_capture_get_octree_cell_subdiv(E->get()->base); to_cell_xform = to_cell_xform * E->get()->transform.affine_inverse(); - PoolVector<RasterizerStorage::LightmapCaptureOctree>::Read octree_r = octree->read(); + const RasterizerStorage::LightmapCaptureOctree *octree_r = octree->ptr(); Vector3 pos = to_cell_xform.xform(p_instance->transform.origin); for (int i = 0; i < 12; i++) { Vector3 dir = to_cell_xform.basis.xform(cone_traces[i]).normalized(); - Color capture = _light_capture_voxel_cone_trace(octree_r.ptr(), pos, dir, cone_aperture, cell_subdiv); + Color capture = _light_capture_voxel_cone_trace(octree_r, pos, dir, cone_aperture, cell_subdiv); p_instance->lightmap_capture_data.write[i] += capture; } } diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index 3ed3728757..9d5281b17a 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -157,7 +157,7 @@ public: FUNC2(mesh_set_blend_shape_mode, RID, BlendShapeMode) FUNC1RC(BlendShapeMode, mesh_get_blend_shape_mode, RID) - FUNC4(mesh_surface_update_region, RID, int, int, const PoolVector<uint8_t> &) + FUNC4(mesh_surface_update_region, RID, int, int, const Vector<uint8_t> &) FUNC3(mesh_surface_set_material, RID, int, RID) FUNC2RC(RID, mesh_surface_get_material, RID, int) @@ -192,8 +192,8 @@ public: FUNC2RC(Color, multimesh_instance_get_color, RID, int) FUNC2RC(Color, multimesh_instance_get_custom_data, RID, int) - FUNC2(multimesh_set_buffer, RID, const PoolVector<float> &) - FUNC1RC(PoolVector<float>, multimesh_get_buffer, RID) + FUNC2(multimesh_set_buffer, RID, const Vector<float> &) + FUNC1RC(Vector<float>, multimesh_get_buffer, RID) FUNC2(multimesh_set_visible_instances, RID, int) FUNC1RC(int, multimesh_get_visible_instances, RID) @@ -268,14 +268,14 @@ public: FUNCRID(gi_probe) - FUNC8(gi_probe_allocate, RID, const Transform &, const AABB &, const Vector3i &, const PoolVector<uint8_t> &, const PoolVector<uint8_t> &, const PoolVector<uint8_t> &, const PoolVector<int> &) + FUNC8(gi_probe_allocate, RID, const Transform &, const AABB &, const Vector3i &, const Vector<uint8_t> &, const Vector<uint8_t> &, const Vector<uint8_t> &, const Vector<int> &) FUNC1RC(AABB, gi_probe_get_bounds, RID) FUNC1RC(Vector3i, gi_probe_get_octree_size, RID) - FUNC1RC(PoolVector<uint8_t>, gi_probe_get_octree_cells, RID) - FUNC1RC(PoolVector<uint8_t>, gi_probe_get_data_cells, RID) - FUNC1RC(PoolVector<uint8_t>, gi_probe_get_distance_field, RID) - FUNC1RC(PoolVector<int>, gi_probe_get_level_counts, RID) + FUNC1RC(Vector<uint8_t>, gi_probe_get_octree_cells, RID) + FUNC1RC(Vector<uint8_t>, gi_probe_get_data_cells, RID) + FUNC1RC(Vector<uint8_t>, gi_probe_get_distance_field, RID) + FUNC1RC(Vector<int>, gi_probe_get_level_counts, RID) FUNC1RC(Transform, gi_probe_get_to_cell_xform, RID) FUNC2(gi_probe_set_dynamic_range, RID, float) @@ -315,8 +315,8 @@ public: FUNC2(lightmap_capture_set_bounds, RID, const AABB &) FUNC1RC(AABB, lightmap_capture_get_bounds, RID) - FUNC2(lightmap_capture_set_octree, RID, const PoolVector<uint8_t> &) - FUNC1RC(PoolVector<uint8_t>, lightmap_capture_get_octree, RID) + FUNC2(lightmap_capture_set_octree, RID, const Vector<uint8_t> &) + FUNC1RC(Vector<uint8_t>, lightmap_capture_get_octree, RID) FUNC2(lightmap_capture_set_octree_cell_transform, RID, const Transform &) FUNC1RC(Transform, lightmap_capture_get_octree_cell_transform, RID) FUNC2(lightmap_capture_set_octree_cell_subdiv, RID, int) @@ -590,8 +590,8 @@ public: FUNC2(canvas_light_occluder_set_light_mask, RID, int) FUNCRID(canvas_occluder_polygon) - FUNC3(canvas_occluder_polygon_set_shape, RID, const PoolVector<Vector2> &, bool) - FUNC2(canvas_occluder_polygon_set_shape_as_lines, RID, const PoolVector<Vector2> &) + FUNC3(canvas_occluder_polygon_set_shape, RID, const Vector<Vector2> &, bool) + FUNC2(canvas_occluder_polygon_set_shape_as_lines, RID, const Vector<Vector2> &) FUNC2(canvas_occluder_polygon_set_cull_mode, RID, CanvasOccluderPolygonCullMode) diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 508d5ec1f8..21885e93b5 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -120,11 +120,11 @@ RID VisualServer::get_test_texture() { #define TEST_TEXTURE_SIZE 256 - PoolVector<uint8_t> test_data; + Vector<uint8_t> test_data; test_data.resize(TEST_TEXTURE_SIZE * TEST_TEXTURE_SIZE * 3); { - PoolVector<uint8_t>::Write w = test_data.write(); + uint8_t *w = test_data.ptrw(); for (int x = 0; x < TEST_TEXTURE_SIZE; x++) { @@ -172,10 +172,10 @@ void VisualServer::_free_internal_rids() { RID VisualServer::_make_test_cube() { - PoolVector<Vector3> vertices; - PoolVector<Vector3> normals; - PoolVector<float> tangents; - PoolVector<Vector3> uvs; + Vector<Vector3> vertices; + Vector<Vector3> normals; + Vector<float> tangents; + Vector<Vector3> uvs; #define ADD_VTX(m_idx) \ vertices.push_back(face_points[m_idx]); \ @@ -229,7 +229,7 @@ RID VisualServer::_make_test_cube() { d[VisualServer::ARRAY_TEX_UV] = uvs; d[VisualServer::ARRAY_VERTEX] = vertices; - PoolVector<int> indices; + Vector<int> indices; indices.resize(vertices.size()); for (int i = 0; i < vertices.size(); i++) indices.set(i, i); @@ -254,8 +254,8 @@ RID VisualServer::_make_test_cube() { RID VisualServer::make_sphere_mesh(int p_lats, int p_lons, float p_radius) { - PoolVector<Vector3> vertices; - PoolVector<Vector3> normals; + Vector<Vector3> vertices; + Vector<Vector3> normals; for (int i = 1; i <= p_lats; i++) { double lat0 = Math_PI * (-0.5 + (double)(i - 1) / p_lats); @@ -314,10 +314,10 @@ RID VisualServer::get_white_texture() { if (white_texture.is_valid()) return white_texture; - PoolVector<uint8_t> wt; + Vector<uint8_t> wt; wt.resize(16 * 3); { - PoolVector<uint8_t>::Write w = wt.write(); + uint8_t *w = wt.ptrw(); for (int i = 0; i < 16 * 3; i++) w[i] = 255; } @@ -329,13 +329,13 @@ RID VisualServer::get_white_texture() { #define SMALL_VEC2 Vector2(0.00001, 0.00001) #define SMALL_VEC3 Vector3(0.00001, 0.00001, 0.00001) -Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb) { +Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, Vector<uint8_t> &r_vertex_array, int p_vertex_array_len, Vector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb) { - PoolVector<uint8_t>::Write vw = r_vertex_array.write(); + uint8_t *vw = r_vertex_array.ptrw(); - PoolVector<uint8_t>::Write iw; + uint8_t *iw; if (r_index_array.size()) { - iw = r_index_array.write(); + iw = r_index_array.ptrw(); } int max_bone = 0; @@ -351,11 +351,10 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ if (p_format & VS::ARRAY_FLAG_USE_2D_VERTICES) { - PoolVector<Vector2> array = p_arrays[ai]; + Vector<Vector2> array = p_arrays[ai]; ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER); - PoolVector<Vector2>::Read read = array.read(); - const Vector2 *src = read.ptr(); + const Vector2 *src = array.ptr(); // setting vertices means regenerating the AABB Rect2 aabb; @@ -380,11 +379,10 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ r_aabb = AABB(Vector3(aabb.position.x, aabb.position.y, 0), Vector3(aabb.size.x, aabb.size.y, 0)); } else { - PoolVector<Vector3> array = p_arrays[ai]; + Vector<Vector3> array = p_arrays[ai]; ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER); - PoolVector<Vector3>::Read read = array.read(); - const Vector3 *src = read.ptr(); + const Vector3 *src = array.ptr(); // setting vertices means regenerating the AABB AABB aabb; @@ -412,13 +410,12 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ } break; case VS::ARRAY_NORMAL: { - ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::POOL_VECTOR3_ARRAY, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_VECTOR3_ARRAY, ERR_INVALID_PARAMETER); - PoolVector<Vector3> array = p_arrays[ai]; + Vector<Vector3> array = p_arrays[ai]; ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER); - PoolVector<Vector3>::Read read = array.read(); - const Vector3 *src = read.ptr(); + const Vector3 *src = array.ptr(); // setting vertices means regenerating the AABB @@ -448,14 +445,13 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ case VS::ARRAY_TANGENT: { - ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::POOL_REAL_ARRAY, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_REAL_ARRAY, ERR_INVALID_PARAMETER); - PoolVector<real_t> array = p_arrays[ai]; + Vector<real_t> array = p_arrays[ai]; ERR_FAIL_COND_V(array.size() != p_vertex_array_len * 4, ERR_INVALID_PARAMETER); - PoolVector<real_t>::Read read = array.read(); - const real_t *src = read.ptr(); + const real_t *src = array.ptr(); if (p_format & ARRAY_COMPRESS_TANGENT) { @@ -487,14 +483,13 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ } break; case VS::ARRAY_COLOR: { - ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::POOL_COLOR_ARRAY, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_COLOR_ARRAY, ERR_INVALID_PARAMETER); - PoolVector<Color> array = p_arrays[ai]; + Vector<Color> array = p_arrays[ai]; ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER); - PoolVector<Color>::Read read = array.read(); - const Color *src = read.ptr(); + const Color *src = array.ptr(); if (p_format & ARRAY_COMPRESS_COLOR) { @@ -520,15 +515,13 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ } break; case VS::ARRAY_TEX_UV: { - ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::POOL_VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::POOL_VECTOR2_ARRAY, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::PACKED_VECTOR2_ARRAY, ERR_INVALID_PARAMETER); - PoolVector<Vector2> array = p_arrays[ai]; + Vector<Vector2> array = p_arrays[ai]; ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER); - PoolVector<Vector2>::Read read = array.read(); - - const Vector2 *src = read.ptr(); + const Vector2 *src = array.ptr(); if (p_format & ARRAY_COMPRESS_TEX_UV) { @@ -551,15 +544,13 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ case VS::ARRAY_TEX_UV2: { - ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::POOL_VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::POOL_VECTOR2_ARRAY, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::PACKED_VECTOR2_ARRAY, ERR_INVALID_PARAMETER); - PoolVector<Vector2> array = p_arrays[ai]; + Vector<Vector2> array = p_arrays[ai]; ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER); - PoolVector<Vector2>::Read read = array.read(); - - const Vector2 *src = read.ptr(); + const Vector2 *src = array.ptr(); if (p_format & ARRAY_COMPRESS_TEX_UV2) { @@ -580,15 +571,13 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ } break; case VS::ARRAY_WEIGHTS: { - ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::POOL_REAL_ARRAY, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_REAL_ARRAY, ERR_INVALID_PARAMETER); - PoolVector<real_t> array = p_arrays[ai]; + Vector<real_t> array = p_arrays[ai]; ERR_FAIL_COND_V(array.size() != p_vertex_array_len * VS::ARRAY_WEIGHTS_SIZE, ERR_INVALID_PARAMETER); - PoolVector<real_t>::Read read = array.read(); - - const real_t *src = read.ptr(); + const real_t *src = array.ptr(); { @@ -606,15 +595,13 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ } break; case VS::ARRAY_BONES: { - ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::POOL_INT_ARRAY && p_arrays[ai].get_type() != Variant::POOL_REAL_ARRAY, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_INT_ARRAY && p_arrays[ai].get_type() != Variant::PACKED_REAL_ARRAY, ERR_INVALID_PARAMETER); - PoolVector<int> array = p_arrays[ai]; + Vector<int> array = p_arrays[ai]; ERR_FAIL_COND_V(array.size() != p_vertex_array_len * VS::ARRAY_WEIGHTS_SIZE, ERR_INVALID_PARAMETER); - PoolVector<int>::Read read = array.read(); - - const int *src = read.ptr(); + const int *src = array.ptr(); for (int i = 0; i < p_vertex_array_len; i++) { @@ -631,16 +618,15 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ case VS::ARRAY_INDEX: { ERR_FAIL_COND_V(p_index_array_len <= 0, ERR_INVALID_DATA); - ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::POOL_INT_ARRAY, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_INT_ARRAY, ERR_INVALID_PARAMETER); - PoolVector<int> indices = p_arrays[ai]; + Vector<int> indices = p_arrays[ai]; ERR_FAIL_COND_V(indices.size() == 0, ERR_INVALID_PARAMETER); ERR_FAIL_COND_V(indices.size() != p_index_array_len, ERR_INVALID_PARAMETER); /* determine whether using 16 or 32 bits indices */ - PoolVector<int>::Read read = indices.read(); - const int *src = read.ptr(); + const int *src = indices.ptr(); for (int i = 0; i < p_index_array_len; i++) { @@ -675,18 +661,18 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ } } - PoolVector<Vector3> vertices = p_arrays[VS::ARRAY_VERTEX]; - PoolVector<int> bones = p_arrays[VS::ARRAY_BONES]; - PoolVector<float> weights = p_arrays[VS::ARRAY_WEIGHTS]; + Vector<Vector3> vertices = p_arrays[VS::ARRAY_VERTEX]; + Vector<int> bones = p_arrays[VS::ARRAY_BONES]; + Vector<float> weights = p_arrays[VS::ARRAY_WEIGHTS]; bool any_valid = false; if (vertices.size() && bones.size() == vertices.size() * 4 && weights.size() == bones.size()) { int vs = vertices.size(); - PoolVector<Vector3>::Read rv = vertices.read(); - PoolVector<int>::Read rb = bones.read(); - PoolVector<float>::Read rw = weights.read(); + const Vector3 *rv = vertices.ptr(); + const int *rb = bones.ptr(); + const float *rw = weights.ptr(); AABB *bptr = r_bone_aabb.ptrw(); @@ -866,22 +852,22 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_ Variant var = p_arrays[i]; switch (var.get_type()) { - case Variant::POOL_VECTOR2_ARRAY: { - PoolVector<Vector2> v2 = var; + case Variant::PACKED_VECTOR2_ARRAY: { + Vector<Vector2> v2 = var; } break; - case Variant::POOL_VECTOR3_ARRAY: { - PoolVector<Vector3> v3 = var; + case Variant::PACKED_VECTOR3_ARRAY: { + Vector<Vector3> v3 = var; } break; default: { Array v = var; } break; } - array_len = PoolVector3Array(p_arrays[i]).size(); + array_len = PackedVector3Array(p_arrays[i]).size(); ERR_FAIL_COND_V(array_len == 0, ERR_INVALID_DATA); } else if (i == VS::ARRAY_INDEX) { - index_array_len = PoolIntArray(p_arrays[i]).size(); + index_array_len = PackedIntArray(p_arrays[i]).size(); } } @@ -921,10 +907,10 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_ case VS::ARRAY_VERTEX: { Variant arr = p_arrays[0]; - if (arr.get_type() == Variant::POOL_VECTOR2_ARRAY) { + if (arr.get_type() == Variant::PACKED_VECTOR2_ARRAY) { elem_size = 2; p_compress_format |= ARRAY_FLAG_USE_2D_VERTICES; - } else if (arr.get_type() == Variant::POOL_VECTOR3_ARRAY) { + } else if (arr.get_type() == Variant::PACKED_VECTOR3_ARRAY) { p_compress_format &= ~ARRAY_FLAG_USE_2D_VERTICES; elem_size = 3; } else { @@ -1020,12 +1006,12 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_ int array_size = total_elem_size * array_len; - PoolVector<uint8_t> vertex_array; + Vector<uint8_t> vertex_array; vertex_array.resize(array_size); int index_array_size = offsets[VS::ARRAY_INDEX] * index_array_len; - PoolVector<uint8_t> index_array; + Vector<uint8_t> index_array; index_array.resize(index_array_size); AABB aabb; @@ -1034,13 +1020,13 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_ Error err = _surface_set_data(p_arrays, format, offsets, total_elem_size, vertex_array, array_len, index_array, index_array_len, aabb, bone_aabb); ERR_FAIL_COND_V_MSG(err != OK, ERR_INVALID_DATA, "Invalid array format for surface."); - Vector<PoolVector<uint8_t> > blend_shape_data; + Vector<Vector<uint8_t> > blend_shape_data; for (int i = 0; i < p_blend_shapes.size(); i++) { - PoolVector<uint8_t> vertex_array_shape; + Vector<uint8_t> vertex_array_shape; vertex_array_shape.resize(array_size); - PoolVector<uint8_t> noindex; + Vector<uint8_t> noindex; AABB laabb; Error err2 = _surface_set_data(p_blend_shapes[i], format & ~ARRAY_FORMAT_INDEX, offsets, total_elem_size, vertex_array_shape, array_len, noindex, 0, laabb, bone_aabb); @@ -1057,27 +1043,27 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_ for (List<Variant>::Element *E = keys.front(); E; E = E->next()) { float distance = E->get(); ERR_CONTINUE(distance <= 0.0); - PoolVector<int> indices = p_lods[E->get()]; + Vector<int> indices = p_lods[E->get()]; ERR_CONTINUE(indices.size() == 0); uint32_t index_count = indices.size(); ERR_CONTINUE(index_count >= (uint32_t)index_array_len); //should be smaller.. - PoolVector<int>::Read r = indices.read(); + const int *r = indices.ptr(); - PoolVector<uint8_t> data; + Vector<uint8_t> data; if (array_len <= 65536) { //16 bits indices data.resize(indices.size() * 2); - PoolVector<uint8_t>::Write w = data.write(); - uint16_t *index_ptr = (uint16_t *)w.ptr(); + uint8_t *w = data.ptrw(); + uint16_t *index_ptr = (uint16_t *)w; for (uint32_t i = 0; i < index_count; i++) { index_ptr[i] = r[i]; } } else { //32 bits indices data.resize(indices.size() * 4); - PoolVector<uint8_t>::Write w = data.write(); - uint32_t *index_ptr = (uint32_t *)w.ptr(); + uint8_t *w = data.ptrw(); + uint32_t *index_ptr = (uint32_t *)w; for (uint32_t i = 0; i < index_count; i++) { index_ptr[i] = r[i]; } @@ -1115,7 +1101,7 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_prim mesh_add_surface(p_mesh, sd); } -Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_t> p_vertex_data, int p_vertex_len, PoolVector<uint8_t> p_index_data, int p_index_len) const { +Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p_vertex_data, int p_vertex_len, Vector<uint8_t> p_index_data, int p_index_len) const { uint32_t offsets[ARRAY_MAX]; @@ -1227,7 +1213,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ Array ret; ret.resize(VS::ARRAY_MAX); - PoolVector<uint8_t>::Read r = p_vertex_data.read(); + const uint8_t *r = p_vertex_data.ptr(); for (int i = 0; i < VS::ARRAY_MAX; i++) { @@ -1240,12 +1226,12 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ if (p_format & ARRAY_FLAG_USE_2D_VERTICES) { - PoolVector<Vector2> arr_2d; + Vector<Vector2> arr_2d; arr_2d.resize(p_vertex_len); { - PoolVector<Vector2>::Write w = arr_2d.write(); + Vector2 *w = arr_2d.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1257,12 +1243,12 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ ret[i] = arr_2d; } else { - PoolVector<Vector3> arr_3d; + Vector<Vector3> arr_3d; arr_3d.resize(p_vertex_len); { - PoolVector<Vector3>::Write w = arr_3d.write(); + Vector3 *w = arr_3d.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1276,12 +1262,12 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } break; case VS::ARRAY_NORMAL: { - PoolVector<Vector3> arr; + Vector<Vector3> arr; arr.resize(p_vertex_len); if (p_format & ARRAY_COMPRESS_NORMAL) { - PoolVector<Vector3>::Write w = arr.write(); + Vector3 *w = arr.ptrw(); const float multiplier = 1.f / 127.f; for (int j = 0; j < p_vertex_len; j++) { @@ -1290,7 +1276,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ w[j] = Vector3(float(v[0]) * multiplier, float(v[1]) * multiplier, float(v[2]) * multiplier); } } else { - PoolVector<Vector3>::Write w = arr.write(); + Vector3 *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1304,10 +1290,10 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } break; case VS::ARRAY_TANGENT: { - PoolVector<float> arr; + Vector<float> arr; arr.resize(p_vertex_len * 4); if (p_format & ARRAY_COMPRESS_TANGENT) { - PoolVector<float>::Write w = arr.write(); + float *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1318,7 +1304,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } } else { - PoolVector<float>::Write w = arr.write(); + float *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { const float *v = (const float *)&r[j * total_elem_size + offsets[i]]; @@ -1333,12 +1319,12 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } break; case VS::ARRAY_COLOR: { - PoolVector<Color> arr; + Vector<Color> arr; arr.resize(p_vertex_len); if (p_format & ARRAY_COMPRESS_COLOR) { - PoolVector<Color>::Write w = arr.write(); + Color *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1346,7 +1332,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ w[j] = Color(float(v[0] / 255.0), float(v[1] / 255.0), float(v[2] / 255.0), float(v[3] / 255.0)); } } else { - PoolVector<Color>::Write w = arr.write(); + Color *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1359,12 +1345,12 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } break; case VS::ARRAY_TEX_UV: { - PoolVector<Vector2> arr; + Vector<Vector2> arr; arr.resize(p_vertex_len); if (p_format & ARRAY_COMPRESS_TEX_UV) { - PoolVector<Vector2>::Write w = arr.write(); + Vector2 *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1373,7 +1359,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } } else { - PoolVector<Vector2>::Write w = arr.write(); + Vector2 *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1386,12 +1372,12 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } break; case VS::ARRAY_TEX_UV2: { - PoolVector<Vector2> arr; + Vector<Vector2> arr; arr.resize(p_vertex_len); if (p_format & ARRAY_COMPRESS_TEX_UV2) { - PoolVector<Vector2>::Write w = arr.write(); + Vector2 *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1400,7 +1386,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } } else { - PoolVector<Vector2>::Write w = arr.write(); + Vector2 *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1414,10 +1400,10 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } break; case VS::ARRAY_WEIGHTS: { - PoolVector<float> arr; + Vector<float> arr; arr.resize(p_vertex_len * 4); { - PoolVector<float>::Write w = arr.write(); + float *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1433,10 +1419,10 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } break; case VS::ARRAY_BONES: { - PoolVector<int> arr; + Vector<int> arr; arr.resize(p_vertex_len * 4); - PoolVector<int>::Write w = arr.write(); + int *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1452,13 +1438,13 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ case VS::ARRAY_INDEX: { /* determine whether using 16 or 32 bits indices */ - PoolVector<uint8_t>::Read ir = p_index_data.read(); + const uint8_t *ir = p_index_data.ptr(); - PoolVector<int> arr; + Vector<int> arr; arr.resize(p_index_len); if (p_vertex_len < (1 << 16)) { - PoolVector<int>::Write w = arr.write(); + int *w = arr.ptrw(); for (int j = 0; j < p_index_len; j++) { @@ -1467,7 +1453,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } } else { - PoolVector<int>::Write w = arr.write(); + int *w = arr.ptrw(); for (int j = 0; j < p_index_len; j++) { const int *v = (const int *)&ir[j * 4]; @@ -1499,22 +1485,22 @@ Dictionary VisualServer::mesh_surface_get_lods(RID p_mesh, int p_surface) const Dictionary ret; for (int i = 0; i < sd.lods.size(); i++) { - PoolVector<int> lods; + Vector<int> lods; if (sd.vertex_count <= 65536) { uint32_t lc = sd.lods[i].index_data.size() / 2; lods.resize(lc); - PoolVector<uint8_t>::Read r = sd.lods[i].index_data.read(); - const uint16_t *rptr = (const uint16_t *)r.ptr(); - PoolVector<int>::Write w = lods.write(); + const uint8_t *r = sd.lods[i].index_data.ptr(); + const uint16_t *rptr = (const uint16_t *)r; + int *w = lods.ptrw(); for (uint32_t j = 0; j < lc; j++) { w[j] = rptr[i]; } } else { uint32_t lc = sd.lods[i].index_data.size() / 4; lods.resize(lc); - PoolVector<uint8_t>::Read r = sd.lods[i].index_data.read(); - const uint32_t *rptr = (const uint32_t *)r.ptr(); - PoolVector<int>::Write w = lods.write(); + const uint8_t *r = sd.lods[i].index_data.ptr(); + const uint32_t *rptr = (const uint32_t *)r; + int *w = lods.ptrw(); for (uint32_t j = 0; j < lc; j++) { w[j] = rptr[i]; } @@ -1531,12 +1517,12 @@ Array VisualServer::mesh_surface_get_blend_shape_arrays(RID p_mesh, int p_surfac SurfaceData sd = mesh_get_surface(p_mesh, p_surface); ERR_FAIL_COND_V(sd.vertex_count == 0, Array()); - Vector<PoolVector<uint8_t> > blend_shape_data = sd.blend_shapes; + Vector<Vector<uint8_t> > blend_shape_data = sd.blend_shapes; if (blend_shape_data.size() > 0) { int vertex_len = sd.vertex_count; - PoolVector<uint8_t> index_data = sd.index_data; + Vector<uint8_t> index_data = sd.index_data; int index_len = sd.index_count; uint32_t format = sd.format; @@ -1555,12 +1541,12 @@ Array VisualServer::mesh_surface_get_blend_shape_arrays(RID p_mesh, int p_surfac Array VisualServer::mesh_create_arrays_from_surface_data(const SurfaceData &p_data) const { - PoolVector<uint8_t> vertex_data = p_data.vertex_data; + Vector<uint8_t> vertex_data = p_data.vertex_data; ERR_FAIL_COND_V(vertex_data.size() == 0, Array()); int vertex_len = p_data.vertex_count; - PoolVector<uint8_t> index_data = p_data.index_data; + Vector<uint8_t> index_data = p_data.index_data; int index_len = p_data.index_count; uint32_t format = p_data.format; @@ -2251,8 +2237,8 @@ void VisualServer::_camera_set_orthogonal(RID p_camera, float p_size, float p_z_ void VisualServer::mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry::MeshData &p_mesh_data) { - PoolVector<Vector3> vertices; - PoolVector<Vector3> normals; + Vector<Vector3> vertices; + Vector<Vector3> normals; for (int i = 0; i < p_mesh_data.faces.size(); i++) { @@ -2277,7 +2263,7 @@ void VisualServer::mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry::M mesh_add_surface_from_arrays(p_mesh, PRIMITIVE_TRIANGLES, d); } -void VisualServer::mesh_add_surface_from_planes(RID p_mesh, const PoolVector<Plane> &p_planes) { +void VisualServer::mesh_add_surface_from_planes(RID p_mesh, const Vector<Plane> &p_planes) { Geometry::MeshData mdata = Geometry::build_convex_mesh(p_planes); mesh_add_surface_from_mesh_data(p_mesh, mdata); diff --git a/servers/visual_server.h b/servers/visual_server.h index 09fc1aaba2..c29bc2a767 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -32,7 +32,6 @@ #define VISUAL_SERVER_H #include "core/image.h" -#include "core/math/bsp_tree.h" #include "core/math/geometry.h" #include "core/math/transform_2d.h" #include "core/object.h" @@ -49,7 +48,7 @@ class VisualServer : public Object { void _camera_set_orthogonal(RID p_camera, float p_size, float p_z_near, float p_z_far); void _canvas_item_add_style_box(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector<float> &p_margins, const Color &p_modulate = Color(1, 1, 1)); - Array _get_array_from_surface(uint32_t p_format, PoolVector<uint8_t> p_vertex_data, int p_vertex_len, PoolVector<uint8_t> p_index_data, int p_index_len) const; + Array _get_array_from_surface(uint32_t p_format, Vector<uint8_t> p_vertex_data, int p_vertex_len, Vector<uint8_t> p_index_data, int p_index_len) const; protected: RID _make_test_cube(); @@ -58,7 +57,7 @@ protected: RID white_texture; RID test_material; - Error _surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb); + Error _surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, Vector<uint8_t> &r_vertex_array, int p_vertex_array_len, Vector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb); static VisualServer *(*create_func)(); static void _bind_methods(); @@ -250,20 +249,20 @@ public: PrimitiveType primitive = PRIMITIVE_MAX; uint32_t format = 0; - PoolVector<uint8_t> vertex_data; + Vector<uint8_t> vertex_data; uint32_t vertex_count = 0; - PoolVector<uint8_t> index_data; + Vector<uint8_t> index_data; uint32_t index_count = 0; AABB aabb; struct LOD { float edge_length; - PoolVector<uint8_t> index_data; + Vector<uint8_t> index_data; }; Vector<LOD> lods; Vector<AABB> bone_aabbs; - Vector<PoolVector<uint8_t> > blend_shapes; + Vector<Vector<uint8_t> > blend_shapes; RID material; }; @@ -294,7 +293,7 @@ public: virtual void mesh_set_blend_shape_mode(RID p_mesh, BlendShapeMode p_mode) = 0; virtual BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const = 0; - virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) = 0; + virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) = 0; virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) = 0; virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const = 0; @@ -334,8 +333,8 @@ public: virtual Color multimesh_instance_get_color(RID p_multimesh, int p_index) const = 0; virtual Color multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const = 0; - virtual void multimesh_set_buffer(RID p_multimesh, const PoolVector<float> &p_buffer) = 0; - virtual PoolVector<float> multimesh_get_buffer(RID p_multimesh) const = 0; + virtual void multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_buffer) = 0; + virtual Vector<float> multimesh_get_buffer(RID p_multimesh) const = 0; virtual void multimesh_set_visible_instances(RID p_multimesh, int p_visible) = 0; virtual int multimesh_get_visible_instances(RID p_multimesh) const = 0; @@ -463,14 +462,14 @@ public: virtual RID gi_probe_create() = 0; - virtual void gi_probe_allocate(RID p_gi_probe, const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3i &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) = 0; + virtual void gi_probe_allocate(RID p_gi_probe, const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3i &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) = 0; virtual AABB gi_probe_get_bounds(RID p_gi_probe) const = 0; virtual Vector3i gi_probe_get_octree_size(RID p_gi_probe) const = 0; - virtual PoolVector<uint8_t> gi_probe_get_octree_cells(RID p_gi_probe) const = 0; - virtual PoolVector<uint8_t> gi_probe_get_data_cells(RID p_gi_probe) const = 0; - virtual PoolVector<uint8_t> gi_probe_get_distance_field(RID p_gi_probe) const = 0; - virtual PoolVector<int> gi_probe_get_level_counts(RID p_gi_probe) const = 0; + virtual Vector<uint8_t> gi_probe_get_octree_cells(RID p_gi_probe) const = 0; + virtual Vector<uint8_t> gi_probe_get_data_cells(RID p_gi_probe) const = 0; + virtual Vector<uint8_t> gi_probe_get_distance_field(RID p_gi_probe) const = 0; + virtual Vector<int> gi_probe_get_level_counts(RID p_gi_probe) const = 0; virtual Transform gi_probe_get_to_cell_xform(RID p_gi_probe) const = 0; virtual void gi_probe_set_dynamic_range(RID p_gi_probe, float p_range) = 0; @@ -508,12 +507,12 @@ public: virtual RID lightmap_capture_create() = 0; virtual void lightmap_capture_set_bounds(RID p_capture, const AABB &p_bounds) = 0; virtual AABB lightmap_capture_get_bounds(RID p_capture) const = 0; - virtual void lightmap_capture_set_octree(RID p_capture, const PoolVector<uint8_t> &p_octree) = 0; + virtual void lightmap_capture_set_octree(RID p_capture, const Vector<uint8_t> &p_octree) = 0; virtual void lightmap_capture_set_octree_cell_transform(RID p_capture, const Transform &p_xform) = 0; virtual Transform lightmap_capture_get_octree_cell_transform(RID p_capture) const = 0; virtual void lightmap_capture_set_octree_cell_subdiv(RID p_capture, int p_subdiv) = 0; virtual int lightmap_capture_get_octree_cell_subdiv(RID p_capture) const = 0; - virtual PoolVector<uint8_t> lightmap_capture_get_octree(RID p_capture) const = 0; + virtual Vector<uint8_t> lightmap_capture_get_octree(RID p_capture) const = 0; virtual void lightmap_capture_set_energy(RID p_capture, float p_energy) = 0; virtual float lightmap_capture_get_energy(RID p_capture) const = 0; @@ -1011,8 +1010,8 @@ public: virtual void canvas_light_occluder_set_light_mask(RID p_occluder, int p_mask) = 0; virtual RID canvas_occluder_polygon_create() = 0; - virtual void canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const PoolVector<Vector2> &p_shape, bool p_closed) = 0; - virtual void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const PoolVector<Vector2> &p_shape) = 0; + virtual void canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const Vector<Vector2> &p_shape, bool p_closed) = 0; + virtual void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const Vector<Vector2> &p_shape) = 0; enum CanvasOccluderPolygonCullMode { CANVAS_OCCLUDER_POLYGON_CULL_DISABLED, @@ -1082,7 +1081,7 @@ public: virtual RID make_sphere_mesh(int p_lats, int p_lons, float p_radius); virtual void mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry::MeshData &p_mesh_data); - virtual void mesh_add_surface_from_planes(RID p_mesh, const PoolVector<Plane> &p_planes); + virtual void mesh_add_surface_from_planes(RID p_mesh, const Vector<Plane> &p_planes); virtual void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter = true) = 0; virtual void set_default_clear_color(const Color &p_color) = 0; diff --git a/thirdparty/enet/godot.cpp b/thirdparty/enet/godot.cpp index 63580b6d1a..72310fb9a2 100644 --- a/thirdparty/enet/godot.cpp +++ b/thirdparty/enet/godot.cpp @@ -133,8 +133,8 @@ int enet_socket_send(ENetSocket socket, const ENetAddress *address, const ENetBu dest.set_ipv6(address->host); // Create a single packet. - PoolVector<uint8_t> out; - PoolVector<uint8_t>::Write w; + Vector<uint8_t> out; + uint8_t* w; int size = 0; int pos = 0; for (i = 0; i < bufferCount; i++) { @@ -142,7 +142,7 @@ int enet_socket_send(ENetSocket socket, const ENetAddress *address, const ENetBu } out.resize(size); - w = out.write(); + w = out.ptrw(); for (i = 0; i < bufferCount; i++) { memcpy(&w[pos], buffers[i].data, buffers[i].dataLength); pos += buffers[i].dataLength; |