David Catuhe 8 lat temu
rodzic
commit
9ea3a30ef2

Plik diff jest za duży
+ 10 - 10
dist/preview release/babylon.core.js


Plik diff jest za duży
+ 4047 - 4047
dist/preview release/babylon.d.ts


Plik diff jest za duży
+ 10 - 10
dist/preview release/babylon.js


+ 10 - 5
dist/preview release/babylon.max.js

@@ -19615,6 +19615,8 @@ var BABYLON;
                 this._renderAlphaTest(this._alphaTestSubMeshes);
                 engine.setAlphaTesting(false);
             }
+            var stencilState = engine.getStencilBuffer();
+            engine.setStencilBuffer(false);
             // Sprites
             if (renderSprites) {
                 this._renderSprites();
@@ -19631,6 +19633,7 @@ var BABYLON;
                 this._renderTransparent(this._transparentSubMeshes);
                 engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
             }
+            engine.setStencilBuffer(stencilState);
         };
         /**
          * Renders the opaque submeshes in the order from the opaqueSortCompareFn.
@@ -29055,7 +29058,7 @@ var BABYLON;
                 _this._generateMipMaps = false;
             }
             if (urls) {
-                _this.video.addEventListener("canplaythrough", function () {
+                _this.video.addEventListener("canplay", function () {
                     _this._createTexture();
                 });
                 urls.forEach(function (url) {
@@ -29071,15 +29074,17 @@ var BABYLON;
             return _this;
         }
         VideoTexture.prototype._createTexture = function () {
+            var _this = this;
             this._texture = this.getScene().getEngine().createDynamicTexture(this.video.videoWidth, this.video.videoHeight, this._generateMipMaps, this._samplingMode);
-            this.getScene().getEngine().updateVideoTexture(this._texture, this.video, this._invertY);
-            this._texture.isReady = true;
-        };
-        VideoTexture.prototype.update = function () {
             if (this._autoLaunch) {
                 this._autoLaunch = false;
                 this.video.play();
             }
+            this.video.addEventListener("playing", function () {
+                _this._texture.isReady = true;
+            });
+        };
+        VideoTexture.prototype.update = function () {
             var now = BABYLON.Tools.Now;
             if (now - this._lastUpdate < 15 || this.video.readyState !== this.video.HAVE_ENOUGH_DATA) {
                 return false;

Plik diff jest za duży
+ 4047 - 4047
dist/preview release/babylon.module.d.ts


Plik diff jest za duży
+ 13 - 13
dist/preview release/babylon.noworker.js


+ 6 - 4
src/Materials/Textures/babylon.videoTexture.ts

@@ -44,7 +44,7 @@
             }
 
             if (urls) {
-                this.video.addEventListener("canplaythrough", () => {
+                this.video.addEventListener("canplay", () => {
                     this._createTexture();
                 });
                 urls.forEach(url => {
@@ -61,15 +61,17 @@
 
         private _createTexture(): void {
             this._texture = this.getScene().getEngine().createDynamicTexture(this.video.videoWidth, this.video.videoHeight, this._generateMipMaps, this._samplingMode);
-            this._texture.isReady = true;
-        }
 
-        public update(): boolean {
             if (this._autoLaunch) {
                 this._autoLaunch = false;
                 this.video.play();
             }
+            this.video.addEventListener("playing", () => {
+                this._texture.isReady = true;
+            });
+        }
 
+        public update(): boolean {
             var now = Tools.Now;
 
             if (now - this._lastUpdate < 15 || this.video.readyState !== this.video.HAVE_ENOUGH_DATA) {

+ 1 - 5
src/babylon.engine.ts

@@ -3124,11 +3124,7 @@
             if (texture instanceof VideoTexture) {
                 this.activateTexture(this._gl["TEXTURE" + channel]);
                 alreadyActivated = true;
-                if (!texture.update()) {
-                    this._bindTextureDirectly(this._gl.TEXTURE_2D, null);
-                    this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);
-                    return;
-                }
+                texture.update();
             } else if (texture.delayLoadState === Engine.DELAYLOADSTATE_NOTLOADED) { // Delay loading
                 texture.delayLoad();
                 return;