From 8a9c9a67efaf28f0223e29bf857e92c0ab1212ec Mon Sep 17 00:00:00 2001 From: Anilforextra Date: Thu, 13 Jan 2022 10:14:59 +0545 Subject: CameraMatrix: Pre-allocate Vector in get_projection_planes(). --- scene/3d/camera_3d.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'scene') diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp index 55fa05d3fd..2c95010eb4 100644 --- a/scene/3d/camera_3d.cpp +++ b/scene/3d/camera_3d.cpp @@ -331,11 +331,13 @@ Vector Camera3D::get_near_plane_points() const { Vector3 endpoints[8]; cm.get_endpoints(Transform3D(), endpoints); - Vector points; - points.push_back(Vector3()); - for (int i = 0; i < 4; i++) { - points.push_back(endpoints[i + 4]); - } + Vector points = { + Vector3(), + endpoints[4], + endpoints[5], + endpoints[6], + endpoints[7] + }; return points; } -- cgit v1.2.3