From 6c3a0460a803b3dbe89a4172c49f38fc4b95a299 Mon Sep 17 00:00:00 2001 From: Anilforextra Date: Tue, 11 Jan 2022 21:12:39 +0545 Subject: [PATCH] Use List Initializations for Vectors. --- core/core_bind.cpp | 10 +- core/math/a_star.cpp | 3 +- core/math/geometry_3d.cpp | 29 ++--- editor/animation_track_editor_plugins.cpp | 25 +++-- .../animation_blend_space_2d_editor.cpp | 9 +- editor/plugins/canvas_item_editor_plugin.cpp | 20 ++-- editor/plugins/node_3d_editor_gizmos.cpp | 100 +++++++++--------- .../plugins/visual_shader_editor_plugin.cpp | 35 +++--- scene/2d/collision_polygon_2d.cpp | 16 +-- scene/2d/collision_shape_2d.cpp | 16 +-- scene/2d/cpu_particles_2d.cpp | 34 +++--- scene/2d/gpu_particles_2d.cpp | 37 +++---- scene/2d/position_2d.cpp | 44 ++++---- scene/2d/ray_cast_2d.cpp | 14 ++- scene/2d/shape_cast_2d.cpp | 16 +-- scene/resources/separation_ray_shape_2d.cpp | 14 ++- scene/resources/separation_ray_shape_3d.cpp | 7 +- scene/resources/style_box.cpp | 23 ++-- scene/resources/tile_set.cpp | 94 ++++++++-------- scene/resources/world_boundary_shape_3d.cpp | 23 ++-- .../render_forward_clustered.cpp | 38 ++++--- .../forward_mobile/render_forward_mobile.cpp | 27 ++--- 22 files changed, 326 insertions(+), 308 deletions(-) diff --git a/core/core_bind.cpp b/core/core_bind.cpp index 1891ea7e3a7..ef28f43f051 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -698,10 +698,7 @@ Variant Geometry2D::line_intersects_line(const Vector2 &p_from_a, const Vector2 Vector Geometry2D::get_closest_points_between_segments(const Vector2 &p1, const Vector2 &q1, const Vector2 &p2, const Vector2 &q2) { Vector2 r1, r2; ::Geometry2D::get_closest_points_between_segments(p1, q1, p2, q2, r1, r2); - Vector r; - r.resize(2); - r.set(0, r1); - r.set(1, r2); + Vector r = { r1, r2 }; return r; } @@ -923,10 +920,7 @@ Vector Geometry3D::build_capsule_planes(float p_radius, float p_height, i Vector Geometry3D::get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2) { Vector3 r1, r2; ::Geometry3D::get_closest_points_between_segments(p1, p2, q1, q2, r1, r2); - Vector r; - r.resize(2); - r.set(0, r1); - r.set(1, r2); + Vector r = { r1, r2 }; return r; } diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index ebe88fcf668..ce2435216bc 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -699,8 +699,7 @@ Vector AStar2D::get_point_path(int p_from_id, int p_to_id) { ERR_FAIL_COND_V_MSG(!to_exists, Vector(), vformat("Can't get point path. Point with id: %d doesn't exist.", p_to_id)); if (a == b) { - Vector ret; - ret.push_back(Vector2(a->pos.x, a->pos.y)); + Vector ret = { Vector2(a->pos.x, a->pos.y) }; return ret; } diff --git a/core/math/geometry_3d.cpp b/core/math/geometry_3d.cpp index e1bce81b6bd..98a2c27d938 100644 --- a/core/math/geometry_3d.cpp +++ b/core/math/geometry_3d.cpp @@ -644,14 +644,15 @@ Geometry3D::MeshData Geometry3D::build_convex_mesh(const Vector &p_planes Vector3 right = p.normal.cross(ref).normalized(); Vector3 up = p.normal.cross(right).normalized(); - Vector vertices; - Vector3 center = p.center(); + // make a quad clockwise - vertices.push_back(center - up * subplane_size + right * subplane_size); - vertices.push_back(center - up * subplane_size - right * subplane_size); - vertices.push_back(center + up * subplane_size - right * subplane_size); - vertices.push_back(center + up * subplane_size + right * subplane_size); + Vector vertices = { + center - up * subplane_size + right * subplane_size, + center - up * subplane_size - right * subplane_size, + center + up * subplane_size - right * subplane_size, + center + up * subplane_size + right * subplane_size + }; for (int j = 0; j < p_planes.size(); j++) { if (j == i) { @@ -762,14 +763,14 @@ Geometry3D::MeshData Geometry3D::build_convex_mesh(const Vector &p_planes } Vector Geometry3D::build_box_planes(const Vector3 &p_extents) { - Vector planes; - - planes.push_back(Plane(Vector3(1, 0, 0), p_extents.x)); - planes.push_back(Plane(Vector3(-1, 0, 0), p_extents.x)); - planes.push_back(Plane(Vector3(0, 1, 0), p_extents.y)); - planes.push_back(Plane(Vector3(0, -1, 0), p_extents.y)); - planes.push_back(Plane(Vector3(0, 0, 1), p_extents.z)); - planes.push_back(Plane(Vector3(0, 0, -1), p_extents.z)); + Vector planes = { + Plane(Vector3(1, 0, 0), p_extents.x), + Plane(Vector3(-1, 0, 0), p_extents.x), + Plane(Vector3(0, 1, 0), p_extents.y), + Plane(Vector3(0, -1, 0), p_extents.y), + Plane(Vector3(0, 0, 1), p_extents.z), + Plane(Vector3(0, 0, -1), p_extents.z) + }; return planes; } diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp index a6d2225bdc8..058e59dea31 100644 --- a/editor/animation_track_editor_plugins.cpp +++ b/editor/animation_track_editor_plugins.cpp @@ -145,20 +145,19 @@ void AnimationTrackEditColor::draw_key_link(int p_index, float p_pixels_sec, int } for (int i = 0; i < color_samples.size() - 1; i++) { - Vector points; - Vector colors; + Vector points = { + Vector2(Math::lerp(x_from, x_to, float(i) / (color_samples.size() - 1)), y_from), + Vector2(Math::lerp(x_from, x_to, float(i + 1) / (color_samples.size() - 1)), y_from), + Vector2(Math::lerp(x_from, x_to, float(i + 1) / (color_samples.size() - 1)), y_from + fh), + Vector2(Math::lerp(x_from, x_to, float(i) / (color_samples.size() - 1)), y_from + fh) + }; - points.push_back(Vector2(Math::lerp(x_from, x_to, float(i) / (color_samples.size() - 1)), y_from)); - colors.push_back(color_samples[i]); - - points.push_back(Vector2(Math::lerp(x_from, x_to, float(i + 1) / (color_samples.size() - 1)), y_from)); - colors.push_back(color_samples[i + 1]); - - points.push_back(Vector2(Math::lerp(x_from, x_to, float(i + 1) / (color_samples.size() - 1)), y_from + fh)); - colors.push_back(color_samples[i + 1]); - - points.push_back(Vector2(Math::lerp(x_from, x_to, float(i) / (color_samples.size() - 1)), y_from + fh)); - colors.push_back(color_samples[i]); + Vector colors = { + color_samples[i], + color_samples[i + 1], + color_samples[i + 1], + color_samples[i] + }; draw_primitive(points, colors, Vector()); } diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index 459de5d35bb..c0029312a7f 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -488,10 +488,11 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_draw() { color.a *= 0.2; } - Vector colors; - colors.push_back(color); - colors.push_back(color); - colors.push_back(color); + Vector colors = { + color, + color, + color + }; blend_space_draw->draw_primitive(points, colors, Vector()); } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 089c37d7a6c..cb84e7ea652 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3381,10 +3381,11 @@ void CanvasItemEditor::_draw_selection() { Size2 move_factor = Size2(MOVE_HANDLE_DISTANCE, MOVE_HANDLE_DISTANCE); viewport->draw_set_transform_matrix(simple_xform); - Vector points; - points.push_back(Vector2(move_factor.x * EDSCALE, 5 * EDSCALE)); - points.push_back(Vector2(move_factor.x * EDSCALE, -5 * EDSCALE)); - points.push_back(Vector2((move_factor.x + 10) * EDSCALE, 0)); + Vector points = { + Vector2(move_factor.x * EDSCALE, 5 * EDSCALE), + Vector2(move_factor.x * EDSCALE, -5 * EDSCALE), + Vector2((move_factor.x + 10) * EDSCALE, 0) + }; viewport->draw_colored_polygon(points, get_theme_color(SNAME("axis_x_color"), SNAME("Editor"))); viewport->draw_line(Point2(), Point2(move_factor.x * EDSCALE, 0), get_theme_color(SNAME("axis_x_color"), SNAME("Editor")), Math::round(EDSCALE)); @@ -5823,11 +5824,12 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String & editor_data->get_undo_redo().add_do_property(child, "rect_size", texture_size); } else if (node_class == "Polygon2D") { Size2 texture_size = texture->get_size(); - Vector list; - list.push_back(Vector2(0, 0)); - list.push_back(Vector2(texture_size.width, 0)); - list.push_back(Vector2(texture_size.width, texture_size.height)); - list.push_back(Vector2(0, texture_size.height)); + Vector list = { + Vector2(0, 0), + Vector2(texture_size.width, 0), + Vector2(texture_size.width, texture_size.height), + Vector2(0, texture_size.height) + }; editor_data->get_undo_redo().add_do_property(child, "polygon", list); } diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp index 474e84cae88..79d73c1f002 100644 --- a/editor/plugins/node_3d_editor_gizmos.cpp +++ b/editor/plugins/node_3d_editor_gizmos.cpp @@ -324,37 +324,34 @@ void EditorNode3DGizmo::add_unscaled_billboard(const Ref &p_material, ERR_FAIL_COND(!spatial_node); Instance ins; - Vector vs; - Vector uv; - Vector colors; + Vector vs = { + Vector3(-p_scale, p_scale, 0), + Vector3(p_scale, p_scale, 0), + Vector3(p_scale, -p_scale, 0), + Vector3(-p_scale, -p_scale, 0) + }; - vs.push_back(Vector3(-p_scale, p_scale, 0)); - vs.push_back(Vector3(p_scale, p_scale, 0)); - vs.push_back(Vector3(p_scale, -p_scale, 0)); - vs.push_back(Vector3(-p_scale, -p_scale, 0)); + Vector uv = { + Vector2(0, 0), + Vector2(1, 0), + Vector2(1, 1), + Vector2(0, 1) + }; - uv.push_back(Vector2(0, 0)); - uv.push_back(Vector2(1, 0)); - uv.push_back(Vector2(1, 1)); - uv.push_back(Vector2(0, 1)); + Vector colors = { + p_modulate, + p_modulate, + p_modulate, + p_modulate + }; - colors.push_back(p_modulate); - colors.push_back(p_modulate); - colors.push_back(p_modulate); - colors.push_back(p_modulate); + Vector indices = { 0, 1, 2, 0, 2, 3 }; Ref mesh = memnew(ArrayMesh); Array a; a.resize(Mesh::ARRAY_MAX); a[Mesh::ARRAY_VERTEX] = vs; a[Mesh::ARRAY_TEX_UV] = uv; - Vector indices; - indices.push_back(0); - indices.push_back(1); - indices.push_back(2); - indices.push_back(0); - indices.push_back(2); - indices.push_back(3); a[Mesh::ARRAY_INDEX] = indices; a[Mesh::ARRAY_COLOR] = colors; mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, a); @@ -1477,9 +1474,10 @@ void Light3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { p_gizmo->add_lines(points_primary, material_primary, false, color); p_gizmo->add_lines(points_secondary, material_secondary, false, color); - Vector handles; - handles.push_back(Vector3(0, 0, -r)); - handles.push_back(Vector3(w, 0, -d)); + Vector handles = { + Vector3(0, 0, -r), + Vector3(w, 0, -d) + }; p_gizmo->add_handles(handles, get_material("handles")); p_gizmo->add_unscaled_billboard(icon, 0.05, color); @@ -2210,10 +2208,10 @@ void SpringArm3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { p_gizmo->clear(); - Vector lines; - - lines.push_back(Vector3()); - lines.push_back(Vector3(0, 0, 1.0) * spring_arm->get_length()); + Vector lines = { + Vector3(), + Vector3(0, 0, 1.0) * spring_arm->get_length() + }; Ref material = get_material("shape_material", p_gizmo); @@ -4296,9 +4294,10 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { p_gizmo->add_collision_segments(collision_segments); - Vector handles; - handles.push_back(Vector3(cs2->get_radius(), 0, 0)); - handles.push_back(Vector3(0, cs2->get_height() * 0.5, 0)); + Vector handles = { + Vector3(cs2->get_radius(), 0, 0), + Vector3(0, cs2->get_height() * 0.5, 0) + }; p_gizmo->add_handles(handles, handles_material); } @@ -4352,16 +4351,16 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { p_gizmo->add_collision_segments(collision_segments); - Vector handles; - handles.push_back(Vector3(cs2->get_radius(), 0, 0)); - handles.push_back(Vector3(0, cs2->get_height() * 0.5, 0)); + Vector handles = { + Vector3(cs2->get_radius(), 0, 0), + Vector3(0, cs2->get_height() * 0.5, 0) + }; p_gizmo->add_handles(handles, handles_material); } if (Object::cast_to(*s)) { Ref wbs = s; const Plane &p = wbs->get_plane(); - Vector points; Vector3 n1 = p.get_any_perpendicular_normal(); Vector3 n2 = p.normal.cross(n1).normalized(); @@ -4373,16 +4372,18 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { p.normal * p.d + n1 * -10.0 + n2 * 10.0, }; - points.push_back(pface[0]); - points.push_back(pface[1]); - points.push_back(pface[1]); - points.push_back(pface[2]); - points.push_back(pface[2]); - points.push_back(pface[3]); - points.push_back(pface[3]); - points.push_back(pface[0]); - points.push_back(p.normal * p.d); - points.push_back(p.normal * p.d + p.normal * 3); + Vector points = { + pface[0], + pface[1], + pface[1], + pface[2], + pface[2], + pface[3], + pface[3], + pface[0], + p.normal * p.d, + p.normal * p.d + p.normal * 3 + }; p_gizmo->add_lines(points, material); p_gizmo->add_collision_segments(points); @@ -4419,9 +4420,10 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { if (Object::cast_to(*s)) { Ref rs = s; - Vector points; - points.push_back(Vector3()); - points.push_back(Vector3(0, 0, rs->get_length())); + Vector points = { + Vector3(), + Vector3(0, 0, rs->get_length()) + }; p_gizmo->add_lines(points, material); p_gizmo->add_collision_segments(points); Vector handles; diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 03797b1797a..587e690780f 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -5260,21 +5260,26 @@ Size2 VisualShaderNodePortPreview::get_minimum_size() const { void VisualShaderNodePortPreview::_notification(int p_what) { if (p_what == NOTIFICATION_DRAW) { - Vector points; - Vector uvs; - Vector colors; - points.push_back(Vector2()); - uvs.push_back(Vector2(0, 0)); - colors.push_back(Color(1, 1, 1, 1)); - points.push_back(Vector2(get_size().width, 0)); - uvs.push_back(Vector2(1, 0)); - colors.push_back(Color(1, 1, 1, 1)); - points.push_back(get_size()); - uvs.push_back(Vector2(1, 1)); - colors.push_back(Color(1, 1, 1, 1)); - points.push_back(Vector2(0, get_size().height)); - uvs.push_back(Vector2(0, 1)); - colors.push_back(Color(1, 1, 1, 1)); + Vector points = { + Vector2(), + Vector2(get_size().width, 0), + get_size(), + Vector2(0, get_size().height) + }; + + Vector uvs = { + Vector2(0, 0), + Vector2(1, 0), + Vector2(1, 1), + Vector2(0, 1) + }; + + Vector colors = { + Color(1, 1, 1, 1), + Color(1, 1, 1, 1), + Color(1, 1, 1, 1), + Color(1, 1, 1, 1) + }; draw_primitive(points, colors, uvs); } diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index 9bc32268514..2923b287be8 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -164,15 +164,15 @@ void CollisionPolygon2D::_notification(int p_what) { dcol.a = 1.0; Vector2 line_to(0, 20); draw_line(Vector2(), line_to, dcol, 3); - Vector pts; real_t tsize = 8; - pts.push_back(line_to + (Vector2(0, tsize))); - pts.push_back(line_to + (Vector2(Math_SQRT12 * tsize, 0))); - pts.push_back(line_to + (Vector2(-Math_SQRT12 * tsize, 0))); - Vector cols; - for (int i = 0; i < 3; i++) { - cols.push_back(dcol); - } + + Vector pts = { + line_to + Vector2(0, tsize), + line_to + Vector2(Math_SQRT12 * tsize, 0), + line_to + Vector2(-Math_SQRT12 * tsize, 0) + }; + + Vector cols{ dcol, dcol, dcol }; draw_primitive(pts, cols, Vector()); //small arrow } diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp index 18426c088d3..a0520ca28f8 100644 --- a/scene/2d/collision_shape_2d.cpp +++ b/scene/2d/collision_shape_2d.cpp @@ -121,15 +121,15 @@ void CollisionShape2D::_notification(int p_what) { } Vector2 line_to(0, 20); draw_line(Vector2(), line_to, draw_col, 2); - Vector pts; real_t tsize = 8; - pts.push_back(line_to + (Vector2(0, tsize))); - pts.push_back(line_to + (Vector2(Math_SQRT12 * tsize, 0))); - pts.push_back(line_to + (Vector2(-Math_SQRT12 * tsize, 0))); - Vector cols; - for (int i = 0; i < 3; i++) { - cols.push_back(draw_col); - } + + Vector pts{ + line_to + Vector2(0, tsize), + line_to + Vector2(Math_SQRT12 * tsize, 0), + line_to + Vector2(-Math_SQRT12 * tsize, 0) + }; + + Vector cols{ draw_col, draw_col, draw_col }; draw_primitive(pts, cols, Vector()); } diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index f62e7f24e35..4673a990825 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -152,11 +152,14 @@ void CPUParticles2D::_update_mesh_texture() { } else { tex_size = Size2(1, 1); } - Vector vertices; - vertices.push_back(-tex_size * 0.5); - vertices.push_back(-tex_size * 0.5 + Vector2(tex_size.x, 0)); - vertices.push_back(-tex_size * 0.5 + tex_size); - vertices.push_back(-tex_size * 0.5 + Vector2(0, tex_size.y)); + + Vector vertices = { + -tex_size * 0.5, + -tex_size * 0.5 + Vector2(tex_size.x, 0), + -tex_size * 0.5 + tex_size, + -tex_size * 0.5 + Vector2(0, tex_size.y) + }; + Vector uvs; AtlasTexture *atlas_texure = Object::cast_to(*texture); if (atlas_texure && atlas_texure->get_atlas().is_valid()) { @@ -172,18 +175,15 @@ void CPUParticles2D::_update_mesh_texture() { uvs.push_back(Vector2(1, 1)); uvs.push_back(Vector2(0, 1)); } - Vector colors; - colors.push_back(Color(1, 1, 1, 1)); - colors.push_back(Color(1, 1, 1, 1)); - colors.push_back(Color(1, 1, 1, 1)); - colors.push_back(Color(1, 1, 1, 1)); - Vector indices; - indices.push_back(0); - indices.push_back(1); - indices.push_back(2); - indices.push_back(2); - indices.push_back(3); - indices.push_back(0); + + Vector colors = { + Color(1, 1, 1, 1), + Color(1, 1, 1, 1), + Color(1, 1, 1, 1), + Color(1, 1, 1, 1) + }; + + Vector indices = { 0, 1, 2, 2, 3, 0 }; Array arr; arr.resize(RS::ARRAY_MAX); diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp index 8c8f794298b..b6d1e5c9345 100644 --- a/scene/2d/gpu_particles_2d.cpp +++ b/scene/2d/gpu_particles_2d.cpp @@ -427,26 +427,23 @@ void GPUParticles2D::_notification(int p_what) { } else { RS::get_singleton()->mesh_clear(mesh); - Vector points; - points.resize(4); - points.write[0] = Vector2(-size.x / 2.0, -size.y / 2.0); - points.write[1] = Vector2(size.x / 2.0, -size.y / 2.0); - points.write[2] = Vector2(size.x / 2.0, size.y / 2.0); - points.write[3] = Vector2(-size.x / 2.0, size.y / 2.0); - Vector uvs; - uvs.resize(4); - uvs.write[0] = Vector2(0, 0); - uvs.write[1] = Vector2(1, 0); - uvs.write[2] = Vector2(1, 1); - uvs.write[3] = Vector2(0, 1); - Vector indices; - indices.resize(6); - indices.write[0] = 0; - indices.write[1] = 1; - indices.write[2] = 2; - indices.write[3] = 0; - indices.write[4] = 2; - indices.write[5] = 3; + + Vector points = { + Vector2(-size.x / 2.0, -size.y / 2.0), + Vector2(size.x / 2.0, -size.y / 2.0), + Vector2(size.x / 2.0, size.y / 2.0), + Vector2(-size.x / 2.0, size.y / 2.0) + }; + + Vector uvs = { + Vector2(0, 0), + Vector2(1, 0), + Vector2(1, 1), + Vector2(0, 1) + }; + + Vector indices = { 0, 1, 2, 0, 2, 3 }; + Array arr; arr.resize(RS::ARRAY_MAX); arr[RS::ARRAY_VERTEX] = points; diff --git a/scene/2d/position_2d.cpp b/scene/2d/position_2d.cpp index 28aeff98ca6..67aff9c5201 100644 --- a/scene/2d/position_2d.cpp +++ b/scene/2d/position_2d.cpp @@ -36,37 +36,41 @@ void Position2D::_draw_cross() { const real_t extents = get_gizmo_extents(); // Add more points to create a "hard stop" in the color gradient. - PackedVector2Array points_x; - points_x.push_back(Point2(+extents, 0)); - points_x.push_back(Point2()); - points_x.push_back(Point2()); - points_x.push_back(Point2(-extents, 0)); + PackedVector2Array points_x = { + Point2(+extents, 0), + Point2(), + Point2(), + Point2(-extents, 0) + }; - PackedVector2Array points_y; - points_y.push_back(Point2(0, +extents)); - points_y.push_back(Point2()); - points_y.push_back(Point2()); - points_y.push_back(Point2(0, -extents)); + PackedVector2Array points_y = { + Point2(0, +extents), + Point2(), + Point2(), + Point2(0, -extents) + }; // Use the axis color which is brighter for the positive axis. // Use a darkened axis color for the negative axis. // This makes it possible to see in which direction the Position3D node is rotated // (which can be important depending on how it's used). // Axis colors are taken from `axis_x_color` and `axis_y_color` (defined in `editor/editor_themes.cpp`). - PackedColorArray colors_x; const Color color_x = Color(0.96, 0.20, 0.32); - colors_x.push_back(color_x); - colors_x.push_back(color_x); - colors_x.push_back(color_x.lerp(Color(0, 0, 0), 0.5)); - colors_x.push_back(color_x.lerp(Color(0, 0, 0), 0.5)); + PackedColorArray colors_x = { + color_x, + color_x, + color_x.lerp(Color(0, 0, 0), 0.5), + color_x.lerp(Color(0, 0, 0), 0.5) + }; draw_multiline_colors(points_x, colors_x); - PackedColorArray colors_y; const Color color_y = Color(0.53, 0.84, 0.01); - colors_y.push_back(color_y); - colors_y.push_back(color_y); - colors_y.push_back(color_y.lerp(Color(0, 0, 0), 0.5)); - colors_y.push_back(color_y.lerp(Color(0, 0, 0), 0.5)); + PackedColorArray colors_y = { + color_y, + color_y, + color_y.lerp(Color(0, 0, 0), 0.5), + color_y.lerp(Color(0, 0, 0), 0.5) + }; draw_multiline_colors(points_y, colors_y); } diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp index 33090fbaccc..1fdd8b05a62 100644 --- a/scene/2d/ray_cast_2d.cpp +++ b/scene/2d/ray_cast_2d.cpp @@ -244,15 +244,13 @@ void RayCast2D::_draw_debug_shape() { xf.rotate(target_position.angle()); xf.translate(Vector2(no_line ? 0 : target_position.length() - arrow_size, 0)); - Vector pts; - pts.push_back(xf.xform(Vector2(arrow_size, 0))); - pts.push_back(xf.xform(Vector2(0, 0.5 * arrow_size))); - pts.push_back(xf.xform(Vector2(0, -0.5 * arrow_size))); + Vector pts = { + xf.xform(Vector2(arrow_size, 0)), + xf.xform(Vector2(0, 0.5 * arrow_size)), + xf.xform(Vector2(0, -0.5 * arrow_size)) + }; - Vector cols; - for (int i = 0; i < 3; i++) { - cols.push_back(draw_col); - } + Vector cols = { draw_col, draw_col, draw_col }; draw_primitive(pts, cols, Vector()); } diff --git a/scene/2d/shape_cast_2d.cpp b/scene/2d/shape_cast_2d.cpp index 7fc1992e969..10194861b46 100644 --- a/scene/2d/shape_cast_2d.cpp +++ b/scene/2d/shape_cast_2d.cpp @@ -239,14 +239,16 @@ void ShapeCast2D::_notification(int p_what) { xf.translate(Vector2(target_position.length(), 0)); draw_line(Vector2(), target_position, draw_col, 2); - Vector pts; + float tsize = 8; - pts.push_back(xf.xform(Vector2(tsize, 0))); - pts.push_back(xf.xform(Vector2(0, Math_SQRT12 * tsize))); - pts.push_back(xf.xform(Vector2(0, -Math_SQRT12 * tsize))); - Vector cols; - for (int i = 0; i < 3; i++) - cols.push_back(draw_col); + + Vector pts = { + xf.xform(Vector2(tsize, 0)), + xf.xform(Vector2(0, Math_SQRT12 * tsize)), + xf.xform(Vector2(0, -Math_SQRT12 * tsize)) + }; + + Vector cols = { draw_col, draw_col, draw_col }; draw_primitive(pts, cols, Vector()); } diff --git a/scene/resources/separation_ray_shape_2d.cpp b/scene/resources/separation_ray_shape_2d.cpp index 5ac8d0a475f..0406c91b704 100644 --- a/scene/resources/separation_ray_shape_2d.cpp +++ b/scene/resources/separation_ray_shape_2d.cpp @@ -59,15 +59,13 @@ void SeparationRayShape2D::draw(const RID &p_to_rid, const Color &p_color) { xf.rotate(target_position.angle()); xf.translate(Vector2(no_line ? 0 : target_position.length() - arrow_size, 0)); - Vector pts; - pts.push_back(xf.xform(Vector2(arrow_size, 0))); - pts.push_back(xf.xform(Vector2(0, 0.5 * arrow_size))); - pts.push_back(xf.xform(Vector2(0, -0.5 * arrow_size))); + Vector pts = { + xf.xform(Vector2(arrow_size, 0)), + xf.xform(Vector2(0, 0.5 * arrow_size)), + xf.xform(Vector2(0, -0.5 * arrow_size)) + }; - Vector cols; - for (int i = 0; i < 3; i++) { - cols.push_back(p_color); - } + Vector cols = { p_color, p_color, p_color }; RS::get_singleton()->canvas_item_add_primitive(p_to_rid, pts, cols, Vector(), RID()); } diff --git a/scene/resources/separation_ray_shape_3d.cpp b/scene/resources/separation_ray_shape_3d.cpp index a059d55bbe2..5aa76165893 100644 --- a/scene/resources/separation_ray_shape_3d.cpp +++ b/scene/resources/separation_ray_shape_3d.cpp @@ -33,9 +33,10 @@ #include "servers/physics_server_3d.h" Vector SeparationRayShape3D::get_debug_mesh_lines() const { - Vector points; - points.push_back(Vector3()); - points.push_back(Vector3(0, 0, get_length())); + Vector points = { + Vector3(), + Vector3(0, 0, get_length()) + }; return points; } diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index c39902739ff..5afd424e039 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -521,21 +521,22 @@ inline void draw_ring(Vector &verts, Vector &indices, Vector outer_points; - outer_points.push_back(ring_rect.position + Vector2(ring_corner_radius[0], ring_corner_radius[0])); //tl - outer_points.push_back(Point2(ring_rect.position.x + ring_rect.size.x - ring_corner_radius[1], ring_rect.position.y + ring_corner_radius[1])); //tr - outer_points.push_back(ring_rect.position + ring_rect.size - Vector2(ring_corner_radius[2], ring_corner_radius[2])); //br - outer_points.push_back(Point2(ring_rect.position.x + ring_corner_radius[3], ring_rect.position.y + ring_rect.size.y - ring_corner_radius[3])); //bl + Vector outer_points = { + ring_rect.position + Vector2(ring_corner_radius[0], ring_corner_radius[0]), //tl + Point2(ring_rect.position.x + ring_rect.size.x - ring_corner_radius[1], ring_rect.position.y + ring_corner_radius[1]), //tr + ring_rect.position + ring_rect.size - Vector2(ring_corner_radius[2], ring_corner_radius[2]), //br + Point2(ring_rect.position.x + ring_corner_radius[3], ring_rect.position.y + ring_rect.size.y - ring_corner_radius[3]) //bl + }; real_t inner_corner_radius[4]; set_inner_corner_radius(style_rect, inner_rect, corner_radius, inner_corner_radius); - Vector inner_points; - inner_points.push_back(inner_rect.position + Vector2(inner_corner_radius[0], inner_corner_radius[0])); //tl - inner_points.push_back(Point2(inner_rect.position.x + inner_rect.size.x - inner_corner_radius[1], inner_rect.position.y + inner_corner_radius[1])); //tr - inner_points.push_back(inner_rect.position + inner_rect.size - Vector2(inner_corner_radius[2], inner_corner_radius[2])); //br - inner_points.push_back(Point2(inner_rect.position.x + inner_corner_radius[3], inner_rect.position.y + inner_rect.size.y - inner_corner_radius[3])); //bl - + Vector inner_points = { + inner_rect.position + Vector2(inner_corner_radius[0], inner_corner_radius[0]), //tl + Point2(inner_rect.position.x + inner_rect.size.x - inner_corner_radius[1], inner_rect.position.y + inner_corner_radius[1]), //tr + inner_rect.position + inner_rect.size - Vector2(inner_corner_radius[2], inner_corner_radius[2]), //br + Point2(inner_rect.position.x + inner_corner_radius[3], inner_rect.position.y + inner_rect.size.y - inner_corner_radius[3]) //bl + }; // Calculate the vertices. for (int corner_index = 0; corner_index < 4; corner_index++) { for (int detail = 0; detail <= adapted_corner_detail; detail++) { diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 44a7af75b9d..ddb9cc74405 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -1765,11 +1765,14 @@ Vector TileSet::_get_square_corner_or_side_terrain_bit_polygon(Vector2i break; } bit_rect.position *= Vector2(p_size) / 6.0; - Vector polygon; - polygon.push_back(bit_rect.position); - polygon.push_back(Vector2(bit_rect.get_end().x, bit_rect.position.y)); - polygon.push_back(bit_rect.get_end()); - polygon.push_back(Vector2(bit_rect.position.x, bit_rect.get_end().y)); + + Vector polygon = { + bit_rect.position, + Vector2(bit_rect.get_end().x, bit_rect.position.y), + bit_rect.get_end(), + Vector2(bit_rect.position.x, bit_rect.get_end().y) + }; + return polygon; } @@ -1984,25 +1987,26 @@ Vector TileSet::_get_isometric_side_terrain_bit_polygon(Vector2i p_size, } Vector TileSet::_get_half_offset_corner_or_side_terrain_bit_polygon(Vector2i p_size, TileSet::CellNeighbor p_bit, float p_overlap, TileSet::TileOffsetAxis p_offset_axis) { - Vector point_list; - point_list.push_back(Vector2(3, (3.0 * (1.0 - p_overlap * 2.0)) / 2.0)); - point_list.push_back(Vector2(3, 3.0 * (1.0 - p_overlap * 2.0))); - point_list.push_back(Vector2(2, 3.0 * (1.0 - (p_overlap * 2.0) * 2.0 / 3.0))); - point_list.push_back(Vector2(1, 3.0 - p_overlap * 2.0)); - point_list.push_back(Vector2(0, 3)); - point_list.push_back(Vector2(-1, 3.0 - p_overlap * 2.0)); - point_list.push_back(Vector2(-2, 3.0 * (1.0 - (p_overlap * 2.0) * 2.0 / 3.0))); - point_list.push_back(Vector2(-3, 3.0 * (1.0 - p_overlap * 2.0))); - point_list.push_back(Vector2(-3, (3.0 * (1.0 - p_overlap * 2.0)) / 2.0)); - point_list.push_back(Vector2(-3, -(3.0 * (1.0 - p_overlap * 2.0)) / 2.0)); - point_list.push_back(Vector2(-3, -3.0 * (1.0 - p_overlap * 2.0))); - point_list.push_back(Vector2(-2, -3.0 * (1.0 - (p_overlap * 2.0) * 2.0 / 3.0))); - point_list.push_back(Vector2(-1, -(3.0 - p_overlap * 2.0))); - point_list.push_back(Vector2(0, -3)); - point_list.push_back(Vector2(1, -(3.0 - p_overlap * 2.0))); - point_list.push_back(Vector2(2, -3.0 * (1.0 - (p_overlap * 2.0) * 2.0 / 3.0))); - point_list.push_back(Vector2(3, -3.0 * (1.0 - p_overlap * 2.0))); - point_list.push_back(Vector2(3, -(3.0 * (1.0 - p_overlap * 2.0)) / 2.0)); + Vector point_list = { + Vector2(3, (3.0 * (1.0 - p_overlap * 2.0)) / 2.0), + Vector2(3, 3.0 * (1.0 - p_overlap * 2.0)), + Vector2(2, 3.0 * (1.0 - (p_overlap * 2.0) * 2.0 / 3.0)), + Vector2(1, 3.0 - p_overlap * 2.0), + Vector2(0, 3), + Vector2(-1, 3.0 - p_overlap * 2.0), + Vector2(-2, 3.0 * (1.0 - (p_overlap * 2.0) * 2.0 / 3.0)), + Vector2(-3, 3.0 * (1.0 - p_overlap * 2.0)), + Vector2(-3, (3.0 * (1.0 - p_overlap * 2.0)) / 2.0), + Vector2(-3, -(3.0 * (1.0 - p_overlap * 2.0)) / 2.0), + Vector2(-3, -3.0 * (1.0 - p_overlap * 2.0)), + Vector2(-2, -3.0 * (1.0 - (p_overlap * 2.0) * 2.0 / 3.0)), + Vector2(-1, -(3.0 - p_overlap * 2.0)), + Vector2(0, -3), + Vector2(1, -(3.0 - p_overlap * 2.0)), + Vector2(2, -3.0 * (1.0 - (p_overlap * 2.0) * 2.0 / 3.0)), + Vector2(3, -3.0 * (1.0 - p_overlap * 2.0)), + Vector2(3, -(3.0 * (1.0 - p_overlap * 2.0)) / 2.0) + }; Vector2 unit = Vector2(p_size) / 6.0; for (int i = 0; i < point_list.size(); i++) { @@ -2144,19 +2148,20 @@ Vector TileSet::_get_half_offset_corner_or_side_terrain_bit_polygon(Vect } Vector TileSet::_get_half_offset_corner_terrain_bit_polygon(Vector2i p_size, TileSet::CellNeighbor p_bit, float p_overlap, TileSet::TileOffsetAxis p_offset_axis) { - Vector point_list; - point_list.push_back(Vector2(3, 0)); - point_list.push_back(Vector2(3, 3.0 * (1.0 - p_overlap * 2.0))); - point_list.push_back(Vector2(1.5, (3.0 * (1.0 - p_overlap * 2.0) + 3.0) / 2.0)); - point_list.push_back(Vector2(0, 3)); - point_list.push_back(Vector2(-1.5, (3.0 * (1.0 - p_overlap * 2.0) + 3.0) / 2.0)); - point_list.push_back(Vector2(-3, 3.0 * (1.0 - p_overlap * 2.0))); - point_list.push_back(Vector2(-3, 0)); - point_list.push_back(Vector2(-3, -3.0 * (1.0 - p_overlap * 2.0))); - point_list.push_back(Vector2(-1.5, -(3.0 * (1.0 - p_overlap * 2.0) + 3.0) / 2.0)); - point_list.push_back(Vector2(0, -3)); - point_list.push_back(Vector2(1.5, -(3.0 * (1.0 - p_overlap * 2.0) + 3.0) / 2.0)); - point_list.push_back(Vector2(3, -3.0 * (1.0 - p_overlap * 2.0))); + Vector point_list = { + Vector2(3, 0), + Vector2(3, 3.0 * (1.0 - p_overlap * 2.0)), + Vector2(1.5, (3.0 * (1.0 - p_overlap * 2.0) + 3.0) / 2.0), + Vector2(0, 3), + Vector2(-1.5, (3.0 * (1.0 - p_overlap * 2.0) + 3.0) / 2.0), + Vector2(-3, 3.0 * (1.0 - p_overlap * 2.0)), + Vector2(-3, 0), + Vector2(-3, -3.0 * (1.0 - p_overlap * 2.0)), + Vector2(-1.5, -(3.0 * (1.0 - p_overlap * 2.0) + 3.0) / 2.0), + Vector2(0, -3), + Vector2(1.5, -(3.0 * (1.0 - p_overlap * 2.0) + 3.0) / 2.0), + Vector2(3, -3.0 * (1.0 - p_overlap * 2.0)) + }; Vector2 unit = Vector2(p_size) / 6.0; for (int i = 0; i < point_list.size(); i++) { @@ -2250,13 +2255,14 @@ Vector TileSet::_get_half_offset_corner_terrain_bit_polygon(Vector2i p_s } Vector TileSet::_get_half_offset_side_terrain_bit_polygon(Vector2i p_size, TileSet::CellNeighbor p_bit, float p_overlap, TileSet::TileOffsetAxis p_offset_axis) { - Vector point_list; - point_list.push_back(Vector2(3, 3.0 * (1.0 - p_overlap * 2.0))); - point_list.push_back(Vector2(0, 3)); - point_list.push_back(Vector2(-3, 3.0 * (1.0 - p_overlap * 2.0))); - point_list.push_back(Vector2(-3, -3.0 * (1.0 - p_overlap * 2.0))); - point_list.push_back(Vector2(0, -3)); - point_list.push_back(Vector2(3, -3.0 * (1.0 - p_overlap * 2.0))); + Vector point_list = { + Vector2(3, 3.0 * (1.0 - p_overlap * 2.0)), + Vector2(0, 3), + Vector2(-3, 3.0 * (1.0 - p_overlap * 2.0)), + Vector2(-3, -3.0 * (1.0 - p_overlap * 2.0)), + Vector2(0, -3), + Vector2(3, -3.0 * (1.0 - p_overlap * 2.0)) + }; Vector2 unit = Vector2(p_size) / 6.0; for (int i = 0; i < point_list.size(); i++) { diff --git a/scene/resources/world_boundary_shape_3d.cpp b/scene/resources/world_boundary_shape_3d.cpp index efa288511db..09d41e82919 100644 --- a/scene/resources/world_boundary_shape_3d.cpp +++ b/scene/resources/world_boundary_shape_3d.cpp @@ -34,7 +34,6 @@ Vector WorldBoundaryShape3D::get_debug_mesh_lines() const { Plane p = get_plane(); - Vector points; Vector3 n1 = p.get_any_perpendicular_normal(); Vector3 n2 = p.normal.cross(n1).normalized(); @@ -46,16 +45,18 @@ Vector WorldBoundaryShape3D::get_debug_mesh_lines() const { p.normal * p.d + n1 * -10.0 + n2 * 10.0, }; - points.push_back(pface[0]); - points.push_back(pface[1]); - points.push_back(pface[1]); - points.push_back(pface[2]); - points.push_back(pface[2]); - points.push_back(pface[3]); - points.push_back(pface[3]); - points.push_back(pface[0]); - points.push_back(p.normal * p.d); - points.push_back(p.normal * p.d + p.normal * 3); + Vector points = { + pface[0], + pface[1], + pface[1], + pface[2], + pface[2], + pface[3], + pface[3], + pface[0], + p.normal * p.d, + p.normal * p.d + p.normal * 3 + }; return points; } diff --git a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp index cd7b2622ab9..36604073cc4 100644 --- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp +++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp @@ -1795,12 +1795,14 @@ void RenderForwardClustered::_render_material(const Transform3D &p_cam_transform { RenderListParameters render_list_params(render_list[RENDER_LIST_SECONDARY].elements.ptr(), render_list[RENDER_LIST_SECONDARY].element_info.ptr(), render_list[RENDER_LIST_SECONDARY].elements.size(), true, pass_mode, true, false, rp_uniform_set); //regular forward for now - Vector clear; - clear.push_back(Color(0, 0, 0, 0)); - clear.push_back(Color(0, 0, 0, 0)); - clear.push_back(Color(0, 0, 0, 0)); - clear.push_back(Color(0, 0, 0, 0)); - clear.push_back(Color(0, 0, 0, 0)); + Vector clear = { + Color(0, 0, 0, 0), + Color(0, 0, 0, 0), + Color(0, 0, 0, 0), + Color(0, 0, 0, 0), + Color(0, 0, 0, 0) + }; + RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(p_framebuffer, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, clear, 1.0, 0, p_region); _render_list(draw_list, RD::get_singleton()->framebuffer_get_format(p_framebuffer), &render_list_params, 0, render_list_params.element_count); RD::get_singleton()->draw_list_end(); @@ -1839,12 +1841,13 @@ void RenderForwardClustered::_render_uv2(const PagedArray &p { RenderListParameters render_list_params(render_list[RENDER_LIST_SECONDARY].elements.ptr(), render_list[RENDER_LIST_SECONDARY].element_info.ptr(), render_list[RENDER_LIST_SECONDARY].elements.size(), true, pass_mode, true, false, rp_uniform_set, true); //regular forward for now - Vector clear; - clear.push_back(Color(0, 0, 0, 0)); - clear.push_back(Color(0, 0, 0, 0)); - clear.push_back(Color(0, 0, 0, 0)); - clear.push_back(Color(0, 0, 0, 0)); - clear.push_back(Color(0, 0, 0, 0)); + Vector clear = { + Color(0, 0, 0, 0), + Color(0, 0, 0, 0), + Color(0, 0, 0, 0), + Color(0, 0, 0, 0), + Color(0, 0, 0, 0) + }; RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(p_framebuffer, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, clear, 1.0, 0, p_region); const int uv_offset_count = 9; @@ -1901,11 +1904,12 @@ void RenderForwardClustered::_render_sdfgi(RID p_render_buffers, const Vector3i Vector3 half_extents = p_bounds.size * 0.5; Vector3 center = p_bounds.position + half_extents; - Vector sbs; - sbs.push_back(p_albedo_texture); - sbs.push_back(p_emission_texture); - sbs.push_back(p_emission_aniso_texture); - sbs.push_back(p_geom_facing_texture); + Vector sbs = { + p_albedo_texture, + p_emission_texture, + p_emission_aniso_texture, + p_geom_facing_texture + }; //print_line("re-render " + p_from + " - " + p_size + " bounds " + p_bounds); for (int i = 0; i < 3; i++) { diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp index 8b2a60c487e..b9c51f54613 100644 --- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp +++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp @@ -1002,12 +1002,13 @@ void RenderForwardMobile::_render_material(const Transform3D &p_cam_transform, c { RenderListParameters render_list_params(render_list[RENDER_LIST_SECONDARY].elements.ptr(), render_list[RENDER_LIST_SECONDARY].element_info.ptr(), render_list[RENDER_LIST_SECONDARY].elements.size(), true, pass_mode, rp_uniform_set, 0); //regular forward for now - Vector clear; - clear.push_back(Color(0, 0, 0, 0)); - clear.push_back(Color(0, 0, 0, 0)); - clear.push_back(Color(0, 0, 0, 0)); - clear.push_back(Color(0, 0, 0, 0)); - clear.push_back(Color(0, 0, 0, 0)); + Vector clear = { + Color(0, 0, 0, 0), + Color(0, 0, 0, 0), + Color(0, 0, 0, 0), + Color(0, 0, 0, 0), + Color(0, 0, 0, 0) + }; RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(p_framebuffer, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, clear, 1.0, 0, p_region); _render_list(draw_list, RD::get_singleton()->framebuffer_get_format(p_framebuffer), &render_list_params, 0, render_list_params.element_count); RD::get_singleton()->draw_list_end(); @@ -1043,12 +1044,14 @@ void RenderForwardMobile::_render_uv2(const PagedArray &p_in { RenderListParameters render_list_params(render_list[RENDER_LIST_SECONDARY].elements.ptr(), render_list[RENDER_LIST_SECONDARY].element_info.ptr(), render_list[RENDER_LIST_SECONDARY].elements.size(), true, pass_mode, rp_uniform_set, true, 0); //regular forward for now - Vector clear; - clear.push_back(Color(0, 0, 0, 0)); - clear.push_back(Color(0, 0, 0, 0)); - clear.push_back(Color(0, 0, 0, 0)); - clear.push_back(Color(0, 0, 0, 0)); - clear.push_back(Color(0, 0, 0, 0)); + Vector clear = { + Color(0, 0, 0, 0), + Color(0, 0, 0, 0), + Color(0, 0, 0, 0), + Color(0, 0, 0, 0), + Color(0, 0, 0, 0) + }; + RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(p_framebuffer, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, clear, 1.0, 0, p_region); const int uv_offset_count = 9;