OK... been working on this for about a week(in between other crap and RL) now. Normally wouldn't show this code this rough, etc., but what the hell, this is actually pretty cool.
Basically, this is a prototype of a new particle system I'm working on.
Thought I'd share the early WIP code for this, as maybe other people will join in, help out. That, and this is an open project where I want to make sure that people can understand my sourcecode, because I have a feeling that this will be worthwhile when it's done.
How does it work?
It uses the GPU to do everything, other than iterate through the list of named textures and particle properties. It iterates by texture, because, ironically, gl.Texture callouts are the most expensive by far- that may be an area of the engine that needs some optimization, or maybe it's just plain expensive, IDK enough about Deep OpenGL to know for sure.
All animations are vertex-based, on the GPU, using the timer to determine distance moved, so there are no absolute guarantees that motion will precisely match gamestate, but it should be reasonably close. The goal is to keep all systems in two mat4s (one for ColorMap emulation) for fast transfer. That may be hard to achieve, but I'd like to try.
All particles are independent agents. You can create a single system or 100 or mix them up or throw a lot of randomness in, or even write some custom algorithm that will do funky stuff (that may be a good use for that last matrix position, come to think).
It's not like CEG, where you have a given spawner with a min/max cap, it's pretty much what you want, when you want it.
CPU loading will rise concurrently, of course, but it's almost totally linear. The cool part about that is that you can handle load-balancing however you want. I haven't structured this for that yet, except a really crude example of time-based culling, but basically you're free to implement that how you want. I'm planning for the "stock" version to cull the oldest first, if we're going to exceed the cap, so that new effects play, and we're most likely culling stuff that's nearly done anyhow. May need to add a test for time left, etc., to keep stuff that's supposed to stick around.
It culls for AirLOS. It's going to have the same problems that everything using LOS does- it's checking a sector's state, and I only check the LOS of the starting points. I don't think it's possible to track the current points without eating a lot of CPU, so I'm probably not going to bother.
Anyhow, that's a lot of verbiage, for a relatively short piece of code, heh. I just wanted to make certain things understood, since it looks so simplistic at first. It's Not Done Yet, but I accidently created a really cool goof while playing around with the rudiments of physics logic, thought I'd share it, maybe somebody can find a use for it...