Class Texture

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class Texture : public portal::renderer::RendererResource

Abstract texture interface with mipmap, sampler, and cube texture support.

Wraps Image with texture-specific functionality: mipmap queries, sampler configuration, predefined texture IDs (missing/white/black), and texture type (2D/cube). Supports CPU buffer access and resizing.

Subclassed by portal::renderer::vulkan::VulkanTexture

Public Functions

inline explicit Texture(const StringId &id)
virtual ImageFormat get_format() const = 0

Gets texture format.

virtual size_t get_width() const = 0

Gets texture width.

virtual size_t get_height() const = 0

Gets texture height.

virtual size_t get_depth() const = 0

Gets texture depth.

virtual glm::uvec3 get_size() const = 0

Gets texture size as 3D vector.

virtual uint32_t get_mip_level_count() const = 0

Gets mipmap level count.

virtual glm::uvec3 get_mip_size(uint32_t mip) const = 0

Gets dimensions of specific mip level.

Parameters:

mip – Mip level index

Returns:

Mip size (width/height/depth)

virtual void resize(const glm::uvec3 &size) = 0

Resizes texture.

Parameters:

size – New size

virtual void resize(size_t width, size_t height, size_t depth) = 0

Resizes texture.

Parameters:
  • width – New width

  • height – New height

  • depth – New depth

virtual Reference<Image> get_image() const = 0

Gets underlying image.

virtual Buffer get_buffer() const = 0

Gets CPU buffer (const)

virtual Buffer get_writeable_buffer() = 0

Gets CPU buffer (mutable)

virtual bool loaded() const = 0

Checks if texture data is loaded.

virtual TextureType get_type() const = 0

Gets texture type (2D/cube)

Public Static Functions

static inline ResourceType static_type()

Public Static Attributes

static const StringId MISSING_TEXTURE_ID = STRING_ID("missing_texture")
static const StringId WHITE_TEXTURE_ID = STRING_ID("white_texture")
static const StringId BLACK_TEXTURE_ID = STRING_ID("black_texture")