mirror of
https://github.com/Relintai/texture_packer.git
synced 2025-01-29 15:49:21 +01:00
Now the initial width and height of the main texture will be set properly even if the first added texture is an AtlasTexture.
This commit is contained in:
parent
e865e55db0
commit
0dd28a6525
@ -67,11 +67,26 @@ void TextureLayerMerger::add_texture(Ref<Texture> p_texture, Color p_color, Vect
|
|||||||
|
|
||||||
entry.rect = p_rect;
|
entry.rect = p_rect;
|
||||||
|
|
||||||
if (_width == 0)
|
if (_width == 0 || _height == 0) {
|
||||||
_width = p_texture->get_width();
|
Ref<AtlasTexture> at = p_texture;
|
||||||
|
|
||||||
if (_height == 0)
|
int w = 0;
|
||||||
_height = p_texture->get_height();
|
int h = 0;
|
||||||
|
|
||||||
|
if (at.is_valid()) {
|
||||||
|
w = at->get_region().size.x;
|
||||||
|
h = at->get_region().size.y;
|
||||||
|
} else {
|
||||||
|
w = p_texture->get_width();
|
||||||
|
h = p_texture->get_height();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_width == 0)
|
||||||
|
_width = w;
|
||||||
|
|
||||||
|
if (_height == 0)
|
||||||
|
_height = h;
|
||||||
|
}
|
||||||
|
|
||||||
_entries.push_back(entry);
|
_entries.push_back(entry);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user