|
@@ -804,14 +804,24 @@ export class StandardMaterial extends PushMaterial {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- return this._diffuseTexture != null && this._diffuseTexture.hasAlpha && (this._transparencyMode == null || this._transparencyMode === Material.MATERIAL_ALPHATEST);
|
|
|
+ return this._hasAlphaChannel() && (this._transparencyMode == null || this._transparencyMode === Material.MATERIAL_ALPHATEST);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Specifies whether or not the alpha value of the diffuse texture should be used for alpha blending.
|
|
|
+ */
|
|
|
protected _shouldUseAlphaFromDiffuseTexture(): boolean {
|
|
|
return this._diffuseTexture != null && this._diffuseTexture.hasAlpha && this._useAlphaFromDiffuseTexture && this._transparencyMode !== Material.MATERIAL_OPAQUE;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Specifies whether or not there is a usable alpha channel for transparency.
|
|
|
+ */
|
|
|
+ protected _hasAlphaChannel(): boolean {
|
|
|
+ return (this._diffuseTexture != null && this._diffuseTexture.hasAlpha) || this._opacityTexture != null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Get the texture used for alpha test purpose.
|
|
|
* @returns the diffuse texture in case of the standard material.
|
|
|
*/
|
|
@@ -1432,9 +1442,6 @@ export class StandardMaterial extends PushMaterial {
|
|
|
ubo.updateFloat2("vDiffuseInfos", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);
|
|
|
MaterialHelper.BindTextureMatrix(this._diffuseTexture, ubo, "diffuse");
|
|
|
|
|
|
- if (this._diffuseTexture.hasAlpha) {
|
|
|
- effect.setFloat("alphaCutOff", this.alphaCutOff);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
if (this._ambientTexture && StandardMaterial.AmbientTextureEnabled) {
|
|
@@ -1447,6 +1454,10 @@ export class StandardMaterial extends PushMaterial {
|
|
|
MaterialHelper.BindTextureMatrix(this._opacityTexture, ubo, "opacity");
|
|
|
}
|
|
|
|
|
|
+ if (this._hasAlphaChannel()) {
|
|
|
+ effect.setFloat("alphaCutOff", this.alphaCutOff);
|
|
|
+ }
|
|
|
+
|
|
|
if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {
|
|
|
ubo.updateFloat2("vReflectionInfos", this._reflectionTexture.level, this.roughness);
|
|
|
ubo.updateMatrix("reflectionMatrix", this._reflectionTexture.getReflectionTextureMatrix());
|