diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-02-18 06:32:11 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-02-18 06:32:11 +0100 |
commit | dbc638717df7e4639693e06e4a581f57188d2647 (patch) | |
tree | db343cd1b27aaecfac61133d77e645f7d98284bb /atlas.hpp | |
parent | e409d00af067860edb509df6ffc53c8a20b881ff (diff) |
rename atlas type filename
Diffstat (limited to 'atlas.hpp')
-rw-r--r-- | atlas.hpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/atlas.hpp b/atlas.hpp new file mode 100644 index 00000000..4d747137 --- /dev/null +++ b/atlas.hpp @@ -0,0 +1,26 @@ +#pragma once +#include <Magnum/Math/Vector.h> +#include <Magnum/Math/Vector2.h> +#include <Magnum/GL/Texture.h> +#include <Magnum/Trade/ImageData.h> +#include <array> + +namespace Magnum::Examples { +using Vector2i = Math::Vector<2, int>; + +struct atlas_texture final +{ + atlas_texture(const Trade::ImageData2D& img, Vector2i dims); + std::array<Vector2, 4> texcoords_for_id(int id) const; + static std::array<Vector3, 4> floor_quad(Vector3 center, Vector2 size); + static std::array<UnsignedShort, 6> indices(int N); + GL::Texture2D& texture() { return tex_; } + + atlas_texture(const atlas_texture&) = delete; + atlas_texture& operator=(const atlas_texture&) = delete; +private: + GL::Texture2D tex_; + Vector2i size_, dims_, tile_size_; +}; + +} // namespace Magnum::Examples |