Mandrill 2025.6.0
Loading...
Searching...
No Matches
Mandrill::Texture Class Reference

Texture class for managing textures in Vulkan. More...

#include <Texture.h>

Public Member Functions

MANDRILL_API Texture (ptr< Device > pDevice, Type type, VkFormat format, const std::filesystem::path &path, bool mipmaps=false)
 Create a new texture from a file.
 
MANDRILL_API Texture (ptr< Device > pDevice, Type type, VkFormat format, const void *pData, uint32_t width, uint32_t height, uint32_t depth, uint32_t channels, bool mipmaps=false)
 Create a new texture from a buffer.
 
MANDRILL_API ~Texture ()
 Destructor for texture.
 
MANDRILL_API void setSampler (const ptr< Sampler > pSampler)
 Set the sampler for the texture.
 
MANDRILL_API VkSampler getSampler () const
 Get the sampler handle currently in use by the texture.
 
MANDRILL_API ptr< ImagegetImage () const
 Get the image of the texture.
 
MANDRILL_API VkImageView getImageView () const
 Get the image view handle.
 
MANDRILL_API VkWriteDescriptorSet getWriteDescriptor (uint32_t binding) const
 Get the write descriptor set. Useful when using push descriptors.
 

Detailed Description

Texture class for managing textures in Vulkan.

Constructor & Destructor Documentation

◆ Texture() [1/2]

Texture::Texture ( ptr< Device pDevice,
Type  type,
VkFormat  format,
const std::filesystem::path &  path,
bool  mipmaps = false 
)

Create a new texture from a file.

Parameters
pDeviceDevice to use
typeType of texture
formatFormat to use
pathPath to texture file
mipmapsWhether to use mipmaps or not

◆ Texture() [2/2]

Texture::Texture ( ptr< Device pDevice,
Type  type,
VkFormat  format,
const void *  pData,
uint32_t  width,
uint32_t  height,
uint32_t  depth,
uint32_t  channels,
bool  mipmaps = false 
)

Create a new texture from a buffer.

Parameters
pDeviceDevice to use
typeType of texture
formatFormat to use
pDataPointer to texture data
widthWidth of texture
heightHeight of texture
depthDepth of texture
channelsNumber of channels in texture
mipmapsWhether to use mipmaps or not

Member Function Documentation

◆ getImage()

MANDRILL_API ptr< Image > Mandrill::Texture::getImage ( ) const
inline

Get the image of the texture.

Returns
Pointer to image

◆ getImageView()

MANDRILL_API VkImageView Mandrill::Texture::getImageView ( ) const
inline

Get the image view handle.

Returns
Image view handle

◆ getSampler()

MANDRILL_API VkSampler Mandrill::Texture::getSampler ( ) const
inline

Get the sampler handle currently in use by the texture.

Returns
Vulkan sampler handle

◆ getWriteDescriptor()

MANDRILL_API VkWriteDescriptorSet Mandrill::Texture::getWriteDescriptor ( uint32_t  binding) const
inline

Get the write descriptor set. Useful when using push descriptors.

Parameters
bindingBinding to place the write descriptor in
Returns
Write descriptor set

◆ setSampler()

MANDRILL_API void Mandrill::Texture::setSampler ( const ptr< Sampler pSampler)
inline

Set the sampler for the texture.

Parameters
pSamplerSampler to use

The documentation for this class was generated from the following files: