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

fix: BufferGeometry rename uv2 to uv1 #377

Merged
merged 2 commits into from
Aug 5, 2024

Conversation

RodrigoHamuy
Copy link
Contributor

@RodrigoHamuy RodrigoHamuy commented Aug 5, 2024

Copy link

codesandbox-ci bot commented Aug 5, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@CodyJasonBennett
Copy link
Member

We'll need to perform some indirection here for the key to preserve backward compatibility. Had a tough time maintaining this with the back-to-back renames between versions.

const ATTRIBUTES = {
POSITION: 'position',
NORMAL: 'normal',
TANGENT: 'tangent',
// uv => uv1, 4 uv channels
// https://github.com/mrdoob/three.js/pull/25943
// https://github.com/mrdoob/three.js/pull/25788
...(version >= 152
? {
TEXCOORD_0: 'uv',
TEXCOORD_1: 'uv1',
TEXCOORD_2: 'uv2',
TEXCOORD_3: 'uv3',
}
: {
TEXCOORD_0: 'uv',
TEXCOORD_1: 'uv2',
}),

@RodrigoHamuy
Copy link
Contributor Author

RodrigoHamuy commented Aug 5, 2024

@CodyJasonBennett I think is not a terrible idea to ask users to update to a newer ThreeJS version that is more than a year old anyway in exchange of cleaner code.

But if you disagree, will update the files to follow the same strategy as GLTFLoader.js for backward compatiliby.

@CodyJasonBennett
Copy link
Member

The goal of this project is to make itself obsolete by fostering improvements to three examples, and upstreaming them, but we have the additional constraint of adhering to SemVer (which I personally think is an oversight) which means we have to employ tricks to maintain compatibility.

Requiring an upgrade to three.js is a breaking change (major version increment), and I think we can try to maintain an indirection table until that becomes infeasible. The need for an upgrade to three.js is a larger conversation than the changes in this PR alone, as we support as low as r128 with many breaking changes to public API and types since.

@CodyJasonBennett
Copy link
Member

I can do this myself in a few hours, when I can take a closer look.

@RodrigoHamuy
Copy link
Contributor Author

I can do this myself in a few hours, when I can take a closer look.

No worries, makes sense, will push in a few minutes.

@RodrigoHamuy
Copy link
Contributor Author

@CodyJasonBennett backward compatibility added ☺️

@CodyJasonBennett
Copy link
Member

Thanks; I appreciate the thoroughness. Elevating to a fix so we can get this out.

@CodyJasonBennett CodyJasonBennett changed the title chore: BufferGeometry rename uv2 to uv1 fix: BufferGeometry rename uv2 to uv1 Aug 5, 2024
@CodyJasonBennett CodyJasonBennett merged commit 442de29 into pmndrs:main Aug 5, 2024
3 checks passed
Copy link

github-actions bot commented Aug 5, 2024

🎉 This PR is included in version 2.32.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants