/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* texture_manager.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/11 00:56:15 by maldavid #+# #+# */ /* Updated: 2024/01/11 01:49:12 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef __MLX_TEXTURE_MANAGER__ #define __MLX_TEXTURE_MANAGER__ #include #include #include #include namespace mlx { class TextureManager { public: TextureManager() = default; inline void clear() { _texture_descriptors.clear(); } inline std::pair registerTexture(Texture* texture, int x, int y) { MLX_PROFILE_FUNCTION(); auto res = _texture_descriptors.emplace(texture, x, y); return std::make_pair(static_cast(&const_cast(*res.first)), res.second); } ~TextureManager() = default; private: std::unordered_set _texture_descriptors; }; } #endif