No need to multiply the camMatrix for every particle. Once is enough.

This commit is contained in:
Richard Davey 2023-01-19 16:59:33 +00:00
parent b25337b4e8
commit 8815205900

View file

@ -75,8 +75,9 @@ var ParticleEmitterWebGLRenderer = function (renderer, emitter, camera, parentMa
camera.addToRenderList(emitter);
var scrollFactorX = emitter.scrollFactorX;
var scrollFactorY = emitter.scrollFactorY;
camMatrix.copyFrom(camera.matrix);
camMatrix.multiplyWithOffset(managerMatrix, -camera.scrollX * emitter.scrollFactorX, -camera.scrollY * emitter.scrollFactorY);
renderer.setBlendMode(emitter.blendMode);
@ -102,10 +103,6 @@ var ParticleEmitterWebGLRenderer = function (renderer, emitter, camera, parentMa
particleMatrix.applyITRS(particle.x, particle.y, particle.rotation, particle.scaleX, particle.scaleY);
camMatrix.copyFrom(camera.matrix);
camMatrix.multiplyWithOffset(managerMatrix, -camera.scrollX * scrollFactorX, -camera.scrollY * scrollFactorY);
// Undo the camera scroll
particleMatrix.e = particle.x;
particleMatrix.f = particle.y;