diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-06 19:20:03 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-06 19:20:11 +0100 |
commit | b82ebb0339a15cc05e26f9cdca646022e6b71ef4 (patch) | |
tree | 1e8bb27a0f5d0c84de4790465cf280d77c785a33 /src/anim-atlas.cpp | |
parent | edc3ad8c86cb1a042134f82c738029004b116d86 (diff) |
a
Diffstat (limited to 'src/anim-atlas.cpp')
-rw-r--r-- | src/anim-atlas.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/anim-atlas.cpp b/src/anim-atlas.cpp index 65b0038c..1aadab21 100644 --- a/src/anim-atlas.cpp +++ b/src/anim-atlas.cpp @@ -1,5 +1,6 @@ #include "anim-atlas.hpp" #include <Corrade/Containers/StringStlView.h> +#include <Magnum/GL/TextureFormat.h> namespace floormat { @@ -28,10 +29,17 @@ decltype(anim_atlas::_group_indices) anim_atlas::make_group_indices(const anim_i } anim_atlas::anim_atlas() noexcept = default; -anim_atlas::anim_atlas(StringView name, GL::Texture2D&& tex, anim_info info) noexcept : - _tex{std::move(tex)}, _name{name}, +anim_atlas::anim_atlas(StringView name, const ImageView2D& image, anim_info info) noexcept : + _name{name}, _info{std::move(info)}, _group_indices{make_group_indices(_info)} { + _tex.setWrapping(GL::SamplerWrapping::ClampToEdge) + .setMagnificationFilter(GL::SamplerFilter::Nearest) + .setMinificationFilter(GL::SamplerFilter::Linear) + .setMaxAnisotropy(1) + .setBorderColor(Color4{1, 0, 0, 1}) + .setStorage(1, GL::textureFormat(image.format()), image.size()) + .setSubImage(0, {}, image); } anim_atlas::~anim_atlas() noexcept = default; @@ -74,4 +82,6 @@ auto anim_atlas::frame_texcoords(const anim_frame& frame) const noexcept -> texc }}; } + + } // namespace floormat |