|
@@ -19860,7 +19860,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
return needNormals;
|
|
return needNormals;
|
|
};
|
|
};
|
|
- StandardMaterial.BindLightShadow = function (light, scene, mesh, lightIndex, effect, defines, depthValuesAlreadySet) {
|
|
|
|
|
|
+ StandardMaterial.BindLightShadow = function (light, scene, mesh, lightIndex, effect, depthValuesAlreadySet) {
|
|
var shadowGenerator = light.getShadowGenerator();
|
|
var shadowGenerator = light.getShadowGenerator();
|
|
if (mesh.receiveShadows && shadowGenerator) {
|
|
if (mesh.receiveShadows && shadowGenerator) {
|
|
if (!light.needCube()) {
|
|
if (!light.needCube()) {
|
|
@@ -19912,7 +19912,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
// Shadows
|
|
// Shadows
|
|
if (scene.shadowsEnabled) {
|
|
if (scene.shadowsEnabled) {
|
|
- depthValuesAlreadySet = this.BindLightShadow(light, scene, mesh, lightIndex, effect, defines, depthValuesAlreadySet);
|
|
|
|
|
|
+ depthValuesAlreadySet = this.BindLightShadow(light, scene, mesh, lightIndex, effect, depthValuesAlreadySet);
|
|
}
|
|
}
|
|
lightIndex++;
|
|
lightIndex++;
|
|
if (lightIndex === maxSimultaneousLights)
|
|
if (lightIndex === maxSimultaneousLights)
|
|
@@ -20296,9 +20296,7 @@ var BABYLON;
|
|
// Matrices
|
|
// Matrices
|
|
this.bindOnlyWorldMatrix(world);
|
|
this.bindOnlyWorldMatrix(world);
|
|
// Bones
|
|
// Bones
|
|
- if (mesh && mesh.useBones && mesh.computeBonesUsingShaders) {
|
|
|
|
- this._effect.setMatrices("mBones", mesh.skeleton.getTransformMatrices(mesh));
|
|
|
|
- }
|
|
|
|
|
|
+ StandardMaterial.ApplyBonesParameters(mesh, this._effect);
|
|
if (scene.getCachedMaterial() !== this) {
|
|
if (scene.getCachedMaterial() !== this) {
|
|
this._effect.setMatrix("viewProjection", scene.getTransformMatrix());
|
|
this._effect.setMatrix("viewProjection", scene.getTransformMatrix());
|
|
if (StandardMaterial.FresnelEnabled) {
|
|
if (StandardMaterial.FresnelEnabled) {
|
|
@@ -20415,10 +20413,7 @@ var BABYLON;
|
|
this._effect.setMatrix("view", scene.getViewMatrix());
|
|
this._effect.setMatrix("view", scene.getViewMatrix());
|
|
}
|
|
}
|
|
// Fog
|
|
// Fog
|
|
- if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== BABYLON.Scene.FOGMODE_NONE) {
|
|
|
|
- this._effect.setFloat4("vFogInfos", scene.fogMode, scene.fogStart, scene.fogEnd, scene.fogDensity);
|
|
|
|
- this._effect.setColor3("vFogColor", scene.fogColor);
|
|
|
|
- }
|
|
|
|
|
|
+ StandardMaterial.ApplyFogParameters(scene, mesh, this._effect);
|
|
// Log. depth
|
|
// Log. depth
|
|
if (this._defines.LOGARITHMICDEPTH) {
|
|
if (this._defines.LOGARITHMICDEPTH) {
|
|
this._effect.setFloat("logarithmicDepthConstant", 2.0 / (Math.log(scene.activeCamera.maxZ + 1.0) / Math.LN2));
|
|
this._effect.setFloat("logarithmicDepthConstant", 2.0 / (Math.log(scene.activeCamera.maxZ + 1.0) / Math.LN2));
|
|
@@ -20426,6 +20421,17 @@ var BABYLON;
|
|
}
|
|
}
|
|
_super.prototype.bind.call(this, world, mesh);
|
|
_super.prototype.bind.call(this, world, mesh);
|
|
};
|
|
};
|
|
|
|
+ StandardMaterial.ApplyFogParameters = function (scene, mesh, effect) {
|
|
|
|
+ if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== BABYLON.Scene.FOGMODE_NONE) {
|
|
|
|
+ effect.setFloat4("vFogInfos", scene.fogMode, scene.fogStart, scene.fogEnd, scene.fogDensity);
|
|
|
|
+ effect.setColor3("vFogColor", scene.fogColor);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ StandardMaterial.ApplyBonesParameters = function (mesh, effect) {
|
|
|
|
+ if (mesh && mesh.useBones && mesh.computeBonesUsingShaders) {
|
|
|
|
+ effect.setMatrices("mBones", mesh.skeleton.getTransformMatrices(mesh));
|
|
|
|
+ }
|
|
|
|
+ };
|
|
StandardMaterial.prototype.getAnimatables = function () {
|
|
StandardMaterial.prototype.getAnimatables = function () {
|
|
var results = [];
|
|
var results = [];
|
|
if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {
|
|
if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {
|