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

BatchedMesh: addUpdateRanges #27981

Merged
merged 1 commit into from Mar 24, 2024

Conversation

marwie
Copy link
Contributor

@marwie marwie commented Mar 23, 2024

Related issue: #27980

Description

Currently when a BatchedMesh geometry changes the whole buffer is updated via bufferSubData which causes lags when just a part of the buffer has actually changed.

This PR registers the changed range in the BatchedMesh attributes so only the necessary areas are updated

This contribution is funded by 🌵 Needle

Before the change

20240323-160914_Minimal_-_Google_Chrome-logo.mp4

After the change

20240323-160935_Minimal_-_Google_Chrome-logo.mp4

Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
670.9 kB (166.3 kB) 671 kB (166.3 kB) +59 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
450.9 kB (108.9 kB) 450.9 kB (108.9 kB) +0 B

@gkjohnson
Copy link
Collaborator

I think this is a good change. There's a potential risk of this being slower to update if too many geometries are updated at once but this use case is why I added multiple update ranges initially - it just never made it in to the class.

@gkjohnson gkjohnson added this to the r163 milestone Mar 24, 2024
@Mugen87 Mugen87 merged commit 97aa17d into mrdoob:dev Mar 24, 2024
12 checks passed
marwie added a commit to needle-tools/three.js that referenced this pull request Mar 24, 2024
marwie added a commit to needle-tools/three.js that referenced this pull request Mar 24, 2024
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.

None yet

3 participants