mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
Fix Mask reenable render issue (#2834)
* Improve hash calculation in Mask * Fix Mask reenable render issue
This commit is contained in:
@@ -177,10 +177,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;
|
||||
this._frontMaterial.updateHash();
|
||||
this._endMaterial._hash = -this._frontMaterial._hash;
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -308,9 +307,8 @@ let Mask = cc.Class({
|
||||
this._endMaterial.useColor = false;
|
||||
}
|
||||
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._endMaterial._hash = -this._frontMaterial._hash;
|
||||
this.markForRender(true);
|
||||
},
|
||||
|
||||
@@ -353,7 +351,8 @@ let Mask = cc.Class({
|
||||
|
||||
markForRender (enable) {
|
||||
if (enable && this.enabledInHierarchy) {
|
||||
this.node._renderFlag |= RenderFlow.FLAG_RENDER | RenderFlow.FLAG_POST_RENDER;
|
||||
this.node._renderFlag |= (RenderFlow.FLAG_RENDER | RenderFlow.FLAG_UPDATE_RENDER_DATA |
|
||||
RenderFlow.FLAG_POST_RENDER | RenderFlow.FLAG_POST_UPDATE_RENDER_DATA);
|
||||
}
|
||||
else if (!enable) {
|
||||
this.node._renderFlag &= ~(RenderFlow.FLAG_RENDER | RenderFlow.FLAG_POST_RENDER);
|
||||
|
||||
Reference in New Issue
Block a user