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

CSM: Remove array allocation in getBreaks, getExtendedBreaks #18735

Merged
merged 2 commits into from
Feb 27, 2020

Conversation

gkjohnson
Copy link
Collaborator

@gkjohnson gkjohnson commented Feb 26, 2020

Follow up to #18724.

Modifies the getBreaks function and getExtendedBreaks function to reuse existing arrays rather than creating new ones every call to prevent garbage collection.

This also implies a small API change to customSplitsCallback, which now needs to modify an existing array in target rather than return a new one:

customSplitsCallback(
   cascades: Number,
   near: Number,
   far: Number,
   target: Array<Number>
): void

Temporary Live Link:
https://raw.githack.com/gkjohnson/three.js/csm-breaks-cache-arrays/examples/webgl_shadowmap_csm.html

@vhawk

Edit: Looks like the CI failure is from css3d_youtube diff again

ERROR! Diff wrong in 0.254 of pixels in file: css3d_youtube

@mrdoob mrdoob added this to the r114 milestone Feb 27, 2020
@mrdoob mrdoob merged commit 2324c89 into mrdoob:dev Feb 27, 2020
@mrdoob
Copy link
Owner

mrdoob commented Feb 27, 2020

Thanks!

@gkjohnson gkjohnson deleted the csm-breaks-cache-arrays branch February 27, 2020 06:01
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

Successfully merging this pull request may close these issues.

2 participants