Add gfx::texture_atlas_2d::used_pixels()
This commit is contained in:
parent
c5ca7a3c4f
commit
8d41e7fcd9
1 changed files with 5 additions and 0 deletions
|
|
@ -21,9 +21,12 @@ namespace psemek::gfx
|
||||||
texture_view find(Key const & key) const;
|
texture_view find(Key const & key) const;
|
||||||
texture_view at(Key const & key) const;
|
texture_view at(Key const & key) const;
|
||||||
|
|
||||||
|
std::size_t used_pixels() const { return used_pixels_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
util::atlas<Pixel, 2, Key, Compare> atlas_;
|
util::atlas<Pixel, 2, Key, Compare> atlas_;
|
||||||
texture_2d texture_;
|
texture_2d texture_;
|
||||||
|
std::size_t used_pixels_ = 0;
|
||||||
|
|
||||||
void update_texture();
|
void update_texture();
|
||||||
|
|
||||||
|
|
@ -42,6 +45,8 @@ namespace psemek::gfx
|
||||||
if (result.second)
|
if (result.second)
|
||||||
update_texture();
|
update_texture();
|
||||||
|
|
||||||
|
used_pixels_ += data.size();
|
||||||
|
|
||||||
return {to_view(result.first), result.second};
|
return {to_view(result.first), result.second};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue