From ac01b1cb1c34b6ada8be3ace5dacda09d4a0f1a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 27 Sep 2021 18:18:27 +0200 Subject: [PATCH] Revert "Fixes the normals of SphereMesh when the sphere/hemisphere is oblong" This reverts commit c4d0074aae43db94b6a53e10ea926f2b7e476b19. It caused regression #52965. --- scene/resources/primitive_meshes.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 1d6f3e55ce4..f4e58a21d9e 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -1456,8 +1456,6 @@ void SphereMesh::_create_mesh_array(Array &p_arr) const { int i, j, prevrow, thisrow, point; float x, y, z; - float scale = height * (is_hemisphere ? 1.0 : 0.5); - // set our bounding box PoolVector points; @@ -1481,7 +1479,7 @@ void SphereMesh::_create_mesh_array(Array &p_arr) const { v /= (rings + 1); w = sin(Math_PI * v); - y = scale * cos(Math_PI * v); + y = height * (is_hemisphere ? 1.0 : 0.5) * cos(Math_PI * v); for (i = 0; i <= radial_segments; i++) { float u = i; @@ -1496,8 +1494,7 @@ void SphereMesh::_create_mesh_array(Array &p_arr) const { } else { Vector3 p = Vector3(x * radius * w, y, z * radius * w); points.push_back(p); - Vector3 normal = Vector3(x * radius * w * scale, y / scale, z * radius * w * scale); - normals.push_back(normal.normalized()); + normals.push_back(p.normalized()); }; ADD_TANGENT(z, 0.0, -x, 1.0) uvs.push_back(Vector2(u, v));