From d0de60dc33df75fbcacb53a09568b14d0fd48cb9 Mon Sep 17 00:00:00 2001 From: Mel Date: Mon, 12 Jun 2023 17:09:55 +0200 Subject: Multithreaded world generation with Perlin --- src/GFX/Image/RawImage.hpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/GFX/Image/RawImage.hpp') diff --git a/src/GFX/Image/RawImage.hpp b/src/GFX/Image/RawImage.hpp index 2b10cb0..8a837e6 100644 --- a/src/GFX/Image/RawImage.hpp +++ b/src/GFX/Image/RawImage.hpp @@ -2,19 +2,23 @@ #include #include +#include #include +#include "../../Util/Sampler.hpp" namespace MC::GFX::Image { class RawImage { public: - RawImage() : m_pixels(), m_width(0), m_height(0), m_channels(0) {}; + RawImage() : m_pixels(), m_width(0), m_height(0) {}; - explicit RawImage(uint32_t width, uint32_t height, uint8_t channels) - : m_pixels(), m_width(width), m_height(height), m_channels(channels) { + RawImage(uint32_t width, uint32_t height) + : m_pixels(), m_width(width), m_height(height) { m_pixels.reserve(width * height); } + RawImage(Util::Sampler<2, float>& sampler, uint32_t width, uint32_t height); + struct Pixel { uint8_t r, g, b; }; @@ -27,11 +31,13 @@ public: uint32_t width() const; uint32_t height() const; uint8_t channels() const; + + std::string string() const; private: std::vector m_pixels; uint32_t m_width, m_height; - uint8_t m_channels; + uint8_t m_channels = 3; }; } -- cgit 1.4.1