summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-09-14 15:02:23 +0200
committerGitHub <noreply@github.com>2018-09-14 15:02:23 +0200
commitc52a3646f1055f30b11b0c3fe5d2233a693bd498 (patch)
treef6555e8ed3ff3b7188b3a2a79f163e5690ccf24a
parentebc07ad5a2ae771497db28082600729859694f28 (diff)
parentc522fe05e043057c2232afb6a3385fbc2dd39933 (diff)
Merge pull request #21502 from Web-eWorks/atlasfixes
AtlasTexture fixes, part 2.
-rw-r--r--scene/3d/sprite_3d.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index 36c0dfc18a..774ee49af2 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -431,7 +431,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<AtlasTexture> atlas_tex = texture;
@@ -441,10 +441,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()) {
@@ -731,7 +731,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<AtlasTexture> atlas_tex = texture;
@@ -741,10 +741,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()) {