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

Add method to get vertex data as component type #16104

Merged
merged 13 commits into from
Jan 29, 2025

Conversation

alexchuber
Copy link
Contributor

To avoid converting vertex data to floats, as discussed more here #16064 (comment), this introduces a new method with a structure similar to GetFloatData, except the parameter componentType is used to determine an appropriate TypedArray to use, avoiding the copy that would occur with non-float componentType in GetFloatData.

Also gave it (maybe unnecessary) checks for range, and an extra alignment check for ArrayBuffer types (neither of these cases should ever happen).
Lengthy unit tests included.

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 23, 2025

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 24, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 24, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 24, 2025

Copy link
Contributor

@deltakosh deltakosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@bghgary bghgary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I like the positive and negative tests!

packages/dev/core/src/Buffers/bufferUtils.ts Outdated Show resolved Hide resolved
packages/dev/core/src/Buffers/bufferUtils.ts Outdated Show resolved Hide resolved
@bjsplat
Copy link
Collaborator

bjsplat commented Jan 24, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 24, 2025

@alexchuber
Copy link
Contributor Author

alexchuber commented Jan 24, 2025

@deltakosh Do you mind if I update the redundancies in the glTF loader in a separate PR after this?

Did it beforehand instead: #16109

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 24, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 24, 2025

@alexchuber alexchuber marked this pull request as draft January 24, 2025 22:48
@bjsplat
Copy link
Collaborator

bjsplat commented Jan 27, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 27, 2025

@alexchuber alexchuber marked this pull request as ready for review January 28, 2025 20:19
@bjsplat
Copy link
Collaborator

bjsplat commented Jan 28, 2025

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 28, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 28, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 28, 2025

@deltakosh deltakosh merged commit 3d03937 into BabylonJS:master Jan 29, 2025
14 checks passed
@alexchuber alexchuber deleted the get-typed-data branch February 7, 2025 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants