Skip to content

Commit 04bf7d4

Browse files
committed
Merge pull request godotengine#93467 from anniryynanen/progress-circle-atlas
Fix atlas texture positioning in circular TextureProgressBar
2 parents ded2a4a + 2c5befd commit 04bf7d4

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

scene/gui/texture_progress_bar.cpp

-18
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "texture_progress_bar.h"
3232

3333
#include "core/config/engine.h"
34-
#include "scene/resources/atlas_texture.h"
3534

3635
void TextureProgressBar::set_under_texture(const Ref<Texture2D> &p_texture) {
3736
_set_texture(&under, p_texture);
@@ -513,15 +512,6 @@ void TextureProgressBar::_notification(int p_what) {
513512
}
514513
pts.push_back(to);
515514

516-
Ref<AtlasTexture> atlas_progress = progress;
517-
bool valid_atlas_progress = atlas_progress.is_valid() && atlas_progress->get_atlas().is_valid();
518-
Rect2 region_rect;
519-
Size2 atlas_size;
520-
if (valid_atlas_progress) {
521-
region_rect = atlas_progress->get_region();
522-
atlas_size = atlas_progress->get_atlas()->get_size();
523-
}
524-
525515
Vector<Point2> uvs;
526516
Vector<Point2> points;
527517
for (const float &f : pts) {
@@ -530,21 +520,13 @@ void TextureProgressBar::_notification(int p_what) {
530520
continue;
531521
}
532522
points.push_back(progress_offset + Point2(uv.x * s.x, uv.y * s.y));
533-
if (valid_atlas_progress) {
534-
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);
535-
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);
536-
}
537523
uvs.push_back(uv);
538524
}
539525

540526
// Filter out an edge case where almost equal `from`, `to` were mapped to the same UV.
541527
if (points.size() >= 2) {
542528
Point2 center_point = get_relative_center();
543529
points.push_back(progress_offset + s * center_point);
544-
if (valid_atlas_progress) {
545-
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);
546-
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);
547-
}
548530
uvs.push_back(center_point);
549531

550532
Vector<Color> colors;

0 commit comments

Comments
 (0)