Hi, I’ve not had time to be super-thorough but I’ve done a quick code review.
Overall, it looks very good I’ve seen commercial java projects with waaaaaay worse code.
A correct package needs to be defined obviously, I’m guessing the current one is a placeholder.
Emitter.java
addInfluencer javadoc - “ParticleData Influencer” should be “ParticleInfluencer”.
getInfleuncer - no javadoc
Remove the mapping influencers, you don’t need it - just remove the second s from influencerss and use that. To implement getInfluencer(Class x) just do a for loop over the list and return the first match.
In reality this will be faster than using the hash map even though its less “correct” as the overheads of maintaining the map will be higher than for the arraylist and you are only dealing with small numbers of influencers.
All Influencers, same two points: should have a constructor that sets the params (i.e. start/end colour etc).
rather than update always doing if (enabled) the thing calling update should call isEnabled and only call update if it is.
ImpulseInfluencer setChance/getChance javadoc says “successfully affecting”. That’s a bit confusing, I think you can lose the successfully bit.
PreferredDestinationInfluencer - what happens if I want to influence particles towards 0? Would be better to have preferred as null to do nothing, all other values mean their usual.
PreferredDestinationInfluencer, PreferredDirectionInfluencer - you seem to have got fed up with writing javadoc by the time you got to these ones
RotationInfluencer -why do you have both a boolean to store direction and a float (inside a v3f) to store speed for angular velocity? Just use the float and if it goes negative that’s the reverse direction.
i.e. in the p.rotationSpeed.set use: FastMath.nextRandomFloat()speedFactor.x2 - speedFactor.x
and then ditch all the booleans and checks for them.
SpriteInfluencer - Rather than storing interval/duration/etc as mappings in the particle you can ditch the mapping and just store in all particles a float spawnTime and in the particle mesh a float meshTime. When new particles are spawned set their spawn time = to mesh time. Each update meshTime += tpf. The SpriteInfluencer update can then just look at ((meshTime - spawnTime) / fixedDuration and calculate the sprite from that. Even if you don’t make that (larger) change all of the strings used as keys should be defined in static final String FRAME_INTERVAL_KEY = “frameInterval” rather than repeated scattered through the file. I’d also recommend calling them SpriteInfluencer.FrameInterval to set a pattern that will avoid name collisions in future. This will remove all need for the Map data = new HashMap();
ParticleData.java
Consider removing data if not needed. At the very least lazy initialize it rather than creating a mapping for every single particle data whether it needs it or not.
Remove the booleans for rotation direction and just use negative velocity.
initialize() does not call data.clear()
ParticleData(X)Mesh.java
These all seem to be lacking javadoc and its not clear at a glance what they are for/how to use them/etc.
Where is the code that does the billboarding? I didn’t see it here on my look through.