diff options
257 files changed, 2783 insertions, 3095 deletions
diff --git a/bin/tests/test_math.cpp b/bin/tests/test_math.cpp index e3e74af14c..b3b70986c9 100644 --- a/bin/tests/test_math.cpp +++ b/bin/tests/test_math.cpp @@ -477,17 +477,34 @@ uint32_t ihash3( uint32_t a) MainLoop* test() { - Matrix3 m; - m.rotate(Vector3(0,1,0),Math_PI*0.5); - print_line(m.scaled(Vector3(0.5,1,1))); - Matrix3 s; - s.scale(Vector3(0.5,1.0,1.0)); + print_line("Dvectors: "+itos(MemoryPool::allocs_used)); + print_line("Mem used: "+itos(MemoryPool::total_memory)); + print_line("MAx mem used: "+itos(MemoryPool::max_memory)); - print_line(m * s); + PoolVector<int> ints; + ints.resize(20); + { + PoolVector<int>::Write w; + w = ints.write(); + for(int i=0;i<ints.size();i++) { + w[i]=i; + } + } + + PoolVector<int> posho = ints; + { + PoolVector<int>::Read r = posho.read(); + 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)); return NULL; @@ -718,8 +735,8 @@ MainLoop* test() { print_line(String("res://..").simplify_path()); - DVector<uint8_t> a; - DVector<uint8_t> b; + PoolVector<uint8_t> a; + PoolVector<uint8_t> b; a.resize(20); b=a; diff --git a/bin/tests/test_physics.cpp b/bin/tests/test_physics.cpp index 8a270f721f..15dc40a4fd 100644 --- a/bin/tests/test_physics.cpp +++ b/bin/tests/test_physics.cpp @@ -146,7 +146,7 @@ protected: /* BOX SHAPE */ - DVector<Plane> box_planes = Geometry::build_box_planes(Vector3(0.5,0.5,0.5)); + PoolVector<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); @@ -159,7 +159,7 @@ protected: /* CAPSULE SHAPE */ - DVector<Plane> capsule_planes = Geometry::build_capsule_planes(0.5,0.7,12,Vector3::AXIS_Z); + PoolVector<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); @@ -176,7 +176,7 @@ protected: /* CONVEX SHAPE */ - DVector<Plane> convex_planes = Geometry::build_cylinder_planes(0.5,0.7,5,Vector3::AXIS_Z); + PoolVector<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); @@ -534,7 +534,7 @@ public: PhysicsServer * ps = PhysicsServer::get_singleton(); - DVector<Plane> capsule_planes = Geometry::build_capsule_planes(0.5,1,12,5,Vector3::AXIS_Y); + PoolVector<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/bin/tests/test_physics_2d.cpp b/bin/tests/test_physics_2d.cpp index 93d707b26a..39b4e7edda 100644 --- a/bin/tests/test_physics_2d.cpp +++ b/bin/tests/test_physics_2d.cpp @@ -74,7 +74,7 @@ class TestPhysics2DMainLoop : public MainLoop { { - DVector<uint8_t> pixels; + PoolVector<uint8_t> pixels; pixels.resize(32*2*2); for(int i=0;i<2;i++) { @@ -100,7 +100,7 @@ class TestPhysics2DMainLoop : public MainLoop { { - DVector<uint8_t> pixels; + PoolVector<uint8_t> pixels; pixels.resize(32*32*2); for(int i=0;i<32;i++) { @@ -128,7 +128,7 @@ class TestPhysics2DMainLoop : public MainLoop { { - DVector<uint8_t> pixels; + PoolVector<uint8_t> pixels; pixels.resize(32*32*2); for(int i=0;i<32;i++) { @@ -157,7 +157,7 @@ class TestPhysics2DMainLoop : public MainLoop { { - DVector<uint8_t> pixels; + PoolVector<uint8_t> pixels; pixels.resize(32*64*2); for(int i=0;i<64;i++) { @@ -195,7 +195,7 @@ class TestPhysics2DMainLoop : public MainLoop { RID convex_polygon_shape = ps->shape_create(Physics2DServer::SHAPE_CONVEX_POLYGON); - DVector<Vector2> arr; + PoolVector<Vector2> arr; Point2 sb(32,32); arr.push_back(Point2(20,3)-sb); arr.push_back(Point2(58,23)-sb); diff --git a/bin/tests/test_render.cpp b/bin/tests/test_render.cpp index b971d412aa..51e1366073 100644 --- a/bin/tests/test_render.cpp +++ b/bin/tests/test_render.cpp @@ -87,7 +87,7 @@ public: Vector<Vector3> vts; /* - DVector<Plane> sp = Geometry::build_sphere_planes(2,5,5); + PoolVector<Plane> sp = Geometry::build_sphere_planes(2,5,5); Geometry::MeshData md2 = Geometry::build_convex_mesh(sp); vts=md2.vertices; */ diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 0d89659cef..384813ecdf 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -69,11 +69,11 @@ RES _ResourceLoader::load(const String &p_path,const String& p_type_hint, bool p return ret; } -DVector<String> _ResourceLoader::get_recognized_extensions_for_type(const String& p_type) { +PoolVector<String> _ResourceLoader::get_recognized_extensions_for_type(const String& p_type) { List<String> exts; ResourceLoader::get_recognized_extensions_for_type(p_type,&exts); - DVector<String> ret; + PoolVector<String> ret; for(List<String>::Element *E=exts.front();E;E=E->next()) { ret.push_back(E->get()); @@ -135,12 +135,12 @@ Error _ResourceSaver::save(const String &p_path,const RES& p_resource, uint32_t return ResourceSaver::save(p_path,p_resource, p_flags); } -DVector<String> _ResourceSaver::get_recognized_extensions(const RES& p_resource) { +PoolVector<String> _ResourceSaver::get_recognized_extensions(const RES& p_resource) { - ERR_FAIL_COND_V(p_resource.is_null(),DVector<String>()); + ERR_FAIL_COND_V(p_resource.is_null(),PoolVector<String>()); List<String> exts; ResourceSaver::get_recognized_extensions(p_resource,&exts); - DVector<String> ret; + PoolVector<String> ret; for(List<String>::Element *E=exts.front();E;E=E->next()) { ret.push_back(E->get()); @@ -1232,16 +1232,16 @@ _Geometry *_Geometry::get_singleton() { return singleton; } -DVector<Plane> _Geometry::build_box_planes(const Vector3& p_extents) { +PoolVector<Plane> _Geometry::build_box_planes(const Vector3& p_extents) { return Geometry::build_box_planes(p_extents); } -DVector<Plane> _Geometry::build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis) { +PoolVector<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); } -DVector<Plane> _Geometry::build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis) { +PoolVector<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); } @@ -1262,22 +1262,22 @@ Variant _Geometry::segment_intersects_segment_2d(const Vector2& p_from_a,const V }; }; -DVector<Vector2> _Geometry::get_closest_points_between_segments_2d( const Vector2& p1,const Vector2& q1, const Vector2& p2,const Vector2& q2) { +PoolVector<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); - DVector<Vector2> r; + PoolVector<Vector2> r; r.resize(2); r.set(0,r1); r.set(1,r2); return r; } -DVector<Vector3> _Geometry::get_closest_points_between_segments(const Vector3& p1,const Vector3& p2,const Vector3& q1,const Vector3& q2) { +PoolVector<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); - DVector<Vector3> r; + PoolVector<Vector3> r; r.resize(2); r.set(0,r1); r.set(1,r2); @@ -1314,9 +1314,9 @@ bool _Geometry::point_is_inside_triangle(const Vector2& s, const Vector2& a, con return Geometry::is_point_in_triangle(s,a,b,c); } -DVector<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> _Geometry::segment_intersects_sphere( const Vector3& p_from, const Vector3& p_to, const Vector3& p_sphere_pos,real_t p_sphere_radius) { - DVector<Vector3> r; + PoolVector<Vector3> r; Vector3 res,norm; if (!Geometry::segment_intersects_sphere(p_from,p_to,p_sphere_pos,p_sphere_radius,&res,&norm)) return r; @@ -1326,9 +1326,9 @@ DVector<Vector3> _Geometry::segment_intersects_sphere( const Vector3& p_from, co r.set(1,norm); return r; } -DVector<Vector3> _Geometry::segment_intersects_cylinder( const Vector3& p_from, const Vector3& p_to, float p_height,float p_radius) { +PoolVector<Vector3> _Geometry::segment_intersects_cylinder( const Vector3& p_from, const Vector3& p_to, float p_height,float p_radius) { - DVector<Vector3> r; + PoolVector<Vector3> r; Vector3 res,norm; if (!Geometry::segment_intersects_cylinder(p_from,p_to,p_height,p_radius,&res,&norm)) return r; @@ -1339,9 +1339,9 @@ DVector<Vector3> _Geometry::segment_intersects_cylinder( const Vector3& p_from, return r; } -DVector<Vector3> _Geometry::segment_intersects_convex(const Vector3& p_from, const Vector3& p_to,const Vector<Plane>& p_planes) { +PoolVector<Vector3> _Geometry::segment_intersects_convex(const Vector3& p_from, const Vector3& p_to,const Vector<Plane>& p_planes) { - DVector<Vector3> r; + PoolVector<Vector3> r; Vector3 res,norm; if (!Geometry::segment_intersects_convex(p_from,p_to,p_planes.ptr(),p_planes.size(),&res,&norm)) return r; @@ -1566,9 +1566,9 @@ real_t _File::get_real() const{ return f->get_real(); } -DVector<uint8_t> _File::get_buffer(int p_length) const{ +PoolVector<uint8_t> _File::get_buffer(int p_length) const{ - DVector<uint8_t> data; + PoolVector<uint8_t> data; ERR_FAIL_COND_V(!f,data); ERR_FAIL_COND_V(p_length<0,data); @@ -1576,11 +1576,11 @@ DVector<uint8_t> _File::get_buffer(int p_length) const{ return data; Error err = data.resize(p_length); ERR_FAIL_COND_V(err!=OK,data); - DVector<uint8_t>::Write w = data.write(); + PoolVector<uint8_t>::Write w = data.write(); int len = f->get_buffer(&w[0],p_length); - ERR_FAIL_COND_V( len < 0 , DVector<uint8_t>()); + ERR_FAIL_COND_V( len < 0 , PoolVector<uint8_t>()); - w = DVector<uint8_t>::Write(); + w = PoolVector<uint8_t>::Write(); if (len < p_length) data.resize(p_length); @@ -1735,7 +1735,7 @@ void _File::store_line(const String& p_string){ f->store_line(p_string); } -void _File::store_buffer(const DVector<uint8_t>& p_buffer){ +void _File::store_buffer(const PoolVector<uint8_t>& p_buffer){ ERR_FAIL_COND(!f); @@ -1743,7 +1743,7 @@ void _File::store_buffer(const DVector<uint8_t>& p_buffer){ if (len==0) return; - DVector<uint8_t>::Read r = p_buffer.read(); + PoolVector<uint8_t>::Read r = p_buffer.read(); f->store_buffer(&r[0],len); } @@ -1762,13 +1762,13 @@ void _File::store_var(const Variant& p_var) { Error err = encode_variant(p_var,NULL,len); ERR_FAIL_COND( err != OK ); - DVector<uint8_t> buff; + PoolVector<uint8_t> buff; buff.resize(len); - DVector<uint8_t>::Write w = buff.write(); + PoolVector<uint8_t>::Write w = buff.write(); err = encode_variant(p_var,&w[0],len); ERR_FAIL_COND( err != OK ); - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); store_32(len); store_buffer(buff); @@ -1778,10 +1778,10 @@ Variant _File::get_var() const { ERR_FAIL_COND_V(!f,Variant()); uint32_t len = get_32(); - DVector<uint8_t> buff = get_buffer(len); + PoolVector<uint8_t> buff = get_buffer(len); ERR_FAIL_COND_V(buff.size() != len, Variant()); - DVector<uint8_t>::Read r = buff.read(); + PoolVector<uint8_t>::Read r = buff.read(); Variant v; Error err = decode_variant(v,&r[0],len); @@ -2056,17 +2056,17 @@ String _Marshalls::variant_to_base64(const Variant& p_var) { Error err = encode_variant(p_var,NULL,len); ERR_FAIL_COND_V( err != OK, "" ); - DVector<uint8_t> buff; + PoolVector<uint8_t> buff; buff.resize(len); - DVector<uint8_t>::Write w = buff.write(); + PoolVector<uint8_t>::Write w = buff.write(); err = encode_variant(p_var,&w[0],len); ERR_FAIL_COND_V( err != OK, "" ); int b64len = len / 3 * 4 + 4 + 1; - DVector<uint8_t> b64buff; + PoolVector<uint8_t> b64buff; b64buff.resize(b64len); - DVector<uint8_t>::Write w64 = b64buff.write(); + PoolVector<uint8_t>::Write w64 = b64buff.write(); int strlen = base64_encode((char*)(&w64[0]), (char*)(&w[0]), len); //OS::get_singleton()->print("len is %i, vector size is %i\n", b64len, strlen); @@ -2081,9 +2081,9 @@ Variant _Marshalls::base64_to_variant(const String& p_str) { int strlen = p_str.length(); CharString cstr = p_str.ascii(); - DVector<uint8_t> buf; + PoolVector<uint8_t> buf; buf.resize(strlen / 4 * 3 + 1); - DVector<uint8_t>::Write w = buf.write(); + PoolVector<uint8_t>::Write w = buf.write(); int len = base64_decode((char*)(&w[0]), (char*)cstr.get_data(), strlen); @@ -2094,15 +2094,15 @@ Variant _Marshalls::base64_to_variant(const String& p_str) { return v; }; -String _Marshalls::raw_to_base64(const DVector<uint8_t> &p_arr) { +String _Marshalls::raw_to_base64(const PoolVector<uint8_t> &p_arr) { int len = p_arr.size(); - DVector<uint8_t>::Read r = p_arr.read(); + PoolVector<uint8_t>::Read r = p_arr.read(); int b64len = len / 3 * 4 + 4 + 1; - DVector<uint8_t> b64buff; + PoolVector<uint8_t> b64buff; b64buff.resize(b64len); - DVector<uint8_t>::Write w64 = b64buff.write(); + PoolVector<uint8_t>::Write w64 = b64buff.write(); int strlen = base64_encode((char*)(&w64[0]), (char*)(&r[0]), len); w64[strlen] = 0; @@ -2111,22 +2111,22 @@ String _Marshalls::raw_to_base64(const DVector<uint8_t> &p_arr) { return ret; }; -DVector<uint8_t> _Marshalls::base64_to_raw(const String &p_str) { +PoolVector<uint8_t> _Marshalls::base64_to_raw(const String &p_str) { int strlen = p_str.length(); CharString cstr = p_str.ascii(); int arr_len; - DVector<uint8_t> buf; + PoolVector<uint8_t> buf; { buf.resize(strlen / 4 * 3 + 1); - DVector<uint8_t>::Write w = buf.write(); + PoolVector<uint8_t>::Write w = buf.write(); arr_len = base64_decode((char*)(&w[0]), (char*)cstr.get_data(), strlen); }; buf.resize(arr_len); - // conversion from DVector<uint8_t> to raw array? + // conversion from PoolVector<uint8_t> to raw array? return buf; }; @@ -2136,9 +2136,9 @@ String _Marshalls::utf8_to_base64(const String& p_str) { int len = cstr.length(); int b64len = len / 3 * 4 + 4 + 1; - DVector<uint8_t> b64buff; + PoolVector<uint8_t> b64buff; b64buff.resize(b64len); - DVector<uint8_t>::Write w64 = b64buff.write(); + PoolVector<uint8_t>::Write w64 = b64buff.write(); int strlen = base64_encode((char*)(&w64[0]), (char*)cstr.get_data(), len); @@ -2153,9 +2153,9 @@ String _Marshalls::base64_to_utf8(const String& p_str) { int strlen = p_str.length(); CharString cstr = p_str.ascii(); - DVector<uint8_t> buf; + PoolVector<uint8_t> buf; buf.resize(strlen / 4 * 3 + 1 + 1); - DVector<uint8_t>::Write w = buf.write(); + PoolVector<uint8_t>::Write w = buf.write(); int len = base64_decode((char*)(&w[0]), (char*)cstr.get_data(), strlen); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 9a4f26a12d..f1c98a58dc 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -50,7 +50,7 @@ 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); - DVector<String> get_recognized_extensions_for_type(const String& p_type); + PoolVector<String> get_recognized_extensions_for_type(const String& p_type); void set_abort_on_missing_resources(bool p_abort); StringArray get_dependencies(const String& p_path); bool has(const String& p_path); @@ -81,7 +81,7 @@ public: static _ResourceSaver *get_singleton() { return singleton; } Error save(const String &p_path,const RES& p_resource, uint32_t p_flags); - DVector<String> get_recognized_extensions(const RES& p_resource); + PoolVector<String> get_recognized_extensions(const RES& p_resource); _ResourceSaver(); @@ -342,20 +342,20 @@ protected: public: static _Geometry *get_singleton(); - DVector<Plane> build_box_planes(const Vector3& p_extents); - DVector<Plane> build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis=Vector3::AXIS_Z); - DVector<Plane> build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis=Vector3::AXIS_Z); + 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); 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); - DVector<Vector2> get_closest_points_between_segments_2d( const Vector2& p1,const Vector2& q1, const Vector2& p2,const Vector2& q2); - DVector<Vector3> get_closest_points_between_segments(const Vector3& p1,const Vector3& p2,const Vector3& q1,const Vector3& q2); + 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); Vector3 get_closest_point_to_segment(const Vector3& p_point, const Vector3& p_a,const Vector3& p_b); Variant ray_intersects_triangle( const Vector3& p_from, const Vector3& p_dir, const Vector3& p_v0,const Vector3& p_v1,const Vector3& p_v2); 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; - DVector<Vector3> segment_intersects_sphere( const Vector3& p_from, const Vector3& p_to, const Vector3& p_sphere_pos,real_t p_sphere_radius); - DVector<Vector3> segment_intersects_cylinder( const Vector3& p_from, const Vector3& p_to, float p_height,float p_radius); - DVector<Vector3> segment_intersects_convex(const Vector3& p_from, const Vector3& p_to,const Vector<Plane>& p_planes); + 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); 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); @@ -413,7 +413,7 @@ public: Variant get_var() const; - DVector<uint8_t> get_buffer(int p_length) const; ///< get an array of bytes + PoolVector<uint8_t> get_buffer(int p_length) const; ///< get an array of bytes String get_line() const; String get_as_text() const; String get_md5(const String& p_path) const; @@ -447,7 +447,7 @@ public: Vector<String> get_csv_line(String delim=",") const; - void store_buffer(const DVector<uint8_t>& p_buffer); ///< store an array of bytes + void store_buffer(const PoolVector<uint8_t>& p_buffer); ///< store an array of bytes void store_var(const Variant& p_var); @@ -517,8 +517,8 @@ public: String variant_to_base64(const Variant& p_var); Variant base64_to_variant(const String& p_str); - String raw_to_base64(const DVector<uint8_t>& p_arr); - DVector<uint8_t> base64_to_raw(const String& p_str); + String raw_to_base64(const PoolVector<uint8_t>& p_arr); + PoolVector<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); diff --git a/core/compressed_translation.cpp b/core/compressed_translation.cpp index 9b39eeb2c1..f8aa3915d4 100644 --- a/core/compressed_translation.cpp +++ b/core/compressed_translation.cpp @@ -356,8 +356,8 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) { hash_table.resize(size); bucket_table.resize(bucket_table_size); - DVector<int>::Write htwb = hash_table.write(); - DVector<int>::Write btwb = bucket_table.write(); + PoolVector<int>::Write htwb = hash_table.write(); + PoolVector<int>::Write btwb = bucket_table.write(); uint32_t *htw = (uint32_t*)&htwb[0]; uint32_t *btw = (uint32_t*)&btwb[0]; @@ -392,7 +392,7 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) { print_line("total collisions: "+itos(collisions)); strings.resize(total_compression_size); - DVector<uint8_t>::Write cw = strings.write(); + PoolVector<uint8_t>::Write cw = strings.write(); for(int i=0;i<compressed.size();i++) { memcpy(&cw[compressed[i].offset],compressed[i].compressed.get_data(),compressed[i].compressed.size()); @@ -454,11 +454,11 @@ StringName PHashTranslation::get_message(const StringName& p_src_text) const { uint32_t h = hash(0,str.get_data()); - DVector<int>::Read htr = hash_table.read(); + PoolVector<int>::Read htr = hash_table.read(); const uint32_t *htptr = (const uint32_t*)&htr[0]; - DVector<int>::Read btr = bucket_table.read(); + PoolVector<int>::Read btr = bucket_table.read(); const uint32_t *btptr = (const uint32_t*)&btr[0]; - DVector<uint8_t>::Read sr = strings.read(); + PoolVector<uint8_t>::Read sr = strings.read(); const char *sptr= (const char*)&sr[0]; uint32_t p = htptr[ h % htsize]; diff --git a/core/compressed_translation.h b/core/compressed_translation.h index 218a59c05d..cb1e084051 100644 --- a/core/compressed_translation.h +++ b/core/compressed_translation.h @@ -42,9 +42,9 @@ class PHashTranslation : public Translation { //of catching untranslated strings //load/store friendly types - DVector<int> hash_table; - DVector<int> bucket_table; - DVector<uint8_t> strings; + PoolVector<int> hash_table; + PoolVector<int> bucket_table; + PoolVector<uint8_t> strings; struct Bucket { diff --git a/core/dvector.cpp b/core/dvector.cpp index 7caa198c4c..f6b5a5fcbf 100644 --- a/core/dvector.cpp +++ b/core/dvector.cpp @@ -30,3 +30,44 @@ Mutex* dvector_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_EXPLAINC("There are still MemoryPool allocs in use at exit!"); + ERR_FAIL_COND(allocs_used>0); + +} diff --git a/core/dvector.h b/core/dvector.h index 9e0090fb7c..f109f842a2 100644 --- a/core/dvector.h +++ b/core/dvector.h @@ -30,6 +30,46 @@ #define DVECTOR_H #include "os/memory.h" +#include "os/copymem.h" +#include "pool_allocator.h" +#include "safe_refcount.h" +#include "os/rw_lock.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() { mem=NULL; lock=0; 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(); +}; /** @@ -37,182 +77,274 @@ */ -extern Mutex* dvector_lock; - template<class T> -class DVector { +class PoolVector { + + MemoryPool::Alloc *alloc; - mutable MID mem; + void _copy_on_write() { - void copy_on_write() { - if (!mem.is_valid()) + if (!alloc) return; - if (dvector_lock) - dvector_lock->lock(); + ERR_FAIL_COND(alloc->lock>0); - MID_Lock lock( mem ); + if (alloc->refcount.get()==1) + return; //nothing to do - if ( *(int*)lock.data() == 1 ) { - // one reference, means no refcount changes - if (dvector_lock) - dvector_lock->unlock(); - return; + //must allocate something + + MemoryPool::alloc_mutex->lock(); + if (MemoryPool::allocs_used==MemoryPool::alloc_count) { + MemoryPool::alloc_mutex->unlock(); + ERR_EXPLAINC("All memory pool allocations are in use, can't COW."); + ERR_FAIL(); } - MID new_mem= dynalloc( mem.get_size() ); + 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++; - if (!new_mem.is_valid()) { + //copy the alloc data + alloc->size=old_alloc->size; + alloc->refcount.init(); + alloc->pool_id=POOL_ALLOCATOR_INVALID_ID; + alloc->lock=0; - if (dvector_lock) - dvector_lock->unlock(); - ERR_FAIL_COND( new_mem.is_valid() ); // out of memory +#ifdef DEBUG_ENABLED + MemoryPool::total_memory+=alloc->size; + if (MemoryPool::total_memory>MemoryPool::max_memory) { + MemoryPool::max_memory=MemoryPool::total_memory; } +#endif - MID_Lock dst_lock( new_mem ); + MemoryPool::alloc_mutex->unlock(); - int *rc = (int*)dst_lock.data(); + if (MemoryPool::memory_pool) { - *rc=1; - T * dst = (T*)(rc + 1 ); + } else { + alloc->mem = memalloc( alloc->size ); + copymem( alloc->mem, old_alloc->mem, alloc->size ); + } - T * src =(T*) ((int*)lock.data() + 1 ); + if (old_alloc->refcount.unref()) { + //this should never happen but.. - int count = (mem.get_size() - sizeof(int)) / sizeof(T); +#ifdef DEBUG_ENABLED + MemoryPool::alloc_mutex->lock(); + MemoryPool::total_memory-=old_alloc->size; + MemoryPool::alloc_mutex->unlock(); +#endif - for (int i=0;i<count;i++) { - memnew_placement( &dst[i], T(src[i]) ); - } + if (MemoryPool::memory_pool) { + //resize memory pool + //if none, create + //if some resize + } else { - (*(int*)lock.data())--; + memfree( old_alloc->mem ); + old_alloc->mem=NULL; + old_alloc->size=0; - // unlock all - dst_lock=MID_Lock(); - lock=MID_Lock(); - mem=new_mem; + MemoryPool::alloc_mutex->lock(); + old_alloc->free_list=MemoryPool::free_list; + MemoryPool::free_list=old_alloc; + MemoryPool::allocs_used--; + MemoryPool::alloc_mutex->unlock(); + } - if (dvector_lock) - dvector_lock->unlock(); + } } - void reference( const DVector& p_dvector ) { + void _reference( const PoolVector& p_dvector ) { - unreference(); + if (alloc==p_dvector.alloc) + return; - if (dvector_lock) - dvector_lock->lock(); + _unreference(); - if (!p_dvector.mem.is_valid()) { + if (!p_dvector.alloc) { + return; + } - if (dvector_lock) - dvector_lock->unlock(); + if (p_dvector.alloc->refcount.ref()) { + alloc=p_dvector.alloc; + } + + } + + + void _unreference() { + + if (!alloc) + return; + + if (!alloc->refcount.unref()) { + alloc=NULL; return; } - MID_Lock lock(p_dvector.mem); + //must be disposed! - int * rc = (int*)lock.data(); - (*rc)++; + { + int cur_elements = alloc->size/sizeof(T); + Write w; + for (int i=0;i<cur_elements;i++) { - lock = MID_Lock(); - mem=p_dvector.mem; + w[i].~T(); + } - if (dvector_lock) - dvector_lock->unlock(); + } - } +#ifdef DEBUG_ENABLED + MemoryPool::alloc_mutex->lock(); + MemoryPool::total_memory-=alloc->size; + MemoryPool::alloc_mutex->unlock(); +#endif - void unreference() { + if (MemoryPool::memory_pool) { + //resize memory pool + //if none, create + //if some resize + } else { - if (dvector_lock) - dvector_lock->lock(); + memfree( alloc->mem ); + alloc->mem=NULL; + alloc->size=0; - if (!mem.is_valid()) { - if (dvector_lock) - dvector_lock->unlock(); - return; + MemoryPool::alloc_mutex->lock(); + alloc->free_list=MemoryPool::free_list; + MemoryPool::free_list=alloc; + MemoryPool::allocs_used--; + MemoryPool::alloc_mutex->unlock(); + } - MID_Lock lock(mem); + alloc=NULL; + } - int * rc = (int*)lock.data(); - (*rc)--; +public: - if (*rc==0) { - // no one else using it, destruct + class Access { + friend class PoolVector; + protected: + MemoryPool::Alloc *alloc; + T * mem; - T * t= (T*)(rc+1); - int count = (mem.get_size() - sizeof(int)) / sizeof(T); + _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 + } + } - for (int i=0;i<count;i++) { + mem = (T*)alloc->mem; + } + } - t[i].~T(); + _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; + } - lock = MID_Lock(); - mem = MID (); + public: + virtual ~Access() { + _unref(); + } + }; - if (dvector_lock) - dvector_lock->unlock(); + 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; } -public: + void operator=(const Read& p_read) { + if (this->alloc==p_read.alloc) + return; + this->_unref(); + this->_ref(p_read.alloc); + } - class Read { - friend class DVector; - MID_Lock lock; - const T * mem; - public: + Read(const Read& p_read) { + this->_ref(p_read.alloc); + } + + Read() {} - _FORCE_INLINE_ const T& operator[](int p_index) const { return mem[p_index]; } - _FORCE_INLINE_ const T *ptr() const { return mem; } - Read() { mem=NULL; } }; - class Write { - friend class DVector; - MID_Lock lock; - T * mem; + class Write : public Access { public: - _FORCE_INLINE_ T& operator[](int p_index) { return mem[p_index]; } - _FORCE_INLINE_ T *ptr() { return mem; } + _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() {} - Write() { mem=NULL; } }; Read read() const { Read r; - if (mem.is_valid()) { - r.lock = MID_Lock( mem ); - r.mem = (const T*)((int*)r.lock.data()+1); + if (alloc) { + r._ref(alloc); } return r; + } Write write() { Write w; - if (mem.is_valid()) { - copy_on_write(); - w.lock = MID_Lock( mem ); - w.mem = (T*)((int*)w.lock.data()+1); + if (alloc) { + _copy_on_write(); //make sure there is only one being acessed + w._ref(alloc); } return w; } @@ -250,7 +382,7 @@ public: 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 DVector<T>& p_arr) { + void append_array(const PoolVector<T>& p_arr) { int ds = p_arr.size(); if (ds==0) return; @@ -262,7 +394,7 @@ public: w[bs+i]=r[i]; } - DVector<T> subarray(int p_from, int p_to) { + PoolVector<T> subarray(int p_from, int p_to) { if (p_from<0) { p_from=size()+p_from; @@ -271,15 +403,15 @@ public: p_to=size()+p_to; } if (p_from<0 || p_from>=size()) { - DVector<T>& aux=*((DVector<T>*)0); // nullreturn + PoolVector<T>& aux=*((PoolVector<T>*)0); // nullreturn ERR_FAIL_COND_V(p_from<0 || p_from>=size(),aux) } if (p_to<0 || p_to>=size()) { - DVector<T>& aux=*((DVector<T>*)0); // nullreturn + PoolVector<T>& aux=*((PoolVector<T>*)0); // nullreturn ERR_FAIL_COND_V(p_to<0 || p_to>=size(),aux) } - DVector<T> slice; + PoolVector<T> slice; int span=1 + p_to - p_from; slice.resize(span); Read r = read(); @@ -307,7 +439,7 @@ public: } - bool is_locked() const { return mem.is_locked(); } + bool is_locked() const { return alloc && alloc->lock>0; } inline const T operator[](int p_index) const; @@ -315,27 +447,27 @@ public: void invert(); - void operator=(const DVector& p_dvector) { reference(p_dvector); } - DVector() {} - DVector(const DVector& p_dvector) { reference(p_dvector); } - ~DVector() { unreference(); } + void operator=(const PoolVector& p_dvector) { _reference(p_dvector); } + PoolVector() { alloc=NULL; } + PoolVector(const PoolVector& p_dvector) { alloc=NULL; _reference(p_dvector); } + ~PoolVector() { _unreference(); } }; template<class T> -int DVector<T>::size() const { +int PoolVector<T>::size() const { - return mem.is_valid() ? ((mem.get_size() - sizeof(int)) / sizeof(T) ) : 0; + return alloc ? alloc->size/sizeof(T) : 0; } template<class T> -T DVector<T>::get(int p_index) const { +T PoolVector<T>::get(int p_index) const { return operator[](p_index); } template<class T> -void DVector<T>::set(int p_index, const T& p_val) { +void PoolVector<T>::set(int p_index, const T& p_val) { if (p_index<0 || p_index>=size()) { ERR_FAIL_COND(p_index<0 || p_index>=size()); @@ -346,14 +478,14 @@ void DVector<T>::set(int p_index, const T& p_val) { } template<class T> -void DVector<T>::push_back(const T& p_val) { +void PoolVector<T>::push_back(const T& p_val) { resize( size() + 1 ); set( size() -1, p_val ); } template<class T> -const T DVector<T>::operator[](int p_index) const { +const T PoolVector<T>::operator[](int p_index) const { if (p_index<0 || p_index>=size()) { T& aux=*((T*)0); //nullreturn @@ -367,94 +499,130 @@ const T DVector<T>::operator[](int p_index) const { template<class T> -Error DVector<T>::resize(int p_size) { +Error PoolVector<T>::resize(int p_size) { - if (dvector_lock) - dvector_lock->lock(); - bool same = p_size==size(); + if (alloc==NULL) { - if (dvector_lock) - dvector_lock->unlock(); - // no further locking is necesary because we are supposed to own the only copy of this (using copy on write) + if (p_size==0) + return OK; //nothing to do here - if (same) - return OK; + //must allocate something + MemoryPool::alloc_mutex->lock(); + if (MemoryPool::allocs_used==MemoryPool::alloc_count) { + MemoryPool::alloc_mutex->unlock(); + ERR_EXPLAINC("All memory pool allocations are in use."); + ERR_FAIL_V(ERR_OUT_OF_MEMORY); + } - if (p_size == 0 ) { + //take one from the free list + alloc = MemoryPool::free_list; + MemoryPool::free_list = alloc->free_list; + //increment the used counter + MemoryPool::allocs_used++; - unreference(); - return OK; + //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( alloc->lock>0, ERR_LOCKED ); //can't resize if locked! } + size_t new_size = sizeof(T)*p_size; - copy_on_write(); // make it unique + if (alloc->size==new_size) + return OK; //nothing to do - ERR_FAIL_COND_V( mem.is_locked(), ERR_LOCKED ); // if after copy on write, memory is locked, fail. + if (p_size == 0 ) { + _unreference(); + return OK; + } - if (p_size > size() ) { + _copy_on_write(); // make it unique - int oldsize=size(); +#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 - MID_Lock lock; - if (oldsize==0) { + int cur_elements = alloc->size / sizeof(T); - mem = dynalloc( p_size * sizeof(T) + sizeof(int) ); - lock=MID_Lock(mem); - int *rc = ((int*)lock.data()); - *rc=1; + if (p_size > cur_elements ) { + if (MemoryPool::memory_pool) { + //resize memory pool + //if none, create + //if some resize } else { - if (dynrealloc( mem, p_size * sizeof(T) + sizeof(int) )!=OK ) { - - ERR_FAIL_V(ERR_OUT_OF_MEMORY); // out of memory + if (alloc->size==0) { + alloc->mem = memalloc( new_size ); + } else { + alloc->mem = memrealloc( alloc->mem, new_size ); } - - lock=MID_Lock(mem); } + alloc->size=new_size; + Write w = write(); + for (int i=cur_elements;i<p_size;i++) { - T *t = (T*)((int*)lock.data() + 1); - - for (int i=oldsize;i<p_size;i++) { - - memnew_placement(&t[i], T ); + memnew_placement(&w[i], T ); } - lock = MID_Lock(); // clear - } else { - - int oldsize=size(); - - MID_Lock lock(mem); + } else { - T *t = (T*)((int*)lock.data() + 1); + { + Write w; + for (int i=p_size;i<cur_elements;i++) { - for (int i=p_size;i<oldsize;i++) { + w[i].~T(); + } - t[i].~T(); } - lock = MID_Lock(); // clear + 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; - if (dynrealloc( mem, p_size * sizeof(T) + sizeof(int) )!=OK ) { + MemoryPool::alloc_mutex->lock(); + alloc->free_list=MemoryPool::free_list; + MemoryPool::free_list=alloc; + MemoryPool::allocs_used--; + MemoryPool::alloc_mutex->unlock(); - ERR_FAIL_V(ERR_OUT_OF_MEMORY); // wtf error + } else { + alloc->mem = memrealloc( alloc->mem, new_size ); + alloc->size=new_size; + } } - } return OK; } template<class T> -void DVector<T>::invert() { +void PoolVector<T>::invert() { T temp; Write w = write(); int s = size(); diff --git a/core/globals.cpp b/core/globals.cpp index 6609b47147..b6498c62e4 100644 --- a/core/globals.cpp +++ b/core/globals.cpp @@ -691,9 +691,9 @@ static Variant _decode_variant(const String& p_string) { String data=params[4]; int datasize=data.length()/2; - DVector<uint8_t> pixels; + PoolVector<uint8_t> pixels; pixels.resize(datasize); - DVector<uint8_t>::Write wb = pixels.write(); + PoolVector<uint8_t>::Write wb = pixels.write(); const CharType *cptr=data.c_str(); int idx=0; @@ -720,7 +720,7 @@ static Variant _decode_variant(const String& p_string) { } - wb = DVector<uint8_t>::Write(); + wb = PoolVector<uint8_t>::Write(); return Image(w,h,mipmaps,imgformat,pixels); } @@ -992,9 +992,9 @@ static String _encode_variant(const Variant& p_variant) { str+=itos(img.has_mipmaps())+", "; str+=itos(img.get_width())+", "; str+=itos(img.get_height())+", "; - DVector<uint8_t> data = img.get_data(); + PoolVector<uint8_t> data = img.get_data(); int ds=data.size(); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Read r = data.read(); for(int i=0;i<ds;i++) { uint8_t byte = r[i]; const char hex[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; diff --git a/core/image.cpp b/core/image.cpp index e949cd9b38..174c840c23 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -365,8 +365,8 @@ void Image::convert( Format p_new_format ){ // int len=data.size(); - DVector<uint8_t>::Read r = data.read(); - DVector<uint8_t>::Write w = new_img.data.write(); + 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(); @@ -409,8 +409,8 @@ void Image::convert( Format p_new_format ){ } - r = DVector<uint8_t>::Read(); - w = DVector<uint8_t>::Write(); + r = PoolVector<uint8_t>::Read(); + w = PoolVector<uint8_t>::Write(); bool gen_mipmaps=mipmaps; @@ -651,10 +651,10 @@ void Image::resize( int p_width, int p_height, Interpolation p_interpolation ) { Image dst( p_width, p_height, 0, format ); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Read r = data.read(); const unsigned char*r_ptr=r.ptr(); - DVector<uint8_t>::Write w = dst.data.write(); + PoolVector<uint8_t>::Write w = dst.data.write(); unsigned char*w_ptr=w.ptr(); @@ -693,8 +693,8 @@ void Image::resize( int p_width, int p_height, Interpolation p_interpolation ) { } - r = DVector<uint8_t>::Read(); - w = DVector<uint8_t>::Write(); + r = PoolVector<uint8_t>::Read(); + w = PoolVector<uint8_t>::Write(); if (mipmaps>0) dst.generate_mipmaps(); @@ -725,8 +725,8 @@ void Image::crop( int p_width, int p_height ) { Image dst( p_width, p_height,0, format ); { - DVector<uint8_t>::Read r = data.read(); - DVector<uint8_t>::Write w = dst.data.write(); + PoolVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Write w = dst.data.write(); for (int y=0;y<p_height;y++) { @@ -767,7 +767,7 @@ void Image::flip_y() { { - DVector<uint8_t>::Write w = data.write(); + PoolVector<uint8_t>::Write w = data.write(); uint8_t up[16]; uint8_t down[16]; uint32_t pixel_size = get_format_pixel_size(format); @@ -806,7 +806,7 @@ void Image::flip_x() { { - DVector<uint8_t>::Write w = data.write(); + PoolVector<uint8_t>::Write w = data.write(); uint8_t up[16]; uint8_t down[16]; uint32_t pixel_size = get_format_pixel_size(format); @@ -925,12 +925,12 @@ void Image::expand_x2_hq2x() { if (current!=FORMAT_RGBA8) convert(FORMAT_RGBA8); - DVector<uint8_t> dest; + PoolVector<uint8_t> dest; dest.resize(width*2*height*2*4); { - DVector<uint8_t>::Read r = data.read(); - DVector<uint8_t>::Write w = dest.write(); + PoolVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Write w = dest.write(); hq2x_resize((const uint32_t*)r.ptr(),width,height,(uint32_t*)w.ptr()); @@ -959,7 +959,7 @@ void Image::shrink_x2() { if (mipmaps) { //just use the lower mipmap as base and copy all - DVector<uint8_t> new_img; + PoolVector<uint8_t> new_img; int ofs = get_mipmap_offset(1); @@ -968,8 +968,8 @@ void Image::shrink_x2() { { - DVector<uint8_t>::Write w=new_img.write(); - DVector<uint8_t>::Read r=data.read(); + PoolVector<uint8_t>::Write w=new_img.write(); + PoolVector<uint8_t>::Read r=data.read(); copymem(w.ptr(),&r[ofs],new_size); } @@ -980,15 +980,15 @@ void Image::shrink_x2() { } else { - DVector<uint8_t> new_img; + PoolVector<uint8_t> new_img; ERR_FAIL_COND( !_can_modify(format) ); int ps = get_format_pixel_size(format); new_img.resize((width/2)*(height/2)*ps); { - DVector<uint8_t>::Write w=new_img.write(); - DVector<uint8_t>::Read r=data.read(); + PoolVector<uint8_t>::Write w=new_img.write(); + PoolVector<uint8_t>::Read r=data.read(); switch(format) { @@ -1027,7 +1027,7 @@ Error Image::generate_mipmaps(bool p_keep_existing) { data.resize(size); - DVector<uint8_t>::Write wp=data.write(); + PoolVector<uint8_t>::Write wp=data.write(); if (nearest_power_of_2(width)==uint32_t(width) && nearest_power_of_2(height)==uint32_t(height)) { //use fast code for powers of 2 @@ -1122,7 +1122,7 @@ bool Image::empty() const { return (data.size()==0); } -DVector<uint8_t> Image::get_data() const { +PoolVector<uint8_t> Image::get_data() const { return data; } @@ -1134,7 +1134,7 @@ void Image::create(int p_width, int p_height, bool p_use_mipmaps,Format p_format int size = _get_dst_image_size(p_width,p_height,p_format,mm,p_use_mipmaps?-1:0); data.resize( size ); { - DVector<uint8_t>::Write w= data.write(); + PoolVector<uint8_t>::Write w= data.write(); zeromem(w.ptr(),size); } @@ -1146,7 +1146,7 @@ void Image::create(int p_width, int p_height, bool p_use_mipmaps,Format p_format } -void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const DVector<uint8_t>& p_data) { +void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const PoolVector<uint8_t>& p_data) { ERR_FAIL_INDEX(p_width-1,MAX_WIDTH); ERR_FAIL_INDEX(p_height-1,MAX_HEIGHT); @@ -1188,7 +1188,7 @@ void Image::create( const char ** p_xpm ) { HashMap<String,Color> colormap; int colormap_size; uint32_t pixel_size; - DVector<uint8_t>::Write w; + PoolVector<uint8_t>::Write w; while (status!=DONE) { @@ -1355,7 +1355,7 @@ bool Image::is_invisible() const { int w,h; _get_mipmap_offset_and_size(1,len,w,h); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Read r = data.read(); const unsigned char *data_ptr=r.ptr(); bool detected=false; @@ -1401,7 +1401,7 @@ Image::AlphaMode Image::detect_alpha() const { int w,h; _get_mipmap_offset_and_size(1,len,w,h); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Read r = data.read(); const unsigned char *data_ptr=r.ptr(); bool bit=false; @@ -1459,8 +1459,8 @@ bool Image::operator==(const Image& p_image) const { if (data.size() == 0 && p_image.data.size() == 0) return true; - DVector<uint8_t>::Read r = data.read(); - DVector<uint8_t>::Read pr = p_image.data.read(); + PoolVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Read pr = p_image.data.read(); return r.ptr() == pr.ptr(); } @@ -1502,11 +1502,11 @@ Error Image::_decompress_bc() { int mm; int size = _get_dst_image_size(wd,ht,FORMAT_RGBA8,mm); - DVector<uint8_t> newdata; + PoolVector<uint8_t> newdata; newdata.resize(size); - DVector<uint8_t>::Write w = newdata.write(); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Write w = newdata.write(); + PoolVector<uint8_t>::Read r = data.read(); int rofs=0; int wofs=0; @@ -1814,8 +1814,8 @@ Error Image::_decompress_bc() { } - w=DVector<uint8_t>::Write(); - r=DVector<uint8_t>::Read(); + w=PoolVector<uint8_t>::Write(); + r=PoolVector<uint8_t>::Read(); data=newdata; format=FORMAT_RGBA8; @@ -1927,7 +1927,7 @@ Image::Image(int p_width, int p_height,bool p_use_mipmaps, Format p_format) { } -Image::Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const DVector<uint8_t>& p_data) { +Image::Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const PoolVector<uint8_t>& p_data) { width=0; height=0; @@ -1950,7 +1950,7 @@ Rect2 Image::get_used_rect() const { return Rect2(); //int data_size = len; - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Read r = data.read(); const unsigned char *rptr=r.ptr(); int ps = format==FORMAT_LA8?2:4; @@ -2005,10 +2005,10 @@ void Image::blit_rect(const Image& p_src, const Rect2& p_src_rect,const Point2& return; Rect2i src_rect( p_src_rect.pos + ( local_src_rect.pos - p_dest), local_src_rect.size ); - DVector<uint8_t>::Write wp = data.write(); + PoolVector<uint8_t>::Write wp = data.write(); uint8_t *dst_data_ptr=wp.ptr(); - DVector<uint8_t>::Read rp = p_src.data.read(); + PoolVector<uint8_t>::Read rp = p_src.data.read(); const uint8_t *src_data_ptr=rp.ptr(); int pixel_size=get_format_pixel_size(format); @@ -2049,10 +2049,10 @@ void (*Image::_image_decompress_bc)(Image *)=NULL; void (*Image::_image_decompress_etc)(Image *)=NULL; void (*Image::_image_decompress_etc2)(Image *)=NULL; -DVector<uint8_t> (*Image::lossy_packer)(const Image& ,float )=NULL; -Image (*Image::lossy_unpacker)(const DVector<uint8_t>& )=NULL; -DVector<uint8_t> (*Image::lossless_packer)(const Image& )=NULL; -Image (*Image::lossless_unpacker)(const DVector<uint8_t>& )=NULL; +PoolVector<uint8_t> (*Image::lossy_packer)(const Image& ,float )=NULL; +Image (*Image::lossy_unpacker)(const PoolVector<uint8_t>& )=NULL; +PoolVector<uint8_t> (*Image::lossless_packer)(const Image& )=NULL; +Image (*Image::lossless_unpacker)(const PoolVector<uint8_t>& )=NULL; void Image::set_compress_bc_func(void (*p_compress_func)(Image *)) { @@ -2067,7 +2067,7 @@ void Image::normalmap_to_xy() { { int len = data.size()/4; - DVector<uint8_t>::Write wp = data.write(); + PoolVector<uint8_t>::Write wp = data.write(); unsigned char *data_ptr=wp.ptr(); for(int i=0;i<len;i++) { @@ -2094,7 +2094,7 @@ void Image::srgb_to_linear() { if (format==FORMAT_RGBA8) { int len = data.size()/4; - DVector<uint8_t>::Write wp = data.write(); + PoolVector<uint8_t>::Write wp = data.write(); unsigned char *data_ptr=wp.ptr(); for(int i=0;i<len;i++) { @@ -2107,7 +2107,7 @@ void Image::srgb_to_linear() { } else if (format==FORMAT_RGB8) { int len = data.size()/3; - DVector<uint8_t>::Write wp = data.write(); + PoolVector<uint8_t>::Write wp = data.write(); unsigned char *data_ptr=wp.ptr(); for(int i=0;i<len;i++) { @@ -2128,7 +2128,7 @@ void Image::premultiply_alpha() { if (format!=FORMAT_RGBA8) return; //not needed - DVector<uint8_t>::Write wp = data.write(); + PoolVector<uint8_t>::Write wp = data.write(); unsigned char *data_ptr=wp.ptr(); @@ -2152,11 +2152,11 @@ void Image::fix_alpha_edges() { if (format!=FORMAT_RGBA8) return; //not needed - DVector<uint8_t> dcopy = data; - DVector<uint8_t>::Read rp = data.read(); + PoolVector<uint8_t> dcopy = data; + PoolVector<uint8_t>::Read rp = data.read(); const uint8_t *srcptr=rp.ptr(); - DVector<uint8_t>::Write wp = data.write(); + PoolVector<uint8_t>::Write wp = data.write(); unsigned char *data_ptr=wp.ptr(); const int max_radius=4; diff --git a/core/image.h b/core/image.h index 2c585d74d9..620160147b 100644 --- a/core/image.h +++ b/core/image.h @@ -123,14 +123,14 @@ public: Error _decompress_bc(); - static DVector<uint8_t> (*lossy_packer)(const Image& p_image,float p_quality); - static Image (*lossy_unpacker)(const DVector<uint8_t>& p_buffer); - static DVector<uint8_t> (*lossless_packer)(const Image& p_image); - static Image (*lossless_unpacker)(const DVector<uint8_t>& p_buffer); + static PoolVector<uint8_t> (*lossy_packer)(const Image& p_image,float p_quality); + static Image (*lossy_unpacker)(const PoolVector<uint8_t>& p_buffer); + static PoolVector<uint8_t> (*lossless_packer)(const Image& p_image); + static Image (*lossless_unpacker)(const PoolVector<uint8_t>& p_buffer); private: Format format; - DVector<uint8_t> data; + PoolVector<uint8_t> data; int width,height; bool mipmaps; @@ -206,7 +206,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 DVector<uint8_t>& p_data); + void create(int p_width, int p_height, bool p_use_mipmaps, Format p_format, const PoolVector<uint8_t>& p_data); void create( const char ** p_xpm ); /** @@ -214,7 +214,7 @@ public: */ bool empty() const; - DVector<uint8_t> get_data() const; + PoolVector<uint8_t> get_data() const; Error load(const String& p_path); Error save_png(const String& p_path); @@ -230,7 +230,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 DVector<uint8_t>& p_data); + Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const PoolVector<uint8_t>& p_data); enum AlphaMode { ALPHA_NONE, diff --git a/core/io/file_access_buffered.cpp b/core/io/file_access_buffered.cpp index 347edc7407..71518de38b 100644 --- a/core/io/file_access_buffered.cpp +++ b/core/io/file_access_buffered.cpp @@ -117,7 +117,7 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest,int p_elements) const { int size = (cache.buffer.size() - (file.offset - cache.offset)); size = size - (size % 4); - //DVector<uint8_t>::Read read = cache.buffer.read(); + //PoolVector<uint8_t>::Read read = cache.buffer.read(); //memcpy(p_dest, read.ptr() + (file.offset - cache.offset), size); memcpy(p_dest, cache.buffer.ptr() + (file.offset - cache.offset), size); p_dest += size; @@ -152,7 +152,7 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest,int p_elements) const { }; int r = MIN(left, to_read); - //DVector<uint8_t>::Read read = cache.buffer.read(); + //PoolVector<uint8_t>::Read read = cache.buffer.read(); //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_fa.h b/core/io/file_access_buffered_fa.h index 8a15584b13..884d40a266 100644 --- a/core/io/file_access_buffered_fa.h +++ b/core/io/file_access_buffered_fa.h @@ -53,7 +53,7 @@ class FileAccessBufferedFA : public FileAccessBuffered { cache.buffer.resize(p_size); // on dvector - //DVector<uint8_t>::Write write = cache.buffer.write(); + //PoolVector<uint8_t>::Write write = cache.buffer.write(); //f.get_buffer(write.ptr(), p_size); // on vector diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 4051ae302f..b556d46105 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -87,7 +87,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 DVector<uint8_t>& p_body) { +Error HTTPClient::request_raw( Method p_method, const String& p_url, const Vector<String>& p_headers,const PoolVector<uint8_t>& p_body) { ERR_FAIL_INDEX_V(p_method,METHOD_MAX,ERR_INVALID_PARAMETER); ERR_FAIL_COND_V(status!=STATUS_CONNECTED,ERR_INVALID_PARAMETER); @@ -120,7 +120,7 @@ Error HTTPClient::request_raw( Method p_method, const String& p_url, const Vecto request+="\r\n"; CharString cs=request.utf8(); - DVector<uint8_t> data; + PoolVector<uint8_t> data; //Maybe this goes faster somehow? for(int i=0;i<cs.length();i++) { @@ -128,7 +128,7 @@ Error HTTPClient::request_raw( Method p_method, const String& p_url, const Vecto } data.append_array( p_body ); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Read r = data.read(); Error err = connection->put_data(&r[0], data.size()); if (err) { diff --git a/core/io/http_client.h b/core/io/http_client.h index 2e78882303..231475775f 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -172,7 +172,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 DVector<uint8_t>& p_body); + Error request_raw( Method p_method, const String& p_url, const Vector<String>& p_headers,const PoolVector<uint8_t>& p_body); Error request( Method p_method, const String& p_url, const Vector<String>& p_headers,const String& p_body=String()); Error send_body_text(const String& p_body); Error send_body_data(const ByteArray& p_body); diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index bc6cc0bb83..e10e4413bc 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -272,11 +272,11 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * if (datalen>0) { len-=5*4; ERR_FAIL_COND_V( len < datalen, ERR_INVALID_DATA ); - DVector<uint8_t> data; + PoolVector<uint8_t> data; data.resize(datalen); - DVector<uint8_t>::Write wr = data.write(); + PoolVector<uint8_t>::Write wr = data.write(); copymem(&wr[0],&buf[20],datalen); - wr = DVector<uint8_t>::Write(); + wr = PoolVector<uint8_t>::Write(); @@ -537,17 +537,17 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * ERR_FAIL_COND_V((int)count>len,ERR_INVALID_DATA); - DVector<uint8_t> data; + PoolVector<uint8_t> data; if (count) { data.resize(count); - DVector<uint8_t>::Write w = data.write(); + PoolVector<uint8_t>::Write w = data.write(); for(int i=0;i<count;i++) { w[i]=buf[i]; } - w = DVector<uint8_t>::Write(); + w = PoolVector<uint8_t>::Write(); } r_variant=data; @@ -569,18 +569,18 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * len-=4; ERR_FAIL_COND_V((int)count*4>len,ERR_INVALID_DATA); - DVector<int> data; + PoolVector<int> data; if (count) { //const int*rbuf=(const int*)buf; data.resize(count); - DVector<int>::Write w = data.write(); + PoolVector<int>::Write w = data.write(); for(int i=0;i<count;i++) { w[i]=decode_uint32(&buf[i*4]); } - w = DVector<int>::Write(); + w = PoolVector<int>::Write(); } r_variant=Variant(data); if (r_len) { @@ -596,18 +596,18 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * len-=4; ERR_FAIL_COND_V((int)count*4>len,ERR_INVALID_DATA); - DVector<float> data; + PoolVector<float> data; if (count) { //const float*rbuf=(const float*)buf; data.resize(count); - DVector<float>::Write w = data.write(); + PoolVector<float>::Write w = data.write(); for(int i=0;i<count;i++) { w[i]=decode_float(&buf[i*4]); } - w = DVector<float>::Write(); + w = PoolVector<float>::Write(); } r_variant=data; @@ -623,7 +623,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * uint32_t count = decode_uint32(buf); ERR_FAIL_COND_V(count<0,ERR_INVALID_DATA); - DVector<String> strings; + PoolVector<String> strings; buf+=4; len-=4; @@ -676,7 +676,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * len-=4; ERR_FAIL_COND_V((int)count*4*2>len,ERR_INVALID_DATA); - DVector<Vector2> varray; + PoolVector<Vector2> varray; if (r_len) { (*r_len)+=4; @@ -684,7 +684,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * if (count) { varray.resize(count); - DVector<Vector2>::Write w = varray.write(); + PoolVector<Vector2>::Write w = varray.write(); for(int i=0;i<(int)count;i++) { @@ -714,7 +714,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * len-=4; ERR_FAIL_COND_V((int)count*4*3>len,ERR_INVALID_DATA); - DVector<Vector3> varray; + PoolVector<Vector3> varray; if (r_len) { (*r_len)+=4; @@ -722,7 +722,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * if (count) { varray.resize(count); - DVector<Vector3>::Write w = varray.write(); + PoolVector<Vector3>::Write w = varray.write(); for(int i=0;i<(int)count;i++) { @@ -753,7 +753,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * len-=4; ERR_FAIL_COND_V((int)count*4*4>len,ERR_INVALID_DATA); - DVector<Color> carray; + PoolVector<Color> carray; if (r_len) { (*r_len)+=4; @@ -761,7 +761,7 @@ Error decode_variant(Variant& r_variant,const uint8_t *p_buffer, int p_len,int * if (count) { carray.resize(count); - DVector<Color>::Write w = carray.write(); + PoolVector<Color>::Write w = carray.write(); for(int i=0;i<(int)count;i++) { @@ -1055,7 +1055,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { case Variant::IMAGE: { Image image = p_variant; - DVector<uint8_t> data=image.get_data(); + PoolVector<uint8_t> data=image.get_data(); if (buf) { @@ -1065,7 +1065,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { encode_uint32(image.get_height(),&buf[12]); int ds=data.size(); encode_uint32(ds,&buf[16]); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Read r = data.read(); copymem(&buf[20],&r[0],ds); } @@ -1234,14 +1234,14 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { // arrays case Variant::RAW_ARRAY: { - DVector<uint8_t> data = p_variant; + PoolVector<uint8_t> data = p_variant; int datalen=data.size(); int datasize=sizeof(uint8_t); if (buf) { encode_uint32(datalen,buf); buf+=4; - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Read r = data.read(); copymem(buf,&r[0],datalen*datasize); } @@ -1253,14 +1253,14 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { } break; case Variant::INT_ARRAY: { - DVector<int> data = p_variant; + PoolVector<int> data = p_variant; int datalen=data.size(); int datasize=sizeof(int32_t); if (buf) { encode_uint32(datalen,buf); buf+=4; - DVector<int>::Read r = data.read(); + PoolVector<int>::Read r = data.read(); for(int i=0;i<datalen;i++) encode_uint32(r[i],&buf[i*datasize]); @@ -1271,14 +1271,14 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { } break; case Variant::REAL_ARRAY: { - DVector<real_t> data = p_variant; + PoolVector<real_t> data = p_variant; int datalen=data.size(); int datasize=sizeof(real_t); if (buf) { encode_uint32(datalen,buf); buf+=4; - DVector<real_t>::Read r = data.read(); + PoolVector<real_t>::Read r = data.read(); for(int i=0;i<datalen;i++) encode_float(r[i],&buf[i*datasize]); @@ -1290,7 +1290,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { case Variant::STRING_ARRAY: { - DVector<String> data = p_variant; + PoolVector<String> data = p_variant; int len=data.size(); if (buf) { @@ -1323,7 +1323,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { } break; case Variant::VECTOR2_ARRAY: { - DVector<Vector2> data = p_variant; + PoolVector<Vector2> data = p_variant; int len=data.size(); if (buf) { @@ -1351,7 +1351,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { } break; case Variant::VECTOR3_ARRAY: { - DVector<Vector3> data = p_variant; + PoolVector<Vector3> data = p_variant; int len=data.size(); if (buf) { @@ -1380,7 +1380,7 @@ Error encode_variant(const Variant& p_variant, uint8_t *r_buffer, int &r_len) { } break; case Variant::COLOR_ARRAY: { - DVector<Color> data = p_variant; + PoolVector<Color> data = p_variant; int len=data.size(); if (buf) { diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp index 720e912e71..5ff09f9fb0 100644 --- a/core/io/packet_peer.cpp +++ b/core/io/packet_peer.cpp @@ -39,7 +39,7 @@ PacketPeer::PacketPeer() { last_get_error=OK; } -Error PacketPeer::get_packet_buffer(DVector<uint8_t> &r_buffer) const { +Error PacketPeer::get_packet_buffer(PoolVector<uint8_t> &r_buffer) const { const uint8_t *buffer; int buffer_size; @@ -51,7 +51,7 @@ Error PacketPeer::get_packet_buffer(DVector<uint8_t> &r_buffer) const { if (buffer_size==0) return OK; - DVector<uint8_t>::Write w = r_buffer.write(); + PoolVector<uint8_t>::Write w = r_buffer.write(); for(int i=0;i<buffer_size;i++) w[i]=buffer[i]; @@ -59,13 +59,13 @@ Error PacketPeer::get_packet_buffer(DVector<uint8_t> &r_buffer) const { } -Error PacketPeer::put_packet_buffer(const DVector<uint8_t> &p_buffer) { +Error PacketPeer::put_packet_buffer(const PoolVector<uint8_t> &p_buffer) { int len = p_buffer.size(); if (len==0) return OK; - DVector<uint8_t>::Read r = p_buffer.read(); + PoolVector<uint8_t>::Read r = p_buffer.read(); return put_packet(&r[0],len); } @@ -108,12 +108,12 @@ Variant PacketPeer::_bnd_get_var() const { return var; }; -Error PacketPeer::_put_packet(const DVector<uint8_t> &p_buffer) { +Error PacketPeer::_put_packet(const PoolVector<uint8_t> &p_buffer) { return put_packet_buffer(p_buffer); } -DVector<uint8_t> PacketPeer::_get_packet() const { +PoolVector<uint8_t> PacketPeer::_get_packet() const { - DVector<uint8_t> raw; + PoolVector<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 c67cfb943e..bacd5214f1 100644 --- a/core/io/packet_peer.h +++ b/core/io/packet_peer.h @@ -42,8 +42,8 @@ class PacketPeer : public Reference { static void _bind_methods(); - Error _put_packet(const DVector<uint8_t> &p_buffer); - DVector<uint8_t> _get_packet() const; + Error _put_packet(const PoolVector<uint8_t> &p_buffer); + PoolVector<uint8_t> _get_packet() const; Error _get_packet_error() const; @@ -59,8 +59,8 @@ public: /* helpers / binders */ - virtual Error get_packet_buffer(DVector<uint8_t> &r_buffer) const; - virtual Error put_packet_buffer(const DVector<uint8_t> &p_buffer); + virtual Error get_packet_buffer(PoolVector<uint8_t> &r_buffer) const; + virtual Error put_packet_buffer(const PoolVector<uint8_t> &p_buffer); virtual Error get_var(Variant &r_variant) const; virtual Error put_var(const Variant& p_packet); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 512031b128..2a9089e8e8 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -264,22 +264,22 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) { uint32_t datalen = f->get_32(); - DVector<uint8_t> imgdata; + PoolVector<uint8_t> imgdata; imgdata.resize(datalen); - DVector<uint8_t>::Write w = imgdata.write(); + PoolVector<uint8_t>::Write w = imgdata.write(); f->get_buffer(w.ptr(),datalen); _advance_padding(datalen); - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); r_v=Image(width,height,mipmaps,fmt,imgdata); } else { //compressed - DVector<uint8_t> data; + PoolVector<uint8_t> data; data.resize(f->get_32()); - DVector<uint8_t>::Write w = data.write(); + PoolVector<uint8_t>::Write w = data.write(); f->get_buffer(w.ptr(),data.size()); - w = DVector<uint8_t>::Write(); + w = PoolVector<uint8_t>::Write(); Image img; @@ -448,12 +448,12 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) { uint32_t len = f->get_32(); - DVector<uint8_t> array; + PoolVector<uint8_t> array; array.resize(len); - DVector<uint8_t>::Write w = array.write(); + PoolVector<uint8_t>::Write w = array.write(); f->get_buffer(w.ptr(),len); _advance_padding(len); - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); r_v=array; } break; @@ -461,9 +461,9 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) { uint32_t len = f->get_32(); - DVector<int> array; + PoolVector<int> array; array.resize(len); - DVector<int>::Write w = array.write(); + PoolVector<int>::Write w = array.write(); f->get_buffer((uint8_t*)w.ptr(),len*4); #ifdef BIG_ENDIAN_ENABLED { @@ -475,16 +475,16 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) { } #endif - w=DVector<int>::Write(); + w=PoolVector<int>::Write(); r_v=array; } break; case VARIANT_REAL_ARRAY: { uint32_t len = f->get_32(); - DVector<real_t> array; + PoolVector<real_t> array; array.resize(len); - DVector<real_t>::Write w = array.write(); + PoolVector<real_t>::Write w = array.write(); f->get_buffer((uint8_t*)w.ptr(),len*sizeof(real_t)); #ifdef BIG_ENDIAN_ENABLED { @@ -497,18 +497,18 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) { #endif - w=DVector<real_t>::Write(); + w=PoolVector<real_t>::Write(); r_v=array; } break; case VARIANT_STRING_ARRAY: { uint32_t len = f->get_32(); - DVector<String> array; + PoolVector<String> array; array.resize(len); - DVector<String>::Write w = array.write(); + PoolVector<String>::Write w = array.write(); for(uint32_t i=0;i<len;i++) w[i]=get_unicode_string(); - w=DVector<String>::Write(); + w=PoolVector<String>::Write(); r_v=array; @@ -517,9 +517,9 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) { uint32_t len = f->get_32(); - DVector<Vector2> array; + PoolVector<Vector2> array; array.resize(len); - DVector<Vector2>::Write w = array.write(); + PoolVector<Vector2>::Write w = array.write(); if (sizeof(Vector2)==8) { f->get_buffer((uint8_t*)w.ptr(),len*sizeof(real_t)*2); #ifdef BIG_ENDIAN_ENABLED @@ -537,7 +537,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) { ERR_EXPLAIN("Vector2 size is NOT 8!"); ERR_FAIL_V(ERR_UNAVAILABLE); } - w=DVector<Vector2>::Write(); + w=PoolVector<Vector2>::Write(); r_v=array; } break; @@ -545,9 +545,9 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) { uint32_t len = f->get_32(); - DVector<Vector3> array; + PoolVector<Vector3> array; array.resize(len); - DVector<Vector3>::Write w = array.write(); + PoolVector<Vector3>::Write w = array.write(); if (sizeof(Vector3)==12) { f->get_buffer((uint8_t*)w.ptr(),len*sizeof(real_t)*3); #ifdef BIG_ENDIAN_ENABLED @@ -565,7 +565,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) { ERR_EXPLAIN("Vector3 size is NOT 12!"); ERR_FAIL_V(ERR_UNAVAILABLE); } - w=DVector<Vector3>::Write(); + w=PoolVector<Vector3>::Write(); r_v=array; } break; @@ -573,9 +573,9 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) { uint32_t len = f->get_32(); - DVector<Color> array; + PoolVector<Color> array; array.resize(len); - DVector<Color>::Write w = array.write(); + PoolVector<Color>::Write w = array.write(); if (sizeof(Color)==16) { f->get_buffer((uint8_t*)w.ptr(),len*sizeof(real_t)*4); #ifdef BIG_ENDIAN_ENABLED @@ -593,7 +593,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) { ERR_EXPLAIN("Color size is NOT 16!"); ERR_FAIL_V(ERR_UNAVAILABLE); } - w=DVector<Color>::Write(); + w=PoolVector<Color>::Write(); r_v=array; } break; @@ -1587,12 +1587,12 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, int dlen = val.get_data().size(); f->store_32(dlen); - DVector<uint8_t>::Read r = val.get_data().read(); + PoolVector<uint8_t>::Read r = val.get_data().read(); f->store_buffer(r.ptr(),dlen); _pad_buffer(dlen); } else { - DVector<uint8_t> data; + PoolVector<uint8_t> data; if (encoding==IMAGE_ENCODING_LOSSY) { data=Image::lossy_packer(val,quality); @@ -1604,7 +1604,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, int ds=data.size(); f->store_32(ds); if (ds>0) { - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Read r = data.read(); f->store_buffer(r.ptr(),ds); _pad_buffer(ds); @@ -1703,10 +1703,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, case Variant::RAW_ARRAY: { f->store_32(VARIANT_RAW_ARRAY); - DVector<uint8_t> arr = p_property; + PoolVector<uint8_t> arr = p_property; int len=arr.size(); f->store_32(len); - DVector<uint8_t>::Read r = arr.read(); + PoolVector<uint8_t>::Read r = arr.read(); f->store_buffer(r.ptr(),len); _pad_buffer(len); @@ -1714,10 +1714,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, case Variant::INT_ARRAY: { f->store_32(VARIANT_INT_ARRAY); - DVector<int> arr = p_property; + PoolVector<int> arr = p_property; int len=arr.size(); f->store_32(len); - DVector<int>::Read r = arr.read(); + PoolVector<int>::Read r = arr.read(); for(int i=0;i<len;i++) f->store_32(r[i]); @@ -1725,10 +1725,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, case Variant::REAL_ARRAY: { f->store_32(VARIANT_REAL_ARRAY); - DVector<real_t> arr = p_property; + PoolVector<real_t> arr = p_property; int len=arr.size(); f->store_32(len); - DVector<real_t>::Read r = arr.read(); + PoolVector<real_t>::Read r = arr.read(); for(int i=0;i<len;i++) { f->store_real(r[i]); } @@ -1737,10 +1737,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, case Variant::STRING_ARRAY: { f->store_32(VARIANT_STRING_ARRAY); - DVector<String> arr = p_property; + PoolVector<String> arr = p_property; int len=arr.size(); f->store_32(len); - DVector<String>::Read r = arr.read(); + PoolVector<String>::Read r = arr.read(); for(int i=0;i<len;i++) { save_unicode_string(r[i]); } @@ -1749,10 +1749,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, case Variant::VECTOR3_ARRAY: { f->store_32(VARIANT_VECTOR3_ARRAY); - DVector<Vector3> arr = p_property; + PoolVector<Vector3> arr = p_property; int len=arr.size(); f->store_32(len); - DVector<Vector3>::Read r = arr.read(); + PoolVector<Vector3>::Read r = arr.read(); for(int i=0;i<len;i++) { f->store_real(r[i].x); f->store_real(r[i].y); @@ -1763,10 +1763,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, case Variant::VECTOR2_ARRAY: { f->store_32(VARIANT_VECTOR2_ARRAY); - DVector<Vector2> arr = p_property; + PoolVector<Vector2> arr = p_property; int len=arr.size(); f->store_32(len); - DVector<Vector2>::Read r = arr.read(); + PoolVector<Vector2>::Read r = arr.read(); for(int i=0;i<len;i++) { f->store_real(r[i].x); f->store_real(r[i].y); @@ -1776,10 +1776,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property, case Variant::COLOR_ARRAY: { f->store_32(VARIANT_COLOR_ARRAY); - DVector<Color> arr = p_property; + PoolVector<Color> arr = p_property; int len=arr.size(); f->store_32(len); - DVector<Color>::Read r = arr.read(); + PoolVector<Color>::Read r = arr.read(); 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_format_xml.cpp b/core/io/resource_format_xml.cpp index d4808d4741..34e3f282c1 100644 --- a/core/io/resource_format_xml.cpp +++ b/core/io/resource_format_xml.cpp @@ -623,9 +623,9 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) return OK; }; - DVector<uint8_t> pixels; + PoolVector<uint8_t> pixels; pixels.resize(datasize); - DVector<uint8_t>::Write wb = pixels.write(); + PoolVector<uint8_t>::Write wb = pixels.write(); int idx=0; uint8_t byte; @@ -652,7 +652,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) } ERR_FAIL_COND_V(f->eof_reached(),ERR_FILE_CORRUPT); - wb=DVector<uint8_t>::Write(); + wb=PoolVector<uint8_t>::Write(); r_v=Image(w,h,mipmaps,imgformat,pixels); String sdfsdfg; @@ -672,9 +672,9 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) } int len=tag->args["len"].to_int(); - DVector<uint8_t> bytes; + PoolVector<uint8_t> bytes; bytes.resize(len); - DVector<uint8_t>::Write w=bytes.write(); + PoolVector<uint8_t>::Write w=bytes.write(); uint8_t *bytesptr=w.ptr(); int idx=0; uint8_t byte; @@ -700,7 +700,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) ERR_FAIL_COND_V(f->eof_reached(),ERR_FILE_CORRUPT); - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); r_v=bytes; String sdfsdfg; Error err=parse_property_data(sdfsdfg); @@ -717,9 +717,9 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) } int len=tag->args["len"].to_int(); - DVector<int> ints; + PoolVector<int> ints; ints.resize(len); - DVector<int>::Write w=ints.write(); + PoolVector<int>::Write w=ints.write(); int *intsptr=w.ptr(); int idx=0; String str; @@ -770,7 +770,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) } #endif - w=DVector<int>::Write(); + w=PoolVector<int>::Write(); r_v=ints; Error err=goto_end_of_tag(); @@ -786,9 +786,9 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) } int len=tag->args["len"].to_int();; - DVector<real_t> reals; + PoolVector<real_t> reals; reals.resize(len); - DVector<real_t>::Write w=reals.write(); + PoolVector<real_t>::Write w=reals.write(); real_t *realsptr=w.ptr(); int idx=0; String str; @@ -845,7 +845,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) #endif - w=DVector<real_t>::Write(); + w=PoolVector<real_t>::Write(); r_v=reals; Error err=goto_end_of_tag(); @@ -861,9 +861,9 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) } int len=tag->args["len"].to_int(); - DVector<String> strings; + PoolVector<String> strings; strings.resize(len); - DVector<String>::Write w=strings.write(); + PoolVector<String>::Write w=strings.write(); String *stringsptr=w.ptr(); int idx=0; String str; @@ -903,7 +903,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) cs.push_back(c); } } - w=DVector<String>::Write(); + w=PoolVector<String>::Write(); r_v=strings; String sdfsdfg; Error err=parse_property_data(sdfsdfg); @@ -923,7 +923,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) StringArray array; array.resize(len); - DVector<String>::Write w = array.write(); + PoolVector<String>::Write w = array.write(); Error err; Variant v; @@ -964,9 +964,9 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) } int len=tag->args["len"].to_int();; - DVector<Vector3> vectors; + PoolVector<Vector3> vectors; vectors.resize(len); - DVector<Vector3>::Write w=vectors.write(); + PoolVector<Vector3>::Write w=vectors.write(); Vector3 *vectorsptr=w.ptr(); int idx=0; int subidx=0; @@ -1041,7 +1041,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) // double time_taken = (OS::get_singleton()->get_ticks_usec() - tbegin)/1000000.0; - w=DVector<Vector3>::Write(); + w=PoolVector<Vector3>::Write(); r_v=vectors; String sdfsdfg; Error err=goto_end_of_tag(); @@ -1058,9 +1058,9 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) } int len=tag->args["len"].to_int();; - DVector<Vector2> vectors; + PoolVector<Vector2> vectors; vectors.resize(len); - DVector<Vector2>::Write w=vectors.write(); + PoolVector<Vector2>::Write w=vectors.write(); Vector2 *vectorsptr=w.ptr(); int idx=0; int subidx=0; @@ -1135,7 +1135,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) // double time_taken = (OS::get_singleton()->get_ticks_usec() - tbegin)/1000000.0; - w=DVector<Vector2>::Write(); + w=PoolVector<Vector2>::Write(); r_v=vectors; String sdfsdfg; Error err=goto_end_of_tag(); @@ -1152,9 +1152,9 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) } int len=tag->args["len"].to_int();; - DVector<Color> colors; + PoolVector<Color> colors; colors.resize(len); - DVector<Color>::Write w=colors.write(); + PoolVector<Color>::Write w=colors.write(); Color *colorsptr=w.ptr(); int idx=0; int subidx=0; @@ -1194,7 +1194,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) str+=c; } } - w=DVector<Color>::Write(); + w=PoolVector<Color>::Write(); r_v=colors; String sdfsdfg; Error err=parse_property_data(sdfsdfg); @@ -2248,13 +2248,13 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V case Variant::DICTIONARY: type="dictionary"; params="shared=\""+String(p_property.is_shared()?"true":"false")+"\""; oneliner=false; break; case Variant::ARRAY: type="array"; params="len=\""+itos(p_property.operator Array().size())+"\" shared=\""+String(p_property.is_shared()?"true":"false")+"\""; oneliner=false; break; - case Variant::RAW_ARRAY: type="raw_array"; params="len=\""+itos(p_property.operator DVector < uint8_t >().size())+"\""; break; - case Variant::INT_ARRAY: type="int_array"; params="len=\""+itos(p_property.operator DVector < int >().size())+"\""; break; - case Variant::REAL_ARRAY: type="real_array"; params="len=\""+itos(p_property.operator DVector < real_t >().size())+"\""; break; - case Variant::STRING_ARRAY: oneliner=false; type="string_array"; params="len=\""+itos(p_property.operator DVector < String >().size())+"\""; break; - case Variant::VECTOR2_ARRAY: type="vector2_array"; params="len=\""+itos(p_property.operator DVector < Vector2 >().size())+"\""; break; - case Variant::VECTOR3_ARRAY: type="vector3_array"; params="len=\""+itos(p_property.operator DVector < Vector3 >().size())+"\""; break; - case Variant::COLOR_ARRAY: type="color_array"; params="len=\""+itos(p_property.operator DVector < Color >().size())+"\""; break; + case Variant::RAW_ARRAY: type="raw_array"; params="len=\""+itos(p_property.operator PoolVector < uint8_t >().size())+"\""; break; + case Variant::INT_ARRAY: type="int_array"; params="len=\""+itos(p_property.operator PoolVector < int >().size())+"\""; break; + case Variant::REAL_ARRAY: type="real_array"; params="len=\""+itos(p_property.operator PoolVector < real_t >().size())+"\""; break; + case Variant::STRING_ARRAY: oneliner=false; type="string_array"; params="len=\""+itos(p_property.operator PoolVector < String >().size())+"\""; break; + case Variant::VECTOR2_ARRAY: type="vector2_array"; params="len=\""+itos(p_property.operator PoolVector < Vector2 >().size())+"\""; break; + case Variant::VECTOR3_ARRAY: type="vector3_array"; params="len=\""+itos(p_property.operator PoolVector < Vector3 >().size())+"\""; break; + case Variant::COLOR_ARRAY: type="color_array"; params="len=\""+itos(p_property.operator PoolVector < Color >().size())+"\""; break; default: { ERR_PRINT("Unknown Variant type."); @@ -2403,9 +2403,9 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V String s; Image img = p_property; - DVector<uint8_t> data = img.get_data(); + PoolVector<uint8_t> data = img.get_data(); int len = data.size(); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Read r = data.read(); const uint8_t *ptr=r.ptr();; for (int i=0;i<len;i++) { @@ -2487,9 +2487,9 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V case Variant::RAW_ARRAY: { String s; - DVector<uint8_t> data = p_property; + PoolVector<uint8_t> data = p_property; int len = data.size(); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Read r = data.read(); const uint8_t *ptr=r.ptr();; for (int i=0;i<len;i++) { @@ -2504,9 +2504,9 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V } break; case Variant::INT_ARRAY: { - DVector<int> data = p_property; + PoolVector<int> data = p_property; int len = data.size(); - DVector<int>::Read r = data.read(); + PoolVector<int>::Read r = data.read(); const int *ptr=r.ptr();; write_tabs(); @@ -2523,9 +2523,9 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V } break; case Variant::REAL_ARRAY: { - DVector<real_t> data = p_property; + PoolVector<real_t> data = p_property; int len = data.size(); - DVector<real_t>::Read r = data.read(); + PoolVector<real_t>::Read r = data.read(); const real_t *ptr=r.ptr();; write_tabs(); String cm=", " ; @@ -2541,9 +2541,9 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V } break; case Variant::STRING_ARRAY: { - DVector<String> data = p_property; + PoolVector<String> data = p_property; int len = data.size(); - DVector<String>::Read r = data.read(); + PoolVector<String>::Read r = data.read(); const String *ptr=r.ptr();; String s; //write_string("\n"); @@ -2560,9 +2560,9 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V } break; case Variant::VECTOR2_ARRAY: { - DVector<Vector2> data = p_property; + PoolVector<Vector2> data = p_property; int len = data.size(); - DVector<Vector2>::Read r = data.read(); + PoolVector<Vector2>::Read r = data.read(); const Vector2 *ptr=r.ptr();; write_tabs(); @@ -2579,9 +2579,9 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V } break; case Variant::VECTOR3_ARRAY: { - DVector<Vector3> data = p_property; + PoolVector<Vector3> data = p_property; int len = data.size(); - DVector<Vector3>::Read r = data.read(); + PoolVector<Vector3>::Read r = data.read(); const Vector3 *ptr=r.ptr();; write_tabs(); @@ -2599,9 +2599,9 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V } break; case Variant::COLOR_ARRAY: { - DVector<Color> data = p_property; + PoolVector<Color> data = p_property; int len = data.size(); - DVector<Color>::Read r = data.read(); + PoolVector<Color>::Read r = data.read(); const Color *ptr=r.ptr();; write_tabs(); diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp index 218e17278e..a2812edb81 100644 --- a/core/io/stream_peer.cpp +++ b/core/io/stream_peer.cpp @@ -29,16 +29,16 @@ #include "stream_peer.h" #include "io/marshalls.h" -Error StreamPeer::_put_data(const DVector<uint8_t>& p_data) { +Error StreamPeer::_put_data(const PoolVector<uint8_t>& p_data) { int len = p_data.size(); if (len==0) return OK; - DVector<uint8_t>::Read r = p_data.read(); + PoolVector<uint8_t>::Read r = p_data.read(); return put_data(&r[0],len); } -Array StreamPeer::_put_partial_data(const DVector<uint8_t>& p_data) { +Array StreamPeer::_put_partial_data(const PoolVector<uint8_t>& p_data) { Array ret; @@ -49,7 +49,7 @@ Array StreamPeer::_put_partial_data(const DVector<uint8_t>& p_data) { return ret; } - DVector<uint8_t>::Read r = p_data.read(); + PoolVector<uint8_t>::Read r = p_data.read(); int sent; Error err = put_partial_data(&r[0],len,sent); @@ -66,18 +66,18 @@ Array StreamPeer::_get_data(int p_bytes) { Array ret; - DVector<uint8_t> data; + PoolVector<uint8_t> data; data.resize(p_bytes); if (data.size()!=p_bytes) { ret.push_back(ERR_OUT_OF_MEMORY); - ret.push_back(DVector<uint8_t>()); + ret.push_back(PoolVector<uint8_t>()); return ret; } - DVector<uint8_t>::Write w = data.write(); + PoolVector<uint8_t>::Write w = data.write(); Error err = get_data(&w[0],p_bytes); - w = DVector<uint8_t>::Write(); + w = PoolVector<uint8_t>::Write(); ret.push_back(err); ret.push_back(data); return ret; @@ -88,19 +88,19 @@ Array StreamPeer::_get_partial_data(int p_bytes) { Array ret; - DVector<uint8_t> data; + PoolVector<uint8_t> data; data.resize(p_bytes); if (data.size()!=p_bytes) { ret.push_back(ERR_OUT_OF_MEMORY); - ret.push_back(DVector<uint8_t>()); + ret.push_back(PoolVector<uint8_t>()); return ret; } - DVector<uint8_t>::Write w = data.write(); + PoolVector<uint8_t>::Write w = data.write(); int received; Error err = get_partial_data(&w[0],p_bytes,received); - w = DVector<uint8_t>::Write(); + w = PoolVector<uint8_t>::Write(); if (err!=OK) { data.resize(0); @@ -454,7 +454,7 @@ Error StreamPeerBuffer::put_data(const uint8_t* p_data,int p_bytes) { } - DVector<uint8_t>::Write w = data.write(); + PoolVector<uint8_t>::Write w = data.write(); copymem(&w[pointer],p_data,p_bytes); pointer+=p_bytes; @@ -490,7 +490,7 @@ Error StreamPeerBuffer::get_partial_data(uint8_t* p_buffer, int p_bytes,int &r_r r_received=p_bytes; } - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Read r = data.read(); copymem(p_buffer,r.ptr(),r_received); } @@ -520,13 +520,13 @@ void StreamPeerBuffer::resize(int p_size){ data.resize(p_size); } -void StreamPeerBuffer::set_data_array(const DVector<uint8_t> & p_data){ +void StreamPeerBuffer::set_data_array(const PoolVector<uint8_t> & p_data){ data=p_data; pointer=0; } -DVector<uint8_t> StreamPeerBuffer::get_data_array() const{ +PoolVector<uint8_t> StreamPeerBuffer::get_data_array() const{ return data; } diff --git a/core/io/stream_peer.h b/core/io/stream_peer.h index 232a908dd7..eb0f90ba50 100644 --- a/core/io/stream_peer.h +++ b/core/io/stream_peer.h @@ -38,8 +38,8 @@ protected: static void _bind_methods(); //bind helpers - Error _put_data(const DVector<uint8_t>& p_data); - Array _put_partial_data(const DVector<uint8_t>& p_data); + Error _put_data(const PoolVector<uint8_t>& p_data); + Array _put_partial_data(const PoolVector<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); - DVector<uint8_t> data; + PoolVector<uint8_t> data; int pointer; protected: @@ -116,8 +116,8 @@ public: void resize(int p_size); - void set_data_array(const DVector<uint8_t> & p_data); - DVector<uint8_t> get_data_array() const; + void set_data_array(const PoolVector<uint8_t> & p_data); + PoolVector<uint8_t> get_data_array() const; void clear(); diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp index 751dfbadca..bfa5dce58f 100644 --- a/core/io/tcp_server.cpp +++ b/core/io/tcp_server.cpp @@ -44,7 +44,7 @@ TCP_Server* TCP_Server::create() { return _create(); } -Error TCP_Server::_listen(uint16_t p_port, DVector<String> p_accepted_hosts) { +Error TCP_Server::_listen(uint16_t p_port, PoolVector<String> p_accepted_hosts) { List<String> hosts; for(int i=0;i<p_accepted_hosts.size();i++) @@ -62,7 +62,7 @@ void TCP_Server::set_ip_type(IP::Type p_type) { void TCP_Server::_bind_methods() { ClassDB::bind_method(_MD("set_ip_type","ip_type"),&TCP_Server::set_ip_type); - ClassDB::bind_method(_MD("listen","port","accepted_hosts"),&TCP_Server::_listen,DEFVAL(DVector<String>())); + ClassDB::bind_method(_MD("listen","port","accepted_hosts"),&TCP_Server::_listen,DEFVAL(PoolVector<String>())); ClassDB::bind_method(_MD("is_connection_available"),&TCP_Server::is_connection_available); ClassDB::bind_method(_MD("take_connection"),&TCP_Server::take_connection); ClassDB::bind_method(_MD("stop"),&TCP_Server::stop); diff --git a/core/io/tcp_server.h b/core/io/tcp_server.h index 5fd65575f6..3d7b3ddd8d 100644 --- a/core/io/tcp_server.h +++ b/core/io/tcp_server.h @@ -43,7 +43,7 @@ protected: static TCP_Server* (*_create)(); //bind helper - Error _listen(uint16_t p_port, DVector<String> p_accepted_hosts=DVector<String>()); + Error _listen(uint16_t p_port, PoolVector<String> p_accepted_hosts=PoolVector<String>()); static void _bind_methods(); public: diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index 29f61834b4..0d6997183f 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -295,10 +295,10 @@ bool AStar::_solve(Point* begin_point, Point* end_point) { } -DVector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) { +PoolVector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) { - ERR_FAIL_COND_V(!points.has(p_from_id),DVector<Vector3>()); - ERR_FAIL_COND_V(!points.has(p_to_id),DVector<Vector3>()); + ERR_FAIL_COND_V(!points.has(p_from_id),PoolVector<Vector3>()); + ERR_FAIL_COND_V(!points.has(p_to_id),PoolVector<Vector3>()); pass++; @@ -307,7 +307,7 @@ DVector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) { Point* b = points[p_to_id]; if (a==b) { - DVector<Vector3> ret; + PoolVector<Vector3> ret; ret.push_back(a->pos); return ret; } @@ -319,7 +319,7 @@ DVector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) { bool found_route=_solve(begin_point,end_point); if (!found_route) - return DVector<Vector3>(); + return PoolVector<Vector3>(); //midpoints Point *p=end_point; @@ -329,11 +329,11 @@ DVector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) { p=p->prev_point; } - DVector<Vector3> path; + PoolVector<Vector3> path; path.resize(pc); { - DVector<Vector3>::Write w = path.write(); + PoolVector<Vector3>::Write w = path.write(); Point *p=end_point; int idx=pc-1; @@ -351,10 +351,10 @@ DVector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) { } -DVector<int> AStar::get_id_path(int p_from_id, int p_to_id) { +PoolVector<int> AStar::get_id_path(int p_from_id, int p_to_id) { - ERR_FAIL_COND_V(!points.has(p_from_id),DVector<int>()); - ERR_FAIL_COND_V(!points.has(p_to_id),DVector<int>()); + ERR_FAIL_COND_V(!points.has(p_from_id),PoolVector<int>()); + ERR_FAIL_COND_V(!points.has(p_to_id),PoolVector<int>()); pass++; @@ -363,7 +363,7 @@ DVector<int> AStar::get_id_path(int p_from_id, int p_to_id) { Point* b = points[p_to_id]; if (a==b) { - DVector<int> ret; + PoolVector<int> ret; ret.push_back(a->id); return ret; } @@ -375,7 +375,7 @@ DVector<int> AStar::get_id_path(int p_from_id, int p_to_id) { bool found_route=_solve(begin_point,end_point); if (!found_route) - return DVector<int>(); + return PoolVector<int>(); //midpoints Point *p=end_point; @@ -385,11 +385,11 @@ DVector<int> AStar::get_id_path(int p_from_id, int p_to_id) { p=p->prev_point; } - DVector<int> path; + PoolVector<int> path; path.resize(pc); { - DVector<int>::Write w = path.write(); + PoolVector<int>::Write w = path.write(); p=end_point; int idx=pc-1; diff --git a/core/math/a_star.h b/core/math/a_star.h index 66a983a6ce..35e6ead226 100644 --- a/core/math/a_star.h +++ b/core/math/a_star.h @@ -113,8 +113,8 @@ public: int get_closest_point(const Vector3& p_point) const; Vector3 get_closest_pos_in_segment(const Vector3& p_point) const; - DVector<Vector3> get_point_path(int p_from_id, int p_to_id); - DVector<int> get_id_path(int p_from_id, int p_to_id); + 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); AStar(); ~AStar(); diff --git a/core/math/bsp_tree.cpp b/core/math/bsp_tree.cpp index 5242abfa3b..b7194d7ffb 100644 --- a/core/math/bsp_tree.cpp +++ b/core/math/bsp_tree.cpp @@ -484,7 +484,7 @@ BSP_Tree::operator Variant() const { d["planes"]=plane_values; - DVector<int> dst_nodes; + PoolVector<int> dst_nodes; dst_nodes.resize(nodes.size()*3); for(int i=0;i<nodes.size();i++) { @@ -514,19 +514,19 @@ BSP_Tree::BSP_Tree(const Variant& p_variant) { ERR_FAIL_COND(!d.has("aabb")); ERR_FAIL_COND(!d.has("error_radius")); - DVector<int> src_nodes = d["nodes"]; + PoolVector<int> src_nodes = d["nodes"]; ERR_FAIL_COND(src_nodes.size()%3); if (d["planes"].get_type()==Variant::REAL_ARRAY) { - DVector<float> src_planes=d["planes"]; + PoolVector<float> src_planes=d["planes"]; int plane_count=src_planes.size(); ERR_FAIL_COND(plane_count%4); planes.resize(plane_count/4); if (plane_count) { - DVector<float>::Read r = src_planes.read(); + PoolVector<float>::Read r = src_planes.read(); for(int i=0;i<plane_count/4;i++) { planes[i].normal.x=r[i*4+0]; @@ -549,7 +549,7 @@ BSP_Tree::BSP_Tree(const Variant& p_variant) { // int node_count = src_nodes.size(); nodes.resize(src_nodes.size()/3); - DVector<int>::Read r = src_nodes.read(); + PoolVector<int>::Read r = src_nodes.read(); for(int i=0;i<nodes.size();i++) { @@ -560,12 +560,12 @@ BSP_Tree::BSP_Tree(const Variant& p_variant) { } -BSP_Tree::BSP_Tree(const DVector<Face3>& p_faces,float p_error_radius) { +BSP_Tree::BSP_Tree(const PoolVector<Face3>& p_faces,float p_error_radius) { // compute aabb int face_count=p_faces.size(); - DVector<Face3>::Read faces_r=p_faces.read(); + PoolVector<Face3>::Read faces_r=p_faces.read(); const Face3 *facesptr = faces_r.ptr(); diff --git a/core/math/bsp_tree.h b/core/math/bsp_tree.h index 3913e3d34a..236b6e5ac2 100644 --- a/core/math/bsp_tree.h +++ b/core/math/bsp_tree.h @@ -91,7 +91,7 @@ public: BSP_Tree(); BSP_Tree(const Variant& p_variant); - BSP_Tree(const DVector<Face3>& p_faces,float p_error_radius=0); + BSP_Tree(const PoolVector<Face3>& p_faces,float p_error_radius=0); BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const AABB& p_aabb,float p_error_radius=0); ~BSP_Tree(); diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp index 91f7cf179a..3232d36262 100644 --- a/core/math/geometry.cpp +++ b/core/math/geometry.cpp @@ -204,21 +204,21 @@ static bool _group_face(_FaceClassify *p_faces, int len, int p_index,int p_group } -DVector< DVector< Face3 > > Geometry::separate_objects( DVector< Face3 > p_array ) { +PoolVector< PoolVector< Face3 > > Geometry::separate_objects( PoolVector< Face3 > p_array ) { - DVector< DVector< Face3 > > objects; + PoolVector< PoolVector< Face3 > > objects; int len = p_array.size(); - DVector<Face3>::Read r=p_array.read(); + PoolVector<Face3>::Read r=p_array.read(); const Face3* arrayptr = r.ptr(); - DVector< _FaceClassify> fc; + PoolVector< _FaceClassify> fc; fc.resize( len ); - DVector< _FaceClassify >::Write fcw=fc.write(); + PoolVector< _FaceClassify >::Write fcw=fc.write(); _FaceClassify * _fcptr = fcw.ptr(); @@ -231,7 +231,7 @@ DVector< DVector< Face3 > > Geometry::separate_objects( DVector< Face3 > p_array if (error) { - ERR_FAIL_COND_V(error, DVector< DVector< Face3 > >() ); // invalid geometry + ERR_FAIL_COND_V(error, PoolVector< PoolVector< Face3 > >() ); // invalid geometry } /* group connected faces in separate objects */ @@ -257,8 +257,8 @@ DVector< DVector< Face3 > > Geometry::separate_objects( DVector< Face3 > p_array if (group>=0) { objects.resize(group); - DVector< DVector<Face3> >::Write obw=objects.write(); - DVector< Face3 > *group_faces = obw.ptr(); + PoolVector< PoolVector<Face3> >::Write obw=objects.write(); + PoolVector< Face3 > *group_faces = obw.ptr(); for (int i=0;i<len;i++) { if (!_fcptr[i].valid) @@ -487,7 +487,7 @@ static inline void _mark_outside(uint8_t*** p_cell_status,int x,int y,int z,int } } -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,DVector<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,PoolVector<Face3>& p_faces) { ERR_FAIL_INDEX(x,len_x); ERR_FAIL_INDEX(y,len_y); @@ -580,13 +580,13 @@ static inline void _build_faces(uint8_t*** p_cell_status,int x,int y,int z,int l } -DVector< Face3 > Geometry::wrap_geometry( DVector< Face3 > p_array,float *p_error ) { +PoolVector< Face3 > Geometry::wrap_geometry( PoolVector< Face3 > p_array,float *p_error ) { #define _MIN_SIZE 1.0 #define _MAX_LENGTH 20 int face_count=p_array.size(); - DVector<Face3>::Read facesr=p_array.read(); + PoolVector<Face3>::Read facesr=p_array.read(); const Face3 *faces = facesr.ptr(); AABB global_aabb; @@ -696,7 +696,7 @@ DVector< Face3 > Geometry::wrap_geometry( DVector< Face3 > p_array,float *p_erro //print_line("Wrapper (3/6): Building Faces"); - DVector<Face3> wrapped_faces; + PoolVector<Face3> wrapped_faces; for (int i=0;i<div_x;i++) { @@ -714,7 +714,7 @@ DVector< Face3 > Geometry::wrap_geometry( DVector< Face3 > p_array,float *p_erro // transform face vertices to global coords int wrapped_faces_count=wrapped_faces.size(); - DVector<Face3>::Write wrapped_facesw=wrapped_faces.write(); + PoolVector<Face3>::Write wrapped_facesw=wrapped_faces.write(); Face3* wrapped_faces_ptr=wrapped_facesw.ptr(); for(int i=0;i<wrapped_faces_count;i++) { @@ -748,7 +748,7 @@ DVector< Face3 > Geometry::wrap_geometry( DVector< Face3 > p_array,float *p_erro return wrapped_faces; } -Geometry::MeshData Geometry::build_convex_mesh(const DVector<Plane> &p_planes) { +Geometry::MeshData Geometry::build_convex_mesh(const PoolVector<Plane> &p_planes) { MeshData mesh; @@ -896,9 +896,9 @@ Geometry::MeshData Geometry::build_convex_mesh(const DVector<Plane> &p_planes) { } -DVector<Plane> Geometry::build_box_planes(const Vector3& p_extents) { +PoolVector<Plane> Geometry::build_box_planes(const Vector3& p_extents) { - DVector<Plane> planes; + PoolVector<Plane> planes; planes.push_back( Plane( Vector3(1,0,0), p_extents.x ) ); planes.push_back( Plane( Vector3(-1,0,0), p_extents.x ) ); @@ -910,9 +910,9 @@ DVector<Plane> Geometry::build_box_planes(const Vector3& p_extents) { return planes; } -DVector<Plane> Geometry::build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis) { +PoolVector<Plane> Geometry::build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis) { - DVector<Plane> planes; + PoolVector<Plane> planes; for (int i=0;i<p_sides;i++) { @@ -933,10 +933,10 @@ DVector<Plane> Geometry::build_cylinder_planes(float p_radius, float p_height, i } -DVector<Plane> Geometry::build_sphere_planes(float p_radius, int p_lats,int p_lons, Vector3::Axis p_axis) { +PoolVector<Plane> Geometry::build_sphere_planes(float p_radius, int p_lats,int p_lons, Vector3::Axis p_axis) { - DVector<Plane> planes; + PoolVector<Plane> planes; Vector3 axis; axis[p_axis]=1.0; @@ -969,9 +969,9 @@ DVector<Plane> Geometry::build_sphere_planes(float p_radius, int p_lats,int p_lo } -DVector<Plane> Geometry::build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis) { +PoolVector<Plane> Geometry::build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis) { - DVector<Plane> planes; + PoolVector<Plane> planes; Vector3 axis; axis[p_axis]=1.0; diff --git a/core/math/geometry.h b/core/math/geometry.h index dae556cd09..9800e5513c 100644 --- a/core/math/geometry.h +++ b/core/math/geometry.h @@ -808,9 +808,9 @@ public: } - static DVector< DVector< Face3 > > separate_objects( DVector< Face3 > p_array ); + static PoolVector< PoolVector< Face3 > > separate_objects( PoolVector< Face3 > p_array ); - static DVector< Face3 > wrap_geometry( DVector< Face3 > p_array, float *p_error=NULL ); ///< create a "wrap" that encloses the given geometry + static PoolVector< Face3 > wrap_geometry( PoolVector< Face3 > p_array, float *p_error=NULL ); ///< create a "wrap" that encloses the given geometry struct MeshData { @@ -919,11 +919,11 @@ public: return H; } - static MeshData build_convex_mesh(const DVector<Plane> &p_planes); - static DVector<Plane> build_sphere_planes(float p_radius, int p_lats, int p_lons, Vector3::Axis p_axis=Vector3::AXIS_Z); - static DVector<Plane> build_box_planes(const Vector3& p_extents); - static DVector<Plane> build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis=Vector3::AXIS_Z); - static DVector<Plane> build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis=Vector3::AXIS_Z); + static MeshData build_convex_mesh(const PoolVector<Plane> &p_planes); + static PoolVector<Plane> build_sphere_planes(float 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(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis=Vector3::AXIS_Z); + static PoolVector<Plane> build_capsule_planes(float p_radius, float 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/triangle_mesh.cpp b/core/math/triangle_mesh.cpp index b3daee0c7e..101e164eae 100644 --- a/core/math/triangle_mesh.cpp +++ b/core/math/triangle_mesh.cpp @@ -94,7 +94,7 @@ int TriangleMesh::_create_bvh(BVH*p_bvh,BVH** p_bb,int p_from,int p_size,int p_d } -void TriangleMesh::create(const DVector<Vector3>& p_faces) { +void TriangleMesh::create(const PoolVector<Vector3>& p_faces) { valid=false; @@ -104,7 +104,7 @@ void TriangleMesh::create(const DVector<Vector3>& p_faces) { triangles.resize(fc); bvh.resize(fc*3); //will never be larger than this (todo make better) - DVector<BVH>::Write bw = bvh.write(); + PoolVector<BVH>::Write bw = bvh.write(); { @@ -112,8 +112,8 @@ void TriangleMesh::create(const DVector<Vector3>& p_faces) { //except for the Set for repeated triangles, everything //goes in-place. - DVector<Vector3>::Read r = p_faces.read(); - DVector<Triangle>::Write w = triangles.write(); + PoolVector<Vector3>::Read r = p_faces.read(); + PoolVector<Triangle>::Write w = triangles.write(); Map<Vector3,int> db; for(int i=0;i<fc;i++) { @@ -149,16 +149,16 @@ void TriangleMesh::create(const DVector<Vector3>& p_faces) { } vertices.resize(db.size()); - DVector<Vector3>::Write vw = vertices.write(); + PoolVector<Vector3>::Write vw = vertices.write(); for (Map<Vector3,int>::Element *E=db.front();E;E=E->next()) { vw[E->get()]=E->key(); } } - DVector<BVH*> bwptrs; + PoolVector<BVH*> bwptrs; bwptrs.resize(fc); - DVector<BVH*>::Write bwp = bwptrs.write(); + PoolVector<BVH*>::Write bwp = bwptrs.write(); for(int i=0;i<fc;i++) { bwp[i]=&bw[i]; @@ -168,7 +168,7 @@ void TriangleMesh::create(const DVector<Vector3>& p_faces) { int max_alloc=fc; int max=_create_bvh(bw.ptr(),bwp.ptr(),0,fc,1,max_depth,max_alloc); - bw=DVector<BVH>::Write(); //clearup + bw=PoolVector<BVH>::Write(); //clearup bvh.resize(max_alloc); //resize back valid=true; @@ -197,9 +197,9 @@ Vector3 TriangleMesh::get_area_normal(const AABB& p_aabb) const { int level=0; - DVector<Triangle>::Read trianglesr = triangles.read(); - DVector<Vector3>::Read verticesr=vertices.read(); - DVector<BVH>::Read bvhr=bvh.read(); + PoolVector<Triangle>::Read trianglesr = triangles.read(); + PoolVector<Vector3>::Read verticesr=vertices.read(); + PoolVector<BVH>::Read bvhr=bvh.read(); const Triangle *triangleptr=trianglesr.ptr(); int pos=bvh.size()-1; @@ -299,9 +299,9 @@ bool TriangleMesh::intersect_segment(const Vector3& p_begin,const Vector3& p_end int level=0; - DVector<Triangle>::Read trianglesr = triangles.read(); - DVector<Vector3>::Read verticesr=vertices.read(); - DVector<BVH>::Read bvhr=bvh.read(); + PoolVector<Triangle>::Read trianglesr = triangles.read(); + PoolVector<Vector3>::Read verticesr=vertices.read(); + PoolVector<BVH>::Read bvhr=bvh.read(); const Triangle *triangleptr=trianglesr.ptr(); const Vector3 *vertexptr=verticesr.ptr(); @@ -422,9 +422,9 @@ bool TriangleMesh::intersect_ray(const Vector3& p_begin,const Vector3& p_dir,Vec int level=0; - DVector<Triangle>::Read trianglesr = triangles.read(); - DVector<Vector3>::Read verticesr=vertices.read(); - DVector<BVH>::Read bvhr=bvh.read(); + PoolVector<Triangle>::Read trianglesr = triangles.read(); + PoolVector<Vector3>::Read verticesr=vertices.read(); + PoolVector<BVH>::Read bvhr=bvh.read(); const Triangle *triangleptr=trianglesr.ptr(); const Vector3 *vertexptr=verticesr.ptr(); @@ -524,18 +524,18 @@ bool TriangleMesh::is_valid() const { return valid; } -DVector<Face3> TriangleMesh::get_faces() const { +PoolVector<Face3> TriangleMesh::get_faces() const { if (!valid) - return DVector<Face3>(); + return PoolVector<Face3>(); - DVector<Face3> faces; + PoolVector<Face3> faces; int ts = triangles.size(); faces.resize(triangles.size()); - DVector<Face3>::Write w=faces.write(); - DVector<Triangle>::Read r = triangles.read(); - DVector<Vector3>::Read rv = vertices.read(); + PoolVector<Face3>::Write w=faces.write(); + PoolVector<Triangle>::Read r = triangles.read(); + PoolVector<Vector3>::Read rv = vertices.read(); for(int i=0;i<ts;i++) { for(int j=0;j<3;j++) { @@ -543,7 +543,7 @@ DVector<Face3> TriangleMesh::get_faces() const { } } - w = DVector<Face3>::Write(); + w = PoolVector<Face3>::Write(); return faces; } diff --git a/core/math/triangle_mesh.h b/core/math/triangle_mesh.h index d42f9c8dde..37d32bd7ec 100644 --- a/core/math/triangle_mesh.h +++ b/core/math/triangle_mesh.h @@ -41,8 +41,8 @@ class TriangleMesh : public Reference { int indices[3]; }; - DVector<Triangle> triangles; - DVector<Vector3> vertices; + PoolVector<Triangle> triangles; + PoolVector<Vector3> vertices; struct BVH { @@ -79,7 +79,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); - DVector<BVH> bvh; + PoolVector<BVH> bvh; int max_depth; bool valid; @@ -89,10 +89,10 @@ public: bool intersect_segment(const Vector3& p_begin,const Vector3& p_end,Vector3 &r_point, Vector3 &r_normal) const; bool intersect_ray(const Vector3& p_begin,const Vector3& p_dir,Vector3 &r_point, Vector3 &r_normal) const; Vector3 get_area_normal(const AABB& p_aabb) const; - DVector<Face3> get_faces() const; + PoolVector<Face3> get_faces() const; - void create(const DVector<Vector3>& p_faces); + void create(const PoolVector<Vector3>& p_faces); TriangleMesh(); }; diff --git a/core/method_ptrcall.h b/core/method_ptrcall.h index e38d59fd8f..2e3959c3ab 100644 --- a/core/method_ptrcall.h +++ b/core/method_ptrcall.h @@ -133,12 +133,12 @@ struct PtrToArg< const T* > { template<>\ struct PtrToArg<Vector<m_type> > {\ _FORCE_INLINE_ static Vector<m_type> convert(const void* p_ptr) {\ - const DVector<m_type> *dvs = reinterpret_cast<const DVector<m_type> *>(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);\ {\ - DVector<m_type>::Read r=dvs->read();\ + PoolVector<m_type>::Read r=dvs->read();\ for(int i=0;i<len;i++) {\ ret[i]=r[i];\ }\ @@ -146,11 +146,11 @@ struct PtrToArg<Vector<m_type> > {\ return ret;\ }\ _FORCE_INLINE_ static void encode(Vector<m_type> p_vec, void* p_ptr) {\ - DVector<m_type> *dv = reinterpret_cast<DVector<m_type> *>(p_ptr);\ + PoolVector<m_type> *dv = reinterpret_cast<PoolVector<m_type> *>(p_ptr);\ int len=p_vec.size();\ dv->resize(len);\ {\ - DVector<m_type>::Write w=dv->write();\ + PoolVector<m_type>::Write w=dv->write();\ for(int i=0;i<len;i++) {\ w[i]=p_vec[i];\ }\ @@ -160,12 +160,12 @@ struct PtrToArg<Vector<m_type> > {\ template<>\ struct PtrToArg<const Vector<m_type>& > {\ _FORCE_INLINE_ static Vector<m_type> convert(const void* p_ptr) {\ - const DVector<m_type> *dvs = reinterpret_cast<const DVector<m_type> *>(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);\ {\ - DVector<m_type>::Read r=dvs->read();\ + PoolVector<m_type>::Read r=dvs->read();\ for(int i=0;i<len;i++) {\ ret[i]=r[i];\ }\ @@ -226,26 +226,26 @@ MAKE_VECARR(Plane); #define MAKE_DVECARR(m_type) \ template<>\ -struct PtrToArg<DVector<m_type> > {\ - _FORCE_INLINE_ static DVector<m_type> convert(const void* p_ptr) {\ +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);\ - DVector<m_type> ret;\ + PoolVector<m_type> ret;\ int len = arr->size();\ ret.resize(len);\ {\ - DVector<m_type>::Write w=ret.write();\ + 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(DVector<m_type> p_vec, void* p_ptr) {\ + _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);\ {\ - DVector<m_type>::Read r=p_vec.read();\ + PoolVector<m_type>::Read r=p_vec.read();\ for(int i=0;i<len;i++) {\ (*arr)[i]=r[i];\ }\ @@ -253,14 +253,14 @@ struct PtrToArg<DVector<m_type> > {\ } \ };\ template<>\ -struct PtrToArg<const DVector<m_type>& > {\ - _FORCE_INLINE_ static DVector<m_type> convert(const void* p_ptr) {\ +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);\ - DVector<m_type> ret;\ + PoolVector<m_type> ret;\ int len = arr->size();\ ret.resize(len);\ {\ - DVector<m_type>::Write w=ret.write();\ + PoolVector<m_type>::Write w=ret.write();\ for(int i=0;i<len;i++) {\ w[i]=(*arr)[i];\ }\ @@ -297,15 +297,15 @@ MAKE_STRINGCONV(StringName); MAKE_STRINGCONV(IP_Address); template<> -struct PtrToArg<DVector<Face3> > { - _FORCE_INLINE_ static DVector<Face3> convert(const void* p_ptr) { - const DVector<Vector3> *dvs = reinterpret_cast<const DVector<Vector3> *>(p_ptr); - DVector<Face3> ret; +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; int len = dvs->size()/3; ret.resize(len); { - DVector<Vector3>::Read r=dvs->read(); - DVector<Face3>::Write w=ret.write(); + PoolVector<Vector3>::Read r=dvs->read(); + PoolVector<Face3>::Write w=ret.write(); for(int i=0;i<len;i++) { w[i].vertex[0]=r[i*3+0]; w[i].vertex[1]=r[i*3+1]; @@ -314,13 +314,13 @@ struct PtrToArg<DVector<Face3> > { } return ret; } - _FORCE_INLINE_ static void encode(DVector<Face3> p_vec, void* p_ptr) {\ - DVector<Vector3> *arr = reinterpret_cast<DVector<Vector3> *>(p_ptr);\ + _FORCE_INLINE_ static void encode(PoolVector<Face3> p_vec, void* p_ptr) {\ + PoolVector<Vector3> *arr = reinterpret_cast<PoolVector<Vector3> *>(p_ptr);\ int len = p_vec.size();\ arr->resize(len*3);\ {\ - DVector<Face3>::Read r=p_vec.read();\ - DVector<Vector3>::Write w=arr->write();\ + PoolVector<Face3>::Read r=p_vec.read();\ + PoolVector<Vector3>::Write w=arr->write();\ for(int i=0;i<len;i++) {\ w[i*3+0]=r[i].vertex[0];\ w[i*3+1]=r[i].vertex[1];\ @@ -330,15 +330,15 @@ struct PtrToArg<DVector<Face3> > { } \ }; template<> -struct PtrToArg<const DVector<Face3>& > { - _FORCE_INLINE_ static DVector<Face3> convert(const void* p_ptr) { - const DVector<Vector3> *dvs = reinterpret_cast<const DVector<Vector3> *>(p_ptr); - DVector<Face3> ret; +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; int len = dvs->size()/3; ret.resize(len); { - DVector<Vector3>::Read r=dvs->read(); - DVector<Face3>::Write w=ret.write(); + PoolVector<Vector3>::Read r=dvs->read(); + PoolVector<Face3>::Write w=ret.write(); 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 82377013e1..0f9b112ad2 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1112,9 +1112,9 @@ Array Object::_get_method_list_bind() const { } -DVector<String> Object::_get_meta_list_bind() const { +PoolVector<String> Object::_get_meta_list_bind() const { - DVector<String> _metaret; + PoolVector<String> _metaret; List<Variant> keys; metadata.get_key_list(&keys); @@ -1942,27 +1942,37 @@ uint32_t ObjectDB::instance_counter=1; HashMap<Object*,ObjectID,ObjectDB::ObjectPtrHash> ObjectDB::instance_checks; uint32_t ObjectDB::add_instance(Object *p_object) { - GLOBAL_LOCK_FUNCTION; + ERR_FAIL_COND_V( p_object->get_instance_ID()!=0, 0 ); + + rw_lock->write_lock(); instances[++instance_counter]=p_object; #ifdef DEBUG_ENABLED instance_checks[p_object]=instance_counter; #endif + rw_lock->write_unlock(); + return instance_counter; } void ObjectDB::remove_instance(Object *p_object) { - GLOBAL_LOCK_FUNCTION; + + rw_lock->write_lock(); + instances.erase( p_object->get_instance_ID() ); #ifdef DEBUG_ENABLED instance_checks.erase(p_object); #endif + + rw_lock->write_unlock(); } Object *ObjectDB::get_instance(uint32_t p_instance_ID) { - GLOBAL_LOCK_FUNCTION; + rw_lock->read_lock(); Object**obj=instances.getptr(p_instance_ID); + rw_lock->read_unlock(); + if (!obj) return NULL; return *obj; @@ -1970,13 +1980,16 @@ Object *ObjectDB::get_instance(uint32_t p_instance_ID) { void ObjectDB::debug_objects(DebugFunc p_func) { - GLOBAL_LOCK_FUNCTION; + rw_lock->read_lock(); const uint32_t *K=NULL; while((K=instances.next(K))) { p_func(instances[*K]); } + + rw_lock->read_unlock(); + } @@ -1987,15 +2000,26 @@ void Object::get_argument_options(const StringName& p_function,int p_idx,List<St int ObjectDB::get_object_count() { - GLOBAL_LOCK_FUNCTION; - return instances.size(); + rw_lock->read_lock(); + int count =instances.size(); + rw_lock->read_unlock(); + + return count; + +} + +RWLock *ObjectDB::rw_lock=NULL; + +void ObjectDB::setup() { + + rw_lock = RWLock::create(); } void ObjectDB::cleanup() { - GLOBAL_LOCK_FUNCTION; + rw_lock->write_lock(); if (instances.size()) { WARN_PRINT("ObjectDB Instances still exist!"); @@ -2014,4 +2038,7 @@ void ObjectDB::cleanup() { } instances.clear(); instance_checks.clear(); + rw_lock->write_unlock(); + + memdelete(rw_lock); } diff --git a/core/object.h b/core/object.h index 6dd427bf41..7c74f70518 100644 --- a/core/object.h +++ b/core/object.h @@ -34,6 +34,7 @@ #include "set.h" #include "map.h" #include "vmap.h" +#include "os/rw_lock.h" #define VARIANT_ARG_LIST const Variant& p_arg1=Variant(),const Variant& p_arg2=Variant(),const Variant& p_arg3=Variant(),const Variant& p_arg4=Variant(),const Variant& p_arg5=Variant() #define VARIANT_ARG_PASS p_arg1,p_arg2,p_arg3,p_arg4,p_arg5 @@ -481,7 +482,7 @@ protected: return &_class_name; } - DVector<String> _get_meta_list_bind() const; + PoolVector<String> _get_meta_list_bind() const; Array _get_property_list_bind() const; Array _get_method_list_bind() const; @@ -686,9 +687,14 @@ class ObjectDB { friend class Object; friend void unregister_core_types(); + + static RWLock *rw_lock; static void cleanup(); static uint32_t add_instance(Object *p_object); static void remove_instance(Object *p_object); +friend void register_core_types(); + static void setup(); + public: typedef void (*DebugFunc)(Object *p_obj); diff --git a/core/object_type_db.cpp b/core/object_type_db.cpp index 94cc865b62..7432c09563 100644 --- a/core/object_type_db.cpp +++ b/core/object_type_db.cpp @@ -31,11 +31,12 @@ #ifdef NO_THREADS -#define OBJTYPE_LOCK +#define OBJTYPE_RLOCK #else -#define OBJTYPE_LOCK MutexLock _mutex_lock_(lock); +#define OBJTYPE_RLOCK RWLockRead _rw_lockr_(lock); +#define OBJTYPE_WLOCK RWLockWrite _rw_lockw_(lock); #endif @@ -215,7 +216,7 @@ ClassDB::ClassInfo::~ClassInfo() { bool ClassDB::is_parent_class(const StringName &p_class,const StringName& p_inherits) { - OBJTYPE_LOCK; + OBJTYPE_RLOCK; StringName inherits=p_class; @@ -230,7 +231,7 @@ bool ClassDB::is_parent_class(const StringName &p_class,const StringName& p_inhe } void ClassDB::get_class_list( List<StringName> *p_classes) { - OBJTYPE_LOCK; + OBJTYPE_RLOCK; const StringName *k=NULL; @@ -245,7 +246,7 @@ void ClassDB::get_class_list( List<StringName> *p_classes) { void ClassDB::get_inheriters_from_class( const StringName& p_class,List<StringName> *p_classes) { - OBJTYPE_LOCK; + OBJTYPE_RLOCK; const StringName *k=NULL; @@ -259,7 +260,7 @@ void ClassDB::get_inheriters_from_class( const StringName& p_class,List<StringNa StringName ClassDB::get_parent_class(const StringName& p_class) { - OBJTYPE_LOCK; + OBJTYPE_RLOCK; ClassInfo *ti = classes.getptr(p_class); ERR_FAIL_COND_V(!ti,""); @@ -268,7 +269,7 @@ StringName ClassDB::get_parent_class(const StringName& p_class) { ClassDB::APIType ClassDB::get_api_type(const StringName &p_class) { - OBJTYPE_LOCK; + OBJTYPE_RLOCK; ClassInfo *ti = classes.getptr(p_class); ERR_FAIL_COND_V(!ti,API_NONE); @@ -277,6 +278,7 @@ ClassDB::APIType ClassDB::get_api_type(const StringName &p_class) { uint64_t ClassDB::get_api_hash(APIType p_api) { + OBJTYPE_RLOCK; #ifdef DEBUG_METHODS_ENABLED uint64_t hash = hash_djb2_one_64(HashMapHahserDefault::hash(VERSION_FULL_NAME)); @@ -433,12 +435,13 @@ uint64_t ClassDB::get_api_hash(APIType p_api) { bool ClassDB::class_exists(const StringName &p_class) { - OBJTYPE_LOCK; + OBJTYPE_RLOCK; return classes.has(p_class); } void ClassDB::add_compatibility_class(const StringName& p_class,const StringName& p_fallback) { + OBJTYPE_WLOCK; compat_classes[p_class]=p_fallback; } @@ -446,7 +449,7 @@ Object *ClassDB::instance(const StringName &p_class) { ClassInfo *ti; { - OBJTYPE_LOCK; + OBJTYPE_RLOCK; ti=classes.getptr(p_class); if (!ti || ti->disabled || !ti->creation_func) { if (compat_classes.has(p_class)) { @@ -462,7 +465,7 @@ Object *ClassDB::instance(const StringName &p_class) { } bool ClassDB::can_instance(const StringName &p_class) { - OBJTYPE_LOCK; + OBJTYPE_RLOCK; ClassInfo *ti = classes.getptr(p_class); ERR_FAIL_COND_V(!ti,false); @@ -472,7 +475,7 @@ bool ClassDB::can_instance(const StringName &p_class) { void ClassDB::_add_class2(const StringName& p_class, const StringName& p_inherits) { - OBJTYPE_LOCK; + OBJTYPE_WLOCK; StringName name = p_class; @@ -499,7 +502,7 @@ void ClassDB::_add_class2(const StringName& p_class, const StringName& p_inherit void ClassDB::get_method_list(StringName p_class,List<MethodInfo> *p_methods,bool p_no_inheritance) { - OBJTYPE_LOCK; + OBJTYPE_RLOCK; ClassInfo *type=classes.getptr(p_class); @@ -572,7 +575,7 @@ void ClassDB::get_method_list(StringName p_class,List<MethodInfo> *p_methods,boo MethodBind *ClassDB::get_method(StringName p_class, StringName p_name) { - OBJTYPE_LOCK; + OBJTYPE_RLOCK; ClassInfo *type=classes.getptr(p_class); @@ -589,7 +592,7 @@ MethodBind *ClassDB::get_method(StringName p_class, StringName p_name) { void ClassDB::bind_integer_constant(const StringName& p_class, const StringName &p_name, int p_constant) { - OBJTYPE_LOCK; + OBJTYPE_WLOCK; ClassInfo *type=classes.getptr(p_class); if (!type) { @@ -611,7 +614,7 @@ void ClassDB::bind_integer_constant(const StringName& p_class, const StringName void ClassDB::get_integer_constant_list(const StringName& p_class, List<String> *p_constants, bool p_no_inheritance) { - OBJTYPE_LOCK; + OBJTYPE_RLOCK; ClassInfo *type=classes.getptr(p_class); @@ -639,7 +642,7 @@ void ClassDB::get_integer_constant_list(const StringName& p_class, List<String> int ClassDB::get_integer_constant(const StringName& p_class, const StringName &p_name, bool *p_success) { - OBJTYPE_LOCK; + OBJTYPE_RLOCK; ClassInfo *type=classes.getptr(p_class); @@ -666,6 +669,8 @@ int ClassDB::get_integer_constant(const StringName& p_class, const StringName &p void ClassDB::add_signal(StringName p_class,const MethodInfo& p_signal) { + OBJTYPE_WLOCK; + ClassInfo *type=classes.getptr(p_class); ERR_FAIL_COND(!type); @@ -688,6 +693,8 @@ void ClassDB::add_signal(StringName p_class,const MethodInfo& p_signal) { void ClassDB::get_signal_list(StringName p_class,List<MethodInfo> *p_signals,bool p_no_inheritance) { + OBJTYPE_RLOCK; + ClassInfo *type=classes.getptr(p_class); ERR_FAIL_COND(!type); @@ -712,6 +719,7 @@ void ClassDB::get_signal_list(StringName p_class,List<MethodInfo> *p_signals,boo bool ClassDB::has_signal(StringName p_class,StringName p_signal) { + OBJTYPE_RLOCK; ClassInfo *type=classes.getptr(p_class); ClassInfo *check=type; while(check) { @@ -725,6 +733,7 @@ bool ClassDB::has_signal(StringName p_class,StringName p_signal) { bool ClassDB::get_signal(StringName p_class,StringName p_signal,MethodInfo *r_signal) { + OBJTYPE_RLOCK; ClassInfo *type=classes.getptr(p_class); ClassInfo *check=type; while(check) { @@ -743,6 +752,7 @@ bool ClassDB::get_signal(StringName p_class,StringName p_signal,MethodInfo *r_si void ClassDB::add_property_group(StringName p_class,const String& p_name,const String& p_prefix) { + OBJTYPE_WLOCK; ClassInfo *type=classes.getptr(p_class); ERR_FAIL_COND(!type); @@ -752,7 +762,13 @@ void ClassDB::add_property_group(StringName p_class,const String& p_name,const S void ClassDB::add_property(StringName p_class,const PropertyInfo& p_pinfo, const StringName& p_setter, const StringName& p_getter, int p_index) { + + lock->read_lock(); + ClassInfo *type=classes.getptr(p_class); + + lock->read_unlock(); + ERR_FAIL_COND(!type); MethodBind *mb_set=NULL; @@ -804,6 +820,9 @@ void ClassDB::add_property(StringName p_class,const PropertyInfo& p_pinfo, const ERR_FAIL(); } #endif + + OBJTYPE_WLOCK + type->property_list.push_back(p_pinfo); PropertySetGet psg; @@ -821,6 +840,8 @@ void ClassDB::add_property(StringName p_class,const PropertyInfo& p_pinfo, const void ClassDB::get_property_list(StringName p_class, List<PropertyInfo> *p_list, bool p_no_inheritance,const Object *p_validator) { + OBJTYPE_RLOCK; + ClassInfo *type=classes.getptr(p_class); ClassInfo *check=type; while(check) { @@ -846,6 +867,7 @@ void ClassDB::get_property_list(StringName p_class, List<PropertyInfo> *p_list, bool ClassDB::set_property(Object* p_object,const StringName& p_property, const Variant& p_value,bool *r_valid) { + ClassInfo *type=classes.getptr(p_object->get_class_name()); ClassInfo *check=type; while(check) { @@ -1010,6 +1032,7 @@ bool ClassDB::has_property(const StringName& p_class, const StringName& p_proper void ClassDB::set_method_flags(StringName p_class,StringName p_method,int p_flags) { + OBJTYPE_WLOCK; ClassInfo *type=classes.getptr(p_class); ClassInfo *check=type; ERR_FAIL_COND(!check); @@ -1070,7 +1093,7 @@ MethodBind* ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind , const } - OBJTYPE_LOCK; + OBJTYPE_WLOCK; ERR_FAIL_COND_V(!p_bind,NULL); p_bind->set_name(mdname); @@ -1114,6 +1137,8 @@ MethodBind* ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind , const void ClassDB::add_virtual_method(const StringName& p_class, const MethodInfo& p_method , bool p_virtual) { ERR_FAIL_COND(!classes.has(p_class)); + OBJTYPE_WLOCK; + #ifdef DEBUG_METHODS_ENABLED MethodInfo mi=p_method; if (p_virtual) @@ -1149,12 +1174,16 @@ void ClassDB::get_virtual_methods(const StringName& p_class, List<MethodInfo> * void ClassDB::set_class_enabled(StringName p_class,bool p_enable) { + OBJTYPE_WLOCK; + ERR_FAIL_COND(!classes.has(p_class)); classes[p_class].disabled=!p_enable; } bool ClassDB::is_class_enabled(StringName p_class) { + OBJTYPE_RLOCK; + ClassInfo *ti=classes.getptr(p_class); if (!ti || !ti->creation_func) { if (compat_classes.has(p_class)) { @@ -1206,23 +1235,19 @@ void ClassDB::get_extensions_for_type(const StringName& p_class,List<String> *p_ } -Mutex *ClassDB::lock=NULL; +RWLock *ClassDB::lock=NULL; void ClassDB::init() { #ifndef NO_THREADS - lock = Mutex::create(); + lock = RWLock::create(); #endif } void ClassDB::cleanup() { -#ifndef NO_THREADS - - memdelete(lock); -#endif //OBJTYPE_LOCK; hah not here @@ -1241,6 +1266,12 @@ void ClassDB::cleanup() { classes.clear(); resource_base_extensions.clear(); compat_classes.clear(); + +#ifndef NO_THREADS + + memdelete(lock); +#endif + } // diff --git a/core/object_type_db.h b/core/object_type_db.h index 3613d351e4..158a4dae23 100644 --- a/core/object_type_db.h +++ b/core/object_type_db.h @@ -156,7 +156,7 @@ public: return memnew( T ); } - static Mutex *lock; + static RWLock *lock; static HashMap<StringName,ClassInfo,StringNameHasher> classes; static HashMap<StringName,StringName,StringNameHasher> resource_base_extensions; static HashMap<StringName,StringName,StringNameHasher> compat_classes; diff --git a/core/os/memory.cpp b/core/os/memory.cpp index cf42c3681a..37a523b763 100644 --- a/core/os/memory.cpp +++ b/core/os/memory.cpp @@ -33,61 +33,6 @@ #include <stdlib.h> -MID::MID(MemoryPoolDynamic::ID p_id) { - - data = (Data*)memalloc(sizeof(Data)); - data->refcount.init(); - data->id=p_id; -} - -void MID::unref() { - - if (!data) - return; - if (data->refcount.unref()) { - - if (data->id!=MemoryPoolDynamic::INVALID_ID) - MemoryPoolDynamic::get_singleton()->free(data->id); - memfree(data); - } - - data=NULL; -} -Error MID::_resize(size_t p_size) { - - if (p_size==0 && (!data || data->id==MemoryPoolDynamic::INVALID_ID)) - return OK; - if (p_size && !data) { - // create data because we'll need it - data = (Data*)memalloc(sizeof(Data)); - ERR_FAIL_COND_V( !data,ERR_OUT_OF_MEMORY ); - data->refcount.init(); - data->id=MemoryPoolDynamic::INVALID_ID; - } - - if (p_size==0 && data && data->id==MemoryPoolDynamic::INVALID_ID) { - - MemoryPoolDynamic::get_singleton()->free(data->id); - data->id=MemoryPoolDynamic::INVALID_ID; - } - - if (p_size>0) { - - if (data->id==MemoryPoolDynamic::INVALID_ID) { - - data->id=MemoryPoolDynamic::get_singleton()->alloc(p_size,"Unnamed MID"); - ERR_FAIL_COND_V( data->id==MemoryPoolDynamic::INVALID_ID, ERR_OUT_OF_MEMORY ); - - } else { - - MemoryPoolDynamic::get_singleton()->realloc(data->id,p_size); - ERR_FAIL_COND_V( data->id==MemoryPoolDynamic::INVALID_ID, ERR_OUT_OF_MEMORY ); - - } - } - - return OK; -} void * operator new(size_t p_size,const char *p_description) { @@ -242,34 +187,6 @@ size_t Memory::get_mem_max_usage(){ } -MID Memory::alloc_dynamic(size_t p_bytes, const char *p_descr) { - - MemoryPoolDynamic::ID id = MemoryPoolDynamic::get_singleton()->alloc(p_bytes,p_descr); - - return MID(id); -} -Error Memory::realloc_dynamic(MID p_mid,size_t p_bytes) { - - MemoryPoolDynamic::ID id = p_mid.data?p_mid.data->id:MemoryPoolDynamic::INVALID_ID; - - if (id==MemoryPoolDynamic::INVALID_ID) - return ERR_INVALID_PARAMETER; - - return MemoryPoolDynamic::get_singleton()->realloc(p_mid, p_bytes); - -} - -size_t Memory::get_dynamic_mem_available() { - - return MemoryPoolDynamic::get_singleton()->get_available_mem(); -} - -size_t Memory::get_dynamic_mem_usage() { - - return MemoryPoolDynamic::get_singleton()->get_total_usage(); -} - - _GlobalNil::_GlobalNil() { diff --git a/core/os/memory.h b/core/os/memory.h index 6a939e3d6f..0e6dea48d3 100644 --- a/core/os/memory.h +++ b/core/os/memory.h @@ -31,8 +31,6 @@ #include <stddef.h> #include "safe_refcount.h" -#include "os/memory_pool_dynamic.h" - /** @@ -44,88 +42,6 @@ #endif -class MID { - - struct Data { - - SafeRefCount refcount; - MemoryPoolDynamic::ID id; - }; - - mutable Data *data; - - - - void ref(Data *p_data) { - - if (data==p_data) - return; - unref(); - - if (p_data && p_data->refcount.ref()) - data=p_data; - } - -friend class MID_Lock; - - inline void lock() { - - if (data && data->id!=MemoryPoolDynamic::INVALID_ID) - MemoryPoolDynamic::get_singleton()->lock(data->id); - } - inline void unlock() { - - if (data && data->id!=MemoryPoolDynamic::INVALID_ID) - MemoryPoolDynamic::get_singleton()->unlock(data->id); - - } - - inline void * get() { - - if (data && data->id!=MemoryPoolDynamic::INVALID_ID) - return MemoryPoolDynamic::get_singleton()->get(data->id); - - return NULL; - } - - - void unref(); - Error _resize(size_t p_size); - -friend class Memory; - - MID(MemoryPoolDynamic::ID p_id); -public: - - bool is_valid() const { return data; } - operator bool() const { return data; } - - - size_t get_size() const { return (data && data->id!=MemoryPoolDynamic::INVALID_ID) ? MemoryPoolDynamic::get_singleton()->get_size(data->id) : 0; } - Error resize(size_t p_size) { return _resize(p_size); } - inline void operator=(const MID& p_mid) { ref( p_mid.data ); } - inline bool is_locked() const { return (data && data->id!=MemoryPoolDynamic::INVALID_ID) ? MemoryPoolDynamic::get_singleton()->is_locked(data->id) : false; } - inline MID(const MID& p_mid) { data=NULL; ref( p_mid.data ); } - inline MID() { data = NULL; } - ~MID() { unref(); } -}; - - -class MID_Lock { - - MID mid; - -public: - - void *data() { return mid.get(); } - - void operator=(const MID_Lock& p_lock ) { mid.unlock(); mid = p_lock.mid; mid.lock(); } - inline MID_Lock(const MID& p_mid) { mid=p_mid; mid.lock(); } - inline MID_Lock(const MID_Lock& p_lock) { mid=p_lock.mid; mid.lock(); } - MID_Lock() {} - ~MID_Lock() { mid.unlock(); } -}; - class Memory{ @@ -148,12 +64,6 @@ public: static size_t get_mem_max_usage(); - static MID alloc_dynamic(size_t p_bytes, const char *p_descr=""); - static Error realloc_dynamic(MID p_mid,size_t p_bytes); - - static size_t get_dynamic_mem_available(); - static size_t get_dynamic_mem_usage(); - }; class DefaultAllocator { @@ -174,18 +84,6 @@ void * operator new(size_t p_size,void *p_pointer,size_t check, const char *p_de #define memfree(m_size) Memory::free_static(m_size) -#ifdef DEBUG_MEMORY_ENABLED -#define dynalloc(m_size) Memory::alloc_dynamic(m_size, __FILE__ ":" __STR(__LINE__) ", type: DYNAMIC") -#define dynrealloc(m_mem,m_size) m_mem.resize(m_size) - -#else - -#define dynalloc(m_size) Memory::alloc_dynamic(m_size) -#define dynrealloc(m_mem,m_size) m_mem.resize(m_size) - -#endif - - _ALWAYS_INLINE_ void postinitialize_handler(void *) {} @@ -241,7 +139,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 DVector class, so it should be safe.*/ + same strategy used by std::vector, and the PoolVector 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/memory_pool_dynamic.cpp b/core/os/memory_pool_dynamic.cpp deleted file mode 100644 index 0bd64a0362..0000000000 --- a/core/os/memory_pool_dynamic.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/*************************************************************************/ -/* memory_pool_dynamic.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 "memory_pool_dynamic.h" - - -MemoryPoolDynamic* MemoryPoolDynamic::singleton=NULL; - - -MemoryPoolDynamic* MemoryPoolDynamic::get_singleton() { - - return singleton; -} - - -MemoryPoolDynamic::MemoryPoolDynamic() { - - ERR_FAIL_COND(singleton!=NULL); - singleton=this; -} - -MemoryPoolDynamic::~MemoryPoolDynamic() { - - singleton=NULL; -} diff --git a/core/os/memory_pool_dynamic.h b/core/os/memory_pool_dynamic.h deleted file mode 100644 index 025e925d3c..0000000000 --- a/core/os/memory_pool_dynamic.h +++ /dev/null @@ -1,79 +0,0 @@ -/*************************************************************************/ -/* memory_pool_dynamic.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 MEMORY_POOL_DYNAMIC_H -#define MEMORY_POOL_DYNAMIC_H - -#include "typedefs.h" - - -class MemoryPoolDynamic { - - static MemoryPoolDynamic* singleton; -protected: -friend class Memory; -friend class MID; - - enum { - - INVALID_ID=0xFFFFFFFF - }; - - static MemoryPoolDynamic* get_singleton(); - - typedef uint64_t ID; - - - virtual ID alloc(size_t p_amount,const char* p_description)=0; - virtual void free(ID p_id)=0; - virtual Error realloc(ID p_id, size_t p_amount)=0; - virtual bool is_valid(ID p_id)=0; - virtual size_t get_size(ID p_id) const=0; - virtual const char* get_description(ID p_id) const=0; - - virtual Error lock(ID p_id)=0; - virtual void * get(ID p_ID)=0; - virtual Error unlock(ID p_id)=0; - virtual bool is_locked(ID p_id) const=0; - - virtual size_t get_available_mem() const=0; - virtual size_t get_total_usage() const=0; - - MemoryPoolDynamic(); -public: - virtual ~MemoryPoolDynamic(); - -}; - - -#endif - - - - - diff --git a/core/os/memory_pool_dynamic_prealloc.cpp b/core/os/memory_pool_dynamic_prealloc.cpp deleted file mode 100644 index d2efa4cc88..0000000000 --- a/core/os/memory_pool_dynamic_prealloc.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/*************************************************************************/ -/* memory_pool_dynamic_prealloc.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 "memory_pool_dynamic_prealloc.h" -#include "os/memory.h" - -#include "print_string.h" -MemoryPoolDynamicPrealloc::ID MemoryPoolDynamicPrealloc::alloc(size_t p_amount,const char* p_description) { - - -// print_line("dynpool - allocating: "+itos(p_amount)); - ID id = pool_alloc->alloc(p_amount); -// print_line("dynpool - free: "+itos(pool_alloc->get_free_mem())); - return id; - -} - -void MemoryPoolDynamicPrealloc::free(ID p_id) { - - pool_alloc->free(p_id); -} - -Error MemoryPoolDynamicPrealloc::realloc(ID p_id, size_t p_amount) { - - return pool_alloc->resize(p_id,p_amount); -} - -bool MemoryPoolDynamicPrealloc::is_valid(ID p_id) { - - return true; -} - -size_t MemoryPoolDynamicPrealloc::get_size(ID p_id) const { - - return pool_alloc->get_size(p_id); -} - -const char* MemoryPoolDynamicPrealloc::get_description(ID p_id) const { - - return ""; -} - -Error MemoryPoolDynamicPrealloc::lock(ID p_id) { - -// print_line("lock: "+itos(p_id)); - return pool_alloc->lock(p_id); -} - -void * MemoryPoolDynamicPrealloc::get(ID p_ID) { - -// print_line("get: "+itos(p_ID)); - return pool_alloc->get(p_ID); -} - -Error MemoryPoolDynamicPrealloc::unlock(ID p_id) { - -// print_line("unlock: "+itos(p_id)); - pool_alloc->unlock(p_id); - return OK; -} - -bool MemoryPoolDynamicPrealloc::is_locked(ID p_id) const { - - return pool_alloc->is_locked(p_id); -} - - -size_t MemoryPoolDynamicPrealloc::get_available_mem() const { - - return pool_alloc->get_free_mem(); -} - -size_t MemoryPoolDynamicPrealloc::get_total_usage() const { - - return pool_alloc->get_used_mem(); -} - - - -MemoryPoolDynamicPrealloc::MemoryPoolDynamicPrealloc(void * p_mem,int p_size, int p_align, int p_max_entries) { - - pool_alloc = memnew( PoolAllocator(p_mem,p_size,p_align,true,p_max_entries)); - -} - -MemoryPoolDynamicPrealloc::~MemoryPoolDynamicPrealloc() { - - - memdelete( pool_alloc ); -} - diff --git a/core/os/memory_pool_dynamic_prealloc.h b/core/os/memory_pool_dynamic_prealloc.h deleted file mode 100644 index a2e51b93f3..0000000000 --- a/core/os/memory_pool_dynamic_prealloc.h +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************/ -/* memory_pool_dynamic_prealloc.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 MEMORY_POOL_DYNAMIC_PREALLOC_H -#define MEMORY_POOL_DYNAMIC_PREALLOC_H - -#include "pool_allocator.h" -#include "core/os/memory_pool_dynamic.h" - -class MemoryPoolDynamicPrealloc : public MemoryPoolDynamic { - - PoolAllocator *pool_alloc; - -public: - - virtual ID alloc(size_t p_amount,const char* p_description); - virtual void free(ID p_id); - virtual Error realloc(ID p_id, size_t p_amount); - virtual bool is_valid(ID p_id); - virtual size_t get_size(ID p_id) const; - virtual const char* get_description(ID p_id) const; - - virtual Error lock(ID p_id); - virtual void * get(ID p_ID); - virtual Error unlock(ID p_id); - virtual bool is_locked(ID p_id) const; - - virtual size_t get_available_mem() const; - virtual size_t get_total_usage() const; - - MemoryPoolDynamicPrealloc(void * p_mem,int p_size, int p_align = 16, int p_max_entries=PoolAllocator::DEFAULT_MAX_ALLOCS); - ~MemoryPoolDynamicPrealloc(); -}; - -#endif // MEMORY_POOL_DYNAMIC_PREALLOC_H diff --git a/core/os/memory_pool_dynamic_static.cpp b/core/os/memory_pool_dynamic_static.cpp deleted file mode 100644 index b7a1bbc19f..0000000000 --- a/core/os/memory_pool_dynamic_static.cpp +++ /dev/null @@ -1,272 +0,0 @@ -/*************************************************************************/ -/* memory_pool_dynamic_static.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 "memory_pool_dynamic_static.h" -#include "os/memory.h" -#include "os/os.h" -#include "ustring.h" -#include "print_string.h" -#include <stdio.h> - -MemoryPoolDynamicStatic::Chunk *MemoryPoolDynamicStatic::get_chunk(ID p_id) { - - uint64_t check = p_id/MAX_CHUNKS; - uint64_t idx = p_id%MAX_CHUNKS; - - if (!chunk[idx].mem || chunk[idx].check!=check) - return NULL; - - return &chunk[idx]; -} - - -const MemoryPoolDynamicStatic::Chunk *MemoryPoolDynamicStatic::get_chunk(ID p_id) const { - - uint64_t check = p_id/MAX_CHUNKS; - uint64_t idx = p_id%MAX_CHUNKS; - - if (!chunk[idx].mem || chunk[idx].check!=check) - return NULL; - - return &chunk[idx]; -} - -MemoryPoolDynamic::ID MemoryPoolDynamicStatic::alloc(size_t p_amount,const char* p_description) { - - _THREAD_SAFE_METHOD_ - - int idx=-1; - - for (int i=0;i<MAX_CHUNKS;i++) { - - last_alloc++; - if (last_alloc>=MAX_CHUNKS) - last_alloc=0; - - if ( !chunk[last_alloc].mem ) { - - idx=last_alloc; - break; - } - } - - - if (idx==-1) { - ERR_EXPLAIN("Out of dynamic Memory IDs"); - ERR_FAIL_V(INVALID_ID); - //return INVALID_ID; - } - - //chunk[idx].mem = Memory::alloc_static(p_amount,p_description); - chunk[idx].mem = memalloc(p_amount); - if (!chunk[idx].mem) - return INVALID_ID; - - chunk[idx].size=p_amount; - chunk[idx].check=++last_check; - chunk[idx].descr=p_description; - chunk[idx].lock=0; - - total_usage+=p_amount; - if (total_usage>max_usage) - max_usage=total_usage; - - ID id = chunk[idx].check*MAX_CHUNKS + (uint64_t)idx; - - return id; - -} -void MemoryPoolDynamicStatic::free(ID p_id) { - - _THREAD_SAFE_METHOD_ - - Chunk *c = get_chunk(p_id); - ERR_FAIL_COND(!c); - - - total_usage-=c->size; - memfree(c->mem); - - c->mem=0; - - if (c->lock>0) { - - ERR_PRINT("Freed ID Still locked"); - } -} - -Error MemoryPoolDynamicStatic::realloc(ID p_id, size_t p_amount) { - - _THREAD_SAFE_METHOD_ - - Chunk *c = get_chunk(p_id); - ERR_FAIL_COND_V(!c,ERR_INVALID_PARAMETER); - ERR_FAIL_COND_V(c->lock > 0 , ERR_LOCKED ); - - - void * new_mem = memrealloc(c->mem,p_amount); - - ERR_FAIL_COND_V(!new_mem,ERR_OUT_OF_MEMORY); - total_usage-=c->size; - c->mem=new_mem; - c->size=p_amount; - total_usage+=c->size; - if (total_usage>max_usage) - max_usage=total_usage; - - - return OK; -} -bool MemoryPoolDynamicStatic::is_valid(ID p_id) { - - _THREAD_SAFE_METHOD_ - - Chunk *c = get_chunk(p_id); - - return c!=NULL; - -} -size_t MemoryPoolDynamicStatic::get_size(ID p_id) const { - - _THREAD_SAFE_METHOD_ - - const Chunk *c = get_chunk(p_id); - ERR_FAIL_COND_V(!c,0); - - return c->size; - - -} -const char* MemoryPoolDynamicStatic::get_description(ID p_id) const { - - _THREAD_SAFE_METHOD_ - - const Chunk *c = get_chunk(p_id); - ERR_FAIL_COND_V(!c,""); - - return c->descr; - -} - - -bool MemoryPoolDynamicStatic::is_locked(ID p_id) const { - - _THREAD_SAFE_METHOD_ - - const Chunk *c = get_chunk(p_id); - ERR_FAIL_COND_V(!c,false); - - return c->lock>0; - -} - -Error MemoryPoolDynamicStatic::lock(ID p_id) { - - _THREAD_SAFE_METHOD_ - - Chunk *c = get_chunk(p_id); - ERR_FAIL_COND_V(!c,ERR_INVALID_PARAMETER); - - c->lock++; - - return OK; -} -void * MemoryPoolDynamicStatic::get(ID p_id) { - - _THREAD_SAFE_METHOD_ - - const Chunk *c = get_chunk(p_id); - ERR_FAIL_COND_V(!c,NULL); - ERR_FAIL_COND_V( c->lock==0, NULL ); - - return c->mem; -} -Error MemoryPoolDynamicStatic::unlock(ID p_id) { - - _THREAD_SAFE_METHOD_ - - Chunk *c = get_chunk(p_id); - ERR_FAIL_COND_V(!c,ERR_INVALID_PARAMETER); - - ERR_FAIL_COND_V( c->lock<=0, ERR_INVALID_PARAMETER ); - c->lock--; - - return OK; -} - -size_t MemoryPoolDynamicStatic::get_available_mem() const { - - return Memory::get_mem_available(); -} - -size_t MemoryPoolDynamicStatic::get_total_usage() const { - _THREAD_SAFE_METHOD_ - - return total_usage; -} - -MemoryPoolDynamicStatic::MemoryPoolDynamicStatic() { - - last_check=1; - last_alloc=0; - total_usage=0; - max_usage=0; -} - -MemoryPoolDynamicStatic::~MemoryPoolDynamicStatic() { - -#ifdef DEBUG_MEMORY_ENABLED - - if (OS::get_singleton()->is_stdout_verbose()) { - - if (total_usage>0) { - - ERR_PRINT("DYNAMIC ALLOC: ** MEMORY LEAKS DETECTED **"); - ERR_PRINT(String("DYNAMIC ALLOC: "+String::num(total_usage)+" bytes of memory in use at exit.").ascii().get_data()); - - ERR_PRINT("DYNAMIC ALLOC: Following is the list of leaked allocations:"); - - for (int i=0;i<MAX_CHUNKS;i++) { - - if (chunk[i].mem) { - - ERR_PRINT(String("\t"+String::num(chunk[i].size)+" bytes - "+String(chunk[i].descr)).ascii().get_data()); - } - } - - ERR_PRINT("DYNAMIC ALLOC: End of Report."); - - print_line("INFO: dynmem - max: "+itos(max_usage)+", "+itos(total_usage)+" leaked."); - } else { - - print_line("INFO: dynmem - max: "+itos(max_usage)+", no leaks."); - } - } - -#endif -} diff --git a/core/os/memory_pool_dynamic_static.h b/core/os/memory_pool_dynamic_static.h deleted file mode 100644 index a72d39355c..0000000000 --- a/core/os/memory_pool_dynamic_static.h +++ /dev/null @@ -1,86 +0,0 @@ -/*************************************************************************/ -/* memory_pool_dynamic_static.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* 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 MEMORY_POOL_DYNAMIC_STATIC_H -#define MEMORY_POOL_DYNAMIC_STATIC_H - -#include "os/memory_pool_dynamic.h" -#include "typedefs.h" -#include "os/thread_safe.h" - -class MemoryPoolDynamicStatic : public MemoryPoolDynamic { - - _THREAD_SAFE_CLASS_ - - enum { - MAX_CHUNKS=65536 - }; - - - struct Chunk { - - uint64_t lock; - uint64_t check; - void *mem; - size_t size; - const char *descr; - - Chunk() { mem=NULL; lock=0; check=0; } - }; - - Chunk chunk[MAX_CHUNKS]; - uint64_t last_check; - int last_alloc; - size_t total_usage; - size_t max_usage; - - Chunk *get_chunk(ID p_id); - const Chunk *get_chunk(ID p_id) const; -public: - - virtual ID alloc(size_t p_amount,const char* p_description); - virtual void free(ID p_id); - virtual Error realloc(ID p_id, size_t p_amount); - virtual bool is_valid(ID p_id); - virtual size_t get_size(ID p_id) const; - virtual const char* get_description(ID p_id) const; - - virtual bool is_locked(ID p_id) const; - virtual Error lock(ID p_id); - virtual void * get(ID p_ID); - virtual Error unlock(ID p_id); - - virtual size_t get_available_mem() const; - virtual size_t get_total_usage() const; - - MemoryPoolDynamicStatic(); - virtual ~MemoryPoolDynamicStatic(); - -}; - -#endif diff --git a/core/os/os.cpp b/core/os/os.cpp index 7333d667db..82500f5423 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -371,7 +371,7 @@ int OS::get_static_memory_usage() const { } int OS::get_dynamic_memory_usage() const{ - return Memory::get_dynamic_mem_usage(); + return MemoryPool::total_memory; } int OS::get_static_memory_peak_usage() const { diff --git a/core/os/rw_lock.cpp b/core/os/rw_lock.cpp new file mode 100644 index 0000000000..9b2d1f8a46 --- /dev/null +++ b/core/os/rw_lock.cpp @@ -0,0 +1,21 @@ +#include "rw_lock.h" +#include "error_macros.h" +#include <stddef.h> + + + +RWLock* (*RWLock::create_func)()=0; + +RWLock *RWLock::create() { + + ERR_FAIL_COND_V( !create_func, 0 ); + + return create_func(); +} + + +RWLock::~RWLock() { + + +} + diff --git a/core/os/rw_lock.h b/core/os/rw_lock.h new file mode 100644 index 0000000000..c513e6d636 --- /dev/null +++ b/core/os/rw_lock.h @@ -0,0 +1,46 @@ +#ifndef RWLOCK_H +#define RWLOCK_H + +#include "error_list.h" + +class RWLock { +protected: + static RWLock* (*create_func)(); + +public: + + virtual void read_lock()=0; ///< Lock the rwlock, block if locked by someone else + virtual void read_unlock()=0; ///< Unlock the rwlock, let other threads continue + virtual Error read_try_lock()=0; ///< Attempt to lock the rwlock, OK on success, ERROR means it can't lock. + + virtual void write_lock()=0; ///< Lock the rwlock, block if locked by someone else + virtual void write_unlock()=0; ///< Unlock the rwlock, let other thwrites continue + virtual Error write_try_lock()=0; ///< Attempt to lock the rwlock, OK on success, ERROR means it can't lock. + + static RWLock * create(); ///< Create a rwlock + + virtual ~RWLock(); +}; + + +class RWLockRead { + + RWLock *lock; +public: + + RWLockRead(RWLock* p_lock) { lock=p_lock; if (lock) lock->read_lock(); } + ~RWLockRead() { if (lock) lock->read_unlock(); } + +}; + +class RWLockWrite { + + RWLock *lock; +public: + + RWLockWrite(RWLock* p_lock) { lock=p_lock; if (lock) lock->write_lock(); } + ~RWLockWrite() { if (lock) lock->write_unlock(); } + +}; + +#endif // RWLOCK_H diff --git a/core/packed_data_container.cpp b/core/packed_data_container.cpp index 8bf77b735a..77afbfc214 100644 --- a/core/packed_data_container.cpp +++ b/core/packed_data_container.cpp @@ -82,7 +82,7 @@ Variant PackedDataContainer::_iter_get_ofs(const Variant& p_iter,uint32_t p_offs if (pos<0 || pos>=size) return Variant(); - DVector<uint8_t>::Read rd=data.read(); + PoolVector<uint8_t>::Read rd=data.read(); const uint8_t *r=&rd[p_offset]; uint32_t type = decode_uint32(r); @@ -131,7 +131,7 @@ Variant PackedDataContainer::_get_at_ofs(uint32_t p_ofs,const uint8_t *p_buf,boo uint32_t PackedDataContainer::_type_at_ofs(uint32_t p_ofs) const { - DVector<uint8_t>::Read rd=data.read(); + PoolVector<uint8_t>::Read rd=data.read(); const uint8_t *r=&rd[p_ofs]; uint32_t type = decode_uint32(r); @@ -140,7 +140,7 @@ uint32_t PackedDataContainer::_type_at_ofs(uint32_t p_ofs) const { int PackedDataContainer::_size(uint32_t p_ofs) const { - DVector<uint8_t>::Read rd=data.read(); + PoolVector<uint8_t>::Read rd=data.read(); const uint8_t *r=&rd[p_ofs]; uint32_t type = decode_uint32(r); @@ -160,7 +160,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 { - DVector<uint8_t>::Read rd=data.read(); + PoolVector<uint8_t>::Read rd=data.read(); const uint8_t *r=&rd[p_ofs]; uint32_t type = decode_uint32(r); @@ -344,21 +344,21 @@ Error PackedDataContainer::pack(const Variant& p_data) { _pack(p_data,tmpdata,string_cache); datalen=tmpdata.size(); data.resize(tmpdata.size()); - DVector<uint8_t>::Write w = data.write(); + PoolVector<uint8_t>::Write w = data.write(); copymem(w.ptr(),tmpdata.ptr(),tmpdata.size()); return OK; } -void PackedDataContainer::_set_data(const DVector<uint8_t>& p_data) { +void PackedDataContainer::_set_data(const PoolVector<uint8_t>& p_data) { data=p_data; datalen=data.size(); } -DVector<uint8_t> PackedDataContainer::_get_data() const { +PoolVector<uint8_t> PackedDataContainer::_get_data() const { return data; } diff --git a/core/packed_data_container.h b/core/packed_data_container.h index 5e0180a424..f8ff43f9b0 100644 --- a/core/packed_data_container.h +++ b/core/packed_data_container.h @@ -50,7 +50,7 @@ class PackedDataContainer : public Resource { }; - DVector<uint8_t> data; + PoolVector<uint8_t> data; int datalen; @@ -73,8 +73,8 @@ friend class PackedDataContainerRef; protected: - void _set_data(const DVector<uint8_t>& p_data); - DVector<uint8_t> _get_data() const; + void _set_data(const PoolVector<uint8_t>& p_data); + PoolVector<uint8_t> _get_data() const; static void _bind_methods(); public: diff --git a/core/path_remap.cpp b/core/path_remap.cpp index 92a2ab9af7..980e8f76e7 100644 --- a/core/path_remap.cpp +++ b/core/path_remap.cpp @@ -124,13 +124,13 @@ void PathRemap::clear_remaps() { void PathRemap::load_remaps() { // default remaps first - DVector<String> remaps = GlobalConfig::get_singleton()->get("remap/all"); + PoolVector<String> remaps = GlobalConfig::get_singleton()->get("remap/all"); { int rlen = remaps.size(); ERR_FAIL_COND( rlen%2 ); - DVector<String>::Read r = remaps.read(); + PoolVector<String>::Read r = remaps.read(); for(int i=0;i<rlen/2;i++) { String from = r[i*2+0]; @@ -147,7 +147,7 @@ void PathRemap::load_remaps() { int rlen = remaps.size(); ERR_FAIL_COND( rlen%2 ); - DVector<String>::Read r = remaps.read(); + PoolVector<String>::Read r = remaps.read(); for(int i=0;i<rlen/2;i++) { String from = r[i*2+0]; diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index e3c18217e9..7c076d028e 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -85,6 +85,9 @@ extern void unregister_variant_methods(); void register_core_types() { + ObjectDB::setup(); + ResourceCache::setup(); + MemoryPool::setup(); _global_mutex=Mutex::create(); @@ -241,4 +244,7 @@ void unregister_core_types() { memdelete(_global_mutex); _global_mutex=NULL; //still needed at a few places }; + + MemoryPool::cleanup(); + } diff --git a/core/resource.cpp b/core/resource.cpp index a503e965b0..7bcdd88891 100644 --- a/core/resource.cpp +++ b/core/resource.cpp @@ -164,17 +164,31 @@ void Resource::set_path(const String& p_path, bool p_take_over) { if (path_cache!="") { + ResourceCache::lock->write_lock(); ResourceCache::resources.erase(path_cache); + ResourceCache::lock->write_unlock(); } path_cache=""; - if (ResourceCache::resources.has( p_path )) { + + ResourceCache::lock->read_lock(); + bool has_path = ResourceCache::resources.has( p_path ); + ResourceCache::lock->read_unlock(); + + if (has_path) { if (p_take_over) { + ResourceCache::lock->write_lock(); ResourceCache::resources.get(p_path)->set_name(""); + ResourceCache::lock->write_unlock(); } else { ERR_EXPLAIN("Another resource is loaded from path: "+p_path); - ERR_FAIL_COND( ResourceCache::resources.has( p_path ) ); + + ResourceCache::lock->read_lock(); + bool exists = ResourceCache::resources.has( p_path ); + ResourceCache::lock->read_unlock(); + + ERR_FAIL_COND( exists ); } } @@ -182,7 +196,9 @@ void Resource::set_path(const String& p_path, bool p_take_over) { if (path_cache!="") { + ResourceCache::lock->write_lock(); ResourceCache::resources[path_cache]=this;; + ResourceCache::lock->write_unlock(); } _change_notify("resource/path"); @@ -393,8 +409,11 @@ Resource::Resource() { Resource::~Resource() { - if (path_cache!="") + if (path_cache!="") { + ResourceCache::lock->write_lock(); ResourceCache::resources.erase(path_cache); + ResourceCache::lock->write_unlock(); + } if (owners.size()) { WARN_PRINT("Resource is still owned"); } @@ -402,18 +421,24 @@ Resource::~Resource() { HashMap<String,Resource*> ResourceCache::resources; +RWLock *ResourceCache::lock=NULL; + +void ResourceCache::setup() { + + lock = RWLock::create(); +} + void ResourceCache::clear() { if (resources.size()) ERR_PRINT("Resources Still in use at Exit!"); resources.clear(); + memdelete(lock); } void ResourceCache::reload_externals() { - GLOBAL_LOCK_FUNCTION - //const String *K=NULL; //while ((K=resources.next(K))) { // resources[*K]->reload_external_data(); @@ -423,15 +448,21 @@ void ResourceCache::reload_externals() { bool ResourceCache::has(const String& p_path) { - GLOBAL_LOCK_FUNCTION + lock->read_lock();; + bool b = resources.has(p_path); + lock->read_unlock();; + - return resources.has(p_path); + return b; } Resource *ResourceCache::get(const String& p_path) { - GLOBAL_LOCK_FUNCTION + lock->read_lock(); Resource **res = resources.getptr(p_path); + + lock->read_unlock(); + if (!res) { return NULL; } @@ -443,6 +474,7 @@ Resource *ResourceCache::get(const String& p_path) { void ResourceCache::get_cached_resources(List<Ref<Resource> > *p_resources) { + lock->read_lock(); const String* K=NULL; while((K=resources.next(K))) { @@ -450,17 +482,22 @@ void ResourceCache::get_cached_resources(List<Ref<Resource> > *p_resources) { p_resources->push_back( Ref<Resource>( r )); } + lock->read_unlock(); } int ResourceCache::get_cached_resource_count() { - return resources.size(); + lock->read_lock(); + int rc = resources.size(); + lock->read_unlock(); + + return rc; } void ResourceCache::dump(const char* p_file,bool p_short) { #ifdef DEBUG_ENABLED - GLOBAL_LOCK_FUNCTION + lock->read_lock(); Map<String,int> type_count; @@ -500,5 +537,7 @@ void ResourceCache::dump(const char* p_file,bool p_short) { memdelete(f); } + lock->read_unlock(); + #endif } diff --git a/core/resource.h b/core/resource.h index cb109b3767..11f2c5ee2a 100644 --- a/core/resource.h +++ b/core/resource.h @@ -165,9 +165,12 @@ typedef Ref<Resource> RES; class ResourceCache { friend class Resource; + static RWLock *lock; static HashMap<String,Resource*> resources; friend void unregister_core_types(); static void clear(); +friend void register_core_types(); + static void setup(); public: static void reload_externals(); diff --git a/core/safe_refcount.cpp b/core/safe_refcount.cpp index f0d4fbd610..ede37bbe8a 100644 --- a/core/safe_refcount.cpp +++ b/core/safe_refcount.cpp @@ -76,6 +76,9 @@ uint32_t atomic_decrement( register uint32_t * pw ) { return InterlockedDecrement( (LONG volatile*)pw ); } +uint32_t atomic_increment( register uint32_t * pw ) { + return InterlockedIncrement( (LONG volatile*)pw ); +} #elif defined(__GNUC__) uint32_t atomic_conditional_increment( register uint32_t * pw ) { @@ -95,6 +98,12 @@ uint32_t atomic_decrement( register uint32_t * pw ) { } +uint32_t atomic_increment( register uint32_t * pw ) { + + return __sync_add_and_fetch(pw,1); + +} + #else //no threads supported? #error Must provide atomic functions for this platform or compiler! diff --git a/core/safe_refcount.h b/core/safe_refcount.h index 08bea9d244..6e349d89d8 100644 --- a/core/safe_refcount.h +++ b/core/safe_refcount.h @@ -38,6 +38,7 @@ uint32_t atomic_conditional_increment( register uint32_t * counter ); uint32_t atomic_decrement( register uint32_t * pw ); +uint32_t atomic_increment( register uint32_t * pw ); diff --git a/core/string_db.cpp b/core/string_db.cpp index 471195ceda..be35a44ed1 100644 --- a/core/string_db.cpp +++ b/core/string_db.cpp @@ -41,9 +41,12 @@ StringName _scs_create(const char *p_chr) { } bool StringName::configured=false; +Mutex* StringName::lock=NULL; void StringName::setup() { + lock = Mutex::create(); + ERR_FAIL_COND(configured); for(int i=0;i<STRING_TABLE_LEN;i++) { @@ -54,7 +57,8 @@ void StringName::setup() { void StringName::cleanup() { - _global_lock(); + lock->lock(); + int lost_strings=0; for(int i=0;i<STRING_TABLE_LEN;i++) { @@ -78,7 +82,9 @@ void StringName::cleanup() { if (OS::get_singleton()->is_stdout_verbose() && lost_strings) { print_line("StringName: "+itos(lost_strings)+" unclaimed string names at exit."); } - _global_unlock(); + lock->unlock(); + + memdelete(lock); } void StringName::unref() { @@ -87,7 +93,7 @@ void StringName::unref() { if (_data && _data->refcount.unref()) { - _global_lock(); + lock->lock(); if (_data->prev) { _data->prev->next=_data->next; @@ -103,7 +109,7 @@ void StringName::unref() { } memdelete(_data); - _global_unlock(); + lock->unlock(); } _data=NULL; @@ -186,7 +192,7 @@ StringName::StringName(const char *p_name) { if (!p_name || p_name[0]==0) return; //empty, ignore - _global_lock(); + lock->lock(); uint32_t hash = String::hash(p_name); @@ -206,7 +212,7 @@ StringName::StringName(const char *p_name) { if (_data) { if (_data->refcount.ref()) { // exists - _global_unlock(); + lock->unlock(); return; } else { @@ -226,8 +232,7 @@ StringName::StringName(const char *p_name) { _table[idx]=_data; - _global_unlock(); - + lock->unlock(); } StringName::StringName(const StaticCString& p_static_string) { @@ -238,7 +243,7 @@ StringName::StringName(const StaticCString& p_static_string) { ERR_FAIL_COND( !p_static_string.ptr || !p_static_string.ptr[0]); - _global_lock(); + lock->lock(); uint32_t hash = String::hash(p_static_string.ptr); @@ -258,7 +263,7 @@ StringName::StringName(const StaticCString& p_static_string) { if (_data) { if (_data->refcount.ref()) { // exists - _global_unlock(); + lock->unlock(); return; } else { @@ -278,7 +283,8 @@ StringName::StringName(const StaticCString& p_static_string) { _table[idx]=_data; - _global_unlock(); + lock->unlock(); + } @@ -292,7 +298,7 @@ StringName::StringName(const String& p_name) { if (p_name==String()) return; - _global_lock(); + lock->lock(); uint32_t hash = p_name.hash(); @@ -311,7 +317,7 @@ StringName::StringName(const String& p_name) { if (_data) { if (_data->refcount.ref()) { // exists - _global_unlock(); + lock->unlock(); return; } else { @@ -332,7 +338,7 @@ StringName::StringName(const String& p_name) { _table[idx]->prev=_data; _table[idx]=_data; - _global_unlock(); + lock->unlock(); } @@ -344,7 +350,7 @@ StringName StringName::search(const char *p_name) { if (!p_name[0]) return StringName(); - _global_lock(); + lock->lock(); uint32_t hash = String::hash(p_name); @@ -361,12 +367,13 @@ StringName StringName::search(const char *p_name) { } if (_data && _data->refcount.ref()) { - _global_unlock(); + lock->unlock(); + return StringName(_data); } - _global_unlock(); + lock->unlock(); return StringName(); //does not exist @@ -380,7 +387,7 @@ StringName StringName::search(const CharType *p_name) { if (!p_name[0]) return StringName(); - _global_lock(); + lock->lock(); uint32_t hash = String::hash(p_name); @@ -397,12 +404,12 @@ StringName StringName::search(const CharType *p_name) { } if (_data && _data->refcount.ref()) { - _global_unlock(); + lock->unlock(); return StringName(_data); } - _global_unlock(); + lock->unlock(); return StringName(); //does not exist } @@ -410,7 +417,7 @@ StringName StringName::search(const String &p_name) { ERR_FAIL_COND_V( p_name=="", StringName() ); - _global_lock(); + lock->lock(); uint32_t hash = p_name.hash(); @@ -427,12 +434,12 @@ StringName StringName::search(const String &p_name) { } if (_data && _data->refcount.ref()) { - _global_unlock(); + lock->unlock(); return StringName(_data); } - _global_unlock(); + lock->unlock(); return StringName(); //does not exist } diff --git a/core/string_db.h b/core/string_db.h index fd24159265..a14cdbc7ba 100644 --- a/core/string_db.h +++ b/core/string_db.h @@ -32,7 +32,7 @@ #include "hash_map.h" #include "ustring.h" #include "safe_refcount.h" - +#include "os/mutex.h" /** @author Juan Linietsky <reduzio@gmail.com> */ @@ -83,6 +83,7 @@ class StringName { friend void register_core_types(); friend void unregister_core_types(); + static Mutex *lock; static void setup(); static void cleanup(); static bool configured; diff --git a/core/translation.cpp b/core/translation.cpp index 8e58b45565..302f74a98c 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -799,9 +799,9 @@ static bool is_valid_locale(const String& p_locale) { return false; } -DVector<String> Translation::_get_messages() const { +PoolVector<String> Translation::_get_messages() const { - DVector<String> msgs; + PoolVector<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()) { @@ -814,9 +814,9 @@ DVector<String> Translation::_get_messages() const { return msgs; } -DVector<String> Translation::_get_message_list() const { +PoolVector<String> Translation::_get_message_list() const { - DVector<String> msgs; + PoolVector<String> msgs; msgs.resize(translation_map.size()); int idx=0; for (const Map<StringName, StringName>::Element *E=translation_map.front();E;E=E->next()) { @@ -829,12 +829,12 @@ DVector<String> Translation::_get_message_list() const { } -void Translation::_set_messages(const DVector<String>& p_messages){ +void Translation::_set_messages(const PoolVector<String>& p_messages){ int msg_count=p_messages.size(); ERR_FAIL_COND(msg_count%2); - DVector<String>::Read r = p_messages.read(); + PoolVector<String>::Read r = p_messages.read(); for(int i=0;i<msg_count;i+=2) { @@ -1048,12 +1048,12 @@ TranslationServer *TranslationServer::singleton=NULL; bool TranslationServer::_load_translations(const String& p_from) { if (GlobalConfig::get_singleton()->has(p_from)) { - DVector<String> translations=GlobalConfig::get_singleton()->get(p_from); + PoolVector<String> translations=GlobalConfig::get_singleton()->get(p_from); int tcount=translations.size(); if (tcount) { - DVector<String>::Read r = translations.read(); + PoolVector<String>::Read r = translations.read(); for(int i=0;i<tcount;i++) { diff --git a/core/translation.h b/core/translation.h index 01edc82139..85ab4a229d 100644 --- a/core/translation.h +++ b/core/translation.h @@ -42,10 +42,10 @@ class Translation : public Resource { String locale; Map<StringName, StringName> translation_map; - DVector<String> _get_message_list() const; + PoolVector<String> _get_message_list() const; - DVector<String> _get_messages() const; - void _set_messages(const DVector<String>& p_messages); + PoolVector<String> _get_messages() const; + void _set_messages(const PoolVector<String>& p_messages); protected: static void _bind_methods(); diff --git a/core/variant.cpp b/core/variant.cpp index 19b0ea7129..f2c614e14f 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -842,37 +842,37 @@ bool Variant::is_zero() const { // arrays case RAW_ARRAY: { - return reinterpret_cast<const DVector<uint8_t>*>(_data._mem)->size()==0; + return reinterpret_cast<const PoolVector<uint8_t>*>(_data._mem)->size()==0; } break; case INT_ARRAY: { - return reinterpret_cast<const DVector<int>*>(_data._mem)->size()==0; + return reinterpret_cast<const PoolVector<int>*>(_data._mem)->size()==0; } break; case REAL_ARRAY: { - return reinterpret_cast<const DVector<real_t>*>(_data._mem)->size()==0; + return reinterpret_cast<const PoolVector<real_t>*>(_data._mem)->size()==0; } break; case STRING_ARRAY: { - return reinterpret_cast<const DVector<String>*>(_data._mem)->size()==0; + return reinterpret_cast<const PoolVector<String>*>(_data._mem)->size()==0; } break; case VECTOR2_ARRAY: { - return reinterpret_cast<const DVector<Vector2>*>(_data._mem)->size()==0; + return reinterpret_cast<const PoolVector<Vector2>*>(_data._mem)->size()==0; } break; case VECTOR3_ARRAY: { - return reinterpret_cast<const DVector<Vector3>*>(_data._mem)->size()==0; + return reinterpret_cast<const PoolVector<Vector3>*>(_data._mem)->size()==0; } break; case COLOR_ARRAY: { - return reinterpret_cast<const DVector<Color>*>(_data._mem)->size()==0; + return reinterpret_cast<const PoolVector<Color>*>(_data._mem)->size()==0; } break; default: {} @@ -1070,37 +1070,37 @@ void Variant::reference(const Variant& p_variant) { // arrays case RAW_ARRAY: { - memnew_placement( _data._mem, DVector<uint8_t> ( *reinterpret_cast<const DVector<uint8_t>*>(p_variant._data._mem) ) ); + memnew_placement( _data._mem, PoolVector<uint8_t> ( *reinterpret_cast<const PoolVector<uint8_t>*>(p_variant._data._mem) ) ); } break; case INT_ARRAY: { - memnew_placement( _data._mem, DVector<int> ( *reinterpret_cast<const DVector<int>*>(p_variant._data._mem) ) ); + memnew_placement( _data._mem, PoolVector<int> ( *reinterpret_cast<const PoolVector<int>*>(p_variant._data._mem) ) ); } break; case REAL_ARRAY: { - memnew_placement( _data._mem, DVector<real_t> ( *reinterpret_cast<const DVector<real_t>*>(p_variant._data._mem) ) ); + memnew_placement( _data._mem, PoolVector<real_t> ( *reinterpret_cast<const PoolVector<real_t>*>(p_variant._data._mem) ) ); } break; case STRING_ARRAY: { - memnew_placement( _data._mem, DVector<String> ( *reinterpret_cast<const DVector<String>*>(p_variant._data._mem) ) ); + memnew_placement( _data._mem, PoolVector<String> ( *reinterpret_cast<const PoolVector<String>*>(p_variant._data._mem) ) ); } break; case VECTOR2_ARRAY: { - memnew_placement( _data._mem, DVector<Vector2> ( *reinterpret_cast<const DVector<Vector2>*>(p_variant._data._mem) ) ); + memnew_placement( _data._mem, PoolVector<Vector2> ( *reinterpret_cast<const PoolVector<Vector2>*>(p_variant._data._mem) ) ); } break; case VECTOR3_ARRAY: { - memnew_placement( _data._mem, DVector<Vector3> ( *reinterpret_cast<const DVector<Vector3>*>(p_variant._data._mem) ) ); + memnew_placement( _data._mem, PoolVector<Vector3> ( *reinterpret_cast<const PoolVector<Vector3>*>(p_variant._data._mem) ) ); } break; case COLOR_ARRAY: { - memnew_placement( _data._mem, DVector<Color> ( *reinterpret_cast<const DVector<Color>*>(p_variant._data._mem) ) ); + memnew_placement( _data._mem, PoolVector<Color> ( *reinterpret_cast<const PoolVector<Color>*>(p_variant._data._mem) ) ); } break; default: {} @@ -1198,37 +1198,37 @@ void Variant::clear() { // arrays case RAW_ARRAY: { - reinterpret_cast< DVector<uint8_t>* >(_data._mem)->~DVector<uint8_t>(); + reinterpret_cast< PoolVector<uint8_t>* >(_data._mem)->~PoolVector<uint8_t>(); } break; case INT_ARRAY: { - reinterpret_cast< DVector<int>* >(_data._mem)->~DVector<int>(); + reinterpret_cast< PoolVector<int>* >(_data._mem)->~PoolVector<int>(); } break; case REAL_ARRAY: { - reinterpret_cast< DVector<real_t>* >(_data._mem)->~DVector<real_t>(); + reinterpret_cast< PoolVector<real_t>* >(_data._mem)->~PoolVector<real_t>(); } break; case STRING_ARRAY: { - reinterpret_cast< DVector<String>* >(_data._mem)->~DVector<String>(); + reinterpret_cast< PoolVector<String>* >(_data._mem)->~PoolVector<String>(); } break; case VECTOR2_ARRAY: { - reinterpret_cast< DVector<Vector2>* >(_data._mem)->~DVector<Vector2>(); + reinterpret_cast< PoolVector<Vector2>* >(_data._mem)->~PoolVector<Vector2>(); } break; case VECTOR3_ARRAY: { - reinterpret_cast< DVector<Vector3>* >(_data._mem)->~DVector<Vector3>(); + reinterpret_cast< PoolVector<Vector3>* >(_data._mem)->~PoolVector<Vector3>(); } break; case COLOR_ARRAY: { - reinterpret_cast< DVector<Color>* >(_data._mem)->~DVector<Color>(); + reinterpret_cast< PoolVector<Color>* >(_data._mem)->~PoolVector<Color>(); } break; default: {} /* not needed */ @@ -1578,7 +1578,7 @@ Variant::operator String() const { } break; case VECTOR2_ARRAY: { - DVector<Vector2> vec = operator DVector<Vector2>(); + PoolVector<Vector2> vec = operator PoolVector<Vector2>(); String str("["); for(int i=0;i<vec.size();i++) { @@ -1591,7 +1591,7 @@ Variant::operator String() const { } break; case VECTOR3_ARRAY: { - DVector<Vector3> vec = operator DVector<Vector3>(); + PoolVector<Vector3> vec = operator PoolVector<Vector3>(); String str("["); for(int i=0;i<vec.size();i++) { @@ -1604,7 +1604,7 @@ Variant::operator String() const { } break; case STRING_ARRAY: { - DVector<String> vec = operator DVector<String>(); + PoolVector<String> vec = operator PoolVector<String>(); String str("["); for(int i=0;i<vec.size();i++) { @@ -1617,7 +1617,7 @@ Variant::operator String() const { } break; case INT_ARRAY: { - DVector<int> vec = operator DVector<int>(); + PoolVector<int> vec = operator PoolVector<int>(); String str("["); for(int i=0;i<vec.size();i++) { @@ -1630,7 +1630,7 @@ Variant::operator String() const { } break; case REAL_ARRAY: { - DVector<real_t> vec = operator DVector<real_t>(); + PoolVector<real_t> vec = operator PoolVector<real_t>(); String str("["); for(int i=0;i<vec.size();i++) { @@ -1893,13 +1893,13 @@ inline DA _convert_array_from_variant(const Variant& p_variant) { case Variant::ARRAY: { return _convert_array<DA,Array >( p_variant.operator Array () ); } - case Variant::RAW_ARRAY: { return _convert_array<DA,DVector<uint8_t> >( p_variant.operator DVector<uint8_t> () ); } - case Variant::INT_ARRAY: { return _convert_array<DA,DVector<int> >( p_variant.operator DVector<int> () ); } - case Variant::REAL_ARRAY: { return _convert_array<DA,DVector<real_t> >( p_variant.operator DVector<real_t> () ); } - case Variant::STRING_ARRAY: { return _convert_array<DA,DVector<String> >( p_variant.operator DVector<String> () ); } - case Variant::VECTOR2_ARRAY: { return _convert_array<DA,DVector<Vector2> >( p_variant.operator DVector<Vector2> () ); } - case Variant::VECTOR3_ARRAY: { return _convert_array<DA,DVector<Vector3> >( p_variant.operator DVector<Vector3> () ); } - case Variant::COLOR_ARRAY: { return _convert_array<DA,DVector<Color> >( p_variant.operator DVector<Color>() ); } + case Variant::RAW_ARRAY: { return _convert_array<DA,PoolVector<uint8_t> >( p_variant.operator PoolVector<uint8_t> () ); } + case Variant::INT_ARRAY: { return _convert_array<DA,PoolVector<int> >( p_variant.operator PoolVector<int> () ); } + case Variant::REAL_ARRAY: { return _convert_array<DA,PoolVector<real_t> >( p_variant.operator PoolVector<real_t> () ); } + case Variant::STRING_ARRAY: { return _convert_array<DA,PoolVector<String> >( p_variant.operator PoolVector<String> () ); } + case Variant::VECTOR2_ARRAY: { return _convert_array<DA,PoolVector<Vector2> >( p_variant.operator PoolVector<Vector2> () ); } + case Variant::VECTOR3_ARRAY: { return _convert_array<DA,PoolVector<Vector3> >( p_variant.operator PoolVector<Vector3> () ); } + case Variant::COLOR_ARRAY: { return _convert_array<DA,PoolVector<Color> >( p_variant.operator PoolVector<Color>() ); } default: { return DA(); } } @@ -1914,64 +1914,64 @@ Variant::operator Array() const { return _convert_array_from_variant<Array >(*this); } -Variant::operator DVector<uint8_t>() const { +Variant::operator PoolVector<uint8_t>() const { if (type==RAW_ARRAY) - return *reinterpret_cast<const DVector<uint8_t>* >(_data._mem); + return *reinterpret_cast<const PoolVector<uint8_t>* >(_data._mem); else - return _convert_array_from_variant<DVector<uint8_t> >(*this); + return _convert_array_from_variant<PoolVector<uint8_t> >(*this); } -Variant::operator DVector<int>() const { +Variant::operator PoolVector<int>() const { if (type==INT_ARRAY) - return *reinterpret_cast<const DVector<int>* >(_data._mem); + return *reinterpret_cast<const PoolVector<int>* >(_data._mem); else - return _convert_array_from_variant<DVector<int> >(*this); + return _convert_array_from_variant<PoolVector<int> >(*this); } -Variant::operator DVector<real_t>() const { +Variant::operator PoolVector<real_t>() const { if (type==REAL_ARRAY) - return *reinterpret_cast<const DVector<real_t>* >(_data._mem); + return *reinterpret_cast<const PoolVector<real_t>* >(_data._mem); else - return _convert_array_from_variant<DVector<real_t> >(*this); + return _convert_array_from_variant<PoolVector<real_t> >(*this); } -Variant::operator DVector<String>() const { +Variant::operator PoolVector<String>() const { if (type==STRING_ARRAY) - return *reinterpret_cast<const DVector<String>* >(_data._mem); + return *reinterpret_cast<const PoolVector<String>* >(_data._mem); else - return _convert_array_from_variant<DVector<String> >(*this); + return _convert_array_from_variant<PoolVector<String> >(*this); } -Variant::operator DVector<Vector3>() const { +Variant::operator PoolVector<Vector3>() const { if (type==VECTOR3_ARRAY) - return *reinterpret_cast<const DVector<Vector3>* >(_data._mem); + return *reinterpret_cast<const PoolVector<Vector3>* >(_data._mem); else - return _convert_array_from_variant<DVector<Vector3> >(*this); + return _convert_array_from_variant<PoolVector<Vector3> >(*this); } -Variant::operator DVector<Vector2>() const { +Variant::operator PoolVector<Vector2>() const { if (type==VECTOR2_ARRAY) - return *reinterpret_cast<const DVector<Vector2>* >(_data._mem); + return *reinterpret_cast<const PoolVector<Vector2>* >(_data._mem); else - return _convert_array_from_variant<DVector<Vector2> >(*this); + return _convert_array_from_variant<PoolVector<Vector2> >(*this); } -Variant::operator DVector<Color>() const { +Variant::operator PoolVector<Color>() const { if (type==COLOR_ARRAY) - return *reinterpret_cast<const DVector<Color>* >(_data._mem); + return *reinterpret_cast<const PoolVector<Color>* >(_data._mem); else - return _convert_array_from_variant<DVector<Color> >(*this); + return _convert_array_from_variant<PoolVector<Color> >(*this); } @@ -1990,13 +1990,13 @@ Variant::operator Vector<RID>() const { Variant::operator Vector<Vector2>() const { - DVector<Vector2> from=operator DVector<Vector2>(); + PoolVector<Vector2> from=operator PoolVector<Vector2>(); Vector<Vector2> to; int len=from.size(); if (len==0) return Vector<Vector2>(); to.resize(len); - DVector<Vector2>::Read r = from.read(); + PoolVector<Vector2>::Read r = from.read(); Vector2 *w = &to[0]; for (int i=0;i<len;i++) { @@ -2005,16 +2005,16 @@ Variant::operator Vector<Vector2>() const { return to; } -Variant::operator DVector<Plane>() const { +Variant::operator PoolVector<Plane>() const { Array va= operator Array(); - DVector<Plane> planes; + PoolVector<Plane> planes; int va_size=va.size(); if (va_size==0) return planes; planes.resize(va_size); - DVector<Plane>::Write w = planes.write(); + PoolVector<Plane>::Write w = planes.write(); for(int i=0;i<va_size;i++) w[i]=va[i]; @@ -2022,17 +2022,17 @@ Variant::operator DVector<Plane>() const { return planes; } -Variant::operator DVector<Face3>() const { +Variant::operator PoolVector<Face3>() const { - DVector<Vector3> va= operator DVector<Vector3>(); - DVector<Face3> faces; + PoolVector<Vector3> va= operator PoolVector<Vector3>(); + PoolVector<Face3> faces; int va_size=va.size(); if (va_size==0) return faces; faces.resize(va_size/3); - DVector<Face3>::Write w = faces.write(); - DVector<Vector3>::Read r = va.read(); + PoolVector<Face3>::Write w = faces.write(); + PoolVector<Vector3>::Read r = va.read(); for(int i=0;i<va_size;i++) w[i/3].vertex[i%3]=r[i]; @@ -2072,7 +2072,7 @@ Variant::operator Vector<Variant>() const { Variant::operator Vector<uint8_t>() const { - DVector<uint8_t> from=operator DVector<uint8_t>(); + PoolVector<uint8_t> from=operator PoolVector<uint8_t>(); Vector<uint8_t> to; int len=from.size(); to.resize(len); @@ -2084,7 +2084,7 @@ Variant::operator Vector<uint8_t>() const { } Variant::operator Vector<int>() const { - DVector<int> from=operator DVector<int>(); + PoolVector<int> from=operator PoolVector<int>(); Vector<int> to; int len=from.size(); to.resize(len); @@ -2096,7 +2096,7 @@ Variant::operator Vector<int>() const { } Variant::operator Vector<real_t>() const { - DVector<real_t> from=operator DVector<real_t>(); + PoolVector<real_t> from=operator PoolVector<real_t>(); Vector<real_t> to; int len=from.size(); to.resize(len); @@ -2109,7 +2109,7 @@ Variant::operator Vector<real_t>() const { Variant::operator Vector<String>() const { - DVector<String> from=operator DVector<String>(); + PoolVector<String> from=operator PoolVector<String>(); Vector<String> to; int len=from.size(); to.resize(len); @@ -2122,13 +2122,13 @@ Variant::operator Vector<String>() const { } Variant::operator Vector<Vector3>() const { - DVector<Vector3> from=operator DVector<Vector3>(); + PoolVector<Vector3> from=operator PoolVector<Vector3>(); Vector<Vector3> to; int len=from.size(); if (len==0) return Vector<Vector3>(); to.resize(len); - DVector<Vector3>::Read r = from.read(); + PoolVector<Vector3>::Read r = from.read(); Vector3 *w = &to[0]; for (int i=0;i<len;i++) { @@ -2139,13 +2139,13 @@ Variant::operator Vector<Vector3>() const { } Variant::operator Vector<Color>() const { - DVector<Color> from=operator DVector<Color>(); + PoolVector<Color> from=operator PoolVector<Color>(); Vector<Color> to; int len=from.size(); if (len==0) return Vector<Color>(); to.resize(len); - DVector<Color>::Read r = from.read(); + PoolVector<Color>::Read r = from.read(); Color *w = &to[0]; for (int i=0;i<len;i++) { @@ -2167,7 +2167,7 @@ Variant::operator IP_Address() const { if (type==REAL_ARRAY || type==INT_ARRAY || type==RAW_ARRAY) { - DVector<int> addr=operator DVector<int>(); + PoolVector<int> addr=operator PoolVector<int>(); if (addr.size()==4) { return IP_Address(addr.get(0),addr.get(1),addr.get(2),addr.get(3)); } @@ -2418,7 +2418,7 @@ Variant::Variant(const Array& p_array) { } -Variant::Variant(const DVector<Plane>& p_array) { +Variant::Variant(const PoolVector<Plane>& p_array) { type=ARRAY; @@ -2467,11 +2467,11 @@ Variant::Variant(const Vector<Vector2>& p_array) { type=NIL; - DVector<Vector2> v; + PoolVector<Vector2> v; int len=p_array.size(); if (len>0) { v.resize(len); - DVector<Vector2>::Write w = v.write(); + PoolVector<Vector2>::Write w = v.write(); const Vector2 *r = p_array.ptr(); for (int i=0;i<len;i++) @@ -2481,59 +2481,59 @@ Variant::Variant(const Vector<Vector2>& p_array) { } -Variant::Variant(const DVector<uint8_t>& p_raw_array) { +Variant::Variant(const PoolVector<uint8_t>& p_raw_array) { type=RAW_ARRAY; - memnew_placement( _data._mem, DVector<uint8_t>(p_raw_array) ); + memnew_placement( _data._mem, PoolVector<uint8_t>(p_raw_array) ); } -Variant::Variant(const DVector<int>& p_int_array) { +Variant::Variant(const PoolVector<int>& p_int_array) { type=INT_ARRAY; - memnew_placement( _data._mem, DVector<int>(p_int_array) ); + memnew_placement( _data._mem, PoolVector<int>(p_int_array) ); } -Variant::Variant(const DVector<real_t>& p_real_array) { +Variant::Variant(const PoolVector<real_t>& p_real_array) { type=REAL_ARRAY; - memnew_placement( _data._mem, DVector<real_t>(p_real_array) ); + memnew_placement( _data._mem, PoolVector<real_t>(p_real_array) ); } -Variant::Variant(const DVector<String>& p_string_array) { +Variant::Variant(const PoolVector<String>& p_string_array) { type=STRING_ARRAY; - memnew_placement( _data._mem, DVector<String>(p_string_array) ); + memnew_placement( _data._mem, PoolVector<String>(p_string_array) ); } -Variant::Variant(const DVector<Vector3>& p_vector3_array) { +Variant::Variant(const PoolVector<Vector3>& p_vector3_array) { type=VECTOR3_ARRAY; - memnew_placement( _data._mem, DVector<Vector3>(p_vector3_array) ); + memnew_placement( _data._mem, PoolVector<Vector3>(p_vector3_array) ); } -Variant::Variant(const DVector<Vector2>& p_vector2_array) { +Variant::Variant(const PoolVector<Vector2>& p_vector2_array) { type=VECTOR2_ARRAY; - memnew_placement( _data._mem, DVector<Vector2>(p_vector2_array) ); + memnew_placement( _data._mem, PoolVector<Vector2>(p_vector2_array) ); } -Variant::Variant(const DVector<Color>& p_color_array) { +Variant::Variant(const PoolVector<Color>& p_color_array) { type=COLOR_ARRAY; - memnew_placement( _data._mem, DVector<Color>(p_color_array) ); + memnew_placement( _data._mem, PoolVector<Color>(p_color_array) ); } -Variant::Variant(const DVector<Face3>& p_face_array) { +Variant::Variant(const PoolVector<Face3>& p_face_array) { - DVector<Vector3> vertices; + PoolVector<Vector3> vertices; int face_count=p_face_array.size(); vertices.resize(face_count*3); if (face_count) { - DVector<Face3>::Read r = p_face_array.read(); - DVector<Vector3>::Write w = vertices.write(); + PoolVector<Face3>::Read r = p_face_array.read(); + PoolVector<Vector3>::Write w = vertices.write(); for(int i=0;i<face_count;i++) { @@ -2541,8 +2541,8 @@ Variant::Variant(const DVector<Face3>& p_face_array) { w[i*3+j]=r[i].vertex[j]; } - r=DVector<Face3>::Read(); - w=DVector<Vector3>::Write(); + r=PoolVector<Face3>::Read(); + w=PoolVector<Vector3>::Write(); } @@ -2567,7 +2567,7 @@ Variant::Variant(const Vector<Variant>& p_array) { Variant::Variant(const Vector<uint8_t>& p_array) { type=NIL; - DVector<uint8_t> v; + PoolVector<uint8_t> v; int len=p_array.size(); v.resize(len); for (int i=0;i<len;i++) @@ -2578,7 +2578,7 @@ Variant::Variant(const Vector<uint8_t>& p_array) { Variant::Variant(const Vector<int>& p_array) { type=NIL; - DVector<int> v; + PoolVector<int> v; int len=p_array.size(); v.resize(len); for (int i=0;i<len;i++) @@ -2589,7 +2589,7 @@ Variant::Variant(const Vector<int>& p_array) { Variant::Variant(const Vector<real_t>& p_array) { type=NIL; - DVector<real_t> v; + PoolVector<real_t> v; int len=p_array.size(); v.resize(len); for (int i=0;i<len;i++) @@ -2600,7 +2600,7 @@ Variant::Variant(const Vector<real_t>& p_array) { Variant::Variant(const Vector<String>& p_array) { type=NIL; - DVector<String> v; + PoolVector<String> v; int len=p_array.size(); v.resize(len); for (int i=0;i<len;i++) @@ -2611,11 +2611,11 @@ Variant::Variant(const Vector<String>& p_array) { Variant::Variant(const Vector<Vector3>& p_array) { type=NIL; - DVector<Vector3> v; + PoolVector<Vector3> v; int len=p_array.size(); if (len>0) { v.resize(len); - DVector<Vector3>::Write w = v.write(); + PoolVector<Vector3>::Write w = v.write(); const Vector3 *r = p_array.ptr(); for (int i=0;i<len;i++) @@ -2627,7 +2627,7 @@ Variant::Variant(const Vector<Vector3>& p_array) { Variant::Variant(const Vector<Color>& p_array) { type=NIL; - DVector<Color> v; + PoolVector<Color> v; int len=p_array.size(); v.resize(len); for (int i=0;i<len;i++) @@ -2826,27 +2826,27 @@ uint32_t Variant::hash() const { } break; case RAW_ARRAY: { - const DVector<uint8_t>& arr = *reinterpret_cast<const DVector<uint8_t>* >(_data._mem); + const PoolVector<uint8_t>& arr = *reinterpret_cast<const PoolVector<uint8_t>* >(_data._mem); int len = arr.size(); - DVector<uint8_t>::Read r = arr.read(); + PoolVector<uint8_t>::Read r = arr.read(); return hash_djb2_buffer((uint8_t*)&r[0],len); } break; case INT_ARRAY: { - const DVector<int>& arr = *reinterpret_cast<const DVector<int>* >(_data._mem); + const PoolVector<int>& arr = *reinterpret_cast<const PoolVector<int>* >(_data._mem); int len = arr.size(); - DVector<int>::Read r = arr.read(); + PoolVector<int>::Read r = arr.read(); return hash_djb2_buffer((uint8_t*)&r[0],len*sizeof(int)); } break; case REAL_ARRAY: { - const DVector<real_t>& arr = *reinterpret_cast<const DVector<real_t>* >(_data._mem); + const PoolVector<real_t>& arr = *reinterpret_cast<const PoolVector<real_t>* >(_data._mem); int len = arr.size(); - DVector<real_t>::Read r = arr.read(); + PoolVector<real_t>::Read r = arr.read(); return hash_djb2_buffer((uint8_t*)&r[0],len*sizeof(real_t)); @@ -2854,9 +2854,9 @@ uint32_t Variant::hash() const { case STRING_ARRAY: { uint32_t hash=5831; - const DVector<String>& arr = *reinterpret_cast<const DVector<String>* >(_data._mem); + const PoolVector<String>& arr = *reinterpret_cast<const PoolVector<String>* >(_data._mem); int len = arr.size(); - DVector<String>::Read r = arr.read(); + PoolVector<String>::Read r = arr.read(); for(int i=0;i<len;i++) { hash = hash_djb2_one_32(r[i].hash(),hash); @@ -2867,9 +2867,9 @@ uint32_t Variant::hash() const { case VECTOR2_ARRAY: { uint32_t hash=5831; - const DVector<Vector2>& arr = *reinterpret_cast<const DVector<Vector2>* >(_data._mem); + const PoolVector<Vector2>& arr = *reinterpret_cast<const PoolVector<Vector2>* >(_data._mem); int len = arr.size(); - DVector<Vector2>::Read r = arr.read(); + PoolVector<Vector2>::Read r = arr.read(); for(int i=0;i<len;i++) { hash = hash_djb2_one_float(r[i].x,hash); @@ -2882,9 +2882,9 @@ uint32_t Variant::hash() const { case VECTOR3_ARRAY: { uint32_t hash=5831; - const DVector<Vector3>& arr = *reinterpret_cast<const DVector<Vector3>* >(_data._mem); + const PoolVector<Vector3>& arr = *reinterpret_cast<const PoolVector<Vector3>* >(_data._mem); int len = arr.size(); - DVector<Vector3>::Read r = arr.read(); + PoolVector<Vector3>::Read r = arr.read(); for(int i=0;i<len;i++) { hash = hash_djb2_one_float(r[i].x,hash); @@ -2898,9 +2898,9 @@ uint32_t Variant::hash() const { case COLOR_ARRAY: { uint32_t hash=5831; - const DVector<Color>& arr = *reinterpret_cast<const DVector<Color>* >(_data._mem); + const PoolVector<Color>& arr = *reinterpret_cast<const PoolVector<Color>* >(_data._mem); int len = arr.size(); - DVector<Color>::Read r = arr.read(); + PoolVector<Color>::Read r = arr.read(); for(int i=0;i<len;i++) { hash = hash_djb2_one_float(r[i].r,hash); diff --git a/core/variant.h b/core/variant.h index f4bb3b6c8b..a2b9a88b3e 100644 --- a/core/variant.h +++ b/core/variant.h @@ -63,13 +63,13 @@ struct PropertyInfo; struct MethodInfo; -typedef DVector<uint8_t> ByteArray; -typedef DVector<int> IntArray; -typedef DVector<real_t> RealArray; -typedef DVector<String> StringArray; -typedef DVector<Vector2> Vector2Array; -typedef DVector<Vector3> Vector3Array; -typedef DVector<Color> ColorArray; +typedef PoolVector<uint8_t> ByteArray; +typedef PoolVector<int> IntArray; +typedef PoolVector<real_t> RealArray; +typedef PoolVector<String> StringArray; +typedef PoolVector<Vector2> Vector2Array; +typedef PoolVector<Vector3> Vector3Array; +typedef PoolVector<Color> ColorArray; class Variant { public: @@ -227,14 +227,14 @@ public: operator Dictionary() const; operator Array() const; - operator DVector<uint8_t>() const; - operator DVector<int>() const; - operator DVector<real_t>() const; - operator DVector<String>() const; - operator DVector<Vector3>() const; - operator DVector<Color>() const; - operator DVector<Plane>() const; - operator DVector<Face3>() 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; @@ -246,7 +246,7 @@ public: operator Vector<Color>() const; operator Vector<RID>() const; operator Vector<Vector2>() const; - operator DVector<Vector2>() const; + operator PoolVector<Vector2>() const; operator Vector<Plane>() const; // some core type enums to convert to @@ -295,14 +295,14 @@ public: Variant(const Dictionary& p_dictionary); Variant(const Array& p_array); - Variant(const DVector<Plane>& p_array); // helper - Variant(const DVector<uint8_t>& p_raw_array); - Variant(const DVector<int>& p_int_array); - Variant(const DVector<real_t>& p_real_array); - Variant(const DVector<String>& p_string_array); - Variant(const DVector<Vector3>& p_vector3_array); - Variant(const DVector<Color>& p_color_array); - Variant(const DVector<Face3>& p_face_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<Variant>& p_array); @@ -315,7 +315,7 @@ public: Variant(const Vector<Plane>& p_array); // helper Variant(const Vector<RID>& p_array); // helper Variant(const Vector<Vector2>& p_array); // helper - Variant(const DVector<Vector2>& p_array); // helper + Variant(const PoolVector<Vector2>& p_array); // helper Variant(const IP_Address& p_address); diff --git a/core/variant_call.cpp b/core/variant_call.cpp index cedf21b377..a9adc744b6 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -305,7 +305,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var retval.resize(len); ByteArray::Write w = retval.write(); copymem(w.ptr(), charstr.ptr(), len); - w = DVector<uint8_t>::Write(); + w = PoolVector<uint8_t>::Write(); r_ret = retval; } @@ -320,7 +320,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var retval.resize(len); ByteArray::Write w = retval.write(); copymem(w.ptr(), charstr.ptr(), len); - w = DVector<uint8_t>::Write(); + w = PoolVector<uint8_t>::Write(); r_ret = retval; } diff --git a/core/variant_op.cpp b/core/variant_op.cpp index 94a2ea9977..a8495a4913 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -186,16 +186,16 @@ case m_name: { \ r_valid=false;\ return;\ }\ - const DVector<m_type> &array_a=*reinterpret_cast<const DVector<m_type> *>(p_a._data._mem);\ - const DVector<m_type> &array_b=*reinterpret_cast<const DVector<m_type> *>(p_b._data._mem);\ + 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);\ \ int a_len = array_a.size();\ if (a_len m_opa array_b.size()){\ _RETURN( m_ret_s);\ }else {\ \ - DVector<m_type>::Read ra = array_a.read();\ - DVector<m_type>::Read rb = array_b.read();\ + PoolVector<m_type>::Read ra = array_a.read();\ + PoolVector<m_type>::Read rb = array_b.read();\ \ for(int i=0;i<a_len;i++) {\ if (ra[i] m_opb rb[i])\ @@ -212,9 +212,9 @@ case m_name: { \ r_valid=false;\ _RETURN( NIL);\ }\ - const DVector<m_type> &array_a=*reinterpret_cast<const DVector<m_type> *>(p_a._data._mem);\ - const DVector<m_type> &array_b=*reinterpret_cast<const DVector<m_type> *>(p_b._data._mem);\ - DVector<m_type> sum = array_a;\ + 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 );\ } @@ -1049,10 +1049,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, DVector<dv_type>, if(skip_cond) return;, arr->set(index, p_value);return) + DEFAULT_OP_ARRAY_CMD(m_name, PoolVector<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 DVector<dv_type>, ;, return arr->get(index)) + DEFAULT_OP_ARRAY_CMD(m_name, const PoolVector<dv_type>, ;, return arr->get(index)) void Variant::set(const Variant& p_index, const Variant& p_value, bool *r_valid) { @@ -2561,10 +2561,10 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const { if (p_index.get_type()==Variant::INT || p_index.get_type()==Variant::REAL) { int index = p_index; - const DVector<uint8_t> *arr=reinterpret_cast<const DVector<uint8_t>* >(_data._mem); + const PoolVector<uint8_t> *arr=reinterpret_cast<const PoolVector<uint8_t>* >(_data._mem); int l=arr->size(); if (l) { - DVector<uint8_t>::Read r = arr->read(); + PoolVector<uint8_t>::Read r = arr->read(); for(int i=0;i<l;i++) { if (r[i]==index) return true; @@ -2580,10 +2580,10 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const { if (p_index.get_type()==Variant::INT || p_index.get_type()==Variant::REAL) { int index = p_index; - const DVector<int> *arr=reinterpret_cast<const DVector<int>* >(_data._mem); + const PoolVector<int> *arr=reinterpret_cast<const PoolVector<int>* >(_data._mem); int l=arr->size(); if (l) { - DVector<int>::Read r = arr->read(); + PoolVector<int>::Read r = arr->read(); for(int i=0;i<l;i++) { if (r[i]==index) return true; @@ -2599,10 +2599,10 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const { if (p_index.get_type()==Variant::INT || p_index.get_type()==Variant::REAL) { real_t index = p_index; - const DVector<real_t> *arr=reinterpret_cast<const DVector<real_t>* >(_data._mem); + const PoolVector<real_t> *arr=reinterpret_cast<const PoolVector<real_t>* >(_data._mem); int l=arr->size(); if (l) { - DVector<real_t>::Read r = arr->read(); + PoolVector<real_t>::Read r = arr->read(); for(int i=0;i<l;i++) { if (r[i]==index) return true; @@ -2618,11 +2618,11 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const { if (p_index.get_type()==Variant::STRING) { String index = p_index; - const DVector<String> *arr=reinterpret_cast<const DVector<String>* >(_data._mem); + const PoolVector<String> *arr=reinterpret_cast<const PoolVector<String>* >(_data._mem); int l=arr->size(); if (l) { - DVector<String>::Read r = arr->read(); + PoolVector<String>::Read r = arr->read(); for(int i=0;i<l;i++) { if (r[i]==index) return true; @@ -2638,11 +2638,11 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const { if (p_index.get_type()==Variant::VECTOR2) { Vector2 index = p_index; - const DVector<Vector2> *arr=reinterpret_cast<const DVector<Vector2>* >(_data._mem); + const PoolVector<Vector2> *arr=reinterpret_cast<const PoolVector<Vector2>* >(_data._mem); int l=arr->size(); if (l) { - DVector<Vector2>::Read r = arr->read(); + PoolVector<Vector2>::Read r = arr->read(); for(int i=0;i<l;i++) { if (r[i]==index) return true; @@ -2658,11 +2658,11 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const { if (p_index.get_type()==Variant::VECTOR3) { Vector3 index = p_index; - const DVector<Vector3> *arr=reinterpret_cast<const DVector<Vector3>* >(_data._mem); + const PoolVector<Vector3> *arr=reinterpret_cast<const PoolVector<Vector3>* >(_data._mem); int l=arr->size(); if (l) { - DVector<Vector3>::Read r = arr->read(); + PoolVector<Vector3>::Read r = arr->read(); for(int i=0;i<l;i++) { if (r[i]==index) return true; @@ -2679,12 +2679,12 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const { if (p_index.get_type()==Variant::COLOR) { Color index = p_index; - const DVector<Color> *arr=reinterpret_cast<const DVector<Color>* >(_data._mem); + const PoolVector<Color> *arr=reinterpret_cast<const PoolVector<Color>* >(_data._mem); int l=arr->size(); if (l) { - DVector<Color>::Read r = arr->read(); + PoolVector<Color>::Read r = arr->read(); for(int i=0;i<l;i++) { if (r[i]==index) return true; @@ -2992,7 +2992,7 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const { return true; } break; case RAW_ARRAY: { - const DVector<uint8_t> *arr=reinterpret_cast<const DVector<uint8_t>*>(_data._mem); + const PoolVector<uint8_t> *arr=reinterpret_cast<const PoolVector<uint8_t>*>(_data._mem); if (arr->size()==0) return false; r_iter=0; @@ -3000,7 +3000,7 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const { } break; case INT_ARRAY: { - const DVector<int> *arr=reinterpret_cast<const DVector<int>*>(_data._mem); + const PoolVector<int> *arr=reinterpret_cast<const PoolVector<int>*>(_data._mem); if (arr->size()==0) return false; r_iter=0; @@ -3008,7 +3008,7 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const { } break; case REAL_ARRAY: { - const DVector<real_t> *arr=reinterpret_cast<const DVector<real_t>*>(_data._mem); + const PoolVector<real_t> *arr=reinterpret_cast<const PoolVector<real_t>*>(_data._mem); if (arr->size()==0) return false; r_iter=0; @@ -3016,7 +3016,7 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const { } break; case STRING_ARRAY: { - const DVector<String> *arr=reinterpret_cast<const DVector<String>*>(_data._mem); + const PoolVector<String> *arr=reinterpret_cast<const PoolVector<String>*>(_data._mem); if (arr->size()==0) return false; r_iter=0; @@ -3024,7 +3024,7 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const { } break; case VECTOR2_ARRAY: { - const DVector<Vector2> *arr=reinterpret_cast<const DVector<Vector2>*>(_data._mem); + const PoolVector<Vector2> *arr=reinterpret_cast<const PoolVector<Vector2>*>(_data._mem); if (arr->size()==0) return false; r_iter=0; @@ -3032,7 +3032,7 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const { } break; case VECTOR3_ARRAY: { - const DVector<Vector3> *arr=reinterpret_cast<const DVector<Vector3>*>(_data._mem); + const PoolVector<Vector3> *arr=reinterpret_cast<const PoolVector<Vector3>*>(_data._mem); if (arr->size()==0) return false; r_iter=0; @@ -3040,7 +3040,7 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const { } break; case COLOR_ARRAY: { - const DVector<Color> *arr=reinterpret_cast<const DVector<Color>*>(_data._mem); + const PoolVector<Color> *arr=reinterpret_cast<const PoolVector<Color>*>(_data._mem); if (arr->size()==0) return false; r_iter=0; @@ -3123,7 +3123,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const { return true; } break; case RAW_ARRAY: { - const DVector<uint8_t> *arr=reinterpret_cast<const DVector<uint8_t>*>(_data._mem); + const PoolVector<uint8_t> *arr=reinterpret_cast<const PoolVector<uint8_t>*>(_data._mem); int idx=r_iter; idx++; if (idx>=arr->size()) @@ -3133,7 +3133,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const { } break; case INT_ARRAY: { - const DVector<int> *arr=reinterpret_cast<const DVector<int>*>(_data._mem); + const PoolVector<int> *arr=reinterpret_cast<const PoolVector<int>*>(_data._mem); int idx=r_iter; idx++; if (idx>=arr->size()) @@ -3143,7 +3143,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const { } break; case REAL_ARRAY: { - const DVector<real_t> *arr=reinterpret_cast<const DVector<real_t>*>(_data._mem); + const PoolVector<real_t> *arr=reinterpret_cast<const PoolVector<real_t>*>(_data._mem); int idx=r_iter; idx++; if (idx>=arr->size()) @@ -3153,7 +3153,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const { } break; case STRING_ARRAY: { - const DVector<String> *arr=reinterpret_cast<const DVector<String>*>(_data._mem); + const PoolVector<String> *arr=reinterpret_cast<const PoolVector<String>*>(_data._mem); int idx=r_iter; idx++; if (idx>=arr->size()) @@ -3163,7 +3163,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const { } break; case VECTOR2_ARRAY: { - const DVector<Vector2> *arr=reinterpret_cast<const DVector<Vector2>*>(_data._mem); + const PoolVector<Vector2> *arr=reinterpret_cast<const PoolVector<Vector2>*>(_data._mem); int idx=r_iter; idx++; if (idx>=arr->size()) @@ -3173,7 +3173,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const { } break; case VECTOR3_ARRAY: { - const DVector<Vector3> *arr=reinterpret_cast<const DVector<Vector3>*>(_data._mem); + const PoolVector<Vector3> *arr=reinterpret_cast<const PoolVector<Vector3>*>(_data._mem); int idx=r_iter; idx++; if (idx>=arr->size()) @@ -3183,7 +3183,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const { } break; case COLOR_ARRAY: { - const DVector<Color> *arr=reinterpret_cast<const DVector<Color>*>(_data._mem); + const PoolVector<Color> *arr=reinterpret_cast<const PoolVector<Color>*>(_data._mem); int idx=r_iter; idx++; if (idx>=arr->size()) @@ -3255,7 +3255,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const { return arr->get(idx); } break; case RAW_ARRAY: { - const DVector<uint8_t> *arr=reinterpret_cast<const DVector<uint8_t>*>(_data._mem); + const PoolVector<uint8_t> *arr=reinterpret_cast<const PoolVector<uint8_t>*>(_data._mem); int idx=r_iter; #ifdef DEBUG_ENABLED if (idx<0 || idx>=arr->size()) { @@ -3266,7 +3266,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const { return arr->get(idx); } break; case INT_ARRAY: { - const DVector<int> *arr=reinterpret_cast<const DVector<int>*>(_data._mem); + const PoolVector<int> *arr=reinterpret_cast<const PoolVector<int>*>(_data._mem); int idx=r_iter; #ifdef DEBUG_ENABLED if (idx<0 || idx>=arr->size()) { @@ -3277,7 +3277,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const { return arr->get(idx); } break; case REAL_ARRAY: { - const DVector<real_t> *arr=reinterpret_cast<const DVector<real_t>*>(_data._mem); + const PoolVector<real_t> *arr=reinterpret_cast<const PoolVector<real_t>*>(_data._mem); int idx=r_iter; #ifdef DEBUG_ENABLED if (idx<0 || idx>=arr->size()) { @@ -3288,7 +3288,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const { return arr->get(idx); } break; case STRING_ARRAY: { - const DVector<String> *arr=reinterpret_cast<const DVector<String>*>(_data._mem); + const PoolVector<String> *arr=reinterpret_cast<const PoolVector<String>*>(_data._mem); int idx=r_iter; #ifdef DEBUG_ENABLED if (idx<0 || idx>=arr->size()) { @@ -3300,7 +3300,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const { } break; case VECTOR2_ARRAY: { - const DVector<Vector2> *arr=reinterpret_cast<const DVector<Vector2>*>(_data._mem); + const PoolVector<Vector2> *arr=reinterpret_cast<const PoolVector<Vector2>*>(_data._mem); int idx=r_iter; #ifdef DEBUG_ENABLED if (idx<0 || idx>=arr->size()) { @@ -3312,7 +3312,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const { } break; case VECTOR3_ARRAY: { - const DVector<Vector3> *arr=reinterpret_cast<const DVector<Vector3>*>(_data._mem); + const PoolVector<Vector3> *arr=reinterpret_cast<const PoolVector<Vector3>*>(_data._mem); int idx=r_iter; #ifdef DEBUG_ENABLED if (idx<0 || idx>=arr->size()) { @@ -3324,7 +3324,7 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const { } break; case COLOR_ARRAY: { - const DVector<Color> *arr=reinterpret_cast<const DVector<Color>*>(_data._mem); + const PoolVector<Color> *arr=reinterpret_cast<const PoolVector<Color>*>(_data._mem); int idx=r_iter; #ifdef DEBUG_ENABLED if (idx<0 || idx>=arr->size()) { @@ -3495,20 +3495,20 @@ void Variant::interpolate(const Variant& a, const Variant& b, float c,Variant &r case REAL_ARRAY:{ r_dst=a; } return; case STRING_ARRAY:{ r_dst=a; } return; case VECTOR2_ARRAY:{ - const DVector<Vector2> *arr_a=reinterpret_cast<const DVector<Vector2>* >(a._data._mem); - const DVector<Vector2> *arr_b=reinterpret_cast<const DVector<Vector2>* >(b._data._mem); + 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); int sz = arr_a->size(); if (sz==0 || arr_b->size()!=sz) { r_dst=a; } else { - DVector<Vector2> v; + PoolVector<Vector2> v; v.resize(sz); { - DVector<Vector2>::Write vw=v.write(); - DVector<Vector2>::Read ar=arr_a->read(); - DVector<Vector2>::Read br=arr_b->read(); + PoolVector<Vector2>::Write vw=v.write(); + PoolVector<Vector2>::Read ar=arr_a->read(); + PoolVector<Vector2>::Read br=arr_b->read(); for(int i=0;i<sz;i++) { vw[i]=ar[i].linear_interpolate(br[i],c); @@ -3523,20 +3523,20 @@ void Variant::interpolate(const Variant& a, const Variant& b, float c,Variant &r case VECTOR3_ARRAY:{ - const DVector<Vector3> *arr_a=reinterpret_cast<const DVector<Vector3>* >(a._data._mem); - const DVector<Vector3> *arr_b=reinterpret_cast<const DVector<Vector3>* >(b._data._mem); + 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); int sz = arr_a->size(); if (sz==0 || arr_b->size()!=sz) { r_dst=a; } else { - DVector<Vector3> v; + PoolVector<Vector3> v; v.resize(sz); { - DVector<Vector3>::Write vw=v.write(); - DVector<Vector3>::Read ar=arr_a->read(); - DVector<Vector3>::Read br=arr_b->read(); + PoolVector<Vector3>::Write vw=v.write(); + PoolVector<Vector3>::Read ar=arr_a->read(); + PoolVector<Vector3>::Read br=arr_b->read(); 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 597e975873..325c998ec5 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -802,7 +802,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in int len = Image::get_image_data_size(width,height,format,mipmaps); - DVector<uint8_t> buffer; + PoolVector<uint8_t> buffer; buffer.resize(len); if (buffer.size()!=len) { @@ -810,7 +810,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in } { - DVector<uint8_t>::Write w=buffer.write(); + PoolVector<uint8_t>::Write w=buffer.write(); for(int i=0;i<len;i++) { get_token(p_stream,token,line,r_err_str); @@ -1156,11 +1156,11 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in if (err) return err; - DVector<uint8_t> arr; + PoolVector<uint8_t> arr; { int len=args.size(); arr.resize(len); - DVector<uint8_t>::Write w = arr.write(); + PoolVector<uint8_t>::Write w = arr.write(); for(int i=0;i<len;i++) { w[i]=args[i]; } @@ -1177,11 +1177,11 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in if (err) return err; - DVector<int> arr; + PoolVector<int> arr; { int len=args.size(); arr.resize(len); - DVector<int>::Write w = arr.write(); + PoolVector<int>::Write w = arr.write(); for(int i=0;i<len;i++) { w[i]=int(args[i]); } @@ -1198,11 +1198,11 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in if (err) return err; - DVector<float> arr; + PoolVector<float> arr; { int len=args.size(); arr.resize(len); - DVector<float>::Write w = arr.write(); + PoolVector<float>::Write w = arr.write(); for(int i=0;i<len;i++) { w[i]=args[i]; } @@ -1251,11 +1251,11 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in } - DVector<String> arr; + PoolVector<String> arr; { int len=cs.size(); arr.resize(len); - DVector<String>::Write w = arr.write(); + PoolVector<String>::Write w = arr.write(); for(int i=0;i<len;i++) { w[i]=cs[i]; } @@ -1273,11 +1273,11 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in if (err) return err; - DVector<Vector2> arr; + PoolVector<Vector2> arr; { int len=args.size()/2; arr.resize(len); - DVector<Vector2>::Write w = arr.write(); + PoolVector<Vector2>::Write w = arr.write(); for(int i=0;i<len;i++) { w[i]=Vector2(args[i*2+0],args[i*2+1]); } @@ -1294,11 +1294,11 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in if (err) return err; - DVector<Vector3> arr; + PoolVector<Vector3> arr; { int len=args.size()/3; arr.resize(len); - DVector<Vector3>::Write w = arr.write(); + PoolVector<Vector3>::Write w = arr.write(); for(int i=0;i<len;i++) { w[i]=Vector3(args[i*3+0],args[i*3+1],args[i*3+2]); } @@ -1315,11 +1315,11 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in if (err) return err; - DVector<Color> arr; + PoolVector<Color> arr; { int len=args.size()/4; arr.resize(len); - DVector<Color>::Write w = arr.write(); + PoolVector<Color>::Write w = arr.write(); 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]); } @@ -1986,9 +1986,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str String s; - DVector<uint8_t> data = img.get_data(); + PoolVector<uint8_t> data = img.get_data(); int len = data.size(); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Read r = data.read(); const uint8_t *ptr=r.ptr();; for (int i=0;i<len;i++) { @@ -2128,9 +2128,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud,"ByteArray( "); String s; - DVector<uint8_t> data = p_variant; + PoolVector<uint8_t> data = p_variant; int len = data.size(); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Read r = data.read(); const uint8_t *ptr=r.ptr();; for (int i=0;i<len;i++) { @@ -2147,9 +2147,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str case Variant::INT_ARRAY: { p_store_string_func(p_store_string_ud,"IntArray( "); - DVector<int> data = p_variant; + PoolVector<int> data = p_variant; int len = data.size(); - DVector<int>::Read r = data.read(); + PoolVector<int>::Read r = data.read(); const int *ptr=r.ptr();; for (int i=0;i<len;i++) { @@ -2167,9 +2167,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str case Variant::REAL_ARRAY: { p_store_string_func(p_store_string_ud,"FloatArray( "); - DVector<real_t> data = p_variant; + PoolVector<real_t> data = p_variant; int len = data.size(); - DVector<real_t>::Read r = data.read(); + PoolVector<real_t>::Read r = data.read(); const real_t *ptr=r.ptr();; for (int i=0;i<len;i++) { @@ -2185,9 +2185,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str case Variant::STRING_ARRAY: { p_store_string_func(p_store_string_ud,"StringArray( "); - DVector<String> data = p_variant; + PoolVector<String> data = p_variant; int len = data.size(); - DVector<String>::Read r = data.read(); + PoolVector<String>::Read r = data.read(); const String *ptr=r.ptr();; String s; //write_string("\n"); @@ -2208,9 +2208,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str case Variant::VECTOR2_ARRAY: { p_store_string_func(p_store_string_ud,"Vector2Array( "); - DVector<Vector2> data = p_variant; + PoolVector<Vector2> data = p_variant; int len = data.size(); - DVector<Vector2>::Read r = data.read(); + PoolVector<Vector2>::Read r = data.read(); const Vector2 *ptr=r.ptr();; for (int i=0;i<len;i++) { @@ -2226,9 +2226,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str case Variant::VECTOR3_ARRAY: { p_store_string_func(p_store_string_ud,"Vector3Array( "); - DVector<Vector3> data = p_variant; + PoolVector<Vector3> data = p_variant; int len = data.size(); - DVector<Vector3>::Read r = data.read(); + PoolVector<Vector3>::Read r = data.read(); const Vector3 *ptr=r.ptr();; for (int i=0;i<len;i++) { @@ -2245,9 +2245,9 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud,"ColorArray( "); - DVector<Color> data = p_variant; + PoolVector<Color> data = p_variant; int len = data.size(); - DVector<Color>::Read r = data.read(); + PoolVector<Color>::Read r = data.read(); const Color *ptr=r.ptr();; for (int i=0;i<len;i++) { diff --git a/core/vector.h b/core/vector.h index 3227561000..3119657cbb 100644 --- a/core/vector.h +++ b/core/vector.h @@ -32,7 +32,7 @@ /** * @class Vector * @author Juan Linietsky - * Vector container. Regular Vector Container. Use with care and for smaller arrays when possible. Use DVector for large arrays. + * Vector container. Regular Vector Container. Use with care and for smaller arrays when possible. Use PoolVector for large arrays. */ #include "os/memory.h" #include "error_macros.h" diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index b49f817188..2673c79232 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -998,7 +998,7 @@ void RasterizerGLES2::texture_set_data(RID p_texture,const Image& p_image,VS::Cu GLenum blit_target = (texture->target == GL_TEXTURE_CUBE_MAP)?_cube_side_enum[p_cube_side]:GL_TEXTURE_2D; texture->data_size=img.get_data().size(); - DVector<uint8_t>::Read read = img.get_data().read(); + PoolVector<uint8_t>::Read read = img.get_data().read(); glActiveTexture(GL_TEXTURE0); glBindTexture(texture->target, texture->tex_id); @@ -1133,7 +1133,7 @@ Image RasterizerGLES2::texture_get_data(RID p_texture,VS::CubeMapSide p_cube_sid ERR_FAIL_COND_V(!texture->active,Image()); ERR_FAIL_COND_V(texture->data_size==0,Image()); - DVector<uint8_t> data; + PoolVector<uint8_t> data; GLenum format,type=GL_UNSIGNED_BYTE; Image::Format fmt; int pixelsize=0; @@ -1235,7 +1235,7 @@ Image RasterizerGLES2::texture_get_data(RID p_texture,VS::CubeMapSide p_cube_sid } data.resize(texture->data_size); - DVector<uint8_t>::Write wb = data.write(); + PoolVector<uint8_t>::Write wb = data.write(); glActiveTexture(GL_TEXTURE0); int ofs=0; @@ -1264,7 +1264,7 @@ Image RasterizerGLES2::texture_get_data(RID p_texture,VS::CubeMapSide p_cube_sid } - wb=DVector<uint8_t>::Write(); + wb=PoolVector<uint8_t>::Write(); Image img(texture->alloc_width,texture->alloc_height,texture->mipmaps,fmt,data); @@ -2103,10 +2103,10 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive, uint8_t *array_ptr=NULL; uint8_t *index_array_ptr=NULL; - DVector<uint8_t> array_pre_vbo; - DVector<uint8_t>::Write vaw; - DVector<uint8_t> index_array_pre_vbo; - DVector<uint8_t>::Write iaw; + PoolVector<uint8_t> array_pre_vbo; + PoolVector<uint8_t>::Write vaw; + PoolVector<uint8_t> index_array_pre_vbo; + PoolVector<uint8_t>::Write iaw; /* create pointers */ if (use_VBO) { @@ -2191,11 +2191,11 @@ Error RasterizerGLES2::_surface_set_arrays(Surface *p_surface, uint8_t *p_mem,ui ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::VECTOR3_ARRAY, ERR_INVALID_PARAMETER ); - DVector<Vector3> array = p_arrays[ai]; + PoolVector<Vector3> array = p_arrays[ai]; ERR_FAIL_COND_V( array.size() != p_surface->array_len, ERR_INVALID_PARAMETER ); - DVector<Vector3>::Read read = array.read(); + PoolVector<Vector3>::Read read = array.read(); const Vector3* src=read.ptr(); // setting vertices means regenerating the AABB @@ -2252,11 +2252,11 @@ Error RasterizerGLES2::_surface_set_arrays(Surface *p_surface, uint8_t *p_mem,ui ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::VECTOR3_ARRAY, ERR_INVALID_PARAMETER ); - DVector<Vector3> array = p_arrays[ai]; + PoolVector<Vector3> array = p_arrays[ai]; ERR_FAIL_COND_V( array.size() != p_surface->array_len, ERR_INVALID_PARAMETER ); - DVector<Vector3>::Read read = array.read(); + PoolVector<Vector3>::Read read = array.read(); const Vector3* src=read.ptr(); // setting vertices means regenerating the AABB @@ -2292,12 +2292,12 @@ Error RasterizerGLES2::_surface_set_arrays(Surface *p_surface, uint8_t *p_mem,ui ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::REAL_ARRAY, ERR_INVALID_PARAMETER ); - DVector<real_t> array = p_arrays[ai]; + PoolVector<real_t> array = p_arrays[ai]; ERR_FAIL_COND_V( array.size() != p_surface->array_len*4, ERR_INVALID_PARAMETER ); - DVector<real_t>::Read read = array.read(); + PoolVector<real_t>::Read read = array.read(); const real_t* src = read.ptr(); if (p_surface->array[VS::ARRAY_TANGENT].datatype==GL_BYTE) { @@ -2337,12 +2337,12 @@ Error RasterizerGLES2::_surface_set_arrays(Surface *p_surface, uint8_t *p_mem,ui ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::COLOR_ARRAY, ERR_INVALID_PARAMETER ); - DVector<Color> array = p_arrays[ai]; + PoolVector<Color> array = p_arrays[ai]; ERR_FAIL_COND_V( array.size() != p_surface->array_len, ERR_INVALID_PARAMETER ); - DVector<Color>::Read read = array.read(); + PoolVector<Color>::Read read = array.read(); const Color* src = read.ptr(); bool alpha=false; @@ -2371,11 +2371,11 @@ Error RasterizerGLES2::_surface_set_arrays(Surface *p_surface, uint8_t *p_mem,ui ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::VECTOR2_ARRAY, ERR_INVALID_PARAMETER ); - DVector<Vector2> array = p_arrays[ai]; + PoolVector<Vector2> array = p_arrays[ai]; ERR_FAIL_COND_V( array.size() != p_surface->array_len , ERR_INVALID_PARAMETER); - DVector<Vector2>::Read read = array.read(); + PoolVector<Vector2>::Read read = array.read(); const Vector2 * src=read.ptr(); float scale=1.0; @@ -2417,12 +2417,12 @@ Error RasterizerGLES2::_surface_set_arrays(Surface *p_surface, uint8_t *p_mem,ui ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::REAL_ARRAY, ERR_INVALID_PARAMETER ); - DVector<real_t> array = p_arrays[ai]; + PoolVector<real_t> array = p_arrays[ai]; ERR_FAIL_COND_V( array.size() != p_surface->array_len*VS::ARRAY_WEIGHTS_SIZE, ERR_INVALID_PARAMETER ); - DVector<real_t>::Read read = array.read(); + PoolVector<real_t>::Read read = array.read(); const real_t * src = read.ptr(); @@ -2460,12 +2460,12 @@ Error RasterizerGLES2::_surface_set_arrays(Surface *p_surface, uint8_t *p_mem,ui ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::REAL_ARRAY, ERR_INVALID_PARAMETER ); - DVector<int> array = p_arrays[ai]; + PoolVector<int> array = p_arrays[ai]; ERR_FAIL_COND_V( array.size() != p_surface->array_len*VS::ARRAY_WEIGHTS_SIZE, ERR_INVALID_PARAMETER ); - DVector<int>::Read read = array.read(); + PoolVector<int>::Read read = array.read(); const int * src = read.ptr(); @@ -2511,13 +2511,13 @@ Error RasterizerGLES2::_surface_set_arrays(Surface *p_surface, uint8_t *p_mem,ui ERR_FAIL_COND_V( p_surface->index_array_len<=0, ERR_INVALID_DATA ); ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::INT_ARRAY, ERR_INVALID_PARAMETER ); - DVector<int> indices = p_arrays[ai]; + PoolVector<int> indices = p_arrays[ai]; ERR_FAIL_COND_V( indices.size() == 0, ERR_INVALID_PARAMETER ); ERR_FAIL_COND_V( indices.size() != p_surface->index_array_len, ERR_INVALID_PARAMETER ); /* determine wether using 16 or 32 bits indices */ - DVector<int>::Read read = indices.read(); + PoolVector<int>::Read read = indices.read(); const int *src=read.ptr(); for (int i=0;i<p_surface->index_array_len;i++) { @@ -2553,18 +2553,18 @@ Error RasterizerGLES2::_surface_set_arrays(Surface *p_surface, uint8_t *p_mem,ui for(int i=0;i<total_bones;i++) p_surface->skeleton_bone_used[i]=false; } - DVector<Vector3> vertices = p_arrays[VS::ARRAY_VERTEX]; - DVector<int> bones = p_arrays[VS::ARRAY_BONES]; - DVector<float> weights = p_arrays[VS::ARRAY_WEIGHTS]; + PoolVector<Vector3> vertices = p_arrays[VS::ARRAY_VERTEX]; + PoolVector<int> bones = p_arrays[VS::ARRAY_BONES]; + PoolVector<float> weights = p_arrays[VS::ARRAY_WEIGHTS]; bool any_valid=false; if (vertices.size() && bones.size()==vertices.size()*4 && weights.size()==bones.size()) { //print_line("MAKING SKELETHONG"); int vs = vertices.size(); - DVector<Vector3>::Read rv =vertices.read(); - DVector<int>::Read rb=bones.read(); - DVector<float>::Read rw=weights.read(); + PoolVector<Vector3>::Read rv =vertices.read(); + PoolVector<int>::Read rb=bones.read(); + PoolVector<float>::Read rw=weights.read(); Vector<bool> first; first.resize(total_bones); @@ -3310,7 +3310,7 @@ Vector3 RasterizerGLES2::particles_get_emission_base_velocity(RID p_particles) c } -void RasterizerGLES2::particles_set_emission_points(RID p_particles, const DVector<Vector3>& p_points) { +void RasterizerGLES2::particles_set_emission_points(RID p_particles, const PoolVector<Vector3>& p_points) { Particles* particles = particles_owner.get( p_particles ); ERR_FAIL_COND(!particles); @@ -3318,10 +3318,10 @@ void RasterizerGLES2::particles_set_emission_points(RID p_particles, const DVect particles->data.emission_points=p_points; } -DVector<Vector3> RasterizerGLES2::particles_get_emission_points(RID p_particles) const { +PoolVector<Vector3> RasterizerGLES2::particles_get_emission_points(RID p_particles) const { Particles* particles = particles_owner.get( p_particles ); - ERR_FAIL_COND_V(!particles,DVector<Vector3>()); + ERR_FAIL_COND_V(!particles,PoolVector<Vector3>()); return particles->data.emission_points; @@ -4304,9 +4304,9 @@ void RasterizerGLES2::begin_frame() { void RasterizerGLES2::capture_viewport(Image* r_capture) { #if 0 - DVector<uint8_t> pixels; + PoolVector<uint8_t> pixels; pixels.resize(viewport.width*viewport.height*3); - DVector<uint8_t>::Write w = pixels.write(); + PoolVector<uint8_t>::Write w = pixels.write(); #ifdef GLEW_ENABLED glReadBuffer(GL_COLOR_ATTACHMENT0); #endif @@ -4318,15 +4318,15 @@ void RasterizerGLES2::capture_viewport(Image* r_capture) { glPixelStorei(GL_PACK_ALIGNMENT, 4); - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); r_capture->create(viewport.width,viewport.height,0,Image::FORMAT_RGB8,pixels); #else - DVector<uint8_t> pixels; + PoolVector<uint8_t> pixels; pixels.resize(viewport.width*viewport.height*4); - DVector<uint8_t>::Write w = pixels.write(); + PoolVector<uint8_t>::Write w = pixels.write(); glPixelStorei(GL_PACK_ALIGNMENT, 4); // uint64_t time = OS::get_singleton()->get_ticks_usec(); @@ -4359,7 +4359,7 @@ void RasterizerGLES2::capture_viewport(Image* r_capture) { } } - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); r_capture->create(viewport.width,viewport.height,0,Image::FORMAT_RGBA8,pixels); //r_capture->flip_y(); @@ -8685,7 +8685,7 @@ RID RasterizerGLES2::canvas_light_occluder_create() { return canvas_occluder_owner.make_rid(co); } -void RasterizerGLES2::canvas_light_occluder_set_polylines(RID p_occluder, const DVector<Vector2>& p_lines) { +void RasterizerGLES2::canvas_light_occluder_set_polylines(RID p_occluder, const PoolVector<Vector2>& p_lines) { CanvasOccluder *co = canvas_occluder_owner.get(p_occluder); ERR_FAIL_COND(!co); @@ -8709,18 +8709,18 @@ void RasterizerGLES2::canvas_light_occluder_set_polylines(RID p_occluder, const - DVector<float> geometry; - DVector<uint16_t> indices; + PoolVector<float> geometry; + PoolVector<uint16_t> indices; int lc = p_lines.size(); geometry.resize(lc*6); indices.resize(lc*3); - DVector<float>::Write vw=geometry.write(); - DVector<uint16_t>::Write iw=indices.write(); + PoolVector<float>::Write vw=geometry.write(); + PoolVector<uint16_t>::Write iw=indices.write(); - DVector<Vector2>::Read lr=p_lines.read(); + PoolVector<Vector2>::Read lr=p_lines.read(); const int POLY_HEIGHT = 16384; diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 5f82e1691b..b5904e09d0 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -4596,10 +4596,10 @@ void RasterizerSceneGLES3::_generate_brdf() { - DVector<uint8_t> brdf; + PoolVector<uint8_t> brdf; brdf.resize(brdf_size*brdf_size*2); - DVector<uint8_t>::Write w = brdf.write(); + PoolVector<uint8_t>::Write w = brdf.write(); for(int i=0;i<brdf_size;i++) { diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 689d7ab8c4..a3c5bf5577 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -670,7 +670,7 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture,const Image& p_image GLenum blit_target = (texture->target == GL_TEXTURE_CUBE_MAP)?_cube_side_enum[p_cube_side]:GL_TEXTURE_2D; texture->data_size=img.get_data().size(); - DVector<uint8_t>::Read read = img.get_data().read(); + PoolVector<uint8_t>::Read read = img.get_data().read(); glActiveTexture(GL_TEXTURE0); glBindTexture(texture->target, texture->tex_id); @@ -831,12 +831,12 @@ Image RasterizerStorageGLES3::texture_get_data(RID p_texture,VS::CubeMapSide p_c #ifdef GLES_OVER_GL - DVector<uint8_t> data; + PoolVector<uint8_t> data; int data_size = Image::get_image_data_size(texture->alloc_width,texture->alloc_height,texture->format,texture->mipmaps>1?-1:0); data.resize(data_size*2); //add some memory at the end, just in case for buggy drivers - DVector<uint8_t>::Write wb = data.write(); + PoolVector<uint8_t>::Write wb = data.write(); glActiveTexture(GL_TEXTURE0); @@ -868,7 +868,7 @@ Image RasterizerStorageGLES3::texture_get_data(RID p_texture,VS::CubeMapSide p_c } - wb=DVector<uint8_t>::Write(); + wb=PoolVector<uint8_t>::Write(); data.resize(data_size); @@ -1848,11 +1848,11 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy } break; case ShaderLanguage::TYPE_IVEC2: { - DVector<int> iv = value; + PoolVector<int> iv = value; int s = iv.size(); GLint *gui = (GLint*)data; - DVector<int>::Read r = iv.read(); + PoolVector<int>::Read r = iv.read(); for(int i=0;i<2;i++) { if (i<s) @@ -1865,11 +1865,11 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy } break; case ShaderLanguage::TYPE_IVEC3: { - DVector<int> iv = value; + PoolVector<int> iv = value; int s = iv.size(); GLint *gui = (GLint*)data; - DVector<int>::Read r = iv.read(); + PoolVector<int>::Read r = iv.read(); for(int i=0;i<3;i++) { if (i<s) @@ -1882,11 +1882,11 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy case ShaderLanguage::TYPE_IVEC4: { - DVector<int> iv = value; + PoolVector<int> iv = value; int s = iv.size(); GLint *gui = (GLint*)data; - DVector<int>::Read r = iv.read(); + PoolVector<int>::Read r = iv.read(); for(int i=0;i<4;i++) { if (i<s) @@ -1905,11 +1905,11 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy } break; case ShaderLanguage::TYPE_UVEC2: { - DVector<int> iv = value; + PoolVector<int> iv = value; int s = iv.size(); GLuint *gui = (GLuint*)data; - DVector<int>::Read r = iv.read(); + PoolVector<int>::Read r = iv.read(); for(int i=0;i<2;i++) { if (i<s) @@ -1920,11 +1920,11 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy } } break; case ShaderLanguage::TYPE_UVEC3: { - DVector<int> iv = value; + PoolVector<int> iv = value; int s = iv.size(); GLuint *gui = (GLuint*)data; - DVector<int>::Read r = iv.read(); + PoolVector<int>::Read r = iv.read(); for(int i=0;i<3;i++) { if (i<s) @@ -1935,11 +1935,11 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy } break; case ShaderLanguage::TYPE_UVEC4: { - DVector<int> iv = value; + PoolVector<int> iv = value; int s = iv.size(); GLuint *gui = (GLuint*)data; - DVector<int>::Read r = iv.read(); + PoolVector<int>::Read r = iv.read(); for(int i=0;i<4;i++) { if (i<s) @@ -2463,9 +2463,9 @@ RID RasterizerStorageGLES3::mesh_create(){ } -void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const DVector<uint8_t>& p_array,int p_vertex_count,const DVector<uint8_t>& p_index_array,int p_index_count,const AABB& p_aabb,const Vector<DVector<uint8_t> >& p_blend_shapes,const Vector<AABB>& p_bone_aabbs){ +void RasterizerStorageGLES3::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){ - DVector<uint8_t> array = p_array; + PoolVector<uint8_t> array = p_array; Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND(!mesh); @@ -2667,12 +2667,12 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P print_line("desired size: "+itos(array_size)+" vcount "+itos(p_vertex_count)+" should be: "+itos(array.size()+p_vertex_count*2)+" but is "+itos(array.size())); if (array.size()!=array_size && array.size()+p_vertex_count*2 == array_size) { //old format, convert - array = DVector<uint8_t>(); + array = PoolVector<uint8_t>(); array.resize( p_array.size()+p_vertex_count*2 ); - DVector<uint8_t>::Write w = array.write(); - DVector<uint8_t>::Read r = p_array.read(); + PoolVector<uint8_t>::Write w = array.write(); + PoolVector<uint8_t>::Read r = p_array.read(); uint16_t *w16 = (uint16_t*)w.ptr(); const uint16_t *r16 = (uint16_t*)r.ptr(); @@ -2739,7 +2739,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P { - DVector<uint8_t>::Read vr = array.read(); + PoolVector<uint8_t>::Read vr = array.read(); glGenBuffers(1,&surface->vertex_id); glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); @@ -2749,7 +2749,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P if (p_format&VS::ARRAY_FORMAT_INDEX) { - DVector<uint8_t>::Read ir = p_index_array.read(); + PoolVector<uint8_t>::Read ir = p_index_array.read(); glGenBuffers(1,&surface->index_id); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,surface->index_id); @@ -2809,7 +2809,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P Surface::MorphTarget mt; - DVector<uint8_t>::Read vr = p_blend_shapes[i].read(); + PoolVector<uint8_t>::Read vr = p_blend_shapes[i].read(); glGenBuffers(1,&mt.vertex_id); glBindBuffer(GL_ARRAY_BUFFER,mt.vertex_id); @@ -2933,25 +2933,25 @@ int RasterizerStorageGLES3::mesh_surface_get_array_index_len(RID p_mesh, int p_s return mesh->surfaces[p_surface]->index_array_len; } -DVector<uint8_t> RasterizerStorageGLES3::mesh_surface_get_array(RID p_mesh, int p_surface) const{ +PoolVector<uint8_t> RasterizerStorageGLES3::mesh_surface_get_array(RID p_mesh, int p_surface) const{ const Mesh *mesh = mesh_owner.getornull(p_mesh); - ERR_FAIL_COND_V(!mesh,DVector<uint8_t>()); - ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),DVector<uint8_t>()); + ERR_FAIL_COND_V(!mesh,PoolVector<uint8_t>()); + ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),PoolVector<uint8_t>()); Surface *surface = mesh->surfaces[p_surface]; glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); void * data = glMapBufferRange(GL_ARRAY_BUFFER,0,surface->array_byte_size,GL_MAP_READ_BIT); - ERR_FAIL_COND_V(!data,DVector<uint8_t>()); + ERR_FAIL_COND_V(!data,PoolVector<uint8_t>()); - DVector<uint8_t> ret; + PoolVector<uint8_t> ret; ret.resize(surface->array_byte_size); { - DVector<uint8_t>::Write w = ret.write(); + PoolVector<uint8_t>::Write w = ret.write(); copymem(w.ptr(),data,surface->array_byte_size); } glUnmapBuffer(GL_ARRAY_BUFFER); @@ -2960,26 +2960,26 @@ DVector<uint8_t> RasterizerStorageGLES3::mesh_surface_get_array(RID p_mesh, int return ret; } -DVector<uint8_t> RasterizerStorageGLES3::mesh_surface_get_index_array(RID p_mesh, int p_surface) const { +PoolVector<uint8_t> RasterizerStorageGLES3::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,DVector<uint8_t>()); - ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),DVector<uint8_t>()); + ERR_FAIL_COND_V(!mesh,PoolVector<uint8_t>()); + ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),PoolVector<uint8_t>()); Surface *surface = mesh->surfaces[p_surface]; - ERR_FAIL_COND_V(surface->index_array_len==0,DVector<uint8_t>()); + ERR_FAIL_COND_V(surface->index_array_len==0,PoolVector<uint8_t>()); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,surface->index_id); void * data = glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER,0,surface->index_array_byte_size,GL_MAP_READ_BIT); - ERR_FAIL_COND_V(!data,DVector<uint8_t>()); + ERR_FAIL_COND_V(!data,PoolVector<uint8_t>()); - DVector<uint8_t> ret; + PoolVector<uint8_t> ret; ret.resize(surface->index_array_byte_size); { - DVector<uint8_t>::Write w = ret.write(); + PoolVector<uint8_t>::Write w = ret.write(); copymem(w.ptr(),data,surface->index_array_byte_size); } @@ -3019,27 +3019,27 @@ AABB RasterizerStorageGLES3::mesh_surface_get_aabb(RID p_mesh, int p_surface) co } -Vector<DVector<uint8_t> > RasterizerStorageGLES3::mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const{ +Vector<PoolVector<uint8_t> > RasterizerStorageGLES3::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<DVector<uint8_t> >()); - ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),Vector<DVector<uint8_t> >()); + ERR_FAIL_COND_V(!mesh,Vector<PoolVector<uint8_t> >()); + ERR_FAIL_INDEX_V(p_surface,mesh->surfaces.size(),Vector<PoolVector<uint8_t> >()); - Vector<DVector<uint8_t> > bsarr; + Vector<PoolVector<uint8_t> > bsarr; for(int i=0;i<mesh->surfaces[p_surface]->morph_targets.size();i++) { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,mesh->surfaces[p_surface]->morph_targets[i].vertex_id); void * data = glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER,0,mesh->surfaces[p_surface]->array_byte_size,GL_MAP_READ_BIT); - ERR_FAIL_COND_V(!data,Vector<DVector<uint8_t> >()); + ERR_FAIL_COND_V(!data,Vector<PoolVector<uint8_t> >()); - DVector<uint8_t> ret; + PoolVector<uint8_t> ret; ret.resize(mesh->surfaces[p_surface]->array_byte_size); { - DVector<uint8_t>::Write w = ret.write(); + PoolVector<uint8_t>::Write w = ret.write(); copymem(w.ptr(),data,mesh->surfaces[p_surface]->array_byte_size); } @@ -4705,7 +4705,7 @@ RID RasterizerStorageGLES3::room_create(){ return RID(); } -void RasterizerStorageGLES3::room_add_bounds(RID p_room, const DVector<Vector2>& p_convex_polygon,float p_height,const Transform& p_transform){ +void RasterizerStorageGLES3::room_add_bounds(RID p_room, const PoolVector<Vector2>& p_convex_polygon,float p_height,const Transform& p_transform){ } @@ -4810,7 +4810,7 @@ Transform RasterizerStorageGLES3::gi_probe_get_to_cell_xform(RID p_probe) const -void RasterizerStorageGLES3::gi_probe_set_dynamic_data(RID p_probe,const DVector<int>& p_data){ +void RasterizerStorageGLES3::gi_probe_set_dynamic_data(RID p_probe,const PoolVector<int>& p_data){ GIProbe *gip = gi_probe_owner.getornull(p_probe); ERR_FAIL_COND(!gip); @@ -4819,10 +4819,10 @@ void RasterizerStorageGLES3::gi_probe_set_dynamic_data(RID p_probe,const DVector gip->instance_change_notify(); } -DVector<int> RasterizerStorageGLES3::gi_probe_get_dynamic_data(RID p_probe) const{ +PoolVector<int> RasterizerStorageGLES3::gi_probe_get_dynamic_data(RID p_probe) const{ const GIProbe *gip = gi_probe_owner.getornull(p_probe); - ERR_FAIL_COND_V(!gip,DVector<int>()); + ERR_FAIL_COND_V(!gip,PoolVector<int>()); return gip->dynamic_data; } @@ -5125,7 +5125,7 @@ void RasterizerStorageGLES3::particles_set_emission_box_extents(RID p_particles, particles->emission_box_extents=p_extents; } -void RasterizerStorageGLES3::particles_set_emission_points(RID p_particles,const DVector<Vector3>& p_points) { +void RasterizerStorageGLES3::particles_set_emission_points(RID p_particles,const PoolVector<Vector3>& p_points) { Particles *particles = particles_owner.getornull(p_particles); ERR_FAIL_COND(!particles); @@ -5961,7 +5961,7 @@ RID RasterizerStorageGLES3::canvas_light_occluder_create() { return canvas_occluder_owner.make_rid(co); } -void RasterizerStorageGLES3::canvas_light_occluder_set_polylines(RID p_occluder, const DVector<Vector2>& p_lines) { +void RasterizerStorageGLES3::canvas_light_occluder_set_polylines(RID p_occluder, const PoolVector<Vector2>& p_lines) { CanvasOccluder *co = canvas_occluder_owner.get(p_occluder); ERR_FAIL_COND(!co); @@ -5985,18 +5985,18 @@ void RasterizerStorageGLES3::canvas_light_occluder_set_polylines(RID p_occluder, - DVector<float> geometry; - DVector<uint16_t> indices; + PoolVector<float> geometry; + PoolVector<uint16_t> indices; int lc = p_lines.size(); geometry.resize(lc*6); indices.resize(lc*3); - DVector<float>::Write vw=geometry.write(); - DVector<uint16_t>::Write iw=indices.write(); + PoolVector<float>::Write vw=geometry.write(); + PoolVector<uint16_t>::Write iw=indices.write(); - DVector<Vector2>::Read lr=p_lines.read(); + PoolVector<Vector2>::Read lr=p_lines.read(); const int POLY_HEIGHT = 16384; diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 357b69183e..32581e860d 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -599,7 +599,7 @@ public: virtual RID mesh_create(); - virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const DVector<uint8_t>& p_array,int p_vertex_count,const DVector<uint8_t>& p_index_array,int p_index_count,const AABB& p_aabb,const Vector<DVector<uint8_t> >& p_blend_shapes=Vector<DVector<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 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_set_morph_target_count(RID p_mesh,int p_amount); virtual int mesh_get_morph_target_count(RID p_mesh) const; @@ -614,15 +614,15 @@ 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 DVector<uint8_t> mesh_surface_get_array(RID p_mesh, int p_surface) const; - virtual DVector<uint8_t> mesh_surface_get_index_array(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 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<DVector<uint8_t> > mesh_surface_get_blend_shapes(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<AABB> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const; virtual void mesh_remove_surface(RID p_mesh, int p_surface); @@ -877,7 +877,7 @@ public: /* ROOM API */ virtual RID room_create(); - virtual void room_add_bounds(RID p_room, const DVector<Vector2>& p_convex_polygon,float p_height,const Transform& p_transform); + virtual void room_add_bounds(RID p_room, const PoolVector<Vector2>& p_convex_polygon,float p_height,const Transform& p_transform); virtual void room_clear_bounds(RID p_room); /* PORTAL API */ @@ -913,7 +913,7 @@ public: uint32_t version; - DVector<int> dynamic_data; + PoolVector<int> dynamic_data; }; @@ -931,8 +931,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 DVector<int>& p_data); - virtual DVector<int> gi_probe_get_dynamic_data(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_range(RID p_probe,int p_range); virtual int gi_probe_get_dynamic_range(RID p_probe) const; @@ -985,7 +985,7 @@ public: VS::ParticlesEmissionShape emission_shape; float emission_sphere_radius; Vector3 emission_box_extents; - DVector<Vector3> emission_points; + PoolVector<Vector3> emission_points; GLuint emission_point_texture; VS::ParticlesDrawOrder draw_order; @@ -1061,7 +1061,7 @@ public: virtual void particles_set_emission_shape(RID p_particles,VS::ParticlesEmissionShape p_shape); virtual void particles_set_emission_sphere_radius(RID p_particles,float p_radius); virtual void particles_set_emission_box_extents(RID p_particles,const Vector3& p_extents); - virtual void particles_set_emission_points(RID p_particles,const DVector<Vector3>& p_points); + virtual void particles_set_emission_points(RID p_particles,const PoolVector<Vector3>& p_points); virtual void particles_set_draw_order(RID p_particles,VS::ParticlesDrawOrder p_order); @@ -1208,14 +1208,14 @@ public: GLuint vertex_id; // 0 means, unconfigured GLuint index_id; // 0 means, unconfigured - DVector<Vector2> lines; + PoolVector<Vector2> lines; int len; }; RID_Owner<CanvasOccluder> canvas_occluder_owner; virtual RID canvas_light_occluder_create(); - virtual void canvas_light_occluder_set_polylines(RID p_occluder, const DVector<Vector2>& p_lines); + virtual void canvas_light_occluder_set_polylines(RID p_occluder, const PoolVector<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 d74a12ba93..de095c20ac 100644 --- a/drivers/png/image_loader_png.cpp +++ b/drivers/png/image_loader_png.cpp @@ -181,11 +181,11 @@ Error ImageLoaderPNG::_load_image(void *rf_up,png_rw_ptr p_func,Image *p_image) //int rowsize = png_get_rowbytes(png, info); int rowsize = components * width; - DVector<uint8_t> dstbuff; + PoolVector<uint8_t> dstbuff; dstbuff.resize( rowsize * height ); - DVector<uint8_t>::Write dstbuff_write = dstbuff.write(); + PoolVector<uint8_t>::Write dstbuff_write = dstbuff.write(); uint8_t* data = dstbuff_write.ptr(); @@ -265,10 +265,10 @@ static Image _load_mem_png(const uint8_t* p_png,int p_size) { } -static Image _lossless_unpack_png(const DVector<uint8_t>& p_data) { +static Image _lossless_unpack_png(const PoolVector<uint8_t>& p_data) { int len = p_data.size(); - DVector<uint8_t>::Read r = p_data.read(); + PoolVector<uint8_t>::Read r = p_data.read(); ERR_FAIL_COND_V(r[0]!='P' || r[1]!='N' || r[2]!='G' || r[3]!=' ',Image()); return _load_mem_png(&r[4],len-4); @@ -276,17 +276,17 @@ static Image _lossless_unpack_png(const DVector<uint8_t>& p_data) { static void _write_png_data(png_structp png_ptr,png_bytep data, png_size_t p_length) { - DVector<uint8_t> &v = *(DVector<uint8_t>*)png_get_io_ptr(png_ptr); + PoolVector<uint8_t> &v = *(PoolVector<uint8_t>*)png_get_io_ptr(png_ptr); int vs = v.size(); v.resize(vs+p_length); - DVector<uint8_t>::Write w = v.write(); + PoolVector<uint8_t>::Write w = v.write(); copymem(&w[vs],data,p_length); //print_line("png write: "+itos(p_length)); } -static DVector<uint8_t> _lossless_pack_png(const Image& p_image) { +static PoolVector<uint8_t> _lossless_pack_png(const Image& p_image) { Image img = p_image; @@ -294,7 +294,7 @@ static DVector<uint8_t> _lossless_pack_png(const Image& p_image) { img.decompress(); - ERR_FAIL_COND_V(img.is_compressed(), DVector<uint8_t>()); + ERR_FAIL_COND_V(img.is_compressed(), PoolVector<uint8_t>()); png_structp png_ptr; png_infop info_ptr; @@ -304,16 +304,16 @@ static DVector<uint8_t> _lossless_pack_png(const Image& p_image) { /* initialize stuff */ png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - ERR_FAIL_COND_V(!png_ptr,DVector<uint8_t>()); + ERR_FAIL_COND_V(!png_ptr,PoolVector<uint8_t>()); info_ptr = png_create_info_struct(png_ptr); - ERR_FAIL_COND_V(!info_ptr,DVector<uint8_t>()); + ERR_FAIL_COND_V(!info_ptr,PoolVector<uint8_t>()); if (setjmp(png_jmpbuf(png_ptr))) { - ERR_FAIL_V(DVector<uint8_t>()); + ERR_FAIL_V(PoolVector<uint8_t>()); } - DVector<uint8_t> ret; + PoolVector<uint8_t> ret; ret.push_back('P'); ret.push_back('N'); ret.push_back('G'); @@ -323,7 +323,7 @@ static DVector<uint8_t> _lossless_pack_png(const Image& p_image) { /* write header */ if (setjmp(png_jmpbuf(png_ptr))) { - ERR_FAIL_V(DVector<uint8_t>()); + ERR_FAIL_V(PoolVector<uint8_t>()); } int pngf=0; @@ -379,11 +379,11 @@ static DVector<uint8_t> _lossless_pack_png(const Image& p_image) { /* write bytes */ if (setjmp(png_jmpbuf(png_ptr))) { - ERR_FAIL_V(DVector<uint8_t>()); + ERR_FAIL_V(PoolVector<uint8_t>()); } - DVector<uint8_t>::Read r = img.get_data().read(); + PoolVector<uint8_t>::Read r = img.get_data().read(); row_pointers = (png_bytep*)memalloc(sizeof(png_bytep)*h); for(int i=0;i<h;i++) { @@ -397,7 +397,7 @@ static DVector<uint8_t> _lossless_pack_png(const Image& p_image) { /* end write */ if (setjmp(png_jmpbuf(png_ptr))) { - ERR_FAIL_V(DVector<uint8_t>()); + ERR_FAIL_V(PoolVector<uint8_t>()); } png_write_end(png_ptr, NULL); diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp index b06b02b200..a9a199bb59 100644 --- a/drivers/png/resource_saver_png.cpp +++ b/drivers/png/resource_saver_png.cpp @@ -193,7 +193,7 @@ Error ResourceSaverPNG::save_image(const String &p_path, Image &p_img) { } - DVector<uint8_t>::Read r = p_img.get_data().read(); + PoolVector<uint8_t>::Read r = p_img.get_data().read(); row_pointers = (png_bytep*)memalloc(sizeof(png_bytep)*h); for(int i=0;i<h;i++) { diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 1e8b76f505..283cff0486 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -31,10 +31,10 @@ #ifdef UNIX_ENABLED -#include "os/memory_pool_dynamic_static.h" #include "thread_posix.h" #include "semaphore_posix.h" #include "mutex_posix.h" +#include "rw_lock_posix.h" #include "core/os/thread_dummy.h" //#include "core/io/file_access_buffered_fa.h" @@ -116,7 +116,6 @@ int OS_Unix::unix_initialize_audio(int p_audio_driver) { return 0; } -static MemoryPoolDynamicStatic *mempool_dynamic=NULL; void OS_Unix::initialize_core() { @@ -129,6 +128,7 @@ void OS_Unix::initialize_core() { ThreadPosix::make_default(); SemaphorePosix::make_default(); MutexPosix::make_default(); + RWLockPosix::make_default(); #endif FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_RESOURCES); FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_USERDATA); @@ -144,7 +144,6 @@ void OS_Unix::initialize_core() { PacketPeerUDPPosix::make_default(); IP_Unix::make_default(); #endif - mempool_dynamic = memnew( MemoryPoolDynamicStatic ); ticks_start=0; ticks_start=get_ticks_usec(); @@ -153,8 +152,6 @@ void OS_Unix::initialize_core() { void OS_Unix::finalize_core() { - if (mempool_dynamic) - memdelete( mempool_dynamic ); } diff --git a/drivers/unix/rw_lock_posix.cpp b/drivers/unix/rw_lock_posix.cpp new file mode 100644 index 0000000000..772a7b812a --- /dev/null +++ b/drivers/unix/rw_lock_posix.cpp @@ -0,0 +1,76 @@ + +#if defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED) + +#include "os/memory.h" +#include "rw_lock_posix.h" +#include "error_macros.h" +#include <stdio.h> + +void RWLockPosix::read_lock() { + + int err =pthread_rwlock_rdlock(&rwlock); + if (err!=0) { + perror("wtf: "); + } + ERR_FAIL_COND(err!=0); +} + +void RWLockPosix::read_unlock() { + + pthread_rwlock_unlock(&rwlock); +} + +Error RWLockPosix::read_try_lock() { + + if (pthread_rwlock_tryrdlock(&rwlock)!=0) { + return ERR_BUSY; + } else { + return OK; + } + +} + +void RWLockPosix::write_lock() { + + int err = pthread_rwlock_wrlock(&rwlock); + ERR_FAIL_COND(err!=0); +} + +void RWLockPosix::write_unlock() { + + pthread_rwlock_unlock(&rwlock); +} + +Error RWLockPosix::write_try_lock() { + if (pthread_rwlock_trywrlock(&rwlock)!=0) { + return ERR_BUSY; + } else { + return OK; + } +} + + +RWLock *RWLockPosix::create_func_posix() { + + return memnew( RWLockPosix ); +} + +void RWLockPosix::make_default() { + + create_func=create_func_posix; +} + + +RWLockPosix::RWLockPosix() { + + rwlock=PTHREAD_RWLOCK_INITIALIZER; +} + + +RWLockPosix::~RWLockPosix() { + + pthread_rwlock_destroy(&rwlock); + +} + +#endif diff --git a/drivers/unix/rw_lock_posix.h b/drivers/unix/rw_lock_posix.h new file mode 100644 index 0000000000..bcc102f6a6 --- /dev/null +++ b/drivers/unix/rw_lock_posix.h @@ -0,0 +1,37 @@ +#ifndef RWLOCKPOSIX_H +#define RWLOCKPOSIX_H + +#if defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED) + +#include <pthread.h> +#include "os/rw_lock.h" + +class RWLockPosix : public RWLock { + + + pthread_rwlock_t rwlock; + + static RWLock *create_func_posix(); + +public: + + virtual void read_lock(); + virtual void read_unlock(); + virtual Error read_try_lock(); + + virtual void write_lock(); + virtual void write_unlock(); + virtual Error write_try_lock(); + + static void make_default(); + + RWLockPosix(); + + ~RWLockPosix(); + +}; + +#endif + + +#endif // RWLOCKPOSIX_H diff --git a/main/performance.cpp b/main/performance.cpp index 637ff2b079..2ca73c6d4b 100644 --- a/main/performance.cpp +++ b/main/performance.cpp @@ -122,9 +122,9 @@ float Performance::get_monitor(Monitor p_monitor) const { case TIME_PROCESS: return _process_time; case TIME_FIXED_PROCESS: return _fixed_process_time; case MEMORY_STATIC: return Memory::get_mem_usage(); - case MEMORY_DYNAMIC: return Memory::get_dynamic_mem_usage(); - case MEMORY_STATIC_MAX: return Memory::get_mem_max_usage(); - case MEMORY_DYNAMIC_MAX: return Memory::get_dynamic_mem_available(); + case MEMORY_DYNAMIC: return MemoryPool::total_memory; + case MEMORY_STATIC_MAX: return MemoryPool::max_memory; + case MEMORY_DYNAMIC_MAX: return 0; 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(); diff --git a/modules/chibi/event_stream_chibi.cpp b/modules/chibi/event_stream_chibi.cpp index 0b680b4fda..73d1c01e33 100644 --- a/modules/chibi/event_stream_chibi.cpp +++ b/modules/chibi/event_stream_chibi.cpp @@ -298,9 +298,9 @@ void CPSampleManagerImpl::unlock_data(CPSample_ID p_id){ sd->locks--; if (sd->locks==0) { - sd->w=DVector<uint8_t>::Write(); + sd->w=PoolVector<uint8_t>::Write(); AudioServer::get_singleton()->sample_set_data(sd->rid,sd->lock); - sd->lock=DVector<uint8_t>(); + sd->lock=PoolVector<uint8_t>(); } } diff --git a/modules/chibi/event_stream_chibi.h b/modules/chibi/event_stream_chibi.h index 9c6c883f61..0244ee0a95 100644 --- a/modules/chibi/event_stream_chibi.h +++ b/modules/chibi/event_stream_chibi.h @@ -54,8 +54,8 @@ class CPSampleManagerImpl : public CPSampleManager { int loop_begin; int loop_end; int locks; - DVector<uint8_t> lock; - DVector<uint8_t>::Write w; + PoolVector<uint8_t> lock; + PoolVector<uint8_t>::Write w; CPSample_Loop_Type loop_type; }; diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp index 598b2aab0e..1de98a6b1f 100644 --- a/modules/dds/texture_loader_dds.cpp +++ b/modules/dds/texture_loader_dds.cpp @@ -223,7 +223,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, // print_line("found format: "+String(dds_format_info[dds_format].name)); - DVector<uint8_t> src_data; + PoolVector<uint8_t> src_data; const DDSFormatInfo &info=dds_format_info[dds_format]; uint32_t w = width; @@ -247,9 +247,9 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, } src_data.resize(size); - DVector<uint8_t>::Write wb = src_data.write(); + PoolVector<uint8_t>::Write wb = src_data.write(); f->get_buffer(wb.ptr(),size); - wb=DVector<uint8_t>::Write(); + wb=PoolVector<uint8_t>::Write(); } else if (info.palette) { @@ -281,7 +281,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, } src_data.resize(size + 256*colsize ); - DVector<uint8_t>::Write wb = src_data.write(); + PoolVector<uint8_t>::Write wb = src_data.write(); f->get_buffer(wb.ptr(),size); for(int i=0;i<256;i++) { @@ -296,7 +296,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, } - wb=DVector<uint8_t>::Write(); + wb=PoolVector<uint8_t>::Write(); } else { //uncompressed generic... @@ -316,7 +316,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, size=size*2; src_data.resize(size); - DVector<uint8_t>::Write wb = src_data.write(); + PoolVector<uint8_t>::Write wb = src_data.write(); f->get_buffer(wb.ptr(),size); @@ -449,7 +449,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, } - wb=DVector<uint8_t>::Write(); + wb=PoolVector<uint8_t>::Write(); } diff --git a/modules/etc1/image_etc.cpp b/modules/etc1/image_etc.cpp index 4bbdc0a60a..845084fef7 100644 --- a/modules/etc1/image_etc.cpp +++ b/modules/etc1/image_etc.cpp @@ -37,10 +37,10 @@ static void _decompress_etc(Image *p_img) { int imgw = p_img->get_width(); int imgh = p_img->get_height(); - DVector<uint8_t> src=p_img->get_data(); - DVector<uint8_t> dst; + PoolVector<uint8_t> src=p_img->get_data(); + PoolVector<uint8_t> dst; - DVector<uint8_t>::Read r = src.read(); + PoolVector<uint8_t>::Read r = src.read(); int mmc=p_img->get_mipmap_count(); @@ -49,7 +49,7 @@ static void _decompress_etc(Image *p_img) { dst.resize(dst.size()+imgw*imgh*3); const uint8_t *srcbr=&r[p_img->get_mipmap_offset(i)]; - DVector<uint8_t>::Write w = dst.write(); + PoolVector<uint8_t>::Write w = dst.write(); uint8_t *wptr = &w[dst.size()-imgw*imgh*3]; @@ -91,7 +91,7 @@ static void _decompress_etc(Image *p_img) { } - r=DVector<uint8_t>::Read(); + r=PoolVector<uint8_t>::Read(); //print_line("Re Creating ETC into regular image: w "+itos(p_img->get_width())+" h "+itos(p_img->get_height())+" mm "+itos(p_img->get_mipmaps())); *p_img=Image(p_img->get_width(),p_img->get_height(),p_img->has_mipmaps(),Image::FORMAT_RGB8,dst); if (p_img->has_mipmaps()) @@ -117,9 +117,9 @@ static void _compress_etc(Image *p_img) { img.generate_mipmaps(); // force mipmaps, so it works on most hardware - DVector<uint8_t> res_data; - DVector<uint8_t> dst_data; - DVector<uint8_t>::Read r = img.get_data().read(); + PoolVector<uint8_t> res_data; + PoolVector<uint8_t> dst_data; + PoolVector<uint8_t>::Read r = img.get_data().read(); int mc=0; @@ -134,7 +134,7 @@ static void _compress_etc(Image *p_img) { const uint8_t *src = &r[img.get_mipmap_offset(i)]; int mmsize = MAX(bw,1)*MAX(bh,1)*8; dst_data.resize(dst_data.size()+mmsize); - DVector<uint8_t>::Write w=dst_data.write(); + PoolVector<uint8_t>::Write w=dst_data.write(); uint8_t *dst = &w[dst_data.size()-mmsize]; diff --git a/modules/etc1/texture_loader_pkm.cpp b/modules/etc1/texture_loader_pkm.cpp index f8af141979..42c9937b8f 100644 --- a/modules/etc1/texture_loader_pkm.cpp +++ b/modules/etc1/texture_loader_pkm.cpp @@ -43,13 +43,13 @@ RES ResourceFormatPKM::load(const String &p_path, const String& p_original_path, h.origWidth = f->get_16(); h.origHeight = f->get_16(); - DVector<uint8_t> src_data; + PoolVector<uint8_t> src_data; uint32_t size = h.texWidth * h.texHeight / 2; src_data.resize(size); - DVector<uint8_t>::Write wb = src_data.write(); + PoolVector<uint8_t>::Write wb = src_data.write(); f->get_buffer(wb.ptr(),size); - wb=DVector<uint8_t>::Write(); + wb=PoolVector<uint8_t>::Write(); int mipmaps = h.format; int width = h.origWidth; diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index b205a0a890..5fe97335f0 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -830,7 +830,7 @@ Error GDScript::load_byte_code(const String& p_path) { Error GDScript::load_source_code(const String& p_path) { - DVector<uint8_t> sourcef; + PoolVector<uint8_t> sourcef; Error err; FileAccess *f=FileAccess::open(p_path,FileAccess::READ,&err); if (err) { @@ -840,7 +840,7 @@ Error GDScript::load_source_code(const String& p_path) { int len = f->get_len(); sourcef.resize(len+1); - DVector<uint8_t>::Write w = sourcef.write(); + PoolVector<uint8_t>::Write w = sourcef.write(); int r = f->get_buffer(w.ptr(),len); f->close(); memdelete(f); diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 84d8250033..b934e7ab1b 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -61,9 +61,9 @@ bool GridMap::_set(const StringName& p_name, const Variant& p_value) { } else if (name=="theme/bake") { set_bake(p_value); /* } else if (name=="cells") { - DVector<int> cells = p_value; + PoolVector<int> cells = p_value; int amount=cells.size(); - DVector<int>::Read r = cells.read(); + PoolVector<int>::Read r = cells.read(); ERR_FAIL_COND_V(amount&1,false); // not even cell_map.clear();; for(int i=0;i<amount/3;i++) { @@ -86,9 +86,9 @@ bool GridMap::_set(const StringName& p_name, const Variant& p_value) { baked=d["baked"]; if (d.has("cells")) { - DVector<int> cells = d["cells"]; + PoolVector<int> cells = d["cells"]; int amount=cells.size(); - DVector<int>::Read r = cells.read(); + PoolVector<int>::Read r = cells.read(); ERR_FAIL_COND_V(amount%3,false); // not even cell_map.clear();; for(int i=0;i<amount/3;i++) { @@ -183,10 +183,10 @@ bool GridMap::_get(const StringName& p_name,Variant &r_ret) const { Dictionary d; - DVector<int> cells; + PoolVector<int> cells; cells.resize(cell_map.size()*3); { - DVector<int>::Write w = cells.write(); + PoolVector<int>::Write w = cells.write(); int i=0; for (Map<IndexKey,Cell>::Element *E=cell_map.front();E;E=E->next(),i++) { @@ -665,7 +665,7 @@ void GridMap::_octant_update(const OctantKey &p_key) { VS::get_singleton()->mesh_clear(g.collision_debug); } - DVector<Vector3> col_debug; + PoolVector<Vector3> col_debug; /* * foreach item in this octant, @@ -863,15 +863,15 @@ void GridMap::_octant_bake(const OctantKey &p_key, const Ref<TriangleMesh>& p_tm if (ii.mesh->surface_get_primitive_type(i)!=Mesh::PRIMITIVE_TRIANGLES) continue; Array a = ii.mesh->surface_get_arrays(i); - DVector<Vector3> av=a[VS::ARRAY_VERTEX]; + PoolVector<Vector3> av=a[VS::ARRAY_VERTEX]; int avs = av.size(); - DVector<Vector3>::Read vr = av.read(); + PoolVector<Vector3>::Read vr = av.read(); - DVector<int> ai=a[VS::ARRAY_INDEX]; + PoolVector<int> ai=a[VS::ARRAY_INDEX]; int ais=ai.size(); if (ais) { - DVector<int>::Read ir=ai.read(); + PoolVector<int>::Read ir=ai.read(); for(int j=0;j<ais;j++) { p_prebake->push_back(xform.xform(vr[ir[j]])); @@ -1667,7 +1667,7 @@ void GridMap::bake_geometry() { } - DVector<Vector3> vv; + PoolVector<Vector3> vv; vv.fill_with(vertices); //print_line("TOTAL VERTICES: "+itos(vv.size())); tmesh = Ref<TriangleMesh>( memnew( TriangleMesh )); diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index 08f2c4fbbc..db0952b1cb 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -1126,7 +1126,7 @@ void GridMapEditor::_update_areas_display() { RID mesh = VisualServer::get_singleton()->mesh_create(); - DVector<Plane> planes; + PoolVector<Plane> planes; for(int i=0;i<3;i++) { Vector3 axis; @@ -1343,8 +1343,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { //selection mesh create - DVector<Vector3> lines; - DVector<Vector3> triangles; + PoolVector<Vector3> lines; + PoolVector<Vector3> triangles; for (int i=0;i<6;i++) { diff --git a/modules/jpg/image_loader_jpegd.cpp b/modules/jpg/image_loader_jpegd.cpp index 9709c0c706..1152d42e1b 100644 --- a/modules/jpg/image_loader_jpegd.cpp +++ b/modules/jpg/image_loader_jpegd.cpp @@ -56,11 +56,11 @@ Error jpeg_load_image_from_buffer(Image *p_image,const uint8_t* p_buffer, int p_ const int dst_bpl = image_width * comps; - DVector<uint8_t> data; + PoolVector<uint8_t> data; data.resize(dst_bpl * image_height); - DVector<uint8_t>::Write dw = data.write(); + PoolVector<uint8_t>::Write dw = data.write(); jpgd::uint8 *pImage_data = (jpgd::uint8*)dw.ptr(); @@ -88,7 +88,7 @@ Error jpeg_load_image_from_buffer(Image *p_image,const uint8_t* p_buffer, int p_ else fmt=Image::FORMAT_RGBA8; - dw = DVector<uint8_t>::Write(); + dw = PoolVector<uint8_t>::Write(); p_image->create(image_width,image_height,0,fmt,data); return OK; @@ -99,12 +99,12 @@ Error jpeg_load_image_from_buffer(Image *p_image,const uint8_t* p_buffer, int p_ Error ImageLoaderJPG::load_image(Image *p_image,FileAccess *f) { - DVector<uint8_t> src_image; + PoolVector<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); - DVector<uint8_t>::Write w = src_image.write(); + PoolVector<uint8_t>::Write w = src_image.write(); f->get_buffer(&w[0],src_image_len); @@ -113,7 +113,7 @@ Error ImageLoaderJPG::load_image(Image *p_image,FileAccess *f) { Error err = jpeg_load_image_from_buffer(p_image,w.ptr(),src_image_len); - w = DVector<uint8_t>::Write(); + w = PoolVector<uint8_t>::Write(); return err; diff --git a/modules/mpc/audio_stream_mpc.cpp b/modules/mpc/audio_stream_mpc.cpp index d8572d3b5d..bcb7e4c871 100644 --- a/modules/mpc/audio_stream_mpc.cpp +++ b/modules/mpc/audio_stream_mpc.cpp @@ -59,7 +59,7 @@ Error AudioStreamPlaybackMPC::_open_file() { if (preload) { data.resize(streamlen); - DVector<uint8_t>::Write w = data.write(); + PoolVector<uint8_t>::Write w = data.write(); f->get_buffer(&w[0],streamlen); memdelete(f); f=NULL; @@ -85,7 +85,7 @@ int AudioStreamPlaybackMPC::_read_file(void *p_dst,int p_bytes) { if (f) return f->get_buffer((uint8_t*)p_dst,p_bytes); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Read r = data.read(); if (p_bytes+data_ofs > streamlen) { p_bytes=streamlen-data_ofs; } diff --git a/modules/mpc/audio_stream_mpc.h b/modules/mpc/audio_stream_mpc.h index e7d677aa8c..5330fa055f 100644 --- a/modules/mpc/audio_stream_mpc.h +++ b/modules/mpc/audio_stream_mpc.h @@ -43,7 +43,7 @@ class AudioStreamPlaybackMPC : public AudioStreamPlayback { bool preload; FileAccess *f; String file; - DVector<uint8_t> data; + PoolVector<uint8_t> data; int data_ofs; int streamlen; diff --git a/modules/pbm/bitmap_loader_pbm.cpp b/modules/pbm/bitmap_loader_pbm.cpp index f9fc19b2cc..6caaf10334 100644 --- a/modules/pbm/bitmap_loader_pbm.cpp +++ b/modules/pbm/bitmap_loader_pbm.cpp @@ -31,11 +31,11 @@ #include "scene/resources/bit_mask.h" -static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token,bool p_binary=false,bool p_single_chunk=false) { +static bool _get_token(FileAccessRef& f,uint8_t &saved,PoolVector<uint8_t>& r_token,bool p_binary=false,bool p_single_chunk=false) { int token_max = r_token.size(); - DVector<uint8_t>::Write w; + PoolVector<uint8_t>::Write w; if (token_max) w=r_token.write(); int ofs=0; @@ -53,7 +53,7 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token } if (f->eof_reached()) { if (ofs) { - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); r_token.resize(ofs); return true; } else { @@ -81,7 +81,7 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token if (ofs && !p_single_chunk) { - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); r_token.resize(ofs); saved=b; @@ -98,7 +98,7 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token resized=true; } if (resized) { - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); r_token.resize(token_max); w=r_token.write(); } @@ -109,10 +109,10 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token return false; } -static int _get_number_from_token(DVector<uint8_t>& r_token) { +static int _get_number_from_token(PoolVector<uint8_t>& r_token) { int len = r_token.size(); - DVector<uint8_t>::Read r = r_token.read(); + PoolVector<uint8_t>::Read r = r_token.read(); return String::to_int((const char*)r.ptr(),len); } @@ -133,7 +133,7 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E if (!f) _RETURN(ERR_CANT_OPEN); - DVector<uint8_t> token; + PoolVector<uint8_t> token; if (!_get_token(f,saved,token)) { _RETURN(ERR_PARSE_ERROR); @@ -186,7 +186,7 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E _RETURN(ERR_FILE_CORRUPT); } - DVector<uint8_t>::Read r=token.read(); + PoolVector<uint8_t>::Read r=token.read(); for(int i=0;i<height;i++) { for(int j=0;j<width;j++) { @@ -210,7 +210,7 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E _RETURN(ERR_FILE_CORRUPT); } - DVector<uint8_t>::Read r=token.read(); + PoolVector<uint8_t>::Read r=token.read(); int bitwidth = width; if (bitwidth % 8) bitwidth+=8-(bitwidth%8); diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp index 0b07e05410..9f8db98e05 100644 --- a/modules/pvr/texture_loader_pvr.cpp +++ b/modules/pvr/texture_loader_pvr.cpp @@ -99,13 +99,13 @@ RES ResourceFormatPVR::load(const String &p_path,const String& p_original_path,E print_line("surfcount: "+itos(surfcount)); */ - DVector<uint8_t> data; + PoolVector<uint8_t> data; data.resize(surfsize); ERR_FAIL_COND_V(data.size()==0,RES()); - DVector<uint8_t>::Write w = data.write(); + PoolVector<uint8_t>::Write w = data.write(); f->get_buffer(&w[0],surfsize); err = f->get_error(); ERR_FAIL_COND_V(err!=OK,RES()); @@ -151,7 +151,7 @@ RES ResourceFormatPVR::load(const String &p_path,const String& p_original_path,E } - w = DVector<uint8_t>::Write(); + w = PoolVector<uint8_t>::Write(); int tex_flags=Texture::FLAG_FILTER|Texture::FLAG_REPEAT; @@ -209,10 +209,10 @@ static void _compress_pvrtc4(Image * p_img) { Image new_img; new_img.create(img.get_width(),img.get_height(),true,use_alpha?Image::FORMAT_PVRTC4A:Image::FORMAT_PVRTC4); - DVector<uint8_t> data=new_img.get_data(); + PoolVector<uint8_t> data=new_img.get_data(); { - DVector<uint8_t>::Write wr=data.write(); - DVector<uint8_t>::Read r=img.get_data().read(); + PoolVector<uint8_t>::Write wr=data.write(); + PoolVector<uint8_t>::Read r=img.get_data().read(); for(int i=0;i<=new_img.get_mipmap_count();i++) { @@ -677,13 +677,13 @@ static void _pvrtc_decompress(Image* p_img) { bool _2bit = (p_img->get_format()==Image::FORMAT_PVRTC2 || p_img->get_format()==Image::FORMAT_PVRTC2A ); - DVector<uint8_t> data = p_img->get_data(); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t> data = p_img->get_data(); + PoolVector<uint8_t>::Read r = data.read(); - DVector<uint8_t> newdata; + PoolVector<uint8_t> newdata; newdata.resize( p_img->get_width() * p_img->get_height() * 4); - DVector<uint8_t>::Write w=newdata.write(); + 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()); @@ -691,8 +691,8 @@ static void _pvrtc_decompress(Image* p_img) { // print_line(itos(w[i])); //} - w=DVector<uint8_t>::Write(); - r=DVector<uint8_t>::Read(); + w=PoolVector<uint8_t>::Write(); + r=PoolVector<uint8_t>::Read(); bool make_mipmaps=p_img->has_mipmaps(); Image newimg(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 6cd9048f1b..7410658603 100644 --- a/modules/squish/image_compress_squish.cpp +++ b/modules/squish/image_compress_squish.cpp @@ -66,12 +66,12 @@ void image_compress_squish(Image *p_image) { int mm_count = p_image->get_mipmap_count(); - DVector<uint8_t> data; + PoolVector<uint8_t> data; int target_size = Image::get_image_data_size(w,h,target_format,mm_count); data.resize(target_size); - DVector<uint8_t>::Read rb = p_image->get_data().read(); - DVector<uint8_t>::Write wb = data.write(); + PoolVector<uint8_t>::Read rb = p_image->get_data().read(); + PoolVector<uint8_t>::Write wb = data.write(); int dst_ofs=0; @@ -84,8 +84,8 @@ void image_compress_squish(Image *p_image) { h>>=1; } - rb = DVector<uint8_t>::Read(); - wb = DVector<uint8_t>::Write(); + rb = PoolVector<uint8_t>::Read(); + wb = PoolVector<uint8_t>::Write(); p_image->create(p_image->get_width(),p_image->get_height(),p_image->has_mipmaps(),target_format,data); diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index e6bf55185e..b847f17bb7 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -88,7 +88,7 @@ void VideoStreamPlaybackTheora::video_write(void){ { int pixels = size.x * size.y; frame_data.resize(pixels * 4); - DVector<uint8_t>::Write w = frame_data.write(); + PoolVector<uint8_t>::Write w = frame_data.write(); char* dst = (char*)w.ptr(); int p = 0; for (int i=0; i<size.y; i++) { @@ -112,7 +112,7 @@ void VideoStreamPlaybackTheora::video_write(void){ int pitch = 4; frame_data.resize(size.x * size.y * pitch); { - DVector<uint8_t>::Write w = frame_data.write(); + PoolVector<uint8_t>::Write w = frame_data.write(); char* dst = (char*)w.ptr(); //uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y/2); @@ -143,7 +143,7 @@ void VideoStreamPlaybackTheora::video_write(void){ int pitch = 3; frame_data.resize(size.x * size.y * pitch); - DVector<uint8_t>::Write w = frame_data.write(); + PoolVector<uint8_t>::Write w = frame_data.write(); char* dst = (char*)w.ptr(); for(int i=0;i<size.y;i++) { @@ -174,7 +174,7 @@ void VideoStreamPlaybackTheora::video_write(void){ int pitch = 4; frame_data.resize(size.x * size.y * pitch); - DVector<uint8_t>::Write w = frame_data.write(); + PoolVector<uint8_t>::Write w = frame_data.write(); char* dst = (char*)w.ptr(); uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y / div); @@ -208,7 +208,7 @@ void VideoStreamPlaybackTheora::video_write(void){ int pitch = 2; frame_data.resize(size.x * size.y * pitch); - DVector<uint8_t>::Write w = frame_data.write(); + PoolVector<uint8_t>::Write w = frame_data.write(); char* dst = (char*)w.ptr(); uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y / div); diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h index bff9d2538d..0e1f5fa864 100644 --- a/modules/theora/video_stream_theora.h +++ b/modules/theora/video_stream_theora.h @@ -51,7 +51,7 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback { //Image frames[MAX_FRAMES]; Image::Format format; - DVector<uint8_t> frame_data; + PoolVector<uint8_t> frame_data; int frames_pending; FileAccess* file; String file_name; diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp index 35b215cb52..d132e89690 100644 --- a/modules/webm/video_stream_webm.cpp +++ b/modules/webm/video_stream_webm.cpp @@ -293,7 +293,7 @@ void VideoStreamPlaybackWebm::update(float p_delta) { if (err == VPXDecoder::NO_ERROR && image.w == webm->getWidth() && image.h == webm->getHeight()) { - DVector<uint8_t>::Write w = frame_data.write(); + PoolVector<uint8_t>::Write w = frame_data.write(); bool converted = false; if (image.chromaShiftW == 1 && image.chromaShiftH == 1) { diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h index a34591d9b9..cb4ef53f6d 100644 --- a/modules/webm/video_stream_webm.h +++ b/modules/webm/video_stream_webm.h @@ -56,7 +56,7 @@ class VideoStreamPlaybackWebm : public VideoStreamPlayback { double delay_compensation; double time, video_frame_delay, video_pos; - DVector<uint8_t> frame_data; + PoolVector<uint8_t> frame_data; Ref<ImageTexture> texture; int16_t *pcm; diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp index 56fc386ef4..3508c6a663 100644 --- a/modules/webp/image_loader_webp.cpp +++ b/modules/webp/image_loader_webp.cpp @@ -36,9 +36,9 @@ #include <webp/decode.h> #include <webp/encode.h> -static DVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) { +static PoolVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) { - ERR_FAIL_COND_V(p_image.empty(),DVector<uint8_t>()); + ERR_FAIL_COND_V(p_image.empty(),PoolVector<uint8_t>()); Image img=p_image; if (img.detect_alpha()) @@ -47,8 +47,8 @@ static DVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) { img.convert(Image::FORMAT_RGB8); Size2 s(img.get_width(),img.get_height()); - DVector<uint8_t> data = img.get_data(); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t> data = img.get_data(); + PoolVector<uint8_t>::Read r = data.read(); uint8_t *dst_buff=NULL; size_t dst_size=0; @@ -59,25 +59,25 @@ static DVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) { dst_size = WebPEncodeRGBA(r.ptr(),s.width,s.height,4*s.width,CLAMP(p_quality*100.0,0,100.0),&dst_buff); } - ERR_FAIL_COND_V(dst_size==0,DVector<uint8_t>()); - DVector<uint8_t> dst; + ERR_FAIL_COND_V(dst_size==0,PoolVector<uint8_t>()); + PoolVector<uint8_t> dst; dst.resize(4+dst_size); - DVector<uint8_t>::Write w = dst.write(); + PoolVector<uint8_t>::Write w = dst.write(); w[0]='W'; w[1]='E'; w[2]='B'; w[3]='P'; copymem(&w[4],dst_buff,dst_size); free(dst_buff); - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); return dst; } -static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) { +static Image _webp_lossy_unpack(const PoolVector<uint8_t>& p_buffer) { int size = p_buffer.size()-4; ERR_FAIL_COND_V(size<=0,Image()); - DVector<uint8_t>::Read r = p_buffer.read(); + PoolVector<uint8_t>::Read r = p_buffer.read(); ERR_FAIL_COND_V(r[0]!='W' || r[1]!='E' || r[2]!='B' || r[3]!='P',Image()); WebPBitstreamFeatures features; @@ -90,11 +90,11 @@ static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) { //print_line("height: "+itos(features.height)); //print_line("alpha: "+itos(features.has_alpha)); - DVector<uint8_t> dst_image; + PoolVector<uint8_t> dst_image; int datasize = features.width*features.height*(features.has_alpha?4:3); dst_image.resize(datasize); - DVector<uint8_t>::Write dst_w = dst_image.write(); + PoolVector<uint8_t>::Write dst_w = dst_image.write(); bool errdec=false; if (features.has_alpha) { @@ -107,7 +107,7 @@ static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) { //ERR_EXPLAIN("Error decoding webp! - "+p_file); ERR_FAIL_COND_V(errdec,Image()); - dst_w = DVector<uint8_t>::Write(); + dst_w = PoolVector<uint8_t>::Write(); return Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8,dst_image); @@ -118,12 +118,12 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) { uint32_t size = f->get_len(); - DVector<uint8_t> src_image; + PoolVector<uint8_t> src_image; src_image.resize(size); WebPBitstreamFeatures features; - DVector<uint8_t>::Write src_w = src_image.write(); + PoolVector<uint8_t>::Write src_w = src_image.write(); f->get_buffer(src_w.ptr(),size); ERR_FAIL_COND_V(f->eof_reached(), ERR_FILE_EOF); @@ -137,14 +137,14 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) { print_line("height: "+itos(features.height)); print_line("alpha: "+itos(features.has_alpha)); - src_w = DVector<uint8_t>::Write(); + src_w = PoolVector<uint8_t>::Write(); - DVector<uint8_t> dst_image; + PoolVector<uint8_t> dst_image; int datasize = features.width*features.height*(features.has_alpha?4:3); dst_image.resize(datasize); - DVector<uint8_t>::Read src_r = src_image.read(); - DVector<uint8_t>::Write dst_w = dst_image.write(); + PoolVector<uint8_t>::Read src_r = src_image.read(); + PoolVector<uint8_t>::Write dst_w = dst_image.write(); bool errdec=false; @@ -158,8 +158,8 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) { //ERR_EXPLAIN("Error decoding webp! - "+p_file); ERR_FAIL_COND_V(errdec,ERR_FILE_CORRUPT); - src_r = DVector<uint8_t>::Read(); - dst_w = DVector<uint8_t>::Write(); + src_r = PoolVector<uint8_t>::Read(); + dst_w = PoolVector<uint8_t>::Write(); *p_image = Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8,dst_image); diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp index 715021db33..c4d1a85c5f 100644 --- a/platform/android/godot_android.cpp +++ b/platform/android/godot_android.cpp @@ -153,7 +153,7 @@ public: } break; case Variant::STRING_ARRAY: { - DVector<String> sarray = *p_args[i]; + PoolVector<String> sarray = *p_args[i]; jobjectArray arr = env->NewObjectArray(sarray.size(),env->FindClass("java/lang/String"),env->NewStringUTF("")); for(int j=0;j<sarray.size();j++) { @@ -165,18 +165,18 @@ public: } break; case Variant::INT_ARRAY: { - DVector<int> array = *p_args[i]; + PoolVector<int> array = *p_args[i]; jintArray arr = env->NewIntArray(array.size()); - DVector<int>::Read r = array.read(); + PoolVector<int>::Read r = array.read(); env->SetIntArrayRegion(arr,0,array.size(),r.ptr()); v[i].l=arr; } break; case Variant::REAL_ARRAY: { - DVector<float> array = *p_args[i]; + PoolVector<float> array = *p_args[i]; jfloatArray arr = env->NewFloatArray(array.size()); - DVector<float>::Read r = array.read(); + PoolVector<float>::Read r = array.read(); env->SetFloatArrayRegion(arr,0,array.size(),r.ptr()); v[i].l=arr; @@ -225,7 +225,7 @@ public: jobjectArray arr = (jobjectArray)env->CallObjectMethodA(instance,E->get().method,v); int stringCount = env->GetArrayLength(arr); - DVector<String> sarr; + PoolVector<String> sarr; for (int i=0; i<stringCount; i++) { jstring string = (jstring) env->GetObjectArrayElement(arr, i); @@ -241,12 +241,12 @@ public: jintArray arr = (jintArray)env->CallObjectMethodA(instance,E->get().method,v); int fCount = env->GetArrayLength(arr); - DVector<int> sarr; + PoolVector<int> sarr; sarr.resize(fCount); - DVector<int>::Write w = sarr.write(); + PoolVector<int>::Write w = sarr.write(); env->GetIntArrayRegion(arr,0,fCount,w.ptr()); - w = DVector<int>::Write(); + w = PoolVector<int>::Write(); ret=sarr; } break; case Variant::REAL_ARRAY: { @@ -254,12 +254,12 @@ public: jfloatArray arr = (jfloatArray)env->CallObjectMethodA(instance,E->get().method,v); int fCount = env->GetArrayLength(arr); - DVector<float> sarr; + PoolVector<float> sarr; sarr.resize(fCount); - DVector<float>::Write w = sarr.write(); + PoolVector<float>::Write w = sarr.write(); env->GetFloatArrayRegion(arr,0,fCount,w.ptr()); - w = DVector<float>::Write(); + w = PoolVector<float>::Write(); ret=sarr; } break; default: { diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index 602d22dfa2..6d47946263 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -122,7 +122,7 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_a } break; case Variant::STRING_ARRAY: { - DVector<String> sarray = *p_arg; + PoolVector<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++) { @@ -181,18 +181,18 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_a case Variant::INT_ARRAY: { - DVector<int> array = *p_arg; + PoolVector<int> array = *p_arg; jintArray arr = env->NewIntArray(array.size()); - DVector<int>::Read r = array.read(); + PoolVector<int>::Read r = array.read(); env->SetIntArrayRegion(arr,0,array.size(),r.ptr()); v.val.l=arr; v.obj=arr; } break; case Variant::RAW_ARRAY: { - DVector<uint8_t> array = *p_arg; + PoolVector<uint8_t> array = *p_arg; jbyteArray arr = env->NewByteArray(array.size()); - DVector<uint8_t>::Read r = array.read(); + PoolVector<uint8_t>::Read r = array.read(); env->SetByteArrayRegion(arr,0,array.size(),reinterpret_cast<const signed char*>(r.ptr())); v.val.l=arr; v.obj=arr; @@ -200,9 +200,9 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_a } break; case Variant::REAL_ARRAY: { - DVector<float> array = *p_arg; + PoolVector<float> array = *p_arg; jfloatArray arr = env->NewFloatArray(array.size()); - DVector<float>::Read r = array.read(); + PoolVector<float>::Read r = array.read(); env->SetFloatArrayRegion(arr,0,array.size(),r.ptr()); v.val.l=arr; v.obj=arr; @@ -259,7 +259,7 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) { jobjectArray arr = (jobjectArray)obj; int stringCount = env->GetArrayLength(arr); //print_line("String array! " + String::num(stringCount)); - DVector<String> sarr; + PoolVector<String> sarr; for (int i=0; i<stringCount; i++) { jstring string = (jstring) env->GetObjectArrayElement(arr, i); @@ -290,12 +290,12 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) { jintArray arr = (jintArray)obj; int fCount = env->GetArrayLength(arr); - DVector<int> sarr; + PoolVector<int> sarr; sarr.resize(fCount); - DVector<int>::Write w = sarr.write(); + PoolVector<int>::Write w = sarr.write(); env->GetIntArrayRegion(arr,0,fCount,w.ptr()); - w = DVector<int>::Write(); + w = PoolVector<int>::Write(); return sarr; }; @@ -303,12 +303,12 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) { jbyteArray arr = (jbyteArray)obj; int fCount = env->GetArrayLength(arr); - DVector<uint8_t> sarr; + PoolVector<uint8_t> sarr; sarr.resize(fCount); - DVector<uint8_t>::Write w = sarr.write(); + PoolVector<uint8_t>::Write w = sarr.write(); env->GetByteArrayRegion(arr,0,fCount,reinterpret_cast<signed char*>(w.ptr())); - w = DVector<uint8_t>::Write(); + w = PoolVector<uint8_t>::Write(); return sarr; }; @@ -540,12 +540,12 @@ public: jintArray arr = (jintArray)env->CallObjectMethodA(instance,E->get().method,v); int fCount = env->GetArrayLength(arr); - DVector<int> sarr; + PoolVector<int> sarr; sarr.resize(fCount); - DVector<int>::Write w = sarr.write(); + PoolVector<int>::Write w = sarr.write(); env->GetIntArrayRegion(arr,0,fCount,w.ptr()); - w = DVector<int>::Write(); + w = PoolVector<int>::Write(); ret=sarr; env->DeleteLocalRef(arr); } break; @@ -554,12 +554,12 @@ public: jfloatArray arr = (jfloatArray)env->CallObjectMethodA(instance,E->get().method,v); int fCount = env->GetArrayLength(arr); - DVector<float> sarr; + PoolVector<float> sarr; sarr.resize(fCount); - DVector<float>::Write w = sarr.write(); + PoolVector<float>::Write w = sarr.write(); env->GetFloatArrayRegion(arr,0,fCount,w.ptr()); - w = DVector<float>::Write(); + w = PoolVector<float>::Write(); ret=sarr; env->DeleteLocalRef(arr); } break; diff --git a/platform/iphone/rasterizer_iphone.cpp b/platform/iphone/rasterizer_iphone.cpp index 3654f6d2d6..ee0457cfb1 100644 --- a/platform/iphone/rasterizer_iphone.cpp +++ b/platform/iphone/rasterizer_iphone.cpp @@ -286,7 +286,7 @@ void RasterizerIPhone::texture_blit_rect(RID p_texture,int p_x,int p_y, const Im GLenum blit_target = GL_TEXTURE_2D; //(texture->target == GL_TEXTURE_CUBE_MAP)?_cube_side_enum[p_cube_side]:GL_TEXTURE_2D; - DVector<uint8_t>::Read read = img.get_data().read(); + PoolVector<uint8_t>::Read read = img.get_data().read(); glBindTexture(texture->target, texture->tex_id); glTexSubImage2D( blit_target, 0, p_x,p_y,img.get_width(),img.get_height(),format,GL_UNSIGNED_BYTE,read.ptr() ); @@ -770,7 +770,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr ERR_FAIL_COND_V( surface->index_array_len<=0, ERR_INVALID_DATA ); ERR_FAIL_COND_V( p_array.get_type() != Variant::INT_ARRAY, ERR_INVALID_PARAMETER ); - DVector<int> indices = p_array; + PoolVector<int> indices = p_array; ERR_FAIL_COND_V( indices.size() == 0, ERR_INVALID_PARAMETER ); ERR_FAIL_COND_V( indices.size() != surface->index_array_len, ERR_INVALID_PARAMETER ); @@ -780,7 +780,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,surface->index_id); }; - DVector<int>::Read read = indices.read(); + PoolVector<int>::Read read = indices.read(); const int *src=read.ptr(); for (int i=0;i<surface->index_array_len;i++) { @@ -822,14 +822,14 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr ERR_FAIL_COND_V( p_array.get_type() != Variant::VECTOR3_ARRAY, ERR_INVALID_PARAMETER ); - DVector<Vector3> array = p_array; + PoolVector<Vector3> array = p_array; ERR_FAIL_COND_V( array.size() != surface->array_len, ERR_INVALID_PARAMETER ); if (surface->array_local == 0) { glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); }; - DVector<Vector3>::Read read = array.read(); + PoolVector<Vector3>::Read read = array.read(); const Vector3* src=read.ptr(); // setting vertices means regenerating the AABB @@ -868,7 +868,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr ERR_FAIL_COND_V( p_array.get_type() != Variant::REAL_ARRAY, ERR_INVALID_PARAMETER ); - DVector<real_t> array = p_array; + PoolVector<real_t> array = p_array; ERR_FAIL_COND_V( array.size() != surface->array_len*4, ERR_INVALID_PARAMETER ); @@ -877,7 +877,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr }; - DVector<real_t>::Read read = array.read(); + PoolVector<real_t>::Read read = array.read(); const real_t* src = read.ptr(); for (int i=0;i<surface->array_len;i++) { @@ -908,7 +908,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr ERR_FAIL_COND_V( p_array.get_type() != Variant::COLOR_ARRAY, ERR_INVALID_PARAMETER ); - DVector<Color> array = p_array; + PoolVector<Color> array = p_array; ERR_FAIL_COND_V( array.size() != surface->array_len, ERR_INVALID_PARAMETER ); @@ -916,7 +916,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); - DVector<Color>::Read read = array.read(); + PoolVector<Color>::Read read = array.read(); const Color* src = read.ptr(); surface->has_alpha_cache=false; @@ -943,14 +943,14 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr ERR_FAIL_COND_V( p_array.get_type() != Variant::VECTOR3_ARRAY, ERR_INVALID_PARAMETER ); - DVector<Vector3> array = p_array; + PoolVector<Vector3> array = p_array; ERR_FAIL_COND_V( array.size() != surface->array_len , ERR_INVALID_PARAMETER); if (surface->array_local == 0) glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); - DVector<Vector3>::Read read = array.read(); + PoolVector<Vector3>::Read read = array.read(); const Vector3 * src=read.ptr(); @@ -975,14 +975,14 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr ERR_FAIL_COND_V( p_array.get_type() != Variant::REAL_ARRAY, ERR_INVALID_PARAMETER ); - DVector<real_t> array = p_array; + PoolVector<real_t> array = p_array; ERR_FAIL_COND_V( array.size() != surface->array_len*VS::ARRAY_WEIGHTS_SIZE, ERR_INVALID_PARAMETER ); if (surface->array_local == 0) glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); - DVector<real_t>::Read read = array.read(); + PoolVector<real_t>::Read read = array.read(); const real_t * src = read.ptr(); diff --git a/platform/javascript/audio_server_javascript.cpp b/platform/javascript/audio_server_javascript.cpp index fec553df04..d1fba030a5 100644 --- a/platform/javascript/audio_server_javascript.cpp +++ b/platform/javascript/audio_server_javascript.cpp @@ -87,7 +87,7 @@ const void* AudioServerJavascript::sample_get_data_ptr(RID p_sample) const{ return NULL; } -void AudioServerJavascript::sample_set_data(RID p_sample, const DVector<uint8_t>& p_buffer){ +void AudioServerJavascript::sample_set_data(RID p_sample, const PoolVector<uint8_t>& p_buffer){ Sample *sample = sample_owner.get(p_sample); ERR_FAIL_COND(!sample); @@ -95,7 +95,7 @@ void AudioServerJavascript::sample_set_data(RID p_sample, const DVector<uint8_t> Vector<float> buffer; buffer.resize(sample->length*chans); - DVector<uint8_t>::Read r=p_buffer.read(); + PoolVector<uint8_t>::Read r=p_buffer.read(); if (sample->format==SAMPLE_FORMAT_PCM8) { const int8_t*ptr = (const int8_t*)r.ptr(); for(int i=0;i<sample->length*chans;i++) { @@ -116,10 +116,10 @@ void AudioServerJavascript::sample_set_data(RID p_sample, const DVector<uint8_t> } -DVector<uint8_t> AudioServerJavascript::sample_get_data(RID p_sample) const{ +PoolVector<uint8_t> AudioServerJavascript::sample_get_data(RID p_sample) const{ - return DVector<uint8_t>(); + return PoolVector<uint8_t>(); } void AudioServerJavascript::sample_set_mix_rate(RID p_sample,int p_rate){ diff --git a/platform/javascript/audio_server_javascript.h b/platform/javascript/audio_server_javascript.h index 47aadf6bc6..8e61e94dfc 100644 --- a/platform/javascript/audio_server_javascript.h +++ b/platform/javascript/audio_server_javascript.h @@ -131,8 +131,8 @@ public: virtual const void* sample_get_data_ptr(RID p_sample) const; - virtual void sample_set_data(RID p_sample, const DVector<uint8_t>& p_buffer); - virtual DVector<uint8_t> sample_get_data(RID p_sample) const; + virtual void sample_set_data(RID p_sample, const PoolVector<uint8_t>& p_buffer); + virtual PoolVector<uint8_t> sample_get_data(RID p_sample) const; virtual void sample_set_mix_rate(RID p_sample,int p_rate); virtual int sample_get_mix_rate(RID p_sample) const; diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index f27eb98764..548d33ebfa 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1327,8 +1327,8 @@ void OS_OSX::set_icon(const Image& p_icon) { uint8_t *pixels = [imgrep bitmapData]; int len = img.get_width()*img.get_height(); - DVector<uint8_t> data = img.get_data(); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t> data = img.get_data(); + PoolVector<uint8_t>::Read r = data.read(); /* Premultiply the alpha channel */ for (int i = 0; i<len ; i++) { diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 97ed8d7ae0..5beef2693f 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2126,7 +2126,7 @@ void OS_Windows::set_icon(const Image& p_icon) { encode_uint32(0,&icon_bmp[36]); uint8_t *wr=&icon_bmp[40]; - DVector<uint8_t>::Read r= icon.get_data().read(); + PoolVector<uint8_t>::Read r= icon.get_data().read(); for(int i=0;i<h;i++) { diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 74482a57e7..e560b46d4b 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1894,7 +1894,7 @@ void OS_X11::set_icon(const Image& p_icon) { pd[0]=w; pd[1]=h; - DVector<uint8_t>::Read r = img.get_data().read(); + PoolVector<uint8_t>::Read r = img.get_data().read(); long * wr = &pd[2]; uint8_t const * pr = r.ptr(); diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index 4b7a918023..46baa7c184 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -68,16 +68,16 @@ void CollisionPolygon2D::_add_to_collision_object(Object *p_obj) { Ref<ConcavePolygonShape2D> concave = memnew( ConcavePolygonShape2D ); - DVector<Vector2> segments; + PoolVector<Vector2> segments; segments.resize(polygon.size()*2); - DVector<Vector2>::Write w=segments.write(); + PoolVector<Vector2>::Write w=segments.write(); for(int i=0;i<polygon.size();i++) { w[(i<<1)+0]=polygon[i]; w[(i<<1)+1]=polygon[(i+1)%polygon.size()]; } - w=DVector<Vector2>::Write(); + w=PoolVector<Vector2>::Write(); concave->set_segments(segments); co->add_shape(concave,get_transform()); diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index ac1fb16d78..ac2a8d4dc5 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -29,14 +29,14 @@ #include "light_occluder_2d.h" -void OccluderPolygon2D::set_polygon(const DVector<Vector2>& p_polygon) { +void OccluderPolygon2D::set_polygon(const PoolVector<Vector2>& p_polygon) { polygon=p_polygon; VS::get_singleton()->canvas_occluder_polygon_set_shape(occ_polygon,p_polygon,closed); emit_changed(); } -DVector<Vector2> OccluderPolygon2D::get_polygon() const{ +PoolVector<Vector2> OccluderPolygon2D::get_polygon() const{ return polygon; } @@ -141,7 +141,7 @@ void LightOccluder2D::_notification(int p_what) { if (occluder_polygon.is_valid()) { - DVector<Vector2> poly = occluder_polygon->get_polygon(); + PoolVector<Vector2> poly = occluder_polygon->get_polygon(); if (poly.size()) { if (occluder_polygon->is_closed()) { @@ -151,7 +151,7 @@ void LightOccluder2D::_notification(int p_what) { } else { int ps=poly.size(); - DVector<Vector2>::Read r = poly.read(); + PoolVector<Vector2>::Read r = poly.read(); 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 1d7430689f..777785cd1d 100644 --- a/scene/2d/light_occluder_2d.h +++ b/scene/2d/light_occluder_2d.h @@ -45,7 +45,7 @@ private: RID occ_polygon; - DVector<Vector2> polygon; + PoolVector<Vector2> polygon; bool closed; CullMode cull; @@ -54,8 +54,8 @@ protected: static void _bind_methods(); public: - void set_polygon(const DVector<Vector2>& p_polygon); - DVector<Vector2> get_polygon() const; + void set_polygon(const PoolVector<Vector2>& p_polygon); + PoolVector<Vector2> get_polygon() const; void set_closed(bool p_closed); bool is_closed() const; diff --git a/scene/2d/navigation2d.cpp b/scene/2d/navigation2d.cpp index 1a7d01c762..be68c61bd8 100644 --- a/scene/2d/navigation2d.cpp +++ b/scene/2d/navigation2d.cpp @@ -36,12 +36,12 @@ void Navigation2D::_navpoly_link(int p_id) { NavMesh &nm=navpoly_map[p_id]; ERR_FAIL_COND(nm.linked); - DVector<Vector2> vertices=nm.navpoly->get_vertices(); + PoolVector<Vector2> vertices=nm.navpoly->get_vertices(); int len = vertices.size(); if (len==0) return; - DVector<Vector2>::Read r=vertices.read(); + PoolVector<Vector2>::Read r=vertices.read(); for(int i=0;i<nm.navpoly->get_polygon_count();i++) { diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index a11f2240f9..add3a183ef 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -31,12 +31,12 @@ #include "triangulator.h" #include "core_string_names.h" -void NavigationPolygon::set_vertices(const DVector<Vector2>& p_vertices) { +void NavigationPolygon::set_vertices(const PoolVector<Vector2>& p_vertices) { vertices=p_vertices; } -DVector<Vector2> NavigationPolygon::get_vertices() const{ +PoolVector<Vector2> NavigationPolygon::get_vertices() const{ return vertices; } @@ -89,7 +89,7 @@ void NavigationPolygon::add_polygon(const Vector<int>& p_polygon){ } -void NavigationPolygon::add_outline_at_index(const DVector<Vector2>& p_outline,int p_index) { +void NavigationPolygon::add_outline_at_index(const PoolVector<Vector2>& p_outline,int p_index) { outlines.insert(p_index,p_outline); } @@ -108,7 +108,7 @@ void NavigationPolygon::clear_polygons(){ polygons.clear(); } -void NavigationPolygon::add_outline(const DVector<Vector2>& p_outline) { +void NavigationPolygon::add_outline(const PoolVector<Vector2>& p_outline) { outlines.push_back(p_outline); } @@ -118,7 +118,7 @@ int NavigationPolygon::get_outline_count() const{ return outlines.size(); } -void NavigationPolygon::set_outline(int p_idx,const DVector<Vector2>& p_outline) { +void NavigationPolygon::set_outline(int p_idx,const PoolVector<Vector2>& p_outline) { ERR_FAIL_INDEX(p_idx,outlines.size()); outlines[p_idx]=p_outline; } @@ -130,8 +130,8 @@ void NavigationPolygon::remove_outline(int p_idx) { } -DVector<Vector2> NavigationPolygon::get_outline(int p_idx) const { - ERR_FAIL_INDEX_V(p_idx,outlines.size(),DVector<Vector2>()); +PoolVector<Vector2> NavigationPolygon::get_outline(int p_idx) const { + ERR_FAIL_INDEX_V(p_idx,outlines.size(),PoolVector<Vector2>()); return outlines[p_idx]; } @@ -147,11 +147,11 @@ void NavigationPolygon::make_polygons_from_outlines(){ for(int i=0;i<outlines.size();i++) { - DVector<Vector2> ol = outlines[i]; + PoolVector<Vector2> ol = outlines[i]; int olsize = ol.size(); if (olsize<3) continue; - DVector<Vector2>::Read r=ol.read(); + PoolVector<Vector2>::Read r=ol.read(); 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 ); @@ -165,11 +165,11 @@ void NavigationPolygon::make_polygons_from_outlines(){ for(int i=0;i<outlines.size();i++) { - DVector<Vector2> ol = outlines[i]; + PoolVector<Vector2> ol = outlines[i]; int olsize = ol.size(); if (olsize<3) continue; - DVector<Vector2>::Read r=ol.read(); + PoolVector<Vector2>::Read r=ol.read(); int interscount=0; //test if this is an outer outline @@ -178,11 +178,11 @@ void NavigationPolygon::make_polygons_from_outlines(){ if (i==k) continue; //no self intersect - DVector<Vector2> ol2 = outlines[k]; + PoolVector<Vector2> ol2 = outlines[k]; int olsize2 = ol2.size(); if (olsize2<3) continue; - DVector<Vector2>::Read r2=ol2.read(); + PoolVector<Vector2>::Read r2=ol2.read(); for(int l=0;l<olsize2;l++) { @@ -368,7 +368,7 @@ void NavigationPolygonInstance::_notification(int p_what) { if (is_inside_tree() && (get_tree()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()) && navpoly.is_valid()) { - DVector<Vector2> verts=navpoly->get_vertices(); + PoolVector<Vector2> verts=navpoly->get_vertices(); int vsize = verts.size(); if (vsize<3) return; @@ -385,7 +385,7 @@ void NavigationPolygonInstance::_notification(int p_what) { vertices.resize(vsize); colors.resize(vsize); { - DVector<Vector2>::Read vr = verts.read(); + PoolVector<Vector2>::Read vr = verts.read(); for(int i=0;i<vsize;i++) { vertices[i]=vr[i]; colors[i]=color; diff --git a/scene/2d/navigation_polygon.h b/scene/2d/navigation_polygon.h index edf3dcadc3..7f1762b6f5 100644 --- a/scene/2d/navigation_polygon.h +++ b/scene/2d/navigation_polygon.h @@ -36,12 +36,12 @@ class NavigationPolygon : public Resource { GDCLASS( NavigationPolygon, Resource ); - DVector<Vector2> vertices; + PoolVector<Vector2> vertices; struct Polygon { Vector<int> indices; }; Vector<Polygon> polygons; - Vector< DVector<Vector2> > outlines; + Vector< PoolVector<Vector2> > outlines; protected: @@ -57,16 +57,16 @@ public: - void set_vertices(const DVector<Vector2>& p_vertices); - DVector<Vector2> get_vertices() const; + void set_vertices(const PoolVector<Vector2>& p_vertices); + PoolVector<Vector2> get_vertices() const; void add_polygon(const Vector<int>& p_polygon); int get_polygon_count() const; - void add_outline(const DVector<Vector2>& p_outline); - void add_outline_at_index(const DVector<Vector2>& p_outline,int p_index); - void set_outline(int p_idx,const DVector<Vector2>& p_outline); - DVector<Vector2> get_outline(int p_idx) 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 remove_outline(int p_idx); int get_outline_count() const; diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index 168bd1b289..f8747d54b7 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -276,7 +276,7 @@ void Particles2D::_process_particles(float p_delta) { active_count=0; - DVector<Point2>::Read r; + PoolVector<Point2>::Read r; int emission_point_count=0; if (emission_points.size()) { @@ -992,12 +992,12 @@ int Particles2D::get_v_frames() const{ -void Particles2D::set_emission_points(const DVector<Vector2>& p_points) { +void Particles2D::set_emission_points(const PoolVector<Vector2>& p_points) { emission_points=p_points; } -DVector<Vector2> Particles2D::get_emission_points() const{ +PoolVector<Vector2> Particles2D::get_emission_points() const{ return emission_points; } diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h index 9b740dad7d..91f42c5222 100644 --- a/scene/2d/particles_2d.h +++ b/scene/2d/particles_2d.h @@ -151,7 +151,7 @@ private: Point2 emissor_offset; Vector2 initial_velocity; Vector2 extents; - DVector<Vector2> emission_points; + PoolVector<Vector2> emission_points; float time; int active_count; @@ -245,8 +245,8 @@ public: void set_initial_velocity(const Vector2& p_velocity); Vector2 get_initial_velocity() const; - void set_emission_points(const DVector<Vector2>& p_points); - DVector<Vector2> get_emission_points() const; + void set_emission_points(const PoolVector<Vector2>& p_points); + PoolVector<Vector2> get_emission_points() const; void pre_process(float p_delta); void reset(); diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index 179e71fa90..948c8b0818 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -33,7 +33,7 @@ Rect2 Polygon2D::get_item_rect() const { if (rect_cache_dirty){ int l =polygon.size(); - DVector<Vector2>::Read r = polygon.read(); + PoolVector<Vector2>::Read r = polygon.read(); item_rect=Rect2(); for(int i=0;i<l;i++) { Vector2 pos = r[i] + offset; @@ -84,7 +84,7 @@ void Polygon2D::_notification(int p_what) { int len = points.size(); { - DVector<Vector2>::Read polyr =polygon.read(); + PoolVector<Vector2>::Read polyr =polygon.read(); for(int i=0;i<len;i++) { points[i]=polyr[i]+offset; } @@ -157,7 +157,7 @@ void Polygon2D::_notification(int p_what) { if (points.size()==uv.size()) { - DVector<Vector2>::Read uvr = uv.read(); + PoolVector<Vector2>::Read uvr = uv.read(); for(int i=0;i<len;i++) { uvs[i]=texmat.xform(uvr[i])/tex_size; @@ -176,7 +176,7 @@ void Polygon2D::_notification(int p_what) { int color_len=vertex_colors.size(); colors.resize(len); { - DVector<Color>::Read color_r=vertex_colors.read(); + PoolVector<Color>::Read color_r=vertex_colors.read(); for(int i=0;i<color_len && i<len;i++){ colors[i]=color_r[i]; } @@ -194,25 +194,25 @@ void Polygon2D::_notification(int p_what) { } -void Polygon2D::set_polygon(const DVector<Vector2>& p_polygon) { +void Polygon2D::set_polygon(const PoolVector<Vector2>& p_polygon) { polygon=p_polygon; rect_cache_dirty=true; update(); } -DVector<Vector2> Polygon2D::get_polygon() const{ +PoolVector<Vector2> Polygon2D::get_polygon() const{ return polygon; } -void Polygon2D::set_uv(const DVector<Vector2>& p_uv) { +void Polygon2D::set_uv(const PoolVector<Vector2>& p_uv) { uv=p_uv; update(); } -DVector<Vector2> Polygon2D::get_uv() const{ +PoolVector<Vector2> Polygon2D::get_uv() const{ return uv; } @@ -227,12 +227,12 @@ Color Polygon2D::get_color() const{ return color; } -void Polygon2D::set_vertex_colors(const DVector<Color>& p_colors){ +void Polygon2D::set_vertex_colors(const PoolVector<Color>& p_colors){ vertex_colors=p_colors; update(); } -DVector<Color> Polygon2D::get_vertex_colors() const{ +PoolVector<Color> Polygon2D::get_vertex_colors() const{ return vertex_colors; } diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h index 6327021295..8434dae40c 100644 --- a/scene/2d/polygon_2d.h +++ b/scene/2d/polygon_2d.h @@ -35,9 +35,9 @@ class Polygon2D : public Node2D { GDCLASS(Polygon2D,Node2D); - DVector<Vector2> polygon; - DVector<Vector2> uv; - DVector<Color> vertex_colors; + PoolVector<Vector2> polygon; + PoolVector<Vector2> uv; + PoolVector<Color> vertex_colors; Color color; Ref<Texture> texture; Size2 tex_scale; @@ -60,17 +60,17 @@ protected: static void _bind_methods(); public: - void set_polygon(const DVector<Vector2>& p_polygon); - DVector<Vector2> get_polygon() const; + void set_polygon(const PoolVector<Vector2>& p_polygon); + PoolVector<Vector2> get_polygon() const; - void set_uv(const DVector<Vector2>& p_uv); - DVector<Vector2> get_uv() const; + void set_uv(const PoolVector<Vector2>& p_uv); + PoolVector<Vector2> get_uv() const; void set_color(const Color& p_color); Color get_color() const; - void set_vertex_colors(const DVector<Color>& p_colors); - DVector<Color> get_vertex_colors() const; + void set_vertex_colors(const PoolVector<Color>& p_colors); + PoolVector<Color> get_vertex_colors() const; void set_texture(const Ref<Texture>& p_texture); Ref<Texture> get_texture() const; diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 54d3f9f5dd..04b0379a1c 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -819,10 +819,10 @@ void TileMap::clear() { tile_map.clear(); } -void TileMap::_set_tile_data(const DVector<int>& p_data) { +void TileMap::_set_tile_data(const PoolVector<int>& p_data) { int c=p_data.size(); - DVector<int>::Read r = p_data.read(); + PoolVector<int>::Read r = p_data.read(); for(int i=0;i<c;i+=2) { @@ -857,11 +857,11 @@ void TileMap::_set_tile_data(const DVector<int>& p_data) { } -DVector<int> TileMap::_get_tile_data() const { +PoolVector<int> TileMap::_get_tile_data() const { - DVector<int> data; + PoolVector<int> data; data.resize(tile_map.size()*2); - DVector<int>::Write w = data.write(); + PoolVector<int>::Write w = data.write(); int idx=0; for(const Map<PosKey,Cell>::Element *E=tile_map.front();E;E=E->next()) { @@ -882,7 +882,7 @@ DVector<int> TileMap::_get_tile_data() const { } - w = DVector<int>::Write(); + w = PoolVector<int>::Write(); return data; diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index 8cc144b74d..f863c0b2ea 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -168,8 +168,8 @@ private: _FORCE_INLINE_ int _get_quadrant_size() const; - void _set_tile_data(const DVector<int>& p_data); - DVector<int> _get_tile_data() const; + void _set_tile_data(const PoolVector<int>& p_data); + PoolVector<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/baked_light_instance.cpp b/scene/3d/baked_light_instance.cpp index b5cc451835..f85dfea80e 100644 --- a/scene/3d/baked_light_instance.cpp +++ b/scene/3d/baked_light_instance.cpp @@ -204,7 +204,7 @@ Vector<Color> BakedLight::_get_bake_texture(Image &p_image,const Color& p_color) p_image.resize(bake_texture_size,bake_texture_size,Image::INTERPOLATE_CUBIC); - DVector<uint8_t>::Read r = p_image.get_data().read(); + PoolVector<uint8_t>::Read r = p_image.get_data().read(); ret.resize(bake_texture_size*bake_texture_size); for(int i=0;i<bake_texture_size*bake_texture_size;i++) { @@ -506,7 +506,7 @@ void BakedLight::_plot_face(int p_idx, int p_level, const Vector3 *p_vtx, const if (bake_cells_used==(1<<bake_cells_alloc)) { //exhausted cells, creating more space bake_cells_alloc++; - bake_cells_write=DVector<BakeCell>::Write(); + bake_cells_write=PoolVector<BakeCell>::Write(); bake_cells.resize(1<<bake_cells_alloc); bake_cells_write=bake_cells.write(); } @@ -670,11 +670,11 @@ void BakedLight::_bake_add_mesh(const Transform& p_xform,Ref<Mesh>& p_mesh) { Array a = p_mesh->surface_get_arrays(i); - DVector<Vector3> vertices = a[Mesh::ARRAY_VERTEX]; - DVector<Vector3>::Read vr=vertices.read(); - DVector<Vector2> uv = a[Mesh::ARRAY_TEX_UV]; - DVector<Vector2>::Read uvr; - DVector<int> index = a[Mesh::ARRAY_INDEX]; + 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<int> index = a[Mesh::ARRAY_INDEX]; bool read_uv=false; @@ -687,7 +687,7 @@ void BakedLight::_bake_add_mesh(const Transform& p_xform,Ref<Mesh>& p_mesh) { if (index.size()) { int facecount = index.size()/3; - DVector<int>::Read ir=index.read(); + PoolVector<int>::Read ir=index.read(); for(int j=0;j<facecount;j++) { @@ -747,9 +747,9 @@ void BakedLight::_bake_add_to_aabb(const Transform& p_xform,Ref<Mesh>& p_mesh,bo continue; //only triangles Array a = p_mesh->surface_get_arrays(i); - DVector<Vector3> vertices = a[Mesh::ARRAY_VERTEX]; + PoolVector<Vector3> vertices = a[Mesh::ARRAY_VERTEX]; int vc = vertices.size(); - DVector<Vector3>::Read vr=vertices.read(); + PoolVector<Vector3>::Read vr=vertices.read(); if (first) { bounds.pos=p_xform.xform(vr[0]); @@ -827,7 +827,7 @@ void BakedLight::bake() { _fixup_plot(0, 0,0,0,0); - bake_cells_write=DVector<BakeCell>::Write(); + bake_cells_write=PoolVector<BakeCell>::Write(); bake_cells.resize(bake_cells_used); @@ -1005,7 +1005,7 @@ void BakedLight::bake_lights() { _upscale_light(0,0); - bake_cells_write=DVector<BakeCell>::Write(); + bake_cells_write=PoolVector<BakeCell>::Write(); } @@ -1371,7 +1371,7 @@ void BakedLight::bake_radiance() { _bake_radiance(0,0,0,0,0); - bake_cells_write=DVector<BakeCell>::Write(); + bake_cells_write=PoolVector<BakeCell>::Write(); } int BakedLight::_find_cell(int x,int y, int z) { @@ -1538,9 +1538,9 @@ AABB BakedLight::get_aabb() const { return AABB(Vector3(0,0,0),Vector3(1,1,1)); } -DVector<Face3> BakedLight::get_faces(uint32_t p_usage_flags) const { +PoolVector<Face3> BakedLight::get_faces(uint32_t p_usage_flags) const { - return DVector<Face3>(); + return PoolVector<Face3>(); } @@ -1621,8 +1621,8 @@ void BakedLight::create_debug_mesh(DebugMode p_mode) { Array arr; arr.resize(Mesh::ARRAY_MAX); - DVector<Vector3> vertices; - DVector<Color> colors; + PoolVector<Vector3> vertices; + PoolVector<Color> colors; int vtx_idx=0; #define ADD_VTX(m_idx);\ diff --git a/scene/3d/baked_light_instance.h b/scene/3d/baked_light_instance.h index d097a9af60..461b3adeff 100644 --- a/scene/3d/baked_light_instance.h +++ b/scene/3d/baked_light_instance.h @@ -107,8 +107,8 @@ private: int bake_cells_used; int zero_alphas; Vector<int> bake_cells_level_used; - DVector<BakeCell> bake_cells; - DVector<BakeCell>::Write bake_cells_write; + PoolVector<BakeCell> bake_cells; + PoolVector<BakeCell>::Write bake_cells_write; @@ -157,7 +157,7 @@ public: void create_debug_mesh(DebugMode p_mode); virtual AABB get_aabb() const; - virtual DVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; String get_configuration_warning() const; @@ -192,7 +192,7 @@ protected: public: virtual AABB get_aabb() const; - virtual DVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; void set_param(Param p_param,float p_value); float get_param(Param p_param) const; diff --git a/scene/3d/body_shape.cpp b/scene/3d/body_shape.cpp index 0f71933388..ff8b0f15bf 100644 --- a/scene/3d/body_shape.cpp +++ b/scene/3d/body_shape.cpp @@ -83,8 +83,8 @@ void CollisionShape::_update_indicator() { if (shape.is_null()) return; - DVector<Vector3> points; - DVector<Vector3> normals; + PoolVector<Vector3> points; + PoolVector<Vector3> normals; VS::PrimitiveType pt = VS::PRIMITIVE_TRIANGLES; @@ -235,7 +235,7 @@ void CollisionShape::_update_indicator() { CapsuleShape *shapeptr=shape->cast_to<CapsuleShape>(); - DVector<Plane> planes = Geometry::build_capsule_planes(shapeptr->get_radius(), shapeptr->get_height()/2.0, 12, Vector3::AXIS_Z); + PoolVector<Plane> planes = Geometry::build_capsule_planes(shapeptr->get_radius(), shapeptr->get_height()/2.0, 12, Vector3::AXIS_Z); Geometry::MeshData md = Geometry::build_convex_mesh(planes); for(int i=0;i<md.faces.size();i++) { @@ -840,7 +840,7 @@ void CollisionShapeCylinder::update_indicator(RID p_indicator) { vs->poly_clear(p_indicator); Color col(0.4,1.0,1.0,0.5); - DVector<Plane> planes = Geometry::build_cylinder_planes(radius, height, 12, Vector3::AXIS_Z); + PoolVector<Plane> planes = Geometry::build_cylinder_planes(radius, height, 12, Vector3::AXIS_Z); Geometry::MeshData md = Geometry::build_convex_mesh(planes); for(int i=0;i<md.faces.size();i++) { @@ -906,7 +906,7 @@ void CollisionShapeCapsule::update_indicator(RID p_indicator) { vs->poly_clear(p_indicator); Color col(0.4,1.0,1.0,0.5); - DVector<Plane> planes = Geometry::build_capsule_planes(radius, height, 12, 3, Vector3::AXIS_Z); + PoolVector<Plane> planes = Geometry::build_capsule_planes(radius, height, 12, 3, Vector3::AXIS_Z); Geometry::MeshData md = Geometry::build_convex_mesh(planes); for(int i=0;i<md.faces.size();i++) { diff --git a/scene/3d/collision_polygon.cpp b/scene/3d/collision_polygon.cpp index 8c34748191..6cc0291707 100644 --- a/scene/3d/collision_polygon.cpp +++ b/scene/3d/collision_polygon.cpp @@ -56,11 +56,11 @@ void CollisionPolygon::_add_to_collision_object(Object *p_obj) { shape_from=co->get_shape_count(); for(int i=0;i<decomp.size();i++) { Ref<ConvexPolygonShape> convex = memnew( ConvexPolygonShape ); - DVector<Vector3> cp; + PoolVector<Vector3> cp; int cs = decomp[i].size(); cp.resize(cs*2); { - DVector<Vector3>::Write w = cp.write(); + PoolVector<Vector3>::Write w = cp.write(); int idx=0; for(int j=0;j<cs;j++) { @@ -84,16 +84,16 @@ void CollisionPolygon::_add_to_collision_object(Object *p_obj) { #if 0 Ref<ConcavePolygonShape> concave = memnew( ConcavePolygonShape ); - DVector<Vector2> segments; + PoolVector<Vector2> segments; segments.resize(polygon.size()*2); - DVector<Vector2>::Write w=segments.write(); + PoolVector<Vector2>::Write w=segments.write(); for(int i=0;i<polygon.size();i++) { w[(i<<1)+0]=polygon[i]; w[(i<<1)+1]=polygon[(i+1)%polygon.size()]; } - w=DVector<Vector2>::Write(); + w=PoolVector<Vector2>::Write(); concave->set_segments(segments); co->add_shape(concave,get_transform()); diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 19c67faa39..5b51273d0e 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -37,12 +37,12 @@ Transform GIProbeData::get_to_cell_xform() const { } -void GIProbeData::set_dynamic_data(const DVector<int>& p_data){ +void GIProbeData::set_dynamic_data(const PoolVector<int>& p_data){ VS::get_singleton()->gi_probe_set_dynamic_data(probe,p_data); } -DVector<int> GIProbeData::get_dynamic_data() const{ +PoolVector<int> GIProbeData::get_dynamic_data() const{ return VS::get_singleton()->gi_probe_get_dynamic_data(probe); } @@ -832,7 +832,7 @@ Vector<Color> GIProbe::_get_bake_texture(Image &p_image,const Color& p_color) { p_image.resize(bake_texture_size,bake_texture_size,Image::INTERPOLATE_CUBIC); - DVector<uint8_t>::Read r = p_image.get_data().read(); + PoolVector<uint8_t>::Read r = p_image.get_data().read(); ret.resize(bake_texture_size*bake_texture_size); for(int i=0;i<bake_texture_size*bake_texture_size;i++) { @@ -919,11 +919,11 @@ void GIProbe::_plot_mesh(const Transform& p_xform, Ref<Mesh>& p_mesh, Baker *p_b Array a = p_mesh->surface_get_arrays(i); - DVector<Vector3> vertices = a[Mesh::ARRAY_VERTEX]; - DVector<Vector3>::Read vr=vertices.read(); - DVector<Vector2> uv = a[Mesh::ARRAY_TEX_UV]; - DVector<Vector2>::Read uvr; - DVector<int> index = a[Mesh::ARRAY_INDEX]; + 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<int> index = a[Mesh::ARRAY_INDEX]; bool read_uv=false; @@ -936,7 +936,7 @@ void GIProbe::_plot_mesh(const Transform& p_xform, Ref<Mesh>& p_mesh, Baker *p_b if (index.size()) { int facecount = index.size()/3; - DVector<int>::Read ir=index.read(); + PoolVector<int>::Read ir=index.read(); for(int j=0;j<facecount;j++) { @@ -1090,12 +1090,12 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug){ //create the data for visual server - DVector<int> data; + PoolVector<int> data; data.resize( 16+(8+1+1+1+1)*baker.bake_cells.size() ); //4 for header, rest for rest. { - DVector<int>::Write w = data.write(); + PoolVector<int>::Write w = data.write(); uint32_t * w32 = (uint32_t*)w.ptr(); @@ -1247,8 +1247,8 @@ void GIProbe::_create_debug_mesh(Baker *p_baker) { Array arr; arr.resize(Mesh::ARRAY_MAX); - DVector<Vector3> vertices; - DVector<Color> colors; + PoolVector<Vector3> vertices; + PoolVector<Color> colors; int vtx_idx=0; #define ADD_VTX(m_idx);\ @@ -1333,9 +1333,9 @@ AABB GIProbe::get_aabb() const { return AABB(-extents,extents*2); } -DVector<Face3> GIProbe::get_faces(uint32_t p_usage_flags) const { +PoolVector<Face3> GIProbe::get_faces(uint32_t p_usage_flags) const { - return DVector<Face3>(); + return PoolVector<Face3>(); } void GIProbe::_bind_methods() { diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h index 4b06c13268..55cde2960a 100644 --- a/scene/3d/gi_probe.h +++ b/scene/3d/gi_probe.h @@ -26,8 +26,8 @@ public: void set_to_cell_xform(const Transform& p_xform); Transform get_to_cell_xform() const; - void set_dynamic_data(const DVector<int>& p_data); - DVector<int> get_dynamic_data() const; + void set_dynamic_data(const PoolVector<int>& p_data); + PoolVector<int> get_dynamic_data() const; void set_dynamic_range(int p_range); int get_dynamic_range() const; @@ -179,7 +179,7 @@ public: void bake(Node *p_from_node=NULL,bool p_create_visual_debug=false); virtual AABB get_aabb() const; - virtual DVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; GIProbe(); ~GIProbe(); diff --git a/scene/3d/immediate_geometry.cpp b/scene/3d/immediate_geometry.cpp index 4ee2e646e6..ee200cb3ea 100644 --- a/scene/3d/immediate_geometry.cpp +++ b/scene/3d/immediate_geometry.cpp @@ -96,9 +96,9 @@ AABB ImmediateGeometry::get_aabb() const { return aabb; } -DVector<Face3> ImmediateGeometry::get_faces(uint32_t p_usage_flags) const { +PoolVector<Face3> ImmediateGeometry::get_faces(uint32_t p_usage_flags) const { - return DVector<Face3>(); + return PoolVector<Face3>(); } diff --git a/scene/3d/immediate_geometry.h b/scene/3d/immediate_geometry.h index 3c8a76fbc7..bf624e67fd 100644 --- a/scene/3d/immediate_geometry.h +++ b/scene/3d/immediate_geometry.h @@ -67,7 +67,7 @@ public: virtual AABB get_aabb() const; - virtual DVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; ImmediateGeometry(); ~ImmediateGeometry(); diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 84a6fecf5e..ba3c63c403 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -135,9 +135,9 @@ AABB Light::get_aabb() const { return AABB(); } -DVector<Face3> Light::get_faces(uint32_t p_usage_flags) const { +PoolVector<Face3> Light::get_faces(uint32_t p_usage_flags) const { - return DVector<Face3>(); + return PoolVector<Face3>(); } diff --git a/scene/3d/light.h b/scene/3d/light.h index d3585b5cf2..3481d0229c 100644 --- a/scene/3d/light.h +++ b/scene/3d/light.h @@ -118,7 +118,7 @@ public: virtual AABB get_aabb() const; - virtual DVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual PoolVector<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 ef633ac301..5b12f80d5c 100644 --- a/scene/3d/mesh_instance.cpp +++ b/scene/3d/mesh_instance.cpp @@ -177,13 +177,13 @@ AABB MeshInstance::get_aabb() const { return AABB(); } -DVector<Face3> MeshInstance::get_faces(uint32_t p_usage_flags) const { +PoolVector<Face3> MeshInstance::get_faces(uint32_t p_usage_flags) const { if (!(p_usage_flags&(FACES_SOLID|FACES_ENCLOSING))) - return DVector<Face3>(); + return PoolVector<Face3>(); if (mesh.is_null()) - return DVector<Face3>(); + return PoolVector<Face3>(); return mesh->get_faces(); } diff --git a/scene/3d/mesh_instance.h b/scene/3d/mesh_instance.h index 92f181c24e..1291d6b12f 100644 --- a/scene/3d/mesh_instance.h +++ b/scene/3d/mesh_instance.h @@ -81,7 +81,7 @@ public: void create_convex_collision(); virtual AABB get_aabb() const; - virtual DVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual PoolVector<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 44cd7485ca..a9d1de1cfa 100644 --- a/scene/3d/multimesh_instance.cpp +++ b/scene/3d/multimesh_instance.cpp @@ -58,9 +58,9 @@ Ref<MultiMesh> MultiMeshInstance::get_multimesh() const { -DVector<Face3> MultiMeshInstance::get_faces(uint32_t p_usage_flags) const { +PoolVector<Face3> MultiMeshInstance::get_faces(uint32_t p_usage_flags) const { - return DVector<Face3>(); + return PoolVector<Face3>(); } AABB MultiMeshInstance::get_aabb() const { diff --git a/scene/3d/multimesh_instance.h b/scene/3d/multimesh_instance.h index 503f5e75fc..ef2403a44a 100644 --- a/scene/3d/multimesh_instance.h +++ b/scene/3d/multimesh_instance.h @@ -49,7 +49,7 @@ protected: public: - virtual DVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual PoolVector<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/navigation.cpp b/scene/3d/navigation.cpp index 598a935e4b..40666a60dc 100644 --- a/scene/3d/navigation.cpp +++ b/scene/3d/navigation.cpp @@ -36,12 +36,12 @@ void Navigation::_navmesh_link(int p_id) { print_line("LINK"); - DVector<Vector3> vertices=nm.navmesh->get_vertices(); + PoolVector<Vector3> vertices=nm.navmesh->get_vertices(); int len = vertices.size(); if (len==0) return; - DVector<Vector3>::Read r=vertices.read(); + PoolVector<Vector3>::Read r=vertices.read(); for(int i=0;i<nm.navmesh->get_polygon_count();i++) { diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp index 9ed3b4147a..7ec9085e30 100644 --- a/scene/3d/navigation_mesh.cpp +++ b/scene/3d/navigation_mesh.cpp @@ -33,7 +33,7 @@ void NavigationMesh::create_from_mesh(const Ref<Mesh>& p_mesh) { - vertices=DVector<Vector3>(); + vertices=PoolVector<Vector3>(); clear_polygons(); for(int i=0;i<p_mesh->get_surface_count();i++) { @@ -41,15 +41,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); - DVector<Vector3> varr = arr[Mesh::ARRAY_VERTEX]; - DVector<int> iarr = arr[Mesh::ARRAY_INDEX]; + PoolVector<Vector3> varr = arr[Mesh::ARRAY_VERTEX]; + PoolVector<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(); - DVector<int>::Read r = iarr.read(); + PoolVector<int>::Read r = iarr.read(); for(int j=0;j<rlen;j+=3) { Vector<int> vi; @@ -63,12 +63,12 @@ void NavigationMesh::create_from_mesh(const Ref<Mesh>& p_mesh) { } } -void NavigationMesh::set_vertices(const DVector<Vector3>& p_vertices) { +void NavigationMesh::set_vertices(const PoolVector<Vector3>& p_vertices) { vertices=p_vertices; } -DVector<Vector3> NavigationMesh::get_vertices() const{ +PoolVector<Vector3> NavigationMesh::get_vertices() const{ return vertices; } @@ -122,8 +122,8 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() { - DVector<Vector3> vertices = get_vertices(); - DVector<Vector3>::Read vr=vertices.read(); + PoolVector<Vector3> vertices = get_vertices(); + PoolVector<Vector3>::Read vr=vertices.read(); List<Face3> faces; for(int i=0;i<get_polygon_count();i++) { Vector<int> p = get_polygon(i); @@ -140,11 +140,11 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() { Map<_EdgeKey,bool> edge_map; - DVector<Vector3> tmeshfaces; + PoolVector<Vector3> tmeshfaces; tmeshfaces.resize(faces.size()*3); { - DVector<Vector3>::Write tw=tmeshfaces.write(); + PoolVector<Vector3>::Write tw=tmeshfaces.write(); int tidx=0; @@ -185,10 +185,10 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() { } } - DVector<Vector3> varr; + PoolVector<Vector3> varr; varr.resize(lines.size()); { - DVector<Vector3>::Write w = varr.write(); + PoolVector<Vector3>::Write w = varr.write(); int idx=0; for(List<Vector3>::Element *E=lines.front();E;E=E->next()) { w[idx++]=E->get(); diff --git a/scene/3d/navigation_mesh.h b/scene/3d/navigation_mesh.h index a0bdc5a516..e025b7ce8b 100644 --- a/scene/3d/navigation_mesh.h +++ b/scene/3d/navigation_mesh.h @@ -38,7 +38,7 @@ class NavigationMesh : public Resource { GDCLASS( NavigationMesh, Resource ); - DVector<Vector3> vertices; + PoolVector<Vector3> vertices; struct Polygon { Vector<int> indices; }; @@ -65,8 +65,8 @@ public: void create_from_mesh(const Ref<Mesh>& p_mesh); - void set_vertices(const DVector<Vector3>& p_vertices); - DVector<Vector3> get_vertices() const; + void set_vertices(const PoolVector<Vector3>& p_vertices); + PoolVector<Vector3> get_vertices() const; void add_polygon(const Vector<int>& p_polygon); int get_polygon_count() const; diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 09be49d7d6..9e37658cd9 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -88,9 +88,9 @@ AABB Particles::get_aabb() const { return AABB( Vector3(-1,-1,-1), Vector3(2, 2, 2 ) ); } -DVector<Face3> Particles::get_faces(uint32_t p_usage_flags) const { +PoolVector<Face3> Particles::get_faces(uint32_t p_usage_flags) const { - return DVector<Face3>(); + return PoolVector<Face3>(); } @@ -130,16 +130,16 @@ AABB Particles::get_visibility_aabb() const { } -void Particles::set_emission_points(const DVector<Vector3>& p_points) { +void Particles::set_emission_points(const PoolVector<Vector3>& p_points) { using_points = p_points.size(); VisualServer::get_singleton()->particles_set_emission_points(particles,p_points); } -DVector<Vector3> Particles::get_emission_points() const { +PoolVector<Vector3> Particles::get_emission_points() const { if (!using_points) - return DVector<Vector3>(); + return PoolVector<Vector3>(); return VisualServer::get_singleton()->particles_get_emission_points(particles); diff --git a/scene/3d/particles.h b/scene/3d/particles.h index 95cf44a033..b96bd4e69e 100644 --- a/scene/3d/particles.h +++ b/scene/3d/particles.h @@ -103,7 +103,7 @@ public: AABB get_aabb() const; - DVector<Face3> get_faces(uint32_t p_usage_flags) const; + PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; void set_amount(int p_amount); int get_amount() const; @@ -120,8 +120,8 @@ public: void set_emission_base_velocity(const Vector3& p_base_velocity); Vector3 get_emission_base_velocity() const; - void set_emission_points(const DVector<Vector3>& p_points); - DVector<Vector3> get_emission_points() const; + void set_emission_points(const PoolVector<Vector3>& p_points); + PoolVector<Vector3> get_emission_points() const; void set_gravity_normal(const Vector3& p_normal); Vector3 get_gravity_normal() const; diff --git a/scene/3d/portal.cpp b/scene/3d/portal.cpp index 1de9188e82..e4c03a78ee 100644 --- a/scene/3d/portal.cpp +++ b/scene/3d/portal.cpp @@ -34,7 +34,7 @@ bool Portal::_set(const StringName& p_name, const Variant& p_value) { if (p_name=="shape") { - DVector<float> src_coords=p_value; + PoolVector<float> src_coords=p_value; Vector<Point2> points; int src_coords_size = src_coords.size(); ERR_FAIL_COND_V(src_coords_size%2,false); @@ -63,7 +63,7 @@ bool Portal::_get(const StringName& p_name,Variant &r_ret) const { if (p_name=="shape") { Vector<Point2> points=get_shape(); - DVector<float> dst_coords; + PoolVector<float> dst_coords; dst_coords.resize(points.size()*2); for (int i=0;i<points.size();i++) { @@ -102,14 +102,14 @@ AABB Portal::get_aabb() const { return aabb; } -DVector<Face3> Portal::get_faces(uint32_t p_usage_flags) const { +PoolVector<Face3> Portal::get_faces(uint32_t p_usage_flags) const { if (!(p_usage_flags&FACES_ENCLOSING)) - return DVector<Face3>(); + return PoolVector<Face3>(); Vector<Point2> shape = get_shape(); if (shape.size()==0) - return DVector<Face3>(); + return PoolVector<Face3>(); Vector2 center; for (int i=0;i<shape.size();i++) { @@ -118,7 +118,7 @@ DVector<Face3> Portal::get_faces(uint32_t p_usage_flags) const { } - DVector<Face3> ret; + PoolVector<Face3> ret; center/=shape.size(); for (int i=0;i<shape.size();i++) { diff --git a/scene/3d/portal.h b/scene/3d/portal.h index d154c18b3d..8464a628f9 100644 --- a/scene/3d/portal.h +++ b/scene/3d/portal.h @@ -68,7 +68,7 @@ protected: public: virtual AABB get_aabb() const; - virtual DVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; void set_enabled(bool p_enabled); bool is_enabled() const; diff --git a/scene/3d/quad.cpp b/scene/3d/quad.cpp index 4ba828f927..f1c59860af 100644 --- a/scene/3d/quad.cpp +++ b/scene/3d/quad.cpp @@ -44,9 +44,9 @@ void Quad::_update() { - DVector<Vector3> points; + PoolVector<Vector3> points; points.resize(4); - DVector<Vector3>::Write pointsw = points.write(); + PoolVector<Vector3>::Write pointsw = points.write(); Vector2 s2 = size*0.5; Vector2 o = offset; @@ -70,34 +70,34 @@ void Quad::_update() { for(int i=1;i<4;i++) aabb.expand_to(pointsw[i]); - pointsw = DVector<Vector3>::Write(); + pointsw = PoolVector<Vector3>::Write(); - DVector<Vector3> normals; + PoolVector<Vector3> normals; normals.resize(4); - DVector<Vector3>::Write normalsw = normals.write(); + PoolVector<Vector3>::Write normalsw = normals.write(); for(int i=0;i<4;i++) normalsw[i]=normal; - normalsw=DVector<Vector3>::Write(); + normalsw=PoolVector<Vector3>::Write(); - DVector<Vector2> uvs; + PoolVector<Vector2> uvs; uvs.resize(4); - DVector<Vector2>::Write uvsw = uvs.write(); + PoolVector<Vector2>::Write uvsw = uvs.write(); uvsw[0]=Vector2(0,0); uvsw[1]=Vector2(1,0); uvsw[2]=Vector2(1,1); uvsw[3]=Vector2(0,1); - uvsw = DVector<Vector2>::Write(); + uvsw = PoolVector<Vector2>::Write(); - DVector<int> indices; + PoolVector<int> indices; indices.resize(6); - DVector<int>::Write indicesw = indices.write(); + PoolVector<int>::Write indicesw = indices.write(); indicesw[0]=0; indicesw[1]=1; indicesw[2]=2; @@ -105,7 +105,7 @@ void Quad::_update() { indicesw[4]=3; indicesw[5]=0; - indicesw=DVector<int>::Write(); + indicesw=PoolVector<int>::Write(); Array arr; arr.resize(VS::ARRAY_MAX); @@ -187,9 +187,9 @@ void Quad::_notification(int p_what) { } } -DVector<Face3> Quad::get_faces(uint32_t p_usage_flags) const { +PoolVector<Face3> Quad::get_faces(uint32_t p_usage_flags) const { - return DVector<Face3>(); + return PoolVector<Face3>(); } AABB Quad::get_aabb() const { diff --git a/scene/3d/quad.h b/scene/3d/quad.h index bdb2cb3088..94b438c548 100644 --- a/scene/3d/quad.h +++ b/scene/3d/quad.h @@ -67,7 +67,7 @@ public: void set_centered(bool p_enabled); bool is_centered() const; - virtual DVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; virtual AABB get_aabb() const; Quad(); diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp index 63855b7e98..0235a063ea 100644 --- a/scene/3d/reflection_probe.cpp +++ b/scene/3d/reflection_probe.cpp @@ -169,9 +169,9 @@ AABB ReflectionProbe::get_aabb() const { aabb.size=origin_offset+extents; return aabb; } -DVector<Face3> ReflectionProbe::get_faces(uint32_t p_usage_flags) const { +PoolVector<Face3> ReflectionProbe::get_faces(uint32_t p_usage_flags) const { - return DVector<Face3>(); + return PoolVector<Face3>(); } void ReflectionProbe::_validate_property(PropertyInfo& property) const { diff --git a/scene/3d/reflection_probe.h b/scene/3d/reflection_probe.h index 2de02ebbfa..789e5837b0 100644 --- a/scene/3d/reflection_probe.h +++ b/scene/3d/reflection_probe.h @@ -78,7 +78,7 @@ public: UpdateMode get_update_mode() const; virtual AABB get_aabb() const; - virtual DVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp index 1423f56786..137a16490d 100644 --- a/scene/3d/room_instance.cpp +++ b/scene/3d/room_instance.cpp @@ -86,9 +86,9 @@ AABB Room::get_aabb() const { return AABB(); } -DVector<Face3> Room::get_faces(uint32_t p_usage_flags) const { +PoolVector<Face3> Room::get_faces(uint32_t p_usage_flags) const { - return DVector<Face3>(); + return PoolVector<Face3>(); } @@ -119,21 +119,21 @@ Ref<RoomBounds> Room::get_room() const { return room; } -void Room::_parse_node_faces(DVector<Face3> &all_faces,const Node *p_node) const { +void Room::_parse_node_faces(PoolVector<Face3> &all_faces,const Node *p_node) const { const VisualInstance *vi=p_node->cast_to<VisualInstance>(); if (vi) { - DVector<Face3> faces=vi->get_faces(FACES_ENCLOSING); + PoolVector<Face3> faces=vi->get_faces(FACES_ENCLOSING); if (faces.size()) { int old_len=all_faces.size(); all_faces.resize( all_faces.size() + faces.size() ); int new_len=all_faces.size(); - DVector<Face3>::Write all_facesw=all_faces.write(); + PoolVector<Face3>::Write all_facesw=all_faces.write(); Face3 * all_facesptr=all_facesw.ptr(); - DVector<Face3>::Read facesr=faces.read(); + PoolVector<Face3>::Read facesr=faces.read(); const Face3 * facesptr=facesr.ptr(); Transform tr=vi->get_relative_transform(this); diff --git a/scene/3d/room_instance.h b/scene/3d/room_instance.h index 8c2bb76a38..8cdc908ceb 100644 --- a/scene/3d/room_instance.h +++ b/scene/3d/room_instance.h @@ -63,7 +63,7 @@ private: bool sound_enabled; int level; - void _parse_node_faces(DVector<Face3> &all_faces,const Node *p_node) const; + void _parse_node_faces(PoolVector<Face3> &all_faces,const Node *p_node) const; void _bounds_changed(); @@ -83,7 +83,7 @@ public: }; virtual AABB get_aabb() const; - virtual DVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; void set_room( const Ref<RoomBounds>& p_room ); Ref<RoomBounds> get_room() const; diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 576f085120..5d686e8715 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -211,9 +211,9 @@ AABB SpriteBase3D::get_aabb() const { return aabb; } -DVector<Face3> SpriteBase3D::get_faces(uint32_t p_usage_flags) const { +PoolVector<Face3> SpriteBase3D::get_faces(uint32_t p_usage_flags) const { - return DVector<Face3>(); + return PoolVector<Face3>(); } diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h index 58d70fa2f7..f82a391038 100644 --- a/scene/3d/sprite_3d.h +++ b/scene/3d/sprite_3d.h @@ -135,7 +135,7 @@ public: virtual Rect2 get_item_rect() const=0; virtual AABB get_aabb() const; - virtual DVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; SpriteBase3D(); ~SpriteBase3D(); diff --git a/scene/3d/test_cube.cpp b/scene/3d/test_cube.cpp index bd99de417e..c2ebe63e21 100644 --- a/scene/3d/test_cube.cpp +++ b/scene/3d/test_cube.cpp @@ -35,9 +35,9 @@ AABB TestCube::get_aabb() const { return AABB( Vector3(-1,-1,-1), Vector3(2, 2, 2 ) ); } -DVector<Face3> TestCube::get_faces(uint32_t p_usage_flags) const { +PoolVector<Face3> TestCube::get_faces(uint32_t p_usage_flags) const { - return DVector<Face3>(); + return PoolVector<Face3>(); } diff --git a/scene/3d/test_cube.h b/scene/3d/test_cube.h index cbd9918b13..c62999c34b 100644 --- a/scene/3d/test_cube.h +++ b/scene/3d/test_cube.h @@ -47,7 +47,7 @@ class TestCube : public GeometryInstance { public: virtual AABB get_aabb() const; - virtual DVector<Face3> get_faces(uint32_t p_usage_flags) const; + virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; TestCube(); ~TestCube(); diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h index 7b76cd299e..f59ec3a7e6 100644 --- a/scene/3d/visual_instance.h +++ b/scene/3d/visual_instance.h @@ -66,7 +66,7 @@ public: RID get_instance() const; virtual AABB get_aabb() const=0; - virtual DVector<Face3> get_faces(uint32_t p_usage_flags) const=0; + virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const=0; virtual AABB get_transformed_aabb() const; // helper diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index c03762549b..94955bec60 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -208,11 +208,11 @@ private: void _node_removed(Node *p_node); // bind helpers - DVector<String> _get_animation_list() const { + PoolVector<String> _get_animation_list() const { List<StringName> animations; get_animation_list(&animations); - DVector<String> ret; + PoolVector<String> ret; while(animations.size()) { ret.push_back( animations.front()->get()); diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index 2ed8e52615..4df37af7a1 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -1740,11 +1740,11 @@ NodePath AnimationTreePlayer::get_master_player() const{ return master; } -DVector<String> AnimationTreePlayer::_get_node_list() { +PoolVector<String> AnimationTreePlayer::_get_node_list() { List<StringName> nl; get_node_list(&nl); - DVector<String> ret; + PoolVector<String> ret; ret.resize(nl.size()); int idx=0; for(List<StringName>::Element *E=nl.front();E;E=E->next()) { diff --git a/scene/animation/animation_tree_player.h b/scene/animation/animation_tree_player.h index 6d9db5dc63..ae2fe8c2bb 100644 --- a/scene/animation/animation_tree_player.h +++ b/scene/animation/animation_tree_player.h @@ -282,7 +282,7 @@ private: Track* _find_track(const NodePath& p_path); void _recompute_caches(); void _recompute_caches(const StringName& p_node); - DVector<String> _get_node_list(); + PoolVector<String> _get_node_list(); void _compute_weights(float *p_fallback_weight, HashMap<NodePath,float> *p_weights, float p_coeff, const HashMap<NodePath,bool> *p_filter = NULL, float p_filtered_coeff = 0); diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index ceb3b69f2f..10f4ae9fec 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -170,11 +170,11 @@ void ColorPicker::_update_presets() Size2 size=bt_add_preset->get_size(); preset->set_custom_minimum_size(Size2(size.width*presets.size(),size.height)); - DVector<uint8_t> img; + PoolVector<uint8_t> img; img.resize(size.x*presets.size()*size.y*3); { - DVector<uint8_t>::Write w=img.write(); + PoolVector<uint8_t>::Write w=img.write(); for (int y=0;y<size.y;y++) { for (int x=0;x<size.x*presets.size();x++) { int ofs = (y*(size.x*presets.size())+x)*3; @@ -421,7 +421,7 @@ void ColorPicker::_screen_input(const InputEvent &ev) int pw = last_capture.get_format()==Image::FORMAT_RGBA8?4:3; int ofs = (mev.global_y*last_capture.get_width()+mev.global_x)*pw; - DVector<uint8_t>::Read r = last_capture.get_data().read(); + PoolVector<uint8_t>::Read r = last_capture.get_data().read(); Color c( r[ofs+0]/255.0, r[ofs+1]/255.0, r[ofs+2]/255.0 ); diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 4fe65fad75..6828ae3980 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -164,7 +164,7 @@ void FileDialog::_action_pressed() { TreeItem *ti=tree->get_next_selected(NULL); String fbase=dir_access->get_current_dir(); - DVector<String> files; + PoolVector<String> files; while(ti) { files.push_back( fbase.plus_file(ti->get_text(0)) ); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 397edbf3b6..4ea44a6ead 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3794,11 +3794,11 @@ int TextEdit::_get_column_pos_of_word(const String &p_key, const String &p_searc return col; } -DVector<int> TextEdit::_search_bind(const String &p_key,uint32_t p_search_flags, int p_from_line,int p_from_column) const { +PoolVector<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,col,line)) { - DVector<int> result; + PoolVector<int> result; result.resize(2); result.set(0,line); result.set(1,col); @@ -3806,7 +3806,7 @@ DVector<int> TextEdit::_search_bind(const String &p_key,uint32_t p_search_flags, } else { - return DVector<int>(); + return PoolVector<int>(); } } diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index c674c859e6..2cb3d71386 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -316,7 +316,7 @@ class TextEdit : public Control { int _get_column_pos_of_word(const String &p_key, const String &p_search, uint32_t p_search_flags, int p_from_column); - DVector<int> _search_bind(const String &p_key,uint32_t p_search_flags, int p_from_line,int p_from_column) const; + PoolVector<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/io/resource_format_wav.cpp b/scene/io/resource_format_wav.cpp index 3720aa13fd..f75836d2df 100644 --- a/scene/io/resource_format_wav.cpp +++ b/scene/io/resource_format_wav.cpp @@ -171,9 +171,9 @@ RES ResourceFormatLoaderWAV::load(const String &p_path, const String& p_original if (format_bits>8) len*=2; - DVector<uint8_t> data; + PoolVector<uint8_t> data; data.resize(len); - DVector<uint8_t>::Write dataw = data.write(); + PoolVector<uint8_t>::Write dataw = data.write(); void * data_ptr = dataw.ptr(); for (int i=0;i<frames;i++) { @@ -215,7 +215,7 @@ RES ResourceFormatLoaderWAV::load(const String &p_path, const String& p_original } - dataw=DVector<uint8_t>::Write(); + dataw=PoolVector<uint8_t>::Write(); sample->set_data(data); diff --git a/scene/main/http_request.h b/scene/main/http_request.h index d4adaa16d4..59be980077 100644 --- a/scene/main/http_request.h +++ b/scene/main/http_request.h @@ -76,7 +76,7 @@ private: bool got_response; int response_code; - DVector<String> response_headers; + PoolVector<String> response_headers; String download_to_file; diff --git a/scene/main/resource_preloader.cpp b/scene/main/resource_preloader.cpp index 57bda91494..93a836a2eb 100644 --- a/scene/main/resource_preloader.cpp +++ b/scene/main/resource_preloader.cpp @@ -33,7 +33,7 @@ void ResourcePreloader::_set_resources(const Array& p_data) { resources.clear(); ERR_FAIL_COND(p_data.size()!=2); - DVector<String> names=p_data[0]; + PoolVector<String> names=p_data[0]; Array resdata=p_data[1]; ERR_FAIL_COND(names.size()!=resdata.size()); @@ -52,7 +52,7 @@ void ResourcePreloader::_set_resources(const Array& p_data) { Array ResourcePreloader::_get_resources() const { - DVector<String> names; + PoolVector<String> names; Array arr; arr.resize(resources.size()); names.resize(resources.size()); @@ -139,9 +139,9 @@ RES ResourcePreloader::get_resource(const StringName& p_name) const { return resources[p_name]; } -DVector<String> ResourcePreloader::_get_resource_list() const { +PoolVector<String> ResourcePreloader::_get_resource_list() const { - DVector<String> res; + PoolVector<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 8f4f997cee..4e585d1751 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; - DVector<String> _get_resource_list() const; + PoolVector<String> _get_resource_list() const; protected: diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index af6d6b18db..a6ef136b84 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -831,11 +831,11 @@ Ref<Mesh> SceneTree::get_debug_contact_mesh() { 1,3,5, }; - DVector<int> indices; + PoolVector<int> indices; for(int i=0;i<8*3;i++) indices.push_back(diamond_faces[i]); - DVector<Vector3> vertices; + PoolVector<Vector3> vertices; for(int i=0;i<6;i++) vertices.push_back(diamond[i]*0.1); diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index b5c438d953..76c6f29bcb 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -79,14 +79,14 @@ 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]); - DVector<float> values=p_value; + PoolVector<float> values=p_value; int vcount=values.size(); #if 0 // old compatibility hack if ((vcount%11) == 0) { - DVector<float>::Read r = values.read(); + PoolVector<float>::Read r = values.read(); tt->transforms.resize(vcount/11); @@ -121,7 +121,7 @@ bool Animation::_set(const StringName& p_name, const Variant& p_value) { #endif ERR_FAIL_COND_V(vcount%12,false); // shuld be multiple of 11 - DVector<float>::Read r = values.read(); + PoolVector<float>::Read r = values.read(); tt->transforms.resize(vcount/12); @@ -172,7 +172,7 @@ bool Animation::_set(const StringName& p_name, const Variant& p_value) { - DVector<float> times=d["times"]; + PoolVector<float> times=d["times"]; Array values=d["values"]; ERR_FAIL_COND_V(times.size()!=values.size(),false); @@ -181,7 +181,7 @@ bool Animation::_set(const StringName& p_name, const Variant& p_value) { int valcount=times.size(); - DVector<float>::Read rt = times.read(); + PoolVector<float>::Read rt = times.read(); vt->values.resize(valcount); @@ -193,10 +193,10 @@ bool Animation::_set(const StringName& p_name, const Variant& p_value) { if (d.has("transitions")) { - DVector<float> transitions = d["transitions"]; + PoolVector<float> transitions = d["transitions"]; ERR_FAIL_COND_V(transitions.size()!=valcount,false); - DVector<float>::Read rtr = transitions.read(); + PoolVector<float>::Read rtr = transitions.read(); for(int i=0;i<valcount;i++) { @@ -218,7 +218,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); - DVector<float> times=d["times"]; + PoolVector<float> times=d["times"]; Array values=d["values"]; ERR_FAIL_COND_V(times.size()!=values.size(),false); @@ -227,7 +227,7 @@ bool Animation::_set(const StringName& p_name, const Variant& p_value) { int valcount=times.size(); - DVector<float>::Read rt = times.read(); + PoolVector<float>::Read rt = times.read(); for(int i=0;i<valcount;i++) { @@ -236,10 +236,10 @@ bool Animation::_set(const StringName& p_name, const Variant& p_value) { if (d.has("transitions")) { - DVector<float> transitions = d["transitions"]; + PoolVector<float> transitions = d["transitions"]; ERR_FAIL_COND_V(transitions.size()!=valcount,false); - DVector<float>::Read rtr = transitions.read(); + PoolVector<float>::Read rtr = transitions.read(); for(int i=0;i<valcount;i++) { @@ -297,11 +297,11 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const { if (track_get_type(track)==TYPE_TRANSFORM) { - DVector<real_t> keys; + PoolVector<real_t> keys; int kk=track_get_key_count(track); keys.resize(kk*12); - DVector<real_t>::Write w = keys.write(); + PoolVector<real_t>::Write w = keys.write(); int idx=0; for(int i=0;i<track_get_key_count(track);i++) { @@ -327,7 +327,7 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const { w[idx++]=scale.z; } - w = DVector<real_t>::Write(); + w = PoolVector<real_t>::Write(); r_ret=keys; return true; @@ -338,8 +338,8 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const { Dictionary d; - DVector<float> key_times; - DVector<float> key_transitions; + PoolVector<float> key_times; + PoolVector<float> key_transitions; Array key_values; int kk=vt->values.size(); @@ -348,8 +348,8 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const { key_transitions.resize(kk); key_values.resize(kk); - DVector<float>::Write wti=key_times.write(); - DVector<float>::Write wtr=key_transitions.write(); + PoolVector<float>::Write wti=key_times.write(); + PoolVector<float>::Write wtr=key_transitions.write(); int idx=0; @@ -363,8 +363,8 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const { idx++; } - wti=DVector<float>::Write(); - wtr=DVector<float>::Write(); + wti=PoolVector<float>::Write(); + wtr=PoolVector<float>::Write(); d["times"]=key_times; d["transitions"]=key_transitions; @@ -382,8 +382,8 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const { Dictionary d; - DVector<float> key_times; - DVector<float> key_transitions; + PoolVector<float> key_times; + PoolVector<float> key_transitions; Array key_values; int kk=track_get_key_count(track); @@ -392,8 +392,8 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const { key_transitions.resize(kk); key_values.resize(kk); - DVector<float>::Write wti=key_times.write(); - DVector<float>::Write wtr=key_transitions.write(); + PoolVector<float>::Write wti=key_times.write(); + PoolVector<float>::Write wtr=key_transitions.write(); int idx=0; for(int i=0;i<track_get_key_count(track);i++) { @@ -404,8 +404,8 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const { idx++; } - wti=DVector<float>::Write(); - wtr=DVector<float>::Write(); + wti=PoolVector<float>::Write(); + wtr=PoolVector<float>::Write(); d["times"]=key_times; d["transitions"]=key_transitions; diff --git a/scene/resources/animation.h b/scene/resources/animation.h index 90824d8c7b..c236b3ef37 100644 --- a/scene/resources/animation.h +++ b/scene/resources/animation.h @@ -188,11 +188,11 @@ private: return ret; } - DVector<int> _value_track_get_key_indices(int p_track, float p_time, float p_delta) const { + PoolVector<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); - DVector<int> idxr; + PoolVector<int> idxr; for (List<int>::Element *E=idxs.front();E;E=E->next()) { @@ -200,11 +200,11 @@ private: } return idxr; } - DVector<int> _method_track_get_key_indices(int p_track, float p_time, float p_delta) const { + PoolVector<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); - DVector<int> idxr; + PoolVector<int> idxr; for (List<int>::Element *E=idxs.front();E;E=E->next()) { diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp index 81ba28fd26..d669ab771c 100644 --- a/scene/resources/bit_mask.cpp +++ b/scene/resources/bit_mask.cpp @@ -51,7 +51,7 @@ void BitMap::create_from_image_alpha(const Image& p_image){ create(Size2(img.get_width(),img.get_height())); - DVector<uint8_t>::Read r = img.get_data().read(); + PoolVector<uint8_t>::Read r = img.get_data().read(); uint8_t *w = bitmask.ptr(); for(int i=0;i<width*height;i++) { diff --git a/scene/resources/concave_polygon_shape.cpp b/scene/resources/concave_polygon_shape.cpp index fc1a3a9961..5190bba6a5 100644 --- a/scene/resources/concave_polygon_shape.cpp +++ b/scene/resources/concave_polygon_shape.cpp @@ -34,11 +34,11 @@ Vector<Vector3> ConcavePolygonShape::_gen_debug_mesh_lines() { Set<DrawEdge> edges; - DVector<Vector3> data=get_faces(); + PoolVector<Vector3> data=get_faces(); int datalen=data.size(); ERR_FAIL_COND_V( (datalen%3)!=0,Vector<Vector3>() ); - DVector<Vector3>::Read r=data.read(); + PoolVector<Vector3>::Read r=data.read(); for(int i=0;i<datalen;i+=3) { @@ -94,13 +94,13 @@ void ConcavePolygonShape::_update_shape() { } -void ConcavePolygonShape::set_faces(const DVector<Vector3>& p_faces) { +void ConcavePolygonShape::set_faces(const PoolVector<Vector3>& p_faces) { PhysicsServer::get_singleton()->shape_set_data(get_shape(),p_faces); notify_change_to_owners(); } -DVector<Vector3> ConcavePolygonShape::get_faces() const { +PoolVector<Vector3> ConcavePolygonShape::get_faces() const { return PhysicsServer::get_singleton()->shape_get_data(get_shape()); diff --git a/scene/resources/concave_polygon_shape.h b/scene/resources/concave_polygon_shape.h index 08d95da0ac..36e806d37a 100644 --- a/scene/resources/concave_polygon_shape.h +++ b/scene/resources/concave_polygon_shape.h @@ -67,8 +67,8 @@ protected: virtual Vector<Vector3> _gen_debug_mesh_lines(); public: - void set_faces(const DVector<Vector3>& p_faces); - DVector<Vector3> get_faces() const; + void set_faces(const PoolVector<Vector3>& p_faces); + PoolVector<Vector3> get_faces() const; ConcavePolygonShape(); diff --git a/scene/resources/concave_polygon_shape_2d.cpp b/scene/resources/concave_polygon_shape_2d.cpp index 4be95cb26d..e794643132 100644 --- a/scene/resources/concave_polygon_shape_2d.cpp +++ b/scene/resources/concave_polygon_shape_2d.cpp @@ -31,13 +31,13 @@ #include "servers/physics_2d_server.h" #include "servers/visual_server.h" -void ConcavePolygonShape2D::set_segments(const DVector<Vector2>& p_segments) { +void ConcavePolygonShape2D::set_segments(const PoolVector<Vector2>& p_segments) { Physics2DServer::get_singleton()->shape_set_data(get_rid(),p_segments); emit_changed(); } -DVector<Vector2> ConcavePolygonShape2D::get_segments() const { +PoolVector<Vector2> ConcavePolygonShape2D::get_segments() const { return Physics2DServer::get_singleton()->shape_get_data(get_rid()); } @@ -45,12 +45,12 @@ DVector<Vector2> ConcavePolygonShape2D::get_segments() const { void ConcavePolygonShape2D::draw(const RID& p_to_rid,const Color& p_color) { - DVector<Vector2> s = get_segments(); + PoolVector<Vector2> s = get_segments(); int len=s.size(); if (len==0 || (len%2)==1) return; - DVector<Vector2>::Read r = s.read(); + PoolVector<Vector2>::Read r = s.read(); 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); } @@ -60,14 +60,14 @@ void ConcavePolygonShape2D::draw(const RID& p_to_rid,const Color& p_color) { Rect2 ConcavePolygonShape2D::get_rect() const { - DVector<Vector2> s = get_segments(); + PoolVector<Vector2> s = get_segments(); int len=s.size(); if (len==0) return Rect2(); Rect2 rect; - DVector<Vector2>::Read r = s.read(); + PoolVector<Vector2>::Read r = s.read(); for(int i=0;i<len;i++) { if (i==0) rect.pos=r[i]; diff --git a/scene/resources/concave_polygon_shape_2d.h b/scene/resources/concave_polygon_shape_2d.h index 36c67254f3..309fb4a7b3 100644 --- a/scene/resources/concave_polygon_shape_2d.h +++ b/scene/resources/concave_polygon_shape_2d.h @@ -38,8 +38,8 @@ protected: static void _bind_methods(); public: - void set_segments(const DVector<Vector2>& p_segments); - DVector<Vector2> get_segments() const; + void set_segments(const PoolVector<Vector2>& p_segments); + PoolVector<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 21e93e4b5c..ca9897bf97 100644 --- a/scene/resources/convex_polygon_shape.cpp +++ b/scene/resources/convex_polygon_shape.cpp @@ -32,7 +32,7 @@ Vector<Vector3> ConvexPolygonShape::_gen_debug_mesh_lines() { - DVector<Vector3> points = get_points(); + PoolVector<Vector3> points = get_points(); if (points.size()>3) { @@ -64,14 +64,14 @@ void ConvexPolygonShape::_update_shape() { emit_changed(); } -void ConvexPolygonShape::set_points(const DVector<Vector3>& p_points) { +void ConvexPolygonShape::set_points(const PoolVector<Vector3>& p_points) { points=p_points; _update_shape(); notify_change_to_owners(); } -DVector<Vector3> ConvexPolygonShape::get_points() const { +PoolVector<Vector3> ConvexPolygonShape::get_points() const { return points; } diff --git a/scene/resources/convex_polygon_shape.h b/scene/resources/convex_polygon_shape.h index 296a0ce4ca..215de941c6 100644 --- a/scene/resources/convex_polygon_shape.h +++ b/scene/resources/convex_polygon_shape.h @@ -34,7 +34,7 @@ class ConvexPolygonShape : public Shape { GDCLASS(ConvexPolygonShape,Shape); - DVector<Vector3> points; + PoolVector<Vector3> points; protected: @@ -45,8 +45,8 @@ protected: virtual Vector<Vector3> _gen_debug_mesh_lines(); public: - void set_points(const DVector<Vector3>& p_points); - DVector<Vector3> get_points() const; + void set_points(const PoolVector<Vector3>& p_points); + PoolVector<Vector3> get_points() const; ConvexPolygonShape(); }; diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp index fd0e9be304..50c546b855 100644 --- a/scene/resources/curve.cpp +++ b/scene/resources/curve.cpp @@ -143,17 +143,17 @@ Vector2 Curve2D::interpolatef(real_t p_findex) const { } -DVector<Point2> Curve2D::bake(int p_subdivs) const { +PoolVector<Point2> Curve2D::bake(int p_subdivs) const { int pc = points.size(); - DVector<Point2> ret; + PoolVector<Point2> ret; if (pc<2) return ret; ret.resize((pc-1)*p_subdivs+1); - DVector<Point2>::Write w = ret.write(); + PoolVector<Point2>::Write w = ret.write(); const Point *r = points.ptr(); for(int i=0;i<pc;i++) { @@ -175,7 +175,7 @@ DVector<Point2> Curve2D::bake(int p_subdivs) const { } } - w = DVector<Point2>::Write(); + w = PoolVector<Point2>::Write(); return ret; } diff --git a/scene/resources/curve.h b/scene/resources/curve.h index 289de50444..670232c9b2 100644 --- a/scene/resources/curve.h +++ b/scene/resources/curve.h @@ -72,7 +72,7 @@ public: Vector2 interpolate(int p_index, float p_offset) const; Vector2 interpolatef(real_t p_findex) const; - DVector<Point2> bake(int p_subdivs=10) const; + PoolVector<Point2> bake(int p_subdivs=10) const; void advance(real_t p_distance,int &r_index, real_t &r_pos) const; void get_approx_position_from_offset(real_t p_offset,int &r_index, real_t &r_pos,int p_subdivs=16) const; diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 7ab7cc74e5..3aadbdbe19 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -535,7 +535,7 @@ void DynamicFontAtSize::_update_char(CharType p_char) { { //zero texture - DVector<uint8_t>::Write w = tex.imgdata.write(); + PoolVector<uint8_t>::Write w = tex.imgdata.write(); ERR_FAIL_COND(texsize*texsize*2 > tex.imgdata.size()); for(int i=0;i<texsize*texsize*2;i++) { w[i]=0; @@ -556,7 +556,7 @@ void DynamicFontAtSize::_update_char(CharType p_char) { CharTexture &tex=textures[tex_index]; { - DVector<uint8_t>::Write wr = tex.imgdata.write(); + PoolVector<uint8_t>::Write wr = tex.imgdata.write(); for(int i=0;i<h;i++) { diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h index 133d48bdea..321ec7e332 100644 --- a/scene/resources/dynamic_font.h +++ b/scene/resources/dynamic_font.h @@ -107,7 +107,7 @@ class DynamicFontAtSize : public Reference { struct CharTexture { - DVector<uint8_t> imgdata; + PoolVector<uint8_t> imgdata; int texture_size; Vector<int> offsets; Ref<ImageTexture> texture; diff --git a/scene/resources/dynamic_font_stb.cpp b/scene/resources/dynamic_font_stb.cpp index c931b4d6c8..a25667d85a 100644 --- a/scene/resources/dynamic_font_stb.cpp +++ b/scene/resources/dynamic_font_stb.cpp @@ -26,10 +26,10 @@ void DynamicFontData::lock() { void DynamicFontData::unlock() { - fr = DVector<uint8_t>::Read(); + fr = PoolVector<uint8_t>::Read(); } -void DynamicFontData::set_font_data(const DVector<uint8_t>& p_font) { +void DynamicFontData::set_font_data(const PoolVector<uint8_t>& p_font) { //clear caches and stuff ERR_FAIL_COND(font_data.size()) ; font_data=p_font; @@ -284,7 +284,7 @@ void DynamicFontAtSize::_update_char(CharType p_char) { { //zero texture - DVector<uint8_t>::Write w = tex.imgdata.write(); + PoolVector<uint8_t>::Write w = tex.imgdata.write(); ERR_FAIL_COND(texsize*texsize*2 > tex.imgdata.size()); for(int i=0;i<texsize*texsize*2;i++) { w[i]=0; @@ -305,7 +305,7 @@ void DynamicFontAtSize::_update_char(CharType p_char) { CharTexture &tex=textures[tex_index]; { - DVector<uint8_t>::Write wr = tex.imgdata.write(); + PoolVector<uint8_t>::Write wr = tex.imgdata.write(); for(int i=0;i<h;i++) { for(int j=0;j<w;j++) { @@ -485,14 +485,14 @@ RES ResourceFormatLoaderDynamicFont::load(const String &p_path, const String& p_ FileAccess *f = FileAccess::open(p_path,FileAccess::READ); ERR_FAIL_COND_V(!f,RES()); - DVector<uint8_t> data; + PoolVector<uint8_t> data; data.resize(f->get_len()); ERR_FAIL_COND_V(data.size()==0,RES()); { - DVector<uint8_t>::Write w = data.write(); + PoolVector<uint8_t>::Write w = data.write(); f->get_buffer(w.ptr(),data.size()); } diff --git a/scene/resources/dynamic_font_stb.h b/scene/resources/dynamic_font_stb.h index ad7ca0009d..07a3e5ee6c 100644 --- a/scene/resources/dynamic_font_stb.h +++ b/scene/resources/dynamic_font_stb.h @@ -18,8 +18,8 @@ class DynamicFontData : public Resource { bool valid; - DVector<uint8_t> font_data; - DVector<uint8_t>::Read fr; + PoolVector<uint8_t> font_data; + PoolVector<uint8_t>::Read fr; const uint8_t* last_data_ptr; struct KerningPairKey { @@ -56,7 +56,7 @@ friend class DynamicFont; Ref<DynamicFontAtSize> _get_dynamic_font_at_size(int p_size); public: - void set_font_data(const DVector<uint8_t>& p_font); + void set_font_data(const PoolVector<uint8_t>& p_font); DynamicFontData(); ~DynamicFontData(); }; @@ -71,7 +71,7 @@ class DynamicFontAtSize : public Reference { struct CharTexture { - DVector<uint8_t> imgdata; + PoolVector<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 d4e18c58b8..0464a64031 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -97,7 +97,7 @@ Font::Font() { ///////////////////////////////////////////////////////////////// -void BitmapFont::_set_chars(const DVector<int>& p_chars) { +void BitmapFont::_set_chars(const PoolVector<int>& p_chars) { int len = p_chars.size(); //char 1 charsize 1 texture, 4 rect, 2 align, advance 1 @@ -107,7 +107,7 @@ void BitmapFont::_set_chars(const DVector<int>& p_chars) { int chars = len/9; - DVector<int>::Read r=p_chars.read(); + PoolVector<int>::Read r=p_chars.read(); for(int i=0;i<chars;i++) { const int* data = &r[i*9]; @@ -116,9 +116,9 @@ void BitmapFont::_set_chars(const DVector<int>& p_chars) { } -DVector<int> BitmapFont::_get_chars() const { +PoolVector<int> BitmapFont::_get_chars() const { - DVector<int> chars; + PoolVector<int> chars; const CharType* key=NULL; @@ -140,13 +140,13 @@ DVector<int> BitmapFont::_get_chars() const { return chars; } -void BitmapFont::_set_kernings(const DVector<int>& p_kernings) { +void BitmapFont::_set_kernings(const PoolVector<int>& p_kernings) { int len=p_kernings.size(); ERR_FAIL_COND(len%3); if (!len) return; - DVector<int>::Read r=p_kernings.read(); + PoolVector<int>::Read r=p_kernings.read(); for(int i=0;i<len/3;i++) { @@ -155,9 +155,9 @@ void BitmapFont::_set_kernings(const DVector<int>& p_kernings) { } } -DVector<int> BitmapFont::_get_kernings() const { +PoolVector<int> BitmapFont::_get_kernings() const { - DVector<int> kernings; + PoolVector<int> kernings; for(Map<KerningPairKey,int>::Element *E=kerning_map.front();E;E=E->next()) { diff --git a/scene/resources/font.h b/scene/resources/font.h index 397d48cbb0..ad0f0176db 100644 --- a/scene/resources/font.h +++ b/scene/resources/font.h @@ -109,10 +109,10 @@ private: float ascent; bool distance_field_hint; - void _set_chars(const DVector<int>& p_chars); - DVector<int> _get_chars() const; - void _set_kernings(const DVector<int>& p_kernings); - DVector<int> _get_kernings() const; + 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_textures(const Vector<Variant> & p_textures); Vector<Variant> _get_textures() const; diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index ed35eb0216..bad87910ff 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -79,9 +79,9 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) { if (p_name=="morph_target/names") { - DVector<String> sk=p_value; + PoolVector<String> sk=p_value; int sz = sk.size(); - DVector<String>::Read r = sk.read(); + PoolVector<String>::Read r = sk.read(); for(int i=0;i<sz;i++) add_morph_target(r[i]); return true; @@ -133,8 +133,8 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) { } else if (d.has("array_data")) { - DVector<uint8_t> array_data = d["array_data"]; - DVector<uint8_t> array_index_data; + PoolVector<uint8_t> array_data = d["array_data"]; + PoolVector<uint8_t> array_index_data; if (d.has("array_index_data")) array_index_data=d["array_index_data"]; @@ -151,12 +151,12 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) { if (d.has("index_count")) index_count=d["index_count"]; - Vector< DVector<uint8_t> > morphs; + Vector< PoolVector<uint8_t> > morphs; if (d.has("morph_data")) { Array morph_data=d["morph_data"]; for(int i=0;i<morph_data.size();i++) { - DVector<uint8_t> morph = morph_data[i]; + PoolVector<uint8_t> morph = morph_data[i]; morphs.push_back(morph_data[i]); } } @@ -201,7 +201,7 @@ bool Mesh::_get(const StringName& p_name,Variant &r_ret) const { if (p_name=="morph_target/names") { - DVector<String> sk; + PoolVector<String> sk; for(int i=0;i<morph_targets.size();i++) sk.push_back(morph_targets[i]); r_ret=sk; @@ -251,7 +251,7 @@ bool Mesh::_get(const StringName& p_name,Variant &r_ret) const { } d["skeleton_aabb"]=arr; - Vector< DVector<uint8_t> > morph_data = VS::get_singleton()->mesh_surface_get_blend_shapes(mesh,idx); + Vector< PoolVector<uint8_t> > morph_data = VS::get_singleton()->mesh_surface_get_blend_shapes(mesh,idx); Array md; for(int i=0;i<morph_data.size();i++) { @@ -306,7 +306,7 @@ void Mesh::_recompute_aabb() { } -void Mesh::add_surface(uint32_t p_format,PrimitiveType p_primitive,const DVector<uint8_t>& p_array,int p_vertex_count,const DVector<uint8_t>& p_index_array,int p_index_count,const AABB& p_aabb,const Vector<DVector<uint8_t> >& p_blend_shapes,const Vector<AABB>& p_bone_aabbs) { +void Mesh::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_aabbs) { Surface s; s.aabb=p_aabb; @@ -330,10 +330,10 @@ void Mesh::add_surface_from_arrays(PrimitiveType p_primitive,const Array& p_arra /* make aABB? */ { - DVector<Vector3> vertices=p_arrays[ARRAY_VERTEX]; + PoolVector<Vector3> vertices=p_arrays[ARRAY_VERTEX]; int len=vertices.size(); ERR_FAIL_COND(len==0); - DVector<Vector3>::Read r=vertices.read(); + PoolVector<Vector3>::Read r=vertices.read(); const Vector3 *vtx=r.ptr(); // check AABB @@ -569,21 +569,21 @@ AABB Mesh::get_custom_aabb() const { } -DVector<Face3> Mesh::get_faces() const { +PoolVector<Face3> Mesh::get_faces() const { Ref<TriangleMesh> tm = generate_triangle_mesh(); if (tm.is_valid()) return tm->get_faces(); - return DVector<Face3>(); + return PoolVector<Face3>(); /* for (int i=0;i<surfaces.size();i++) { if (VisualServer::get_singleton()->mesh_surface_get_primitive_type( mesh, i ) != VisualServer::PRIMITIVE_TRIANGLES ) continue; - DVector<int> indices; - DVector<Vector3> vertices; + PoolVector<int> indices; + PoolVector<Vector3> vertices; vertices=VisualServer::get_singleton()->mesh_surface_get_array(mesh, i,VisualServer::ARRAY_VERTEX); @@ -604,10 +604,10 @@ DVector<Face3> Mesh::get_faces() const { if (len<=0) continue; - DVector<int>::Read indicesr = indices.read(); + PoolVector<int>::Read indicesr = indices.read(); const int *indicesptr = indicesr.ptr(); - DVector<Vector3>::Read verticesr = vertices.read(); + PoolVector<Vector3>::Read verticesr = vertices.read(); const Vector3 *verticesptr = verticesr.ptr(); int old_faces=faces.size(); @@ -615,7 +615,7 @@ DVector<Face3> Mesh::get_faces() const { faces.resize(new_faces); - DVector<Face3>::Write facesw = faces.write(); + PoolVector<Face3>::Write facesw = faces.write(); Face3 *facesptr=facesw.ptr(); @@ -639,12 +639,12 @@ DVector<Face3> Mesh::get_faces() const { Ref<Shape> Mesh::create_convex_shape() const { - DVector<Vector3> vertices; + PoolVector<Vector3> vertices; for(int i=0;i<get_surface_count();i++) { Array a = surface_get_arrays(i); - DVector<Vector3> v=a[ARRAY_VERTEX]; + PoolVector<Vector3> v=a[ARRAY_VERTEX]; vertices.append_array(v); } @@ -656,11 +656,11 @@ Ref<Shape> Mesh::create_convex_shape() const { Ref<Shape> Mesh::create_trimesh_shape() const { - DVector<Face3> faces = get_faces(); + PoolVector<Face3> faces = get_faces(); if (faces.size()==0) return Ref<Shape>(); - DVector<Vector3> face_points; + PoolVector<Vector3> face_points; face_points.resize( faces.size()*3 ); for (int i=0;i<face_points.size();i++) { @@ -681,9 +681,9 @@ void Mesh::center_geometry() { for(int i=0;i<get_surface_count();i++) { - DVector<Vector3> geom = surface_get_array(i,ARRAY_VERTEX); + PoolVector<Vector3> geom = surface_get_array(i,ARRAY_VERTEX); int gc =geom.size(); - DVector<Vector3>::Write w = geom.write(); + PoolVector<Vector3>::Write w = geom.write(); surfaces[i].aabb.pos-=ofs; for(int i=0;i<gc;i++) { @@ -691,7 +691,7 @@ void Mesh::center_geometry() { w[i]-=ofs; } - w = DVector<Vector3>::Write(); + w = PoolVector<Vector3>::Write(); surface_set_array(i,ARRAY_VERTEX,geom); @@ -752,9 +752,9 @@ Ref<TriangleMesh> Mesh::generate_triangle_mesh() const { if (facecount==0 || (facecount%3)!=0) return triangle_mesh; - DVector<Vector3> faces; + PoolVector<Vector3> faces; faces.resize(facecount); - DVector<Vector3>::Write facesw=faces.write(); + PoolVector<Vector3>::Write facesw=faces.write(); int widx=0; @@ -766,14 +766,14 @@ Ref<TriangleMesh> Mesh::generate_triangle_mesh() const { Array a = surface_get_arrays(i); int vc = surface_get_array_len(i); - DVector<Vector3> vertices = a[ARRAY_VERTEX]; - DVector<Vector3>::Read vr=vertices.read(); + PoolVector<Vector3> vertices = a[ARRAY_VERTEX]; + PoolVector<Vector3>::Read vr=vertices.read(); if (surface_get_format(i)&ARRAY_FORMAT_INDEX) { int ic=surface_get_array_index_len(i); - DVector<int> indices = a[ARRAY_INDEX]; - DVector<int>::Read ir = indices.read(); + PoolVector<int> indices = a[ARRAY_INDEX]; + PoolVector<int>::Read ir = indices.read(); for(int i=0;i<ic;i++) { int index = ir[i]; @@ -788,7 +788,7 @@ Ref<TriangleMesh> Mesh::generate_triangle_mesh() const { } - facesw=DVector<Vector3>::Write(); + facesw=PoolVector<Vector3>::Write(); triangle_mesh = Ref<TriangleMesh>( memnew( TriangleMesh )); @@ -814,7 +814,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { if (i==0) { arrays=a; - DVector<Vector3> v=a[ARRAY_VERTEX]; + PoolVector<Vector3> v=a[ARRAY_VERTEX]; index_accum+=v.size(); } else { @@ -831,8 +831,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { case ARRAY_VERTEX: case ARRAY_NORMAL: { - DVector<Vector3> dst = arrays[j]; - DVector<Vector3> src = a[j]; + PoolVector<Vector3> dst = arrays[j]; + PoolVector<Vector3> src = a[j]; if (j==ARRAY_VERTEX) vcount=src.size(); if (dst.size()==0 || src.size()==0) { @@ -846,8 +846,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { case ARRAY_BONES: case ARRAY_WEIGHTS: { - DVector<real_t> dst = arrays[j]; - DVector<real_t> src = a[j]; + PoolVector<real_t> dst = arrays[j]; + PoolVector<real_t> src = a[j]; if (dst.size()==0 || src.size()==0) { arrays[j]=Variant(); continue; @@ -857,8 +857,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { } break; case ARRAY_COLOR: { - DVector<Color> dst = arrays[j]; - DVector<Color> src = a[j]; + PoolVector<Color> dst = arrays[j]; + PoolVector<Color> src = a[j]; if (dst.size()==0 || src.size()==0) { arrays[j]=Variant(); continue; @@ -869,8 +869,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { } break; case ARRAY_TEX_UV: case ARRAY_TEX_UV2: { - DVector<Vector2> dst = arrays[j]; - DVector<Vector2> src = a[j]; + PoolVector<Vector2> dst = arrays[j]; + PoolVector<Vector2> src = a[j]; if (dst.size()==0 || src.size()==0) { arrays[j]=Variant(); continue; @@ -880,15 +880,15 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { } break; case ARRAY_INDEX: { - DVector<int> dst = arrays[j]; - DVector<int> src = a[j]; + PoolVector<int> dst = arrays[j]; + PoolVector<int> src = a[j]; if (dst.size()==0 || src.size()==0) { arrays[j]=Variant(); continue; } { int ss = src.size(); - DVector<int>::Write w = src.write(); + PoolVector<int>::Write w = src.write(); for(int k=0;k<ss;k++) { w[k]+=index_accum; } @@ -906,13 +906,13 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { } { - DVector<int>::Write ir; - DVector<int> indices =arrays[ARRAY_INDEX]; + PoolVector<int>::Write ir; + PoolVector<int> indices =arrays[ARRAY_INDEX]; bool has_indices=false; - DVector<Vector3> vertices =arrays[ARRAY_VERTEX]; + PoolVector<Vector3> vertices =arrays[ARRAY_VERTEX]; int vc = vertices.size(); ERR_FAIL_COND_V(!vc,Ref<Mesh>()); - DVector<Vector3>::Write r=vertices.write(); + PoolVector<Vector3>::Write r=vertices.write(); if (indices.size()) { @@ -977,14 +977,14 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { r[i]=t; } - r = DVector<Vector3>::Write(); + r = PoolVector<Vector3>::Write(); arrays[ARRAY_VERTEX]=vertices; if (!has_indices) { - DVector<int> new_indices; + PoolVector<int> new_indices; new_indices.resize(vertices.size()); - DVector<int>::Write iw = new_indices.write(); + PoolVector<int>::Write iw = new_indices.write(); for(int j=0;j<vc2;j+=3) { @@ -993,7 +993,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { iw[j+2]=j+1; } - iw=DVector<int>::Write(); + iw=PoolVector<int>::Write(); arrays[ARRAY_INDEX]=new_indices; } else { @@ -1002,7 +1002,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { SWAP(ir[j+1],ir[j+2]); } - ir=DVector<int>::Write(); + ir=PoolVector<int>::Write(); arrays[ARRAY_INDEX]=indices; } diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index 9be90b6436..f92db837ea 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -139,7 +139,7 @@ protected: public: void add_surface_from_arrays(PrimitiveType p_primitive, const Array& p_arrays, const Array& p_blend_shapes=Array(), uint32_t p_flags=ARRAY_COMPRESS_DEFAULT); - void add_surface(uint32_t p_format,PrimitiveType p_primitive,const DVector<uint8_t>& p_array,int p_vertex_count,const DVector<uint8_t>& p_index_array,int p_index_count,const AABB& p_aabb,const Vector<DVector<uint8_t> >& p_blend_shapes=Vector<DVector<uint8_t> >(),const Vector<AABB>& p_bone_aabbs=Vector<AABB>()); + 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>()); Array surface_get_arrays(int p_surface) const; virtual Array surface_get_morph_arrays(int p_surface) const; @@ -186,7 +186,7 @@ public: void center_geometry(); void regen_normalmaps(); - DVector<Face3> get_faces() const; + PoolVector<Face3> get_faces() const; Ref<TriangleMesh> generate_triangle_mesh() const; Mesh(); diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp index 4a753e6c09..ec699ee8e3 100644 --- a/scene/resources/mesh_data_tool.cpp +++ b/scene/resources/mesh_data_tool.cpp @@ -51,7 +51,7 @@ Error MeshDataTool::create_from_surface(const Ref<Mesh>& p_mesh,int p_surface) { Array arrays = p_mesh->surface_get_arrays(p_surface); ERR_FAIL_COND_V( arrays.empty(), ERR_INVALID_PARAMETER ); - DVector<Vector3> varray = arrays[Mesh::ARRAY_VERTEX]; + PoolVector<Vector3> varray = arrays[Mesh::ARRAY_VERTEX]; int vcount = varray.size(); ERR_FAIL_COND_V( vcount == 0, ERR_INVALID_PARAMETER); @@ -60,34 +60,34 @@ Error MeshDataTool::create_from_surface(const Ref<Mesh>& p_mesh,int p_surface) { format = p_mesh->surface_get_format(p_surface); material=p_mesh->surface_get_material(p_surface); - DVector<Vector3>::Read vr = varray.read(); + PoolVector<Vector3>::Read vr = varray.read(); - DVector<Vector3>::Read nr; + PoolVector<Vector3>::Read nr; if (arrays[Mesh::ARRAY_NORMAL].get_type()!=Variant::NIL) - nr = arrays[Mesh::ARRAY_NORMAL].operator DVector<Vector3>().read(); + nr = arrays[Mesh::ARRAY_NORMAL].operator PoolVector<Vector3>().read(); - DVector<real_t>::Read ta; + PoolVector<real_t>::Read ta; if (arrays[Mesh::ARRAY_TANGENT].get_type()!=Variant::NIL) - ta = arrays[Mesh::ARRAY_TANGENT].operator DVector<real_t>().read(); + ta = arrays[Mesh::ARRAY_TANGENT].operator PoolVector<real_t>().read(); - DVector<Vector2>::Read uv; + PoolVector<Vector2>::Read uv; if (arrays[Mesh::ARRAY_TEX_UV].get_type()!=Variant::NIL) - uv = arrays[Mesh::ARRAY_TEX_UV].operator DVector<Vector2>().read(); - DVector<Vector2>::Read uv2; + uv = arrays[Mesh::ARRAY_TEX_UV].operator PoolVector<Vector2>().read(); + PoolVector<Vector2>::Read uv2; if (arrays[Mesh::ARRAY_TEX_UV2].get_type()!=Variant::NIL) - uv2 = arrays[Mesh::ARRAY_TEX_UV2].operator DVector<Vector2>().read(); + uv2 = arrays[Mesh::ARRAY_TEX_UV2].operator PoolVector<Vector2>().read(); - DVector<Color>::Read col; + PoolVector<Color>::Read col; if (arrays[Mesh::ARRAY_COLOR].get_type()!=Variant::NIL) - col = arrays[Mesh::ARRAY_COLOR].operator DVector<Color>().read(); + col = arrays[Mesh::ARRAY_COLOR].operator PoolVector<Color>().read(); - DVector<real_t>::Read bo; + PoolVector<real_t>::Read bo; if (arrays[Mesh::ARRAY_BONES].get_type()!=Variant::NIL) - bo = arrays[Mesh::ARRAY_BONES].operator DVector<real_t>().read(); + bo = arrays[Mesh::ARRAY_BONES].operator PoolVector<real_t>().read(); - DVector<real_t>::Read we; + PoolVector<real_t>::Read we; if (arrays[Mesh::ARRAY_WEIGHTS].get_type()!=Variant::NIL) - we = arrays[Mesh::ARRAY_WEIGHTS].operator DVector<real_t>().read(); + we = arrays[Mesh::ARRAY_WEIGHTS].operator PoolVector<real_t>().read(); vertices.resize(vcount); @@ -129,7 +129,7 @@ Error MeshDataTool::create_from_surface(const Ref<Mesh>& p_mesh,int p_surface) { } - DVector<int> indices; + PoolVector<int> indices; if (arrays[Mesh::ARRAY_INDEX].get_type()!=Variant::NIL) { @@ -137,14 +137,14 @@ Error MeshDataTool::create_from_surface(const Ref<Mesh>& p_mesh,int p_surface) { } else { //make code simpler indices.resize(vcount); - DVector<int>::Write iw=indices.write(); + PoolVector<int>::Write iw=indices.write(); for(int i=0;i<vcount;i++) iw[i]=i; } int icount=indices.size(); - DVector<int>::Read r = indices.read(); + PoolVector<int>::Read r = indices.read(); Map<Point2i,int> edge_indices; @@ -199,59 +199,59 @@ Error MeshDataTool::commit_to_surface(const Ref<Mesh>& p_mesh) { int vcount=vertices.size(); - DVector<Vector3> v; - DVector<Vector3> n; - DVector<real_t> t; - DVector<Vector2> u; - DVector<Vector2> u2; - DVector<Color> c; - DVector<real_t> b; - DVector<real_t> w; - DVector<int> in; + PoolVector<Vector3> v; + PoolVector<Vector3> n; + PoolVector<real_t> t; + PoolVector<Vector2> u; + PoolVector<Vector2> u2; + PoolVector<Color> c; + PoolVector<real_t> b; + PoolVector<real_t> w; + PoolVector<int> in; { v.resize(vcount); - DVector<Vector3>::Write vr=v.write(); + PoolVector<Vector3>::Write vr=v.write(); - DVector<Vector3>::Write nr; + PoolVector<Vector3>::Write nr; if (format&Mesh::ARRAY_FORMAT_NORMAL) { n.resize(vcount); nr = n.write(); } - DVector<real_t>::Write ta; + PoolVector<real_t>::Write ta; if (format&Mesh::ARRAY_FORMAT_TANGENT) { t.resize(vcount*4); ta = t.write(); } - DVector<Vector2>::Write uv; + PoolVector<Vector2>::Write uv; if (format&Mesh::ARRAY_FORMAT_TEX_UV) { u.resize(vcount); uv = u.write(); } - DVector<Vector2>::Write uv2; + PoolVector<Vector2>::Write uv2; if (format&Mesh::ARRAY_FORMAT_TEX_UV2) { u2.resize(vcount); uv2 = u2.write(); } - DVector<Color>::Write col; + PoolVector<Color>::Write col; if (format&Mesh::ARRAY_FORMAT_COLOR) { c.resize(vcount); col = c.write(); } - DVector<real_t>::Write bo; + PoolVector<real_t>::Write bo; if (format&Mesh::ARRAY_FORMAT_BONES) { b.resize(vcount*4); bo = b.write(); } - DVector<real_t>::Write we; + PoolVector<real_t>::Write we; if (format&Mesh::ARRAY_FORMAT_WEIGHTS) { w.resize(vcount*4); we = w.write(); @@ -299,7 +299,7 @@ Error MeshDataTool::commit_to_surface(const Ref<Mesh>& p_mesh) { int fc = faces.size(); in.resize(fc*3); - DVector<int>::Write iw=in.write(); + PoolVector<int>::Write iw=in.write(); 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 802f58e8ca..143870c920 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -31,17 +31,17 @@ -void MultiMesh::_set_transform_array(const DVector<Vector3>& p_array) { +void MultiMesh::_set_transform_array(const PoolVector<Vector3>& p_array) { int instance_count = get_instance_count(); - DVector<Vector3> xforms = p_array; + PoolVector<Vector3> xforms = p_array; int len=xforms.size(); ERR_FAIL_COND((len/4) != instance_count); if (len==0) return; - DVector<Vector3>::Read r = xforms.read(); + PoolVector<Vector3>::Read r = xforms.read(); for(int i=0;i<len/4;i++) { @@ -56,17 +56,17 @@ void MultiMesh::_set_transform_array(const DVector<Vector3>& p_array) { } -DVector<Vector3> MultiMesh::_get_transform_array() const { +PoolVector<Vector3> MultiMesh::_get_transform_array() const { int instance_count = get_instance_count(); if (instance_count==0) - return DVector<Vector3>(); + return PoolVector<Vector3>(); - DVector<Vector3> xforms; + PoolVector<Vector3> xforms; xforms.resize(instance_count*4); - DVector<Vector3>::Write w = xforms.write(); + PoolVector<Vector3>::Write w = xforms.write(); for(int i=0;i<instance_count;i++) { @@ -82,17 +82,17 @@ DVector<Vector3> MultiMesh::_get_transform_array() const { } -void MultiMesh::_set_color_array(const DVector<Color>& p_array) { +void MultiMesh::_set_color_array(const PoolVector<Color>& p_array) { int instance_count = get_instance_count(); - DVector<Color> colors = p_array; + PoolVector<Color> colors = p_array; int len=colors.size(); ERR_FAIL_COND(len != instance_count); if (len==0) return; - DVector<Color>::Read r = colors.read(); + PoolVector<Color>::Read r = colors.read(); for(int i=0;i<len;i++) { @@ -101,14 +101,14 @@ void MultiMesh::_set_color_array(const DVector<Color>& p_array) { } -DVector<Color> MultiMesh::_get_color_array() const { +PoolVector<Color> MultiMesh::_get_color_array() const { int instance_count = get_instance_count(); if (instance_count==0) - return DVector<Color>(); + return PoolVector<Color>(); - DVector<Color> colors; + PoolVector<Color> colors; colors.resize(instance_count); for(int i=0;i<instance_count;i++) { diff --git a/scene/resources/multimesh.h b/scene/resources/multimesh.h index ab2ef59214..3ba109a087 100644 --- a/scene/resources/multimesh.h +++ b/scene/resources/multimesh.h @@ -59,11 +59,11 @@ protected: static void _bind_methods(); - void _set_transform_array(const DVector<Vector3>& p_array); - DVector<Vector3> _get_transform_array() const; + void _set_transform_array(const PoolVector<Vector3>& p_array); + PoolVector<Vector3> _get_transform_array() const; - void _set_color_array(const DVector<Color>& p_array); - DVector<Color> _get_color_array() const; + void _set_color_array(const PoolVector<Color>& p_array); + PoolVector<Color> _get_color_array() const; public: diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 7d86513c51..c3b98af811 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -1139,12 +1139,12 @@ void SceneState::set_bundled_scene(const Dictionary& d) { ERR_FAIL(); } - DVector<String> snames = d["names"]; + PoolVector<String> snames = d["names"]; if (snames.size()) { int namecount = snames.size(); names.resize(namecount); - DVector<String>::Read r =snames.read(); + PoolVector<String>::Read r =snames.read(); for(int i=0;i<names.size();i++) names[i]=r[i]; } @@ -1166,8 +1166,8 @@ void SceneState::set_bundled_scene(const Dictionary& d) { nodes.resize(d["node_count"]); int nc=nodes.size(); if (nc) { - DVector<int> snodes = d["nodes"]; - DVector<int>::Read r = snodes.read(); + PoolVector<int> snodes = d["nodes"]; + PoolVector<int>::Read r = snodes.read(); int idx=0; for(int i=0;i<nc;i++) { NodeData &nd = nodes[i]; @@ -1196,8 +1196,8 @@ void SceneState::set_bundled_scene(const Dictionary& d) { if (cc) { - DVector<int> sconns = d["conns"]; - DVector<int>::Read r = sconns.read(); + PoolVector<int> sconns = d["conns"]; + PoolVector<int>::Read r = sconns.read(); int idx=0; for(int i=0;i<cc;i++) { ConnectionData &cd = connections[i]; @@ -1245,12 +1245,12 @@ void SceneState::set_bundled_scene(const Dictionary& d) { Dictionary SceneState::get_bundled_scene() const { - DVector<String> rnames; + PoolVector<String> rnames; rnames.resize(names.size()); if (names.size()) { - DVector<String>::Write r=rnames.write(); + PoolVector<String>::Write r=rnames.write(); for(int i=0;i<names.size();i++) r[i]=names[i]; @@ -1659,10 +1659,10 @@ void SceneState::add_editable_instance(const NodePath& p_path){ editable_instances.push_back(p_path); } -DVector<String> SceneState::_get_node_groups(int p_idx) const { +PoolVector<String> SceneState::_get_node_groups(int p_idx) const { Vector<StringName> groups = get_node_groups(p_idx); - DVector<String> ret; + PoolVector<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 2eda624dc3..fd4ed106df 100644 --- a/scene/resources/packed_scene.h +++ b/scene/resources/packed_scene.h @@ -102,7 +102,7 @@ class SceneState : public Reference { static bool disable_placeholders; - DVector<String> _get_node_groups(int p_idx) const; + PoolVector<String> _get_node_groups(int p_idx) const; protected: diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp index 3dc3e6005a..2156487407 100644 --- a/scene/resources/polygon_path_finder.cpp +++ b/scene/resources/polygon_path_finder.cpp @@ -448,7 +448,7 @@ void PolygonPathFinder::_set_data(const Dictionary& p_data) { ERR_FAIL_COND(!p_data.has("segments")); ERR_FAIL_COND(!p_data.has("bounds")); - DVector<Vector2> p=p_data["points"]; + PoolVector<Vector2> p=p_data["points"]; Array c=p_data["connections"]; ERR_FAIL_COND(c.size()!=p.size()); @@ -458,11 +458,11 @@ void PolygonPathFinder::_set_data(const Dictionary& p_data) { int pc = p.size(); points.resize(pc+2); - DVector<Vector2>::Read pr=p.read(); + PoolVector<Vector2>::Read pr=p.read(); for(int i=0;i<pc;i++) { points[i].pos=pr[i]; - DVector<int> con=c[i]; - DVector<int>::Read cr=con.read(); + PoolVector<int> con=c[i]; + PoolVector<int>::Read cr=con.read(); int cc=con.size(); for(int j=0;j<cc;j++) { @@ -473,19 +473,19 @@ void PolygonPathFinder::_set_data(const Dictionary& p_data) { if (p_data.has("penalties")) { - DVector<float> penalties=p_data["penalties"]; + PoolVector<float> penalties=p_data["penalties"]; if (penalties.size()==pc) { - DVector<float>::Read pr = penalties.read(); + PoolVector<float>::Read pr = penalties.read(); for(int i=0;i<pc;i++) { points[i].penalty=pr[i]; } } } - DVector<int> segs=p_data["segments"]; + PoolVector<int> segs=p_data["segments"]; int sc=segs.size(); ERR_FAIL_COND(sc&1); - DVector<int>::Read sr = segs.read(); + PoolVector<int>::Read sr = segs.read(); for(int i=0;i<sc;i+=2) { Edge e(sr[i],sr[i+1]); @@ -498,25 +498,25 @@ void PolygonPathFinder::_set_data(const Dictionary& p_data) { Dictionary PolygonPathFinder::_get_data() const{ Dictionary d; - DVector<Vector2> p; - DVector<int> ind; + PoolVector<Vector2> p; + PoolVector<int> ind; Array connections; p.resize(points.size()-2); connections.resize(points.size()-2); ind.resize(edges.size()*2); - DVector<float> penalties; + PoolVector<float> penalties; penalties.resize(points.size()-2); { - DVector<Vector2>::Write wp=p.write(); - DVector<float>::Write pw=penalties.write(); + PoolVector<Vector2>::Write wp=p.write(); + PoolVector<float>::Write pw=penalties.write(); for(int i=0;i<points.size()-2;i++) { wp[i]=points[i].pos; pw[i]=points[i].penalty; - DVector<int> c; + PoolVector<int> c; c.resize(points[i].connections.size()); { - DVector<int>::Write cw=c.write(); + PoolVector<int>::Write cw=c.write(); int idx=0; for (Set<int>::Element *E=points[i].connections.front();E;E=E->next()) { cw[idx++]=E->get(); @@ -527,7 +527,7 @@ Dictionary PolygonPathFinder::_get_data() const{ } { - DVector<int>::Write iw=ind.write(); + PoolVector<int>::Write iw=ind.write(); 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/room.cpp b/scene/resources/room.cpp index c4d11b94d1..88648272be 100644 --- a/scene/resources/room.cpp +++ b/scene/resources/room.cpp @@ -37,12 +37,12 @@ RID RoomBounds::get_rid() const { } -void RoomBounds::set_geometry_hint(const DVector<Face3>& p_geometry_hint) { +void RoomBounds::set_geometry_hint(const PoolVector<Face3>& p_geometry_hint) { geometry_hint=p_geometry_hint; } -DVector<Face3> RoomBounds::get_geometry_hint() const { +PoolVector<Face3> RoomBounds::get_geometry_hint() const { return geometry_hint; } diff --git a/scene/resources/room.h b/scene/resources/room.h index 6a8deac8b3..84d68e5718 100644 --- a/scene/resources/room.h +++ b/scene/resources/room.h @@ -41,7 +41,7 @@ class RoomBounds : public Resource { RES_BASE_EXTENSION("room"); RID area; - DVector<Face3> geometry_hint; + PoolVector<Face3> geometry_hint; protected: @@ -53,8 +53,8 @@ public: virtual RID get_rid() const; - void set_geometry_hint(const DVector<Face3>& geometry_hint); - DVector<Face3> get_geometry_hint() const; + void set_geometry_hint(const PoolVector<Face3>& geometry_hint); + PoolVector<Face3> get_geometry_hint() const; RoomBounds(); ~RoomBounds(); diff --git a/scene/resources/sample.cpp b/scene/resources/sample.cpp index 8ea02ac943..e07e4d3767 100644 --- a/scene/resources/sample.cpp +++ b/scene/resources/sample.cpp @@ -119,18 +119,18 @@ int Sample::get_length() const { return length; } -void Sample::set_data(const DVector<uint8_t>& p_buffer) { +void Sample::set_data(const PoolVector<uint8_t>& p_buffer) { if (sample.is_valid()) AudioServer::get_singleton()->sample_set_data(sample,p_buffer); } -DVector<uint8_t> Sample::get_data() const { +PoolVector<uint8_t> Sample::get_data() const { if (sample.is_valid()) return AudioServer::get_singleton()->sample_get_data(sample); - return DVector<uint8_t>(); + return PoolVector<uint8_t>(); } diff --git a/scene/resources/sample.h b/scene/resources/sample.h index c011f63144..be2cf67954 100644 --- a/scene/resources/sample.h +++ b/scene/resources/sample.h @@ -82,8 +82,8 @@ public: bool is_stereo() const; int get_length() const; - void set_data(const DVector<uint8_t>& p_buffer); - DVector<uint8_t> get_data() const; + void set_data(const PoolVector<uint8_t>& p_buffer); + PoolVector<uint8_t> get_data() const; void set_mix_rate(int p_rate); int get_mix_rate() const; diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index 0c31e1406f..37b019e369 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -554,8 +554,8 @@ void ShaderGraph::node_add(ShaderType p_type, NodeType p_node_type,int p_id) { case NODE_XFORM_TO_VEC: {} break; // 3 scalar input: {} break; 1 vec3 output case NODE_SCALAR_INTERP: {} break; // scalar interpolation (with optional curve) case NODE_VEC_INTERP: {} break; // vec3 interpolation (with optional curve) - case NODE_COLOR_RAMP: { node.param1=DVector<Color>(); node.param2=DVector<real_t>();} break; // vec3 interpolation (with optional curve) - case NODE_CURVE_MAP: { node.param1=DVector<Vector2>();} break; // vec3 interpolation (with optional curve) + case NODE_COLOR_RAMP: { node.param1=PoolVector<Color>(); node.param2=PoolVector<real_t>();} break; // vec3 interpolation (with optional curve) + case NODE_CURVE_MAP: { node.param1=PoolVector<Vector2>();} break; // vec3 interpolation (with optional curve) case NODE_SCALAR_INPUT: {node.param1=_find_unique_name("Scalar"); node.param2=0;} break; // scalar uniform (assignable in material) case NODE_VEC_INPUT: {node.param1=_find_unique_name("Vec3");node.param2=Vector3();} break; // vec3 uniform (assignable in material) case NODE_RGB_INPUT: {node.param1=_find_unique_name("Color");node.param2=Color();} break; // color uniform (assignable in material) @@ -1082,7 +1082,7 @@ ShaderGraph::VecFunc ShaderGraph::vec_func_node_get_function(ShaderType p_type, return VecFunc(func); } -void ShaderGraph::color_ramp_node_set_ramp(ShaderType p_type,int p_id,const DVector<Color>& p_colors, const DVector<real_t>& p_offsets){ +void ShaderGraph::color_ramp_node_set_ramp(ShaderType p_type,int p_id,const PoolVector<Color>& p_colors, const PoolVector<real_t>& p_offsets){ ERR_FAIL_INDEX(p_type,3); ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); @@ -1094,27 +1094,27 @@ void ShaderGraph::color_ramp_node_set_ramp(ShaderType p_type,int p_id,const DVec } -DVector<Color> ShaderGraph::color_ramp_node_get_colors(ShaderType p_type,int p_id) const{ +PoolVector<Color> ShaderGraph::color_ramp_node_get_colors(ShaderType p_type,int p_id) const{ - ERR_FAIL_INDEX_V(p_type,3,DVector<Color>()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),DVector<Color>()); + ERR_FAIL_INDEX_V(p_type,3,PoolVector<Color>()); + ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),PoolVector<Color>()); const Node& n = shader[p_type].node_map[p_id]; return n.param1; } -DVector<real_t> ShaderGraph::color_ramp_node_get_offsets(ShaderType p_type,int p_id) const{ +PoolVector<real_t> ShaderGraph::color_ramp_node_get_offsets(ShaderType p_type,int p_id) const{ - ERR_FAIL_INDEX_V(p_type,3,DVector<real_t>()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),DVector<real_t>()); + ERR_FAIL_INDEX_V(p_type,3,PoolVector<real_t>()); + ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),PoolVector<real_t>()); const Node& n = shader[p_type].node_map[p_id]; return n.param2; } -void ShaderGraph::curve_map_node_set_points(ShaderType p_type,int p_id,const DVector<Vector2>& p_points) { +void ShaderGraph::curve_map_node_set_points(ShaderType p_type,int p_id,const PoolVector<Vector2>& p_points) { ERR_FAIL_INDEX(p_type,3); ERR_FAIL_COND(!shader[p_type].node_map.has(p_id)); @@ -1124,10 +1124,10 @@ void ShaderGraph::curve_map_node_set_points(ShaderType p_type,int p_id,const DVe } -DVector<Vector2> ShaderGraph::curve_map_node_get_points(ShaderType p_type,int p_id) const{ +PoolVector<Vector2> ShaderGraph::curve_map_node_get_points(ShaderType p_type,int p_id) const{ - ERR_FAIL_INDEX_V(p_type,3,DVector<Vector2>()); - ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),DVector<Vector2>()); + ERR_FAIL_INDEX_V(p_type,3,PoolVector<Vector2>()); + ERR_FAIL_COND_V(!shader[p_type].node_map.has(p_id),PoolVector<Vector2>()); const Node& n = shader[p_type].node_map[p_id]; return n.param1; @@ -2450,16 +2450,16 @@ void ShaderGraph::_add_node_code(ShaderType p_type,Node *p_node,const Vector<Str DEF_SCALAR(0); static const int color_ramp_len=512; - DVector<uint8_t> cramp; + PoolVector<uint8_t> cramp; cramp.resize(color_ramp_len*4); { - DVector<Color> colors=p_node->param1; - DVector<real_t> offsets=p_node->param2; + PoolVector<Color> colors=p_node->param1; + PoolVector<real_t> offsets=p_node->param2; int cc =colors.size(); - DVector<uint8_t>::Write crw = cramp.write(); - DVector<Color>::Read cr = colors.read(); - DVector<real_t>::Read ofr = offsets.read(); + PoolVector<uint8_t>::Write crw = cramp.write(); + PoolVector<Color>::Read cr = colors.read(); + PoolVector<real_t>::Read ofr = offsets.read(); int at=0; Color color_at(0,0,0,1); @@ -2508,14 +2508,14 @@ void ShaderGraph::_add_node_code(ShaderType p_type,Node *p_node,const Vector<Str static const int curve_map_len=256; bool mapped[256]; zeromem(mapped,sizeof(mapped)); - DVector<uint8_t> cmap; + PoolVector<uint8_t> cmap; cmap.resize(curve_map_len); { - DVector<Point2> points=p_node->param1; + PoolVector<Point2> points=p_node->param1; int pc =points.size(); - DVector<uint8_t>::Write cmw = cmap.write(); - DVector<Point2>::Read pr = points.read(); + PoolVector<uint8_t>::Write cmw = cmap.write(); + PoolVector<Point2>::Read pr = points.read(); Vector2 prev=Vector2(0,0); Vector2 prev2=Vector2(0,0); diff --git a/scene/resources/shader_graph.h b/scene/resources/shader_graph.h index 57893f27c0..f4e24dbe78 100644 --- a/scene/resources/shader_graph.h +++ b/scene/resources/shader_graph.h @@ -326,12 +326,12 @@ public: void vec_func_node_set_function(ShaderType p_which,int p_id,VecFunc p_func); VecFunc vec_func_node_get_function(ShaderType p_which,int p_id) const; - void color_ramp_node_set_ramp(ShaderType p_which,int p_id,const DVector<Color>& p_colors, const DVector<real_t>& p_offsets); - DVector<Color> color_ramp_node_get_colors(ShaderType p_which,int p_id) const; - DVector<real_t> color_ramp_node_get_offsets(ShaderType p_which,int p_id) const; + void color_ramp_node_set_ramp(ShaderType p_which,int p_id,const PoolVector<Color>& p_colors, const PoolVector<real_t>& p_offsets); + PoolVector<Color> color_ramp_node_get_colors(ShaderType p_which,int p_id) const; + PoolVector<real_t> color_ramp_node_get_offsets(ShaderType p_which,int p_id) const; - void curve_map_node_set_points(ShaderType p_which, int p_id, const DVector<Vector2>& p_points); - DVector<Vector2> curve_map_node_get_points(ShaderType p_which,int p_id) const; + void curve_map_node_set_points(ShaderType p_which, int p_id, const PoolVector<Vector2>& p_points); + PoolVector<Vector2> curve_map_node_get_points(ShaderType p_which,int p_id) const; void input_node_set_name(ShaderType p_which,int p_id,const String& p_name); String input_node_get_name(ShaderType p_which,int p_id); diff --git a/scene/resources/shape.cpp b/scene/resources/shape.cpp index f00443276f..a90c3b47a9 100644 --- a/scene/resources/shape.cpp +++ b/scene/resources/shape.cpp @@ -34,7 +34,7 @@ #include "scene/main/scene_main_loop.h" -void Shape::add_vertices_to_array(DVector<Vector3> &array, const Transform& p_xform) { +void Shape::add_vertices_to_array(PoolVector<Vector3> &array, const Transform& p_xform) { Vector<Vector3> toadd = _gen_debug_mesh_lines(); @@ -42,7 +42,7 @@ void Shape::add_vertices_to_array(DVector<Vector3> &array, const Transform& p_xf int base=array.size(); array.resize(base+toadd.size()); - DVector<Vector3>::Write w = array.write(); + PoolVector<Vector3>::Write w = array.write(); for(int i=0;i<toadd.size();i++) { w[i+base]=p_xform.xform(toadd[i]); } @@ -61,11 +61,11 @@ Ref<Mesh> Shape::get_debug_mesh() { if (!lines.empty()) { //make mesh - DVector<Vector3> array; + PoolVector<Vector3> array; array.resize(lines.size()); { - DVector<Vector3>::Write w=array.write(); + PoolVector<Vector3>::Write w=array.write(); 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 94a8ec7075..29a93b642c 100644 --- a/scene/resources/shape.h +++ b/scene/resources/shape.h @@ -53,7 +53,7 @@ public: Ref<Mesh> get_debug_mesh(); - void add_vertices_to_array(DVector<Vector3> &array, const Transform& p_xform); + void add_vertices_to_array(PoolVector<Vector3> &array, const Transform& p_xform); Shape(); ~Shape(); diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index 2ed620c097..cc13c0ff11 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -262,9 +262,9 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { case Mesh::ARRAY_FORMAT_VERTEX: case Mesh::ARRAY_FORMAT_NORMAL: { - DVector<Vector3> array; + PoolVector<Vector3> array; array.resize(varr_len); - DVector<Vector3>::Write w = array.write(); + PoolVector<Vector3>::Write w = array.write(); int idx=0; for(List< Vertex >::Element *E=vertex_array.front();E;E=E->next(),idx++) { @@ -282,7 +282,7 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { } - w=DVector<Vector3>::Write(); + w=PoolVector<Vector3>::Write(); a[i]=array; } break; @@ -290,9 +290,9 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { case Mesh::ARRAY_FORMAT_TEX_UV: case Mesh::ARRAY_FORMAT_TEX_UV2: { - DVector<Vector2> array; + PoolVector<Vector2> array; array.resize(varr_len); - DVector<Vector2>::Write w = array.write(); + PoolVector<Vector2>::Write w = array.write(); int idx=0; for(List< Vertex >::Element *E=vertex_array.front();E;E=E->next(),idx++) { @@ -311,15 +311,15 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { } - w=DVector<Vector2>::Write(); + w=PoolVector<Vector2>::Write(); a[i]=array; } break; case Mesh::ARRAY_FORMAT_TANGENT: { - DVector<float> array; + PoolVector<float> array; array.resize(varr_len*4); - DVector<float>::Write w = array.write(); + PoolVector<float>::Write w = array.write(); int idx=0; for(List< Vertex >::Element *E=vertex_array.front();E;E=E->next(),idx+=4) { @@ -335,15 +335,15 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { w[idx+3]=d<0 ? -1 : 1; } - w=DVector<float>::Write(); + w=PoolVector<float>::Write(); a[i]=array; } break; case Mesh::ARRAY_FORMAT_COLOR: { - DVector<Color> array; + PoolVector<Color> array; array.resize(varr_len); - DVector<Color>::Write w = array.write(); + PoolVector<Color>::Write w = array.write(); int idx=0; for(List< Vertex >::Element *E=vertex_array.front();E;E=E->next(),idx++) { @@ -352,15 +352,15 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { w[idx]=v.color; } - w=DVector<Color>::Write(); + w=PoolVector<Color>::Write(); a[i]=array; } break; case Mesh::ARRAY_FORMAT_BONES: { - DVector<int> array; + PoolVector<int> array; array.resize(varr_len*4); - DVector<int>::Write w = array.write(); + PoolVector<int>::Write w = array.write(); int idx=0; for(List< Vertex >::Element *E=vertex_array.front();E;E=E->next(),idx+=4) { @@ -375,16 +375,16 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { } - w=DVector<int>::Write(); + w=PoolVector<int>::Write(); a[i]=array; } break; case Mesh::ARRAY_FORMAT_WEIGHTS: { - DVector<float> array; + PoolVector<float> array; array.resize(varr_len*4); - DVector<float>::Write w = array.write(); + PoolVector<float>::Write w = array.write(); int idx=0; for(List< Vertex >::Element *E=vertex_array.front();E;E=E->next(),idx+=4) { @@ -399,7 +399,7 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { } - w=DVector<float>::Write(); + w=PoolVector<float>::Write(); a[i]=array; } break; @@ -407,9 +407,9 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { ERR_CONTINUE( index_array.size() ==0 ); - DVector<int> array; + PoolVector<int> array; array.resize(index_array.size()); - DVector<int>::Write w = array.write(); + PoolVector<int>::Write w = array.write(); int idx=0; for(List< int>::Element *E=index_array.front();E;E=E->next(),idx++) { @@ -417,7 +417,7 @@ Ref<Mesh> SurfaceTool::commit(const Ref<Mesh>& p_existing) { w[idx]=E->get(); } - w=DVector<int>::Write(); + w=PoolVector<int>::Write(); a[i]=array; } break; @@ -490,14 +490,14 @@ void SurfaceTool::_create_list(const Ref<Mesh>& p_existing, int p_surface, List< Array arr = p_existing->surface_get_arrays(p_surface); ERR_FAIL_COND( arr.size() !=VS::ARRAY_MAX ); - DVector<Vector3> varr = arr[VS::ARRAY_VERTEX]; - DVector<Vector3> narr = arr[VS::ARRAY_NORMAL]; - DVector<float> tarr = arr[VS::ARRAY_TANGENT]; - DVector<Color> carr = arr[VS::ARRAY_COLOR]; - DVector<Vector2> uvarr = arr[VS::ARRAY_TEX_UV]; - DVector<Vector2> uv2arr = arr[VS::ARRAY_TEX_UV2]; - DVector<int> barr = arr[VS::ARRAY_BONES]; - DVector<float> warr = arr[VS::ARRAY_WEIGHTS]; + 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]; int vc = varr.size(); @@ -505,46 +505,46 @@ void SurfaceTool::_create_list(const Ref<Mesh>& p_existing, int p_surface, List< return; lformat=0; - DVector<Vector3>::Read rv; + PoolVector<Vector3>::Read rv; if (varr.size()) { lformat|=VS::ARRAY_FORMAT_VERTEX; rv=varr.read(); } - DVector<Vector3>::Read rn; + PoolVector<Vector3>::Read rn; if (narr.size()) { lformat|=VS::ARRAY_FORMAT_NORMAL; rn=narr.read(); } - DVector<float>::Read rt; + PoolVector<float>::Read rt; if (tarr.size()) { lformat|=VS::ARRAY_FORMAT_TANGENT; rt=tarr.read(); } - DVector<Color>::Read rc; + PoolVector<Color>::Read rc; if (carr.size()) { lformat|=VS::ARRAY_FORMAT_COLOR; rc=carr.read(); } - DVector<Vector2>::Read ruv; + PoolVector<Vector2>::Read ruv; if (uvarr.size()) { lformat|=VS::ARRAY_FORMAT_TEX_UV; ruv=uvarr.read(); } - DVector<Vector2>::Read ruv2; + PoolVector<Vector2>::Read ruv2; if (uv2arr.size()) { lformat|=VS::ARRAY_FORMAT_TEX_UV2; ruv2=uv2arr.read(); } - DVector<int>::Read rb; + PoolVector<int>::Read rb; if (barr.size()) { lformat|=VS::ARRAY_FORMAT_BONES; rb=barr.read(); } - DVector<float>::Read rw; + PoolVector<float>::Read rw; if (warr.size()) { lformat|=VS::ARRAY_FORMAT_WEIGHTS; rw=warr.read(); @@ -592,12 +592,12 @@ void SurfaceTool::_create_list(const Ref<Mesh>& p_existing, int p_surface, List< //indices - DVector<int> idx= arr[VS::ARRAY_INDEX]; + PoolVector<int> idx= arr[VS::ARRAY_INDEX]; int is = idx.size(); if (is) { lformat|=VS::ARRAY_FORMAT_INDEX; - DVector<int>::Read iarr=idx.read(); + PoolVector<int>::Read iarr=idx.read(); for(int i=0;i<is;i++) { r_index->push_back(iarr[i]); } diff --git a/scene/resources/theme.h b/scene/resources/theme.h index 94ac910e9f..e9d890cf97 100644 --- a/scene/resources/theme.h +++ b/scene/resources/theme.h @@ -72,13 +72,13 @@ protected: Ref<Font> default_theme_font; - DVector<String> _get_icon_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_icon_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } - DVector<String> _get_stylebox_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_stylebox_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } - DVector<String> _get_stylebox_types(void) const { DVector<String> ilret; List<StringName> il; get_stylebox_types(&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } - DVector<String> _get_font_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_font_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } - DVector<String> _get_color_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_color_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } - DVector<String> _get_constant_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_constant_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } - DVector<String> _get_type_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_type_list(&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } + PoolVector<String> _get_icon_list(const String& p_type) const { PoolVector<String> ilret; List<StringName> il; get_icon_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } + PoolVector<String> _get_stylebox_list(const String& p_type) const { PoolVector<String> ilret; List<StringName> il; get_stylebox_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } + PoolVector<String> _get_stylebox_types(void) const { PoolVector<String> ilret; List<StringName> il; get_stylebox_types(&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } + PoolVector<String> _get_font_list(const String& p_type) const { PoolVector<String> ilret; List<StringName> il; get_font_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } + PoolVector<String> _get_color_list(const String& p_type) const { PoolVector<String> ilret; List<StringName> il; get_color_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } + PoolVector<String> _get_constant_list(const String& p_type) const { PoolVector<String> ilret; List<StringName> il; get_constant_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } + PoolVector<String> _get_type_list(const String& p_type) const { PoolVector<String> ilret; List<StringName> il; get_type_list(&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } static void _bind_methods(); public: diff --git a/servers/audio/audio_server_sw.cpp b/servers/audio/audio_server_sw.cpp index edf8143eb5..f508a130b4 100644 --- a/servers/audio/audio_server_sw.cpp +++ b/servers/audio/audio_server_sw.cpp @@ -384,11 +384,11 @@ const void* AudioServerSW::sample_get_data_ptr(RID p_sample) const { return sample_manager->sample_get_data_ptr(p_sample); } -void AudioServerSW::sample_set_data(RID p_sample, const DVector<uint8_t>& p_buffer) { +void AudioServerSW::sample_set_data(RID p_sample, const PoolVector<uint8_t>& p_buffer) { AUDIO_LOCK sample_manager->sample_set_data(p_sample,p_buffer); } -DVector<uint8_t> AudioServerSW::sample_get_data(RID p_sample) const { +PoolVector<uint8_t> AudioServerSW::sample_get_data(RID p_sample) const { AUDIO_LOCK return sample_manager->sample_get_data(p_sample); } diff --git a/servers/audio/audio_server_sw.h b/servers/audio/audio_server_sw.h index f97ae8db82..52b45351c3 100644 --- a/servers/audio/audio_server_sw.h +++ b/servers/audio/audio_server_sw.h @@ -125,8 +125,8 @@ public: virtual int sample_get_length(RID p_sample) const; const void* sample_get_data_ptr(RID p_sample) const; - virtual void sample_set_data(RID p_sample, const DVector<uint8_t>& p_buffer); - virtual DVector<uint8_t> sample_get_data(RID p_sample) const; + virtual void sample_set_data(RID p_sample, const PoolVector<uint8_t>& p_buffer); + virtual PoolVector<uint8_t> sample_get_data(RID p_sample) const; virtual void sample_set_mix_rate(RID p_sample,int p_rate); virtual int sample_get_mix_rate(RID p_sample) const; diff --git a/servers/audio/sample_manager_sw.cpp b/servers/audio/sample_manager_sw.cpp index 623bb0f9cb..fe4cc36776 100644 --- a/servers/audio/sample_manager_sw.cpp +++ b/servers/audio/sample_manager_sw.cpp @@ -125,7 +125,7 @@ int SampleManagerMallocSW::sample_get_length(RID p_sample) const { return s->length; } -void SampleManagerMallocSW::sample_set_data(RID p_sample, const DVector<uint8_t>& p_buffer) { +void SampleManagerMallocSW::sample_set_data(RID p_sample, const PoolVector<uint8_t>& p_buffer) { Sample *s = sample_owner.get(p_sample); ERR_FAIL_COND(!s); @@ -137,7 +137,7 @@ void SampleManagerMallocSW::sample_set_data(RID p_sample, const DVector<uint8_t> ERR_EXPLAIN("Sample buffer size does not match sample size."); //print_line("len bytes: "+itos(s->length_bytes)+" bufsize: "+itos(buff_size)); ERR_FAIL_COND(s->length_bytes!=buff_size); - DVector<uint8_t>::Read buffer_r=p_buffer.read(); + PoolVector<uint8_t>::Read buffer_r=p_buffer.read(); const uint8_t *src = buffer_r.ptr(); uint8_t *dst = (uint8_t*)s->data; //print_line("set data: "+itos(s->length_bytes)); @@ -181,14 +181,14 @@ void SampleManagerMallocSW::sample_set_data(RID p_sample, const DVector<uint8_t> } -const DVector<uint8_t> SampleManagerMallocSW::sample_get_data(RID p_sample) const { +const PoolVector<uint8_t> SampleManagerMallocSW::sample_get_data(RID p_sample) const { Sample *s = sample_owner.get(p_sample); - ERR_FAIL_COND_V(!s,DVector<uint8_t>()); + ERR_FAIL_COND_V(!s,PoolVector<uint8_t>()); - DVector<uint8_t> ret_buffer; + PoolVector<uint8_t> ret_buffer; ret_buffer.resize(s->length_bytes); - DVector<uint8_t>::Write buffer_w=ret_buffer.write(); + PoolVector<uint8_t>::Write buffer_w=ret_buffer.write(); uint8_t *dst = buffer_w.ptr(); const uint8_t *src = (const uint8_t*)s->data; @@ -197,7 +197,7 @@ const DVector<uint8_t> SampleManagerMallocSW::sample_get_data(RID p_sample) cons dst[i]=src[i]; } - buffer_w = DVector<uint8_t>::Write(); //unlock + buffer_w = PoolVector<uint8_t>::Write(); //unlock return ret_buffer; } diff --git a/servers/audio/sample_manager_sw.h b/servers/audio/sample_manager_sw.h index ad71723cd6..93cad96f1a 100644 --- a/servers/audio/sample_manager_sw.h +++ b/servers/audio/sample_manager_sw.h @@ -45,8 +45,8 @@ public: virtual bool sample_is_stereo(RID p_sample) const=0; virtual int sample_get_length(RID p_sample) const=0; - virtual void sample_set_data(RID p_sample, const DVector<uint8_t>& p_buffer)=0; - virtual const DVector<uint8_t> sample_get_data(RID p_sample) const=0; + virtual void sample_set_data(RID p_sample, const PoolVector<uint8_t>& p_buffer)=0; + virtual const PoolVector<uint8_t> sample_get_data(RID p_sample) const=0; virtual void *sample_get_data_ptr(RID p_sample) const=0; @@ -102,8 +102,8 @@ public: virtual bool sample_is_stereo(RID p_sample) const; virtual int sample_get_length(RID p_sample) const; - virtual void sample_set_data(RID p_sample, const DVector<uint8_t>& p_buffer); - virtual const DVector<uint8_t> sample_get_data(RID p_sample) const; + virtual void sample_set_data(RID p_sample, const PoolVector<uint8_t>& p_buffer); + virtual const PoolVector<uint8_t> sample_get_data(RID p_sample) const; virtual void *sample_get_data_ptr(RID p_sample) const; diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 78d793fe46..5037b19924 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -46,7 +46,7 @@ AudioServer *AudioServer::get_singleton() { return singleton; } -void AudioServer::sample_set_signed_data(RID p_sample, const DVector<float>& p_buffer) { +void AudioServer::sample_set_signed_data(RID p_sample, const PoolVector<float>& p_buffer) { SampleFormat format = sample_get_format(p_sample); @@ -56,9 +56,9 @@ void AudioServer::sample_set_signed_data(RID p_sample, const DVector<float>& p_b int len = p_buffer.size(); ERR_FAIL_COND( len == 0 ); - DVector<uint8_t> data; - DVector<uint8_t>::Write w; - DVector<float>::Read r = p_buffer.read(); + PoolVector<uint8_t> data; + PoolVector<uint8_t>::Write w; + PoolVector<float>::Read r = p_buffer.read(); switch(format) { case SAMPLE_FORMAT_PCM8: { @@ -95,7 +95,7 @@ void AudioServer::sample_set_signed_data(RID p_sample, const DVector<float>& p_b } break; } - w = DVector<uint8_t>::Write(); + w = PoolVector<uint8_t>::Write(); sample_set_data(p_sample,data); diff --git a/servers/audio_server.h b/servers/audio_server.h index 9d8ae2bff9..1482b40d4c 100644 --- a/servers/audio_server.h +++ b/servers/audio_server.h @@ -168,9 +168,9 @@ public: virtual int sample_get_length(RID p_sample) const=0; virtual const void* sample_get_data_ptr(RID p_sample) const=0; - virtual void sample_set_signed_data(RID p_sample, const DVector<float>& p_buffer); - virtual void sample_set_data(RID p_sample, const DVector<uint8_t>& p_buffer)=0; - virtual DVector<uint8_t> sample_get_data(RID p_sample) const=0; + virtual void sample_set_signed_data(RID p_sample, const PoolVector<float>& p_buffer); + virtual void sample_set_data(RID p_sample, const PoolVector<uint8_t>& p_buffer)=0; + virtual PoolVector<uint8_t> sample_get_data(RID p_sample) const=0; virtual void sample_set_mix_rate(RID p_sample,int p_rate)=0; virtual int sample_get_mix_rate(RID p_sample) const=0; diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp index 304bcf8f7b..c853dcff35 100644 --- a/servers/physics/shape_sw.cpp +++ b/servers/physics/shape_sw.cpp @@ -971,10 +971,10 @@ FaceShapeSW::FaceShapeSW() { -DVector<Vector3> ConcavePolygonShapeSW::get_faces() const { +PoolVector<Vector3> ConcavePolygonShapeSW::get_faces() const { - DVector<Vector3> rfaces; + PoolVector<Vector3> rfaces; rfaces.resize(faces.size()*3); for(int i=0;i<faces.size();i++) { @@ -998,7 +998,7 @@ void ConcavePolygonShapeSW::project_range(const Vector3& p_normal, const Transfo r_max=0; return; } - DVector<Vector3>::Read r=vertices.read(); + PoolVector<Vector3>::Read r=vertices.read(); const Vector3 *vptr=r.ptr(); for (int i=0;i<count;i++) { @@ -1020,7 +1020,7 @@ Vector3 ConcavePolygonShapeSW::get_support(const Vector3& p_normal) const { if (count==0) return Vector3(); - DVector<Vector3>::Read r=vertices.read(); + PoolVector<Vector3>::Read r=vertices.read(); const Vector3 *vptr=r.ptr(); Vector3 n=p_normal; @@ -1111,9 +1111,9 @@ bool ConcavePolygonShapeSW::intersect_segment(const Vector3& p_begin,const Vecto return false; // unlock data - DVector<Face>::Read fr=faces.read(); - DVector<Vector3>::Read vr=vertices.read(); - DVector<BVH>::Read br=bvh.read(); + PoolVector<Face>::Read fr=faces.read(); + PoolVector<Vector3>::Read vr=vertices.read(); + PoolVector<BVH>::Read br=bvh.read(); _SegmentCullParams params; @@ -1184,9 +1184,9 @@ void ConcavePolygonShapeSW::cull(const AABB& p_local_aabb,Callback p_callback,vo AABB local_aabb=p_local_aabb; // unlock data - DVector<Face>::Read fr=faces.read(); - DVector<Vector3>::Read vr=vertices.read(); - DVector<BVH>::Read br=bvh.read(); + PoolVector<Face>::Read fr=faces.read(); + PoolVector<Vector3>::Read vr=vertices.read(); + PoolVector<BVH>::Read br=bvh.read(); FaceShapeSW face; // use this to send in the callback @@ -1347,7 +1347,7 @@ void ConcavePolygonShapeSW::_fill_bvh(_VolumeSW_BVH* p_bvh_tree,BVH* p_bvh_array } -void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) { +void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) { int src_face_count=p_faces.size(); if (src_face_count==0) { @@ -1357,7 +1357,7 @@ void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) { ERR_FAIL_COND(src_face_count%3); src_face_count/=3; - DVector<Vector3>::Read r = p_faces.read(); + PoolVector<Vector3>::Read r = p_faces.read(); const Vector3 * facesr= r.ptr(); #if 0 @@ -1399,7 +1399,7 @@ void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) { vertices.resize( point_map.size() ); - DVector<Vector3>::Write vw = vertices.write(); + PoolVector<Vector3>::Write vw = vertices.write(); Vector3 *verticesw=vw.ptr(); AABB _aabb; @@ -1418,7 +1418,7 @@ void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) { point_map.clear(); // not needed anymore faces.resize(face_list.size()); - DVector<Face>::Write w = faces.write(); + PoolVector<Face>::Write w = faces.write(); Face *facesw=w.ptr(); int fc=0; @@ -1431,10 +1431,10 @@ void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) { face_list.clear(); - DVector<_VolumeSW_BVH_Element> bvh_array; + PoolVector<_VolumeSW_BVH_Element> bvh_array; bvh_array.resize( fc ); - DVector<_VolumeSW_BVH_Element>::Write bvhw = bvh_array.write(); + PoolVector<_VolumeSW_BVH_Element>::Write bvhw = bvh_array.write(); _VolumeSW_BVH_Element *bvh_arrayw=bvhw.ptr(); @@ -1451,8 +1451,8 @@ void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) { } - w=DVector<Face>::Write(); - vw=DVector<Vector3>::Write(); + w=PoolVector<Face>::Write(); + vw=PoolVector<Vector3>::Write(); int count=0; @@ -1460,11 +1460,11 @@ void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) { ERR_FAIL_COND(count==0); - bvhw=DVector<_VolumeSW_BVH_Element>::Write(); + bvhw=PoolVector<_VolumeSW_BVH_Element>::Write(); bvh.resize( count+1 ); - DVector<BVH>::Write bvhw2 = bvh.write(); + PoolVector<BVH>::Write bvhw2 = bvh.write(); BVH*bvh_arrayw2=bvhw2.ptr(); int idx=0; @@ -1473,19 +1473,19 @@ void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) { set_aabb(_aabb); #else - DVector<_VolumeSW_BVH_Element> bvh_array; + PoolVector<_VolumeSW_BVH_Element> bvh_array; bvh_array.resize( src_face_count ); - DVector<_VolumeSW_BVH_Element>::Write bvhw = bvh_array.write(); + PoolVector<_VolumeSW_BVH_Element>::Write bvhw = bvh_array.write(); _VolumeSW_BVH_Element *bvh_arrayw=bvhw.ptr(); faces.resize(src_face_count); - DVector<Face>::Write w = faces.write(); + PoolVector<Face>::Write w = faces.write(); Face *facesw=w.ptr(); vertices.resize( src_face_count*3 ); - DVector<Vector3>::Write vw = vertices.write(); + PoolVector<Vector3>::Write vw = vertices.write(); Vector3 *verticesw=vw.ptr(); AABB _aabb; @@ -1512,15 +1512,15 @@ void ConcavePolygonShapeSW::_setup(DVector<Vector3> p_faces) { } - w=DVector<Face>::Write(); - vw=DVector<Vector3>::Write(); + w=PoolVector<Face>::Write(); + vw=PoolVector<Vector3>::Write(); int count=0; _VolumeSW_BVH *bvh_tree=_volume_sw_build_bvh(bvh_arrayw,src_face_count,count); bvh.resize( count+1 ); - DVector<BVH>::Write bvhw2 = bvh.write(); + PoolVector<BVH>::Write bvhw2 = bvh.write(); BVH*bvh_arrayw2=bvhw2.ptr(); int idx=0; @@ -1553,7 +1553,7 @@ ConcavePolygonShapeSW::ConcavePolygonShapeSW() { /* HEIGHT MAP SHAPE */ -DVector<float> HeightMapShapeSW::get_heights() const { +PoolVector<float> HeightMapShapeSW::get_heights() const { return heights; } @@ -1614,14 +1614,14 @@ Vector3 HeightMapShapeSW::get_moment_of_inertia(float p_mass) const { } -void HeightMapShapeSW::_setup(DVector<real_t> p_heights,int p_width,int p_depth,real_t p_cell_size) { +void HeightMapShapeSW::_setup(PoolVector<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; - DVector<real_t>::Read r = heights. read(); + PoolVector<real_t>::Read r = heights. read(); AABB aabb; @@ -1656,7 +1656,7 @@ void HeightMapShapeSW::set_data(const Variant& p_data) { int width=d["width"]; int depth=d["depth"]; float cell_size=d["cell_size"]; - DVector<float> heights=d["heights"]; + PoolVector<float> 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 d031a9fb9b..5916fd9881 100644 --- a/servers/physics/shape_sw.h +++ b/servers/physics/shape_sw.h @@ -279,8 +279,8 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW { int indices[3]; }; - DVector<Face> faces; - DVector<Vector3> vertices; + PoolVector<Face> faces; + PoolVector<Vector3> vertices; struct BVH { @@ -291,7 +291,7 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW { int face_index; }; - DVector<BVH> bvh; + PoolVector<BVH> bvh; struct _CullParams { @@ -326,10 +326,10 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW { void _fill_bvh(_VolumeSW_BVH* p_bvh_tree,BVH* p_bvh_array,int& p_idx); - void _setup(DVector<Vector3> p_faces); + void _setup(PoolVector<Vector3> p_faces); public: - DVector<Vector3> get_faces() const; + PoolVector<Vector3> get_faces() const; virtual PhysicsServer::ShapeType get_type() const { return PhysicsServer::SHAPE_CONCAVE_POLYGON; } @@ -352,7 +352,7 @@ public: struct HeightMapShapeSW : public ConcaveShapeSW { - DVector<real_t> heights; + PoolVector<real_t> heights; int width; int depth; float cell_size; @@ -360,10 +360,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(DVector<float> p_heights,int p_width,int p_depth,float p_cell_size); + void _setup(PoolVector<float> p_heights,int p_width,int p_depth,float p_cell_size); public: - DVector<real_t> get_heights() const; + PoolVector<real_t> get_heights() const; int get_width() const; int get_depth() const; float get_cell_size() const; diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp index 6506349ead..e9089e6173 100644 --- a/servers/physics_2d/shape_2d_sw.cpp +++ b/servers/physics_2d/shape_2d_sw.cpp @@ -693,11 +693,11 @@ void ConvexPolygonShape2DSW::set_data(const Variant& p_data) { point_count=0; if (p_data.get_type()==Variant::VECTOR2_ARRAY) { - DVector<Vector2> arr=p_data; + PoolVector<Vector2> arr=p_data; ERR_FAIL_COND(arr.size()==0); point_count=arr.size(); points = memnew_arr(Point,point_count); - DVector<Vector2>::Read r = arr.read(); + PoolVector<Vector2>::Read r = arr.read(); for(int i=0;i<point_count;i++) { points[i].pos=r[i]; @@ -711,12 +711,12 @@ void ConvexPolygonShape2DSW::set_data(const Variant& p_data) { } } else { - DVector<real_t> dvr = p_data; + PoolVector<real_t> dvr = p_data; point_count=dvr.size()/4; ERR_FAIL_COND(point_count==0); points = memnew_arr(Point,point_count); - DVector<real_t>::Read r = dvr.read(); + PoolVector<real_t>::Read r = dvr.read(); for(int i=0;i<point_count;i++) { @@ -741,7 +741,7 @@ void ConvexPolygonShape2DSW::set_data(const Variant& p_data) { Variant ConvexPolygonShape2DSW::get_data() const { - DVector<Vector2> dvr; + PoolVector<Vector2> dvr; dvr.resize(point_count); @@ -970,7 +970,7 @@ void ConcavePolygonShape2DSW::set_data(const Variant& p_data) { if (p_data.get_type()==Variant::VECTOR2_ARRAY) { - DVector<Vector2> p2arr = p_data; + PoolVector<Vector2> p2arr = p_data; int len = p2arr.size(); ERR_FAIL_COND(len%2); @@ -984,7 +984,7 @@ void ConcavePolygonShape2DSW::set_data(const Variant& p_data) { return; } - DVector<Vector2>::Read arr = p2arr.read(); + PoolVector<Vector2>::Read arr = p2arr.read(); Map<Point2,int> pointmap; for(int i=0;i<len;i+=2) { @@ -1046,17 +1046,17 @@ void ConcavePolygonShape2DSW::set_data(const Variant& p_data) { Variant ConcavePolygonShape2DSW::get_data() const { - DVector<Vector2> rsegments; + PoolVector<Vector2> rsegments; int len = segments.size(); rsegments.resize(len*2); - DVector<Vector2>::Write w = rsegments.write(); + PoolVector<Vector2>::Write w = rsegments.write(); 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=DVector<Vector2>::Write(); + w=PoolVector<Vector2>::Write(); return rsegments; } diff --git a/servers/spatial_sound_2d/spatial_sound_2d_server_sw.cpp b/servers/spatial_sound_2d/spatial_sound_2d_server_sw.cpp index 3ec19b60c1..a930daf729 100644 --- a/servers/spatial_sound_2d/spatial_sound_2d_server_sw.cpp +++ b/servers/spatial_sound_2d/spatial_sound_2d_server_sw.cpp @@ -181,7 +181,7 @@ RID SpatialSound2DServerSW::room_get_space(RID p_room) const { -void SpatialSound2DServerSW::room_set_bounds(RID p_room, const DVector<Point2>& p_bounds) { +void SpatialSound2DServerSW::room_set_bounds(RID p_room, const PoolVector<Point2>& p_bounds) { Room *room = room_owner.get(p_room); ERR_FAIL_COND(!room); @@ -198,9 +198,9 @@ void SpatialSound2DServerSW::room_set_bounds(RID p_room, const DVector<Point2>& // space->octree.move(room->octree_id,room->transform.xform(aabb)); } -DVector<Point2> SpatialSound2DServerSW::room_get_bounds(RID p_room) const { +PoolVector<Point2> SpatialSound2DServerSW::room_get_bounds(RID p_room) const { Room *room = room_owner.get(p_room); - ERR_FAIL_COND_V(!room,DVector<Point2>()); + ERR_FAIL_COND_V(!room,PoolVector<Point2>()); return room->bounds; } diff --git a/servers/spatial_sound_2d/spatial_sound_2d_server_sw.h b/servers/spatial_sound_2d/spatial_sound_2d_server_sw.h index a4e4b3a4a1..d6c09f50a8 100644 --- a/servers/spatial_sound_2d/spatial_sound_2d_server_sw.h +++ b/servers/spatial_sound_2d/spatial_sound_2d_server_sw.h @@ -82,7 +82,7 @@ class SpatialSound2DServerSW : public SpatialSound2DServer { RID space; Matrix32 transform; Matrix32 inverse_transform; - DVector<Point2> bounds; + PoolVector<Point2> bounds; RoomReverb reverb; float params[ROOM_PARAM_MAX]; bool override_other_sources; @@ -198,8 +198,8 @@ public: virtual void room_set_space(RID p_room,RID p_space); virtual RID room_get_space(RID p_room) const; - virtual void room_set_bounds(RID p_room, const DVector<Point2>& p_bounds); - virtual DVector<Point2> room_get_bounds(RID p_room) const; + virtual void room_set_bounds(RID p_room, const PoolVector<Point2>& p_bounds); + virtual PoolVector<Point2> room_get_bounds(RID p_room) const; virtual void room_set_transform(RID p_room, const Matrix32& p_transform); virtual Matrix32 room_get_transform(RID p_room) const; diff --git a/servers/spatial_sound_2d_server.h b/servers/spatial_sound_2d_server.h index b54368fec5..c19da87c04 100644 --- a/servers/spatial_sound_2d_server.h +++ b/servers/spatial_sound_2d_server.h @@ -57,8 +57,8 @@ public: virtual RID room_get_space(RID p_room) const=0; - virtual void room_set_bounds(RID p_room, const DVector<Point2>& p_bounds)=0; - virtual DVector<Point2> room_get_bounds(RID p_room) const=0; + virtual void room_set_bounds(RID p_room, const PoolVector<Point2>& p_bounds)=0; + virtual PoolVector<Point2> room_get_bounds(RID p_room) const=0; virtual void room_set_transform(RID p_room, const Matrix32& p_transform)=0; virtual Matrix32 room_get_transform(RID p_room) const=0; diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 27268dcabf..de570b7e4d 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -242,7 +242,7 @@ public: virtual RID mesh_create()=0; - virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const DVector<uint8_t>& p_array,int p_vertex_count,const DVector<uint8_t>& p_index_array,int p_index_count,const AABB& p_aabb,const Vector<DVector<uint8_t> >& p_blend_shapes=Vector<DVector<uint8_t> >(),const Vector<AABB>& p_bone_aabbs=Vector<AABB>())=0; + 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>())=0; virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount)=0; virtual int mesh_get_morph_target_count(RID p_mesh) const=0; @@ -257,15 +257,15 @@ public: virtual int mesh_surface_get_array_len(RID p_mesh, int p_surface) const=0; virtual int mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const=0; - virtual DVector<uint8_t> mesh_surface_get_array(RID p_mesh, int p_surface) const=0; - virtual DVector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const=0; + virtual PoolVector<uint8_t> mesh_surface_get_array(RID p_mesh, int p_surface) const=0; + virtual PoolVector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const=0; virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const=0; virtual VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const=0; virtual AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const=0; - virtual Vector<DVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const=0; + virtual Vector<PoolVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const=0; virtual Vector<AABB> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const=0; virtual void mesh_remove_surface(RID p_mesh,int p_index)=0; @@ -388,7 +388,7 @@ public: /* ROOM API */ virtual RID room_create()=0; - virtual void room_add_bounds(RID p_room, const DVector<Vector2>& p_convex_polygon,float p_height,const Transform& p_transform)=0; + virtual void room_add_bounds(RID p_room, const PoolVector<Vector2>& p_convex_polygon,float p_height,const Transform& p_transform)=0; virtual void room_clear_bounds(RID p_room)=0; /* PORTAL API */ @@ -421,8 +421,8 @@ public: virtual void gi_probe_set_to_cell_xform(RID p_probe,const Transform& p_xform)=0; virtual Transform gi_probe_get_to_cell_xform(RID p_probe) const=0; - virtual void gi_probe_set_dynamic_data(RID p_probe,const DVector<int>& p_data)=0; - virtual DVector<int> gi_probe_get_dynamic_data(RID p_probe) const=0; + virtual void gi_probe_set_dynamic_data(RID p_probe,const PoolVector<int>& p_data)=0; + virtual PoolVector<int> gi_probe_get_dynamic_data(RID p_probe) const=0; virtual void gi_probe_set_dynamic_range(RID p_probe,int p_range)=0; virtual int gi_probe_get_dynamic_range(RID p_probe) const=0; @@ -467,7 +467,7 @@ public: virtual void particles_set_emission_shape(RID p_particles,VS::ParticlesEmissionShape p_shape)=0; virtual void particles_set_emission_sphere_radius(RID p_particles,float p_radius)=0; virtual void particles_set_emission_box_extents(RID p_particles,const Vector3& p_extents)=0; - virtual void particles_set_emission_points(RID p_particles,const DVector<Vector3>& p_points)=0; + virtual void particles_set_emission_points(RID p_particles,const PoolVector<Vector3>& p_points)=0; virtual void particles_set_draw_order(RID p_particles,VS::ParticlesDrawOrder p_order)=0; @@ -506,7 +506,7 @@ public: /* LIGHT SHADOW MAPPING */ virtual RID canvas_light_occluder_create()=0; - virtual void canvas_light_occluder_set_polylines(RID p_occluder, const DVector<Vector2>& p_lines)=0; + virtual void canvas_light_occluder_set_polylines(RID p_occluder, const PoolVector<Vector2>& p_lines)=0; virtual VS::InstanceType get_base_type(RID p_rid) const=0; @@ -1275,8 +1275,8 @@ public: virtual void particles_set_emission_base_velocity(RID p_particles, const Vector3& p_base_velocity)=0; virtual Vector3 particles_get_emission_base_velocity(RID p_particles) const=0; - virtual void particles_set_emission_points(RID p_particles, const DVector<Vector3>& p_points)=0; - virtual DVector<Vector3> particles_get_emission_points(RID p_particles) const=0; + virtual void particles_set_emission_points(RID p_particles, const PoolVector<Vector3>& p_points)=0; + virtual PoolVector<Vector3> particles_get_emission_points(RID p_particles) const=0; virtual void particles_set_gravity_normal(RID p_particles, const Vector3& p_normal)=0; virtual Vector3 particles_get_gravity_normal(RID p_particles) const=0; @@ -1876,7 +1876,7 @@ public: /* LIGHT SHADOW MAPPING */ virtual RID canvas_light_occluder_create()=0; - virtual void canvas_light_occluder_set_polylines(RID p_occluder, const DVector<Vector2>& p_lines)=0; + virtual void canvas_light_occluder_set_polylines(RID p_occluder, const PoolVector<Vector2>& p_lines)=0; virtual RID canvas_light_shadow_buffer_create(int p_width)=0; diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp index f70ce46a3d..8e6345960f 100644 --- a/servers/visual/visual_server_canvas.cpp +++ b/servers/visual/visual_server_canvas.cpp @@ -1058,20 +1058,20 @@ RID VisualServerCanvas::canvas_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 DVector<Vector2>& p_shape,bool p_closed) { +void VisualServerCanvas::canvas_occluder_polygon_set_shape(RID p_occluder_polygon,const PoolVector<Vector2>& p_shape,bool p_closed) { if (p_shape.size()<3) { canvas_occluder_polygon_set_shape_as_lines(p_occluder_polygon,p_shape); return; } - DVector<Vector2> lines; + PoolVector<Vector2> lines; int lc = p_shape.size()*2; lines.resize(lc-(p_closed?0:2)); { - DVector<Vector2>::Write w = lines.write(); - DVector<Vector2>::Read r = p_shape.read(); + PoolVector<Vector2>::Write w = lines.write(); + PoolVector<Vector2>::Read r = p_shape.read(); int max=lc/2; if (!p_closed) { @@ -1089,7 +1089,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 DVector<Vector2>& p_shape) { +void VisualServerCanvas::canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon,const PoolVector<Vector2>& p_shape) { LightOccluderPolygon * occluder_poly = canvas_light_occluder_polygon_owner.get(p_occluder_polygon); ERR_FAIL_COND(!occluder_poly); @@ -1098,7 +1098,7 @@ void VisualServerCanvas::canvas_occluder_polygon_set_shape_as_lines(RID p_occlud int lc = p_shape.size(); occluder_poly->aabb=Rect2(); { - DVector<Vector2>::Read r = p_shape.read(); + PoolVector<Vector2>::Read r = p_shape.read(); for(int i=0;i<lc;i++) { if (i==0) occluder_poly->aabb.pos=r[i]; diff --git a/servers/visual/visual_server_canvas.h b/servers/visual/visual_server_canvas.h index e1edc47f9f..4a5091e754 100644 --- a/servers/visual/visual_server_canvas.h +++ b/servers/visual/visual_server_canvas.h @@ -201,8 +201,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 DVector<Vector2>& p_shape,bool p_closed); - void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon,const DVector<Vector2>& p_shape); + 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_cull_mode(RID p_occluder_polygon,VS::CanvasOccluderPolygonCullMode p_mode); diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 58cfab3b97..3262479c43 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -819,13 +819,13 @@ Vector3 VisualServerRaster::particles_get_emission_base_velocity(RID p_particles return rasterizer->particles_get_emission_base_velocity(p_particles); } -void VisualServerRaster::particles_set_emission_points(RID p_particles, const DVector<Vector3>& p_points) { +void VisualServerRaster::particles_set_emission_points(RID p_particles, const PoolVector<Vector3>& p_points) { VS_CHANGED; rasterizer->particles_set_emission_points(p_particles,p_points); } -DVector<Vector3> VisualServerRaster::particles_get_emission_points(RID p_particles) const { +PoolVector<Vector3> VisualServerRaster::particles_get_emission_points(RID p_particles) const { return rasterizer->particles_get_emission_points(p_particles); } @@ -1279,7 +1279,7 @@ float VisualServerRaster::baked_light_get_lightmap_multiplier(RID p_baked_light) } -void VisualServerRaster::baked_light_set_octree(RID p_baked_light,const DVector<uint8_t> p_octree){ +void VisualServerRaster::baked_light_set_octree(RID p_baked_light,const PoolVector<uint8_t> p_octree){ VS_CHANGED; BakedLight *baked_light = baked_light_owner.get(p_baked_light); @@ -1301,7 +1301,7 @@ void VisualServerRaster::baked_light_set_octree(RID p_baked_light,const DVector< bool has_light_tex=false; { - DVector<uint8_t>::Read r=p_octree.read(); + PoolVector<uint8_t>::Read r=p_octree.read(); tex_w = decode_uint32(&r[0]); tex_h = decode_uint32(&r[4]); print_line("TEX W: "+itos(tex_w)+" TEX H:"+itos(tex_h)+" LEN: "+itos(p_octree.size())); @@ -1386,22 +1386,22 @@ void VisualServerRaster::baked_light_set_octree(RID p_baked_light,const DVector< } -DVector<uint8_t> VisualServerRaster::baked_light_get_octree(RID p_baked_light) const{ +PoolVector<uint8_t> VisualServerRaster::baked_light_get_octree(RID p_baked_light) const{ BakedLight *baked_light = baked_light_owner.get(p_baked_light); - ERR_FAIL_COND_V(!baked_light,DVector<uint8_t>()); + ERR_FAIL_COND_V(!baked_light,PoolVector<uint8_t>()); if (rasterizer->is_texture(baked_light->data.octree_texture)) { Image img = rasterizer->texture_get_data(baked_light->data.octree_texture); return img.get_data(); } else { - return DVector<uint8_t>(); + return PoolVector<uint8_t>(); } } -void VisualServerRaster::baked_light_set_light(RID p_baked_light,const DVector<uint8_t> p_light) { +void VisualServerRaster::baked_light_set_light(RID p_baked_light,const PoolVector<uint8_t> p_light) { VS_CHANGED; BakedLight *baked_light = baked_light_owner.get(p_baked_light); @@ -1425,23 +1425,23 @@ void VisualServerRaster::baked_light_set_light(RID p_baked_light,const DVector<u } -DVector<uint8_t> VisualServerRaster::baked_light_get_light(RID p_baked_light) const{ +PoolVector<uint8_t> VisualServerRaster::baked_light_get_light(RID p_baked_light) const{ BakedLight *baked_light = baked_light_owner.get(p_baked_light); - ERR_FAIL_COND_V(!baked_light,DVector<uint8_t>()); + ERR_FAIL_COND_V(!baked_light,PoolVector<uint8_t>()); if (rasterizer->is_texture(baked_light->data.light_texture)) { Image img = rasterizer->texture_get_data(baked_light->data.light_texture); return img.get_data(); } else { - return DVector<uint8_t>(); + return PoolVector<uint8_t>(); } } -void VisualServerRaster::baked_light_set_sampler_octree(RID p_baked_light, const DVector<int> &p_sampler) { +void VisualServerRaster::baked_light_set_sampler_octree(RID p_baked_light, const PoolVector<int> &p_sampler) { BakedLight *baked_light = baked_light_owner.get(p_baked_light); ERR_FAIL_COND(!baked_light); @@ -1452,10 +1452,10 @@ void VisualServerRaster::baked_light_set_sampler_octree(RID p_baked_light, const } -DVector<int> VisualServerRaster::baked_light_get_sampler_octree(RID p_baked_light) const { +PoolVector<int> VisualServerRaster::baked_light_get_sampler_octree(RID p_baked_light) const { BakedLight *baked_light = baked_light_owner.get(p_baked_light); - ERR_FAIL_COND_V(!baked_light,DVector<int>()); + ERR_FAIL_COND_V(!baked_light,PoolVector<int>()); return baked_light->sampler; @@ -4466,20 +4466,20 @@ RID VisualServerRaster::canvas_occluder_polygon_create() { } -void VisualServerRaster::canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const DVector<Vector2>& p_shape, bool p_close){ +void VisualServerRaster::canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const PoolVector<Vector2>& p_shape, bool p_close){ if (p_shape.size()<3) { canvas_occluder_polygon_set_shape_as_lines(p_occluder_polygon,p_shape); return; } - DVector<Vector2> lines; + PoolVector<Vector2> lines; int lc = p_shape.size()*2; lines.resize(lc-(p_close?0:2)); { - DVector<Vector2>::Write w = lines.write(); - DVector<Vector2>::Read r = p_shape.read(); + PoolVector<Vector2>::Write w = lines.write(); + PoolVector<Vector2>::Read r = p_shape.read(); int max=lc/2; if (!p_close) { @@ -4498,7 +4498,7 @@ void VisualServerRaster::canvas_occluder_polygon_set_shape(RID p_occluder_polygo canvas_occluder_polygon_set_shape_as_lines(p_occluder_polygon,lines); } -void VisualServerRaster::canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon,const DVector<Vector2>& p_shape) { +void VisualServerRaster::canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon,const PoolVector<Vector2>& p_shape) { CanvasLightOccluderPolygon * occluder_poly = canvas_light_occluder_polygon_owner.get(p_occluder_polygon); ERR_FAIL_COND(!occluder_poly); @@ -4507,7 +4507,7 @@ void VisualServerRaster::canvas_occluder_polygon_set_shape_as_lines(RID p_occlud int lc = p_shape.size(); occluder_poly->aabb=Rect2(); { - DVector<Vector2>::Read r = p_shape.read(); + PoolVector<Vector2>::Read r = p_shape.read(); for(int i=0;i<lc;i++) { if (i==0) occluder_poly->aabb.pos=r[i]; @@ -6338,7 +6338,7 @@ void VisualServerRaster::_process_sampled_light(const Transform& p_camera,Instan AABB sample_aabb= bl->data.transform.affine_inverse().xform(AABB(Vector3(-r,-r,-r)+p_sampled_light->data.transform.origin,Vector3(r*2,r*2,r*2))); //ok got octree local AABB - DVector<int>::Read rp = bl->baked_light_info->baked_light->sampler.read(); + PoolVector<int>::Read rp = bl->baked_light_info->baked_light->sampler.read(); const int *rptr = rp.ptr(); int first = rptr[1]; diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 0f75d7ab8b..5fb71aa0f5 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -103,7 +103,7 @@ class VisualServerRaster : public VisualServer { struct BakedLight { Rasterizer::BakedLightData data; - DVector<int> sampler; + PoolVector<int> sampler; AABB octree_aabb; Size2i octree_tex_size; Size2i light_tex_size; @@ -671,7 +671,7 @@ public: BIND0R(RID,mesh_create) - BIND10(mesh_add_surface,RID,uint32_t,PrimitiveType,const DVector<uint8_t>&,int ,const DVector<uint8_t>& ,int ,const AABB&,const Vector<DVector<uint8_t> >&,const Vector<AABB>& ) + BIND10(mesh_add_surface,RID,uint32_t,PrimitiveType,const PoolVector<uint8_t>&,int ,const PoolVector<uint8_t>& ,int ,const AABB&,const Vector<PoolVector<uint8_t> >&,const Vector<AABB>& ) BIND2(mesh_set_morph_target_count,RID,int) BIND1RC(int,mesh_get_morph_target_count,RID) @@ -686,14 +686,14 @@ public: BIND2RC(int,mesh_surface_get_array_len,RID,int) BIND2RC(int,mesh_surface_get_array_index_len,RID,int) - BIND2RC(DVector<uint8_t>,mesh_surface_get_array,RID,int) - BIND2RC(DVector<uint8_t>,mesh_surface_get_index_array,RID, int) + BIND2RC(PoolVector<uint8_t>,mesh_surface_get_array,RID,int) + BIND2RC(PoolVector<uint8_t>,mesh_surface_get_index_array,RID, int) BIND2RC(uint32_t,mesh_surface_get_format,RID,int) BIND2RC(PrimitiveType,mesh_surface_get_primitive_type,RID,int) BIND2RC(AABB,mesh_surface_get_aabb,RID,int) - BIND2RC(Vector<DVector<uint8_t> >,mesh_surface_get_blend_shapes,RID,int) + BIND2RC(Vector<PoolVector<uint8_t> >,mesh_surface_get_blend_shapes,RID,int) BIND2RC(Vector<AABB>,mesh_surface_get_skeleton_aabb,RID,int) BIND2(mesh_remove_surface,RID,int) @@ -791,7 +791,7 @@ public: /* ROOM API */ BIND0R(RID,room_create) - BIND4(room_add_bounds,RID, const DVector<Vector2>& ,float ,const Transform& ) + BIND4(room_add_bounds,RID, const PoolVector<Vector2>& ,float ,const Transform& ) BIND1(room_clear_bounds,RID) /* PORTAL API */ @@ -830,8 +830,8 @@ public: BIND2(gi_probe_set_compress,RID,bool) BIND1RC(bool,gi_probe_is_compressed,RID) - BIND2(gi_probe_set_dynamic_data,RID,const DVector<int>& ) - BIND1RC( DVector<int>,gi_probe_get_dynamic_data,RID) + BIND2(gi_probe_set_dynamic_data,RID,const PoolVector<int>& ) + BIND1RC( PoolVector<int>,gi_probe_get_dynamic_data,RID) /* PARTICLES */ @@ -851,7 +851,7 @@ public: BIND2(particles_set_emission_shape,RID,VS::ParticlesEmissionShape ) BIND2(particles_set_emission_sphere_radius,RID,float ) BIND2(particles_set_emission_box_extents,RID,const Vector3& ) - BIND2(particles_set_emission_points,RID,const DVector<Vector3>& ) + BIND2(particles_set_emission_points,RID,const PoolVector<Vector3>& ) BIND2(particles_set_draw_order,RID,VS::ParticlesDrawOrder ) @@ -1088,8 +1088,8 @@ public: BIND0R(RID,canvas_occluder_polygon_create) - BIND3(canvas_occluder_polygon_set_shape,RID,const DVector<Vector2>& ,bool) - BIND2(canvas_occluder_polygon_set_shape_as_lines,RID ,const DVector<Vector2>&) + BIND3(canvas_occluder_polygon_set_shape,RID,const PoolVector<Vector2>& ,bool) + BIND2(canvas_occluder_polygon_set_shape_as_lines,RID ,const PoolVector<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 816d423034..0f789d9695 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -2423,14 +2423,14 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { if (probe->dynamic.light_data.size()==0) return; //using dynamic data - DVector<int>::Read r=probe->dynamic.light_data.read(); + PoolVector<int>::Read r=probe->dynamic.light_data.read(); const GIProbeDataHeader *header = (GIProbeDataHeader *)r.ptr(); probe->dynamic.local_data.resize(header->cell_count); int cell_count = probe->dynamic.local_data.size(); - DVector<InstanceGIProbeData::LocalData>::Write ldw = probe->dynamic.local_data.write(); + PoolVector<InstanceGIProbeData::LocalData>::Write ldw = probe->dynamic.local_data.write(); const GIProbeDataCell *cells = (GIProbeDataCell*)&r[16]; probe->dynamic.level_cell_lists.resize(header->cell_subdiv); @@ -2466,13 +2466,13 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { uint32_t z = header->depth >> i; //create and clear mipmap - DVector<uint8_t> mipmap; + PoolVector<uint8_t> mipmap; int size = x*y*z*4; size/=size_divisor; mipmap.resize(size); - DVector<uint8_t>::Write w = mipmap.write(); + PoolVector<uint8_t>::Write w = mipmap.write(); zeromem(w.ptr(),size); - w = DVector<uint8_t>::Write(); + w = PoolVector<uint8_t>::Write(); probe->dynamic.mipmaps_3d.push_back(mipmap); @@ -2547,7 +2547,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { for(int i=0;i<mipmap_count;i++) { print_line("S3TC level: "+itos(i)+" blocks: "+itos(comp_blocks[i].size())); probe->dynamic.mipmaps_s3tc[i].resize(comp_blocks[i].size()); - DVector<InstanceGIProbeData::CompBlockS3TC>::Write w = probe->dynamic.mipmaps_s3tc[i].write(); + PoolVector<InstanceGIProbeData::CompBlockS3TC>::Write w = probe->dynamic.mipmaps_s3tc[i].write(); int block_idx=0; for (Map<uint32_t,InstanceGIProbeData::CompBlockS3TC>::Element *E=comp_blocks[i].front();E;E=E->next()) { @@ -2979,7 +2979,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { InstanceGIProbeData * probe_data = static_cast<InstanceGIProbeData*>(p_gi_probe->base_data); - DVector<int>::Read r=probe_data->dynamic.light_data.read(); + PoolVector<int>::Read r=probe_data->dynamic.light_data.read(); const GIProbeDataHeader *header = (const GIProbeDataHeader *)r.ptr(); const GIProbeDataCell *cells = (const GIProbeDataCell*)&r[16]; @@ -2987,7 +2987,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { int leaf_count = probe_data->dynamic.level_cell_lists[ header->cell_subdiv -1 ].size(); const uint32_t *leaves = probe_data->dynamic.level_cell_lists[ header->cell_subdiv -1 ].ptr(); - DVector<InstanceGIProbeData::LocalData>::Write ldw = probe_data->dynamic.local_data.write(); + PoolVector<InstanceGIProbeData::LocalData>::Write ldw = probe_data->dynamic.local_data.write(); InstanceGIProbeData::LocalData *local_data = ldw.ptr(); @@ -3039,7 +3039,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { int level_cell_count = probe_data->dynamic.level_cell_lists[ i ].size(); const uint32_t *level_cells = probe_data->dynamic.level_cell_lists[ i ].ptr(); - DVector<uint8_t>::Write lw = probe_data->dynamic.mipmaps_3d[stage].write(); + PoolVector<uint8_t>::Write lw = probe_data->dynamic.mipmaps_3d[stage].write(); uint8_t *mipmapw = lw.ptr(); uint32_t sizes[3]={header->width>>stage,header->height>>stage,header->depth>>stage}; @@ -3071,9 +3071,9 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { for(int mmi=0;mmi<mipmap_count;mmi++) { - DVector<uint8_t>::Write mmw = probe_data->dynamic.mipmaps_3d[mmi].write(); + PoolVector<uint8_t>::Write mmw = probe_data->dynamic.mipmaps_3d[mmi].write(); int block_count = probe_data->dynamic.mipmaps_s3tc[mmi].size(); - DVector<InstanceGIProbeData::CompBlockS3TC>::Read mmr = probe_data->dynamic.mipmaps_s3tc[mmi].read(); + PoolVector<InstanceGIProbeData::CompBlockS3TC>::Read mmr = probe_data->dynamic.mipmaps_s3tc[mmi].read(); for(int i=0;i<block_count;i++) { @@ -3368,7 +3368,7 @@ void VisualServerScene::render_probes() { for(int i=0;i<(int)probe->dynamic.mipmaps_3d.size();i++) { int mmsize = probe->dynamic.mipmaps_3d[i].size(); - DVector<uint8_t>::Read r = probe->dynamic.mipmaps_3d[i].read(); + PoolVector<uint8_t>::Read r = probe->dynamic.mipmaps_3d[i].read(); VSG::storage->gi_probe_dynamic_data_update(probe->dynamic.probe_data,0,probe->dynamic.grid_size[2]>>i,i,r.ptr()); } diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index 300db1b41c..ac272467b4 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -45,7 +45,7 @@ public: struct BakedLight { Rasterizer::BakedLightData data; - DVector<int> sampler; + PoolVector<int> sampler; AABB octree_aabb; Size2i octree_tex_size; Size2i light_tex_size; @@ -433,16 +433,16 @@ public: Map<RID,LightCache> light_cache; Map<RID,LightCache> light_cache_changes; - DVector<int> light_data; - DVector<LocalData> local_data; + PoolVector<int> light_data; + PoolVector<LocalData> local_data; Vector<Vector<uint32_t> > level_cell_lists; RID probe_data; bool enabled; int bake_dynamic_range; RasterizerStorage::GIProbeCompression compression; - Vector< DVector<uint8_t> > mipmaps_3d; - Vector< DVector<CompBlockS3TC> > mipmaps_s3tc; //for s3tc + Vector< PoolVector<uint8_t> > mipmaps_3d; + Vector< PoolVector<CompBlockS3TC> > mipmaps_s3tc; //for s3tc int updating_stage; diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 3e6c30d6f5..9de17dc431 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -40,11 +40,11 @@ VisualServer *VisualServer::get_singleton() { -DVector<String> VisualServer::_shader_get_param_list(RID p_shader) const { +PoolVector<String> VisualServer::_shader_get_param_list(RID p_shader) const { //remove at some point - DVector<String> pl; + PoolVector<String> pl; #if 0 @@ -90,11 +90,11 @@ RID VisualServer::get_test_texture() { #define TEST_TEXTURE_SIZE 256 - DVector<uint8_t> test_data; + PoolVector<uint8_t> test_data; test_data.resize(TEST_TEXTURE_SIZE*TEST_TEXTURE_SIZE*3); { - DVector<uint8_t>::Write w=test_data.write(); + PoolVector<uint8_t>::Write w=test_data.write(); for (int x=0;x<TEST_TEXTURE_SIZE;x++) { @@ -150,10 +150,10 @@ void VisualServer::_free_internal_rids() { RID VisualServer::_make_test_cube() { - DVector<Vector3> vertices; - DVector<Vector3> normals; - DVector<float> tangents; - DVector<Vector3> uvs; + PoolVector<Vector3> vertices; + PoolVector<Vector3> normals; + PoolVector<float> tangents; + PoolVector<Vector3> uvs; int vtx_idx=0; #define ADD_VTX(m_idx);\ @@ -211,7 +211,7 @@ RID VisualServer::_make_test_cube() { d[VisualServer::ARRAY_TEX_UV]= uvs ; d[VisualServer::ARRAY_VERTEX]= vertices ; - DVector<int> indices; + PoolVector<int> indices; indices.resize(vertices.size()); for(int i=0;i<vertices.size();i++) indices.set(i,i); @@ -238,8 +238,8 @@ RID VisualServer::_make_test_cube() { RID VisualServer::make_sphere_mesh(int p_lats,int p_lons,float p_radius) { - DVector<Vector3> vertices; - DVector<Vector3> normals; + PoolVector<Vector3> vertices; + PoolVector<Vector3> normals; for(int i = 1; i <= p_lats; i++) { double lat0 = Math_PI * (-0.5 + (double) (i - 1) / p_lats); @@ -329,10 +329,10 @@ RID VisualServer::get_white_texture() { if (white_texture.is_valid()) return white_texture; - DVector<uint8_t> wt; + PoolVector<uint8_t> wt; wt.resize(16*3); { - DVector<uint8_t>::Write w =wt.write(); + PoolVector<uint8_t>::Write w =wt.write(); for(int i=0;i<16*3;i++) w[i]=255; } @@ -345,13 +345,16 @@ RID VisualServer::get_white_texture() { } -Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t *p_offsets,uint32_t p_stride,DVector<uint8_t> &r_vertex_array,int p_vertex_array_len,DVector<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,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) { - DVector<uint8_t>::Write vw = r_vertex_array.write(); + PoolVector<uint8_t>::Write vw = r_vertex_array.write(); - DVector<uint8_t>::Write iw; + PoolVector<uint8_t>::Write iw; if (r_index_array.size()) { + print_line("elements: "+itos(r_index_array.size())); + iw=r_index_array.write(); + } int max_bone=0; @@ -369,11 +372,11 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t if (p_format& VS::ARRAY_FLAG_USE_2D_VERTICES) { - DVector<Vector2> array = p_arrays[ai]; + PoolVector<Vector2> array = p_arrays[ai]; ERR_FAIL_COND_V( array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER ); - DVector<Vector2>::Read read = array.read(); + PoolVector<Vector2>::Read read = array.read(); const Vector2* src=read.ptr(); // setting vertices means regenerating the AABB @@ -421,11 +424,11 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t } else { - DVector<Vector3> array = p_arrays[ai]; + PoolVector<Vector3> array = p_arrays[ai]; ERR_FAIL_COND_V( array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER ); - DVector<Vector3>::Read read = array.read(); + PoolVector<Vector3>::Read read = array.read(); const Vector3* src=read.ptr(); // setting vertices means regenerating the AABB @@ -479,11 +482,11 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::VECTOR3_ARRAY, ERR_INVALID_PARAMETER ); - DVector<Vector3> array = p_arrays[ai]; + PoolVector<Vector3> array = p_arrays[ai]; ERR_FAIL_COND_V( array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER ); - DVector<Vector3>::Read read = array.read(); + PoolVector<Vector3>::Read read = array.read(); const Vector3* src=read.ptr(); // setting vertices means regenerating the AABB @@ -519,12 +522,12 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::REAL_ARRAY, ERR_INVALID_PARAMETER ); - DVector<real_t> array = p_arrays[ai]; + PoolVector<real_t> array = p_arrays[ai]; ERR_FAIL_COND_V( array.size() != p_vertex_array_len*4, ERR_INVALID_PARAMETER ); - DVector<real_t>::Read read = array.read(); + PoolVector<real_t>::Read read = array.read(); const real_t* src = read.ptr(); if (p_format&ARRAY_COMPRESS_TANGENT) { @@ -564,12 +567,12 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::COLOR_ARRAY, ERR_INVALID_PARAMETER ); - DVector<Color> array = p_arrays[ai]; + PoolVector<Color> array = p_arrays[ai]; ERR_FAIL_COND_V( array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER ); - DVector<Color>::Read read = array.read(); + PoolVector<Color>::Read read = array.read(); const Color* src = read.ptr(); if (p_format&ARRAY_COMPRESS_COLOR) { @@ -603,11 +606,11 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::VECTOR2_ARRAY, ERR_INVALID_PARAMETER ); - DVector<Vector2> array = p_arrays[ai]; + PoolVector<Vector2> array = p_arrays[ai]; ERR_FAIL_COND_V( array.size() != p_vertex_array_len , ERR_INVALID_PARAMETER); - DVector<Vector2>::Read read = array.read(); + PoolVector<Vector2>::Read read = array.read(); const Vector2 * src=read.ptr(); @@ -639,11 +642,11 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::VECTOR2_ARRAY, ERR_INVALID_PARAMETER ); - DVector<Vector2> array = p_arrays[ai]; + PoolVector<Vector2> array = p_arrays[ai]; ERR_FAIL_COND_V( array.size() != p_vertex_array_len , ERR_INVALID_PARAMETER); - DVector<Vector2>::Read read = array.read(); + PoolVector<Vector2>::Read read = array.read(); const Vector2 * src=read.ptr(); @@ -671,12 +674,12 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::REAL_ARRAY, ERR_INVALID_PARAMETER ); - DVector<real_t> array = p_arrays[ai]; + PoolVector<real_t> array = p_arrays[ai]; ERR_FAIL_COND_V( array.size() != p_vertex_array_len*VS::ARRAY_WEIGHTS_SIZE, ERR_INVALID_PARAMETER ); - DVector<real_t>::Read read = array.read(); + PoolVector<real_t>::Read read = array.read(); const real_t * src = read.ptr(); @@ -711,12 +714,12 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::INT_ARRAY, ERR_INVALID_PARAMETER ); - DVector<int> array = p_arrays[ai]; + PoolVector<int> array = p_arrays[ai]; ERR_FAIL_COND_V( array.size() != p_vertex_array_len*VS::ARRAY_WEIGHTS_SIZE, ERR_INVALID_PARAMETER ); - DVector<int>::Read read = array.read(); + PoolVector<int>::Read read = array.read(); const int * src = read.ptr(); @@ -761,13 +764,13 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t ERR_FAIL_COND_V( p_index_array_len<=0, ERR_INVALID_DATA ); ERR_FAIL_COND_V( p_arrays[ai].get_type() != Variant::INT_ARRAY, ERR_INVALID_PARAMETER ); - DVector<int> indices = p_arrays[ai]; + PoolVector<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 wether using 16 or 32 bits indices */ - DVector<int>::Read read = indices.read(); + PoolVector<int>::Read read = indices.read(); const int *src=read.ptr(); for (int i=0;i<p_index_array_len;i++) { @@ -805,18 +808,18 @@ Error VisualServer::_surface_set_data(Array p_arrays,uint32_t p_format,uint32_t } } - DVector<Vector3> vertices = p_arrays[VS::ARRAY_VERTEX]; - DVector<int> bones = p_arrays[VS::ARRAY_BONES]; - DVector<float> weights = p_arrays[VS::ARRAY_WEIGHTS]; + PoolVector<Vector3> vertices = p_arrays[VS::ARRAY_VERTEX]; + PoolVector<int> bones = p_arrays[VS::ARRAY_BONES]; + PoolVector<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(); - DVector<Vector3>::Read rv =vertices.read(); - DVector<int>::Read rb=bones.read(); - DVector<float>::Read rw=weights.read(); + PoolVector<Vector3>::Read rv =vertices.read(); + PoolVector<int>::Read rb=bones.read(); + PoolVector<float>::Read rw=weights.read(); AABB *bptr = r_bone_aabb.ptr(); @@ -875,11 +878,11 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primi Variant var = p_arrays[i]; switch(var.get_type()) { case Variant::VECTOR2_ARRAY: { - DVector<Vector2> v2 = var; + PoolVector<Vector2> v2 = var; array_len=v2.size(); } break; case Variant::VECTOR3_ARRAY: { - DVector<Vector3> v3 = var; + PoolVector<Vector3> v3 = var; array_len=v3.size(); } break; default: { @@ -1012,12 +1015,12 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primi } break; case VS::ARRAY_BONES: { - DVector<int> bones = p_arrays[VS::ARRAY_BONES]; + PoolVector<int> bones = p_arrays[VS::ARRAY_BONES]; int max_bone=0; { int bc = bones.size(); - DVector<int>::Read r=bones.read(); + PoolVector<int>::Read r=bones.read(); for(int j=0;j<bc;j++) { max_bone=MAX(r[j],max_bone); } @@ -1067,12 +1070,12 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primi int array_size = total_elem_size * array_len; - DVector<uint8_t> vertex_array; + PoolVector<uint8_t> vertex_array; vertex_array.resize(array_size); int index_array_size = offsets[VS::ARRAY_INDEX]*index_array_len; - DVector<uint8_t> index_array; + PoolVector<uint8_t> index_array; index_array.resize(index_array_size); AABB aabb; @@ -1085,13 +1088,13 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primi ERR_FAIL_COND(err!=OK); } - Vector<DVector<uint8_t> > blend_shape_data; + Vector<PoolVector<uint8_t> > blend_shape_data; for(int i=0;i<p_blend_shapes.size();i++) { - DVector<uint8_t> vertex_array_shape; + PoolVector<uint8_t> vertex_array_shape; vertex_array_shape.resize(array_size); - DVector<uint8_t> noindex; + PoolVector<uint8_t> noindex; AABB laabb; Error err = _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); @@ -1108,7 +1111,7 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primi } -Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p_vertex_data,int p_vertex_len,DVector<uint8_t> p_index_data,int p_index_len) const { +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 { uint32_t offsets[ARRAY_MAX]; @@ -1240,7 +1243,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p Array ret; ret.resize(VS::ARRAY_MAX); - DVector<uint8_t>::Read r = p_vertex_data.read(); + PoolVector<uint8_t>::Read r = p_vertex_data.read(); for(int i=0;i<VS::ARRAY_MAX;i++) { @@ -1255,12 +1258,12 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p if (p_format&ARRAY_FLAG_USE_2D_VERTICES) { - DVector<Vector2> arr_2d; + PoolVector<Vector2> arr_2d; arr_2d.resize(p_vertex_len); if (p_format&ARRAY_COMPRESS_VERTEX) { - DVector<Vector2>::Write w = arr_2d.write(); + PoolVector<Vector2>::Write w = arr_2d.write(); for(int j=0;j<p_vertex_len;j++) { @@ -1269,7 +1272,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p } } else { - DVector<Vector2>::Write w = arr_2d.write(); + PoolVector<Vector2>::Write w = arr_2d.write(); for(int j=0;j<p_vertex_len;j++) { @@ -1281,12 +1284,12 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p ret[i]=arr_2d; } else { - DVector<Vector3> arr_3d; + PoolVector<Vector3> arr_3d; arr_3d.resize(p_vertex_len); if (p_format&ARRAY_COMPRESS_VERTEX) { - DVector<Vector3>::Write w = arr_3d.write(); + PoolVector<Vector3>::Write w = arr_3d.write(); for(int j=0;j<p_vertex_len;j++) { @@ -1295,7 +1298,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p } } else { - DVector<Vector3>::Write w = arr_3d.write(); + PoolVector<Vector3>::Write w = arr_3d.write(); for(int j=0;j<p_vertex_len;j++) { @@ -1310,12 +1313,12 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p } break; case VS::ARRAY_NORMAL: { - DVector<Vector3> arr; + PoolVector<Vector3> arr; arr.resize(p_vertex_len); if (p_format&ARRAY_COMPRESS_NORMAL) { - DVector<Vector3>::Write w = arr.write(); + PoolVector<Vector3>::Write w = arr.write(); for(int j=0;j<p_vertex_len;j++) { @@ -1323,7 +1326,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p w[j]=Vector3( float(v[0]/255.0)*2.0-1.0, float(v[1]/255.0)*2.0-1.0, float(v[2]/255.0)*2.0-1.0 ); } } else { - DVector<Vector3>::Write w = arr.write(); + PoolVector<Vector3>::Write w = arr.write(); for(int j=0;j<p_vertex_len;j++) { @@ -1337,10 +1340,10 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p } break; case VS::ARRAY_TANGENT: { - DVector<float> arr; + PoolVector<float> arr; arr.resize(p_vertex_len*4); if (p_format&ARRAY_COMPRESS_TANGENT) { - DVector<float>::Write w = arr.write(); + PoolVector<float>::Write w = arr.write(); for(int j=0;j<p_vertex_len;j++) { @@ -1351,7 +1354,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p } } else { - DVector<float>::Write w = arr.write(); + PoolVector<float>::Write w = arr.write(); for(int j=0;j<p_vertex_len;j++) { const float *v = (const float*)&r[j*total_elem_size+offsets[i]]; @@ -1367,12 +1370,12 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p } break; case VS::ARRAY_COLOR: { - DVector<Color> arr; + PoolVector<Color> arr; arr.resize(p_vertex_len); if (p_format&ARRAY_COMPRESS_COLOR) { - DVector<Color>::Write w = arr.write(); + PoolVector<Color>::Write w = arr.write(); for(int j=0;j<p_vertex_len;j++) { @@ -1380,7 +1383,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p w[j]=Color( float(v[0]/255.0)*2.0-1.0, float(v[1]/255.0)*2.0-1.0, float(v[2]/255.0)*2.0-1.0, float(v[3]/255.0)*2.0-1.0 ); } } else { - DVector<Color>::Write w = arr.write(); + PoolVector<Color>::Write w = arr.write(); for(int j=0;j<p_vertex_len;j++) { @@ -1393,12 +1396,12 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p } break; case VS::ARRAY_TEX_UV: { - DVector<Vector2> arr; + PoolVector<Vector2> arr; arr.resize(p_vertex_len); if (p_format&ARRAY_COMPRESS_TEX_UV) { - DVector<Vector2>::Write w = arr.write(); + PoolVector<Vector2>::Write w = arr.write(); for(int j=0;j<p_vertex_len;j++) { @@ -1407,7 +1410,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p } } else { - DVector<Vector2>::Write w = arr.write(); + PoolVector<Vector2>::Write w = arr.write(); for(int j=0;j<p_vertex_len;j++) { @@ -1420,12 +1423,12 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p } break; case VS::ARRAY_TEX_UV2: { - DVector<Vector2> arr; + PoolVector<Vector2> arr; arr.resize(p_vertex_len); if (p_format&ARRAY_COMPRESS_TEX_UV2) { - DVector<Vector2>::Write w = arr.write(); + PoolVector<Vector2>::Write w = arr.write(); for(int j=0;j<p_vertex_len;j++) { @@ -1434,7 +1437,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p } } else { - DVector<Vector2>::Write w = arr.write(); + PoolVector<Vector2>::Write w = arr.write(); for(int j=0;j<p_vertex_len;j++) { @@ -1448,10 +1451,10 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p } break; case VS::ARRAY_WEIGHTS: { - DVector<float> arr; + PoolVector<float> arr; arr.resize(p_vertex_len*4); if (p_format&ARRAY_COMPRESS_WEIGHTS) { - DVector<float>::Write w = arr.write(); + PoolVector<float>::Write w = arr.write(); for(int j=0;j<p_vertex_len;j++) { @@ -1462,7 +1465,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p } } else { - DVector<float>::Write w = arr.write(); + PoolVector<float>::Write w = arr.write(); for(int j=0;j<p_vertex_len;j++) { const float *v = (const float*)&r[j*total_elem_size+offsets[i]]; @@ -1478,11 +1481,11 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p } break; case VS::ARRAY_BONES: { - DVector<int> arr; + PoolVector<int> arr; arr.resize(p_vertex_len*4); if (p_format&ARRAY_FLAG_USE_16_BIT_BONES) { - DVector<int>::Write w = arr.write(); + PoolVector<int>::Write w = arr.write(); for(int j=0;j<p_vertex_len;j++) { @@ -1493,7 +1496,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p } } else { - DVector<int>::Write w = arr.write(); + PoolVector<int>::Write w = arr.write(); for(int j=0;j<p_vertex_len;j++) { const uint8_t *v = (const uint8_t*)&r[j*total_elem_size+offsets[i]]; @@ -1510,13 +1513,13 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p case VS::ARRAY_INDEX: { /* determine wether using 16 or 32 bits indices */ - DVector<uint8_t>::Read ir = p_index_data.read(); + PoolVector<uint8_t>::Read ir = p_index_data.read(); - DVector<int> arr; + PoolVector<int> arr; arr.resize(p_index_len); if (p_vertex_len<(1<<16)) { - DVector<int>::Write w = arr.write(); + PoolVector<int>::Write w = arr.write(); for(int j=0;j<p_index_len;j++) { @@ -1525,7 +1528,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p } } else { - DVector<int>::Write w = arr.write(); + PoolVector<int>::Write w = arr.write(); for(int j=0;j<p_index_len;j++) { const int *v = (const int*)&ir[j*4]; @@ -1546,11 +1549,11 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format,DVector<uint8_t> p Array VisualServer::mesh_surface_get_arrays(RID p_mesh,int p_surface) const { - DVector<uint8_t> vertex_data = mesh_surface_get_array(p_mesh,p_surface); + PoolVector<uint8_t> vertex_data = mesh_surface_get_array(p_mesh,p_surface); ERR_FAIL_COND_V(vertex_data.size()==0,Array()); int vertex_len = mesh_surface_get_array_len(p_mesh,p_surface); - DVector<uint8_t> index_data = mesh_surface_get_index_array(p_mesh,p_surface); + PoolVector<uint8_t> index_data = mesh_surface_get_index_array(p_mesh,p_surface); int index_len = mesh_surface_get_array_index_len(p_mesh,p_surface); uint32_t format = mesh_surface_get_format(p_mesh,p_surface); @@ -1598,8 +1601,8 @@ void VisualServer::_camera_set_orthogonal(RID p_camera,float p_size,float p_z_ne void VisualServer::mesh_add_surface_from_mesh_data( RID p_mesh, const Geometry::MeshData& p_mesh_data) { #if 1 - DVector<Vector3> vertices; - DVector<Vector3> normals; + PoolVector<Vector3> vertices; + PoolVector<Vector3> normals; for (int i=0;i<p_mesh_data.faces.size();i++) { @@ -1626,7 +1629,7 @@ void VisualServer::mesh_add_surface_from_mesh_data( RID p_mesh, const Geometry:: #else - DVector<Vector3> vertices; + PoolVector<Vector3> vertices; @@ -1649,7 +1652,7 @@ void VisualServer::mesh_add_surface_from_mesh_data( RID p_mesh, const Geometry:: } -void VisualServer::mesh_add_surface_from_planes( RID p_mesh, const DVector<Plane>& p_planes) { +void VisualServer::mesh_add_surface_from_planes( RID p_mesh, const PoolVector<Plane>& p_planes) { Geometry::MeshData mdata = Geometry::build_convex_mesh(p_planes); diff --git a/servers/visual_server.h b/servers/visual_server.h index 16f14655df..d1a20dd6ba 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -48,10 +48,10 @@ class VisualServer : public Object { int mm_policy; - DVector<String> _shader_get_param_list(RID p_shader) const; + PoolVector<String> _shader_get_param_list(RID p_shader) const; 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,DVector<uint8_t> p_vertex_data,int p_vertex_len,DVector<uint8_t> p_index_data,int p_index_len) const; + 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; protected: RID _make_test_cube(); @@ -62,7 +62,7 @@ protected: RID material_2d[16]; - Error _surface_set_data(Array p_arrays,uint32_t p_format,uint32_t *p_offsets,uint32_t p_stride,DVector<uint8_t> &r_vertex_array,int p_vertex_array_len,DVector<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,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); static VisualServer* (*create_func)(); static void _bind_methods(); @@ -244,7 +244,7 @@ public: virtual void mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes=Array(),uint32_t p_compress_format=ARRAY_COMPRESS_DEFAULT); - virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,PrimitiveType p_primitive,const DVector<uint8_t>& p_array,int p_vertex_count,const DVector<uint8_t>& p_index_array,int p_index_count,const AABB& p_aabb,const Vector<DVector<uint8_t> >& p_blend_shapes=Vector<DVector<uint8_t> >(),const Vector<AABB>& p_bone_aabbs=Vector<AABB>())=0; + virtual void mesh_add_surface(RID p_mesh,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>())=0; virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount)=0; virtual int mesh_get_morph_target_count(RID p_mesh) const=0; @@ -263,8 +263,8 @@ public: virtual int mesh_surface_get_array_len(RID p_mesh, int p_surface) const=0; virtual int mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const=0; - virtual DVector<uint8_t> mesh_surface_get_array(RID p_mesh, int p_surface) const=0; - virtual DVector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const=0; + virtual PoolVector<uint8_t> mesh_surface_get_array(RID p_mesh, int p_surface) const=0; + virtual PoolVector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const=0; virtual Array mesh_surface_get_arrays(RID p_mesh,int p_surface) const; @@ -272,7 +272,7 @@ public: virtual PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const=0; virtual AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const=0; - virtual Vector<DVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const=0; + virtual Vector<PoolVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const=0; virtual Vector<AABB> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const=0; virtual void mesh_remove_surface(RID p_mesh,int p_index)=0; @@ -433,7 +433,7 @@ public: /* ROOM API */ virtual RID room_create()=0; - virtual void room_add_bounds(RID p_room, const DVector<Vector2>& p_convex_polygon,float p_height,const Transform& p_transform)=0; + virtual void room_add_bounds(RID p_room, const PoolVector<Vector2>& p_convex_polygon,float p_height,const Transform& p_transform)=0; virtual void room_clear_bounds(RID p_room)=0; /* PORTAL API */ @@ -460,8 +460,8 @@ public: virtual void gi_probe_set_to_cell_xform(RID p_probe,const Transform& p_xform)=0; virtual Transform gi_probe_get_to_cell_xform(RID p_probe) const=0; - virtual void gi_probe_set_dynamic_data(RID p_probe,const DVector<int>& p_data)=0; - virtual DVector<int> gi_probe_get_dynamic_data(RID p_probe) const=0; + virtual void gi_probe_set_dynamic_data(RID p_probe,const PoolVector<int>& p_data)=0; + virtual PoolVector<int> gi_probe_get_dynamic_data(RID p_probe) const=0; virtual void gi_probe_set_dynamic_range(RID p_probe,int p_range)=0; virtual int gi_probe_get_dynamic_range(RID p_probe) const=0; @@ -501,7 +501,7 @@ public: virtual void particles_set_emission_shape(RID p_particles,ParticlesEmissionShape)=0; virtual void particles_set_emission_sphere_radius(RID p_particles,float p_radius)=0; virtual void particles_set_emission_box_extents(RID p_particles,const Vector3& p_extents)=0; - virtual void particles_set_emission_points(RID p_particles,const DVector<Vector3>& p_points)=0; + virtual void particles_set_emission_points(RID p_particles,const PoolVector<Vector3>& p_points)=0; enum ParticlesDrawOrder { PARTICLES_DRAW_ORDER_INDEX, @@ -856,8 +856,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 DVector<Vector2>& p_shape,bool p_closed)=0; - virtual void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon,const DVector<Vector2>& p_shape)=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; enum CanvasOccluderPolygonCullMode { CANVAS_OCCLUDER_POLYGON_CULL_DISABLED, @@ -926,7 +926,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 DVector<Plane>& p_planes); + virtual void mesh_add_surface_from_planes( RID p_mesh, const PoolVector<Plane>& p_planes); virtual void set_boot_image(const Image& p_image, const Color& p_color,bool p_scale)=0; virtual void set_default_clear_color(const Color& p_color)=0; diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index dfdd14673c..07cb72a6b0 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -313,7 +313,7 @@ void EditorFileDialog::_action_pressed() { String fbase=dir_access->get_current_dir(); - DVector<String> files; + PoolVector<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) )); diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index 1245efafa1..c1be2cd940 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -2174,9 +2174,9 @@ bool EditorImportExport::sample_get_trim() const{ return sample_action_trim; } -DVector<String> EditorImportExport::_get_export_file_list() { +PoolVector<String> EditorImportExport::_get_export_file_list() { - DVector<String> fl; + PoolVector<String> fl; for (Map<StringName,FileAction>::Element *E=files.front();E;E=E->next()) { fl.push_back(E->key()); @@ -2185,9 +2185,9 @@ DVector<String> EditorImportExport::_get_export_file_list() { return fl; } -DVector<String> EditorImportExport::_get_export_platforms() { +PoolVector<String> EditorImportExport::_get_export_platforms() { - DVector<String> ep; + PoolVector<String> ep; for (Map<StringName,Ref<EditorExportPlatform> >::Element *E=exporters.front();E;E=E->next()) { ep.push_back(E->key()); diff --git a/tools/editor/editor_import_export.h b/tools/editor/editor_import_export.h index 9109e9ae9f..fb75373f17 100644 --- a/tools/editor/editor_import_export.h +++ b/tools/editor/editor_import_export.h @@ -321,8 +321,8 @@ protected: static EditorImportExport* singleton; - DVector<String> _get_export_file_list(); - DVector<String> _get_export_platforms(); + PoolVector<String> _get_export_file_list(); + PoolVector<String> _get_export_platforms(); static void _bind_methods(); public: diff --git a/tools/editor/editor_profiler.cpp b/tools/editor/editor_profiler.cpp index 5c7b7407b4..5a6de2fa1a 100644 --- a/tools/editor/editor_profiler.cpp +++ b/tools/editor/editor_profiler.cpp @@ -154,7 +154,7 @@ void EditorProfiler::_update_plot() { } - DVector<uint8_t>::Write wr = graph_image.write(); + PoolVector<uint8_t>::Write wr = graph_image.write(); @@ -336,7 +336,7 @@ void EditorProfiler::_update_plot() { } - wr = DVector<uint8_t>::Write(); + wr = PoolVector<uint8_t>::Write(); Image img(w,h,0,Image::FORMAT_RGBA8,graph_image); diff --git a/tools/editor/editor_profiler.h b/tools/editor/editor_profiler.h index 4e18f2e29a..233bc2e0fd 100644 --- a/tools/editor/editor_profiler.h +++ b/tools/editor/editor_profiler.h @@ -73,7 +73,7 @@ private: Button *activate; TextureFrame *graph; Ref<ImageTexture> graph_texture; - DVector<uint8_t> graph_image; + PoolVector<uint8_t> graph_image; Tree *variables; HSplitContainer *h_split; diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp index 2bc29039ea..861af59455 100644 --- a/tools/editor/io_plugins/editor_font_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp @@ -1380,10 +1380,10 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe int ow=font_data_list[i]->width; int oh=font_data_list[i]->height; - DVector<uint8_t> pixels; + PoolVector<uint8_t> pixels; pixels.resize(s.x*s.y*4); - DVector<uint8_t>::Write w = pixels.write(); + PoolVector<uint8_t>::Write w = pixels.write(); //print_line("val: "+itos(font_data_list[i]->valign)); for(int y=0;y<s.height;y++) { @@ -1512,7 +1512,7 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe } - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); Image img(s.width,s.height,0,Image::FORMAT_RGBA8,pixels); @@ -1552,10 +1552,10 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe if (from->has_option("advanced/premultiply_alpha") && bool(from->get_option("advanced/premultiply_alpha"))) { - DVector<uint8_t> data = atlas.get_data(); + PoolVector<uint8_t> data = atlas.get_data(); int dl = data.size(); { - DVector<uint8_t>::Write w = data.write(); + PoolVector<uint8_t>::Write w = data.write(); for(int i=0;i<dl;i+=4) { diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index c1830bf118..5720e15caa 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -485,15 +485,15 @@ Error ColladaImport::_create_material(const String& p_target) { } -static void _generate_normals(const DVector<int>& p_indices,const DVector<Vector3>& p_vertices,DVector<Vector3>&r_normals) { +static void _generate_normals(const PoolVector<int>& p_indices,const PoolVector<Vector3>& p_vertices,PoolVector<Vector3>&r_normals) { r_normals.resize(p_vertices.size()); - DVector<Vector3>::Write narrayw = r_normals.write(); + PoolVector<Vector3>::Write narrayw = r_normals.write(); int iacount=p_indices.size()/3; - DVector<int>::Read index_arrayr = p_indices.read(); - DVector<Vector3>::Read vertex_arrayr = p_vertices.read(); + PoolVector<int>::Read index_arrayr = p_indices.read(); + PoolVector<Vector3>::Read vertex_arrayr = p_vertices.read(); for(int idx=0;idx<iacount;idx++) { @@ -519,7 +519,7 @@ static void _generate_normals(const DVector<int>& p_indices,const DVector<Vector } -static void _generate_tangents_and_binormals(const DVector<int>& p_indices,const DVector<Vector3>& p_vertices,const DVector<Vector3>& p_uvs,const DVector<Vector3>& p_normals,DVector<real_t>&r_tangents) { +static void _generate_tangents_and_binormals(const PoolVector<int>& p_indices,const PoolVector<Vector3>& p_vertices,const PoolVector<Vector3>& p_uvs,const PoolVector<Vector3>& p_normals,PoolVector<real_t>&r_tangents) { int vlen=p_vertices.size(); @@ -531,10 +531,10 @@ static void _generate_tangents_and_binormals(const DVector<int>& p_indices,const int iacount=p_indices.size()/3; - DVector<int>::Read index_arrayr = p_indices.read(); - DVector<Vector3>::Read vertex_arrayr = p_vertices.read(); - DVector<Vector3>::Read narrayr = p_normals.read(); - DVector<Vector3>::Read uvarrayr = p_uvs.read(); + PoolVector<int>::Read index_arrayr = p_indices.read(); + PoolVector<Vector3>::Read vertex_arrayr = p_vertices.read(); + PoolVector<Vector3>::Read narrayr = p_normals.read(); + PoolVector<Vector3>::Read uvarrayr = p_uvs.read(); for(int idx=0;idx<iacount;idx++) { @@ -588,7 +588,7 @@ static void _generate_tangents_and_binormals(const DVector<int>& p_indices,const } r_tangents.resize(vlen*4); - DVector<real_t>::Write tarrayw = r_tangents.write(); + PoolVector<real_t>::Write tarrayw = r_tangents.write(); for(int idx=0;idx<vlen;idx++) { Vector3 tangent = tangents[idx]; @@ -1031,9 +1031,9 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con } - DVector<int> index_array; + PoolVector<int> index_array; index_array.resize(indices_list.size()); - DVector<int>::Write index_arrayw = index_array.write(); + PoolVector<int>::Write index_arrayw = index_array.write(); int iidx=0; for(List<int>::Element *F=indices_list.front();F;F=F->next()) { @@ -1041,7 +1041,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con index_arrayw[iidx++]=F->get(); } - index_arrayw=DVector<int>::Write(); + index_arrayw=PoolVector<int>::Write(); /*****************/ @@ -1075,14 +1075,14 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con - DVector<Vector3> final_vertex_array; - DVector<Vector3> final_normal_array; - DVector<float> final_tangent_array; - DVector<Color> final_color_array; - DVector<Vector3> final_uv_array; - DVector<Vector3> final_uv2_array; - DVector<int> final_bone_array; - DVector<float> final_weight_array; + PoolVector<Vector3> final_vertex_array; + PoolVector<Vector3> final_normal_array; + PoolVector<float> final_tangent_array; + PoolVector<Color> final_color_array; + PoolVector<Vector3> final_uv_array; + PoolVector<Vector3> final_uv2_array; + PoolVector<int> final_bone_array; + PoolVector<float> final_weight_array; uint32_t final_format=0; @@ -1117,61 +1117,61 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con int vlen = vertex_array.size(); { //vertices - DVector<Vector3> varray; + PoolVector<Vector3> varray; varray.resize(vertex_array.size()); - DVector<Vector3>::Write varrayw = varray.write(); + PoolVector<Vector3>::Write varrayw = varray.write(); for(int k=0;k<vlen;k++) varrayw[k]=vertex_array[k].vertex; - varrayw = DVector<Vector3>::Write(); + varrayw = PoolVector<Vector3>::Write(); final_vertex_array=varray; } if (uv_src) { //compute uv first, may be needed for computing tangent/bionrmal - DVector<Vector3> uvarray; + PoolVector<Vector3> uvarray; uvarray.resize(vertex_array.size()); - DVector<Vector3>::Write uvarrayw = uvarray.write(); + PoolVector<Vector3>::Write uvarrayw = uvarray.write(); for(int k=0;k<vlen;k++) { uvarrayw[k]=vertex_array[k].uv; } - uvarrayw = DVector<Vector3>::Write(); + uvarrayw = PoolVector<Vector3>::Write(); final_uv_array=uvarray; } if (uv2_src) { //compute uv first, may be needed for computing tangent/bionrmal - DVector<Vector3> uv2array; + PoolVector<Vector3> uv2array; uv2array.resize(vertex_array.size()); - DVector<Vector3>::Write uv2arrayw = uv2array.write(); + PoolVector<Vector3>::Write uv2arrayw = uv2array.write(); for(int k=0;k<vlen;k++) { uv2arrayw[k]=vertex_array[k].uv2; } - uv2arrayw = DVector<Vector3>::Write(); + uv2arrayw = PoolVector<Vector3>::Write(); final_uv2_array=uv2array; } if (normal_src) { - DVector<Vector3> narray; + PoolVector<Vector3> narray; narray.resize(vertex_array.size()); - DVector<Vector3>::Write narrayw = narray.write(); + PoolVector<Vector3>::Write narrayw = narray.write(); for(int k=0;k<vlen;k++) { narrayw[k]=vertex_array[k].normal; } - narrayw = DVector<Vector3>::Write(); + narrayw = PoolVector<Vector3>::Write(); final_normal_array=narray; - //DVector<Vector3> altnaray; + //PoolVector<Vector3> altnaray; //_generate_normals(index_array,final_vertex_array,altnaray); //for(int i=0;i<altnaray.size();i++) @@ -1189,9 +1189,9 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con if (final_normal_array.size() && uv_src && binormal_src && tangent_src && !force_make_tangents) { - DVector<real_t> tarray; + PoolVector<real_t> tarray; tarray.resize(vertex_array.size()*4); - DVector<real_t>::Write tarrayw = tarray.write(); + PoolVector<real_t>::Write tarrayw = tarray.write(); for(int k=0;k<vlen;k++) { @@ -1202,7 +1202,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con } - tarrayw = DVector<real_t>::Write(); + tarrayw = PoolVector<real_t>::Write(); final_tangent_array=tarray; } else if (final_normal_array.size() && primitive==Mesh::PRIMITIVE_TRIANGLES && final_uv_array.size() && (force_make_tangents || (material.is_valid()))){ @@ -1217,27 +1217,27 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con if (color_src) { - DVector<Color> colorarray; + PoolVector<Color> colorarray; colorarray.resize(vertex_array.size()); - DVector<Color>::Write colorarrayw = colorarray.write(); + PoolVector<Color>::Write colorarrayw = colorarray.write(); for(int k=0;k<vlen;k++) { colorarrayw[k]=vertex_array[k].color; } - colorarrayw = DVector<Color>::Write(); + colorarrayw = PoolVector<Color>::Write(); final_color_array=colorarray; } if (has_weights) { - DVector<float> weightarray; - DVector<int> bonearray; + PoolVector<float> weightarray; + PoolVector<int> bonearray; weightarray.resize(vertex_array.size()*4); - DVector<float>::Write weightarrayw = weightarray.write(); + PoolVector<float>::Write weightarrayw = weightarray.write(); bonearray.resize(vertex_array.size()*4); - DVector<int>::Write bonearrayw = bonearray.write(); + PoolVector<int>::Write bonearrayw = bonearray.write(); for(int k=0;k<vlen;k++) { float sum=0; @@ -1262,8 +1262,8 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con } - weightarrayw = DVector<float>::Write(); - bonearrayw = DVector<int>::Write(); + weightarrayw = PoolVector<float>::Write(); + bonearrayw = PoolVector<int>::Write(); final_weight_array = weightarray; final_bone_array = bonearray; @@ -1326,7 +1326,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con // morph anything but "POSITIONS" seem to exit. Because of this, normals and binormals/tangents have to be regenerated here, // which may result in inaccurate (but most of the time good enough) results. - DVector<Vector3> vertices; + PoolVector<Vector3> vertices; vertices.resize(vlen); ERR_FAIL_COND_V( md.vertices.size() != 1, ERR_INVALID_DATA); @@ -1345,7 +1345,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con //read vertices from morph target - DVector<Vector3>::Write vertw = vertices.write(); + PoolVector<Vector3>::Write vertw = vertices.write(); for(int m_i=0;m_i<m->array.size()/stride;m_i++) { @@ -1381,9 +1381,9 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con //vertices are in place, now generate everything else - vertw = DVector<Vector3>::Write(); - DVector<Vector3> normals; - DVector<float> tangents; + vertw = PoolVector<Vector3>::Write(); + PoolVector<Vector3> normals; + PoolVector<float> tangents; print_line("vertex source id: "+vertex_src_id); if(md.vertices[vertex_src_id].sources.has("NORMAL")){ //has normals @@ -1402,7 +1402,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con //read normals from morph target - DVector<Vector3>::Write vertw = normals.write(); + PoolVector<Vector3>::Write vertw = normals.write(); for(int m_i=0;m_i<m->array.size()/stride;m_i++) { diff --git a/tools/editor/io_plugins/editor_sample_import_plugin.cpp b/tools/editor/io_plugins/editor_sample_import_plugin.cpp index b776fdeec0..db405b1cd7 100644 --- a/tools/editor/io_plugins/editor_sample_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_sample_import_plugin.cpp @@ -443,8 +443,8 @@ Error EditorSampleImportPlugin::import(const String& p_path, const Ref<ResourceI data.resize(len*chans); { - DVector<uint8_t> src_data = smp->get_data(); - DVector<uint8_t>::Read sr = src_data.read(); + PoolVector<uint8_t> src_data = smp->get_data(); + PoolVector<uint8_t>::Read sr = src_data.read(); for(int i=0;i<len*chans;i++) { @@ -602,7 +602,7 @@ Error EditorSampleImportPlugin::import(const String& p_path, const Ref<ResourceI } - DVector<uint8_t> dst_data; + PoolVector<uint8_t> dst_data; Sample::Format dst_format; if ( compression == _EditorSampleImportOptions::COMPRESS_MODE_RAM) { @@ -629,8 +629,8 @@ Error EditorSampleImportPlugin::import(const String& p_path, const Ref<ResourceI right[i]=data[i*2+1]; } - DVector<uint8_t> bleft; - DVector<uint8_t> bright; + PoolVector<uint8_t> bleft; + PoolVector<uint8_t> bright; _compress_ima_adpcm(left,bleft); _compress_ima_adpcm(right,bright); @@ -638,9 +638,9 @@ Error EditorSampleImportPlugin::import(const String& p_path, const Ref<ResourceI int dl = bleft.size(); dst_data.resize( dl *2 ); - DVector<uint8_t>::Write w=dst_data.write(); - DVector<uint8_t>::Read rl=bleft.read(); - DVector<uint8_t>::Read rr=bright.read(); + PoolVector<uint8_t>::Write w=dst_data.write(); + PoolVector<uint8_t>::Read rl=bleft.read(); + PoolVector<uint8_t>::Read rr=bright.read(); for(int i=0;i<dl;i++) { w[i*2+0]=rl[i]; @@ -655,7 +655,7 @@ Error EditorSampleImportPlugin::import(const String& p_path, const Ref<ResourceI dst_format=is16?Sample::FORMAT_PCM16:Sample::FORMAT_PCM8; dst_data.resize( data.size() * (is16?2:1)); { - DVector<uint8_t>::Write w = dst_data.write(); + PoolVector<uint8_t>::Write w = dst_data.write(); int ds=data.size(); for(int i=0;i<ds;i++) { @@ -700,7 +700,7 @@ Error EditorSampleImportPlugin::import(const String& p_path, const Ref<ResourceI } -void EditorSampleImportPlugin::_compress_ima_adpcm(const Vector<float>& p_data,DVector<uint8_t>& dst_data) { +void EditorSampleImportPlugin::_compress_ima_adpcm(const Vector<float>& p_data,PoolVector<uint8_t>& dst_data) { /*p_sample_data->data = (void*)malloc(len); @@ -730,7 +730,7 @@ void EditorSampleImportPlugin::_compress_ima_adpcm(const Vector<float>& p_data,D datalen++; dst_data.resize(datalen/2+4); - DVector<uint8_t>::Write w = dst_data.write(); + PoolVector<uint8_t>::Write w = dst_data.write(); int i,step_idx=0,prev=0; diff --git a/tools/editor/io_plugins/editor_sample_import_plugin.h b/tools/editor/io_plugins/editor_sample_import_plugin.h index 915ca3883c..6d781756b2 100644 --- a/tools/editor/io_plugins/editor_sample_import_plugin.h +++ b/tools/editor/io_plugins/editor_sample_import_plugin.h @@ -40,7 +40,7 @@ class EditorSampleImportPlugin : public EditorImportPlugin { GDCLASS(EditorSampleImportPlugin,EditorImportPlugin); EditorSampleImportDialog *dialog; - void _compress_ima_adpcm(const Vector<float>& p_data,DVector<uint8_t>& dst_data); + void _compress_ima_adpcm(const Vector<float>& p_data,PoolVector<uint8_t>& dst_data); public: static EditorSampleImportPlugin *singleton; diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index c387e503e6..076750e59e 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -1897,7 +1897,7 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> return p_node; MeshInstance *mi = p_node->cast_to<MeshInstance>(); - DVector<Face3> faces = mi->get_faces(VisualInstance::FACES_SOLID); + PoolVector<Face3> faces = mi->get_faces(VisualInstance::FACES_SOLID); BSP_Tree bsptree(faces); @@ -1940,7 +1940,7 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> return p_node; MeshInstance *mi = p_node->cast_to<MeshInstance>(); - DVector<Face3> faces = mi->get_faces(VisualInstance::FACES_SOLID); + PoolVector<Face3> faces = mi->get_faces(VisualInstance::FACES_SOLID); ERR_FAIL_COND_V(faces.size()==0,NULL); //step 1 compute the plane diff --git a/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp b/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp index 1cb16843c5..e1b0719941 100644 --- a/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp +++ b/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp @@ -336,7 +336,7 @@ void EditorSceneImporterFBXConv::_add_surface(State& state,Ref<Mesh>& m,const Di int idx = m->get_surface_count(); Array array = state.surface_cache[id].array; - DVector<float> indices = array[Mesh::ARRAY_BONES]; + PoolVector<float> indices = array[Mesh::ARRAY_BONES]; if (indices.size() && part.has("bones")) { @@ -361,7 +361,7 @@ void EditorSceneImporterFBXConv::_add_surface(State& state,Ref<Mesh>& m,const Di int ilen=indices.size(); { - DVector<float>::Write iw=indices.write(); + PoolVector<float>::Write iw=indices.write(); for(int j=0;j<ilen;j++) { int b = iw[j]; ERR_CONTINUE(!index_map.has(b)); @@ -680,11 +680,11 @@ void EditorSceneImporterFBXConv::_parse_surfaces(State& state) { case Mesh::ARRAY_VERTEX: case Mesh::ARRAY_NORMAL: { - DVector<Vector3> vtx; + PoolVector<Vector3> vtx; vtx.resize(array.size()); { int len=array.size(); - DVector<Vector3>::Write w = vtx.write(); + PoolVector<Vector3>::Write w = vtx.write(); for(int l=0;l<len;l++) { int pos = array[l]; @@ -701,12 +701,12 @@ void EditorSceneImporterFBXConv::_parse_surfaces(State& state) { if (binormal_ofs<0) break; - DVector<float> tangents; + PoolVector<float> tangents; tangents.resize(array.size()*4); { int len=array.size(); - DVector<float>::Write w = tangents.write(); + PoolVector<float>::Write w = tangents.write(); for(int l=0;l<len;l++) { int pos = array[l]; @@ -736,11 +736,11 @@ void EditorSceneImporterFBXConv::_parse_surfaces(State& state) { } break; case Mesh::ARRAY_COLOR: { - DVector<Color> cols; + PoolVector<Color> cols; cols.resize(array.size()); { int len=array.size(); - DVector<Color>::Write w = cols.write(); + PoolVector<Color>::Write w = cols.write(); for(int l=0;l<len;l++) { int pos = array[l]; @@ -756,11 +756,11 @@ void EditorSceneImporterFBXConv::_parse_surfaces(State& state) { case Mesh::ARRAY_TEX_UV: case Mesh::ARRAY_TEX_UV2: { - DVector<Vector2> uvs; + PoolVector<Vector2> uvs; uvs.resize(array.size()); { int len=array.size(); - DVector<Vector2>::Write w = uvs.write(); + PoolVector<Vector2>::Write w = uvs.write(); for(int l=0;l<len;l++) { int pos = array[l]; @@ -775,14 +775,14 @@ void EditorSceneImporterFBXConv::_parse_surfaces(State& state) { case Mesh::ARRAY_BONES: case Mesh::ARRAY_WEIGHTS: { - DVector<float> arr; + PoolVector<float> arr; arr.resize(array.size()*4); int po=k==Mesh::ARRAY_WEIGHTS?1:0; lofs=ofs[Mesh::ARRAY_BONES]; { int len=array.size(); - DVector<float>::Write w = arr.write(); + PoolVector<float>::Write w = arr.write(); for(int l=0;l<len;l++) { int pos = array[l]; @@ -801,12 +801,12 @@ void EditorSceneImporterFBXConv::_parse_surfaces(State& state) { } break; case Mesh::ARRAY_INDEX: { - DVector<int> arr; + PoolVector<int> arr; arr.resize(indices.size()); { int len=indices.size(); - DVector<int>::Write w = arr.write(); + PoolVector<int>::Write w = arr.write(); for(int l=0;l<len;l++) { w[l]=iarray[ indices[l] ]; @@ -838,10 +838,10 @@ void EditorSceneImporterFBXConv::_parse_surfaces(State& state) { } if (pt==Mesh::PRIMITIVE_TRIANGLES) { - DVector<int> ia=arrays[Mesh::ARRAY_INDEX]; + PoolVector<int> ia=arrays[Mesh::ARRAY_INDEX]; int len=ia.size(); { - DVector<int>::Write w=ia.write(); + PoolVector<int>::Write w=ia.write(); for(int l=0;l<len;l+=3) { SWAP(w[l+1],w[l+2]); } diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index 28462438fc..16bc334cce 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -1199,9 +1199,9 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc src.convert(Image::FORMAT_RGB8); } - DVector<uint8_t> data = src.get_data(); + PoolVector<uint8_t> data = src.get_data(); MD5_CTX md5; - DVector<uint8_t>::Read r=data.read(); + PoolVector<uint8_t>::Read r=data.read(); MD5Init(&md5); int len=data.size(); for(int j=0;j<len;j++) { diff --git a/tools/editor/plugins/baked_light_baker.cpp b/tools/editor/plugins/baked_light_baker.cpp index 2b660c4f94..2d91524ef9 100644 --- a/tools/editor/plugins/baked_light_baker.cpp +++ b/tools/editor/plugins/baked_light_baker.cpp @@ -108,8 +108,8 @@ BakedLightBaker::MeshTexture* BakedLightBaker::_get_mat_tex(const Ref<Texture>& image=copy; } - DVector<uint8_t> dvt=image.get_data(); - DVector<uint8_t>::Read r=dvt.read(); + PoolVector<uint8_t> dvt=image.get_data(); + PoolVector<uint8_t>::Read r=dvt.read(); MeshTexture mt; mt.tex_w=image.get_width(); mt.tex_h=image.get_height(); @@ -194,14 +194,14 @@ void BakedLightBaker::_add_mesh(const Ref<Mesh>& p_mesh,const Ref<Material>& p_m Array a = p_mesh->surface_get_arrays(i); - DVector<Vector3> vertices = a[Mesh::ARRAY_VERTEX]; - DVector<Vector3>::Read vr=vertices.read(); - DVector<Vector2> uv; - DVector<Vector2>::Read uvr; - DVector<Vector2> uv2; - DVector<Vector2>::Read uv2r; - DVector<Vector3> normal; - DVector<Vector3>::Read normalr; + PoolVector<Vector3> vertices = a[Mesh::ARRAY_VERTEX]; + PoolVector<Vector3>::Read vr=vertices.read(); + PoolVector<Vector2> uv; + PoolVector<Vector2>::Read uvr; + PoolVector<Vector2> uv2; + PoolVector<Vector2>::Read uv2r; + PoolVector<Vector3> normal; + PoolVector<Vector3>::Read normalr; bool read_uv=false; bool read_normal=false; @@ -236,8 +236,8 @@ void BakedLightBaker::_add_mesh(const Ref<Mesh>& p_mesh,const Ref<Material>& p_m if (p_mesh->surface_get_format(i)&Mesh::ARRAY_FORMAT_INDEX) { - DVector<int> indices = a[Mesh::ARRAY_INDEX]; - DVector<int>::Read ir = indices.read(); + PoolVector<int> indices = a[Mesh::ARRAY_INDEX]; + PoolVector<int>::Read ir = indices.read(); for(int i=0;i<facecount;i++) { Triangle &t=triangles[tbase+i]; @@ -1788,7 +1788,7 @@ void BakedLightBaker::bake(const Ref<BakedLight> &p_light, Node* p_node) { } -void BakedLightBaker::update_octree_sampler(DVector<int> &p_sampler) { +void BakedLightBaker::update_octree_sampler(PoolVector<int> &p_sampler) { BakedLightBaker::Octant *octants=octant_pool.ptr(); double norm = 1.0/double(total_rays); @@ -1845,7 +1845,7 @@ void BakedLightBaker::update_octree_sampler(DVector<int> &p_sampler) { } p_sampler.resize(tmp_smp.size()); - DVector<int>::Write w = p_sampler.write(); + PoolVector<int>::Write w = p_sampler.write(); int ss = tmp_smp.size(); for(int i=0;i<ss;i++) { w[i]=tmp_smp[i]; @@ -1859,7 +1859,7 @@ void BakedLightBaker::update_octree_sampler(DVector<int> &p_sampler) { double mult = baked_light->get_energy_multiplier(); float saturation = baked_light->get_saturation(); - DVector<int>::Write w = p_sampler.write(); + PoolVector<int>::Write w = p_sampler.write(); encode_uint32(octree_depth,(uint8_t*)&w[2]); encode_uint32(linear_color,(uint8_t*)&w[3]); @@ -1900,7 +1900,7 @@ void BakedLightBaker::update_octree_sampler(DVector<int> &p_sampler) { } -void BakedLightBaker::update_octree_images(DVector<uint8_t> &p_octree,DVector<uint8_t> &p_light) { +void BakedLightBaker::update_octree_images(PoolVector<uint8_t> &p_octree,PoolVector<uint8_t> &p_light) { int len = baked_octree_texture_w*baked_octree_texture_h*4; @@ -1910,10 +1910,10 @@ void BakedLightBaker::update_octree_images(DVector<uint8_t> &p_octree,DVector<ui p_light.resize(ilen); - DVector<uint8_t>::Write w = p_octree.write(); + PoolVector<uint8_t>::Write w = p_octree.write(); zeromem(w.ptr(),len); - DVector<uint8_t>::Write iw = p_light.write(); + PoolVector<uint8_t>::Write iw = p_light.write(); zeromem(iw.ptr(),ilen); float gamma = baked_light->get_gamma_adjust(); @@ -2612,10 +2612,10 @@ Error BakedLightBaker::transfer_to_lightmaps() { } } - DVector<uint8_t> dv; + PoolVector<uint8_t> dv; dv.resize(baked_textures[i].data.size()); { - DVector<uint8_t>::Write w = dv.write(); + PoolVector<uint8_t>::Write w = dv.write(); copymem(w.ptr(),baked_textures[i].data.ptr(),baked_textures[i].data.size()); } diff --git a/tools/editor/plugins/baked_light_baker.h b/tools/editor/plugins/baked_light_baker.h index 5616183cb1..6fcf78dd0a 100644 --- a/tools/editor/plugins/baked_light_baker.h +++ b/tools/editor/plugins/baked_light_baker.h @@ -364,8 +364,8 @@ public: Error transfer_to_lightmaps(); - void update_octree_sampler(DVector<int> &p_sampler); - void update_octree_images(DVector<uint8_t> &p_octree,DVector<uint8_t> &p_light); + void update_octree_sampler(PoolVector<int> &p_sampler); + void update_octree_images(PoolVector<uint8_t> &p_octree,PoolVector<uint8_t> &p_light); Ref<BakedLight> get_baked_light() { return baked_light; } diff --git a/tools/editor/plugins/baked_light_editor_plugin.cpp b/tools/editor/plugins/baked_light_editor_plugin.cpp index e6d969c399..8f564a3247 100644 --- a/tools/editor/plugins/baked_light_editor_plugin.cpp +++ b/tools/editor/plugins/baked_light_editor_plugin.cpp @@ -88,7 +88,7 @@ void BakedLightEditor::_notification(int p_option) { float max_lum=0; { - DVector<Color>::Write cw=colors.write(); + PoolVector<Color>::Write cw=colors.write(); BakedLightBaker::Octant *octants=baker->octant_pool.ptr(); BakedLightBaker::Octant *oct = &octants[baker->leaf_list]; int vert_idx=0; diff --git a/tools/editor/plugins/baked_light_editor_plugin.h b/tools/editor/plugins/baked_light_editor_plugin.h index 82310dc07e..e311fe9f17 100644 --- a/tools/editor/plugins/baked_light_editor_plugin.h +++ b/tools/editor/plugins/baked_light_editor_plugin.h @@ -50,9 +50,9 @@ class BakedLightEditor : public Control { float update_timeout; - DVector<uint8_t> octree_texture; - DVector<uint8_t> light_texture; - DVector<int> octree_sampler; + PoolVector<uint8_t> octree_texture; + PoolVector<uint8_t> light_texture; + PoolVector<int> octree_sampler; BakedLightBaker *baker; AcceptDialog *err_dialog; diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 5fa0d88ca5..168b41e51f 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -3771,7 +3771,7 @@ void CanvasItemEditorViewport::_create_nodes(Node* parent, Node* child, String& if (default_type=="Patch9Frame") { editor_data->get_undo_redo().add_do_property(child,"rect/size",texture_size); } else if (default_type=="Polygon2D") { - DVector<Vector2> list; + PoolVector<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/tools/editor/plugins/collision_polygon_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_editor_plugin.cpp index 5ac4023177..1aea1bdfdb 100644 --- a/tools/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_editor_plugin.cpp @@ -478,11 +478,11 @@ void CollisionPolygonEditor::_polygon_draw() { Array a; a.resize(Mesh::ARRAY_MAX); - DVector<Vector3> va; + PoolVector<Vector3> va; { va.resize(poly.size()); - DVector<Vector3>::Write w=va.write(); + PoolVector<Vector3>::Write w=va.write(); for(int i=0;i<poly.size();i++) { diff --git a/tools/editor/plugins/color_ramp_editor_plugin.cpp b/tools/editor/plugins/color_ramp_editor_plugin.cpp index 09bed1c2d0..90ec1e9f4e 100644 --- a/tools/editor/plugins/color_ramp_editor_plugin.cpp +++ b/tools/editor/plugins/color_ramp_editor_plugin.cpp @@ -75,7 +75,7 @@ void ColorRampEditorPlugin::_ramp_changed() { UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - //Not sure if I should convert this data to DVector + //Not sure if I should convert this data to PoolVector Vector<float> new_offsets=ramp_editor->get_offsets(); Vector<Color> new_colors=ramp_editor->get_colors(); Vector<float> old_offsets=color_ramp_ref->get_offsets(); diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp index 5a41f7e9e8..9dcfc2fa94 100644 --- a/tools/editor/plugins/editor_preview_plugins.cpp +++ b/tools/editor/plugins/editor_preview_plugins.cpp @@ -118,12 +118,12 @@ Ref<Texture> EditorBitmapPreviewPlugin::generate(const RES& p_from) { return Ref<Texture>(); } - DVector<uint8_t> data; + PoolVector<uint8_t> data; data.resize(bm->get_size().width*bm->get_size().height); { - DVector<uint8_t>::Write w=data.write(); + PoolVector<uint8_t>::Write w=data.write(); for(int i=0;i<bm->get_size().width;i++) { for(int j=0;j<bm->get_size().height;j++) { @@ -193,14 +193,14 @@ Ref<Texture> EditorPackedScenePreviewPlugin::_gen_from_imd(Ref<ResourceImportMet Variant tn = p_imd->get_option("thumbnail"); //print_line(Variant::get_type_name(tn.get_type())); - DVector<uint8_t> thumbnail = tn; + PoolVector<uint8_t> thumbnail = tn; int len = thumbnail.size(); if (len==0) return Ref<Texture>(); - DVector<uint8_t>::Read r = thumbnail.read(); + PoolVector<uint8_t>::Read r = thumbnail.read(); Image img(r.ptr(),len); if (img.empty()) @@ -311,10 +311,10 @@ EditorMaterialPreviewPlugin::EditorMaterialPreviewPlugin() { int lons=32; float radius=1.0; - DVector<Vector3> vertices; - DVector<Vector3> normals; - DVector<Vector2> uvs; - DVector<float> tangents; + PoolVector<Vector3> vertices; + PoolVector<Vector3> normals; + PoolVector<Vector2> uvs; + PoolVector<float> tangents; Matrix3 tt = Matrix3(Vector3(0,1,0),Math_PI*0.5); for(int i = 1; i <= lats; i++) { @@ -535,15 +535,15 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); thumbnail_size*=EDSCALE; - DVector<uint8_t> img; + PoolVector<uint8_t> img; int w = thumbnail_size; int h = thumbnail_size; img.resize(w*h*3); - DVector<uint8_t>::Write imgdata = img.write(); + PoolVector<uint8_t>::Write imgdata = img.write(); uint8_t * imgw = imgdata.ptr(); - DVector<uint8_t> data = smp->get_data(); - DVector<uint8_t>::Read sampledata = data.read(); + PoolVector<uint8_t> data = smp->get_data(); + PoolVector<uint8_t>::Read sampledata = data.read(); const uint8_t *sdata=sampledata.ptr(); bool stereo = smp->is_stereo(); @@ -776,7 +776,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { } } - imgdata = DVector<uint8_t>::Write(); + imgdata = PoolVector<uint8_t>::Write(); Ref<ImageTexture> ptex = Ref<ImageTexture>( memnew( ImageTexture)); ptex->create_from_image(Image(w,h,0,Image::FORMAT_RGB8,img),0); diff --git a/tools/editor/plugins/material_editor_plugin.cpp b/tools/editor/plugins/material_editor_plugin.cpp index 3ef1818135..e43872deec 100644 --- a/tools/editor/plugins/material_editor_plugin.cpp +++ b/tools/editor/plugins/material_editor_plugin.cpp @@ -143,10 +143,10 @@ MaterialEditor::MaterialEditor() { int lons=32; float radius=1.0; - DVector<Vector3> vertices; - DVector<Vector3> normals; - DVector<Vector2> uvs; - DVector<float> tangents; + PoolVector<Vector3> vertices; + PoolVector<Vector3> normals; + PoolVector<Vector2> uvs; + PoolVector<float> tangents; Matrix3 tt = Matrix3(Vector3(0,1,0),Math_PI*0.5); for(int i = 1; i <= lats; i++) { @@ -221,10 +221,10 @@ MaterialEditor::MaterialEditor() { box_mesh.instance(); - DVector<Vector3> vertices; - DVector<Vector3> normals; - DVector<float> tangents; - DVector<Vector3> uvs; + PoolVector<Vector3> vertices; + PoolVector<Vector3> normals; + PoolVector<float> tangents; + PoolVector<Vector3> uvs; int vtx_idx=0; #define ADD_VTX(m_idx);\ @@ -282,7 +282,7 @@ MaterialEditor::MaterialEditor() { d[VisualServer::ARRAY_TEX_UV]= uvs ; d[VisualServer::ARRAY_VERTEX]= vertices ; - DVector<int> indices; + PoolVector<int> indices; indices.resize(vertices.size()); for(int i=0;i<vertices.size();i++) indices.set(i,i); diff --git a/tools/editor/plugins/multimesh_editor_plugin.cpp b/tools/editor/plugins/multimesh_editor_plugin.cpp index 9b19542268..49c04477a2 100644 --- a/tools/editor/plugins/multimesh_editor_plugin.cpp +++ b/tools/editor/plugins/multimesh_editor_plugin.cpp @@ -125,7 +125,7 @@ void MultiMeshEditor::_populate() { Transform geom_xform = node->get_global_transform().affine_inverse() * ss_instance->get_global_transform(); - DVector<Face3> geometry = ss_instance->get_faces(VisualInstance::FACES_SOLID); + PoolVector<Face3> geometry = ss_instance->get_faces(VisualInstance::FACES_SOLID); if (geometry.size()==0) { @@ -137,7 +137,7 @@ void MultiMeshEditor::_populate() { //make all faces local int gc = geometry.size(); - DVector<Face3>::Write w = geometry.write(); + PoolVector<Face3>::Write w = geometry.write(); for(int i=0;i<gc;i++) { for(int j=0;j<3;j++) { @@ -147,7 +147,7 @@ void MultiMeshEditor::_populate() { - w = DVector<Face3>::Write(); + w = PoolVector<Face3>::Write(); #if 0 node->get_multimesh()->set_instance_count(populate_amount->get_val()); node->populate_parent(populate_rotate_random->get_val(),populate_tilt_random->get_val(),populate_scale_random->get_val(),populate_scale->get_val()); @@ -164,12 +164,12 @@ void MultiMeshEditor::_populate() { ERR_FAIL_COND(!vi); #endif - DVector<Face3> faces = geometry; + PoolVector<Face3> faces = geometry; ERR_EXPLAIN(TTR("Parent has no solid faces to populate.")); int facecount=faces.size(); ERR_FAIL_COND(!facecount); - DVector<Face3>::Read r = faces.read(); + PoolVector<Face3>::Read r = faces.read(); diff --git a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp index d08c89c1ef..2d99522e0e 100644 --- a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp +++ b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp @@ -211,10 +211,10 @@ bool NavigationPolygonEditor::forward_input_event(const InputEvent& p_event) { for(int j=0;j<node->get_navigation_polygon()->get_outline_count();j++) { - DVector<Vector2> points=node->get_navigation_polygon()->get_outline(j); + PoolVector<Vector2> points=node->get_navigation_polygon()->get_outline(j); int pc=points.size(); - DVector<Vector2>::Read poly=points.read(); + PoolVector<Vector2>::Read poly=points.read(); for(int i=0;i<pc;i++) { @@ -240,7 +240,7 @@ bool NavigationPolygonEditor::forward_input_event(const InputEvent& p_event) { if (closest_idx>=0) { pre_move_edit=node->get_navigation_polygon()->get_outline(closest_outline); - DVector<Point2> poly = pre_move_edit; + PoolVector<Point2> poly = pre_move_edit; poly.insert(closest_idx+1,xform.affine_inverse().xform(closest_pos)); edited_point=closest_idx+1; edited_outline=closest_outline; @@ -260,10 +260,10 @@ bool NavigationPolygonEditor::forward_input_event(const InputEvent& p_event) { for(int j=0;j<node->get_navigation_polygon()->get_outline_count();j++) { - DVector<Vector2> points=node->get_navigation_polygon()->get_outline(j); + PoolVector<Vector2> points=node->get_navigation_polygon()->get_outline(j); int pc=points.size(); - DVector<Vector2>::Read poly=points.read(); + PoolVector<Vector2>::Read poly=points.read(); for(int i=0;i<pc;i++) { @@ -296,7 +296,7 @@ bool NavigationPolygonEditor::forward_input_event(const InputEvent& p_event) { //apply - DVector<Vector2> poly = node->get_navigation_polygon()->get_outline(edited_outline); + PoolVector<Vector2> poly = node->get_navigation_polygon()->get_outline(edited_outline); ERR_FAIL_INDEX_V(edited_point,poly.size(),false); poly.set(edited_point,edited_point_pos); undo_redo->create_action(TTR("Edit Poly")); @@ -322,10 +322,10 @@ bool NavigationPolygonEditor::forward_input_event(const InputEvent& p_event) { for(int j=0;j<node->get_navigation_polygon()->get_outline_count();j++) { - DVector<Vector2> points=node->get_navigation_polygon()->get_outline(j); + PoolVector<Vector2> points=node->get_navigation_polygon()->get_outline(j); int pc=points.size(); - DVector<Vector2>::Read poly=points.read(); + PoolVector<Vector2>::Read poly=points.read(); for(int i=0;i<pc;i++) { @@ -345,7 +345,7 @@ bool NavigationPolygonEditor::forward_input_event(const InputEvent& p_event) { if (closest_idx>=0) { - DVector<Vector2> poly = node->get_navigation_polygon()->get_outline(closest_outline); + PoolVector<Vector2> poly = node->get_navigation_polygon()->get_outline(closest_outline); if (poly.size()>3) { undo_redo->create_action(TTR("Edit Poly (Remove Point)")); diff --git a/tools/editor/plugins/navigation_polygon_editor_plugin.h b/tools/editor/plugins/navigation_polygon_editor_plugin.h index 50ba0cfedb..1a5fa3c456 100644 --- a/tools/editor/plugins/navigation_polygon_editor_plugin.h +++ b/tools/editor/plugins/navigation_polygon_editor_plugin.h @@ -70,7 +70,7 @@ class NavigationPolygonEditor : public HBoxContainer { int edited_outline; int edited_point; Vector2 edited_point_pos; - DVector<Vector2> pre_move_edit; + PoolVector<Vector2> pre_move_edit; Vector<Vector2> wip; bool wip_active; diff --git a/tools/editor/plugins/particles_2d_editor_plugin.cpp b/tools/editor/plugins/particles_2d_editor_plugin.cpp index 0eda9d3c1a..aee6b68e3c 100644 --- a/tools/editor/plugins/particles_2d_editor_plugin.cpp +++ b/tools/editor/plugins/particles_2d_editor_plugin.cpp @@ -74,8 +74,8 @@ void Particles2DEditorPlugin::_file_selected(const String& p_file) { Size2i s = Size2(img.get_width(),img.get_height()); ERR_FAIL_COND(s.width==0 || s.height==0); - DVector<uint8_t> data = img.get_data(); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t> data = img.get_data(); + PoolVector<uint8_t>::Read r = data.read(); Vector<Point2i> valid_positions; valid_positions.resize(s.width*s.height); @@ -95,9 +95,9 @@ void Particles2DEditorPlugin::_file_selected(const String& p_file) { ERR_EXPLAIN(TTR("No pixels with transparency > 128 in image..")); ERR_FAIL_COND(valid_positions.size()==0); - DVector<Point2> epoints; + PoolVector<Point2> epoints; epoints.resize(epc); - DVector<Point2>::Write w = epoints.write(); + PoolVector<Point2>::Write w = epoints.write(); Size2 extents = Size2(img.get_width()*0.5,img.get_height()*0.5); @@ -108,7 +108,7 @@ void Particles2DEditorPlugin::_file_selected(const String& p_file) { w[i]=p/extents; } - w = DVector<Point2>::Write(); + w = PoolVector<Point2>::Write(); undo_redo->create_action(TTR("Set Emission Mask")); undo_redo->add_do_method(particles,"set_emission_points",epoints); @@ -131,7 +131,7 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) { case MENU_CLEAR_EMISSION_MASK: { undo_redo->create_action(TTR("Clear Emission Mask")); - undo_redo->add_do_method(particles,"set_emission_points",DVector<Vector2>()); + undo_redo->add_do_method(particles,"set_emission_points",PoolVector<Vector2>()); undo_redo->add_undo_method(particles,"set_emission_points",particles->get_emission_points()); undo_redo->commit_action(); } break; diff --git a/tools/editor/plugins/particles_editor_plugin.cpp b/tools/editor/plugins/particles_editor_plugin.cpp index 4f4477070b..f290a453bb 100644 --- a/tools/editor/plugins/particles_editor_plugin.cpp +++ b/tools/editor/plugins/particles_editor_plugin.cpp @@ -77,7 +77,7 @@ void ParticlesEditor::_node_selected(const NodePath& p_path){ Transform geom_xform = node->get_global_transform().affine_inverse() * vi->get_global_transform(); int gc = geometry.size(); - DVector<Face3>::Write w = geometry.write(); + PoolVector<Face3>::Write w = geometry.write(); for(int i=0;i<gc;i++) { @@ -87,7 +87,7 @@ void ParticlesEditor::_node_selected(const NodePath& p_path){ } - w = DVector<Face3>::Write(); + w = PoolVector<Face3>::Write(); emission_dialog->popup_centered(Size2(300,130)); } @@ -202,7 +202,7 @@ void ParticlesEditor::edit(Particles *p_particles) { void ParticlesEditor::_generate_emission_points() { /// hacer codigo aca - DVector<Vector3> points; + PoolVector<Vector3> points; if (emission_fill->get_selected()==0) { @@ -256,7 +256,7 @@ void ParticlesEditor::_generate_emission_points() { return; } - DVector<Face3>::Read r = geometry.read(); + PoolVector<Face3>::Read r = geometry.read(); AABB aabb; diff --git a/tools/editor/plugins/particles_editor_plugin.h b/tools/editor/plugins/particles_editor_plugin.h index fa4ca3b9ec..c32fbe5ada 100644 --- a/tools/editor/plugins/particles_editor_plugin.h +++ b/tools/editor/plugins/particles_editor_plugin.h @@ -69,7 +69,7 @@ class ParticlesEditor : public Control { }; - DVector<Face3> geometry; + PoolVector<Face3> geometry; void _generate_emission_points(); void _resource_seleted(const String& p_res); diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.cpp b/tools/editor/plugins/polygon_2d_editor_plugin.cpp index 7900f032c0..4977d5facc 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/polygon_2d_editor_plugin.cpp @@ -102,8 +102,8 @@ void Polygon2DEditor::_menu_option(int p_option) { } - DVector<Vector2> points = node->get_polygon(); - DVector<Vector2> uvs = node->get_uv(); + PoolVector<Vector2> points = node->get_polygon(); + PoolVector<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); @@ -119,10 +119,10 @@ void Polygon2DEditor::_menu_option(int p_option) { } break; case UVEDIT_POLYGON_TO_UV: { - DVector<Vector2> points = node->get_polygon(); + PoolVector<Vector2> points = node->get_polygon(); if (points.size()==0) break; - DVector<Vector2> uvs = node->get_uv(); + PoolVector<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); @@ -134,8 +134,8 @@ void Polygon2DEditor::_menu_option(int p_option) { } break; case UVEDIT_UV_TO_POLYGON: { - DVector<Vector2> points = node->get_polygon(); - DVector<Vector2> uvs = node->get_uv(); + PoolVector<Vector2> points = node->get_polygon(); + PoolVector<Vector2> uvs = node->get_uv(); if (uvs.size()==0) break; @@ -149,11 +149,11 @@ void Polygon2DEditor::_menu_option(int p_option) { } break; case UVEDIT_UV_CLEAR: { - DVector<Vector2> uvs = node->get_uv(); + PoolVector<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",DVector<Vector2>()); + undo_redo->add_do_method(node,"set_uv",PoolVector<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"); @@ -593,13 +593,13 @@ void Polygon2DEditor::_uv_input(const InputEvent& p_input) { case UV_MODE_EDIT_POINT: { - DVector<Vector2> uv_new=uv_prev; + PoolVector<Vector2> uv_new=uv_prev; uv_new.set( uv_drag_index, uv_new[uv_drag_index]+drag ); node->set_uv(uv_new); } break; case UV_MODE_MOVE: { - DVector<Vector2> uv_new=uv_prev; + PoolVector<Vector2> uv_new=uv_prev; for(int i=0;i<uv_new.size();i++) uv_new.set( i, uv_new[i]+drag ); @@ -610,7 +610,7 @@ void Polygon2DEditor::_uv_input(const InputEvent& p_input) { case UV_MODE_ROTATE: { Vector2 center; - DVector<Vector2> uv_new=uv_prev; + PoolVector<Vector2> uv_new=uv_prev; for(int i=0;i<uv_new.size();i++) center+=uv_prev[i]; @@ -630,7 +630,7 @@ void Polygon2DEditor::_uv_input(const InputEvent& p_input) { case UV_MODE_SCALE: { Vector2 center; - DVector<Vector2> uv_new=uv_prev; + PoolVector<Vector2> uv_new=uv_prev; for(int i=0;i<uv_new.size();i++) center+=uv_prev[i]; @@ -716,7 +716,7 @@ void Polygon2DEditor::_uv_draw() { } } - DVector<Vector2> uvs = node->get_uv(); + PoolVector<Vector2> uvs = node->get_uv(); Ref<Texture> handle = get_icon("EditorHandle","EditorIcons"); Rect2 rect(Point2(),mtx.basis_xform(base_tex->get_size())); diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.h b/tools/editor/plugins/polygon_2d_editor_plugin.h index a2fd3dc4d0..67d50f6ac2 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.h +++ b/tools/editor/plugins/polygon_2d_editor_plugin.h @@ -81,7 +81,7 @@ class Polygon2DEditor : public HBoxContainer { Vector2 uv_draw_ofs; float uv_draw_zoom; - DVector<Vector2> uv_prev; + PoolVector<Vector2> uv_prev; int uv_drag_index; bool uv_drag; UVMode uv_move_current; diff --git a/tools/editor/plugins/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp index a8fb5743b0..e836e04e19 100644 --- a/tools/editor/plugins/sample_editor_plugin.cpp +++ b/tools/editor/plugins/sample_editor_plugin.cpp @@ -77,15 +77,15 @@ void SampleEditor::_stop_pressed() { void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<ImageTexture> &p_texture) { - DVector<uint8_t> data = p_sample->get_data(); + PoolVector<uint8_t> data = p_sample->get_data(); - DVector<uint8_t> img; + PoolVector<uint8_t> img; int w = p_texture->get_width(); int h = p_texture->get_height(); img.resize(w*h*3); - DVector<uint8_t>::Write imgdata = img.write(); + PoolVector<uint8_t>::Write imgdata = img.write(); uint8_t * imgw = imgdata.ptr(); - DVector<uint8_t>::Read sampledata = data.read(); + PoolVector<uint8_t>::Read sampledata = data.read(); const uint8_t *sdata=sampledata.ptr(); bool stereo = p_sample->is_stereo(); @@ -308,7 +308,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag } } - imgdata = DVector<uint8_t>::Write(); + imgdata = PoolVector<uint8_t>::Write(); p_texture->set_data(Image(w,h,0,Image::FORMAT_RGB8,img)); diff --git a/tools/editor/plugins/sample_library_editor_plugin.cpp b/tools/editor/plugins/sample_library_editor_plugin.cpp index 730c3b69a2..45615ccf9e 100644 --- a/tools/editor/plugins/sample_library_editor_plugin.cpp +++ b/tools/editor/plugins/sample_library_editor_plugin.cpp @@ -66,7 +66,7 @@ void SampleLibraryEditor::_notification(int p_what) { } } -void SampleLibraryEditor::_file_load_request(const DVector<String>& p_path) { +void SampleLibraryEditor::_file_load_request(const PoolVector<String>& p_path) { for(int i=0;i<p_path.size();i++) { @@ -400,7 +400,7 @@ void SampleLibraryEditor::drop_data_fw(const Point2& p_point,const Variant& p_da if (String(d["type"])=="files") { - DVector<String> files = d["files"]; + PoolVector<String> files = d["files"]; _file_load_request(files); diff --git a/tools/editor/plugins/sample_library_editor_plugin.h b/tools/editor/plugins/sample_library_editor_plugin.h index 46b216af82..03bf01a459 100644 --- a/tools/editor/plugins/sample_library_editor_plugin.h +++ b/tools/editor/plugins/sample_library_editor_plugin.h @@ -59,7 +59,7 @@ class SampleLibraryEditor : public Panel { void _load_pressed(); - void _file_load_request(const DVector<String>& p_path); + void _file_load_request(const PoolVector<String>& p_path); void _delete_pressed(); void _update_library(); void _item_edited(); diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp index 15906563c7..1f319a97cc 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.cpp +++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp @@ -986,13 +986,13 @@ void ShaderGraphView::_color_ramp_changed(int p_id,Node* p_ramp) { Vector<float> offsets=cr->get_offsets(); Vector<Color> colors=cr->get_colors(); - DVector<float> new_offsets; - DVector<Color> new_colors; + PoolVector<float> new_offsets; + PoolVector<Color> new_colors; { new_offsets.resize(offsets.size()); new_colors.resize(colors.size()); - DVector<float>::Write ow=new_offsets.write(); - DVector<Color>::Write cw=new_colors.write(); + PoolVector<float>::Write ow=new_offsets.write(); + PoolVector<Color>::Write cw=new_colors.write(); for(int i=0;i<new_offsets.size();i++) { ow[i]=offsets[i]; cw[i]=colors[i]; @@ -1001,8 +1001,8 @@ void ShaderGraphView::_color_ramp_changed(int p_id,Node* p_ramp) { } - DVector<float> old_offsets=graph->color_ramp_node_get_offsets(type,p_id); - DVector<Color> old_colors=graph->color_ramp_node_get_colors(type,p_id); + PoolVector<float> old_offsets=graph->color_ramp_node_get_offsets(type,p_id); + PoolVector<Color> old_colors=graph->color_ramp_node_get_colors(type,p_id); if (old_offsets.size()!=new_offsets.size()) ur->create_action(TTR("Add/Remove to Color Ramp")); @@ -1027,10 +1027,10 @@ void ShaderGraphView::_curve_changed(int p_id,Node* p_curve) { Vector<Point2> points=cr->get_points(); - DVector<Vector2> new_points; + PoolVector<Vector2> new_points; { new_points.resize(points.size()); - DVector<Vector2>::Write ow=new_points.write(); + PoolVector<Vector2>::Write ow=new_points.write(); for(int i=0;i<new_points.size();i++) { ow[i]=points[i]; } @@ -1038,7 +1038,7 @@ void ShaderGraphView::_curve_changed(int p_id,Node* p_curve) { } - DVector<Vector2> old_points=graph->curve_map_node_get_points(type,p_id); + PoolVector<Vector2> old_points=graph->curve_map_node_get_points(type,p_id); if (old_points.size()!=new_points.size()) ur->create_action(TTR("Add/Remove to Curve Map")); @@ -2131,14 +2131,14 @@ void ShaderGraphView::_create_node(int p_id) { gn->set_title("ColorRamp"); GraphColorRampEdit * ramp = memnew( GraphColorRampEdit ); - DVector<real_t> offsets = graph->color_ramp_node_get_offsets(type,p_id); - DVector<Color> colors = graph->color_ramp_node_get_colors(type,p_id); + PoolVector<real_t> offsets = graph->color_ramp_node_get_offsets(type,p_id); + PoolVector<Color> colors = graph->color_ramp_node_get_colors(type,p_id); int oc = offsets.size(); if (oc) { - DVector<real_t>::Read rofs = offsets.read(); - DVector<Color>::Read rcol = colors.read(); + PoolVector<real_t>::Read rofs = offsets.read(); + PoolVector<Color>::Read rcol = colors.read(); Vector<float> ofsv; Vector<Color> colorv; @@ -2184,12 +2184,12 @@ void ShaderGraphView::_create_node(int p_id) { gn->set_title("CurveMap"); GraphCurveMapEdit * map = memnew( GraphCurveMapEdit ); - DVector<Vector2> points = graph->curve_map_node_get_points(type,p_id); + PoolVector<Vector2> points = graph->curve_map_node_get_points(type,p_id); int oc = points.size(); if (oc) { - DVector<Vector2>::Read rofs = points.read(); + PoolVector<Vector2>::Read rofs = points.read(); Vector<Vector2> ofsv; diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 439b884937..7913d097b7 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -898,10 +898,10 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { if (p.distance_to(aabb.get_support(-ray_dir))>min_d) continue; - DVector<Face3> faces = vi->get_faces(VisualInstance::FACES_SOLID); + PoolVector<Face3> faces = vi->get_faces(VisualInstance::FACES_SOLID); int c = faces.size(); if (c>0) { - DVector<Face3>::Read r = faces.read(); + PoolVector<Face3>::Read r = faces.read(); for(int j=0;j<c;j++) { @@ -3179,8 +3179,8 @@ void SpatialEditor::_init_indicators() { indicator_mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT,true); - DVector<Color> grid_colors[3]; - DVector<Vector3> grid_points[3]; + PoolVector<Color> grid_colors[3]; + PoolVector<Vector3> grid_points[3]; Vector<Color> origin_colors; Vector<Vector3> origin_points; @@ -3262,7 +3262,7 @@ void SpatialEditor::_init_indicators() { { cursor_mesh = VisualServer::get_singleton()->mesh_create(); - DVector<Vector3> cursor_points; + PoolVector<Vector3> cursor_points; float cs = 0.25; cursor_points.push_back(Vector3(+cs,0,0)); cursor_points.push_back(Vector3(-cs,0,0)); diff --git a/tools/editor/plugins/sprite_frames_editor_plugin.cpp b/tools/editor/plugins/sprite_frames_editor_plugin.cpp index 7c6e2f6532..fbdbb37b54 100644 --- a/tools/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/tools/editor/plugins/sprite_frames_editor_plugin.cpp @@ -64,7 +64,7 @@ void SpriteFramesEditor::_notification(int p_what) { } } -void SpriteFramesEditor::_file_load_request(const DVector<String>& p_path,int p_at_pos) { +void SpriteFramesEditor::_file_load_request(const PoolVector<String>& p_path,int p_at_pos) { ERR_FAIL_COND(!frames->has_animation(edited_anim)); @@ -744,7 +744,7 @@ void SpriteFramesEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat if (String(d["type"])=="files") { - DVector<String> files = d["files"]; + PoolVector<String> files = d["files"]; _file_load_request(files,at_pos); } diff --git a/tools/editor/plugins/sprite_frames_editor_plugin.h b/tools/editor/plugins/sprite_frames_editor_plugin.h index a6fc53d344..383b831a23 100644 --- a/tools/editor/plugins/sprite_frames_editor_plugin.h +++ b/tools/editor/plugins/sprite_frames_editor_plugin.h @@ -73,7 +73,7 @@ class SpriteFramesEditor : public PanelContainer { void _load_pressed(); void _load_scene_pressed(); - void _file_load_request(const DVector<String>& p_path, int p_at_pos=-1); + void _file_load_request(const PoolVector<String>& p_path, int p_at_pos=-1); void _paste_pressed(); void _empty_pressed(); void _empty2_pressed(); diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index c4bde13352..3dd86527b0 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -289,7 +289,7 @@ void TileMapEditor::_pick_tile(const Point2& p_pos) { canvas_item_editor->update(); } -DVector<Vector2> TileMapEditor::_bucket_fill(const Point2i& p_start, bool erase, bool preview) { +PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i& p_start, bool erase, bool preview) { int prev_id = node->get_cell(p_start.x, p_start.y); int id = TileMap::INVALID_CELL; @@ -297,7 +297,7 @@ DVector<Vector2> TileMapEditor::_bucket_fill(const Point2i& p_start, bool erase, id = get_selected_tile(); if (id == TileMap::INVALID_CELL) - return DVector<Vector2>(); + return PoolVector<Vector2>(); } Rect2i r = node->get_item_rect(); @@ -324,7 +324,7 @@ DVector<Vector2> TileMapEditor::_bucket_fill(const Point2i& p_start, bool erase, if(invalidate_cache) { for(int i = 0; i < area; ++i) bucket_cache_visited[i] = false; - bucket_cache = DVector<Vector2>(); + bucket_cache = PoolVector<Vector2>(); bucket_cache_tile = prev_id; bucket_cache_rect = r; } @@ -333,7 +333,7 @@ DVector<Vector2> TileMapEditor::_bucket_fill(const Point2i& p_start, bool erase, } } - DVector<Vector2> points; + PoolVector<Vector2> points; List<Point2i> queue; queue.push_back(p_start); @@ -370,10 +370,10 @@ DVector<Vector2> TileMapEditor::_bucket_fill(const Point2i& p_start, bool erase, return preview ? bucket_cache : points; } -void TileMapEditor::_fill_points(const DVector<Vector2> p_points, const Dictionary& p_op) { +void TileMapEditor::_fill_points(const PoolVector<Vector2> p_points, const Dictionary& p_op) { int len = p_points.size(); - DVector<Vector2>::Read pr = p_points.read(); + PoolVector<Vector2>::Read pr = p_points.read(); int id = p_op["id"]; bool xf = p_op["flip_h"]; @@ -386,10 +386,10 @@ void TileMapEditor::_fill_points(const DVector<Vector2> p_points, const Dictiona } } -void TileMapEditor::_erase_points(const DVector<Vector2> p_points) { +void TileMapEditor::_erase_points(const PoolVector<Vector2> p_points) { int len = p_points.size(); - DVector<Vector2>::Read pr = p_points.read(); + PoolVector<Vector2>::Read pr = p_points.read(); for (int i=0;i<len;i++) { @@ -507,8 +507,8 @@ void TileMapEditor::_draw_cell(int p_cell, const Point2i& p_point, bool p_flip_h void TileMapEditor::_draw_fill_preview(int p_cell, const Point2i& p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Matrix32& p_xform) { - DVector<Vector2> points = _bucket_fill(p_point, false, true); - DVector<Vector2>::Read pr = points.read(); + PoolVector<Vector2> points = _bucket_fill(p_point, false, true); + PoolVector<Vector2>::Read pr = points.read(); int len = points.size(); int time_after = OS::get_singleton()->get_ticks_msec(); @@ -748,7 +748,7 @@ bool TileMapEditor::forward_input_event(const 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); - DVector<Vector2> points = _bucket_fill(over_tile); + PoolVector<Vector2> points = _bucket_fill(over_tile); if (points.size() == 0) return false; @@ -854,7 +854,7 @@ bool TileMapEditor::forward_input_event(const 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); - DVector<Vector2> points = _bucket_fill(over_tile, true); + PoolVector<Vector2> points = _bucket_fill(over_tile, true); if (points.size() == 0) return false; diff --git a/tools/editor/plugins/tile_map_editor_plugin.h b/tools/editor/plugins/tile_map_editor_plugin.h index 612593c56a..5217453740 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.h +++ b/tools/editor/plugins/tile_map_editor_plugin.h @@ -109,7 +109,7 @@ class TileMapEditor : public VBoxContainer { bool * bucket_cache_visited; Rect2i bucket_cache_rect; int bucket_cache_tile; - DVector<Vector2> bucket_cache; + PoolVector<Vector2> bucket_cache; struct CellOp { int idx; @@ -134,10 +134,10 @@ class TileMapEditor : public VBoxContainer { void _pick_tile(const Point2& p_pos); - DVector<Vector2> _bucket_fill(const Point2i& p_start, bool erase=false, bool preview=false); + PoolVector<Vector2> _bucket_fill(const Point2i& p_start, bool erase=false, bool preview=false); - void _fill_points(const DVector<Vector2> p_points, const Dictionary& p_op); - void _erase_points(const DVector<Vector2> p_points); + void _fill_points(const PoolVector<Vector2> p_points, const Dictionary& p_op); + void _erase_points(const PoolVector<Vector2> p_points); void _select(const Point2i& p_from, const Point2i& p_to); diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp index b183de7c7b..2bb8a63cb7 100644 --- a/tools/editor/project_export.cpp +++ b/tools/editor/project_export.cpp @@ -1732,7 +1732,7 @@ Error ProjectExport::export_project(const String& p_preset) { String selected=p_preset; - DVector<String> preset_settings = GlobalConfig::get_singleton()->get("export_presets/"+selected); + PoolVector<String> preset_settings = GlobalConfig::get_singleton()->get("export_presets/"+selected); String preset_path=GlobalConfig::get_singleton()->get("export_presets_path/"+selected); if (preset_path=="") { @@ -2084,7 +2084,7 @@ Error ProjectExport::export_project(const String& p_preset) { for (Map<String,Map<String,String> >::Element *E=remapped_paths.front();E;E=E->next()) { String platform=E->key(); - DVector<String> remaps; + PoolVector<String> remaps; for(Map<String,String>::Element *F=E->get().front();F;F=F->next() ) { remaps.push_back(F->key()); diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index 809c824d91..ed96fe9e3f 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -117,10 +117,10 @@ void EditorSpatialGizmo::add_lines(const Vector<Vector3> &p_lines, const Ref<Mat a[Mesh::ARRAY_VERTEX]=p_lines; - DVector<Color> color; + PoolVector<Color> color; color.resize(p_lines.size()); { - DVector<Color>::Write w = color.write(); + PoolVector<Color>::Write w = color.write(); for(int i=0;i<p_lines.size();i++) { if (is_selected()) w[i]=Color(1,1,1,0.6); @@ -246,10 +246,10 @@ void EditorSpatialGizmo::add_handles(const Vector<Vector3> &p_handles, bool p_bi a.resize(VS::ARRAY_MAX); a[VS::ARRAY_VERTEX]=p_handles; print_line("handles?: "+itos(p_handles.size())); - DVector<Color> colors; + PoolVector<Color> colors; { colors.resize(p_handles.size()); - DVector<Color>::Write w=colors.write(); + PoolVector<Color>::Write w=colors.write(); for(int i=0;i<p_handles.size();i++) { Color col(1,1,1,1); @@ -1425,11 +1425,11 @@ void RoomSpatialGizmo::redraw() { Ref<RoomBounds> roomie = room->get_room(); if (roomie.is_null()) return; - DVector<Face3> faces = roomie->get_geometry_hint(); + PoolVector<Face3> faces = roomie->get_geometry_hint(); Vector<Vector3> lines; int fc=faces.size(); - DVector<Face3>::Read r =faces.read(); + PoolVector<Face3>::Read r =faces.read(); Map<_EdgeKey,Vector3> edge_map; @@ -2056,7 +2056,7 @@ void CollisionShapeSpatialGizmo::redraw(){ if (s->cast_to<ConvexPolygonShape>()) { - DVector<Vector3> points = s->cast_to<ConvexPolygonShape>()->get_points(); + PoolVector<Vector3> points = s->cast_to<ConvexPolygonShape>()->get_points(); if (points.size()>3) { @@ -2562,8 +2562,8 @@ void NavigationMeshSpatialGizmo::redraw() { if (navmeshie.is_null()) return; - DVector<Vector3> vertices = navmeshie->get_vertices(); - DVector<Vector3>::Read vr=vertices.read(); + PoolVector<Vector3> vertices = navmeshie->get_vertices(); + PoolVector<Vector3>::Read vr=vertices.read(); List<Face3> faces; for(int i=0;i<navmeshie->get_polygon_count();i++) { Vector<int> p = navmeshie->get_polygon(i); @@ -2582,11 +2582,11 @@ void NavigationMeshSpatialGizmo::redraw() { return; Map<_EdgeKey,bool> edge_map; - DVector<Vector3> tmeshfaces; + PoolVector<Vector3> tmeshfaces; tmeshfaces.resize(faces.size()*3); { - DVector<Vector3>::Write tw=tmeshfaces.write(); + PoolVector<Vector3>::Write tw=tmeshfaces.write(); int tidx=0; @@ -3391,8 +3391,8 @@ SpatialEditorGizmos::SpatialEditorGizmos() { pos3d_mesh = Ref<Mesh>( memnew( Mesh ) ); { - DVector<Vector3> cursor_points; - DVector<Color> cursor_colors; + PoolVector<Vector3> cursor_points; + PoolVector<Color> cursor_colors; float cs = 0.25; cursor_points.push_back(Vector3(+cs,0,0)); cursor_points.push_back(Vector3(-cs,0,0)); @@ -3424,8 +3424,8 @@ SpatialEditorGizmos::SpatialEditorGizmos() { listener_line_mesh = Ref<Mesh>(memnew(Mesh)); { - DVector<Vector3> cursor_points; - DVector<Color> cursor_colors; + PoolVector<Vector3> cursor_points; + PoolVector<Color> cursor_colors; cursor_points.push_back(Vector3(0, 0, 0)); cursor_points.push_back(Vector3(0, 0, -1.0)); cursor_colors.push_back(Color(0.5, 0.5, 0.5, 0.7)); @@ -3491,7 +3491,7 @@ SpatialEditorGizmos::SpatialEditorGizmos() { { - DVector<Vector3> vertices; + PoolVector<Vector3> vertices; #undef ADD_VTX #define ADD_VTX(m_idx);\ |