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

SVGLoader: Update vertices according uv.y when linecap is square #27429

Merged
merged 1 commit into from
Dec 24, 2023

Conversation

nieyuyao
Copy link
Contributor

fix #26781

@@ -3082,7 +3082,8 @@ class SVGLoader extends Loader {
} else {

tempV2_3.toArray( vertices, 1 * 3 );
tempV2_3.toArray( vertices, 3 * 3 );
// using tempV2_4 to update 3rd vertex if the uv.y of 3rd vertex is 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

The PR indeed fixes the issue and I don't see any regressions in webgl_loader_svg.

Do you mind explaining the reasoning behind this change though? Why does the code have to make a distinction at this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tempV2_3 and tempV2_4 are the two new vertices after the cap is calculated. They should replace the corresponding old vertices. Updates to tempV2_3 and tempV2_4 are explicit. But there are two cases of updating vertices[3] with tempV2_3 or tempV2_4.

image

uv.y is used to determine whether to use tempV2_3 or tempV2_4.
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be better if there was no need to make a distinction. Maybe there's a better way?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure. If somebody comes up with a uniform approach, we can sill update the code. For now, let's go with the this PR.

@Mugen87 Mugen87 merged commit 93b2923 into mrdoob:dev Dec 24, 2023
11 checks passed
@Mugen87 Mugen87 added this to the r161 milestone Dec 24, 2023
@nieyuyao nieyuyao deleted the fix/svg-path-cap-square branch January 2, 2024 02:27
AdaRoseCannon pushed a commit to AdaRoseCannon/three.js that referenced this pull request Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants