Fix ParticleSystem render state and material issue (#2764)

This commit is contained in:
pandamicro
2018-05-29 22:50:24 +08:00
committed by GitHub
parent 7bad7ba04d
commit c08497ccfd
3 changed files with 10 additions and 11 deletions
+3 -3
View File
@@ -74,7 +74,7 @@ let RenderComponent = cc.Class({
},
markForUpdateRenderData (enable) {
if (enable && this.enabledInHierarchy) {
if (enable && this._enabled) {
this.node._renderFlag |= RenderFlow.FLAG_UPDATE_RENDER_DATA;
}
else if (!enable) {
@@ -83,7 +83,7 @@ let RenderComponent = cc.Class({
},
markForRender (enable) {
if (enable && this.enabledInHierarchy) {
if (enable && this._enabled) {
this.node._renderFlag |= RenderFlow.FLAG_RENDER;
}
else if (!enable) {
@@ -92,7 +92,7 @@ let RenderComponent = cc.Class({
},
markForCustomIARender (enable) {
if (enable && this.enabledInHierarchy) {
if (enable && this._enabled) {
this.node._renderFlag |= RenderFlow.FLAG_CUSTOM_IA_RENDER;
}
else if (!enable) {
+6 -7
View File
@@ -804,8 +804,6 @@ var ParticleSystem = cc.Class({
this._focused = true;
if (this.preview) {
this.resetSystem();
this.markForUpdateRenderData(true);
this.markForCustomIARender(true);
var self = this;
this._previewTimer = setInterval(function () {
@@ -919,7 +917,12 @@ var ParticleSystem = cc.Class({
resetSystem: function () {
this._stopped = false;
this._simulator.reset();
this.markForCustomIARender(true);
if (!this._material) {
this._updateMaterial();
}
else {
this.markForCustomIARender(true);
}
},
/**
@@ -1162,10 +1165,6 @@ var ParticleSystem = cc.Class({
},
_updateMaterial: function () {
if (!this.enabledInHierarchy) {
this.disableRender();
return;
}
// cannot be activated if texture not loaded yet
if (!this._texture || !this._texture.loaded) {
this.markForCustomIARender(false);
@@ -52,9 +52,9 @@ var particleSystemAssembler = {
updateRenderData (comp) {
if (!comp._renderData) {
comp._renderData = new renderEngine.IARenderData();
comp._renderData.material = comp._material;
comp._renderData.ia = comp._ia;
}
comp._renderData.material = comp._material;
},
renderIA (comp, renderer) {