|
@@ -729,6 +729,25 @@ export class Material implements IAnimatable {
|
|
|
this._markAllSubMeshesAsTexturesAndMiscDirty();
|
|
|
}
|
|
|
|
|
|
+ protected _strictTransparencyMode: boolean = false;
|
|
|
+ /**
|
|
|
+ * Gets or sets the strict transparency mode
|
|
|
+ */
|
|
|
+ @serialize()
|
|
|
+ public get strictTransparencyMode(): boolean {
|
|
|
+ return this._strictTransparencyMode;
|
|
|
+ }
|
|
|
+
|
|
|
+ public set strictTransparencyMode(value: boolean) {
|
|
|
+ if (this._strictTransparencyMode === value) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this._strictTransparencyMode = value;
|
|
|
+
|
|
|
+ this._markAllSubMeshesAsTexturesAndMiscDirty();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Returns true if alpha blending should be disabled.
|
|
|
*/
|
|
@@ -742,6 +761,10 @@ export class Material implements IAnimatable {
|
|
|
* @returns a boolean specifying if alpha blending is needed
|
|
|
*/
|
|
|
public needAlphaBlending(): boolean {
|
|
|
+ if (this.strictTransparencyMode) {
|
|
|
+ return this._transparencyMode === Material.MATERIAL_ALPHABLEND || this._transparencyMode === Material.MATERIAL_ALPHATESTANDBLEND;
|
|
|
+ }
|
|
|
+
|
|
|
if (this._disableAlphaBlending) {
|
|
|
return false;
|
|
|
}
|
|
@@ -755,6 +778,10 @@ export class Material implements IAnimatable {
|
|
|
* @returns a boolean specifying if alpha blending is needed for the mesh
|
|
|
*/
|
|
|
public needAlphaBlendingForMesh(mesh: AbstractMesh): boolean {
|
|
|
+ if (this.strictTransparencyMode) {
|
|
|
+ return this._transparencyMode === Material.MATERIAL_ALPHABLEND || this._transparencyMode === Material.MATERIAL_ALPHATESTANDBLEND;
|
|
|
+ }
|
|
|
+
|
|
|
if (this._disableAlphaBlending && mesh.visibility >= 1.0) {
|
|
|
return false;
|
|
|
}
|
|
@@ -767,6 +794,10 @@ export class Material implements IAnimatable {
|
|
|
* @returns a boolean specifying if an alpha test is needed.
|
|
|
*/
|
|
|
public needAlphaTesting(): boolean {
|
|
|
+ if (this.strictTransparencyMode) {
|
|
|
+ return this._transparencyMode === Material.MATERIAL_ALPHATEST || this._transparencyMode === Material.MATERIAL_ALPHATESTANDBLEND;
|
|
|
+ }
|
|
|
+
|
|
|
if (this._forceAlphaTest) {
|
|
|
return true;
|
|
|
}
|
|
@@ -779,6 +810,10 @@ export class Material implements IAnimatable {
|
|
|
* @param mesh defines the mesh to check
|
|
|
*/
|
|
|
protected _shouldTurnAlphaTestOn(mesh: AbstractMesh): boolean {
|
|
|
+ if (this.strictTransparencyMode) {
|
|
|
+ return this._transparencyMode === Material.MATERIAL_ALPHATEST || this._transparencyMode === Material.MATERIAL_ALPHATESTANDBLEND;
|
|
|
+ }
|
|
|
+
|
|
|
return (!this.needAlphaBlendingForMesh(mesh) && this.needAlphaTesting());
|
|
|
}
|
|
|
|