Fix nearby mask being batched issue (#2833)

This commit is contained in:
pandamicro
2018-06-08 11:54:47 +08:00
committed by GitHub
parent 8bc53f72e1
commit 056b9e68ee
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -178,6 +178,9 @@ let Mask = cc.Class({
if (this._frontMaterial) {
this._frontMaterial.alphaThreshold = this.alphaThreshold;
this._frontMaterial.updateHash();
this._endMaterial.alphaThreshold = this.alphaThreshold;
this._endMaterial.updateHash();
this._endMaterial._hash = -this._endMaterial._hash;
}
}
},
@@ -306,6 +309,8 @@ let Mask = cc.Class({
}
this._frontMaterial.updateHash();
this._endMaterial.updateHash();
// Avoid next up mask material to be batch with the exit one
this._endMaterial._hash = -this._endMaterial._hash;
this.markForRender(true);
},
@@ -136,7 +136,7 @@ let maskEndAssembler = {
else {
mask._material = mask._endMaterial;
}
let material = mask.getMaterial();
let material = mask._material;
if (mask._type === Mask.Type.IMAGE_STENCIL) {
let data = mask._renderData;