#pragma once #include #include #include #include #include "vulkan/device.hpp" #include "vulkan/image.hpp" namespace sophia { /** * A sampled, read-only RGBA8 (sRGB) image. * * Owned by the ResourceRegistry and addressed through a TextureHandle. */ class Texture { public: /** `pixels` is width * height tightly packed RGBA8 texels, top row first. */ Texture(Device& device, u32 width, u32 height, std::span pixels); ~Texture(); Texture(const Texture&) = delete; Texture& operator=(const Texture&) = delete; const Image& getImage() const { return *this->image; } u32 getWidth() const { return this->image->getExtent().width; } u32 getHeight() const { return this->image->getExtent().height; } vk::DescriptorImageInfo descriptorInfo() const; private: std::unique_ptr image; }; } // namespace sophia