Kaynağa Gözat

Merge pull request #452 from jahow/patch-3

Material onBind callback improvement
David Catuhe 10 yıl önce
ebeveyn
işleme
37174079ed

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

@@ -25,7 +25,7 @@
         public onCompiled: (effect: Effect) => void;
         public onError: (effect: Effect, errors: string) => void;
         public onDispose: () => void;
-        public onBind: (material: Material) => void;
+        public onBind: (material: Material, mesh: Mesh) => void;
         public getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
 
         public _effect: Effect;
@@ -109,7 +109,7 @@
             this._scene._cachedMaterial = this;
 
             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 {
@@ -244,4 +244,4 @@
             super.dispose(forceDisposeEffect);
         }
     }
-} 
+}