Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix normals computation at the 'seam' of smoothed torus shape #59002

Merged
merged 1 commit into from
Mar 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix normals computation at the 'seam' of smoothed torus shape
  • Loading branch information
MythTitans committed Mar 10, 2022
commit 8bcbaff41119b254c34938a632f787a8049e88c6
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