Переглянути джерело

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

Trevor Baron 7 роки тому
батько
коміт
fd6d773232
1 змінених файлів з 2 додано та 2 видалено
  1. 2 2
      src/Materials/babylon.effect.ts

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

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