David Catuhe 7 年之前
父节点
当前提交
b01c5b3261

文件差异内容过多而无法显示
+ 1754 - 1735
dist/preview release/babylon.d.ts


文件差异内容过多而无法显示
+ 28 - 28
dist/preview release/babylon.js


+ 59 - 0
dist/preview release/babylon.max.js

@@ -5549,6 +5549,9 @@ var BABYLON;
          */
         Observable.prototype.notifyObservers = function (eventData, mask, target, currentTarget) {
             if (mask === void 0) { mask = -1; }
+            if (!this._observers.length) {
+                return false;
+            }
             var state = this._eventState;
             state.mask = mask;
             state.target = target;
@@ -17347,6 +17350,11 @@ var BABYLON;
             */
             this.onBeforeAnimationsObservable = new BABYLON.Observable();
             /**
+            * An event triggered after animations processing
+            * @type {BABYLON.Observable}
+            */
+            this.onAfterAnimationsObservable = new BABYLON.Observable();
+            /**
             * An event triggered before draw calls are ready to be sent
             * @type {BABYLON.Observable}
             */
@@ -20017,6 +20025,7 @@ var BABYLON;
                     // Animations
                     this._animationRatio = defaultTimeStep * (60.0 / 1000.0);
                     this._animate();
+                    this.onAfterAnimationsObservable.notifyObservers(this);
                     // Physics
                     if (this._physicsEngine) {
                         this.onBeforePhysicsObservable.notifyObservers(this);
@@ -20036,6 +20045,7 @@ var BABYLON;
                 var deltaTime = Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime));
                 this._animationRatio = deltaTime * (60.0 / 1000.0);
                 this._animate();
+                this.onAfterAnimationsObservable.notifyObservers(this);
                 // Physics
                 if (this._physicsEngine) {
                     this.onBeforePhysicsObservable.notifyObservers(this);
@@ -20371,6 +20381,8 @@ var BABYLON;
             this.onAfterDrawPhaseObservable.clear();
             this.onBeforePhysicsObservable.clear();
             this.onAfterPhysicsObservable.clear();
+            this.onBeforeAnimationsObservable.clear();
+            this.onAfterAnimationsObservable.clear();
             this.detachControl();
             // Release sounds & sounds tracks
             if (BABYLON.AudioEngine) {
@@ -75322,6 +75334,8 @@ var BABYLON;
             this._spritesRenderTime = new BABYLON.PerfCounter();
             this._capturePhysicsTime = false;
             this._physicsTime = new BABYLON.PerfCounter();
+            this._captureAnimationsTime = false;
+            this._animationsTime = new BABYLON.PerfCounter();
             // Observers
             this._onBeforeActiveMeshesEvaluationObserver = null;
             this._onAfterActiveMeshesEvaluationObserver = null;
@@ -75337,6 +75351,7 @@ var BABYLON;
             this._onAfterSpritesRenderingObserver = null;
             this._onBeforePhysicsObserver = null;
             this._onAfterPhysicsObserver = null;
+            this._onAfterAnimationsObserver = null;
             // Before render
             this._onBeforeAnimationsObserver = scene.onBeforeAnimationsObservable.add(function () {
                 if (_this._captureActiveMeshesEvaluationTime) {
@@ -75358,6 +75373,9 @@ var BABYLON;
                 if (_this._captureSpritesRenderTime) {
                     _this._spritesRenderTime.fetchNewFrame();
                 }
+                if (_this._captureAnimationsTime) {
+                    _this._animationsTime.beginMonitoring();
+                }
                 _this.scene.getEngine()._drawCalls.fetchNewFrame();
             });
             // After render
@@ -75605,6 +75623,45 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(SceneInstrumentation.prototype, "animationsTimeCounter", {
+            /**
+             * Gets the perf counter used for animations time
+             */
+            get: function () {
+                return this._animationsTime;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(SceneInstrumentation.prototype, "captureAnimationsTime", {
+            /**
+             * Gets the animations time capture status
+             */
+            get: function () {
+                return this._captureAnimationsTime;
+            },
+            /**
+             * Enable or disable the animations time capture
+             */
+            set: function (value) {
+                var _this = this;
+                if (value === this._captureAnimationsTime) {
+                    return;
+                }
+                this._captureAnimationsTime = value;
+                if (value) {
+                    this._onAfterAnimationsObserver = this.scene.onAfterAnimationsObservable.add(function () {
+                        _this._animationsTime.endMonitoring();
+                    });
+                }
+                else {
+                    this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver);
+                    this._onAfterAnimationsObserver = null;
+                }
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(SceneInstrumentation.prototype, "frameTimeCounter", {
             /**
              * Gets the perf counter used for frame time capture
@@ -75742,6 +75799,8 @@ var BABYLON;
             this._onBeforePhysicsObserver = null;
             this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver);
             this._onAfterPhysicsObserver = null;
+            this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver);
+            this._onAfterAnimationsObserver = null;
             this.scene = null;
         };
         return SceneInstrumentation;

文件差异内容过多而无法显示
+ 1754 - 1735
dist/preview release/babylon.module.d.ts


文件差异内容过多而无法显示
+ 23 - 23
dist/preview release/babylon.worker.js


文件差异内容过多而无法显示
+ 902 - 883
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


文件差异内容过多而无法显示
+ 29 - 29
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 59 - 0
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -5549,6 +5549,9 @@ var BABYLON;
          */
         Observable.prototype.notifyObservers = function (eventData, mask, target, currentTarget) {
             if (mask === void 0) { mask = -1; }
+            if (!this._observers.length) {
+                return false;
+            }
             var state = this._eventState;
             state.mask = mask;
             state.target = target;
@@ -17347,6 +17350,11 @@ var BABYLON;
             */
             this.onBeforeAnimationsObservable = new BABYLON.Observable();
             /**
+            * An event triggered after animations processing
+            * @type {BABYLON.Observable}
+            */
+            this.onAfterAnimationsObservable = new BABYLON.Observable();
+            /**
             * An event triggered before draw calls are ready to be sent
             * @type {BABYLON.Observable}
             */
@@ -20017,6 +20025,7 @@ var BABYLON;
                     // Animations
                     this._animationRatio = defaultTimeStep * (60.0 / 1000.0);
                     this._animate();
+                    this.onAfterAnimationsObservable.notifyObservers(this);
                     // Physics
                     if (this._physicsEngine) {
                         this.onBeforePhysicsObservable.notifyObservers(this);
@@ -20036,6 +20045,7 @@ var BABYLON;
                 var deltaTime = Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime));
                 this._animationRatio = deltaTime * (60.0 / 1000.0);
                 this._animate();
+                this.onAfterAnimationsObservable.notifyObservers(this);
                 // Physics
                 if (this._physicsEngine) {
                     this.onBeforePhysicsObservable.notifyObservers(this);
@@ -20371,6 +20381,8 @@ var BABYLON;
             this.onAfterDrawPhaseObservable.clear();
             this.onBeforePhysicsObservable.clear();
             this.onAfterPhysicsObservable.clear();
+            this.onBeforeAnimationsObservable.clear();
+            this.onAfterAnimationsObservable.clear();
             this.detachControl();
             // Release sounds & sounds tracks
             if (BABYLON.AudioEngine) {
@@ -74998,6 +75010,8 @@ var BABYLON;
             this._spritesRenderTime = new BABYLON.PerfCounter();
             this._capturePhysicsTime = false;
             this._physicsTime = new BABYLON.PerfCounter();
+            this._captureAnimationsTime = false;
+            this._animationsTime = new BABYLON.PerfCounter();
             // Observers
             this._onBeforeActiveMeshesEvaluationObserver = null;
             this._onAfterActiveMeshesEvaluationObserver = null;
@@ -75013,6 +75027,7 @@ var BABYLON;
             this._onAfterSpritesRenderingObserver = null;
             this._onBeforePhysicsObserver = null;
             this._onAfterPhysicsObserver = null;
+            this._onAfterAnimationsObserver = null;
             // Before render
             this._onBeforeAnimationsObserver = scene.onBeforeAnimationsObservable.add(function () {
                 if (_this._captureActiveMeshesEvaluationTime) {
@@ -75034,6 +75049,9 @@ var BABYLON;
                 if (_this._captureSpritesRenderTime) {
                     _this._spritesRenderTime.fetchNewFrame();
                 }
+                if (_this._captureAnimationsTime) {
+                    _this._animationsTime.beginMonitoring();
+                }
                 _this.scene.getEngine()._drawCalls.fetchNewFrame();
             });
             // After render
@@ -75281,6 +75299,45 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(SceneInstrumentation.prototype, "animationsTimeCounter", {
+            /**
+             * Gets the perf counter used for animations time
+             */
+            get: function () {
+                return this._animationsTime;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(SceneInstrumentation.prototype, "captureAnimationsTime", {
+            /**
+             * Gets the animations time capture status
+             */
+            get: function () {
+                return this._captureAnimationsTime;
+            },
+            /**
+             * Enable or disable the animations time capture
+             */
+            set: function (value) {
+                var _this = this;
+                if (value === this._captureAnimationsTime) {
+                    return;
+                }
+                this._captureAnimationsTime = value;
+                if (value) {
+                    this._onAfterAnimationsObserver = this.scene.onAfterAnimationsObservable.add(function () {
+                        _this._animationsTime.endMonitoring();
+                    });
+                }
+                else {
+                    this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver);
+                    this._onAfterAnimationsObserver = null;
+                }
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(SceneInstrumentation.prototype, "frameTimeCounter", {
             /**
              * Gets the perf counter used for frame time capture
@@ -75418,6 +75475,8 @@ var BABYLON;
             this._onBeforePhysicsObserver = null;
             this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver);
             this._onAfterPhysicsObserver = null;
+            this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver);
+            this._onAfterAnimationsObserver = null;
             this.scene = null;
         };
         return SceneInstrumentation;

文件差异内容过多而无法显示
+ 902 - 883
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


文件差异内容过多而无法显示
+ 2 - 2
dist/preview release/inspector/babylon.inspector.bundle.js


+ 7 - 0
dist/preview release/inspector/babylon.inspector.js

@@ -3677,6 +3677,7 @@ var INSPECTOR;
             _this._sceneInstrumentation.captureParticlesRenderTime = true;
             _this._sceneInstrumentation.captureSpritesRenderTime = true;
             _this._sceneInstrumentation.capturePhysicsTime = true;
+            _this._sceneInstrumentation.captureAnimationsTime = true;
             _this._engineInstrumentation = new BABYLON.EngineInstrumentation(_this._engine);
             _this._engineInstrumentation.captureGPUFrameTime = true;
             // Build the stats panel: a div that will contains all stats
@@ -3785,6 +3786,12 @@ var INSPECTOR;
                     elem: elemValue,
                     updateFct: function () { return BABYLON.Tools.Format(_this._sceneInstrumentation.spritesRenderTimeCounter.current); }
                 });
+                elemLabel = _this._createStatLabel("Animations", _this._panel);
+                elemValue = INSPECTOR.Helpers.CreateDiv('stat-value', _this._panel);
+                _this._updatableProperties.push({
+                    elem: elemValue,
+                    updateFct: function () { return BABYLON.Tools.Format(_this._sceneInstrumentation.animationsTimeCounter.current); }
+                });
                 elemLabel = _this._createStatLabel("Physics", _this._panel);
                 elemValue = INSPECTOR.Helpers.CreateDiv('stat-value', _this._panel);
                 _this._updatableProperties.push({

文件差异内容过多而无法显示
+ 2 - 2
dist/preview release/inspector/babylon.inspector.min.js


+ 7 - 0
inspector/src/tabs/StatsTab.ts

@@ -37,6 +37,7 @@ module INSPECTOR {
             this._sceneInstrumentation.captureParticlesRenderTime = true;
             this._sceneInstrumentation.captureSpritesRenderTime = true;
             this._sceneInstrumentation.capturePhysicsTime = true;
+            this._sceneInstrumentation.captureAnimationsTime = true;
 
             this._engineInstrumentation = new BABYLON.EngineInstrumentation(this._engine);
             this._engineInstrumentation.captureGPUFrameTime = true;
@@ -161,6 +162,12 @@ module INSPECTOR {
                     elem:elemValue, 
                     updateFct:() => { return BABYLON.Tools.Format(this._sceneInstrumentation.spritesRenderTimeCounter.current)}
                 });
+                elemLabel = this._createStatLabel("Animations", this._panel);
+                elemValue = Helpers.CreateDiv('stat-value', this._panel);
+                this._updatableProperties.push({ 
+                    elem:elemValue, 
+                    updateFct:() => { return BABYLON.Tools.Format(this._sceneInstrumentation.animationsTimeCounter.current)}
+                });                       
                 elemLabel = this._createStatLabel("Physics", this._panel);
                 elemValue = Helpers.CreateDiv('stat-value', this._panel);
                 this._updatableProperties.push({ 

+ 50 - 3
src/Instrumentation/babylon.sceneInstrumentation.ts

@@ -25,7 +25,10 @@ module BABYLON {
         private _spritesRenderTime = new PerfCounter();   
 
         private _capturePhysicsTime = false;
-        private _physicsTime = new PerfCounter();         
+        private _physicsTime = new PerfCounter();     
+        
+        private _captureAnimationsTime = false;
+        private _animationsTime = new PerfCounter();            
 
         // Observers
         private _onBeforeActiveMeshesEvaluationObserver: Nullable<Observer<Scene>> = null;
@@ -47,7 +50,9 @@ module BABYLON {
         private _onAfterSpritesRenderingObserver: Nullable<Observer<Scene>> = null;      
         
         private _onBeforePhysicsObserver: Nullable<Observer<Scene>> = null;
-        private _onAfterPhysicsObserver: Nullable<Observer<Scene>> = null;             
+        private _onAfterPhysicsObserver: Nullable<Observer<Scene>> = null;     
+        
+        private _onAfterAnimationsObserver: Nullable<Observer<Scene>> = null;    
                 
         // Properties
         /**
@@ -264,6 +269,41 @@ module BABYLON {
                 this._onAfterPhysicsObserver = null;
             }
         }      
+
+
+        /**
+         * Gets the perf counter used for animations time
+         */
+        public get animationsTimeCounter(): PerfCounter {
+            return this._animationsTime;
+        }
+
+        /**
+         * Gets the animations time capture status
+         */
+        public get captureAnimationsTime(): boolean {
+            return this._captureAnimationsTime;
+        }        
+
+        /**
+         * Enable or disable the animations time capture
+         */        
+        public set captureAnimationsTime(value: boolean) {
+            if (value === this._captureAnimationsTime) {
+                return;
+            }
+
+            this._captureAnimationsTime = value;
+
+            if (value) {
+                this._onAfterAnimationsObserver = this.scene.onAfterAnimationsObservable.add(()=>{                    
+                    this._animationsTime.endMonitoring();
+                });
+            } else {
+                this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver);
+                this._onAfterAnimationsObserver = null;
+            }
+        }              
         
         /**
          * Gets the perf counter used for frame time capture
@@ -384,6 +424,10 @@ module BABYLON {
                     this._spritesRenderTime.fetchNewFrame();
                 }
 
+                if (this._captureAnimationsTime) {
+                    this._animationsTime.beginMonitoring();
+                }
+
                 this.scene.getEngine()._drawCalls.fetchNewFrame();
             });
 
@@ -445,7 +489,10 @@ module BABYLON {
             this._onBeforePhysicsObserver = null;
 
             this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver);
-            this._onAfterPhysicsObserver = null;            
+            this._onAfterPhysicsObserver = null;    
+            
+            this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver);
+            this._onAfterAnimationsObserver = null;            
                 
             (<any>this.scene) = null;
         }

+ 4 - 0
src/Tools/babylon.observable.ts

@@ -177,6 +177,10 @@
          * @param mask
          */
         public notifyObservers(eventData: Nullable<T>, mask: number = -1, target?: any, currentTarget?: any): boolean {
+            if (!this._observers.length) {
+                return false;
+            }
+
             let state = this._eventState;
             state.mask = mask;
             state.target = target;

+ 13 - 1
src/babylon.scene.ts

@@ -253,7 +253,13 @@
         * An event triggered before animating the scene
         * @type {BABYLON.Observable}
         */
-        public onBeforeAnimationsObservable = new Observable<Scene>();        
+        public onBeforeAnimationsObservable = new Observable<Scene>();       
+        
+        /**
+        * An event triggered after animations processing
+        * @type {BABYLON.Observable}
+        */
+        public onAfterAnimationsObservable = new Observable<Scene>();               
 
         /**
         * An event triggered before draw calls are ready to be sent
@@ -354,6 +360,8 @@
         */
         public onAfterSpritesRenderingObservable = new Observable<Scene>();          
 
+         
+
         /**
         * An event triggered when a camera is created
         * @type {BABYLON.Observable}
@@ -3296,6 +3304,7 @@
                 // Animations
                 this._animationRatio = defaultTimeStep * (60.0 / 1000.0);
                 this._animate();
+                this.onAfterAnimationsObservable.notifyObservers(this);
 
                 // Physics
                 if (this._physicsEngine) {
@@ -3318,6 +3327,7 @@
               var deltaTime = Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime));
               this._animationRatio = deltaTime * (60.0 / 1000.0);
               this._animate();
+              this.onAfterAnimationsObservable.notifyObservers(this);
 
               // Physics
               if (this._physicsEngine) {
@@ -3707,6 +3717,8 @@
             this.onAfterDrawPhaseObservable.clear();
             this.onBeforePhysicsObservable.clear();
             this.onAfterPhysicsObservable.clear();
+            this.onBeforeAnimationsObservable.clear();
+            this.onAfterAnimationsObservable.clear();
 
             this.detachControl();