Sebastien Vandenberghe 7 سال پیش
والد
کامیت
b8c55731f3

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 2625 - 2625
dist/preview release/babylon.d.ts


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 46 - 46
dist/preview release/babylon.js


+ 78 - 8
dist/preview release/babylon.max.js

@@ -11995,6 +11995,9 @@ var BABYLON;
                 timerQuery.queryCounterEXT(token._startTimeQuery, timerQuery.TIMESTAMP_EXT);
             }
             else {
+                if (this._currentNonTimestampToken) {
+                    return this._currentNonTimestampToken;
+                }
                 token._timeElapsedQuery = this._createTimeQuery();
                 if (timerQuery.beginQueryEXT) {
                     timerQuery.beginQueryEXT(timerQuery.TIME_ELAPSED_EXT, token._timeElapsedQuery);
@@ -12002,6 +12005,7 @@ var BABYLON;
                 else {
                     this._gl.beginQuery(timerQuery.TIME_ELAPSED_EXT, token._timeElapsedQuery);
                 }
+                this._currentNonTimestampToken = token;
             }
             return token;
         };
@@ -12061,6 +12065,7 @@ var BABYLON;
                     this._deleteTimeQuery(token._timeElapsedQuery);
                     token._timeElapsedQuery = null;
                     token._timeElapsedQueryEnded = false;
+                    this._currentNonTimestampToken = null;
                 }
                 return result;
             }
@@ -17324,7 +17329,7 @@ var BABYLON;
             */
             this.onDisposeObservable = new BABYLON.Observable();
             /**
-            * An event triggered before rendering the scene (right after animations and physcis)
+            * An event triggered before rendering the scene (right after animations and physics)
             * @type {BABYLON.Observable}
             */
             this.onBeforeRenderObservable = new BABYLON.Observable();
@@ -17349,6 +17354,16 @@ var BABYLON;
             */
             this.onAfterDrawPhaseObservable = new BABYLON.Observable();
             /**
+            * An event triggered when physic simulation is about to be run
+            * @type {BABYLON.Observable}
+            */
+            this.onBeforePhysicsObservable = new BABYLON.Observable();
+            /**
+            * An event triggered when physic simulation has been done
+            * @type {BABYLON.Observable}
+            */
+            this.onAfterPhysicsObservable = new BABYLON.Observable();
+            /**
             * An event triggered when the scene is ready
             * @type {BABYLON.Observable}
             */
@@ -20001,9 +20016,9 @@ var BABYLON;
                     this._animate();
                     // Physics
                     if (this._physicsEngine) {
-                        BABYLON.Tools.StartPerformanceCounter("Physics");
+                        this.onBeforePhysicsObservable.notifyObservers(this);
                         this._physicsEngine._step(defaultTimeStep);
-                        BABYLON.Tools.EndPerformanceCounter("Physics");
+                        this.onAfterPhysicsObservable.notifyObservers(this);
                     }
                     this._timeAccumulator -= defaultTimeStep;
                     this.onAfterStepObservable.notifyObservers(this);
@@ -20020,9 +20035,9 @@ var BABYLON;
                 this._animate();
                 // Physics
                 if (this._physicsEngine) {
-                    BABYLON.Tools.StartPerformanceCounter("Physics");
+                    this.onBeforePhysicsObservable.notifyObservers(this);
                     this._physicsEngine._step(deltaTime / 1000.0);
-                    BABYLON.Tools.EndPerformanceCounter("Physics");
+                    this.onAfterPhysicsObservable.notifyObservers(this);
                 }
             }
             // Before render
@@ -20351,6 +20366,8 @@ var BABYLON;
             this.onAfterSpritesRenderingObservable.clear();
             this.onBeforeDrawPhaseObservable.clear();
             this.onAfterDrawPhaseObservable.clear();
+            this.onBeforePhysicsObservable.clear();
+            this.onAfterPhysicsObservable.clear();
             this.detachControl();
             // Release sounds & sounds tracks
             if (BABYLON.AudioEngine) {
@@ -32351,8 +32368,7 @@ var BABYLON;
             defines.COLORCURVES = (this.colorCurvesEnabled && !!this.colorCurves);
             defines.COLORGRADING = (this.colorGradingEnabled && !!this.colorGradingTexture);
             if (defines.COLORGRADING) {
-                var texture = this.colorGradingTexture;
-                defines.COLORGRADING3D = (texture.getScene().getEngine().webGLVersion > 1) ? true : false;
+                defines.COLORGRADING3D = this.colorGradingTexture.is3D;
             }
             else {
                 defines.COLORGRADING3D = false;
@@ -51772,7 +51788,7 @@ var BABYLON;
             // Reaffect the filter.
             this._applyFilterValues();
             // Reaffect Render List.
-            shadowMap.renderList = renderList;
+            this._shadowMap.renderList = renderList;
         };
         ShadowGenerator.prototype._disposeBlurPostProcesses = function () {
             if (this._shadowMap2) {
@@ -75301,6 +75317,8 @@ var BABYLON;
             this._particlesRenderTime = new BABYLON.PerfCounter();
             this._captureSpritesRenderTime = false;
             this._spritesRenderTime = new BABYLON.PerfCounter();
+            this._capturePhysicsTime = false;
+            this._physicsTime = new BABYLON.PerfCounter();
             // Observers
             this._onBeforeActiveMeshesEvaluationObserver = null;
             this._onAfterActiveMeshesEvaluationObserver = null;
@@ -75314,6 +75332,8 @@ var BABYLON;
             this._onAfterParticlesRenderingObserver = null;
             this._onBeforeSpritesRenderingObserver = null;
             this._onAfterSpritesRenderingObserver = null;
+            this._onBeforePhysicsObserver = null;
+            this._onAfterPhysicsObserver = null;
             // Before render
             this._onBeforeAnimationsObserver = scene.onBeforeAnimationsObservable.add(function () {
                 if (_this._captureActiveMeshesEvaluationTime) {
@@ -75536,6 +75556,52 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(SceneInstrumentation.prototype, "physicsTimeCounter", {
+            /**
+             * Gets the perf counter used for physics time
+             */
+            get: function () {
+                return this._physicsTime;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(SceneInstrumentation.prototype, "capturePhysicsTime", {
+            /**
+             * Gets the physics time capture status
+             */
+            get: function () {
+                return this._capturePhysicsTime;
+            },
+            /**
+             * Enable or disable the physics time capture
+             */
+            set: function (value) {
+                var _this = this;
+                if (value === this._capturePhysicsTime) {
+                    return;
+                }
+                this._capturePhysicsTime = value;
+                if (value) {
+                    this._onBeforePhysicsObserver = this.scene.onBeforePhysicsObservable.add(function () {
+                        BABYLON.Tools.StartPerformanceCounter("Physics");
+                        _this._physicsTime.beginMonitoring();
+                    });
+                    this._onAfterPhysicsObserver = this.scene.onAfterPhysicsObservable.add(function () {
+                        BABYLON.Tools.EndPerformanceCounter("Physics");
+                        _this._physicsTime.endMonitoring();
+                    });
+                }
+                else {
+                    this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver);
+                    this._onBeforePhysicsObserver = null;
+                    this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver);
+                    this._onAfterPhysicsObserver = null;
+                }
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(SceneInstrumentation.prototype, "frameTimeCounter", {
             /**
              * Gets the perf counter used for frame time capture
@@ -75669,6 +75735,10 @@ var BABYLON;
             this._onBeforeDrawPhaseObserver = null;
             this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver);
             this._onAfterDrawPhaseObserver = null;
+            this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver);
+            this._onBeforePhysicsObserver = null;
+            this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver);
+            this._onAfterPhysicsObserver = null;
             this.scene = null;
         };
         return SceneInstrumentation;

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 2625 - 2625
dist/preview release/babylon.module.d.ts


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 17 - 17
dist/preview release/babylon.worker.js


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 6254 - 6228
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 16 - 16
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 78 - 8
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -11995,6 +11995,9 @@ var BABYLON;
                 timerQuery.queryCounterEXT(token._startTimeQuery, timerQuery.TIMESTAMP_EXT);
             }
             else {
+                if (this._currentNonTimestampToken) {
+                    return this._currentNonTimestampToken;
+                }
                 token._timeElapsedQuery = this._createTimeQuery();
                 if (timerQuery.beginQueryEXT) {
                     timerQuery.beginQueryEXT(timerQuery.TIME_ELAPSED_EXT, token._timeElapsedQuery);
@@ -12002,6 +12005,7 @@ var BABYLON;
                 else {
                     this._gl.beginQuery(timerQuery.TIME_ELAPSED_EXT, token._timeElapsedQuery);
                 }
+                this._currentNonTimestampToken = token;
             }
             return token;
         };
@@ -12061,6 +12065,7 @@ var BABYLON;
                     this._deleteTimeQuery(token._timeElapsedQuery);
                     token._timeElapsedQuery = null;
                     token._timeElapsedQueryEnded = false;
+                    this._currentNonTimestampToken = null;
                 }
                 return result;
             }
@@ -17324,7 +17329,7 @@ var BABYLON;
             */
             this.onDisposeObservable = new BABYLON.Observable();
             /**
-            * An event triggered before rendering the scene (right after animations and physcis)
+            * An event triggered before rendering the scene (right after animations and physics)
             * @type {BABYLON.Observable}
             */
             this.onBeforeRenderObservable = new BABYLON.Observable();
@@ -17349,6 +17354,16 @@ var BABYLON;
             */
             this.onAfterDrawPhaseObservable = new BABYLON.Observable();
             /**
+            * An event triggered when physic simulation is about to be run
+            * @type {BABYLON.Observable}
+            */
+            this.onBeforePhysicsObservable = new BABYLON.Observable();
+            /**
+            * An event triggered when physic simulation has been done
+            * @type {BABYLON.Observable}
+            */
+            this.onAfterPhysicsObservable = new BABYLON.Observable();
+            /**
             * An event triggered when the scene is ready
             * @type {BABYLON.Observable}
             */
@@ -20001,9 +20016,9 @@ var BABYLON;
                     this._animate();
                     // Physics
                     if (this._physicsEngine) {
-                        BABYLON.Tools.StartPerformanceCounter("Physics");
+                        this.onBeforePhysicsObservable.notifyObservers(this);
                         this._physicsEngine._step(defaultTimeStep);
-                        BABYLON.Tools.EndPerformanceCounter("Physics");
+                        this.onAfterPhysicsObservable.notifyObservers(this);
                     }
                     this._timeAccumulator -= defaultTimeStep;
                     this.onAfterStepObservable.notifyObservers(this);
@@ -20020,9 +20035,9 @@ var BABYLON;
                 this._animate();
                 // Physics
                 if (this._physicsEngine) {
-                    BABYLON.Tools.StartPerformanceCounter("Physics");
+                    this.onBeforePhysicsObservable.notifyObservers(this);
                     this._physicsEngine._step(deltaTime / 1000.0);
-                    BABYLON.Tools.EndPerformanceCounter("Physics");
+                    this.onAfterPhysicsObservable.notifyObservers(this);
                 }
             }
             // Before render
@@ -20351,6 +20366,8 @@ var BABYLON;
             this.onAfterSpritesRenderingObservable.clear();
             this.onBeforeDrawPhaseObservable.clear();
             this.onAfterDrawPhaseObservable.clear();
+            this.onBeforePhysicsObservable.clear();
+            this.onAfterPhysicsObservable.clear();
             this.detachControl();
             // Release sounds & sounds tracks
             if (BABYLON.AudioEngine) {
@@ -32351,8 +32368,7 @@ var BABYLON;
             defines.COLORCURVES = (this.colorCurvesEnabled && !!this.colorCurves);
             defines.COLORGRADING = (this.colorGradingEnabled && !!this.colorGradingTexture);
             if (defines.COLORGRADING) {
-                var texture = this.colorGradingTexture;
-                defines.COLORGRADING3D = (texture.getScene().getEngine().webGLVersion > 1) ? true : false;
+                defines.COLORGRADING3D = this.colorGradingTexture.is3D;
             }
             else {
                 defines.COLORGRADING3D = false;
@@ -51772,7 +51788,7 @@ var BABYLON;
             // Reaffect the filter.
             this._applyFilterValues();
             // Reaffect Render List.
-            shadowMap.renderList = renderList;
+            this._shadowMap.renderList = renderList;
         };
         ShadowGenerator.prototype._disposeBlurPostProcesses = function () {
             if (this._shadowMap2) {
@@ -74977,6 +74993,8 @@ var BABYLON;
             this._particlesRenderTime = new BABYLON.PerfCounter();
             this._captureSpritesRenderTime = false;
             this._spritesRenderTime = new BABYLON.PerfCounter();
+            this._capturePhysicsTime = false;
+            this._physicsTime = new BABYLON.PerfCounter();
             // Observers
             this._onBeforeActiveMeshesEvaluationObserver = null;
             this._onAfterActiveMeshesEvaluationObserver = null;
@@ -74990,6 +75008,8 @@ var BABYLON;
             this._onAfterParticlesRenderingObserver = null;
             this._onBeforeSpritesRenderingObserver = null;
             this._onAfterSpritesRenderingObserver = null;
+            this._onBeforePhysicsObserver = null;
+            this._onAfterPhysicsObserver = null;
             // Before render
             this._onBeforeAnimationsObserver = scene.onBeforeAnimationsObservable.add(function () {
                 if (_this._captureActiveMeshesEvaluationTime) {
@@ -75212,6 +75232,52 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(SceneInstrumentation.prototype, "physicsTimeCounter", {
+            /**
+             * Gets the perf counter used for physics time
+             */
+            get: function () {
+                return this._physicsTime;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(SceneInstrumentation.prototype, "capturePhysicsTime", {
+            /**
+             * Gets the physics time capture status
+             */
+            get: function () {
+                return this._capturePhysicsTime;
+            },
+            /**
+             * Enable or disable the physics time capture
+             */
+            set: function (value) {
+                var _this = this;
+                if (value === this._capturePhysicsTime) {
+                    return;
+                }
+                this._capturePhysicsTime = value;
+                if (value) {
+                    this._onBeforePhysicsObserver = this.scene.onBeforePhysicsObservable.add(function () {
+                        BABYLON.Tools.StartPerformanceCounter("Physics");
+                        _this._physicsTime.beginMonitoring();
+                    });
+                    this._onAfterPhysicsObserver = this.scene.onAfterPhysicsObservable.add(function () {
+                        BABYLON.Tools.EndPerformanceCounter("Physics");
+                        _this._physicsTime.endMonitoring();
+                    });
+                }
+                else {
+                    this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver);
+                    this._onBeforePhysicsObserver = null;
+                    this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver);
+                    this._onAfterPhysicsObserver = null;
+                }
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(SceneInstrumentation.prototype, "frameTimeCounter", {
             /**
              * Gets the perf counter used for frame time capture
@@ -75345,6 +75411,10 @@ var BABYLON;
             this._onBeforeDrawPhaseObserver = null;
             this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver);
             this._onAfterDrawPhaseObserver = null;
+            this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver);
+            this._onBeforePhysicsObserver = null;
+            this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver);
+            this._onAfterPhysicsObserver = null;
             this.scene = null;
         };
         return SceneInstrumentation;

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 6254 - 6228
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 3 - 3
dist/preview release/inspector/babylon.inspector.bundle.js


+ 8 - 1
dist/preview release/inspector/babylon.inspector.js

@@ -944,7 +944,7 @@ var INSPECTOR;
             var str = '';
             var physicsImposter = this._obj;
             if (physicsImposter && physicsImposter.object) {
-                str = physicsImposter.object.name;
+                str = physicsImposter.object.name || "";
             } // otherwise nothing displayed        
             return str;
         };
@@ -3676,6 +3676,7 @@ var INSPECTOR;
             _this._sceneInstrumentation.captureInterFrameTime = true;
             _this._sceneInstrumentation.captureParticlesRenderTime = true;
             _this._sceneInstrumentation.captureSpritesRenderTime = true;
+            _this._sceneInstrumentation.capturePhysicsTime = true;
             _this._engineInstrumentation = new BABYLON.EngineInstrumentation(_this._engine);
             _this._engineInstrumentation.captureGPUFrameTime = true;
             // Build the stats panel: a div that will contains all stats
@@ -3784,6 +3785,12 @@ var INSPECTOR;
                     elem: elemValue,
                     updateFct: function () { return BABYLON.Tools.Format(_this._sceneInstrumentation.spritesRenderTimeCounter.current); }
                 });
+                elemLabel = _this._createStatLabel("Physics", _this._panel);
+                elemValue = INSPECTOR.Helpers.CreateDiv('stat-value', _this._panel);
+                _this._updatableProperties.push({
+                    elem: elemValue,
+                    updateFct: function () { return BABYLON.Tools.Format(_this._sceneInstrumentation.physicsTimeCounter.current); }
+                });
                 elemLabel = _this._createStatLabel("Render", _this._panel);
                 elemValue = INSPECTOR.Helpers.CreateDiv('stat-value', _this._panel);
                 _this._updatableProperties.push({

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 3 - 3
dist/preview release/inspector/babylon.inspector.min.js


+ 1 - 2
src/Lights/Shadows/babylon.shadowGenerator.ts

@@ -825,7 +825,6 @@
 
         public recreateShadowMap(): void {
             let shadowMap = this._shadowMap;
-
             if (!shadowMap) {
                 return;
             }
@@ -841,7 +840,7 @@
             // Reaffect the filter.
             this._applyFilterValues();
             // Reaffect Render List.
-            shadowMap.renderList = renderList;
+            this._shadowMap!.renderList = renderList;
         }
 
         private _disposeBlurPostProcesses(): void {

+ 1 - 2
src/Materials/babylon.imageProcessingConfiguration.ts

@@ -355,8 +355,7 @@ module BABYLON {
             defines.COLORCURVES = (this.colorCurvesEnabled && !!this.colorCurves);
             defines.COLORGRADING = (this.colorGradingEnabled && !!this.colorGradingTexture);
             if (defines.COLORGRADING) {
-                let texture = <BaseTexture>this.colorGradingTexture;
-                defines.COLORGRADING3D = ((<Scene>texture.getScene()).getEngine().webGLVersion > 1) ? true : false;                 
+                defines.COLORGRADING3D = this.colorGradingTexture!.is3D;
             } else {
                 defines.COLORGRADING3D = false;
             }