2
0
Эх сурвалжийг харах

Merge pull request #8640 from yunusey/dev

Fix UV mapping in ArrayMesh tutorial
Max Hilbrunner 1 жил өмнө
parent
commit
62c29c4cdb

+ 2 - 22
tutorials/3d/procedural_geometry/arraymesh.rst

@@ -265,7 +265,7 @@ that you find online.
             var y = cos(PI * v)
             var y = cos(PI * v)
 
 
             # Loop over segments in ring.
             # Loop over segments in ring.
-            for j in range(radial_segments):
+            for j in range(radial_segments + 1):
                 var u = float(j) / radial_segments
                 var u = float(j) / radial_segments
                 var x = sin(u * PI * 2.0)
                 var x = sin(u * PI * 2.0)
                 var z = cos(u * PI * 2.0)
                 var z = cos(u * PI * 2.0)
@@ -285,15 +285,6 @@ that you find online.
                     indices.append(thisrow + j)
                     indices.append(thisrow + j)
                     indices.append(thisrow + j - 1)
                     indices.append(thisrow + j - 1)
 
 
-            if i > 0:
-                indices.append(prevrow + radial_segments - 1)
-                indices.append(prevrow)
-                indices.append(thisrow + radial_segments - 1)
-
-                indices.append(prevrow)
-                indices.append(prevrow + radial_segments)
-                indices.append(thisrow + radial_segments - 1)
-
             prevrow = thisrow
             prevrow = thisrow
             thisrow = point
             thisrow = point
 
 
@@ -324,7 +315,7 @@ that you find online.
                 var y = Mathf.Cos(Mathf.Pi * v);
                 var y = Mathf.Cos(Mathf.Pi * v);
 
 
                 // Loop over segments in ring.
                 // Loop over segments in ring.
-                for (var j = 0; j < _radialSegments; j++)
+                for (var j = 0; j < _radialSegments + 1; j++)
                 {
                 {
                     var u = ((float)j) / _radialSegments;
                     var u = ((float)j) / _radialSegments;
                     var x = Mathf.Sin(u * Mathf.Pi * 2);
                     var x = Mathf.Sin(u * Mathf.Pi * 2);
@@ -348,17 +339,6 @@ that you find online.
                     }
                     }
                 }
                 }
 
 
-                if (i > 0)
-                {
-                    indices.Add(prevRow + _radialSegments - 1);
-                    indices.Add(prevRow);
-                    indices.Add(thisRow + _radialSegments - 1);
-
-                    indices.Add(prevRow);
-                    indices.Add(prevRow + _radialSegments);
-                    indices.Add(thisRow + _radialSegments - 1);
-                }
-
                 prevRow = thisRow;
                 prevRow = thisRow;
                 thisRow = point;
                 thisRow = point;
             }
             }