Browse Source

Pass the world matrix to the bind block method

Popov72 5 years ago
parent
commit
3501d2c481
2 changed files with 4 additions and 2 deletions
  1. 1 1
      src/Materials/Node/nodeMaterial.ts
  2. 3 1
      src/Materials/Node/nodeMaterialBlock.ts

+ 1 - 1
src/Materials/Node/nodeMaterial.ts

@@ -906,7 +906,7 @@ export class NodeMaterial extends PushMaterial {
             if (effect && scene.getCachedEffect() !== effect) {
                 // Bindable blocks
                 for (var block of sharedData.bindableBlocks) {
-                    block.bind(effect, this, mesh, subMesh);
+                    block.bind(effect, this, mesh, subMesh, world);
                 }
 
                 // Connection points

+ 3 - 1
src/Materials/Node/nodeMaterialBlock.ts

@@ -13,6 +13,7 @@ import { UniqueIdGenerator } from '../../Misc/uniqueIdGenerator';
 import { Scene } from '../../scene';
 import { _TypeStore } from '../../Misc/typeStore';
 import { EffectFallbacks } from '../effectFallbacks';
+import { Matrix } from "../../Maths/math.vector";
 
 /**
  * Defines a block that can be used inside a node based material
@@ -173,8 +174,9 @@ export class NodeMaterialBlock {
      * @param nodeMaterial defines the hosting NodeMaterial
      * @param mesh defines the mesh that will be rendered
      * @param subMesh defines the submesh that will be rendered
+     * @param world defines the world transformation matrix
      */
-    public bind(effect: Effect, nodeMaterial: NodeMaterial, mesh?: Mesh, subMesh?: SubMesh) {
+    public bind(effect: Effect, nodeMaterial: NodeMaterial, mesh?: Mesh, subMesh?: SubMesh, world?: Matrix) {
         // Do nothing
     }