diff --git a/src/framework/components/particle-system/component.js b/src/framework/components/particle-system/component.js index a6c9b8c46b2..307e62c22a5 100644 --- a/src/framework/components/particle-system/component.js +++ b/src/framework/components/particle-system/component.js @@ -486,6 +486,7 @@ pc.extend(pc, function() { if (!this.data.autoPlay) { this.pause(); + this.emitter.meshInstance.visible = false; } } @@ -561,6 +562,7 @@ pc.extend(pc, function() { play: function() { this.data.paused = false; if (this.emitter) { + this.emitter.meshInstance.visible = true; this.emitter.loop = this.data.loop; this.emitter.resetTime(); } diff --git a/src/framework/components/particle-system/system.js b/src/framework/components/particle-system/system.js index d157c5214ea..6b28791c284 100644 --- a/src/framework/components/particle-system/system.js +++ b/src/framework/components/particle-system/system.js @@ -165,6 +165,7 @@ pc.extend(pc, function() { if (data.enabled && entity.enabled) { var emitter = data.model.emitter; + if (!emitter.meshInstance.visible) continue; if (!data.paused) { diff --git a/src/scene/forward-renderer.js b/src/scene/forward-renderer.js index 81a6aa3ba61..ca704173679 100644 --- a/src/scene/forward-renderer.js +++ b/src/scene/forward-renderer.js @@ -966,7 +966,7 @@ pc.extend(pc, function () { visible = true; meshPos = null; if (!drawCall.command) { - if (!drawCall.visible) continue; // use hidden property to quickly hide/show meshInstances + if (!drawCall.visible) continue; // use visible property to quickly hide/show meshInstances meshInstance = drawCall; // Only alpha sort and cull mesh instances in the main world diff --git a/src/scene/particle-emitter.js b/src/scene/particle-emitter.js index 6149025f234..5caecab21e9 100644 --- a/src/scene/particle-emitter.js +++ b/src/scene/particle-emitter.js @@ -52,28 +52,6 @@ pc.extend(pc, function() { return x - y * Math.floor(x / y); } - function tex1D(arr, u, chans, outArr, test) { - var a, b, c; - - if ((chans === undefined) || (chans < 2)) { - u *= arr.length - 1; - a = arr[Math.floor(u)]; - b = arr[Math.ceil(u)]; - c = u % 1; - return a + (b - a) * c;//pc.math.lerp(a, b, c); - } - - u *= arr.length / chans - 1; - if (!outArr) outArr = []; - for (var i = 0; i < chans; i++) { - a = arr[Math.floor(u) * chans + i]; - b = arr[Math.ceil(u) * chans + i]; - c = u % 1; - outArr[i] = a + (b - a) * c;//pc.math.lerp(a, b, c); - } - return outArr; - } - var default0Curve = new pc.Curve([0, 0, 1, 0]); var default1Curve = new pc.Curve([0, 1, 1, 1]); var default0Curve3 = new pc.CurveSet([0, 0, 1, 0], [0, 0, 1, 0], [0, 0, 1, 0]); @@ -1538,10 +1516,9 @@ pc.extend(pc, function() { } if (!this.loop) { - if (this.onFinished) { - if (Date.now() > this.endTime) { - this.onFinished(); - } + if (Date.now() > this.endTime) { + if (this.onFinished) this.onFinished(); + this.meshInstance.visible = false; } }