mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 14:43:34 +00:00
50 lines
1.7 KiB
C++
50 lines
1.7 KiB
C++
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* pixel_put.h :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/03/31 13:18:50 by maldavid #+# #+# */
|
|
/* Updated: 2024/01/11 00:06:05 by maldavid ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#ifndef __MLX_PIXEL_PUT__
|
|
#define __MLX_PIXEL_PUT__
|
|
|
|
#include <mlx_profile.h>
|
|
#include <renderer/images/texture.h>
|
|
#include <renderer/descriptors/vk_descriptor_set.h>
|
|
|
|
namespace mlx
|
|
{
|
|
class PixelPutPipeline
|
|
{
|
|
public:
|
|
PixelPutPipeline() = default;
|
|
|
|
void init(uint32_t width, uint32_t height, class Renderer& renderer) noexcept;
|
|
|
|
void setPixel(int x, int y, uint32_t color) noexcept;
|
|
void render(std::array<VkDescriptorSet, 2>& 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<uint32_t> _cpu_map;
|
|
void* _buffer_map = nullptr;
|
|
uint32_t _width = 0;
|
|
uint32_t _height = 0;
|
|
bool _has_been_modified = true;
|
|
};
|
|
}
|
|
|
|
#endif
|