|
@@ -18,6 +18,7 @@ var BABYLON;
|
|
|
this.specularColor = new BABYLON.Color3(1, 1, 1);
|
|
|
this.specularPower = 64;
|
|
|
this.emissiveColor = new BABYLON.Color3(0, 0, 0);
|
|
|
+ this.useAlphaFromDiffuseTexture = false;
|
|
|
this._cachedDefines = null;
|
|
|
this._renderTargets = new BABYLON.SmartArray(16);
|
|
|
this._worldViewProjectionMatrix = BABYLON.Matrix.Zero();
|
|
@@ -38,13 +39,17 @@ var BABYLON;
|
|
|
};
|
|
|
}
|
|
|
StandardMaterial.prototype.needAlphaBlending = function () {
|
|
|
- return (this.alpha < 1.0) || (this.opacityTexture != null);
|
|
|
+ return (this.alpha < 1.0) || (this.opacityTexture != null) || this._shouldUseAlphaFromDiffuseTexture();
|
|
|
};
|
|
|
|
|
|
StandardMaterial.prototype.needAlphaTesting = function () {
|
|
|
return this.diffuseTexture != null && this.diffuseTexture.hasAlpha;
|
|
|
};
|
|
|
|
|
|
+ StandardMaterial.prototype._shouldUseAlphaFromDiffuseTexture = function(){
|
|
|
+ return this.diffuseTexture != null && this.diffuseTexture.hasAlpha && this.useAlphaFromDiffuseTexture;
|
|
|
+ };
|
|
|
+
|
|
|
// Methods
|
|
|
StandardMaterial.prototype.isReady = function (mesh) {
|
|
|
if (this.checkReadyOnlyOnce) {
|
|
@@ -135,6 +140,10 @@ var BABYLON;
|
|
|
defines.push("#define ALPHATEST");
|
|
|
}
|
|
|
|
|
|
+ if(this._shouldUseAlphaFromDiffuseTexture()) {
|
|
|
+ defines.push("#define ALPHAFROMDIFFUSE");
|
|
|
+ }
|
|
|
+
|
|
|
// Fog
|
|
|
if (scene.fogMode !== BABYLON.Scene.FOGMODE_NONE) {
|
|
|
defines.push("#define FOG");
|