17 enum class MANDRILL_API Type {
34 MANDRILL_API
Texture(ptr<Device> pDevice, Type type, VkFormat format,
const std::filesystem::path& path,
35 bool mipmaps =
false);
49 MANDRILL_API
Texture(ptr<Device> pDevice, Type type, VkFormat format,
const void* pData, uint32_t width,
50 uint32_t height, uint32_t depth, uint32_t channels,
bool mipmaps =
false);
61 MANDRILL_API
void setSampler(
const ptr<Sampler> pSampler)
63 mImageInfo.sampler = pSampler->getSampler();
72 return mImageInfo.sampler;
90 return mImageInfo.imageView;
100 VkWriteDescriptorSet descriptor = {
101 .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
102 .dstBinding = binding,
103 .dstArrayElement = 0,
104 .descriptorCount = 1,
105 .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
106 .pImageInfo = &mImageInfo,
113 void create(VkFormat format,
const void* pData, uint32_t width, uint32_t height, uint32_t depth,
114 uint32_t bytesPerPixel,
bool mipmaps);
115 void generateMipmaps(VkCommandBuffer cmd);
117 ptr<Device> mpDevice;
120 VkDescriptorImageInfo mImageInfo;
Texture class for managing textures in Vulkan.
Definition Texture.h:15
MANDRILL_API ~Texture()
Destructor for texture.
Definition Texture.cpp:106
MANDRILL_API ptr< Image > getImage() const
Get the image of the texture.
Definition Texture.h:79
MANDRILL_API VkSampler getSampler() const
Get the sampler handle currently in use by the texture.
Definition Texture.h:70
MANDRILL_API VkImageView getImageView() const
Get the image view handle.
Definition Texture.h:88
MANDRILL_API VkWriteDescriptorSet getWriteDescriptor(uint32_t binding) const
Get the write descriptor set. Useful when using push descriptors.
Definition Texture.h:98
MANDRILL_API void setSampler(const ptr< Sampler > pSampler)
Set the sampler for the texture.
Definition Texture.h:61