瀏覽代碼

Fix up typos, and reduce number of index variables

Stephen Post 7 年之前
父節點
當前提交
ea7d8f85d0
共有 1 個文件被更改,包括 7 次插入11 次删除
  1. 7 11
      src/Mesh/babylon.mesh.vertexData.ts

+ 7 - 11
src/Mesh/babylon.mesh.vertexData.ts

@@ -1769,7 +1769,7 @@
                     var gradient = r * filter.r + g * filter.g + b * filter.b;
                     
                     // If our alpha channel is not within our filter then we will assign a 'special' height 
-                    // Then when building the indicies, we will ignore any vertex that is using the special height
+                    // Then when building the indices, we will ignore any vertex that is using the special height
                     if(a >= alphaFilter)
                         position.y = options.minHeight + (options.maxHeight - options.minHeight) * gradient;
                     else {
@@ -1786,16 +1786,14 @@
             // Indices
             for (row = 0; row < options.subdivisions; row++) {
                 for (col = 0; col < options.subdivisions; col++) {
-                    // Calculate indcies
+                    // Calculate Indices
                     var idx1 = (col + 1 + (row + 1) * (options.subdivisions + 1));
                     var idx2 = (col + 1 + row * (options.subdivisions + 1));
                     var idx3 = (col + row * (options.subdivisions + 1));
                     var idx4 = (col + (row + 1) * (options.subdivisions + 1));
-                    var idx5 = (col + 1 + (row + 1) * (options.subdivisions + 1));
-                    var idx6 = (col + row * (options.subdivisions + 1));
 
-                    // Check that all indicies are visible (based on our special height)
-                    // Only display the vertex if all indcies are visible
+                    // Check that all indices are visible (based on our special height)
+                    // Only display the vertex if all Indices are visible
                     var isVisibleIdx1 = positions[idx1 * 3 + 1] >= options.minHeight;
                     var isVisibleIdx2 = positions[idx2 * 3 + 1] >= options.minHeight;
                     var isVisibleIdx3 = positions[idx3 * 3 + 1] >= options.minHeight;
@@ -1806,12 +1804,10 @@
                     }
 
                     var isVisibleIdx4 = positions[idx4 * 3 + 1] >= options.minHeight;
-                    var isVisibleIdx5 = positions[idx5 * 3 + 1] >= options.minHeight;
-                    var isVisibleIdx6 = positions[idx6 * 3 + 1] >= options.minHeight;
-                    if (isVisibleIdx4 && isVisibleIdx5 && isVisibleIdx6) {
+                    if (isVisibleIdx4 && isVisibleIdx1 && isVisibleIdx3) {
                         indices.push(idx4);
-                        indices.push(idx5);
-                        indices.push(idx6);
+                        indices.push(idx1);
+                        indices.push(idx3);
                     }
                 }
             }