mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
Fix ParticleSystem render state and material issue (#2764)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user