浏览代码

Make sure the arc value is fully taken into account (#8645)

Popov72 5 年之前
父节点
当前提交
7c71752dcc
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      src/Meshes/Builders/discBuilder.ts

+ 4 - 2
src/Meshes/Builders/discBuilder.ts

@@ -20,14 +20,16 @@ VertexData.CreateDisc = function(options: { radius?: number, tessellation?: numb
     uvs.push(0.5, 0.5);
 
     var theta = Math.PI * 2 * arc;
-    var step = theta / tessellation;
-    for (var a = 0; a < theta; a += step) {
+    var step = arc === 1 ? theta / tessellation : theta / (tessellation - 1);
+    var a = 0;
+    for (var t = 0; t < tessellation; t++) {
         var x = Math.cos(a);
         var y = Math.sin(a);
         var u = (x + 1) / 2;
         var v = (1 - y) / 2;
         positions.push(radius * x, radius * y, 0);
         uvs.push(u, v);
+        a += step;
     }
     if (arc === 1) {
         positions.push(positions[3], positions[4], positions[5]); // close the circle