Files
MacroLibX/src/renderer/images/texture_atlas.h
2023-12-24 16:07:09 +01:00

44 lines
1.7 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* texture_atlas.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/07 16:36:33 by maldavid #+# #+# */
/* Updated: 2023/12/23 18:49:25 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __MLX_TEXTURE_ATLAS__
#define __MLX_TEXTURE_ATLAS__
#include <renderer/images/texture.h>
#include <array>
#include <glm/glm.hpp>
#include <mlx_profile.h>
namespace mlx
{
class TextureAtlas : public Image
{
public:
TextureAtlas() = default;
void create(uint8_t* pixels, uint32_t width, uint32_t height, VkFormat format, const char* name, bool dedicated_memory = false);
void render(class Renderer& renderer, int x, int y, uint32_t ibo_size) const;
void destroy() noexcept override;
inline void setDescriptor(DescriptorSet&& set) noexcept { _set = set; }
inline VkDescriptorSet getSet() noexcept { return _set.isInit() ? _set.get() : VK_NULL_HANDLE; }
inline void updateSet(int binding) const noexcept { _set.writeDescriptor(binding, *this); }
~TextureAtlas() = default;
private:
DescriptorSet _set;
};
}
#endif