/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* pixel_put.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/03/31 13:18:50 by maldavid #+# #+# */ /* Updated: 2024/03/25 19:07:56 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef __MLX_PIXEL_PUT__ #define __MLX_PIXEL_PUT__ #include #include namespace mlx { class PixelPutPipeline { public: PixelPutPipeline() = default; void init(std::uint32_t width, std::uint32_t height, class Renderer& renderer) noexcept; void setPixel(int x, int y, std::uint32_t color) noexcept; void render(std::array& sets, class Renderer& renderer) noexcept; void clear(); void destroy() noexcept; ~PixelPutPipeline(); private: Texture _texture; Buffer _buffer; // using vector as CPU map and not directly writting to mapped buffer to improve performances std::vector _cpu_map; void* _buffer_map = nullptr; std::uint32_t _width = 0; std::uint32_t _height = 0; bool _has_been_modified = true; }; } #endif