summaryrefslogtreecommitdiff
path: root/modules/csg
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-03-07 08:37:29 +0100
committerGitHub <noreply@github.com>2022-03-07 08:37:29 +0100
commit1177bd635f2776992dd23a6c53f0e21494d430b1 (patch)
treedf79d6afe9d48af669aa0a5800e9cafec3ffd235 /modules/csg
parenteb8ce0ce6892bb31ec13ad3865eec7babc4d333a (diff)
parent509e03c82133ef55e33da25f13786d0b966945b6 (diff)
Merge pull request #58208 from MythTitans/fix-sphere-and-cylinder-shapes-normals-seam
Diffstat (limited to 'modules/csg')
-rw-r--r--modules/csg/csg_shape.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp
index 39e4751be3..3bb2bc3a4d 100644
--- a/modules/csg/csg_shape.cpp
+++ b/modules/csg/csg_shape.cpp
@@ -955,6 +955,10 @@ CSGBrush *CSGSphere3D::_build_brush() {
double u0 = double(j) / radial_segments;
double longitude1 = longitude_step * (j + 1);
+ if (j == radial_segments - 1) {
+ longitude1 = 0;
+ }
+
double x1 = Math::sin(longitude1);
double z1 = Math::cos(longitude1);
double u1 = double(j + 1) / radial_segments;
@@ -1271,6 +1275,9 @@ CSGBrush *CSGCylinder3D::_build_brush() {
for (int i = 0; i < sides; i++) {
float inc = float(i) / sides;
float inc_n = float((i + 1)) / sides;
+ if (i == sides - 1) {
+ inc_n = 0;
+ }
float ang = inc * Math_TAU;
float ang_n = inc_n * Math_TAU;