Feature Request: layering
Home › Forums › TimelineFX Module › Feature Request: layering
- This topic has 10 replies, 2 voices, and was last updated 13 years, 11 months ago by
wiebow.
-
AuthorPosts
-
October 5, 2010 at 3:30 pm #3190
wiebowParticipantI would like to see z-order layering implemented in the particlemanager. Creating a particlemanager to be able to control in which order particles are drawn is not very practical.
For instance: in my game, I have a player, enemies, bullets, explosions, and a big shield. For each of these, I have to create a particleManager which I all need to update and render so I can control the order of the particles rendering. This comes very precise and I am dependant on additive effect. Also, I am being made dependant on the order in which I do my render calls. If I change the order, for what ever reason, I will have a problem with my particles rendering order.
Adding a z-order index to the particleManager would solve this all.
tlParticleManager.AddEffect(myEffect, 1) would add the effect to layer 1.
tlParticleManager.Render(1) would render all particles in layer 1.It will make complex particle systems much easier to maintain and render.
EDIT: I Realize this should’ve been in the module forum 🙂
October 5, 2010 at 7:06 pm #3749
imported_peterigzParticipanthmm, I’m just thinking about the feasibility of implementing something like this 🙂
Before I go too far, what is the disadvantage of using an array of managers, so it’d be:
tlParticleManager[1].AddEffect(myEffect) would add the effect to layer 1.
tlParticleManager[1].Render() would render all particles in layer 1.I guess if the particle manager handles it internally you won’t have so many particle pools, as the effects on different layers will pull from the same pool. I don’t foresee too many problems implementing this though.
October 5, 2010 at 7:52 pm #3750
imported_peterigzParticipantWell I had a play around and I implemented it, you can try it out if you update from svn. It should work as you outlined, so let me know 🙂 as you said use:
CreateParticleManager(Particles, Layers) -Defaults to 1 layer
Addeffect(Effect, Layer) -defaults to layer 0
DrawParticles(Tween, Layer) -Defaults to -1 which draws all layers.Not tested heavily tested though so see how it goes.
October 5, 2010 at 8:30 pm #3751
wiebowParticipantNice! I will try tomorrow. 🙂
October 6, 2010 at 6:43 am #3753
wiebowParticipant@peterigz wrote:
hmm, I’m just thinking about the feasibility of implementing something like this 🙂
Before I go too far, what is the disadvantage of using an array of managers, so it’d be:
tlParticleManager[1].AddEffect(myEffect) would add the effect to layer 1.
tlParticleManager[1].Render() would render all particles in layer 1.I guess if the particle manager handles it internally you won’t have so many particle pools, as the effects on different layers will pull from the same pool. I don’t foresee too many problems implementing this though.
Your idea of using arrays would work as well. Using one pool won’t be much of a problem, I guess, as the default of max 5000 particles is quite large. Still, having render layers will simplify implementation and having one particle manager seems to be the right way to go about things…
I am going to try your new version now. I will post how things went.
October 6, 2010 at 8:08 am #3756
wiebowParticipantThis works! Thanks very much. This greatly simplifies update and render loops (well, for me anyway 😆 )
One more request: Can you extend ClearAll() or add a ClearLayer() method so it is possible to clear a single layer?
October 6, 2010 at 9:25 am #3757
wiebowParticipantThere is something wrong. I get a null value error using tlParticleManager.ClearAll()
It crashes in this method:
Method ReleaseParticle(p:tlParticle)
unusedcount:+1
inusecount:-1
unused.AddLast p
If Not p.groupparticles
InUse[p.emitter.parentEffect.effectlayer, p.layer].Remove p
End If
End Methodon this line: InUse[p.emitter.parentEffect.effectlayer, p.layer].Remove p
October 6, 2010 at 12:27 pm #3759
imported_peterigzParticipantNo problem.
I thought they’d be some things I’d miss :). I’ll fix that and add a new “ClearLayer” method when I get home tonight.
October 6, 2010 at 12:34 pm #3760
wiebowParticipantThanks Peter, looking forward to that.
October 6, 2010 at 5:10 pm #3761
imported_peterigzParticipantFixed the bug in ClearAll and added new method ClearLayer. SVN is updated. Let me know if there’s any problems 🙂
October 7, 2010 at 9:01 am #3762
wiebowParticipantThis all seems to working all right now! Thanks a bunch.
-
AuthorPosts
You must be logged in to reply to this topic.