Use List Initializations for Vectors.

This commit is contained in:
Anilforextra 2022-01-11 21:12:39 +05:45
parent 5f7c1081a7
commit 6c3a0460a8
22 changed files with 326 additions and 308 deletions

View File

@ -698,10 +698,7 @@ Variant Geometry2D::line_intersects_line(const Vector2 &p_from_a, const Vector2
Vector<Vector2> Geometry2D::get_closest_points_between_segments(const Vector2 &p1, const Vector2 &q1, const Vector2 &p2, const Vector2 &q2) { Vector<Vector2> Geometry2D::get_closest_points_between_segments(const Vector2 &p1, const Vector2 &q1, const Vector2 &p2, const Vector2 &q2) {
Vector2 r1, r2; Vector2 r1, r2;
::Geometry2D::get_closest_points_between_segments(p1, q1, p2, q2, r1, r2); ::Geometry2D::get_closest_points_between_segments(p1, q1, p2, q2, r1, r2);
Vector<Vector2> r; Vector<Vector2> r = { r1, r2 };
r.resize(2);
r.set(0, r1);
r.set(1, r2);
return r; return r;
} }
@ -923,10 +920,7 @@ Vector<Plane> Geometry3D::build_capsule_planes(float p_radius, float p_height, i
Vector<Vector3> Geometry3D::get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2) { Vector<Vector3> Geometry3D::get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2) {
Vector3 r1, r2; Vector3 r1, r2;
::Geometry3D::get_closest_points_between_segments(p1, p2, q1, q2, r1, r2); ::Geometry3D::get_closest_points_between_segments(p1, p2, q1, q2, r1, r2);
Vector<Vector3> r; Vector<Vector3> r = { r1, r2 };
r.resize(2);
r.set(0, r1);
r.set(1, r2);
return r; return r;
} }

View File

@ -699,8 +699,7 @@ Vector<Vector2> AStar2D::get_point_path(int p_from_id, int p_to_id) {
ERR_FAIL_COND_V_MSG(!to_exists, Vector<Vector2>(), vformat("Can't get point path. Point with id: %d doesn't exist.", p_to_id)); ERR_FAIL_COND_V_MSG(!to_exists, Vector<Vector2>(), vformat("Can't get point path. Point with id: %d doesn't exist.", p_to_id));
if (a == b) { if (a == b) {
Vector<Vector2> ret; Vector<Vector2> ret = { Vector2(a->pos.x, a->pos.y) };
ret.push_back(Vector2(a->pos.x, a->pos.y));
return ret; return ret;
} }

View File

@ -644,14 +644,15 @@ Geometry3D::MeshData Geometry3D::build_convex_mesh(const Vector<Plane> &p_planes
Vector3 right = p.normal.cross(ref).normalized(); Vector3 right = p.normal.cross(ref).normalized();
Vector3 up = p.normal.cross(right).normalized(); Vector3 up = p.normal.cross(right).normalized();
Vector<Vector3> vertices;
Vector3 center = p.center(); Vector3 center = p.center();
// make a quad clockwise // make a quad clockwise
vertices.push_back(center - up * subplane_size + right * subplane_size); Vector<Vector3> vertices = {
vertices.push_back(center - up * subplane_size - right * subplane_size); center - up * subplane_size + right * subplane_size,
vertices.push_back(center + up * subplane_size - right * subplane_size); center - up * subplane_size - right * subplane_size,
vertices.push_back(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++) { for (int j = 0; j < p_planes.size(); j++) {
if (j == i) { if (j == i) {
@ -762,14 +763,14 @@ Geometry3D::MeshData Geometry3D::build_convex_mesh(const Vector<Plane> &p_planes
} }
Vector<Plane> Geometry3D::build_box_planes(const Vector3 &p_extents) { Vector<Plane> Geometry3D::build_box_planes(const Vector3 &p_extents) {
Vector<Plane> planes; Vector<Plane> planes = {
Plane(Vector3(1, 0, 0), p_extents.x),
planes.push_back(Plane(Vector3(1, 0, 0), p_extents.x)); Plane(Vector3(-1, 0, 0), p_extents.x),
planes.push_back(Plane(Vector3(-1, 0, 0), p_extents.x)); Plane(Vector3(0, 1, 0), p_extents.y),
planes.push_back(Plane(Vector3(0, 1, 0), p_extents.y)); Plane(Vector3(0, -1, 0), p_extents.y),
planes.push_back(Plane(Vector3(0, -1, 0), p_extents.y)); Plane(Vector3(0, 0, 1), p_extents.z),
planes.push_back(Plane(Vector3(0, 0, 1), p_extents.z)); Plane(Vector3(0, 0, -1), p_extents.z)
planes.push_back(Plane(Vector3(0, 0, -1), p_extents.z)); };
return planes; return planes;
} }

View File

@ -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++) { for (int i = 0; i < color_samples.size() - 1; i++) {
Vector<Vector2> points; Vector<Vector2> points = {
Vector<Color> colors; 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)); Vector<Color> colors = {
colors.push_back(color_samples[i]); color_samples[i],
color_samples[i + 1],
points.push_back(Vector2(Math::lerp(x_from, x_to, float(i + 1) / (color_samples.size() - 1)), y_from)); color_samples[i + 1],
colors.push_back(color_samples[i + 1]); color_samples[i]
};
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]);
draw_primitive(points, colors, Vector<Vector2>()); draw_primitive(points, colors, Vector<Vector2>());
} }

View File

@ -488,10 +488,11 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_draw() {
color.a *= 0.2; color.a *= 0.2;
} }
Vector<Color> colors; Vector<Color> colors = {
colors.push_back(color); color,
colors.push_back(color); color,
colors.push_back(color); color
};
blend_space_draw->draw_primitive(points, colors, Vector<Vector2>()); blend_space_draw->draw_primitive(points, colors, Vector<Vector2>());
} }

View File

@ -3381,10 +3381,11 @@ void CanvasItemEditor::_draw_selection() {
Size2 move_factor = Size2(MOVE_HANDLE_DISTANCE, MOVE_HANDLE_DISTANCE); Size2 move_factor = Size2(MOVE_HANDLE_DISTANCE, MOVE_HANDLE_DISTANCE);
viewport->draw_set_transform_matrix(simple_xform); viewport->draw_set_transform_matrix(simple_xform);
Vector<Point2> points; Vector<Point2> points = {
points.push_back(Vector2(move_factor.x * EDSCALE, 5 * EDSCALE)); Vector2(move_factor.x * EDSCALE, 5 * EDSCALE),
points.push_back(Vector2(move_factor.x * EDSCALE, -5 * EDSCALE)); Vector2(move_factor.x * EDSCALE, -5 * EDSCALE),
points.push_back(Vector2((move_factor.x + 10) * EDSCALE, 0)); Vector2((move_factor.x + 10) * EDSCALE, 0)
};
viewport->draw_colored_polygon(points, get_theme_color(SNAME("axis_x_color"), SNAME("Editor"))); 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)); 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); editor_data->get_undo_redo().add_do_property(child, "rect_size", texture_size);
} else if (node_class == "Polygon2D") { } else if (node_class == "Polygon2D") {
Size2 texture_size = texture->get_size(); Size2 texture_size = texture->get_size();
Vector<Vector2> list; Vector<Vector2> list = {
list.push_back(Vector2(0, 0)); Vector2(0, 0),
list.push_back(Vector2(texture_size.width, 0)); Vector2(texture_size.width, 0),
list.push_back(Vector2(texture_size.width, texture_size.height)); Vector2(texture_size.width, texture_size.height),
list.push_back(Vector2(0, texture_size.height)); Vector2(0, texture_size.height)
};
editor_data->get_undo_redo().add_do_property(child, "polygon", list); editor_data->get_undo_redo().add_do_property(child, "polygon", list);
} }

View File

@ -324,37 +324,34 @@ void EditorNode3DGizmo::add_unscaled_billboard(const Ref<Material> &p_material,
ERR_FAIL_COND(!spatial_node); ERR_FAIL_COND(!spatial_node);
Instance ins; Instance ins;
Vector<Vector3> vs; Vector<Vector3> vs = {
Vector<Vector2> uv; Vector3(-p_scale, p_scale, 0),
Vector<Color> colors; 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)); Vector<Vector2> uv = {
vs.push_back(Vector3(p_scale, p_scale, 0)); Vector2(0, 0),
vs.push_back(Vector3(p_scale, -p_scale, 0)); Vector2(1, 0),
vs.push_back(Vector3(-p_scale, -p_scale, 0)); Vector2(1, 1),
Vector2(0, 1)
};
uv.push_back(Vector2(0, 0)); Vector<Color> colors = {
uv.push_back(Vector2(1, 0)); p_modulate,
uv.push_back(Vector2(1, 1)); p_modulate,
uv.push_back(Vector2(0, 1)); p_modulate,
p_modulate
};
colors.push_back(p_modulate); Vector<int> indices = { 0, 1, 2, 0, 2, 3 };
colors.push_back(p_modulate);
colors.push_back(p_modulate);
colors.push_back(p_modulate);
Ref<ArrayMesh> mesh = memnew(ArrayMesh); Ref<ArrayMesh> mesh = memnew(ArrayMesh);
Array a; Array a;
a.resize(Mesh::ARRAY_MAX); a.resize(Mesh::ARRAY_MAX);
a[Mesh::ARRAY_VERTEX] = vs; a[Mesh::ARRAY_VERTEX] = vs;
a[Mesh::ARRAY_TEX_UV] = uv; a[Mesh::ARRAY_TEX_UV] = uv;
Vector<int> 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_INDEX] = indices;
a[Mesh::ARRAY_COLOR] = colors; a[Mesh::ARRAY_COLOR] = colors;
mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, a); 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_primary, material_primary, false, color);
p_gizmo->add_lines(points_secondary, material_secondary, false, color); p_gizmo->add_lines(points_secondary, material_secondary, false, color);
Vector<Vector3> handles; Vector<Vector3> handles = {
handles.push_back(Vector3(0, 0, -r)); Vector3(0, 0, -r),
handles.push_back(Vector3(w, 0, -d)); Vector3(w, 0, -d)
};
p_gizmo->add_handles(handles, get_material("handles")); p_gizmo->add_handles(handles, get_material("handles"));
p_gizmo->add_unscaled_billboard(icon, 0.05, color); p_gizmo->add_unscaled_billboard(icon, 0.05, color);
@ -2210,10 +2208,10 @@ void SpringArm3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
p_gizmo->clear(); p_gizmo->clear();
Vector<Vector3> lines; Vector<Vector3> lines = {
Vector3(),
lines.push_back(Vector3()); Vector3(0, 0, 1.0) * spring_arm->get_length()
lines.push_back(Vector3(0, 0, 1.0) * spring_arm->get_length()); };
Ref<StandardMaterial3D> material = get_material("shape_material", p_gizmo); Ref<StandardMaterial3D> material = get_material("shape_material", p_gizmo);
@ -4296,9 +4294,10 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
p_gizmo->add_collision_segments(collision_segments); p_gizmo->add_collision_segments(collision_segments);
Vector<Vector3> handles; Vector<Vector3> handles = {
handles.push_back(Vector3(cs2->get_radius(), 0, 0)); Vector3(cs2->get_radius(), 0, 0),
handles.push_back(Vector3(0, cs2->get_height() * 0.5, 0)); Vector3(0, cs2->get_height() * 0.5, 0)
};
p_gizmo->add_handles(handles, handles_material); p_gizmo->add_handles(handles, handles_material);
} }
@ -4352,16 +4351,16 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
p_gizmo->add_collision_segments(collision_segments); p_gizmo->add_collision_segments(collision_segments);
Vector<Vector3> handles; Vector<Vector3> handles = {
handles.push_back(Vector3(cs2->get_radius(), 0, 0)); Vector3(cs2->get_radius(), 0, 0),
handles.push_back(Vector3(0, cs2->get_height() * 0.5, 0)); Vector3(0, cs2->get_height() * 0.5, 0)
};
p_gizmo->add_handles(handles, handles_material); p_gizmo->add_handles(handles, handles_material);
} }
if (Object::cast_to<WorldBoundaryShape3D>(*s)) { if (Object::cast_to<WorldBoundaryShape3D>(*s)) {
Ref<WorldBoundaryShape3D> wbs = s; Ref<WorldBoundaryShape3D> wbs = s;
const Plane &p = wbs->get_plane(); const Plane &p = wbs->get_plane();
Vector<Vector3> points;
Vector3 n1 = p.get_any_perpendicular_normal(); Vector3 n1 = p.get_any_perpendicular_normal();
Vector3 n2 = p.normal.cross(n1).normalized(); 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, p.normal * p.d + n1 * -10.0 + n2 * 10.0,
}; };
points.push_back(pface[0]); Vector<Vector3> points = {
points.push_back(pface[1]); pface[0],
points.push_back(pface[1]); pface[1],
points.push_back(pface[2]); pface[1],
points.push_back(pface[2]); pface[2],
points.push_back(pface[3]); pface[2],
points.push_back(pface[3]); pface[3],
points.push_back(pface[0]); pface[3],
points.push_back(p.normal * p.d); pface[0],
points.push_back(p.normal * p.d + p.normal * 3); p.normal * p.d,
p.normal * p.d + p.normal * 3
};
p_gizmo->add_lines(points, material); p_gizmo->add_lines(points, material);
p_gizmo->add_collision_segments(points); p_gizmo->add_collision_segments(points);
@ -4419,9 +4420,10 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
if (Object::cast_to<SeparationRayShape3D>(*s)) { if (Object::cast_to<SeparationRayShape3D>(*s)) {
Ref<SeparationRayShape3D> rs = s; Ref<SeparationRayShape3D> rs = s;
Vector<Vector3> points; Vector<Vector3> points = {
points.push_back(Vector3()); Vector3(),
points.push_back(Vector3(0, 0, rs->get_length())); Vector3(0, 0, rs->get_length())
};
p_gizmo->add_lines(points, material); p_gizmo->add_lines(points, material);
p_gizmo->add_collision_segments(points); p_gizmo->add_collision_segments(points);
Vector<Vector3> handles; Vector<Vector3> handles;

View File

@ -5260,21 +5260,26 @@ Size2 VisualShaderNodePortPreview::get_minimum_size() const {
void VisualShaderNodePortPreview::_notification(int p_what) { void VisualShaderNodePortPreview::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) { if (p_what == NOTIFICATION_DRAW) {
Vector<Vector2> points; Vector<Vector2> points = {
Vector<Vector2> uvs; Vector2(),
Vector<Color> colors; Vector2(get_size().width, 0),
points.push_back(Vector2()); get_size(),
uvs.push_back(Vector2(0, 0)); Vector2(0, get_size().height)
colors.push_back(Color(1, 1, 1, 1)); };
points.push_back(Vector2(get_size().width, 0));
uvs.push_back(Vector2(1, 0)); Vector<Vector2> uvs = {
colors.push_back(Color(1, 1, 1, 1)); Vector2(0, 0),
points.push_back(get_size()); Vector2(1, 0),
uvs.push_back(Vector2(1, 1)); Vector2(1, 1),
colors.push_back(Color(1, 1, 1, 1)); Vector2(0, 1)
points.push_back(Vector2(0, get_size().height)); };
uvs.push_back(Vector2(0, 1));
colors.push_back(Color(1, 1, 1, 1)); Vector<Color> 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); draw_primitive(points, colors, uvs);
} }

View File

@ -164,15 +164,15 @@ void CollisionPolygon2D::_notification(int p_what) {
dcol.a = 1.0; dcol.a = 1.0;
Vector2 line_to(0, 20); Vector2 line_to(0, 20);
draw_line(Vector2(), line_to, dcol, 3); draw_line(Vector2(), line_to, dcol, 3);
Vector<Vector2> pts;
real_t tsize = 8; real_t tsize = 8;
pts.push_back(line_to + (Vector2(0, tsize)));
pts.push_back(line_to + (Vector2(Math_SQRT12 * tsize, 0))); Vector<Vector2> pts = {
pts.push_back(line_to + (Vector2(-Math_SQRT12 * tsize, 0))); line_to + Vector2(0, tsize),
Vector<Color> cols; line_to + Vector2(Math_SQRT12 * tsize, 0),
for (int i = 0; i < 3; i++) { line_to + Vector2(-Math_SQRT12 * tsize, 0)
cols.push_back(dcol); };
}
Vector<Color> cols{ dcol, dcol, dcol };
draw_primitive(pts, cols, Vector<Vector2>()); //small arrow draw_primitive(pts, cols, Vector<Vector2>()); //small arrow
} }

View File

@ -121,15 +121,15 @@ void CollisionShape2D::_notification(int p_what) {
} }
Vector2 line_to(0, 20); Vector2 line_to(0, 20);
draw_line(Vector2(), line_to, draw_col, 2); draw_line(Vector2(), line_to, draw_col, 2);
Vector<Vector2> pts;
real_t tsize = 8; real_t tsize = 8;
pts.push_back(line_to + (Vector2(0, tsize)));
pts.push_back(line_to + (Vector2(Math_SQRT12 * tsize, 0))); Vector<Vector2> pts{
pts.push_back(line_to + (Vector2(-Math_SQRT12 * tsize, 0))); line_to + Vector2(0, tsize),
Vector<Color> cols; line_to + Vector2(Math_SQRT12 * tsize, 0),
for (int i = 0; i < 3; i++) { line_to + Vector2(-Math_SQRT12 * tsize, 0)
cols.push_back(draw_col); };
}
Vector<Color> cols{ draw_col, draw_col, draw_col };
draw_primitive(pts, cols, Vector<Vector2>()); draw_primitive(pts, cols, Vector<Vector2>());
} }

View File

@ -152,11 +152,14 @@ void CPUParticles2D::_update_mesh_texture() {
} else { } else {
tex_size = Size2(1, 1); tex_size = Size2(1, 1);
} }
Vector<Vector2> vertices;
vertices.push_back(-tex_size * 0.5); Vector<Vector2> vertices = {
vertices.push_back(-tex_size * 0.5 + Vector2(tex_size.x, 0)); -tex_size * 0.5,
vertices.push_back(-tex_size * 0.5 + tex_size); -tex_size * 0.5 + Vector2(tex_size.x, 0),
vertices.push_back(-tex_size * 0.5 + Vector2(0, tex_size.y)); -tex_size * 0.5 + tex_size,
-tex_size * 0.5 + Vector2(0, tex_size.y)
};
Vector<Vector2> uvs; Vector<Vector2> uvs;
AtlasTexture *atlas_texure = Object::cast_to<AtlasTexture>(*texture); AtlasTexture *atlas_texure = Object::cast_to<AtlasTexture>(*texture);
if (atlas_texure && atlas_texure->get_atlas().is_valid()) { 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(1, 1));
uvs.push_back(Vector2(0, 1)); uvs.push_back(Vector2(0, 1));
} }
Vector<Color> colors;
colors.push_back(Color(1, 1, 1, 1)); Vector<Color> colors = {
colors.push_back(Color(1, 1, 1, 1)); Color(1, 1, 1, 1),
colors.push_back(Color(1, 1, 1, 1)); Color(1, 1, 1, 1),
colors.push_back(Color(1, 1, 1, 1)); Color(1, 1, 1, 1),
Vector<int> indices; Color(1, 1, 1, 1)
indices.push_back(0); };
indices.push_back(1);
indices.push_back(2); Vector<int> indices = { 0, 1, 2, 2, 3, 0 };
indices.push_back(2);
indices.push_back(3);
indices.push_back(0);
Array arr; Array arr;
arr.resize(RS::ARRAY_MAX); arr.resize(RS::ARRAY_MAX);

View File

@ -427,26 +427,23 @@ void GPUParticles2D::_notification(int p_what) {
} else { } else {
RS::get_singleton()->mesh_clear(mesh); RS::get_singleton()->mesh_clear(mesh);
Vector<Vector2> points;
points.resize(4); Vector<Vector2> points = {
points.write[0] = Vector2(-size.x / 2.0, -size.y / 2.0); Vector2(-size.x / 2.0, -size.y / 2.0),
points.write[1] = Vector2(size.x / 2.0, -size.y / 2.0); Vector2(size.x / 2.0, -size.y / 2.0),
points.write[2] = Vector2(size.x / 2.0, size.y / 2.0); Vector2(size.x / 2.0, size.y / 2.0),
points.write[3] = Vector2(-size.x / 2.0, size.y / 2.0); Vector2(-size.x / 2.0, size.y / 2.0)
Vector<Vector2> uvs; };
uvs.resize(4);
uvs.write[0] = Vector2(0, 0); Vector<Vector2> uvs = {
uvs.write[1] = Vector2(1, 0); Vector2(0, 0),
uvs.write[2] = Vector2(1, 1); Vector2(1, 0),
uvs.write[3] = Vector2(0, 1); Vector2(1, 1),
Vector<int> indices; Vector2(0, 1)
indices.resize(6); };
indices.write[0] = 0;
indices.write[1] = 1; Vector<int> indices = { 0, 1, 2, 0, 2, 3 };
indices.write[2] = 2;
indices.write[3] = 0;
indices.write[4] = 2;
indices.write[5] = 3;
Array arr; Array arr;
arr.resize(RS::ARRAY_MAX); arr.resize(RS::ARRAY_MAX);
arr[RS::ARRAY_VERTEX] = points; arr[RS::ARRAY_VERTEX] = points;

View File

@ -36,37 +36,41 @@ void Position2D::_draw_cross() {
const real_t extents = get_gizmo_extents(); const real_t extents = get_gizmo_extents();
// Add more points to create a "hard stop" in the color gradient. // Add more points to create a "hard stop" in the color gradient.
PackedVector2Array points_x; PackedVector2Array points_x = {
points_x.push_back(Point2(+extents, 0)); Point2(+extents, 0),
points_x.push_back(Point2()); Point2(),
points_x.push_back(Point2()); Point2(),
points_x.push_back(Point2(-extents, 0)); Point2(-extents, 0)
};
PackedVector2Array points_y; PackedVector2Array points_y = {
points_y.push_back(Point2(0, +extents)); Point2(0, +extents),
points_y.push_back(Point2()); Point2(),
points_y.push_back(Point2()); Point2(),
points_y.push_back(Point2(0, -extents)); Point2(0, -extents)
};
// Use the axis color which is brighter for the positive axis. // Use the axis color which is brighter for the positive axis.
// Use a darkened axis color for the negative axis. // Use a darkened axis color for the negative axis.
// This makes it possible to see in which direction the Position3D node is rotated // This makes it possible to see in which direction the Position3D node is rotated
// (which can be important depending on how it's used). // (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`). // 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); const Color color_x = Color(0.96, 0.20, 0.32);
colors_x.push_back(color_x); PackedColorArray colors_x = {
colors_x.push_back(color_x); color_x,
colors_x.push_back(color_x.lerp(Color(0, 0, 0), 0.5)); color_x,
colors_x.push_back(color_x.lerp(Color(0, 0, 0), 0.5)); 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); draw_multiline_colors(points_x, colors_x);
PackedColorArray colors_y;
const Color color_y = Color(0.53, 0.84, 0.01); const Color color_y = Color(0.53, 0.84, 0.01);
colors_y.push_back(color_y); PackedColorArray colors_y = {
colors_y.push_back(color_y); color_y,
colors_y.push_back(color_y.lerp(Color(0, 0, 0), 0.5)); color_y,
colors_y.push_back(color_y.lerp(Color(0, 0, 0), 0.5)); 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); draw_multiline_colors(points_y, colors_y);
} }

View File

@ -244,15 +244,13 @@ void RayCast2D::_draw_debug_shape() {
xf.rotate(target_position.angle()); xf.rotate(target_position.angle());
xf.translate(Vector2(no_line ? 0 : target_position.length() - arrow_size, 0)); xf.translate(Vector2(no_line ? 0 : target_position.length() - arrow_size, 0));
Vector<Vector2> pts; Vector<Vector2> pts = {
pts.push_back(xf.xform(Vector2(arrow_size, 0))); xf.xform(Vector2(arrow_size, 0)),
pts.push_back(xf.xform(Vector2(0, 0.5 * arrow_size))); xf.xform(Vector2(0, 0.5 * arrow_size)),
pts.push_back(xf.xform(Vector2(0, -0.5 * arrow_size))); xf.xform(Vector2(0, -0.5 * arrow_size))
};
Vector<Color> cols; Vector<Color> cols = { draw_col, draw_col, draw_col };
for (int i = 0; i < 3; i++) {
cols.push_back(draw_col);
}
draw_primitive(pts, cols, Vector<Vector2>()); draw_primitive(pts, cols, Vector<Vector2>());
} }

View File

@ -239,14 +239,16 @@ void ShapeCast2D::_notification(int p_what) {
xf.translate(Vector2(target_position.length(), 0)); xf.translate(Vector2(target_position.length(), 0));
draw_line(Vector2(), target_position, draw_col, 2); draw_line(Vector2(), target_position, draw_col, 2);
Vector<Vector2> pts;
float tsize = 8; float tsize = 8;
pts.push_back(xf.xform(Vector2(tsize, 0)));
pts.push_back(xf.xform(Vector2(0, Math_SQRT12 * tsize))); Vector<Vector2> pts = {
pts.push_back(xf.xform(Vector2(0, -Math_SQRT12 * tsize))); xf.xform(Vector2(tsize, 0)),
Vector<Color> cols; xf.xform(Vector2(0, Math_SQRT12 * tsize)),
for (int i = 0; i < 3; i++) xf.xform(Vector2(0, -Math_SQRT12 * tsize))
cols.push_back(draw_col); };
Vector<Color> cols = { draw_col, draw_col, draw_col };
draw_primitive(pts, cols, Vector<Vector2>()); draw_primitive(pts, cols, Vector<Vector2>());
} }

View File

@ -59,15 +59,13 @@ void SeparationRayShape2D::draw(const RID &p_to_rid, const Color &p_color) {
xf.rotate(target_position.angle()); xf.rotate(target_position.angle());
xf.translate(Vector2(no_line ? 0 : target_position.length() - arrow_size, 0)); xf.translate(Vector2(no_line ? 0 : target_position.length() - arrow_size, 0));
Vector<Vector2> pts; Vector<Vector2> pts = {
pts.push_back(xf.xform(Vector2(arrow_size, 0))); xf.xform(Vector2(arrow_size, 0)),
pts.push_back(xf.xform(Vector2(0, 0.5 * arrow_size))); xf.xform(Vector2(0, 0.5 * arrow_size)),
pts.push_back(xf.xform(Vector2(0, -0.5 * arrow_size))); xf.xform(Vector2(0, -0.5 * arrow_size))
};
Vector<Color> cols; Vector<Color> cols = { p_color, p_color, p_color };
for (int i = 0; i < 3; i++) {
cols.push_back(p_color);
}
RS::get_singleton()->canvas_item_add_primitive(p_to_rid, pts, cols, Vector<Point2>(), RID()); RS::get_singleton()->canvas_item_add_primitive(p_to_rid, pts, cols, Vector<Point2>(), RID());
} }

View File

@ -33,9 +33,10 @@
#include "servers/physics_server_3d.h" #include "servers/physics_server_3d.h"
Vector<Vector3> SeparationRayShape3D::get_debug_mesh_lines() const { Vector<Vector3> SeparationRayShape3D::get_debug_mesh_lines() const {
Vector<Vector3> points; Vector<Vector3> points = {
points.push_back(Vector3()); Vector3(),
points.push_back(Vector3(0, 0, get_length())); Vector3(0, 0, get_length())
};
return points; return points;
} }

View File

@ -521,21 +521,22 @@ inline void draw_ring(Vector<Vector2> &verts, Vector<int> &indices, Vector<Color
set_inner_corner_radius(style_rect, ring_rect, corner_radius, ring_corner_radius); set_inner_corner_radius(style_rect, ring_rect, corner_radius, ring_corner_radius);
// Corner radius center points. // Corner radius center points.
Vector<Point2> outer_points; Vector<Point2> outer_points = {
outer_points.push_back(ring_rect.position + Vector2(ring_corner_radius[0], ring_corner_radius[0])); //tl 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 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 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 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]; real_t inner_corner_radius[4];
set_inner_corner_radius(style_rect, inner_rect, corner_radius, inner_corner_radius); set_inner_corner_radius(style_rect, inner_rect, corner_radius, inner_corner_radius);
Vector<Point2> inner_points; Vector<Point2> inner_points = {
inner_points.push_back(inner_rect.position + Vector2(inner_corner_radius[0], inner_corner_radius[0])); //tl 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 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_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 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. // Calculate the vertices.
for (int corner_index = 0; corner_index < 4; corner_index++) { for (int corner_index = 0; corner_index < 4; corner_index++) {
for (int detail = 0; detail <= adapted_corner_detail; detail++) { for (int detail = 0; detail <= adapted_corner_detail; detail++) {

View File

@ -1765,11 +1765,14 @@ Vector<Point2> TileSet::_get_square_corner_or_side_terrain_bit_polygon(Vector2i
break; break;
} }
bit_rect.position *= Vector2(p_size) / 6.0; bit_rect.position *= Vector2(p_size) / 6.0;
Vector<Vector2> polygon;
polygon.push_back(bit_rect.position); Vector<Vector2> polygon = {
polygon.push_back(Vector2(bit_rect.get_end().x, bit_rect.position.y)); bit_rect.position,
polygon.push_back(bit_rect.get_end()); Vector2(bit_rect.get_end().x, bit_rect.position.y),
polygon.push_back(Vector2(bit_rect.position.x, bit_rect.get_end().y)); bit_rect.get_end(),
Vector2(bit_rect.position.x, bit_rect.get_end().y)
};
return polygon; return polygon;
} }
@ -1984,25 +1987,26 @@ Vector<Point2> TileSet::_get_isometric_side_terrain_bit_polygon(Vector2i p_size,
} }
Vector<Point2> 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<Point2> 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<Vector2> point_list; Vector<Vector2> point_list = {
point_list.push_back(Vector2(3, (3.0 * (1.0 - p_overlap * 2.0)) / 2.0)); 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))); 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))); 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)); Vector2(1, 3.0 - p_overlap * 2.0),
point_list.push_back(Vector2(0, 3)); Vector2(0, 3),
point_list.push_back(Vector2(-1, 3.0 - p_overlap * 2.0)); 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))); 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))); 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)); 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)); 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))); 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))); 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))); Vector2(-1, -(3.0 - p_overlap * 2.0)),
point_list.push_back(Vector2(0, -3)); Vector2(0, -3),
point_list.push_back(Vector2(1, -(3.0 - p_overlap * 2.0))); 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))); 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))); 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)); Vector2(3, -(3.0 * (1.0 - p_overlap * 2.0)) / 2.0)
};
Vector2 unit = Vector2(p_size) / 6.0; Vector2 unit = Vector2(p_size) / 6.0;
for (int i = 0; i < point_list.size(); i++) { for (int i = 0; i < point_list.size(); i++) {
@ -2144,19 +2148,20 @@ Vector<Point2> TileSet::_get_half_offset_corner_or_side_terrain_bit_polygon(Vect
} }
Vector<Point2> TileSet::_get_half_offset_corner_terrain_bit_polygon(Vector2i p_size, TileSet::CellNeighbor p_bit, float p_overlap, TileSet::TileOffsetAxis p_offset_axis) { Vector<Point2> TileSet::_get_half_offset_corner_terrain_bit_polygon(Vector2i p_size, TileSet::CellNeighbor p_bit, float p_overlap, TileSet::TileOffsetAxis p_offset_axis) {
Vector<Vector2> point_list; Vector<Vector2> point_list = {
point_list.push_back(Vector2(3, 0)); Vector2(3, 0),
point_list.push_back(Vector2(3, 3.0 * (1.0 - p_overlap * 2.0))); 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)); Vector2(1.5, (3.0 * (1.0 - p_overlap * 2.0) + 3.0) / 2.0),
point_list.push_back(Vector2(0, 3)); Vector2(0, 3),
point_list.push_back(Vector2(-1.5, (3.0 * (1.0 - p_overlap * 2.0) + 3.0) / 2.0)); 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))); Vector2(-3, 3.0 * (1.0 - p_overlap * 2.0)),
point_list.push_back(Vector2(-3, 0)); Vector2(-3, 0),
point_list.push_back(Vector2(-3, -3.0 * (1.0 - p_overlap * 2.0))); 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)); Vector2(-1.5, -(3.0 * (1.0 - p_overlap * 2.0) + 3.0) / 2.0),
point_list.push_back(Vector2(0, -3)); Vector2(0, -3),
point_list.push_back(Vector2(1.5, -(3.0 * (1.0 - p_overlap * 2.0) + 3.0) / 2.0)); 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))); Vector2(3, -3.0 * (1.0 - p_overlap * 2.0))
};
Vector2 unit = Vector2(p_size) / 6.0; Vector2 unit = Vector2(p_size) / 6.0;
for (int i = 0; i < point_list.size(); i++) { for (int i = 0; i < point_list.size(); i++) {
@ -2250,13 +2255,14 @@ Vector<Point2> TileSet::_get_half_offset_corner_terrain_bit_polygon(Vector2i p_s
} }
Vector<Point2> TileSet::_get_half_offset_side_terrain_bit_polygon(Vector2i p_size, TileSet::CellNeighbor p_bit, float p_overlap, TileSet::TileOffsetAxis p_offset_axis) { Vector<Point2> TileSet::_get_half_offset_side_terrain_bit_polygon(Vector2i p_size, TileSet::CellNeighbor p_bit, float p_overlap, TileSet::TileOffsetAxis p_offset_axis) {
Vector<Vector2> point_list; Vector<Vector2> point_list = {
point_list.push_back(Vector2(3, 3.0 * (1.0 - p_overlap * 2.0))); Vector2(3, 3.0 * (1.0 - p_overlap * 2.0)),
point_list.push_back(Vector2(0, 3)); Vector2(0, 3),
point_list.push_back(Vector2(-3, 3.0 * (1.0 - p_overlap * 2.0))); Vector2(-3, 3.0 * (1.0 - p_overlap * 2.0)),
point_list.push_back(Vector2(-3, -3.0 * (1.0 - p_overlap * 2.0))); Vector2(-3, -3.0 * (1.0 - p_overlap * 2.0)),
point_list.push_back(Vector2(0, -3)); Vector2(0, -3),
point_list.push_back(Vector2(3, -3.0 * (1.0 - p_overlap * 2.0))); Vector2(3, -3.0 * (1.0 - p_overlap * 2.0))
};
Vector2 unit = Vector2(p_size) / 6.0; Vector2 unit = Vector2(p_size) / 6.0;
for (int i = 0; i < point_list.size(); i++) { for (int i = 0; i < point_list.size(); i++) {

View File

@ -34,7 +34,6 @@
Vector<Vector3> WorldBoundaryShape3D::get_debug_mesh_lines() const { Vector<Vector3> WorldBoundaryShape3D::get_debug_mesh_lines() const {
Plane p = get_plane(); Plane p = get_plane();
Vector<Vector3> points;
Vector3 n1 = p.get_any_perpendicular_normal(); Vector3 n1 = p.get_any_perpendicular_normal();
Vector3 n2 = p.normal.cross(n1).normalized(); Vector3 n2 = p.normal.cross(n1).normalized();
@ -46,16 +45,18 @@ Vector<Vector3> WorldBoundaryShape3D::get_debug_mesh_lines() const {
p.normal * p.d + n1 * -10.0 + n2 * 10.0, p.normal * p.d + n1 * -10.0 + n2 * 10.0,
}; };
points.push_back(pface[0]); Vector<Vector3> points = {
points.push_back(pface[1]); pface[0],
points.push_back(pface[1]); pface[1],
points.push_back(pface[2]); pface[1],
points.push_back(pface[2]); pface[2],
points.push_back(pface[3]); pface[2],
points.push_back(pface[3]); pface[3],
points.push_back(pface[0]); pface[3],
points.push_back(p.normal * p.d); pface[0],
points.push_back(p.normal * p.d + p.normal * 3); p.normal * p.d,
p.normal * p.d + p.normal * 3
};
return points; return points;
} }

View File

@ -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); 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 //regular forward for now
Vector<Color> clear; Vector<Color> clear = {
clear.push_back(Color(0, 0, 0, 0)); Color(0, 0, 0, 0),
clear.push_back(Color(0, 0, 0, 0)); Color(0, 0, 0, 0),
clear.push_back(Color(0, 0, 0, 0)); Color(0, 0, 0, 0),
clear.push_back(Color(0, 0, 0, 0)); Color(0, 0, 0, 0),
clear.push_back(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); 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); _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(); RD::get_singleton()->draw_list_end();
@ -1839,12 +1841,13 @@ void RenderForwardClustered::_render_uv2(const PagedArray<GeometryInstance *> &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); 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 //regular forward for now
Vector<Color> clear; Vector<Color> clear = {
clear.push_back(Color(0, 0, 0, 0)); Color(0, 0, 0, 0),
clear.push_back(Color(0, 0, 0, 0)); Color(0, 0, 0, 0),
clear.push_back(Color(0, 0, 0, 0)); Color(0, 0, 0, 0),
clear.push_back(Color(0, 0, 0, 0)); Color(0, 0, 0, 0),
clear.push_back(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); 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; 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 half_extents = p_bounds.size * 0.5;
Vector3 center = p_bounds.position + half_extents; Vector3 center = p_bounds.position + half_extents;
Vector<RID> sbs; Vector<RID> sbs = {
sbs.push_back(p_albedo_texture); p_albedo_texture,
sbs.push_back(p_emission_texture); p_emission_texture,
sbs.push_back(p_emission_aniso_texture); p_emission_aniso_texture,
sbs.push_back(p_geom_facing_texture); p_geom_facing_texture
};
//print_line("re-render " + p_from + " - " + p_size + " bounds " + p_bounds); //print_line("re-render " + p_from + " - " + p_size + " bounds " + p_bounds);
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {

View File

@ -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); 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 //regular forward for now
Vector<Color> clear; Vector<Color> clear = {
clear.push_back(Color(0, 0, 0, 0)); Color(0, 0, 0, 0),
clear.push_back(Color(0, 0, 0, 0)); Color(0, 0, 0, 0),
clear.push_back(Color(0, 0, 0, 0)); Color(0, 0, 0, 0),
clear.push_back(Color(0, 0, 0, 0)); Color(0, 0, 0, 0),
clear.push_back(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); 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); _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(); RD::get_singleton()->draw_list_end();
@ -1043,12 +1044,14 @@ void RenderForwardMobile::_render_uv2(const PagedArray<GeometryInstance *> &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); 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 //regular forward for now
Vector<Color> clear; Vector<Color> clear = {
clear.push_back(Color(0, 0, 0, 0)); Color(0, 0, 0, 0),
clear.push_back(Color(0, 0, 0, 0)); Color(0, 0, 0, 0),
clear.push_back(Color(0, 0, 0, 0)); Color(0, 0, 0, 0),
clear.push_back(Color(0, 0, 0, 0)); Color(0, 0, 0, 0),
clear.push_back(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); 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; const int uv_offset_count = 9;