diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-02-18 11:27:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-18 11:27:04 +0100 |
commit | ef5891091bceef2800b4fae4cd85af219e791467 (patch) | |
tree | 8d58cca8cae2c34d408450cfb5ceb198543147b7 /servers | |
parent | c7faf2e16b684f3dd0246dbdb662b1826dd24571 (diff) | |
parent | 3205a92ad872f918c8322cdcd1434c231a1fd251 (diff) |
Merge pull request #36311 from reduz/poolvector-deprecation
Convert all references and instances of PoolVector to Vector
Diffstat (limited to 'servers')
27 files changed, 415 insertions, 462 deletions
diff --git a/servers/audio/effects/audio_effect_record.cpp b/servers/audio/effects/audio_effect_record.cpp index 9be3a2d554..8f0c55ad83 100644 --- a/servers/audio/effects/audio_effect_record.cpp +++ b/servers/audio/effects/audio_effect_record.cpp @@ -215,7 +215,7 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const { AudioStreamSample::Format dst_format = format; bool stereo = true; //forcing mono is not implemented - PoolVector<uint8_t> dst_data; + Vector<uint8_t> dst_data; ERR_FAIL_COND_V(current_instance.is_null(), NULL); ERR_FAIL_COND_V(current_instance->recording_data.size() == 0, NULL); @@ -223,7 +223,7 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const { if (dst_format == AudioStreamSample::FORMAT_8_BITS) { int data_size = current_instance->recording_data.size(); dst_data.resize(data_size); - PoolVector<uint8_t>::Write w = dst_data.write(); + uint8_t *w = dst_data.ptrw(); for (int i = 0; i < data_size; i++) { int8_t v = CLAMP(current_instance->recording_data[i] * 128, -128, 127); @@ -232,7 +232,7 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const { } else if (dst_format == AudioStreamSample::FORMAT_16_BITS) { int data_size = current_instance->recording_data.size(); dst_data.resize(data_size * 2); - PoolVector<uint8_t>::Write w = dst_data.write(); + uint8_t *w = dst_data.ptrw(); for (int i = 0; i < data_size; i++) { int16_t v = CLAMP(current_instance->recording_data[i] * 32768, -32768, 32767); @@ -252,8 +252,8 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const { right.set(i, current_instance->recording_data[i * 2 + 1]); } - PoolVector<uint8_t> bleft; - PoolVector<uint8_t> bright; + Vector<uint8_t> bleft; + Vector<uint8_t> bright; ResourceImporterWAV::_compress_ima_adpcm(left, bleft); ResourceImporterWAV::_compress_ima_adpcm(right, bright); @@ -261,9 +261,9 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const { int dl = bleft.size(); dst_data.resize(dl * 2); - PoolVector<uint8_t>::Write w = dst_data.write(); - PoolVector<uint8_t>::Read rl = bleft.read(); - PoolVector<uint8_t>::Read rr = bright.read(); + uint8_t *w = dst_data.ptrw(); + const uint8_t *rl = bleft.ptr(); + const uint8_t *rr = bright.ptr(); for (int i = 0; i < dl; i++) { w[i * 2 + 0] = rl[i]; diff --git a/servers/audio/effects/audio_stream_generator.cpp b/servers/audio/effects/audio_stream_generator.cpp index 9e1019afbc..101dcddae7 100644 --- a/servers/audio/effects/audio_stream_generator.cpp +++ b/servers/audio/effects/audio_stream_generator.cpp @@ -99,17 +99,17 @@ bool AudioStreamGeneratorPlayback::push_frame(const Vector2 &p_frame) { bool AudioStreamGeneratorPlayback::can_push_buffer(int p_frames) const { return buffer.space_left() >= p_frames; } -bool AudioStreamGeneratorPlayback::push_buffer(const PoolVector2Array &p_frames) { +bool AudioStreamGeneratorPlayback::push_buffer(const PackedVector2Array &p_frames) { int to_write = p_frames.size(); if (buffer.space_left() < to_write) { return false; } - PoolVector2Array::Read r = p_frames.read(); + const Vector2 *r = p_frames.ptr(); if (sizeof(real_t) == 4) { //write directly - buffer.write((const AudioFrame *)r.ptr(), to_write); + buffer.write((const AudioFrame *)r, to_write); } else { //convert from double AudioFrame buf[2048]; diff --git a/servers/audio/effects/audio_stream_generator.h b/servers/audio/effects/audio_stream_generator.h index f1cd73d266..aee3459e17 100644 --- a/servers/audio/effects/audio_stream_generator.h +++ b/servers/audio/effects/audio_stream_generator.h @@ -85,7 +85,7 @@ public: bool push_frame(const Vector2 &p_frame); bool can_push_buffer(int p_frames) const; - bool push_buffer(const PoolVector2Array &p_frames); + bool push_buffer(const PackedVector2Array &p_frames); int get_frames_available() const; int get_skips() const; diff --git a/servers/audio_server.h b/servers/audio_server.h index eff66d4008..1d9e5100fa 100644 --- a/servers/audio_server.h +++ b/servers/audio_server.h @@ -104,7 +104,7 @@ public: virtual Error capture_stop() { return FAILED; } virtual void capture_set_device(const String &p_name) {} virtual String capture_get_device() { return "Default"; } - virtual Array capture_get_device_list(); // TODO: convert this and get_device_list to PoolStringArray + virtual Array capture_get_device_list(); // TODO: convert this and get_device_list to PackedStringArray virtual float get_latency() { return 0; } diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp index 7c92178803..4a6ed6be58 100644 --- a/servers/physics/shape_sw.cpp +++ b/servers/physics/shape_sw.cpp @@ -1106,9 +1106,9 @@ FaceShapeSW::FaceShapeSW() { configure(AABB()); } -PoolVector<Vector3> ConcavePolygonShapeSW::get_faces() const { +Vector<Vector3> ConcavePolygonShapeSW::get_faces() const { - PoolVector<Vector3> rfaces; + Vector<Vector3> rfaces; rfaces.resize(faces.size() * 3); for (int i = 0; i < faces.size(); i++) { @@ -1132,8 +1132,7 @@ void ConcavePolygonShapeSW::project_range(const Vector3 &p_normal, const Transfo r_max = 0; return; } - PoolVector<Vector3>::Read r = vertices.read(); - const Vector3 *vptr = r.ptr(); + const Vector3 *vptr = vertices.ptr(); for (int i = 0; i < count; i++) { @@ -1152,8 +1151,7 @@ Vector3 ConcavePolygonShapeSW::get_support(const Vector3 &p_normal) const { if (count == 0) return Vector3(); - PoolVector<Vector3>::Read r = vertices.read(); - const Vector3 *vptr = r.ptr(); + const Vector3 *vptr = vertices.ptr(); Vector3 n = p_normal; @@ -1231,9 +1229,9 @@ bool ConcavePolygonShapeSW::intersect_segment(const Vector3 &p_begin, const Vect return false; // unlock data - PoolVector<Face>::Read fr = faces.read(); - PoolVector<Vector3>::Read vr = vertices.read(); - PoolVector<BVH>::Read br = bvh.read(); + const Face *fr = faces.ptr(); + const Vector3 *vr = vertices.ptr(); + const BVH *br = bvh.ptr(); _SegmentCullParams params; params.from = p_begin; @@ -1241,9 +1239,9 @@ bool ConcavePolygonShapeSW::intersect_segment(const Vector3 &p_begin, const Vect params.collisions = 0; params.dir = (p_end - p_begin).normalized(); - params.faces = fr.ptr(); - params.vertices = vr.ptr(); - params.bvh = br.ptr(); + params.faces = fr; + params.vertices = vr; + params.bvh = br; params.min_d = 1e20; // cull @@ -1310,18 +1308,18 @@ void ConcavePolygonShapeSW::cull(const AABB &p_local_aabb, Callback p_callback, AABB local_aabb = p_local_aabb; // unlock data - PoolVector<Face>::Read fr = faces.read(); - PoolVector<Vector3>::Read vr = vertices.read(); - PoolVector<BVH>::Read br = bvh.read(); + const Face *fr = faces.ptr(); + const Vector3 *vr = vertices.ptr(); + const BVH *br = bvh.ptr(); FaceShapeSW face; // use this to send in the callback _CullParams params; params.aabb = local_aabb; params.face = &face; - params.faces = fr.ptr(); - params.vertices = vr.ptr(); - params.bvh = br.ptr(); + params.faces = fr; + params.vertices = vr; + params.bvh = br; params.callback = p_callback; params.userdata = p_userdata; @@ -1464,7 +1462,7 @@ void ConcavePolygonShapeSW::_fill_bvh(_VolumeSW_BVH *p_bvh_tree, BVH *p_bvh_arra memdelete(p_bvh_tree); } -void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) { +void ConcavePolygonShapeSW::_setup(Vector<Vector3> p_faces) { int src_face_count = p_faces.size(); if (src_face_count == 0) { @@ -1474,23 +1472,19 @@ void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) { ERR_FAIL_COND(src_face_count % 3); src_face_count /= 3; - PoolVector<Vector3>::Read r = p_faces.read(); - const Vector3 *facesr = r.ptr(); + const Vector3 *facesr = p_faces.ptr(); - PoolVector<_VolumeSW_BVH_Element> bvh_array; + Vector<_VolumeSW_BVH_Element> bvh_array; bvh_array.resize(src_face_count); - PoolVector<_VolumeSW_BVH_Element>::Write bvhw = bvh_array.write(); - _VolumeSW_BVH_Element *bvh_arrayw = bvhw.ptr(); + _VolumeSW_BVH_Element *bvh_arrayw = bvh_array.ptrw(); faces.resize(src_face_count); - PoolVector<Face>::Write w = faces.write(); - Face *facesw = w.ptr(); + Face *facesw = faces.ptrw(); vertices.resize(src_face_count * 3); - PoolVector<Vector3>::Write vw = vertices.write(); - Vector3 *verticesw = vw.ptr(); + Vector3 *verticesw = vertices.ptrw(); AABB _aabb; @@ -1514,16 +1508,12 @@ void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) { _aabb.merge_with(bvh_arrayw[i].aabb); } - w.release(); - vw.release(); - int count = 0; _VolumeSW_BVH *bvh_tree = _volume_sw_build_bvh(bvh_arrayw, src_face_count, count); bvh.resize(count + 1); - PoolVector<BVH>::Write bvhw2 = bvh.write(); - BVH *bvh_arrayw2 = bvhw2.ptr(); + BVH *bvh_arrayw2 = bvh.ptrw(); int idx = 0; _fill_bvh(bvh_tree, bvh_arrayw2, idx); @@ -1546,7 +1536,7 @@ ConcavePolygonShapeSW::ConcavePolygonShapeSW() { /* HEIGHT MAP SHAPE */ -PoolVector<real_t> HeightMapShapeSW::get_heights() const { +Vector<real_t> HeightMapShapeSW::get_heights() const { return heights; } @@ -1603,14 +1593,14 @@ Vector3 HeightMapShapeSW::get_moment_of_inertia(real_t p_mass) const { (p_mass / 3.0) * (extents.y * extents.y + extents.y * extents.y)); } -void HeightMapShapeSW::_setup(PoolVector<real_t> p_heights, int p_width, int p_depth, real_t p_cell_size) { +void HeightMapShapeSW::_setup(Vector<real_t> p_heights, int p_width, int p_depth, real_t p_cell_size) { heights = p_heights; width = p_width; depth = p_depth; cell_size = p_cell_size; - PoolVector<real_t>::Read r = heights.read(); + const real_t *r = heights.ptr(); AABB aabb; @@ -1643,7 +1633,7 @@ void HeightMapShapeSW::set_data(const Variant &p_data) { int width = d["width"]; int depth = d["depth"]; real_t cell_size = d["cell_size"]; - PoolVector<real_t> heights = d["heights"]; + Vector<real_t> heights = d["heights"]; ERR_FAIL_COND(width <= 0); ERR_FAIL_COND(depth <= 0); diff --git a/servers/physics/shape_sw.h b/servers/physics/shape_sw.h index 62a6cb7f29..eaae64be66 100644 --- a/servers/physics/shape_sw.h +++ b/servers/physics/shape_sw.h @@ -31,7 +31,6 @@ #ifndef SHAPE_SW_H #define SHAPE_SW_H -#include "core/math/bsp_tree.h" #include "core/math/geometry.h" #include "servers/physics_server.h" /* @@ -297,8 +296,8 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW { int indices[3]; }; - PoolVector<Face> faces; - PoolVector<Vector3> vertices; + Vector<Face> faces; + Vector<Vector3> vertices; struct BVH { @@ -309,7 +308,7 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW { int face_index; }; - PoolVector<BVH> bvh; + Vector<BVH> bvh; struct _CullParams { @@ -342,10 +341,10 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW { void _fill_bvh(_VolumeSW_BVH *p_bvh_tree, BVH *p_bvh_array, int &p_idx); - void _setup(PoolVector<Vector3> p_faces); + void _setup(Vector<Vector3> p_faces); public: - PoolVector<Vector3> get_faces() const; + Vector<Vector3> get_faces() const; virtual PhysicsServer::ShapeType get_type() const { return PhysicsServer::SHAPE_CONCAVE_POLYGON; } @@ -368,7 +367,7 @@ public: struct HeightMapShapeSW : public ConcaveShapeSW { - PoolVector<real_t> heights; + Vector<real_t> heights; int width; int depth; real_t cell_size; @@ -376,10 +375,10 @@ struct HeightMapShapeSW : public ConcaveShapeSW { //void _cull_segment(int p_idx,_SegmentCullParams *p_params) const; //void _cull(int p_idx,_CullParams *p_params) const; - void _setup(PoolVector<real_t> p_heights, int p_width, int p_depth, real_t p_cell_size); + void _setup(Vector<real_t> p_heights, int p_width, int p_depth, real_t p_cell_size); public: - PoolVector<real_t> get_heights() const; + Vector<real_t> get_heights() const; int get_width() const; int get_depth() const; real_t get_cell_size() const; @@ -468,16 +467,4 @@ struct MotionShapeSW : public ShapeSW { MotionShapeSW() { configure(AABB()); } }; -struct _ShapeTestConvexBSPSW { - - const BSP_Tree *bsp; - const ShapeSW *shape; - Transform transform; - - _FORCE_INLINE_ void project_range(const Vector3 &p_normal, real_t &r_min, real_t &r_max) const { - - shape->project_range(p_normal, transform, r_min, r_max); - } -}; - -#endif // SHAPESW_H +#endif // SHAPE_SW_H diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp index 75c604f0fa..86057e4078 100644 --- a/servers/physics_2d/shape_2d_sw.cpp +++ b/servers/physics_2d/shape_2d_sw.cpp @@ -639,19 +639,19 @@ real_t ConvexPolygonShape2DSW::get_moment_of_inertia(real_t p_mass, const Size2 void ConvexPolygonShape2DSW::set_data(const Variant &p_data) { - ERR_FAIL_COND(p_data.get_type() != Variant::POOL_VECTOR2_ARRAY && p_data.get_type() != Variant::POOL_REAL_ARRAY); + ERR_FAIL_COND(p_data.get_type() != Variant::PACKED_VECTOR2_ARRAY && p_data.get_type() != Variant::PACKED_REAL_ARRAY); if (points) memdelete_arr(points); points = NULL; point_count = 0; - if (p_data.get_type() == Variant::POOL_VECTOR2_ARRAY) { - PoolVector<Vector2> arr = p_data; + if (p_data.get_type() == Variant::PACKED_VECTOR2_ARRAY) { + Vector<Vector2> arr = p_data; ERR_FAIL_COND(arr.size() == 0); point_count = arr.size(); points = memnew_arr(Point, point_count); - PoolVector<Vector2>::Read r = arr.read(); + const Vector2 *r = arr.ptr(); for (int i = 0; i < point_count; i++) { points[i].pos = r[i]; @@ -665,12 +665,12 @@ void ConvexPolygonShape2DSW::set_data(const Variant &p_data) { } } else { - PoolVector<real_t> dvr = p_data; + Vector<real_t> dvr = p_data; point_count = dvr.size() / 4; ERR_FAIL_COND(point_count == 0); points = memnew_arr(Point, point_count); - PoolVector<real_t>::Read r = dvr.read(); + const real_t *r = dvr.ptr(); for (int i = 0; i < point_count; i++) { @@ -693,7 +693,7 @@ void ConvexPolygonShape2DSW::set_data(const Variant &p_data) { Variant ConvexPolygonShape2DSW::get_data() const { - PoolVector<Vector2> dvr; + Vector<Vector2> dvr; dvr.resize(point_count); @@ -899,13 +899,13 @@ int ConcavePolygonShape2DSW::_generate_bvh(BVH *p_bvh, int p_len, int p_depth) { void ConcavePolygonShape2DSW::set_data(const Variant &p_data) { - ERR_FAIL_COND(p_data.get_type() != Variant::POOL_VECTOR2_ARRAY && p_data.get_type() != Variant::POOL_REAL_ARRAY); + ERR_FAIL_COND(p_data.get_type() != Variant::PACKED_VECTOR2_ARRAY && p_data.get_type() != Variant::PACKED_REAL_ARRAY); Rect2 aabb; - if (p_data.get_type() == Variant::POOL_VECTOR2_ARRAY) { + if (p_data.get_type() == Variant::PACKED_VECTOR2_ARRAY) { - PoolVector<Vector2> p2arr = p_data; + Vector<Vector2> p2arr = p_data; int len = p2arr.size(); ERR_FAIL_COND(len % 2); @@ -919,7 +919,7 @@ void ConcavePolygonShape2DSW::set_data(const Variant &p_data) { return; } - PoolVector<Vector2>::Read arr = p2arr.read(); + const Vector2 *arr = p2arr.ptr(); Map<Point2, int> pointmap; for (int i = 0; i < len; i += 2) { @@ -976,18 +976,16 @@ void ConcavePolygonShape2DSW::set_data(const Variant &p_data) { } Variant ConcavePolygonShape2DSW::get_data() const { - PoolVector<Vector2> rsegments; + Vector<Vector2> rsegments; int len = segments.size(); rsegments.resize(len * 2); - PoolVector<Vector2>::Write w = rsegments.write(); + Vector2 *w = rsegments.ptrw(); for (int i = 0; i < len; i++) { w[(i << 1) + 0] = points[segments[i].points[0]]; w[(i << 1) + 1] = points[segments[i].points[1]]; } - w.release(); - return rsegments; } diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 08d2104f94..3274b15975 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -356,7 +356,7 @@ public: virtual void mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode) = 0; virtual VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const = 0; - virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) = 0; + virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) = 0; virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) = 0; virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const = 0; @@ -393,8 +393,8 @@ public: virtual Color multimesh_instance_get_color(RID p_multimesh, int p_index) const = 0; virtual Color multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const = 0; - virtual void multimesh_set_buffer(RID p_multimesh, const PoolVector<float> &p_buffer) = 0; - virtual PoolVector<float> multimesh_get_buffer(RID p_multimesh) const = 0; + virtual void multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_buffer) = 0; + virtual Vector<float> multimesh_get_buffer(RID p_multimesh) const = 0; virtual void multimesh_set_visible_instances(RID p_multimesh, int p_visible) = 0; virtual int multimesh_get_visible_instances(RID p_multimesh) const = 0; @@ -499,15 +499,15 @@ public: virtual RID gi_probe_create() = 0; - virtual void gi_probe_allocate(RID p_gi_probe, const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3i &p_octree_size, const PoolVector<uint8_t> &p_octree_cells, const PoolVector<uint8_t> &p_data_cells, const PoolVector<uint8_t> &p_distance_field, const PoolVector<int> &p_level_counts) = 0; + virtual void gi_probe_allocate(RID p_gi_probe, const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3i &p_octree_size, const Vector<uint8_t> &p_octree_cells, const Vector<uint8_t> &p_data_cells, const Vector<uint8_t> &p_distance_field, const Vector<int> &p_level_counts) = 0; virtual AABB gi_probe_get_bounds(RID p_gi_probe) const = 0; virtual Vector3i gi_probe_get_octree_size(RID p_gi_probe) const = 0; - virtual PoolVector<uint8_t> gi_probe_get_octree_cells(RID p_gi_probe) const = 0; - virtual PoolVector<uint8_t> gi_probe_get_data_cells(RID p_gi_probe) const = 0; - virtual PoolVector<uint8_t> gi_probe_get_distance_field(RID p_gi_probe) const = 0; + virtual Vector<uint8_t> gi_probe_get_octree_cells(RID p_gi_probe) const = 0; + virtual Vector<uint8_t> gi_probe_get_data_cells(RID p_gi_probe) const = 0; + virtual Vector<uint8_t> gi_probe_get_distance_field(RID p_gi_probe) const = 0; - virtual PoolVector<int> gi_probe_get_level_counts(RID p_gi_probe) const = 0; + virtual Vector<int> gi_probe_get_level_counts(RID p_gi_probe) const = 0; virtual Transform gi_probe_get_to_cell_xform(RID p_gi_probe) const = 0; virtual void gi_probe_set_dynamic_range(RID p_gi_probe, float p_range) = 0; @@ -558,15 +558,15 @@ public: virtual RID lightmap_capture_create() = 0; virtual void lightmap_capture_set_bounds(RID p_capture, const AABB &p_bounds) = 0; virtual AABB lightmap_capture_get_bounds(RID p_capture) const = 0; - virtual void lightmap_capture_set_octree(RID p_capture, const PoolVector<uint8_t> &p_octree) = 0; - virtual PoolVector<uint8_t> lightmap_capture_get_octree(RID p_capture) const = 0; + virtual void lightmap_capture_set_octree(RID p_capture, const Vector<uint8_t> &p_octree) = 0; + virtual Vector<uint8_t> lightmap_capture_get_octree(RID p_capture) const = 0; virtual void lightmap_capture_set_octree_cell_transform(RID p_capture, const Transform &p_xform) = 0; virtual Transform lightmap_capture_get_octree_cell_transform(RID p_capture) const = 0; virtual void lightmap_capture_set_octree_cell_subdiv(RID p_capture, int p_subdiv) = 0; virtual int lightmap_capture_get_octree_cell_subdiv(RID p_capture) const = 0; virtual void lightmap_capture_set_energy(RID p_capture, float p_energy) = 0; virtual float lightmap_capture_get_energy(RID p_capture) const = 0; - virtual const PoolVector<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const = 0; + virtual const Vector<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const = 0; /* PARTICLES */ @@ -1258,7 +1258,7 @@ public: virtual void light_update_shadow(RID p_rid, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders) = 0; virtual RID occluder_polygon_create() = 0; - virtual void occluder_polygon_set_shape_as_lines(RID p_occluder, const PoolVector<Vector2> &p_lines) = 0; + virtual void occluder_polygon_set_shape_as_lines(RID p_occluder, const Vector<Vector2> &p_lines) = 0; virtual void occluder_polygon_set_cull_mode(RID p_occluder, VS::CanvasOccluderPolygonCullMode p_mode) = 0; virtual void draw_window_margins(int *p_margins, RID *p_margin_textures) = 0; diff --git a/servers/visual/rasterizer_rd/light_cluster_builder.cpp b/servers/visual/rasterizer_rd/light_cluster_builder.cpp index 78011c22cc..943ef1c7fa 100644 --- a/servers/visual/rasterizer_rd/light_cluster_builder.cpp +++ b/servers/visual/rasterizer_rd/light_cluster_builder.cpp @@ -47,8 +47,8 @@ void LightClusterBuilder::bake_cluster() { float slice_depth = (z_near - z_far) / depth; - PoolVector<uint8_t>::Write cluster_dataw = cluster_data.write(); - Cell *cluster_data_ptr = (Cell *)cluster_dataw.ptr(); + uint8_t *cluster_dataw = cluster_data.ptrw(); + Cell *cluster_data_ptr = (Cell *)cluster_dataw; //clear the cluster zeromem(cluster_data_ptr, (width * height * depth * sizeof(Cell))); @@ -160,8 +160,7 @@ void LightClusterBuilder::bake_cluster() { //print_line("offset: " + itos(offset)); /* Step 3, Place item lists */ - PoolVector<uint32_t>::Write idsw = ids.write(); - uint32_t *ids_ptr = idsw.ptr(); + uint32_t *ids_ptr = ids.ptrw(); for (uint32_t i = 0; i < sort_id_count; i++) { const SortID &id = sort_ids[i]; @@ -173,12 +172,8 @@ void LightClusterBuilder::bake_cluster() { cell.item_pointers[id.item_type] = pointer | ((counter + 1) << COUNTER_SHIFT); } - cluster_dataw = PoolVector<uint8_t>::Write(); - RD::get_singleton()->texture_update(cluster_texture, 0, cluster_data, true); RD::get_singleton()->buffer_update(items_buffer, 0, offset * sizeof(uint32_t), ids_ptr, true); - - idsw = PoolVector<uint32_t>::Write(); } void LightClusterBuilder::setup(uint32_t p_width, uint32_t p_height, uint32_t p_depth) { diff --git a/servers/visual/rasterizer_rd/light_cluster_builder.h b/servers/visual/rasterizer_rd/light_cluster_builder.h index fd2bd612c3..83014a7dd0 100644 --- a/servers/visual/rasterizer_rd/light_cluster_builder.h +++ b/servers/visual/rasterizer_rd/light_cluster_builder.h @@ -104,7 +104,7 @@ private: uint32_t item_pointers[ITEM_TYPE_MAX]; }; - PoolVector<uint8_t> cluster_data; + Vector<uint8_t> cluster_data; RID cluster_texture; struct SortID { @@ -114,7 +114,7 @@ private: }; SortID *sort_ids = nullptr; - PoolVector<uint32_t> ids; + Vector<uint32_t> ids; uint32_t sort_id_count = 0; uint32_t sort_id_max = 0; RID items_buffer; diff --git a/servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp index 7012cb04cd..425221608b 100644 --- a/servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp +++ b/servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp @@ -271,7 +271,7 @@ RasterizerCanvas::PolygonID RasterizerCanvasRD::request_polygon(const Vector<int uint32_t buffer_size = stride * p_points.size(); - PoolVector<uint8_t> polygon_buffer; + Vector<uint8_t> polygon_buffer; polygon_buffer.resize(buffer_size * sizeof(float)); Vector<RD::VertexDescription> descriptions; descriptions.resize(4); @@ -279,9 +279,9 @@ RasterizerCanvas::PolygonID RasterizerCanvasRD::request_polygon(const Vector<int buffers.resize(4); { - PoolVector<uint8_t>::Read r = polygon_buffer.read(); - float *fptr = (float *)r.ptr(); - uint32_t *uptr = (uint32_t *)r.ptr(); + const uint8_t *r = polygon_buffer.ptr(); + float *fptr = (float *)r; + uint32_t *uptr = (uint32_t *)r; uint32_t base_offset = 0; { //vertices RD::VertexDescription vd; @@ -430,11 +430,11 @@ RasterizerCanvas::PolygonID RasterizerCanvasRD::request_polygon(const Vector<int if (p_indices.size()) { //create indices, as indices were requested - PoolVector<uint8_t> index_buffer; + Vector<uint8_t> index_buffer; index_buffer.resize(p_indices.size() * sizeof(int32_t)); { - PoolVector<uint8_t>::Write w = index_buffer.write(); - copymem(w.ptr(), p_indices.ptr(), sizeof(int32_t) * p_indices.size()); + uint8_t *w = index_buffer.ptrw(); + copymem(w, p_indices.ptr(), sizeof(int32_t) * p_indices.size()); } pb.index_buffer = RD::get_singleton()->index_buffer_create(p_indices.size(), RD::INDEX_BUFFER_FORMAT_UINT32, index_buffer); pb.indices = RD::get_singleton()->index_array_create(pb.index_buffer, 0, p_indices.size()); @@ -1707,7 +1707,7 @@ RID RasterizerCanvasRD::occluder_polygon_create() { return occluder_polygon_owner.make_rid(occluder); } -void RasterizerCanvasRD::occluder_polygon_set_shape_as_lines(RID p_occluder, const PoolVector<Vector2> &p_lines) { +void RasterizerCanvasRD::occluder_polygon_set_shape_as_lines(RID p_occluder, const Vector<Vector2> &p_lines) { OccluderPolygon *oc = occluder_polygon_owner.getornull(p_occluder); ERR_FAIL_COND(!oc); @@ -1727,20 +1727,20 @@ void RasterizerCanvasRD::occluder_polygon_set_shape_as_lines(RID p_occluder, con if (p_lines.size()) { - PoolVector<uint8_t> geometry; - PoolVector<uint8_t> indices; + Vector<uint8_t> geometry; + Vector<uint8_t> indices; int lc = p_lines.size(); geometry.resize(lc * 6 * sizeof(float)); indices.resize(lc * 3 * sizeof(uint16_t)); { - PoolVector<uint8_t>::Write vw = geometry.write(); - float *vwptr = (float *)vw.ptr(); - PoolVector<uint8_t>::Write iw = indices.write(); - uint16_t *iwptr = (uint16_t *)iw.ptr(); + uint8_t *vw = geometry.ptrw(); + float *vwptr = (float *)vw; + uint8_t *iw = indices.ptrw(); + uint16_t *iwptr = (uint16_t *)iw; - PoolVector<Vector2>::Read lr = p_lines.read(); + const Vector2 *lr = p_lines.ptr(); const int POLY_HEIGHT = 16384; @@ -1789,10 +1789,10 @@ void RasterizerCanvasRD::occluder_polygon_set_shape_as_lines(RID p_occluder, con } else { //update existing - PoolVector<uint8_t>::Read vr = geometry.read(); - RD::get_singleton()->buffer_update(oc->vertex_buffer, 0, geometry.size(), vr.ptr()); - PoolVector<uint8_t>::Read ir = indices.read(); - RD::get_singleton()->buffer_update(oc->index_buffer, 0, indices.size(), ir.ptr()); + const uint8_t *vr = geometry.ptr(); + RD::get_singleton()->buffer_update(oc->vertex_buffer, 0, geometry.size(), vr); + const uint8_t *ir = indices.ptr(); + RD::get_singleton()->buffer_update(oc->index_buffer, 0, indices.size(), ir); } } } @@ -2431,11 +2431,11 @@ RasterizerCanvasRD::RasterizerCanvasRD(RasterizerStorageRD *p_storage) { { // default index buffer - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; pv.resize(6 * 4); { - PoolVector<uint8_t>::Write w = pv.write(); - int *p32 = (int *)w.ptr(); + uint8_t *w = pv.ptrw(); + int *p32 = (int *)w; p32[0] = 0; p32[1] = 1; p32[2] = 2; @@ -2482,7 +2482,7 @@ bool RasterizerCanvasRD::free(RID p_rid) { light_set_use_shadow(p_rid, false, 64); canvas_light_owner.free(p_rid); } else if (occluder_polygon_owner.owns(p_rid)) { - occluder_polygon_set_shape_as_lines(p_rid, PoolVector<Vector2>()); + occluder_polygon_set_shape_as_lines(p_rid, Vector<Vector2>()); occluder_polygon_owner.free(p_rid); } else { return false; diff --git a/servers/visual/rasterizer_rd/rasterizer_canvas_rd.h b/servers/visual/rasterizer_rd/rasterizer_canvas_rd.h index 17560ea540..894a00a436 100644 --- a/servers/visual/rasterizer_rd/rasterizer_canvas_rd.h +++ b/servers/visual/rasterizer_rd/rasterizer_canvas_rd.h @@ -482,7 +482,7 @@ public: void light_update_shadow(RID p_rid, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders); RID occluder_polygon_create(); - void occluder_polygon_set_shape_as_lines(RID p_occluder, const PoolVector<Vector2> &p_lines); + void occluder_polygon_set_shape_as_lines(RID p_occluder, const Vector<Vector2> &p_lines); void occluder_polygon_set_cull_mode(RID p_occluder, VS::CanvasOccluderPolygonCullMode p_mode); void canvas_render_items(RID p_to_render_target, Item *p_item_list, const Color &p_modulate, Light *p_light_list, const Transform2D &p_canvas_transform); diff --git a/servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp index 4b8b3334b5..c05f5cead0 100644 --- a/servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp +++ b/servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp @@ -955,11 +955,11 @@ RasterizerEffectsRD::RasterizerEffectsRD() { default_mipmap_sampler = RD::get_singleton()->sampler_create(sampler); { //create index array for copy shaders - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; pv.resize(6 * 4); { - PoolVector<uint8_t>::Write w = pv.write(); - int *p32 = (int *)w.ptr(); + uint8_t *w = pv.ptrw(); + int *p32 = (int *)w; p32[0] = 0; p32[1] = 1; p32[2] = 2; diff --git a/servers/visual/rasterizer_rd/rasterizer_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_rd.cpp index 34be4817f6..de31d9b3b7 100644 --- a/servers/visual/rasterizer_rd/rasterizer_rd.cpp +++ b/servers/visual/rasterizer_rd/rasterizer_rd.cpp @@ -128,11 +128,11 @@ void RasterizerRD::initialize() { } { //create index array for copy shader - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; pv.resize(6 * 4); { - PoolVector<uint8_t>::Write w = pv.write(); - int *p32 = (int *)w.ptr(); + uint8_t *w = pv.ptrw(); + int *p32 = (int *)w; p32[0] = 0; p32[1] = 1; p32[2] = 2; diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp index 317ffb994f..7d5593c239 100644 --- a/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp +++ b/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp @@ -1406,7 +1406,7 @@ void RasterizerSceneRD::gi_probe_update(RID p_probe, bool p_update_light_instanc if (octree_size != Vector3i()) { //can create a 3D texture - PoolVector<int> levels = storage->gi_probe_get_level_counts(gi_probe->probe); + Vector<int> levels = storage->gi_probe_get_level_counts(gi_probe->probe); RD::TextureFormat tf; tf.format = RD::DATA_FORMAT_R8G8B8A8_UNORM; diff --git a/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp index 5203873b7b..9f6b1a2b35 100644 --- a/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp +++ b/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp @@ -584,8 +584,8 @@ RID RasterizerStorageRD::texture_2d_create(const Ref<Image> &p_image) { rd_view.swizzle_b = ret_format.swizzle_b; rd_view.swizzle_a = ret_format.swizzle_a; } - PoolVector<uint8_t> data = image->get_data(); //use image data - Vector<PoolVector<uint8_t> > data_slices; + Vector<uint8_t> data = image->get_data(); //use image data + Vector<Vector<uint8_t> > data_slices; data_slices.push_back(data); texture.rd_texture = RD::get_singleton()->texture_create(rd_format, rd_view, data_slices); ERR_FAIL_COND_V(texture.rd_texture.is_null(), RID()); @@ -720,13 +720,12 @@ RID RasterizerStorageRD::texture_2d_placeholder_create() { Ref<Image> image; image.instance(); image->create(4, 4, false, Image::FORMAT_RGBA8); - image->lock(); + for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { image->set_pixel(i, j, Color(1, 0, 1, 1)); } } - image->unlock(); return texture_2d_create(image); } @@ -749,7 +748,7 @@ Ref<Image> RasterizerStorageRD::texture_2d_get(RID p_texture) const { return tex->image_cache_2d; } #endif - PoolVector<uint8_t> data = RD::get_singleton()->texture_get_data(tex->rd_texture, 0); + Vector<uint8_t> data = RD::get_singleton()->texture_get_data(tex->rd_texture, 0); ERR_FAIL_COND_V(data.size() == 0, Ref<Image>()); Ref<Image> image; image.instance(); @@ -1195,11 +1194,11 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy } break; case ShaderLanguage::TYPE_IVEC2: { - PoolVector<int> iv = value; + Vector<int> iv = value; int s = iv.size(); int32_t *gui = (int32_t *)data; - PoolVector<int>::Read r = iv.read(); + const int *r = iv.ptr(); for (int i = 0; i < 2; i++) { if (i < s) @@ -1211,11 +1210,11 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy } break; case ShaderLanguage::TYPE_IVEC3: { - PoolVector<int> iv = value; + Vector<int> iv = value; int s = iv.size(); int32_t *gui = (int32_t *)data; - PoolVector<int>::Read r = iv.read(); + const int *r = iv.ptr(); for (int i = 0; i < 3; i++) { if (i < s) @@ -1226,11 +1225,11 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy } break; case ShaderLanguage::TYPE_IVEC4: { - PoolVector<int> iv = value; + Vector<int> iv = value; int s = iv.size(); int32_t *gui = (int32_t *)data; - PoolVector<int>::Read r = iv.read(); + const int *r = iv.ptr(); for (int i = 0; i < 4; i++) { if (i < s) @@ -1248,11 +1247,11 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy } break; case ShaderLanguage::TYPE_UVEC2: { - PoolVector<int> iv = value; + Vector<int> iv = value; int s = iv.size(); uint32_t *gui = (uint32_t *)data; - PoolVector<int>::Read r = iv.read(); + const int *r = iv.ptr(); for (int i = 0; i < 2; i++) { if (i < s) @@ -1262,11 +1261,11 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy } } break; case ShaderLanguage::TYPE_UVEC3: { - PoolVector<int> iv = value; + Vector<int> iv = value; int s = iv.size(); uint32_t *gui = (uint32_t *)data; - PoolVector<int>::Read r = iv.read(); + const int *r = iv.ptr(); for (int i = 0; i < 3; i++) { if (i < s) @@ -1277,11 +1276,11 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy } break; case ShaderLanguage::TYPE_UVEC4: { - PoolVector<int> iv = value; + Vector<int> iv = value; int s = iv.size(); uint32_t *gui = (uint32_t *)data; - PoolVector<int>::Read r = iv.read(); + const int *r = iv.ptr(); for (int i = 0; i < 4; i++) { if (i < s) @@ -1955,15 +1954,15 @@ VS::BlendShapeMode RasterizerStorageRD::mesh_get_blend_shape_mode(RID p_mesh) co return mesh->blend_shape_mode; } -void RasterizerStorageRD::mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) { +void RasterizerStorageRD::mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) { Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND(!mesh); ERR_FAIL_UNSIGNED_INDEX((uint32_t)p_surface, mesh->surface_count); ERR_FAIL_COND(p_data.size() == 0); uint64_t data_size = p_data.size(); - PoolVector<uint8_t>::Read r = p_data.read(); + const uint8_t *r = p_data.ptr(); - RD::get_singleton()->buffer_update(mesh->surfaces[p_surface]->vertex_buffer, p_offset, data_size, r.ptr()); + RD::get_singleton()->buffer_update(mesh->surfaces[p_surface]->vertex_buffer, p_offset, data_size, r); } void RasterizerStorageRD::mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) { @@ -2012,7 +2011,7 @@ VS::SurfaceData RasterizerStorageRD::mesh_get_surface(RID p_mesh, int p_surface) sd.bone_aabbs = s.bone_aabbs; for (int i = 0; i < s.blend_shapes.size(); i++) { - PoolVector<uint8_t> bs = RD::get_singleton()->buffer_get_data(s.blend_shapes[i]); + Vector<uint8_t> bs = RD::get_singleton()->buffer_get_data(s.blend_shapes[i]); sd.blend_shapes.push_back(bs); } @@ -2386,7 +2385,7 @@ void RasterizerStorageRD::multimesh_allocate(RID p_multimesh, int p_instances, V multimesh->buffer_set = false; //print_line("allocate, elements: " + itos(p_instances) + " 2D: " + itos(p_transform_format == VS::MULTIMESH_TRANSFORM_2D) + " colors " + itos(multimesh->uses_colors) + " data " + itos(multimesh->uses_custom_data) + " stride " + itos(multimesh->stride_cache) + " total size " + itos(multimesh->stride_cache * multimesh->instances)); - multimesh->data_cache = PoolVector<float>(); + multimesh->data_cache = Vector<float>(); multimesh->aabb = AABB(); multimesh->aabb_dirty = false; multimesh->visible_instances = MIN(multimesh->visible_instances, multimesh->instances); @@ -2421,9 +2420,9 @@ void RasterizerStorageRD::multimesh_set_mesh(RID p_multimesh, RID p_mesh) { } else if (multimesh->instances) { //need to re-create AABB unfortunately, calling this has a penalty if (multimesh->buffer_set) { - PoolVector<uint8_t> buffer = RD::get_singleton()->buffer_get_data(multimesh->buffer); - PoolVector<uint8_t>::Read r = buffer.read(); - const float *data = (const float *)r.ptr(); + Vector<uint8_t> buffer = RD::get_singleton()->buffer_get_data(multimesh->buffer); + const uint8_t *r = buffer.ptr(); + const float *data = (const float *)r; _multimesh_re_create_aabb(multimesh, data, multimesh->instances); } } @@ -2442,17 +2441,17 @@ void RasterizerStorageRD::_multimesh_make_local(MultiMesh *multimesh) const { // for this, the data must reside on CPU, so just copy it there. multimesh->data_cache.resize(multimesh->instances * multimesh->stride_cache); { - PoolVector<float>::Write w = multimesh->data_cache.write(); + float *w = multimesh->data_cache.ptrw(); if (multimesh->buffer_set) { - PoolVector<uint8_t> buffer = RD::get_singleton()->buffer_get_data(multimesh->buffer); + Vector<uint8_t> buffer = RD::get_singleton()->buffer_get_data(multimesh->buffer); { - PoolVector<uint8_t>::Read r = buffer.read(); - copymem(w.ptr(), r.ptr(), buffer.size()); + const uint8_t *r = buffer.ptr(); + copymem(w, r, buffer.size()); } } else { - zeromem(w.ptr(), multimesh->instances * multimesh->stride_cache * sizeof(float)); + zeromem(w, multimesh->instances * multimesh->stride_cache * sizeof(float)); } } uint32_t data_cache_dirty_region_count = (multimesh->instances - 1) / MULTIMESH_DIRTY_REGION_SIZE + 1; @@ -2564,9 +2563,9 @@ void RasterizerStorageRD::multimesh_instance_set_transform(RID p_multimesh, int _multimesh_make_local(multimesh); { - PoolVector<float>::Write w = multimesh->data_cache.write(); + float *w = multimesh->data_cache.ptrw(); - float *dataptr = w.ptr() + p_index * multimesh->stride_cache; + float *dataptr = w + p_index * multimesh->stride_cache; dataptr[0] = p_transform.basis.elements[0][0]; dataptr[1] = p_transform.basis.elements[0][1]; @@ -2595,9 +2594,9 @@ void RasterizerStorageRD::multimesh_instance_set_transform_2d(RID p_multimesh, i _multimesh_make_local(multimesh); { - PoolVector<float>::Write w = multimesh->data_cache.write(); + float *w = multimesh->data_cache.ptrw(); - float *dataptr = w.ptr() + p_index * multimesh->stride_cache; + float *dataptr = w + p_index * multimesh->stride_cache; dataptr[0] = p_transform.elements[0][0]; dataptr[1] = p_transform.elements[1][0]; @@ -2621,9 +2620,9 @@ void RasterizerStorageRD::multimesh_instance_set_color(RID p_multimesh, int p_in _multimesh_make_local(multimesh); { - PoolVector<float>::Write w = multimesh->data_cache.write(); + float *w = multimesh->data_cache.ptrw(); - float *dataptr = w.ptr() + p_index * multimesh->stride_cache + multimesh->color_offset_cache; + float *dataptr = w + p_index * multimesh->stride_cache + multimesh->color_offset_cache; dataptr[0] = p_color.r; dataptr[1] = p_color.g; @@ -2642,9 +2641,9 @@ void RasterizerStorageRD::multimesh_instance_set_custom_data(RID p_multimesh, in _multimesh_make_local(multimesh); { - PoolVector<float>::Write w = multimesh->data_cache.write(); + float *w = multimesh->data_cache.ptrw(); - float *dataptr = w.ptr() + p_index * multimesh->stride_cache + multimesh->custom_data_offset_cache; + float *dataptr = w + p_index * multimesh->stride_cache + multimesh->custom_data_offset_cache; dataptr[0] = p_color.r; dataptr[1] = p_color.g; @@ -2674,9 +2673,9 @@ Transform RasterizerStorageRD::multimesh_instance_get_transform(RID p_multimesh, Transform t; { - PoolVector<float>::Read r = multimesh->data_cache.read(); + const float *r = multimesh->data_cache.ptr(); - const float *dataptr = r.ptr() + p_index * multimesh->stride_cache; + const float *dataptr = r + p_index * multimesh->stride_cache; t.basis.elements[0][0] = dataptr[0]; t.basis.elements[0][1] = dataptr[1]; @@ -2705,9 +2704,9 @@ Transform2D RasterizerStorageRD::multimesh_instance_get_transform_2d(RID p_multi Transform2D t; { - PoolVector<float>::Read r = multimesh->data_cache.read(); + const float *r = multimesh->data_cache.ptr(); - const float *dataptr = r.ptr() + p_index * multimesh->stride_cache; + const float *dataptr = r + p_index * multimesh->stride_cache; t.elements[0][0] = dataptr[0]; t.elements[1][0] = dataptr[1]; @@ -2730,9 +2729,9 @@ Color RasterizerStorageRD::multimesh_instance_get_color(RID p_multimesh, int p_i Color c; { - PoolVector<float>::Read r = multimesh->data_cache.read(); + const float *r = multimesh->data_cache.ptr(); - const float *dataptr = r.ptr() + p_index * multimesh->stride_cache + multimesh->color_offset_cache; + const float *dataptr = r + p_index * multimesh->stride_cache + multimesh->color_offset_cache; c.r = dataptr[0]; c.g = dataptr[1]; @@ -2753,9 +2752,9 @@ Color RasterizerStorageRD::multimesh_instance_get_custom_data(RID p_multimesh, i Color c; { - PoolVector<float>::Read r = multimesh->data_cache.read(); + const float *r = multimesh->data_cache.ptr(); - const float *dataptr = r.ptr() + p_index * multimesh->stride_cache + multimesh->custom_data_offset_cache; + const float *dataptr = r + p_index * multimesh->stride_cache + multimesh->custom_data_offset_cache; c.r = dataptr[0]; c.g = dataptr[1]; @@ -2766,14 +2765,14 @@ Color RasterizerStorageRD::multimesh_instance_get_custom_data(RID p_multimesh, i return c; } -void RasterizerStorageRD::multimesh_set_buffer(RID p_multimesh, const PoolVector<float> &p_buffer) { +void RasterizerStorageRD::multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_buffer) { MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); ERR_FAIL_COND(!multimesh); ERR_FAIL_COND(p_buffer.size() != (multimesh->instances * (int)multimesh->stride_cache)); { - PoolVector<float>::Read r = p_buffer.read(); - RD::get_singleton()->buffer_update(multimesh->buffer, 0, p_buffer.size() * sizeof(float), r.ptr(), false); + const float *r = p_buffer.ptr(); + RD::get_singleton()->buffer_update(multimesh->buffer, 0, p_buffer.size() * sizeof(float), r, false); multimesh->buffer_set = true; } @@ -2792,30 +2791,30 @@ void RasterizerStorageRD::multimesh_set_buffer(RID p_multimesh, const PoolVector _multimesh_mark_all_dirty(multimesh, false, true); //update AABB } else if (multimesh->mesh.is_valid()) { //if we have a mesh set, we need to re-generate the AABB from the new data - PoolVector<float>::Read r = p_buffer.read(); - const float *data = r.ptr(); + const float *data = p_buffer.ptr(); + _multimesh_re_create_aabb(multimesh, data, multimesh->instances); multimesh->instance_dependency.instance_notify_changed(true, false); } } -PoolVector<float> RasterizerStorageRD::multimesh_get_buffer(RID p_multimesh) const { +Vector<float> RasterizerStorageRD::multimesh_get_buffer(RID p_multimesh) const { MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); - ERR_FAIL_COND_V(!multimesh, PoolVector<float>()); + ERR_FAIL_COND_V(!multimesh, Vector<float>()); if (multimesh->buffer.is_null()) { - return PoolVector<float>(); + return Vector<float>(); } else if (multimesh->data_cache.size()) { return multimesh->data_cache; } else { //get from memory - PoolVector<uint8_t> buffer = RD::get_singleton()->buffer_get_data(multimesh->buffer); - PoolVector<float> ret; + Vector<uint8_t> buffer = RD::get_singleton()->buffer_get_data(multimesh->buffer); + Vector<float> ret; ret.resize(multimesh->instances); { - PoolVector<float>::Write w = multimesh->data_cache.write(); - PoolVector<uint8_t>::Read r = buffer.read(); - copymem(w.ptr(), r.ptr(), buffer.size()); + float *w = multimesh->data_cache.ptrw(); + const uint8_t *r = buffer.ptr(); + copymem(w, r, buffer.size()); } return ret; @@ -2860,8 +2859,7 @@ void RasterizerStorageRD::_update_dirty_multimeshes() { MultiMesh *multimesh = multimesh_dirty_list; if (multimesh->data_cache.size()) { //may have been cleared, so only process if it exists - PoolVector<float>::Read r = multimesh->data_cache.read(); - const float *data = r.ptr(); + const float *data = multimesh->data_cache.ptr(); uint32_t visible_instances = multimesh->visible_instances >= 0 ? multimesh->visible_instances : multimesh->instances; @@ -3552,7 +3550,7 @@ RID RasterizerStorageRD::gi_probe_create() { return gi_probe_owner.make_rid(GIProbe()); } -void RasterizerStorageRD::gi_probe_allocate(RID p_gi_probe, const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3i &p_octree_size, const PoolVector<uint8_t> &p_octree_cells, const PoolVector<uint8_t> &p_data_cells, const PoolVector<uint8_t> &p_distance_field, const PoolVector<int> &p_level_counts) { +void RasterizerStorageRD::gi_probe_allocate(RID p_gi_probe, const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3i &p_octree_size, const Vector<uint8_t> &p_octree_cells, const Vector<uint8_t> &p_data_cells, const Vector<uint8_t> &p_distance_field, const Vector<int> &p_level_counts) { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND(!gi_probe); @@ -3597,7 +3595,7 @@ void RasterizerStorageRD::gi_probe_allocate(RID p_gi_probe, const Transform &p_t tf.depth = gi_probe->octree_size.z; tf.type = RD::TEXTURE_TYPE_3D; tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_UPDATE_BIT | RD::TEXTURE_USAGE_CAN_COPY_FROM_BIT; - Vector<PoolVector<uint8_t> > s; + Vector<Vector<uint8_t> > s; s.push_back(p_distance_field); gi_probe->sdf_texture = RD::get_singleton()->texture_create(tf, RD::TextureView(), s); } @@ -3690,36 +3688,36 @@ Vector3i RasterizerStorageRD::gi_probe_get_octree_size(RID p_gi_probe) const { ERR_FAIL_COND_V(!gi_probe, Vector3i()); return gi_probe->octree_size; } -PoolVector<uint8_t> RasterizerStorageRD::gi_probe_get_octree_cells(RID p_gi_probe) const { +Vector<uint8_t> RasterizerStorageRD::gi_probe_get_octree_cells(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); - ERR_FAIL_COND_V(!gi_probe, PoolVector<uint8_t>()); + ERR_FAIL_COND_V(!gi_probe, Vector<uint8_t>()); if (gi_probe->octree_buffer.is_valid()) { return RD::get_singleton()->buffer_get_data(gi_probe->octree_buffer); } - return PoolVector<uint8_t>(); + return Vector<uint8_t>(); } -PoolVector<uint8_t> RasterizerStorageRD::gi_probe_get_data_cells(RID p_gi_probe) const { +Vector<uint8_t> RasterizerStorageRD::gi_probe_get_data_cells(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); - ERR_FAIL_COND_V(!gi_probe, PoolVector<uint8_t>()); + ERR_FAIL_COND_V(!gi_probe, Vector<uint8_t>()); if (gi_probe->data_buffer.is_valid()) { return RD::get_singleton()->buffer_get_data(gi_probe->data_buffer); } - return PoolVector<uint8_t>(); + return Vector<uint8_t>(); } -PoolVector<uint8_t> RasterizerStorageRD::gi_probe_get_distance_field(RID p_gi_probe) const { +Vector<uint8_t> RasterizerStorageRD::gi_probe_get_distance_field(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); - ERR_FAIL_COND_V(!gi_probe, PoolVector<uint8_t>()); + ERR_FAIL_COND_V(!gi_probe, Vector<uint8_t>()); if (gi_probe->data_buffer.is_valid()) { return RD::get_singleton()->texture_get_data(gi_probe->sdf_texture, 0); } - return PoolVector<uint8_t>(); + return Vector<uint8_t>(); } -PoolVector<int> RasterizerStorageRD::gi_probe_get_level_counts(RID p_gi_probe) const { +Vector<int> RasterizerStorageRD::gi_probe_get_level_counts(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); - ERR_FAIL_COND_V(!gi_probe, PoolVector<int>()); + ERR_FAIL_COND_V(!gi_probe, Vector<int>()); return gi_probe->level_counts; } @@ -4387,7 +4385,7 @@ bool RasterizerStorageRD::free(RID p_rid) { reflection_probe->instance_dependency.instance_notify_deleted(p_rid); reflection_probe_owner.free(p_rid); } else if (gi_probe_owner.owns(p_rid)) { - gi_probe_allocate(p_rid, Transform(), AABB(), Vector3i(), PoolVector<uint8_t>(), PoolVector<uint8_t>(), PoolVector<uint8_t>(), PoolVector<int>()); //deallocate + gi_probe_allocate(p_rid, Transform(), AABB(), Vector3i(), Vector<uint8_t>(), Vector<uint8_t>(), Vector<uint8_t>(), Vector<int>()); //deallocate GIProbe *gi_probe = gi_probe_owner.getornull(p_rid); gi_probe->instance_dependency.instance_notify_deleted(p_rid); gi_probe_owner.free(p_rid); @@ -4463,7 +4461,7 @@ RasterizerStorageRD::RasterizerStorageRD() { tformat.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_UPDATE_BIT; tformat.type = RD::TEXTURE_TYPE_2D; - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; pv.resize(16 * 4); for (int i = 0; i < 16; i++) { pv.set(i * 4 + 0, 255); @@ -4473,7 +4471,7 @@ RasterizerStorageRD::RasterizerStorageRD() { } { - Vector<PoolVector<uint8_t> > vpv; + Vector<Vector<uint8_t> > vpv; vpv.push_back(pv); default_rd_textures[DEFAULT_RD_TEXTURE_WHITE] = RD::get_singleton()->texture_create(tformat, RD::TextureView(), vpv); } @@ -4486,7 +4484,7 @@ RasterizerStorageRD::RasterizerStorageRD() { } { - Vector<PoolVector<uint8_t> > vpv; + Vector<Vector<uint8_t> > vpv; vpv.push_back(pv); default_rd_textures[DEFAULT_RD_TEXTURE_BLACK] = RD::get_singleton()->texture_create(tformat, RD::TextureView(), vpv); } @@ -4499,7 +4497,7 @@ RasterizerStorageRD::RasterizerStorageRD() { } { - Vector<PoolVector<uint8_t> > vpv; + Vector<Vector<uint8_t> > vpv; vpv.push_back(pv); default_rd_textures[DEFAULT_RD_TEXTURE_NORMAL] = RD::get_singleton()->texture_create(tformat, RD::TextureView(), vpv); } @@ -4512,7 +4510,7 @@ RasterizerStorageRD::RasterizerStorageRD() { } { - Vector<PoolVector<uint8_t> > vpv; + Vector<Vector<uint8_t> > vpv; vpv.push_back(pv); default_rd_textures[DEFAULT_RD_TEXTURE_ANISO] = RD::get_singleton()->texture_create(tformat, RD::TextureView(), vpv); } @@ -4537,7 +4535,7 @@ RasterizerStorageRD::RasterizerStorageRD() { tformat.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_UPDATE_BIT; tformat.type = RD::TEXTURE_TYPE_CUBE_ARRAY; - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; pv.resize(16 * 4); for (int i = 0; i < 16; i++) { pv.set(i * 4 + 0, 0); @@ -4547,7 +4545,7 @@ RasterizerStorageRD::RasterizerStorageRD() { } { - Vector<PoolVector<uint8_t> > vpv; + Vector<Vector<uint8_t> > vpv; for (int i = 0; i < 6; i++) { vpv.push_back(pv); } @@ -4565,7 +4563,7 @@ RasterizerStorageRD::RasterizerStorageRD() { tformat.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_UPDATE_BIT; tformat.type = RD::TEXTURE_TYPE_CUBE; - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; pv.resize(16 * 4); for (int i = 0; i < 16; i++) { pv.set(i * 4 + 0, 0); @@ -4575,7 +4573,7 @@ RasterizerStorageRD::RasterizerStorageRD() { } { - Vector<PoolVector<uint8_t> > vpv; + Vector<Vector<uint8_t> > vpv; for (int i = 0; i < 6; i++) { vpv.push_back(pv); } @@ -4593,7 +4591,7 @@ RasterizerStorageRD::RasterizerStorageRD() { tformat.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_UPDATE_BIT; tformat.type = RD::TEXTURE_TYPE_3D; - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; pv.resize(64 * 4); for (int i = 0; i < 64; i++) { pv.set(i * 4 + 0, 0); @@ -4603,7 +4601,7 @@ RasterizerStorageRD::RasterizerStorageRD() { } { - Vector<PoolVector<uint8_t> > vpv; + Vector<Vector<uint8_t> > vpv; vpv.push_back(pv); default_rd_textures[DEFAULT_RD_TEXTURE_3D_WHITE] = RD::get_singleton()->texture_create(tformat, RD::TextureView(), vpv); } @@ -4682,11 +4680,11 @@ RasterizerStorageRD::RasterizerStorageRD() { { //vertex - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; buffer.resize(sizeof(float) * 3); { - PoolVector<uint8_t>::Write w = buffer.write(); - float *fptr = (float *)w.ptr(); + uint8_t *w = buffer.ptrw(); + float *fptr = (float *)w; fptr[0] = 0.0; fptr[1] = 0.0; fptr[2] = 0.0; @@ -4695,11 +4693,11 @@ RasterizerStorageRD::RasterizerStorageRD() { } { //normal - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; buffer.resize(sizeof(float) * 3); { - PoolVector<uint8_t>::Write w = buffer.write(); - float *fptr = (float *)w.ptr(); + uint8_t *w = buffer.ptrw(); + float *fptr = (float *)w; fptr[0] = 1.0; fptr[1] = 0.0; fptr[2] = 0.0; @@ -4708,11 +4706,11 @@ RasterizerStorageRD::RasterizerStorageRD() { } { //tangent - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; buffer.resize(sizeof(float) * 4); { - PoolVector<uint8_t>::Write w = buffer.write(); - float *fptr = (float *)w.ptr(); + uint8_t *w = buffer.ptrw(); + float *fptr = (float *)w; fptr[0] = 1.0; fptr[1] = 0.0; fptr[2] = 0.0; @@ -4722,11 +4720,11 @@ RasterizerStorageRD::RasterizerStorageRD() { } { //color - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; buffer.resize(sizeof(float) * 4); { - PoolVector<uint8_t>::Write w = buffer.write(); - float *fptr = (float *)w.ptr(); + uint8_t *w = buffer.ptrw(); + float *fptr = (float *)w; fptr[0] = 1.0; fptr[1] = 1.0; fptr[2] = 1.0; @@ -4736,22 +4734,22 @@ RasterizerStorageRD::RasterizerStorageRD() { } { //tex uv 1 - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; buffer.resize(sizeof(float) * 2); { - PoolVector<uint8_t>::Write w = buffer.write(); - float *fptr = (float *)w.ptr(); + uint8_t *w = buffer.ptrw(); + float *fptr = (float *)w; fptr[0] = 0.0; fptr[1] = 0.0; } mesh_default_rd_buffers[DEFAULT_RD_BUFFER_TEX_UV] = RD::get_singleton()->vertex_buffer_create(buffer.size(), buffer); } { //tex uv 2 - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; buffer.resize(sizeof(float) * 2); { - PoolVector<uint8_t>::Write w = buffer.write(); - float *fptr = (float *)w.ptr(); + uint8_t *w = buffer.ptrw(); + float *fptr = (float *)w; fptr[0] = 0.0; fptr[1] = 0.0; } @@ -4759,11 +4757,11 @@ RasterizerStorageRD::RasterizerStorageRD() { } { //bones - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; buffer.resize(sizeof(uint32_t) * 4); { - PoolVector<uint8_t>::Write w = buffer.write(); - uint32_t *fptr = (uint32_t *)w.ptr(); + uint8_t *w = buffer.ptrw(); + uint32_t *fptr = (uint32_t *)w; fptr[0] = 0; fptr[1] = 0; fptr[2] = 0; @@ -4773,11 +4771,11 @@ RasterizerStorageRD::RasterizerStorageRD() { } { //weights - PoolVector<uint8_t> buffer; + Vector<uint8_t> buffer; buffer.resize(sizeof(float) * 4); { - PoolVector<uint8_t>::Write w = buffer.write(); - float *fptr = (float *)w.ptr(); + uint8_t *w = buffer.ptrw(); + float *fptr = (float *)w; fptr[0] = 0.0; fptr[1] = 0.0; fptr[2] = 0.0; diff --git a/servers/visual/rasterizer_rd/rasterizer_storage_rd.h b/servers/visual/rasterizer_rd/rasterizer_storage_rd.h index 055737d65d..48097ffaac 100644 --- a/servers/visual/rasterizer_rd/rasterizer_storage_rd.h +++ b/servers/visual/rasterizer_rd/rasterizer_storage_rd.h @@ -306,7 +306,7 @@ private: uint32_t color_offset_cache = 0; uint32_t custom_data_offset_cache = 0; - PoolVector<float> data_cache; //used if individual setting is used + Vector<float> data_cache; //used if individual setting is used bool *data_cache_dirty_regions = nullptr; uint32_t data_cache_used_dirty_regions = 0; @@ -413,7 +413,7 @@ private: uint32_t octree_buffer_size = 0; uint32_t data_buffer_size = 0; - PoolVector<int> level_counts; + Vector<int> level_counts; int cell_count = 0; @@ -621,7 +621,7 @@ public: virtual void mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode); virtual VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const; - virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data); + virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data); virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material); virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const; @@ -747,8 +747,8 @@ public: Color multimesh_instance_get_color(RID p_multimesh, int p_index) const; Color multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const; - void multimesh_set_buffer(RID p_multimesh, const PoolVector<float> &p_buffer); - PoolVector<float> multimesh_get_buffer(RID p_multimesh) const; + void multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_buffer); + Vector<float> multimesh_get_buffer(RID p_multimesh) const; void multimesh_set_visible_instances(RID p_multimesh, int p_visible); int multimesh_get_visible_instances(RID p_multimesh) const; @@ -969,15 +969,15 @@ public: RID gi_probe_create(); - void gi_probe_allocate(RID p_gi_probe, const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3i &p_octree_size, const PoolVector<uint8_t> &p_octree_cells, const PoolVector<uint8_t> &p_data_cells, const PoolVector<uint8_t> &p_distance_field, const PoolVector<int> &p_level_counts); + void gi_probe_allocate(RID p_gi_probe, const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3i &p_octree_size, const Vector<uint8_t> &p_octree_cells, const Vector<uint8_t> &p_data_cells, const Vector<uint8_t> &p_distance_field, const Vector<int> &p_level_counts); AABB gi_probe_get_bounds(RID p_gi_probe) const; Vector3i gi_probe_get_octree_size(RID p_gi_probe) const; - PoolVector<uint8_t> gi_probe_get_octree_cells(RID p_gi_probe) const; - PoolVector<uint8_t> gi_probe_get_data_cells(RID p_gi_probe) const; - PoolVector<uint8_t> gi_probe_get_distance_field(RID p_gi_probe) const; + Vector<uint8_t> gi_probe_get_octree_cells(RID p_gi_probe) const; + Vector<uint8_t> gi_probe_get_data_cells(RID p_gi_probe) const; + Vector<uint8_t> gi_probe_get_distance_field(RID p_gi_probe) const; - PoolVector<int> gi_probe_get_level_counts(RID p_gi_probe) const; + Vector<int> gi_probe_get_level_counts(RID p_gi_probe) const; Transform gi_probe_get_to_cell_xform(RID p_gi_probe) const; void gi_probe_set_dynamic_range(RID p_gi_probe, float p_range); @@ -1022,12 +1022,12 @@ public: void lightmap_capture_set_bounds(RID p_capture, const AABB &p_bounds) {} AABB lightmap_capture_get_bounds(RID p_capture) const { return AABB(); } - void lightmap_capture_set_octree(RID p_capture, const PoolVector<uint8_t> &p_octree) {} + void lightmap_capture_set_octree(RID p_capture, const Vector<uint8_t> &p_octree) {} RID lightmap_capture_create() { return RID(); } - PoolVector<uint8_t> lightmap_capture_get_octree(RID p_capture) const { - return PoolVector<uint8_t>(); + Vector<uint8_t> lightmap_capture_get_octree(RID p_capture) const { + return Vector<uint8_t>(); } void lightmap_capture_set_octree_cell_transform(RID p_capture, const Transform &p_xform) {} Transform lightmap_capture_get_octree_cell_transform(RID p_capture) const { return Transform(); } @@ -1035,7 +1035,7 @@ public: int lightmap_capture_get_octree_cell_subdiv(RID p_capture) const { return 0; } void lightmap_capture_set_energy(RID p_capture, float p_energy) {} float lightmap_capture_get_energy(RID p_capture) const { return 0.0; } - const PoolVector<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const { + const Vector<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const { return NULL; } diff --git a/servers/visual/rendering_device.cpp b/servers/visual/rendering_device.cpp index d7c88d5671..3c1795161d 100644 --- a/servers/visual/rendering_device.cpp +++ b/servers/visual/rendering_device.cpp @@ -46,15 +46,15 @@ void RenderingDevice::shader_set_cache_function(ShaderCacheFunction p_function) cache_function = p_function; } -PoolVector<uint8_t> RenderingDevice::shader_compile_from_source(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language, String *r_error, bool p_allow_cache) { +Vector<uint8_t> RenderingDevice::shader_compile_from_source(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language, String *r_error, bool p_allow_cache) { if (p_allow_cache && cache_function) { - PoolVector<uint8_t> cache = cache_function(p_stage, p_source_code, p_language); + Vector<uint8_t> cache = cache_function(p_stage, p_source_code, p_language); if (cache.size()) { return cache; } } - ERR_FAIL_COND_V(!compile_function, PoolVector<uint8_t>()); + ERR_FAIL_COND_V(!compile_function, Vector<uint8_t>()); return compile_function(p_stage, p_source_code, p_language, r_error); } diff --git a/servers/visual/rendering_device.h b/servers/visual/rendering_device.h index d7b13a739c..c3b937d5e2 100644 --- a/servers/visual/rendering_device.h +++ b/servers/visual/rendering_device.h @@ -55,8 +55,8 @@ public: SHADER_LANGUAGE_HLSL }; - typedef PoolVector<uint8_t> (*ShaderCompileFunction)(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language, String *r_error); - typedef PoolVector<uint8_t> (*ShaderCacheFunction)(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language); + typedef Vector<uint8_t> (*ShaderCompileFunction)(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language, String *r_error); + typedef Vector<uint8_t> (*ShaderCacheFunction)(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language); private: static ShaderCompileFunction compile_function; @@ -407,7 +407,7 @@ public: } }; - virtual RID texture_create(const TextureFormat &p_format, const TextureView &p_view, const Vector<PoolVector<uint8_t> > &p_data = Vector<PoolVector<uint8_t> >()) = 0; + virtual RID texture_create(const TextureFormat &p_format, const TextureView &p_view, const Vector<Vector<uint8_t> > &p_data = Vector<Vector<uint8_t> >()) = 0; virtual RID texture_create_shared(const TextureView &p_view, RID p_with_texture) = 0; enum TextureSliceType { @@ -418,8 +418,8 @@ public: virtual RID texture_create_shared_from_slice(const TextureView &p_view, RID p_with_texture, uint32_t p_layer, uint32_t p_mipmap, TextureSliceType p_slice_type = TEXTURE_SLICE_2D) = 0; - virtual Error texture_update(RID p_texture, uint32_t p_layer, const PoolVector<uint8_t> &p_data, bool p_sync_with_draw = false) = 0; //this function can be used from any thread and it takes effect at the begining of the frame, unless sync with draw is used, which is used to mix updates with draw calls - virtual PoolVector<uint8_t> texture_get_data(RID p_texture, uint32_t p_layer) = 0; // CPU textures will return immediately, while GPU textures will most likely force a flush + virtual Error texture_update(RID p_texture, uint32_t p_layer, const Vector<uint8_t> &p_data, bool p_sync_with_draw = false) = 0; //this function can be used from any thread and it takes effect at the begining of the frame, unless sync with draw is used, which is used to mix updates with draw calls + virtual Vector<uint8_t> texture_get_data(RID p_texture, uint32_t p_layer) = 0; // CPU textures will return immediately, while GPU textures will most likely force a flush virtual bool texture_is_format_supported_for_usage(DataFormat p_format, uint32_t p_usage) const = 0; virtual bool texture_is_shared(RID p_texture) = 0; @@ -542,7 +542,7 @@ public: frequency = VERTEX_FREQUENCY_VERTEX; } }; - virtual RID vertex_buffer_create(uint32_t p_size_bytes, const PoolVector<uint8_t> &p_data = PoolVector<uint8_t>()) = 0; + virtual RID vertex_buffer_create(uint32_t p_size_bytes, const Vector<uint8_t> &p_data = Vector<uint8_t>()) = 0; typedef int64_t VertexFormatID; @@ -555,21 +555,21 @@ public: INDEX_BUFFER_FORMAT_UINT32, }; - virtual RID index_buffer_create(uint32_t p_size_indices, IndexBufferFormat p_format, const PoolVector<uint8_t> &p_data = PoolVector<uint8_t>(), bool p_use_restart_indices = false) = 0; + virtual RID index_buffer_create(uint32_t p_size_indices, IndexBufferFormat p_format, const Vector<uint8_t> &p_data = Vector<uint8_t>(), bool p_use_restart_indices = false) = 0; virtual RID index_array_create(RID p_index_buffer, uint32_t p_index_offset, uint32_t p_index_count) = 0; /****************/ /**** SHADER ****/ /****************/ - virtual PoolVector<uint8_t> shader_compile_from_source(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language = SHADER_LANGUAGE_GLSL, String *r_error = NULL, bool p_allow_cache = true); + virtual Vector<uint8_t> shader_compile_from_source(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language = SHADER_LANGUAGE_GLSL, String *r_error = NULL, bool p_allow_cache = true); static void shader_set_compile_function(ShaderCompileFunction p_function); static void shader_set_cache_function(ShaderCacheFunction p_function); struct ShaderStageData { ShaderStage shader_stage; - PoolVector<uint8_t> spir_v; + Vector<uint8_t> spir_v; ShaderStageData() { shader_stage = SHADER_STAGE_VERTEX; @@ -597,9 +597,9 @@ public: UNIFORM_TYPE_MAX }; - virtual RID uniform_buffer_create(uint32_t p_size_bytes, const PoolVector<uint8_t> &p_data = PoolVector<uint8_t>()) = 0; - virtual RID storage_buffer_create(uint32_t p_size, const PoolVector<uint8_t> &p_data = PoolVector<uint8_t>()) = 0; - virtual RID texture_buffer_create(uint32_t p_size_elements, DataFormat p_format, const PoolVector<uint8_t> &p_data = PoolVector<uint8_t>()) = 0; + virtual RID uniform_buffer_create(uint32_t p_size_bytes, const Vector<uint8_t> &p_data = Vector<uint8_t>()) = 0; + virtual RID storage_buffer_create(uint32_t p_size, const Vector<uint8_t> &p_data = Vector<uint8_t>()) = 0; + virtual RID texture_buffer_create(uint32_t p_size_elements, DataFormat p_format, const Vector<uint8_t> &p_data = Vector<uint8_t>()) = 0; struct Uniform { UniformType type; @@ -622,7 +622,7 @@ public: virtual bool uniform_set_is_valid(RID p_uniform_set) = 0; virtual Error buffer_update(RID p_buffer, uint32_t p_offset, uint32_t p_size, const void *p_data, bool p_sync_with_draw = false) = 0; //this function can be used from any thread and it takes effect at the begining of the frame, unless sync with draw is used, which is used to mix updates with draw calls - virtual PoolVector<uint8_t> buffer_get_data(RID p_buffer) = 0; //this causes stall, only use to retrieve large buffers for saving + virtual Vector<uint8_t> buffer_get_data(RID p_buffer) = 0; //this causes stall, only use to retrieve large buffers for saving /*************************/ /**** RENDER PIPELINE ****/ diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index a7c18f184d..438ec2079c 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -2657,7 +2657,7 @@ PropertyInfo ShaderLanguage::uniform_to_property_info(const ShaderNode::Uniform case ShaderLanguage::TYPE_UVEC3: case ShaderLanguage::TYPE_UVEC4: { - pi.type = Variant::POOL_INT_ARRAY; + pi.type = Variant::PACKED_INT_ARRAY; } break; case ShaderLanguage::TYPE_FLOAT: { pi.type = Variant::REAL; diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp index 69f843eb4b..c1833fea44 100644 --- a/servers/visual/visual_server_canvas.cpp +++ b/servers/visual/visual_server_canvas.cpp @@ -1265,20 +1265,20 @@ RID VisualServerCanvas::canvas_occluder_polygon_create() { occluder_poly->occluder = VSG::canvas_render->occluder_polygon_create(); return canvas_light_occluder_polygon_owner.make_rid(occluder_poly); } -void VisualServerCanvas::canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const PoolVector<Vector2> &p_shape, bool p_closed) { +void VisualServerCanvas::canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const Vector<Vector2> &p_shape, bool p_closed) { if (p_shape.size() < 3) { canvas_occluder_polygon_set_shape_as_lines(p_occluder_polygon, p_shape); return; } - PoolVector<Vector2> lines; + Vector<Vector2> lines; int lc = p_shape.size() * 2; lines.resize(lc - (p_closed ? 0 : 2)); { - PoolVector<Vector2>::Write w = lines.write(); - PoolVector<Vector2>::Read r = p_shape.read(); + Vector2 *w = lines.ptrw(); + const Vector2 *r = p_shape.ptr(); int max = lc / 2; if (!p_closed) { @@ -1295,7 +1295,7 @@ void VisualServerCanvas::canvas_occluder_polygon_set_shape(RID p_occluder_polygo canvas_occluder_polygon_set_shape_as_lines(p_occluder_polygon, lines); } -void VisualServerCanvas::canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const PoolVector<Vector2> &p_shape) { +void VisualServerCanvas::canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const Vector<Vector2> &p_shape) { LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.getornull(p_occluder_polygon); ERR_FAIL_COND(!occluder_poly); @@ -1304,7 +1304,7 @@ void VisualServerCanvas::canvas_occluder_polygon_set_shape_as_lines(RID p_occlud int lc = p_shape.size(); occluder_poly->aabb = Rect2(); { - PoolVector<Vector2>::Read r = p_shape.read(); + const Vector2 *r = p_shape.ptr(); for (int i = 0; i < lc; i++) { if (i == 0) occluder_poly->aabb.position = r[i]; diff --git a/servers/visual/visual_server_canvas.h b/servers/visual/visual_server_canvas.h index c120a90314..dea4183752 100644 --- a/servers/visual/visual_server_canvas.h +++ b/servers/visual/visual_server_canvas.h @@ -257,8 +257,8 @@ public: void canvas_light_occluder_set_light_mask(RID p_occluder, int p_mask); RID canvas_occluder_polygon_create(); - void canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const PoolVector<Vector2> &p_shape, bool p_closed); - void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const PoolVector<Vector2> &p_shape); + void canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const Vector<Vector2> &p_shape, bool p_closed); + void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const Vector<Vector2> &p_shape); void canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon, VS::CanvasOccluderPolygonCullMode p_mode); diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 297f0727a0..4fea6082f4 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -233,7 +233,7 @@ public: BIND2(mesh_set_blend_shape_mode, RID, BlendShapeMode) BIND1RC(BlendShapeMode, mesh_get_blend_shape_mode, RID) - BIND4(mesh_surface_update_region, RID, int, int, const PoolVector<uint8_t> &) + BIND4(mesh_surface_update_region, RID, int, int, const Vector<uint8_t> &) BIND3(mesh_surface_set_material, RID, int, RID) BIND2RC(RID, mesh_surface_get_material, RID, int) @@ -268,8 +268,8 @@ public: BIND2RC(Color, multimesh_instance_get_color, RID, int) BIND2RC(Color, multimesh_instance_get_custom_data, RID, int) - BIND2(multimesh_set_buffer, RID, const PoolVector<float> &) - BIND1RC(PoolVector<float>, multimesh_get_buffer, RID) + BIND2(multimesh_set_buffer, RID, const Vector<float> &) + BIND1RC(Vector<float>, multimesh_get_buffer, RID) BIND2(multimesh_set_visible_instances, RID, int) BIND1RC(int, multimesh_get_visible_instances, RID) @@ -344,14 +344,14 @@ public: BIND0R(RID, gi_probe_create) - BIND8(gi_probe_allocate, RID, const Transform &, const AABB &, const Vector3i &, const PoolVector<uint8_t> &, const PoolVector<uint8_t> &, const PoolVector<uint8_t> &, const PoolVector<int> &) + BIND8(gi_probe_allocate, RID, const Transform &, const AABB &, const Vector3i &, const Vector<uint8_t> &, const Vector<uint8_t> &, const Vector<uint8_t> &, const Vector<int> &) BIND1RC(AABB, gi_probe_get_bounds, RID) BIND1RC(Vector3i, gi_probe_get_octree_size, RID) - BIND1RC(PoolVector<uint8_t>, gi_probe_get_octree_cells, RID) - BIND1RC(PoolVector<uint8_t>, gi_probe_get_data_cells, RID) - BIND1RC(PoolVector<uint8_t>, gi_probe_get_distance_field, RID) - BIND1RC(PoolVector<int>, gi_probe_get_level_counts, RID) + BIND1RC(Vector<uint8_t>, gi_probe_get_octree_cells, RID) + BIND1RC(Vector<uint8_t>, gi_probe_get_data_cells, RID) + BIND1RC(Vector<uint8_t>, gi_probe_get_distance_field, RID) + BIND1RC(Vector<int>, gi_probe_get_level_counts, RID) BIND1RC(Transform, gi_probe_get_to_cell_xform, RID) BIND2(gi_probe_set_dynamic_range, RID, float) @@ -391,8 +391,8 @@ public: BIND2(lightmap_capture_set_bounds, RID, const AABB &) BIND1RC(AABB, lightmap_capture_get_bounds, RID) - BIND2(lightmap_capture_set_octree, RID, const PoolVector<uint8_t> &) - BIND1RC(PoolVector<uint8_t>, lightmap_capture_get_octree, RID) + BIND2(lightmap_capture_set_octree, RID, const Vector<uint8_t> &) + BIND1RC(Vector<uint8_t>, lightmap_capture_get_octree, RID) BIND2(lightmap_capture_set_octree_cell_transform, RID, const Transform &) BIND1RC(Transform, lightmap_capture_get_octree_cell_transform, RID) @@ -686,8 +686,8 @@ public: BIND2(canvas_light_occluder_set_light_mask, RID, int) BIND0R(RID, canvas_occluder_polygon_create) - BIND3(canvas_occluder_polygon_set_shape, RID, const PoolVector<Vector2> &, bool) - BIND2(canvas_occluder_polygon_set_shape_as_lines, RID, const PoolVector<Vector2> &) + BIND3(canvas_occluder_polygon_set_shape, RID, const Vector<Vector2> &, bool) + BIND2(canvas_occluder_polygon_set_shape_as_lines, RID, const Vector<Vector2> &) BIND2(canvas_occluder_polygon_set_cull_mode, RID, CanvasOccluderPolygonCullMode) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 61c885cba3..1a9ecae23a 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -1313,7 +1313,7 @@ void VisualServerScene::_update_instance_lightmap_captures(Instance *p_instance) //this could use some sort of blending.. for (List<Instance *>::Element *E = geom->lightmap_captures.front(); E; E = E->next()) { - const PoolVector<RasterizerStorage::LightmapCaptureOctree> *octree = VSG::storage->lightmap_capture_get_octree_ptr(E->get()->base); + const Vector<RasterizerStorage::LightmapCaptureOctree> *octree = VSG::storage->lightmap_capture_get_octree_ptr(E->get()->base); //print_line("octree size: " + itos(octree->size())); if (octree->size() == 0) continue; @@ -1321,14 +1321,14 @@ void VisualServerScene::_update_instance_lightmap_captures(Instance *p_instance) int cell_subdiv = VSG::storage->lightmap_capture_get_octree_cell_subdiv(E->get()->base); to_cell_xform = to_cell_xform * E->get()->transform.affine_inverse(); - PoolVector<RasterizerStorage::LightmapCaptureOctree>::Read octree_r = octree->read(); + const RasterizerStorage::LightmapCaptureOctree *octree_r = octree->ptr(); Vector3 pos = to_cell_xform.xform(p_instance->transform.origin); for (int i = 0; i < 12; i++) { Vector3 dir = to_cell_xform.basis.xform(cone_traces[i]).normalized(); - Color capture = _light_capture_voxel_cone_trace(octree_r.ptr(), pos, dir, cone_aperture, cell_subdiv); + Color capture = _light_capture_voxel_cone_trace(octree_r, pos, dir, cone_aperture, cell_subdiv); p_instance->lightmap_capture_data.write[i] += capture; } } diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index 3ed3728757..9d5281b17a 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -157,7 +157,7 @@ public: FUNC2(mesh_set_blend_shape_mode, RID, BlendShapeMode) FUNC1RC(BlendShapeMode, mesh_get_blend_shape_mode, RID) - FUNC4(mesh_surface_update_region, RID, int, int, const PoolVector<uint8_t> &) + FUNC4(mesh_surface_update_region, RID, int, int, const Vector<uint8_t> &) FUNC3(mesh_surface_set_material, RID, int, RID) FUNC2RC(RID, mesh_surface_get_material, RID, int) @@ -192,8 +192,8 @@ public: FUNC2RC(Color, multimesh_instance_get_color, RID, int) FUNC2RC(Color, multimesh_instance_get_custom_data, RID, int) - FUNC2(multimesh_set_buffer, RID, const PoolVector<float> &) - FUNC1RC(PoolVector<float>, multimesh_get_buffer, RID) + FUNC2(multimesh_set_buffer, RID, const Vector<float> &) + FUNC1RC(Vector<float>, multimesh_get_buffer, RID) FUNC2(multimesh_set_visible_instances, RID, int) FUNC1RC(int, multimesh_get_visible_instances, RID) @@ -268,14 +268,14 @@ public: FUNCRID(gi_probe) - FUNC8(gi_probe_allocate, RID, const Transform &, const AABB &, const Vector3i &, const PoolVector<uint8_t> &, const PoolVector<uint8_t> &, const PoolVector<uint8_t> &, const PoolVector<int> &) + FUNC8(gi_probe_allocate, RID, const Transform &, const AABB &, const Vector3i &, const Vector<uint8_t> &, const Vector<uint8_t> &, const Vector<uint8_t> &, const Vector<int> &) FUNC1RC(AABB, gi_probe_get_bounds, RID) FUNC1RC(Vector3i, gi_probe_get_octree_size, RID) - FUNC1RC(PoolVector<uint8_t>, gi_probe_get_octree_cells, RID) - FUNC1RC(PoolVector<uint8_t>, gi_probe_get_data_cells, RID) - FUNC1RC(PoolVector<uint8_t>, gi_probe_get_distance_field, RID) - FUNC1RC(PoolVector<int>, gi_probe_get_level_counts, RID) + FUNC1RC(Vector<uint8_t>, gi_probe_get_octree_cells, RID) + FUNC1RC(Vector<uint8_t>, gi_probe_get_data_cells, RID) + FUNC1RC(Vector<uint8_t>, gi_probe_get_distance_field, RID) + FUNC1RC(Vector<int>, gi_probe_get_level_counts, RID) FUNC1RC(Transform, gi_probe_get_to_cell_xform, RID) FUNC2(gi_probe_set_dynamic_range, RID, float) @@ -315,8 +315,8 @@ public: FUNC2(lightmap_capture_set_bounds, RID, const AABB &) FUNC1RC(AABB, lightmap_capture_get_bounds, RID) - FUNC2(lightmap_capture_set_octree, RID, const PoolVector<uint8_t> &) - FUNC1RC(PoolVector<uint8_t>, lightmap_capture_get_octree, RID) + FUNC2(lightmap_capture_set_octree, RID, const Vector<uint8_t> &) + FUNC1RC(Vector<uint8_t>, lightmap_capture_get_octree, RID) FUNC2(lightmap_capture_set_octree_cell_transform, RID, const Transform &) FUNC1RC(Transform, lightmap_capture_get_octree_cell_transform, RID) FUNC2(lightmap_capture_set_octree_cell_subdiv, RID, int) @@ -590,8 +590,8 @@ public: FUNC2(canvas_light_occluder_set_light_mask, RID, int) FUNCRID(canvas_occluder_polygon) - FUNC3(canvas_occluder_polygon_set_shape, RID, const PoolVector<Vector2> &, bool) - FUNC2(canvas_occluder_polygon_set_shape_as_lines, RID, const PoolVector<Vector2> &) + FUNC3(canvas_occluder_polygon_set_shape, RID, const Vector<Vector2> &, bool) + FUNC2(canvas_occluder_polygon_set_shape_as_lines, RID, const Vector<Vector2> &) FUNC2(canvas_occluder_polygon_set_cull_mode, RID, CanvasOccluderPolygonCullMode) diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 508d5ec1f8..21885e93b5 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -120,11 +120,11 @@ RID VisualServer::get_test_texture() { #define TEST_TEXTURE_SIZE 256 - PoolVector<uint8_t> test_data; + Vector<uint8_t> test_data; test_data.resize(TEST_TEXTURE_SIZE * TEST_TEXTURE_SIZE * 3); { - PoolVector<uint8_t>::Write w = test_data.write(); + uint8_t *w = test_data.ptrw(); for (int x = 0; x < TEST_TEXTURE_SIZE; x++) { @@ -172,10 +172,10 @@ void VisualServer::_free_internal_rids() { RID VisualServer::_make_test_cube() { - PoolVector<Vector3> vertices; - PoolVector<Vector3> normals; - PoolVector<float> tangents; - PoolVector<Vector3> uvs; + Vector<Vector3> vertices; + Vector<Vector3> normals; + Vector<float> tangents; + Vector<Vector3> uvs; #define ADD_VTX(m_idx) \ vertices.push_back(face_points[m_idx]); \ @@ -229,7 +229,7 @@ RID VisualServer::_make_test_cube() { d[VisualServer::ARRAY_TEX_UV] = uvs; d[VisualServer::ARRAY_VERTEX] = vertices; - PoolVector<int> indices; + Vector<int> indices; indices.resize(vertices.size()); for (int i = 0; i < vertices.size(); i++) indices.set(i, i); @@ -254,8 +254,8 @@ RID VisualServer::_make_test_cube() { RID VisualServer::make_sphere_mesh(int p_lats, int p_lons, float p_radius) { - PoolVector<Vector3> vertices; - PoolVector<Vector3> normals; + Vector<Vector3> vertices; + Vector<Vector3> normals; for (int i = 1; i <= p_lats; i++) { double lat0 = Math_PI * (-0.5 + (double)(i - 1) / p_lats); @@ -314,10 +314,10 @@ RID VisualServer::get_white_texture() { if (white_texture.is_valid()) return white_texture; - PoolVector<uint8_t> wt; + Vector<uint8_t> wt; wt.resize(16 * 3); { - PoolVector<uint8_t>::Write w = wt.write(); + uint8_t *w = wt.ptrw(); for (int i = 0; i < 16 * 3; i++) w[i] = 255; } @@ -329,13 +329,13 @@ RID VisualServer::get_white_texture() { #define SMALL_VEC2 Vector2(0.00001, 0.00001) #define SMALL_VEC3 Vector3(0.00001, 0.00001, 0.00001) -Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb) { +Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, Vector<uint8_t> &r_vertex_array, int p_vertex_array_len, Vector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb) { - PoolVector<uint8_t>::Write vw = r_vertex_array.write(); + uint8_t *vw = r_vertex_array.ptrw(); - PoolVector<uint8_t>::Write iw; + uint8_t *iw; if (r_index_array.size()) { - iw = r_index_array.write(); + iw = r_index_array.ptrw(); } int max_bone = 0; @@ -351,11 +351,10 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ if (p_format & VS::ARRAY_FLAG_USE_2D_VERTICES) { - PoolVector<Vector2> array = p_arrays[ai]; + Vector<Vector2> array = p_arrays[ai]; ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER); - PoolVector<Vector2>::Read read = array.read(); - const Vector2 *src = read.ptr(); + const Vector2 *src = array.ptr(); // setting vertices means regenerating the AABB Rect2 aabb; @@ -380,11 +379,10 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ r_aabb = AABB(Vector3(aabb.position.x, aabb.position.y, 0), Vector3(aabb.size.x, aabb.size.y, 0)); } else { - PoolVector<Vector3> array = p_arrays[ai]; + Vector<Vector3> array = p_arrays[ai]; ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER); - PoolVector<Vector3>::Read read = array.read(); - const Vector3 *src = read.ptr(); + const Vector3 *src = array.ptr(); // setting vertices means regenerating the AABB AABB aabb; @@ -412,13 +410,12 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ } break; case VS::ARRAY_NORMAL: { - ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::POOL_VECTOR3_ARRAY, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_VECTOR3_ARRAY, ERR_INVALID_PARAMETER); - PoolVector<Vector3> array = p_arrays[ai]; + Vector<Vector3> array = p_arrays[ai]; ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER); - PoolVector<Vector3>::Read read = array.read(); - const Vector3 *src = read.ptr(); + const Vector3 *src = array.ptr(); // setting vertices means regenerating the AABB @@ -448,14 +445,13 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ case VS::ARRAY_TANGENT: { - ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::POOL_REAL_ARRAY, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_REAL_ARRAY, ERR_INVALID_PARAMETER); - PoolVector<real_t> array = p_arrays[ai]; + Vector<real_t> array = p_arrays[ai]; ERR_FAIL_COND_V(array.size() != p_vertex_array_len * 4, ERR_INVALID_PARAMETER); - PoolVector<real_t>::Read read = array.read(); - const real_t *src = read.ptr(); + const real_t *src = array.ptr(); if (p_format & ARRAY_COMPRESS_TANGENT) { @@ -487,14 +483,13 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ } break; case VS::ARRAY_COLOR: { - ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::POOL_COLOR_ARRAY, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_COLOR_ARRAY, ERR_INVALID_PARAMETER); - PoolVector<Color> array = p_arrays[ai]; + Vector<Color> array = p_arrays[ai]; ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER); - PoolVector<Color>::Read read = array.read(); - const Color *src = read.ptr(); + const Color *src = array.ptr(); if (p_format & ARRAY_COMPRESS_COLOR) { @@ -520,15 +515,13 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ } break; case VS::ARRAY_TEX_UV: { - ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::POOL_VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::POOL_VECTOR2_ARRAY, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::PACKED_VECTOR2_ARRAY, ERR_INVALID_PARAMETER); - PoolVector<Vector2> array = p_arrays[ai]; + Vector<Vector2> array = p_arrays[ai]; ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER); - PoolVector<Vector2>::Read read = array.read(); - - const Vector2 *src = read.ptr(); + const Vector2 *src = array.ptr(); if (p_format & ARRAY_COMPRESS_TEX_UV) { @@ -551,15 +544,13 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ case VS::ARRAY_TEX_UV2: { - ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::POOL_VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::POOL_VECTOR2_ARRAY, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::PACKED_VECTOR2_ARRAY, ERR_INVALID_PARAMETER); - PoolVector<Vector2> array = p_arrays[ai]; + Vector<Vector2> array = p_arrays[ai]; ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER); - PoolVector<Vector2>::Read read = array.read(); - - const Vector2 *src = read.ptr(); + const Vector2 *src = array.ptr(); if (p_format & ARRAY_COMPRESS_TEX_UV2) { @@ -580,15 +571,13 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ } break; case VS::ARRAY_WEIGHTS: { - ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::POOL_REAL_ARRAY, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_REAL_ARRAY, ERR_INVALID_PARAMETER); - PoolVector<real_t> array = p_arrays[ai]; + Vector<real_t> array = p_arrays[ai]; ERR_FAIL_COND_V(array.size() != p_vertex_array_len * VS::ARRAY_WEIGHTS_SIZE, ERR_INVALID_PARAMETER); - PoolVector<real_t>::Read read = array.read(); - - const real_t *src = read.ptr(); + const real_t *src = array.ptr(); { @@ -606,15 +595,13 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ } break; case VS::ARRAY_BONES: { - ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::POOL_INT_ARRAY && p_arrays[ai].get_type() != Variant::POOL_REAL_ARRAY, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_INT_ARRAY && p_arrays[ai].get_type() != Variant::PACKED_REAL_ARRAY, ERR_INVALID_PARAMETER); - PoolVector<int> array = p_arrays[ai]; + Vector<int> array = p_arrays[ai]; ERR_FAIL_COND_V(array.size() != p_vertex_array_len * VS::ARRAY_WEIGHTS_SIZE, ERR_INVALID_PARAMETER); - PoolVector<int>::Read read = array.read(); - - const int *src = read.ptr(); + const int *src = array.ptr(); for (int i = 0; i < p_vertex_array_len; i++) { @@ -631,16 +618,15 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ case VS::ARRAY_INDEX: { ERR_FAIL_COND_V(p_index_array_len <= 0, ERR_INVALID_DATA); - ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::POOL_INT_ARRAY, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_INT_ARRAY, ERR_INVALID_PARAMETER); - PoolVector<int> indices = p_arrays[ai]; + Vector<int> indices = p_arrays[ai]; ERR_FAIL_COND_V(indices.size() == 0, ERR_INVALID_PARAMETER); ERR_FAIL_COND_V(indices.size() != p_index_array_len, ERR_INVALID_PARAMETER); /* determine whether using 16 or 32 bits indices */ - PoolVector<int>::Read read = indices.read(); - const int *src = read.ptr(); + const int *src = indices.ptr(); for (int i = 0; i < p_index_array_len; i++) { @@ -675,18 +661,18 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ } } - PoolVector<Vector3> vertices = p_arrays[VS::ARRAY_VERTEX]; - PoolVector<int> bones = p_arrays[VS::ARRAY_BONES]; - PoolVector<float> weights = p_arrays[VS::ARRAY_WEIGHTS]; + Vector<Vector3> vertices = p_arrays[VS::ARRAY_VERTEX]; + Vector<int> bones = p_arrays[VS::ARRAY_BONES]; + Vector<float> weights = p_arrays[VS::ARRAY_WEIGHTS]; bool any_valid = false; if (vertices.size() && bones.size() == vertices.size() * 4 && weights.size() == bones.size()) { int vs = vertices.size(); - PoolVector<Vector3>::Read rv = vertices.read(); - PoolVector<int>::Read rb = bones.read(); - PoolVector<float>::Read rw = weights.read(); + const Vector3 *rv = vertices.ptr(); + const int *rb = bones.ptr(); + const float *rw = weights.ptr(); AABB *bptr = r_bone_aabb.ptrw(); @@ -866,22 +852,22 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_ Variant var = p_arrays[i]; switch (var.get_type()) { - case Variant::POOL_VECTOR2_ARRAY: { - PoolVector<Vector2> v2 = var; + case Variant::PACKED_VECTOR2_ARRAY: { + Vector<Vector2> v2 = var; } break; - case Variant::POOL_VECTOR3_ARRAY: { - PoolVector<Vector3> v3 = var; + case Variant::PACKED_VECTOR3_ARRAY: { + Vector<Vector3> v3 = var; } break; default: { Array v = var; } break; } - array_len = PoolVector3Array(p_arrays[i]).size(); + array_len = PackedVector3Array(p_arrays[i]).size(); ERR_FAIL_COND_V(array_len == 0, ERR_INVALID_DATA); } else if (i == VS::ARRAY_INDEX) { - index_array_len = PoolIntArray(p_arrays[i]).size(); + index_array_len = PackedIntArray(p_arrays[i]).size(); } } @@ -921,10 +907,10 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_ case VS::ARRAY_VERTEX: { Variant arr = p_arrays[0]; - if (arr.get_type() == Variant::POOL_VECTOR2_ARRAY) { + if (arr.get_type() == Variant::PACKED_VECTOR2_ARRAY) { elem_size = 2; p_compress_format |= ARRAY_FLAG_USE_2D_VERTICES; - } else if (arr.get_type() == Variant::POOL_VECTOR3_ARRAY) { + } else if (arr.get_type() == Variant::PACKED_VECTOR3_ARRAY) { p_compress_format &= ~ARRAY_FLAG_USE_2D_VERTICES; elem_size = 3; } else { @@ -1020,12 +1006,12 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_ int array_size = total_elem_size * array_len; - PoolVector<uint8_t> vertex_array; + Vector<uint8_t> vertex_array; vertex_array.resize(array_size); int index_array_size = offsets[VS::ARRAY_INDEX] * index_array_len; - PoolVector<uint8_t> index_array; + Vector<uint8_t> index_array; index_array.resize(index_array_size); AABB aabb; @@ -1034,13 +1020,13 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_ Error err = _surface_set_data(p_arrays, format, offsets, total_elem_size, vertex_array, array_len, index_array, index_array_len, aabb, bone_aabb); ERR_FAIL_COND_V_MSG(err != OK, ERR_INVALID_DATA, "Invalid array format for surface."); - Vector<PoolVector<uint8_t> > blend_shape_data; + Vector<Vector<uint8_t> > blend_shape_data; for (int i = 0; i < p_blend_shapes.size(); i++) { - PoolVector<uint8_t> vertex_array_shape; + Vector<uint8_t> vertex_array_shape; vertex_array_shape.resize(array_size); - PoolVector<uint8_t> noindex; + Vector<uint8_t> noindex; AABB laabb; Error err2 = _surface_set_data(p_blend_shapes[i], format & ~ARRAY_FORMAT_INDEX, offsets, total_elem_size, vertex_array_shape, array_len, noindex, 0, laabb, bone_aabb); @@ -1057,27 +1043,27 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_ for (List<Variant>::Element *E = keys.front(); E; E = E->next()) { float distance = E->get(); ERR_CONTINUE(distance <= 0.0); - PoolVector<int> indices = p_lods[E->get()]; + Vector<int> indices = p_lods[E->get()]; ERR_CONTINUE(indices.size() == 0); uint32_t index_count = indices.size(); ERR_CONTINUE(index_count >= (uint32_t)index_array_len); //should be smaller.. - PoolVector<int>::Read r = indices.read(); + const int *r = indices.ptr(); - PoolVector<uint8_t> data; + Vector<uint8_t> data; if (array_len <= 65536) { //16 bits indices data.resize(indices.size() * 2); - PoolVector<uint8_t>::Write w = data.write(); - uint16_t *index_ptr = (uint16_t *)w.ptr(); + uint8_t *w = data.ptrw(); + uint16_t *index_ptr = (uint16_t *)w; for (uint32_t i = 0; i < index_count; i++) { index_ptr[i] = r[i]; } } else { //32 bits indices data.resize(indices.size() * 4); - PoolVector<uint8_t>::Write w = data.write(); - uint32_t *index_ptr = (uint32_t *)w.ptr(); + uint8_t *w = data.ptrw(); + uint32_t *index_ptr = (uint32_t *)w; for (uint32_t i = 0; i < index_count; i++) { index_ptr[i] = r[i]; } @@ -1115,7 +1101,7 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_prim mesh_add_surface(p_mesh, sd); } -Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_t> p_vertex_data, int p_vertex_len, PoolVector<uint8_t> p_index_data, int p_index_len) const { +Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p_vertex_data, int p_vertex_len, Vector<uint8_t> p_index_data, int p_index_len) const { uint32_t offsets[ARRAY_MAX]; @@ -1227,7 +1213,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ Array ret; ret.resize(VS::ARRAY_MAX); - PoolVector<uint8_t>::Read r = p_vertex_data.read(); + const uint8_t *r = p_vertex_data.ptr(); for (int i = 0; i < VS::ARRAY_MAX; i++) { @@ -1240,12 +1226,12 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ if (p_format & ARRAY_FLAG_USE_2D_VERTICES) { - PoolVector<Vector2> arr_2d; + Vector<Vector2> arr_2d; arr_2d.resize(p_vertex_len); { - PoolVector<Vector2>::Write w = arr_2d.write(); + Vector2 *w = arr_2d.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1257,12 +1243,12 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ ret[i] = arr_2d; } else { - PoolVector<Vector3> arr_3d; + Vector<Vector3> arr_3d; arr_3d.resize(p_vertex_len); { - PoolVector<Vector3>::Write w = arr_3d.write(); + Vector3 *w = arr_3d.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1276,12 +1262,12 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } break; case VS::ARRAY_NORMAL: { - PoolVector<Vector3> arr; + Vector<Vector3> arr; arr.resize(p_vertex_len); if (p_format & ARRAY_COMPRESS_NORMAL) { - PoolVector<Vector3>::Write w = arr.write(); + Vector3 *w = arr.ptrw(); const float multiplier = 1.f / 127.f; for (int j = 0; j < p_vertex_len; j++) { @@ -1290,7 +1276,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ w[j] = Vector3(float(v[0]) * multiplier, float(v[1]) * multiplier, float(v[2]) * multiplier); } } else { - PoolVector<Vector3>::Write w = arr.write(); + Vector3 *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1304,10 +1290,10 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } break; case VS::ARRAY_TANGENT: { - PoolVector<float> arr; + Vector<float> arr; arr.resize(p_vertex_len * 4); if (p_format & ARRAY_COMPRESS_TANGENT) { - PoolVector<float>::Write w = arr.write(); + float *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1318,7 +1304,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } } else { - PoolVector<float>::Write w = arr.write(); + float *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { const float *v = (const float *)&r[j * total_elem_size + offsets[i]]; @@ -1333,12 +1319,12 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } break; case VS::ARRAY_COLOR: { - PoolVector<Color> arr; + Vector<Color> arr; arr.resize(p_vertex_len); if (p_format & ARRAY_COMPRESS_COLOR) { - PoolVector<Color>::Write w = arr.write(); + Color *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1346,7 +1332,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ w[j] = Color(float(v[0] / 255.0), float(v[1] / 255.0), float(v[2] / 255.0), float(v[3] / 255.0)); } } else { - PoolVector<Color>::Write w = arr.write(); + Color *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1359,12 +1345,12 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } break; case VS::ARRAY_TEX_UV: { - PoolVector<Vector2> arr; + Vector<Vector2> arr; arr.resize(p_vertex_len); if (p_format & ARRAY_COMPRESS_TEX_UV) { - PoolVector<Vector2>::Write w = arr.write(); + Vector2 *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1373,7 +1359,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } } else { - PoolVector<Vector2>::Write w = arr.write(); + Vector2 *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1386,12 +1372,12 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } break; case VS::ARRAY_TEX_UV2: { - PoolVector<Vector2> arr; + Vector<Vector2> arr; arr.resize(p_vertex_len); if (p_format & ARRAY_COMPRESS_TEX_UV2) { - PoolVector<Vector2>::Write w = arr.write(); + Vector2 *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1400,7 +1386,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } } else { - PoolVector<Vector2>::Write w = arr.write(); + Vector2 *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1414,10 +1400,10 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } break; case VS::ARRAY_WEIGHTS: { - PoolVector<float> arr; + Vector<float> arr; arr.resize(p_vertex_len * 4); { - PoolVector<float>::Write w = arr.write(); + float *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1433,10 +1419,10 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } break; case VS::ARRAY_BONES: { - PoolVector<int> arr; + Vector<int> arr; arr.resize(p_vertex_len * 4); - PoolVector<int>::Write w = arr.write(); + int *w = arr.ptrw(); for (int j = 0; j < p_vertex_len; j++) { @@ -1452,13 +1438,13 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ case VS::ARRAY_INDEX: { /* determine whether using 16 or 32 bits indices */ - PoolVector<uint8_t>::Read ir = p_index_data.read(); + const uint8_t *ir = p_index_data.ptr(); - PoolVector<int> arr; + Vector<int> arr; arr.resize(p_index_len); if (p_vertex_len < (1 << 16)) { - PoolVector<int>::Write w = arr.write(); + int *w = arr.ptrw(); for (int j = 0; j < p_index_len; j++) { @@ -1467,7 +1453,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector<uint8_ } } else { - PoolVector<int>::Write w = arr.write(); + int *w = arr.ptrw(); for (int j = 0; j < p_index_len; j++) { const int *v = (const int *)&ir[j * 4]; @@ -1499,22 +1485,22 @@ Dictionary VisualServer::mesh_surface_get_lods(RID p_mesh, int p_surface) const Dictionary ret; for (int i = 0; i < sd.lods.size(); i++) { - PoolVector<int> lods; + Vector<int> lods; if (sd.vertex_count <= 65536) { uint32_t lc = sd.lods[i].index_data.size() / 2; lods.resize(lc); - PoolVector<uint8_t>::Read r = sd.lods[i].index_data.read(); - const uint16_t *rptr = (const uint16_t *)r.ptr(); - PoolVector<int>::Write w = lods.write(); + const uint8_t *r = sd.lods[i].index_data.ptr(); + const uint16_t *rptr = (const uint16_t *)r; + int *w = lods.ptrw(); for (uint32_t j = 0; j < lc; j++) { w[j] = rptr[i]; } } else { uint32_t lc = sd.lods[i].index_data.size() / 4; lods.resize(lc); - PoolVector<uint8_t>::Read r = sd.lods[i].index_data.read(); - const uint32_t *rptr = (const uint32_t *)r.ptr(); - PoolVector<int>::Write w = lods.write(); + const uint8_t *r = sd.lods[i].index_data.ptr(); + const uint32_t *rptr = (const uint32_t *)r; + int *w = lods.ptrw(); for (uint32_t j = 0; j < lc; j++) { w[j] = rptr[i]; } @@ -1531,12 +1517,12 @@ Array VisualServer::mesh_surface_get_blend_shape_arrays(RID p_mesh, int p_surfac SurfaceData sd = mesh_get_surface(p_mesh, p_surface); ERR_FAIL_COND_V(sd.vertex_count == 0, Array()); - Vector<PoolVector<uint8_t> > blend_shape_data = sd.blend_shapes; + Vector<Vector<uint8_t> > blend_shape_data = sd.blend_shapes; if (blend_shape_data.size() > 0) { int vertex_len = sd.vertex_count; - PoolVector<uint8_t> index_data = sd.index_data; + Vector<uint8_t> index_data = sd.index_data; int index_len = sd.index_count; uint32_t format = sd.format; @@ -1555,12 +1541,12 @@ Array VisualServer::mesh_surface_get_blend_shape_arrays(RID p_mesh, int p_surfac Array VisualServer::mesh_create_arrays_from_surface_data(const SurfaceData &p_data) const { - PoolVector<uint8_t> vertex_data = p_data.vertex_data; + Vector<uint8_t> vertex_data = p_data.vertex_data; ERR_FAIL_COND_V(vertex_data.size() == 0, Array()); int vertex_len = p_data.vertex_count; - PoolVector<uint8_t> index_data = p_data.index_data; + Vector<uint8_t> index_data = p_data.index_data; int index_len = p_data.index_count; uint32_t format = p_data.format; @@ -2251,8 +2237,8 @@ void VisualServer::_camera_set_orthogonal(RID p_camera, float p_size, float p_z_ void VisualServer::mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry::MeshData &p_mesh_data) { - PoolVector<Vector3> vertices; - PoolVector<Vector3> normals; + Vector<Vector3> vertices; + Vector<Vector3> normals; for (int i = 0; i < p_mesh_data.faces.size(); i++) { @@ -2277,7 +2263,7 @@ void VisualServer::mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry::M mesh_add_surface_from_arrays(p_mesh, PRIMITIVE_TRIANGLES, d); } -void VisualServer::mesh_add_surface_from_planes(RID p_mesh, const PoolVector<Plane> &p_planes) { +void VisualServer::mesh_add_surface_from_planes(RID p_mesh, const Vector<Plane> &p_planes) { Geometry::MeshData mdata = Geometry::build_convex_mesh(p_planes); mesh_add_surface_from_mesh_data(p_mesh, mdata); diff --git a/servers/visual_server.h b/servers/visual_server.h index 09fc1aaba2..c29bc2a767 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -32,7 +32,6 @@ #define VISUAL_SERVER_H #include "core/image.h" -#include "core/math/bsp_tree.h" #include "core/math/geometry.h" #include "core/math/transform_2d.h" #include "core/object.h" @@ -49,7 +48,7 @@ class VisualServer : public Object { void _camera_set_orthogonal(RID p_camera, float p_size, float p_z_near, float p_z_far); void _canvas_item_add_style_box(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector<float> &p_margins, const Color &p_modulate = Color(1, 1, 1)); - Array _get_array_from_surface(uint32_t p_format, PoolVector<uint8_t> p_vertex_data, int p_vertex_len, PoolVector<uint8_t> p_index_data, int p_index_len) const; + Array _get_array_from_surface(uint32_t p_format, Vector<uint8_t> p_vertex_data, int p_vertex_len, Vector<uint8_t> p_index_data, int p_index_len) const; protected: RID _make_test_cube(); @@ -58,7 +57,7 @@ protected: RID white_texture; RID test_material; - Error _surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb); + Error _surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, Vector<uint8_t> &r_vertex_array, int p_vertex_array_len, Vector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb); static VisualServer *(*create_func)(); static void _bind_methods(); @@ -250,20 +249,20 @@ public: PrimitiveType primitive = PRIMITIVE_MAX; uint32_t format = 0; - PoolVector<uint8_t> vertex_data; + Vector<uint8_t> vertex_data; uint32_t vertex_count = 0; - PoolVector<uint8_t> index_data; + Vector<uint8_t> index_data; uint32_t index_count = 0; AABB aabb; struct LOD { float edge_length; - PoolVector<uint8_t> index_data; + Vector<uint8_t> index_data; }; Vector<LOD> lods; Vector<AABB> bone_aabbs; - Vector<PoolVector<uint8_t> > blend_shapes; + Vector<Vector<uint8_t> > blend_shapes; RID material; }; @@ -294,7 +293,7 @@ public: virtual void mesh_set_blend_shape_mode(RID p_mesh, BlendShapeMode p_mode) = 0; virtual BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const = 0; - virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) = 0; + virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) = 0; virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) = 0; virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const = 0; @@ -334,8 +333,8 @@ public: virtual Color multimesh_instance_get_color(RID p_multimesh, int p_index) const = 0; virtual Color multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const = 0; - virtual void multimesh_set_buffer(RID p_multimesh, const PoolVector<float> &p_buffer) = 0; - virtual PoolVector<float> multimesh_get_buffer(RID p_multimesh) const = 0; + virtual void multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_buffer) = 0; + virtual Vector<float> multimesh_get_buffer(RID p_multimesh) const = 0; virtual void multimesh_set_visible_instances(RID p_multimesh, int p_visible) = 0; virtual int multimesh_get_visible_instances(RID p_multimesh) const = 0; @@ -463,14 +462,14 @@ public: virtual RID gi_probe_create() = 0; - virtual void gi_probe_allocate(RID p_gi_probe, const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3i &p_octree_size, const PoolVector<uint8_t> &p_octree_cells, const PoolVector<uint8_t> &p_data_cells, const PoolVector<uint8_t> &p_distance_field, const PoolVector<int> &p_level_counts) = 0; + virtual void gi_probe_allocate(RID p_gi_probe, const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3i &p_octree_size, const Vector<uint8_t> &p_octree_cells, const Vector<uint8_t> &p_data_cells, const Vector<uint8_t> &p_distance_field, const Vector<int> &p_level_counts) = 0; virtual AABB gi_probe_get_bounds(RID p_gi_probe) const = 0; virtual Vector3i gi_probe_get_octree_size(RID p_gi_probe) const = 0; - virtual PoolVector<uint8_t> gi_probe_get_octree_cells(RID p_gi_probe) const = 0; - virtual PoolVector<uint8_t> gi_probe_get_data_cells(RID p_gi_probe) const = 0; - virtual PoolVector<uint8_t> gi_probe_get_distance_field(RID p_gi_probe) const = 0; - virtual PoolVector<int> gi_probe_get_level_counts(RID p_gi_probe) const = 0; + virtual Vector<uint8_t> gi_probe_get_octree_cells(RID p_gi_probe) const = 0; + virtual Vector<uint8_t> gi_probe_get_data_cells(RID p_gi_probe) const = 0; + virtual Vector<uint8_t> gi_probe_get_distance_field(RID p_gi_probe) const = 0; + virtual Vector<int> gi_probe_get_level_counts(RID p_gi_probe) const = 0; virtual Transform gi_probe_get_to_cell_xform(RID p_gi_probe) const = 0; virtual void gi_probe_set_dynamic_range(RID p_gi_probe, float p_range) = 0; @@ -508,12 +507,12 @@ public: virtual RID lightmap_capture_create() = 0; virtual void lightmap_capture_set_bounds(RID p_capture, const AABB &p_bounds) = 0; virtual AABB lightmap_capture_get_bounds(RID p_capture) const = 0; - virtual void lightmap_capture_set_octree(RID p_capture, const PoolVector<uint8_t> &p_octree) = 0; + virtual void lightmap_capture_set_octree(RID p_capture, const Vector<uint8_t> &p_octree) = 0; virtual void lightmap_capture_set_octree_cell_transform(RID p_capture, const Transform &p_xform) = 0; virtual Transform lightmap_capture_get_octree_cell_transform(RID p_capture) const = 0; virtual void lightmap_capture_set_octree_cell_subdiv(RID p_capture, int p_subdiv) = 0; virtual int lightmap_capture_get_octree_cell_subdiv(RID p_capture) const = 0; - virtual PoolVector<uint8_t> lightmap_capture_get_octree(RID p_capture) const = 0; + virtual Vector<uint8_t> lightmap_capture_get_octree(RID p_capture) const = 0; virtual void lightmap_capture_set_energy(RID p_capture, float p_energy) = 0; virtual float lightmap_capture_get_energy(RID p_capture) const = 0; @@ -1011,8 +1010,8 @@ public: virtual void canvas_light_occluder_set_light_mask(RID p_occluder, int p_mask) = 0; virtual RID canvas_occluder_polygon_create() = 0; - virtual void canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const PoolVector<Vector2> &p_shape, bool p_closed) = 0; - virtual void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const PoolVector<Vector2> &p_shape) = 0; + virtual void canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const Vector<Vector2> &p_shape, bool p_closed) = 0; + virtual void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const Vector<Vector2> &p_shape) = 0; enum CanvasOccluderPolygonCullMode { CANVAS_OCCLUDER_POLYGON_CULL_DISABLED, @@ -1082,7 +1081,7 @@ public: virtual RID make_sphere_mesh(int p_lats, int p_lons, float p_radius); virtual void mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry::MeshData &p_mesh_data); - virtual void mesh_add_surface_from_planes(RID p_mesh, const PoolVector<Plane> &p_planes); + virtual void mesh_add_surface_from_planes(RID p_mesh, const Vector<Plane> &p_planes); virtual void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter = true) = 0; virtual void set_default_clear_color(const Color &p_color) = 0; |