fix(fill-style): correct pattern orientation by flipping texture y-axis (Fixes #10548) - #10550
fix(fill-style): correct pattern orientation by flipping texture y-axis (Fixes #10548)#10550waterWang wants to merge 2 commits into
Conversation
|
Thanks. Please include unit tests and a screenshot from the website example to validate this addresses the issue. |
|
Hey @Pessimistress, this is a breaking change so my recommendation is approving but waiting for v10. Wdyt? #10548 seems valid |
|
@chrisgervang I think it's acceptable to make a breaking change if it's correcting wrong behavior. @waterWang have you tested OrthographicView with |
|
Please add a note to docs/upgrade-guide.md |
Greptile SummaryThis PR corrects vertically mirrored FillStyleExtension patterns by reversing the pattern-space y coordinate before sampling the texture atlas.
Confidence Score: 5/5The PR appears safe to merge, with no concrete functional, security, or repository-rule issues identified. The atlas uses top-origin frame coordinates, and neither bounds generation nor texture upload performs a y-axis inversion, so applying the flip at sampling time consistently corrects the rendered pattern orientation.
|
| Filename | Overview |
|---|---|
| modules/extensions/src/fill-style/shader-module.ts | Correctly flips the pattern-local y coordinate during atlas sampling, with no conflicting flip elsewhere in the established texture path. |
Reviews (1): Last reviewed commit: "Merge branch 'master' into fix/fill-styl..." | Re-trigger Greptile
Fix pattern orientation in FillStyleExtension
Problem
FillStyleExtension renders patterns flipped vertically (top-to-bottom) compared to the original asset. A line pattern going from bottom-left to top-right (
/) appears as bottom-right to top-left (\).Root cause
The texture coordinate system has y=0 at the bottom (OpenGL convention), but the geometry coordinates have y increasing upward. When computing
texCoordsfrompatternUV(which is derived from geometry coordinates), the y-axis was not flipped, causing the pattern to appear inverted.Fix
Flip the y-axis of
patternUVwhen computing texture coordinates:```glsl
// Before
vec2 texCoords = fill_patternBounds.xy + fill_patternBounds.zw * patternUV;
// After
vec2 texCoords = fill_patternBounds.xy + fill_patternBounds.zw * vec2(patternUV.x, 1.0 - patternUV.y);
```
Breaking change
This fix changes the visual output of FillStyleExtension for all users who rely on the current (incorrect) pattern orientation. The issue author noted this is a breaking change, but the fix aligns the rendering with the principle of least surprise — patterns should render in the same orientation as the original asset.
Closes #10548