diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index fc7a6476aa3..728275b4530 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -367,7 +367,7 @@ void Sprite3D::_draw() { }; - Vector2 src_tsize = Vector2(texture->get_width(), texture->get_height()); + Vector2 src_tsize = tsize; // Properly setup UVs for impostor textures (AtlasTexture). Ref atlas_tex = texture; @@ -377,10 +377,10 @@ void Sprite3D::_draw() { } Vector2 uvs[4] = { - final_src_rect.position / tsize, - (final_src_rect.position + Vector2(final_src_rect.size.x, 0)) / tsize, - (final_src_rect.position + final_src_rect.size) / tsize, - (final_src_rect.position + Vector2(0, final_src_rect.size.y)) / tsize, + final_src_rect.position / src_tsize, + (final_src_rect.position + Vector2(final_src_rect.size.x, 0)) / src_tsize, + (final_src_rect.position + final_src_rect.size) / src_tsize, + (final_src_rect.position + Vector2(0, final_src_rect.size.y)) / src_tsize, }; if (is_flipped_h()) { @@ -667,7 +667,7 @@ void AnimatedSprite3D::_draw() { }; - Vector2 src_tsize = Vector2(texture->get_width(), texture->get_height()); + Vector2 src_tsize = tsize; // Properly setup UVs for impostor textures (AtlasTexture). Ref atlas_tex = texture; @@ -677,10 +677,10 @@ void AnimatedSprite3D::_draw() { } Vector2 uvs[4] = { - final_src_rect.position / tsize, - (final_src_rect.position + Vector2(final_src_rect.size.x, 0)) / tsize, - (final_src_rect.position + final_src_rect.size) / tsize, - (final_src_rect.position + Vector2(0, final_src_rect.size.y)) / tsize, + final_src_rect.position / src_tsize, + (final_src_rect.position + Vector2(final_src_rect.size.x, 0)) / src_tsize, + (final_src_rect.position + final_src_rect.size) / src_tsize, + (final_src_rect.position + Vector2(0, final_src_rect.size.y)) / src_tsize, }; if (is_flipped_h()) {