Bläddra i källkod

Merge pull request #7387 from BabylonJS/master

Deploy Nightly
sebavan 5 år sedan
förälder
incheckning
38ec301700

+ 6 - 0
dist/preview release/babylon.d.ts

@@ -30555,6 +30555,7 @@ declare module BABYLON {
         private _settings;
         private _createInternalTextureOnEvent;
         private _frameId;
+        private _currentSrc;
         /**
          * Creates a video texture.
          * If you want to display a video in your scene, this is the special texture for that.
@@ -30593,6 +30594,11 @@ declare module BABYLON {
          */
         updateURL(url: string): void;
         /**
+         * Clones the texture.
+         * @returns the cloned texture
+         */
+        clone(): VideoTexture;
+        /**
          * Dispose the texture and release its associated resources.
          */
         dispose(): void;

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
dist/preview release/babylon.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 38 - 27
dist/preview release/babylon.max.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
dist/preview release/babylon.max.js.map


+ 12 - 0
dist/preview release/babylon.module.d.ts

@@ -31489,6 +31489,7 @@ declare module "babylonjs/Materials/Textures/videoTexture" {
         private _settings;
         private _createInternalTextureOnEvent;
         private _frameId;
+        private _currentSrc;
         /**
          * Creates a video texture.
          * If you want to display a video in your scene, this is the special texture for that.
@@ -31527,6 +31528,11 @@ declare module "babylonjs/Materials/Textures/videoTexture" {
          */
         updateURL(url: string): void;
         /**
+         * Clones the texture.
+         * @returns the cloned texture
+         */
+        clone(): VideoTexture;
+        /**
          * Dispose the texture and release its associated resources.
          */
         dispose(): void;
@@ -101955,6 +101961,7 @@ declare module BABYLON {
         private _settings;
         private _createInternalTextureOnEvent;
         private _frameId;
+        private _currentSrc;
         /**
          * Creates a video texture.
          * If you want to display a video in your scene, this is the special texture for that.
@@ -101993,6 +102000,11 @@ declare module BABYLON {
          */
         updateURL(url: string): void;
         /**
+         * Clones the texture.
+         * @returns the cloned texture
+         */
+        clone(): VideoTexture;
+        /**
          * Dispose the texture and release its associated resources.
          */
         dispose(): void;

+ 6 - 0
dist/preview release/documentation.d.ts

@@ -30555,6 +30555,7 @@ declare module BABYLON {
         private _settings;
         private _createInternalTextureOnEvent;
         private _frameId;
+        private _currentSrc;
         /**
          * Creates a video texture.
          * If you want to display a video in your scene, this is the special texture for that.
@@ -30593,6 +30594,11 @@ declare module BABYLON {
          */
         updateURL(url: string): void;
         /**
+         * Clones the texture.
+         * @returns the cloned texture
+         */
+        clone(): VideoTexture;
+        /**
          * Dispose the texture and release its associated resources.
          */
         dispose(): void;

+ 12 - 0
dist/preview release/viewer/babylon.module.d.ts

@@ -31489,6 +31489,7 @@ declare module "babylonjs/Materials/Textures/videoTexture" {
         private _settings;
         private _createInternalTextureOnEvent;
         private _frameId;
+        private _currentSrc;
         /**
          * Creates a video texture.
          * If you want to display a video in your scene, this is the special texture for that.
@@ -31527,6 +31528,11 @@ declare module "babylonjs/Materials/Textures/videoTexture" {
          */
         updateURL(url: string): void;
         /**
+         * Clones the texture.
+         * @returns the cloned texture
+         */
+        clone(): VideoTexture;
+        /**
          * Dispose the texture and release its associated resources.
          */
         dispose(): void;
@@ -101955,6 +101961,7 @@ declare module BABYLON {
         private _settings;
         private _createInternalTextureOnEvent;
         private _frameId;
+        private _currentSrc;
         /**
          * Creates a video texture.
          * If you want to display a video in your scene, this is the special texture for that.
@@ -101993,6 +102000,11 @@ declare module BABYLON {
          */
         updateURL(url: string): void;
         /**
+         * Clones the texture.
+         * @returns the cloned texture
+         */
+        clone(): VideoTexture;
+        /**
          * Dispose the texture and release its associated resources.
          */
         dispose(): void;

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 6 - 6
dist/preview release/viewer/babylon.viewer.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


+ 1 - 1
src/Engines/Native/nativeShaderProcessor.ts

@@ -67,7 +67,7 @@ export class NativeShaderProcessor extends WebGL2ShaderProcessor {
             throw new Error("Can't find bgfx name mapping");
         }
         attribute = attribute.replace(name, newName);
-        this._replacements.push({ searchValue: new RegExp(`\\b${name}\\b`), replaceValue: `${newName}` });
+        this._replacements.push({ searchValue: new RegExp(`\\b${name}\\b`, 'g'), replaceValue: `${newName}` });
         return `layout(location=${location}) ${super.attributeProcessor(attribute)}`;
     }
 

+ 19 - 0
src/Materials/Textures/videoTexture.ts

@@ -69,6 +69,7 @@ export class VideoTexture extends Texture {
     private _settings: VideoTextureSettings;
     private _createInternalTextureOnEvent: string;
     private _frameId = -1;
+    private _currentSrc: Nullable<string | string[] | HTMLVideoElement> = null;
 
     /**
      * Creates a video texture.
@@ -103,6 +104,7 @@ export class VideoTexture extends Texture {
         this._initialSamplingMode = samplingMode;
         this.autoUpdateTexture = settings.autoUpdateTexture;
 
+        this._currentSrc = src;
         this.name = name || this._getName(src);
         this.video = this._getVideo(src);
         this._settings = settings;
@@ -317,6 +319,21 @@ export class VideoTexture extends Texture {
      */
     public updateURL(url: string): void {
         this.video.src = url;
+        this._currentSrc = url;
+    }
+
+    /**
+     * Clones the texture.
+     * @returns the cloned texture
+     */
+    public clone(): VideoTexture {
+        return new VideoTexture(this.name,
+            this._currentSrc!,
+            this.getScene(),
+            this._generateMipMaps,
+            this.invertY,
+            this.samplingMode,
+            this._settings);
     }
 
     /**
@@ -325,6 +342,8 @@ export class VideoTexture extends Texture {
     public dispose(): void {
         super.dispose();
 
+        this._currentSrc = null;
+
         if (this._onUserActionRequestedObservable) {
             this._onUserActionRequestedObservable.clear();
             this._onUserActionRequestedObservable = null;