Support item padding in gfx::texture_atlas
This commit is contained in:
parent
a3eca3bef7
commit
aa27b47723
1 changed files with 6 additions and 4 deletions
|
|
@ -10,7 +10,9 @@ namespace psemek::gfx
|
|||
template <typename Pixel, typename Key, typename Compare = std::less<Key>>
|
||||
struct texture_atlas_2d
|
||||
{
|
||||
texture_atlas_2d(Pixel background = Pixel{}, Compare compare = Compare{});
|
||||
using atlas_type = util::atlas<Pixel, 2, Key, Compare>;
|
||||
|
||||
texture_atlas_2d(Pixel background = Pixel{}, std::size_t padding = 0, atlas_type::padding_mode mode = atlas_type::padding_mode::default_value, Compare compare = Compare{});
|
||||
|
||||
using texture_view = texture_view_2d;
|
||||
|
||||
|
|
@ -24,7 +26,7 @@ namespace psemek::gfx
|
|||
std::size_t used_pixels() const { return used_pixels_; }
|
||||
|
||||
private:
|
||||
util::atlas<Pixel, 2, Key, Compare> atlas_;
|
||||
atlas_type atlas_;
|
||||
texture_2d texture_;
|
||||
std::size_t used_pixels_ = 0;
|
||||
|
||||
|
|
@ -34,8 +36,8 @@ namespace psemek::gfx
|
|||
};
|
||||
|
||||
template <typename Pixel, typename Key, typename Compare>
|
||||
texture_atlas_2d<Pixel, Key, Compare>::texture_atlas_2d(Pixel background, Compare compare)
|
||||
: atlas_(std::move(background), std::move(compare))
|
||||
texture_atlas_2d<Pixel, Key, Compare>::texture_atlas_2d(Pixel background, std::size_t padding, atlas_type::padding_mode mode, Compare compare)
|
||||
: atlas_(std::move(background), padding, mode, std::move(compare))
|
||||
{}
|
||||
|
||||
template <typename Pixel, typename Key, typename Compare>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue