summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-10-05 11:22:17 +0200
committerGitHub <noreply@github.com>2021-10-05 11:22:17 +0200
commitc773c709c0b69336d5ae922cd7215f3ea1414be9 (patch)
tree6e0864255af93bc775d58ded8fae9dc18caa311c /scene/3d
parent2ac320681ab6ba3067d5358843d4d82d3e86f4a8 (diff)
parentb266b59e56ff17cd5dd62587e4ad781ba9602fa4 (diff)
Merge pull request #53051 from kleonc/animated-sprites-centered-rendering
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/sprite_3d.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index b9a2736918..349a534680 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -712,7 +712,7 @@ Rect2 Sprite3D::get_item_rect() const {
return CanvasItem::get_item_rect();
*/
- Size2i s;
+ Size2 s;
if (region) {
s = region_rect.size;
@@ -807,22 +807,20 @@ void AnimatedSprite3D::_draw() {
set_base(RID());
return; //no texuture no life
}
- Vector2 tsize = texture->get_size();
+ Size2 tsize = texture->get_size();
if (tsize.x == 0 || tsize.y == 0) {
return;
}
- Size2i s = tsize;
Rect2 src_rect;
-
- src_rect.size = s;
+ src_rect.size = tsize;
Point2 ofs = get_offset();
if (is_centered()) {
- ofs -= s / 2;
+ ofs -= tsize / 2;
}
- Rect2 dst_rect(ofs, s);
+ Rect2 dst_rect(ofs, tsize);
Rect2 final_rect;
Rect2 final_src_rect;
@@ -1133,7 +1131,7 @@ Rect2 AnimatedSprite3D::get_item_rect() const {
if (t.is_null()) {
return Rect2(0, 0, 1, 1);
}
- Size2i s = t->get_size();
+ Size2 s = t->get_size();
Point2 ofs = get_offset();
if (centered) {