Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scope for code optimization #62

Open
mghildiy opened this issue Apr 25, 2018 · 1 comment
Open

Scope for code optimization #62

mghildiy opened this issue Apr 25, 2018 · 1 comment

Comments

@mghildiy
Copy link

mghildiy commented Apr 25, 2018

Hi,

In render.js:

Inside for loop in ParticleSystemBatcher.prototype.push

var x = p.position[0] * lasBuffer.scale[0] + lasBuffer.offset[0];
Later on:
positions[ 3*i ] = p.position[0] * lasBuffer.scale[0] + (lasBuffer.offset[0] - this.corrective.x);
This is same as:
positions[ 3*i ] = x - this.corrective.x

Similar for y and z coordinates.

With huge number of points, avoiding this recomputation may help in improving the performance.

PS:If permitted, I can commit this change.

@verma
Copy link
Owner

verma commented Apr 25, 2018

Please submit a PR and we can take it from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants