瀏覽代碼

fix ReviewUniform for in changed to for index

NasimiAsl 5 年之前
父節點
當前提交
c02e323d49
共有 1 個文件被更改,包括 6 次插入6 次删除
  1. 6 6
      materialsLibrary/src/custom/pbrCustomMaterial.ts

+ 6 - 6
materialsLibrary/src/custom/pbrCustomMaterial.ts

@@ -86,20 +86,20 @@ export class PBRCustomMaterial extends PBRMaterial {
 
     public ReviewUniform(name: string, arr: string[]): string[] {
         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]);
                 }
             }
         }
         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]);
                 }
             }
         }
-        return arr;
+        return arr; 
     }
 
     public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: PBRMaterialDefines, attributes?: string[]): string {
@@ -276,4 +276,4 @@ export class PBRCustomMaterial extends PBRMaterial {
     }
 }
 
-_TypeStore.RegisteredTypes["BABYLON.PBRCustomMaterial"] = PBRCustomMaterial;
+_TypeStore.RegisteredTypes["BABYLON.PBRCustomMaterial"] = PBRCustomMaterial;