Class CpuTexture

Class Documentation

class inexor::vulkan_renderer::wrapper::CpuTexture

RAII wrapper class for texture data.

Todo:

Scan asset directory automatically.

Public Functions

CpuTexture()

Create a CpuTexture instance with a default texture.

CpuTexture(const std::string &file_name, std::string name)

Read a texture from a file.

Parameters
  • file_name – The file name of the texture.

  • name – The internal debug marker name of the command buffer. This must not be an empty string.

CpuTexture(const CpuTexture&) = delete
CpuTexture(CpuTexture&&) noexcept
~CpuTexture()
CpuTexture &operator=(const CpuTexture&) = delete
CpuTexture &operator=(CpuTexture&&) = default
inline std::string name() const
inline int width() const
inline int height() const
inline int channels() const
inline int mip_levels() const
inline stbi_uc *data() const
inline std::size_t data_size() const

Private Functions

void generate_error_texture_data()

Generate a chessboard color pattern which will be used as error texture.

Private Members

std::string m_name
int m_texture_width = {0}
int m_texture_height = {0}
int m_texture_channels = {0}
int m_mip_levels = {0}
stbi_uc *m_texture_data = {nullptr}