David Catuhe 8 年之前
父节点
当前提交
2cf7717a08

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


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


+ 38 - 3
dist/preview release/babylon.max.js

@@ -7474,6 +7474,9 @@ var BABYLON;
             // Deterministic lockstepMaxSteps
             this._deterministicLockstep = false;
             this._lockstepMaxSteps = 4;
+            // Lost context
+            this.onContextLostObservable = new BABYLON.Observable();
+            this.onContextRestoredObservable = new BABYLON.Observable();
             this._contextWasLost = false;
             this._doNotHandleContextLost = false;
             // FPS
@@ -7609,6 +7612,7 @@ var BABYLON;
                     evt.preventDefault();
                     _this._contextWasLost = true;
                     BABYLON.Tools.Warn("WebGL context lost.");
+                    _this.onContextLostObservable.notifyObservers(_this);
                 };
                 this._onContextRestored = function (evt) {
                     // Rebuild gl context
@@ -7622,6 +7626,7 @@ var BABYLON;
                     // Cache
                     _this.wipeCaches(true);
                     BABYLON.Tools.Warn("WebGL context successfully restored.");
+                    _this.onContextRestoredObservable.notifyObservers(_this);
                     _this._contextWasLost = false;
                 };
                 canvas.addEventListener("webglcontextlost", this._onContextLost, false);
@@ -12372,6 +12377,9 @@ var BABYLON;
             if (this._occlusionQuery) {
                 this._occlusionQuery = null;
             }
+            if (this._edgesRenderer) {
+                this._edgesRenderer._rebuild();
+            }
             if (!this.subMeshes) {
                 return;
             }
@@ -46567,6 +46575,9 @@ var BABYLON;
             this._setTextureReady = this.__setTextureReady.bind(this);
             this.video.addEventListener("playing", this._setTextureReady);
         };
+        VideoTexture.prototype._rebuild = function () {
+            this.update();
+        };
         VideoTexture.prototype.update = function () {
             var now = BABYLON.Tools.Now;
             if (now - this._lastUpdate < 15 || this.video.readyState !== this.video.HAVE_ENOUGH_DATA) {
@@ -50352,6 +50363,11 @@ var BABYLON;
             vertices.push(-1, -1);
             vertices.push(1, -1);
             _this._vertexBuffers[BABYLON.VertexBuffer.PositionKind] = new BABYLON.VertexBuffer(engine, vertices, BABYLON.VertexBuffer.PositionKind, false, false, 2);
+            _this._createIndexBuffer();
+            return _this;
+        }
+        ProceduralTexture.prototype._createIndexBuffer = function () {
+            var engine = this.getScene().getEngine();
             // Indices
             var indices = [];
             indices.push(0);
@@ -50360,9 +50376,15 @@ var BABYLON;
             indices.push(0);
             indices.push(2);
             indices.push(3);
-            _this._indexBuffer = engine.createIndexBuffer(indices);
-            return _this;
-        }
+            this._indexBuffer = engine.createIndexBuffer(indices);
+        };
+        ProceduralTexture.prototype._rebuild = function () {
+            this._vertexBuffers[BABYLON.VertexBuffer.PositionKind]._rebuild();
+            this._createIndexBuffer();
+            if (this.refreshRate === BABYLON.RenderTargetTexture.REFRESHRATE_RENDER_ONCE) {
+                this.refreshRate = BABYLON.RenderTargetTexture.REFRESHRATE_RENDER_ONCE;
+            }
+        };
         ProceduralTexture.prototype.reset = function () {
             if (this._effect === undefined) {
                 return;
@@ -68004,6 +68026,19 @@ var BABYLON;
             this._lineShader.disableDepthWrite = true;
             this._lineShader.backFaceCulling = false;
         };
+        EdgesRenderer.prototype._rebuild = function () {
+            var buffer = this._buffers[BABYLON.VertexBuffer.PositionKind];
+            if (buffer) {
+                buffer._rebuild();
+            }
+            buffer = this._buffers[BABYLON.VertexBuffer.NormalKind];
+            if (buffer) {
+                buffer._rebuild();
+            }
+            var scene = this._source.getScene();
+            var engine = scene.getEngine();
+            this._ib = engine.createIndexBuffer(this._linesIndices);
+        };
         EdgesRenderer.prototype.dispose = function () {
             var buffer = this._buffers[BABYLON.VertexBuffer.PositionKind];
             if (buffer) {

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


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


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


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


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

@@ -7474,6 +7474,9 @@ var BABYLON;
             // Deterministic lockstepMaxSteps
             this._deterministicLockstep = false;
             this._lockstepMaxSteps = 4;
+            // Lost context
+            this.onContextLostObservable = new BABYLON.Observable();
+            this.onContextRestoredObservable = new BABYLON.Observable();
             this._contextWasLost = false;
             this._doNotHandleContextLost = false;
             // FPS
@@ -7609,6 +7612,7 @@ var BABYLON;
                     evt.preventDefault();
                     _this._contextWasLost = true;
                     BABYLON.Tools.Warn("WebGL context lost.");
+                    _this.onContextLostObservable.notifyObservers(_this);
                 };
                 this._onContextRestored = function (evt) {
                     // Rebuild gl context
@@ -7622,6 +7626,7 @@ var BABYLON;
                     // Cache
                     _this.wipeCaches(true);
                     BABYLON.Tools.Warn("WebGL context successfully restored.");
+                    _this.onContextRestoredObservable.notifyObservers(_this);
                     _this._contextWasLost = false;
                 };
                 canvas.addEventListener("webglcontextlost", this._onContextLost, false);
@@ -12372,6 +12377,9 @@ var BABYLON;
             if (this._occlusionQuery) {
                 this._occlusionQuery = null;
             }
+            if (this._edgesRenderer) {
+                this._edgesRenderer._rebuild();
+            }
             if (!this.subMeshes) {
                 return;
             }
@@ -34155,6 +34163,9 @@ var BABYLON;
             this._setTextureReady = this.__setTextureReady.bind(this);
             this.video.addEventListener("playing", this._setTextureReady);
         };
+        VideoTexture.prototype._rebuild = function () {
+            this.update();
+        };
         VideoTexture.prototype.update = function () {
             var now = BABYLON.Tools.Now;
             if (now - this._lastUpdate < 15 || this.video.readyState !== this.video.HAVE_ENOUGH_DATA) {

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


+ 15 - 0
src/Materials/Textures/Procedurals/babylon.proceduralTexture.ts

@@ -63,6 +63,12 @@
 
             this._vertexBuffers[VertexBuffer.PositionKind] = new VertexBuffer(engine, vertices, VertexBuffer.PositionKind, false, false, 2);
 
+            this._createIndexBuffer();
+        }
+
+        private _createIndexBuffer(): void {
+            var engine = this.getScene().getEngine();
+
             // Indices
             var indices = [];
             indices.push(0);
@@ -76,6 +82,15 @@
             this._indexBuffer = engine.createIndexBuffer(indices);
         }
 
+        public _rebuild(): void {
+            this._vertexBuffers[VertexBuffer.PositionKind]._rebuild();
+            this._createIndexBuffer();
+
+            if (this.refreshRate === RenderTargetTexture.REFRESHRATE_RENDER_ONCE) {
+                this.refreshRate = RenderTargetTexture.REFRESHRATE_RENDER_ONCE;
+            }            
+        }
+
         public reset(): void {
             if (this._effect === undefined) {
                 return;

+ 5 - 0
src/Materials/Textures/babylon.videoTexture.ts

@@ -74,6 +74,11 @@
             this.video.addEventListener("playing", this._setTextureReady);
         }
 
+        
+        public _rebuild(): void {
+            this.update();
+        }
+
         public update(): boolean {
             var now = Tools.Now;
 

+ 4 - 0
src/Mesh/babylon.abstractMesh.ts

@@ -477,6 +477,10 @@
                 this._occlusionQuery = null;
             }
 
+            if (this._edgesRenderer) {
+                this._edgesRenderer._rebuild();
+            }
+
             if (!this.subMeshes) {
                 return;
             }

+ 16 - 0
src/Rendering/babylon.edgesRenderer.ts

@@ -49,6 +49,22 @@
             this._lineShader.backFaceCulling = false;
         }
 
+        public _rebuild(): void {
+            var buffer = this._buffers[VertexBuffer.PositionKind];
+            if (buffer) {
+                buffer._rebuild();
+            }
+
+            buffer = this._buffers[VertexBuffer.NormalKind];
+            if (buffer) {
+                buffer._rebuild();
+            }
+
+            var scene = this._source.getScene();
+            var engine = scene.getEngine();
+            this._ib = engine.createIndexBuffer(this._linesIndices);
+        }
+
         public dispose(): void {
 
             var buffer = this._buffers[VertexBuffer.PositionKind];

+ 6 - 0
src/babylon.engine.ts

@@ -613,6 +613,8 @@
         private _lockstepMaxSteps: number = 4;
 
         // Lost context
+        public onContextLostObservable = new Observable<Engine>();
+        public onContextRestoredObservable = new Observable<Engine>();
         private _onContextLost: (evt: Event) => void;
         private _onContextRestored: (evt: Event) => void;
         private _contextWasLost = false;
@@ -814,6 +816,8 @@
                     evt.preventDefault();
                     this._contextWasLost = true;
                     Tools.Warn("WebGL context lost.");
+
+                    this.onContextLostObservable.notifyObservers(this);
                 };
 
                 this._onContextRestored = (evt: Event) => {
@@ -834,6 +838,8 @@
 
                     Tools.Warn("WebGL context successfully restored.");
 
+                    this.onContextRestoredObservable.notifyObservers(this);
+
                     this._contextWasLost = false;
                 };