diff options
Diffstat (limited to 'core/bind')
-rw-r--r-- | core/bind/core_bind.cpp | 96 | ||||
-rw-r--r-- | core/bind/core_bind.h | 28 |
2 files changed, 62 insertions, 62 deletions
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); |