#pragma once #include #include #include "Core/Core.h" #include "Core/Singleton.h" class ImageBuffer : public Singleton { public: enum class IBType { Human, Face, FaceMask, }; public: explicit ImageBuffer() noexcept = default; ~ImageBuffer() = default; ImageBuffer(const ImageBuffer&) = delete; ImageBuffer& operator=(const ImageBuffer&) = delete; bool Initialize() override; void Uninitialize() override; void PushImage(IBType type, std::vector data, uint32 width, uint32 height, uint32 comp); void Update(IBType type, class Texture2D* texture); private: void PushHumanImage(std::vector data, uint32 width, uint32 height, uint32 comp); void UpdateHuman(class Texture2D* texture); void PushFaceImage(std::vector data, uint32 width, uint32 height, uint32 comp); void UpdateFace(class Texture2D* texture); void PushFaceMaskImage(std::vector data, uint32 width, uint32 height, uint32 comp); void UpdateFaceMask(class Texture2D* texture); private: struct Image { std::vector data; uint32 width; uint32 height; uint32 comp; }; CriticalSection human_cs_; Image human_; CriticalSection face_cs_; Image face_; CriticalSection face_mask_cs_; Image faceMask_; };