浏览代码

Merge pull request #9234 from aWeirdo/patch-3

Update meshSimplification.ts
sebavan 4 年之前
父节点
当前提交
ae17dca953
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      src/Meshes/meshSimplification.ts

+ 6 - 2
src/Meshes/meshSimplification.ts

@@ -138,7 +138,9 @@ export class SimplificationQueue {
             task.settings.forEach((setting) => {
                 var simplifier = this.getSimplifier(task);
                 simplifier.simplify(setting, (newMesh) => {
-                    task.mesh.addLODLevel(setting.distance, newMesh);
+                    if (setting.distance !== undefined) {
+                        task.mesh.addLODLevel(setting.distance, newMesh);
+                    }
                     newMesh.isVisible = true;
                     //check if it is the last
                     if (setting.quality === task.settings[task.settings.length - 1].quality && task.successCallback) {
@@ -154,7 +156,9 @@ export class SimplificationQueue {
 
             var runDecimation = (setting: ISimplificationSettings, callback: () => void) => {
                 simplifier.simplify(setting, (newMesh) => {
-                    task.mesh.addLODLevel(setting.distance, newMesh);
+                    if (setting.distance !== undefined) {
+                        task.mesh.addLODLevel(setting.distance, newMesh);
+                    }
                     newMesh.isVisible = true;
                     //run the next quality level
                     callback();