Hey, I am drawing about 5000 particles. There will probably be 10-20 different types of particles in there, each with different images.
Since switching textures seems to take time, I think the best way is to draw each type 1 particle with the first texture, then each type 2 particle with the next texture, etc until I have drawn all the particles.
I have come up with two different ways to do this, I am wondering which is better? or there is an even better way?
-
have a single list of particles, and loop through it N times where N is the number of different types of particles.
This means if there are 100 particle types I will have to loop through all the particles 100 times when drawing. But adding particles will be fast. -
have a Map<ParticleType, List> but then whenever I add a new particle I have to find out which list it belongs to.
Using the double-arraylist switching method talked about here http://www.java-gaming.org/index.php?topic=27016.0 by theagentd and princec
means that each time I swap the lists I have to reinsert the list back into the hashmap after I swap it (I would use 2 Maps, one for the current and one for the next)
Thanks,
roland