|
@@ -372,6 +372,18 @@
|
|
defines.push("#define NUM_BONE_INFLUENCERS 0");
|
|
defines.push("#define NUM_BONE_INFLUENCERS 0");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // Morph targets
|
|
|
|
+ var manager = (<Mesh>mesh).morphTargetManager;
|
|
|
|
+ let morphInfluencers = 0;
|
|
|
|
+ if (manager) {
|
|
|
|
+ if (manager.numInfluencers > 0) {
|
|
|
|
+ defines.push("#define MORPHTARGETS");
|
|
|
|
+ morphInfluencers = manager.numInfluencers;
|
|
|
|
+ defines.push("#define NUM_MORPH_INFLUENCERS " + morphInfluencers);
|
|
|
|
+ MaterialHelper.PrepareAttributesForMorphTargets(attribs, mesh, {"NUM_MORPH_INFLUENCERS": morphInfluencers });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
// Instances
|
|
// Instances
|
|
if (useInstances) {
|
|
if (useInstances) {
|
|
defines.push("#define INSTANCES");
|
|
defines.push("#define INSTANCES");
|
|
@@ -387,8 +399,9 @@
|
|
this._cachedDefines = join;
|
|
this._cachedDefines = join;
|
|
this._effectLayerMapGenerationEffect = this._scene.getEngine().createEffect("glowMapGeneration",
|
|
this._effectLayerMapGenerationEffect = this._scene.getEngine().createEffect("glowMapGeneration",
|
|
attribs,
|
|
attribs,
|
|
- ["world", "mBones", "viewProjection", "diffuseMatrix", "color", "emissiveMatrix"],
|
|
|
|
- ["diffuseSampler", "emissiveSampler"], join);
|
|
|
|
|
|
+ ["world", "mBones", "viewProjection", "diffuseMatrix", "color", "emissiveMatrix", "morphTargetInfluences"],
|
|
|
|
+ ["diffuseSampler", "emissiveSampler"], join,
|
|
|
|
+ undefined, undefined, undefined, { maxSimultaneousMorphTargets: morphInfluencers });
|
|
}
|
|
}
|
|
|
|
|
|
return this._effectLayerMapGenerationEffect.isReady();
|
|
return this._effectLayerMapGenerationEffect.isReady();
|
|
@@ -558,6 +571,9 @@
|
|
this._effectLayerMapGenerationEffect.setMatrices("mBones", mesh.skeleton.getTransformMatrices(mesh));
|
|
this._effectLayerMapGenerationEffect.setMatrices("mBones", mesh.skeleton.getTransformMatrices(mesh));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // Morph targets
|
|
|
|
+ MaterialHelper.BindMorphTargetParameters(mesh, this._effectLayerMapGenerationEffect);
|
|
|
|
+
|
|
// Draw
|
|
// Draw
|
|
mesh._processRendering(subMesh, this._effectLayerMapGenerationEffect, Material.TriangleFillMode, batch, hardwareInstancedRendering,
|
|
mesh._processRendering(subMesh, this._effectLayerMapGenerationEffect, Material.TriangleFillMode, batch, hardwareInstancedRendering,
|
|
(isInstance, world) => this._effectLayerMapGenerationEffect.setMatrix("world", world));
|
|
(isInstance, world) => this._effectLayerMapGenerationEffect.setMatrix("world", world));
|