diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-03-11 07:56:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-11 07:56:40 +0100 |
commit | c291b482094e9cebc163c54d07baa67ffaf19f6f (patch) | |
tree | 4d00323b34ac1d6ae379e80382d726341bffd3a4 /modules | |
parent | 7866c984798de62cbb9028f3d1eee947809e0aa9 (diff) | |
parent | 8bcbaff41119b254c34938a632f787a8049e88c6 (diff) |
Merge pull request #59002 from MythTitans/fix-visible-seam-torus
Fix normals computation at the 'seam' of smoothed torus shape
Diffstat (limited to 'modules')
-rw-r--r-- | modules/csg/csg_shape.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 137df52215..34f3ba9296 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -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; @@ -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; |