diff --git a/cocos2d/core/components/CCMask.js b/cocos2d/core/components/CCMask.js index f1cca27a06..f7e2d9ddd1 100644 --- a/cocos2d/core/components/CCMask.js +++ b/cocos2d/core/components/CCMask.js @@ -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);