Closed GoogleCodeExporter closed 8 years ago
The particle engine underwent a recent update which was an optimization of
sorts. For every particle, the engine was pushing the transformation onto the
stack, drawing, and then popping the transform. This was using all sorts of
unnecessary stack operations to render particles in object coordinates, when
rendering them in world coordinates would have been fine.
If you look at the file "particle.js" in the "/spaceroids" folder, you'll
notice that the two particle types (SimpleParticle and TrailParticle) were
updated, slightly, to account for this optimization:
~lines 108 & 171:
Used to look like:
renderContext.drawPoint(Point2D.ZERO);
Now look like:
renderContext.drawPoint(this.pos);
We're rendering the particles at their position in world coordinates rather
than object coordinates. The old way was done by pushing the transformation
onto the stack, shifting the transformation, drawing, then popping the
transformation. The new way pushes the world transformation, renders all
particles in world coordinates, the pops the transformation. This is much more
efficient.
I decided to make this change, now, rather than waiting until the next version
of the engine since it would end up affecting potentially more people that way.
Anyway, you'll just need to update your particle classes to render at their
position, instead of "Point2D.ZERO". That should fix your particle drawing
issues.
Original comment by bfatt...@gmail.com
on 26 Jul 2010 at 1:29
Great. Thanks. One more change that was required to make it work was removing
the call to
renderContext.setPosition(this.pos);
from the draw method of Particle in particle.js
Thanks again.
Original comment by maryrose...@gmail.com
on 27 Jul 2010 at 7:27
Original issue reported on code.google.com by
maryrose...@gmail.com
on 25 Jul 2010 at 5:56