Quellcode durchsuchen

copy array to avoid modifying passed in sampler arrays when initializing an effect

Trevor Baron vor 7 Jahren
Ursprung
Commit
fd6d773232
1 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. 2 2
      src/Materials/babylon.effect.ts

+ 2 - 2
src/Materials/babylon.effect.ts

@@ -259,7 +259,7 @@
 
                 this._attributesNames = options.attributes;
                 this._uniformsNames = options.uniformsNames.concat(options.samplers);
-                this._samplers = options.samplers;
+                this._samplers = options.samplers.slice();
                 this.defines = options.defines;
                 this.onError = options.onError;
                 this.onCompiled = options.onCompiled;
@@ -276,7 +276,7 @@
                 this._engine = <Engine>engine;
                 this.defines = <string>defines;
                 this._uniformsNames = (<string[]>uniformsNamesOrEngine).concat(<string[]>samplers);
-                this._samplers = <string[]>samplers;
+                this._samplers = samplers ? <string[]>samplers.slice() : [];
                 this._attributesNames = (<string[]>attributesNamesOrOptions);
 
                 this.onError = onError;