Browse Source

fix ReviewUniform change for in -- to for index

NasimiAsl 5 years ago
parent
commit
58be3193b4
1 changed files with 7 additions and 7 deletions
  1. 7 7
      materialsLibrary/src/custom/customMaterial.ts

+ 7 - 7
materialsLibrary/src/custom/customMaterial.ts

@@ -62,7 +62,7 @@ export class CustomMaterial extends StandardMaterial {
     public VertexShader: string;
     public VertexShader: string;
 
 
     public AttachAfterBind(mesh: Mesh, effect: Effect) {
     public AttachAfterBind(mesh: Mesh, effect: Effect) {
-        for (var el in this._newUniformInstances) {
+         for (var el in this._newUniformInstances) {
             var ea = el.toString().split('-');
             var ea = el.toString().split('-');
             if (ea[0] == 'vec2') {
             if (ea[0] == 'vec2') {
                 effect.setVector2(ea[1], this._newUniformInstances[el]);
                 effect.setVector2(ea[1], this._newUniformInstances[el]);
@@ -90,20 +90,20 @@ export class CustomMaterial extends StandardMaterial {
 
 
     public ReviewUniform(name: string, arr: string[]): string[] {
     public ReviewUniform(name: string, arr: string[]): string[] {
         if (name == "uniform") {
         if (name == "uniform") {
-            for (var ind in this._newUniforms) {
-                if (this._customUniform[ind].indexOf('sampler') == -1) {
+            for (var ind = 0;ind < this._newUniforms.length ;ind ++ ) {
+                if (  this._customUniform[ind].indexOf('sampler') == -1) {
                     arr.push(this._newUniforms[ind]);
                     arr.push(this._newUniforms[ind]);
                 }
                 }
             }
             }
         }
         }
         if (name == "sampler") {
         if (name == "sampler") {
-            for (var ind in this._newUniforms) {
-                if (this._customUniform[ind].indexOf('sampler') != -1) {
+            for (var ind = 0;ind < this._newUniforms.length ;ind ++ ) {
+                if ( this._customUniform[ind].indexOf('sampler') != -1) {
                     arr.push(this._newUniforms[ind]);
                     arr.push(this._newUniforms[ind]);
                 }
                 }
             }
             }
         }
         }
-        return arr;
+        return arr; 
     }
     }
 
 
     public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines, attributes?: string[]): string {
     public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines, attributes?: string[]): string {
@@ -268,4 +268,4 @@ export class CustomMaterial extends StandardMaterial {
     }
     }
 }
 }
 
 
-_TypeStore.RegisteredTypes["BABYLON.CustomMaterial"] = CustomMaterial;
+_TypeStore.RegisteredTypes["BABYLON.CustomMaterial"] = CustomMaterial;