Fix color overwriting issue when sprite frame change (#2857)

* Fix color overwriting issue when sprite frame change

* Fix _localMatDirty type alter issue
This commit is contained in:
pandamicro
2018-06-13 15:00:31 +08:00
committed by GitHub
parent 3c70b2396f
commit 2918403348
3 changed files with 5 additions and 3 deletions
+2 -1
View File
@@ -2942,7 +2942,8 @@ var Node = cc.Class({
this._worldMatrix = mathPools.mat4.get();
}
this._localMatDirty = this._worldMatDirty = true;
this._localMatDirty = LocalDirtyFlag.ALL;
this._worldMatDirty = true;
this._renderFlag |= RenderFlow.FLAG_TRANSFORM;
if (this._renderComponent) {
+1 -1
View File
@@ -107,7 +107,7 @@ let RenderComponent = cc.Class({
},
disableRender () {
this.node._renderFlag &= ~(RenderFlow.FLAG_RENDER | cc.RenderFlow.FLAG_CUSTOM_IA_RENDER | RenderFlow.FLAG_UPDATE_RENDER_DATA | RenderFlow.FLAG_COLOR);
this.node._renderFlag &= ~(RenderFlow.FLAG_RENDER | RenderFlow.FLAG_CUSTOM_IA_RENDER | RenderFlow.FLAG_UPDATE_RENDER_DATA | RenderFlow.FLAG_COLOR);
},
requestRenderData () {
+2 -1
View File
@@ -542,15 +542,16 @@ var Sprite = cc.Class({
if (this._state === State.GRAY) {
if (!this._graySpriteMaterial) {
this._graySpriteMaterial = new GraySpriteMaterial();
this.node._renderFlag |= RenderFlow.FLAG_COLOR;
}
material = this._graySpriteMaterial;
}
else {
if (!this._spriteMaterial) {
this._spriteMaterial = new SpriteMaterial();
this.node._renderFlag |= RenderFlow.FLAG_COLOR;
}
material = this._spriteMaterial;
material.color = this.node.color;
}
// TODO: old texture in material have been released by loader
material.texture = texture;