human_render/src/ImageBuffer.h

43 lines
978 B
C
Raw Normal View History

2024-11-30 17:10:43 +00:00
#pragma once
#include <vector>
#include <queue>
#include "Core/Core.h"
#include "Core/Singleton.h"
class ImageBuffer : public Singleton<ImageBuffer> {
public:
enum class IBType {
Background,
};
public:
explicit ImageBuffer() noexcept = default;
~ImageBuffer() = default;
ImageBuffer(const ImageBuffer&) = delete;
ImageBuffer& operator=(const ImageBuffer&) = delete;
2024-12-01 17:31:51 +00:00
bool Initialize() override;
void Uninitialize() override;
2024-11-30 17:10:43 +00:00
void PushImage(IBType type, std::vector<uint8> data, uint32 width, uint32 height, uint32 comp);
2024-12-01 17:31:51 +00:00
void Update(IBType type, class Texture2D* texture);
2024-11-30 17:10:43 +00:00
private:
void PushBackgroundImage(std::vector<uint8> data, uint32 width, uint32 height, uint32 comp);
2024-12-01 17:31:51 +00:00
void UpdateBackground(class Texture2D* texture);
2024-11-30 17:10:43 +00:00
private:
struct Image {
std::vector<uint8> data;
uint32 width;
uint32 height;
uint32 comp;
};
CriticalSection cs_;
2024-12-01 17:31:51 +00:00
Image background_;
2024-11-30 17:10:43 +00:00
};