mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-10 22:23:34 +00:00
44 lines
1.8 KiB
C++
44 lines
1.8 KiB
C++
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* TextureAtlas.h :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/04/07 16:36:33 by maldavid #+# #+# */
|
|
/* Updated: 2024/07/05 13:52:40 by maldavid ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#ifndef __MLX_TEXTURE_ATLAS__
|
|
#define __MLX_TEXTURE_ATLAS__
|
|
|
|
#include <Renderer/Images/Texture.h>
|
|
|
|
namespace mlx
|
|
{
|
|
class TextureAtlas : public Image
|
|
{
|
|
public:
|
|
TextureAtlas() = default;
|
|
|
|
void Create(std::uint8_t* pixels, std::uint32_t width, std::uint32_t height, VkFormat format, const char* name, bool dedicated_memory = false);
|
|
void Render(class Renderer& renderer, int x, int y, std::uint32_t ibo_size) const;
|
|
void Destroy() noexcept override;
|
|
|
|
inline void SetDescriptor(DescriptorSet&& set) noexcept { m_set = set; }
|
|
inline DescriptorSet GetSet() noexcept { return m_set; }
|
|
inline void UpdateSet(int binding) noexcept { m_set.WriteDescriptor(binding, *this); m_has_been_updated = true; }
|
|
inline bool HasBeenUpdated() const noexcept { return m_has_been_updated; }
|
|
inline constexpr void ResetUpdate() noexcept { m_has_been_updated = false; }
|
|
|
|
~TextureAtlas() = default;
|
|
|
|
private:
|
|
DescriptorSet m_set;
|
|
bool m_has_been_updated = false;
|
|
};
|
|
}
|
|
|
|
#endif
|