Skip to content

Commit

Permalink
Revert "Fixes the normals of SphereMesh when the sphere/hemisphere is…
Browse files Browse the repository at this point in the history
… oblong"

This reverts commit c4d0074.

It caused regression godotengine#52965.
  • Loading branch information
akien-mga committed Sep 27, 2021
1 parent 9de9994 commit ac01b1c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions scene/resources/primitive_meshes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vector3> points;
Expand All @@ -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;
Expand All @@ -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));
Expand Down

0 comments on commit ac01b1c

Please sign in to comment.