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

Texture Progress Bar does not render the progress texture correctly when using an Atlas Texture in clockwise and counter clockwise fill modes #93462

Closed
peter-rocchio opened this issue Jun 22, 2024 · 2 comments · Fixed by #93467

Comments

@peter-rocchio
Copy link

Tested versions

  • Reproducible in: v4.3.beta2.official [b75f048] and earlier betas
  • Not Reproducible in: v4.2.2.stable.official [15073af] and earlier 4.2

System information

Windows 11 - Forward +

Issue description

Texture Progress Bar does not render the progress texture correctly when using an Atlas Texture in clockwise and counter-clockwise fill modes.
image

Steps to reproduce

  1. Create a TextureProgress Node
  2. Set fill mode to clockwise or counter clockwise
  3. Create a texture atlas
  4. Add the texture atlas to under and progress textures and set a region smaller than the texture
  5. Observe the under texture renders correctly
  6. Change the value to between the min-max
  7. Observe the progress texture does not render correctly

Minimal reproduction project (MRP)

texture_progress_bug.zip

@anniryynanen
Copy link
Contributor

anniryynanen commented Jun 22, 2024

Looks straightforward and I can reproduce this, I'll try to fix it.

@kleonc
Copy link
Member

kleonc commented Jun 22, 2024

That's a regression from #91724, the uvs are remapped twice now for TextureProgressBar as its own remapping was not removed in that PR.

Vector<Point2> uvs;
Vector<Point2> points;
for (const float &f : pts) {
Point2 uv = unit_val_to_uv(f);
if (uvs.has(uv)) {
continue;
}
points.push_back(progress_offset + Point2(uv.x * s.x, uv.y * s.y));
if (valid_atlas_progress) {
uv.x = Math::remap(uv.x, 0, 1, region_rect.position.x / atlas_size.x, (region_rect.position.x + region_rect.size.x) / atlas_size.x);
uv.y = Math::remap(uv.y, 0, 1, region_rect.position.y / atlas_size.y, (region_rect.position.y + region_rect.size.y) / atlas_size.y);
}
uvs.push_back(uv);
}
// Filter out an edge case where almost equal `from`, `to` were mapped to the same UV.
if (points.size() >= 2) {
Point2 center_point = get_relative_center();
points.push_back(progress_offset + s * center_point);
if (valid_atlas_progress) {
center_point.x = Math::remap(center_point.x, 0, 1, region_rect.position.x / atlas_size.x, (region_rect.position.x + region_rect.size.x) / atlas_size.x);
center_point.y = Math::remap(center_point.y, 0, 1, region_rect.position.y / atlas_size.y, (region_rect.position.y + region_rect.size.y) / atlas_size.y);
}
uvs.push_back(center_point);
Vector<Color> colors;
colors.push_back(tint_progress);
draw_polygon(points, colors, uvs, progress);
}

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

Successfully merging a pull request may close this issue.

4 participants