Explorar o código

success/error optional for freez active meshes

Raanan Weber %!s(int64=4) %!d(string=hai) anos
pai
achega
f46e613c4f
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      src/scene.ts

+ 3 - 1
src/scene.ts

@@ -3442,9 +3442,10 @@ export class Scene extends AbstractScene implements IAnimatable, IClipPlanesHold
      * @param skipEvaluateActiveMeshes defines an optional boolean indicating that the evaluate active meshes step must be completely skipped
      * @returns the current scene
      */
-    public freezeActiveMeshes(skipEvaluateActiveMeshes = false): Scene {
+    public freezeActiveMeshes(skipEvaluateActiveMeshes = false, onSuccess?: () => void, onError?: (message: string) => void): Scene {
         this.executeWhenReady(() => {
             if (!this.activeCamera) {
+                onError && onError('No active camera found');
                 return;
             }
 
@@ -3459,6 +3460,7 @@ export class Scene extends AbstractScene implements IAnimatable, IClipPlanesHold
             for (var index = 0; index < this._activeMeshes.length; index++) {
                 this._activeMeshes.data[index]._freeze();
             }
+            onSuccess && onSuccess();
         });
         return this;
     }