Skip to content

Commit

Permalink
Merge pull request #59002 from MythTitans/fix-visible-seam-torus
Browse files Browse the repository at this point in the history
Fix normals computation at the 'seam' of smoothed torus shape
  • Loading branch information
akien-mga authored Mar 11, 2022
2 parents 7866c98 + 8bcbaff commit c291b48
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/csg/csg_shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,9 @@ CSGBrush *CSGTorus3D::_build_brush() {
for (int i = 0; i < sides; i++) {
float inci = float(i) / sides;
float inci_n = float((i + 1)) / sides;
if (i == sides - 1) {
inci_n = 0;
}

float angi = inci * Math_TAU;
float angi_n = inci_n * Math_TAU;
Expand All @@ -1540,6 +1543,9 @@ CSGBrush *CSGTorus3D::_build_brush() {
for (int j = 0; j < ring_sides; j++) {
float incj = float(j) / ring_sides;
float incj_n = float((j + 1)) / ring_sides;
if (j == ring_sides - 1) {
incj_n = 0;
}

float angj = incj * Math_TAU;
float angj_n = incj_n * Math_TAU;
Expand Down

0 comments on commit c291b48

Please sign in to comment.