Browse Source

Merge pull request #9234 from aWeirdo/patch-3

Update meshSimplification.ts
sebavan 4 years ago
parent
commit
ae17dca953
1 changed files with 6 additions and 2 deletions
  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();