소스 검색

Merge pull request #452 from jahow/patch-3

Material onBind callback improvement
David Catuhe 10 년 전
부모
커밋
37174079ed
2개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  1. 3 3
      Babylon/Materials/babylon.material.ts
  2. 2 2
      Babylon/Materials/babylon.shaderMaterial.ts

+ 3 - 3
Babylon/Materials/babylon.material.ts

@@ -25,7 +25,7 @@
         public onCompiled: (effect: Effect) => void;
         public onCompiled: (effect: Effect) => void;
         public onError: (effect: Effect, errors: string) => void;
         public onError: (effect: Effect, errors: string) => void;
         public onDispose: () => void;
         public onDispose: () => void;
-        public onBind: (material: Material) => void;
+        public onBind: (material: Material, mesh: Mesh) => void;
         public getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
         public getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
 
 
         public _effect: Effect;
         public _effect: Effect;
@@ -109,7 +109,7 @@
             this._scene._cachedMaterial = this;
             this._scene._cachedMaterial = this;
 
 
             if (this.onBind) {
             if (this.onBind) {
-                this.onBind(this);
+                this.onBind(this, mesh);
             }
             }
         }
         }
 
 
@@ -136,4 +136,4 @@
             }
             }
         }
         }
     }
     }
-} 
+} 

+ 2 - 2
Babylon/Materials/babylon.shaderMaterial.ts

@@ -231,7 +231,7 @@
                 }
                 }
             }
             }
 
 
-            super.bind(world, null);
+            super.bind(world, mesh);
         }
         }
 
 
         public dispose(forceDisposeEffect?: boolean): void {
         public dispose(forceDisposeEffect?: boolean): void {
@@ -244,4 +244,4 @@
             super.dispose(forceDisposeEffect);
             super.dispose(forceDisposeEffect);
         }
         }
     }
     }
-} 
+}