Skip to content

Texture

Abstract base class for texture types.

This class is not intended to be used directly. Use one of the concrete texture types such as Texture2D, or derive your own texture class that implements the required interface.

Types

Texture::ColorSpace enum

Enumerates supported color spaces for texture data.

Textures containing color data (e.g. albedo or base color maps) are typically authored in sRGB and should use ColorSpace::sRGB. Data textures (e.g. normals, roughness, metallic, masks) must use ColorSpace::Linear to preserve numerical correctness.

ValueDescription
LinearLinear color space, no gamma correction is applied.
sRGBsRGB color space, converted to linear on sampling.

Texture::Format enum

Enumerates pixel format and storage type for the texture.

ValueDescription
RGBA88-bit normalized RGBA.
RGBA16F16-bit float RGBA.
R16F16-bit float single channel.
R32F32-bit float single channel.
R32UI32-bit unsigned integer single channel.
SRGBA88-bit sRGB-encoded RGBA.

Texture::MagFilter enum

Enumerates supported magnification filters.

Magnification filters control how a texture is sampled when it is rendered larger than its native resolution.

ValueDescription
NearestNearest-neighbor sampling.
LinearLinear interpolation.

Texture::MinFilter enum

Enumerates supported minification filters.

Minification filters control how a texture is sampled when it is rendered smaller than its native resolution. Mipmapped filters select and blend between mip levels when available.

ValueDescription
NearestNearest-neighbor sampling.
LinearLinear interpolation.
NearestMipmapNearestNearest mip, nearest sample.
LinearMipmapNearestNearest mip, linear sample.
NearestMipmapLinearLinear mip, nearest sample.
LinearMipmapLinearLinear mip, linear sample.

Texture::RowAlignment enum

Specifies the byte alignment of each row in source texture data.

Determines how pixel rows are aligned in memory when uploading texture data to the GPU. The alignment value must match the source image’s row stride to ensure correct decoding and avoid visual artifacts.

Textures generated through the asset builder pipeline are encoded as RGBA8 with 4-byte row alignment by default.

ValueDescription
OneByte1-byte alignment (tightly packed).
TwoBytes2-byte alignment.
FourBytes4-byte alignment (default).
EightBytes8-byte alignment

Texture::Type enum

Enumerates all supported texture types.

ValueDescription
Texture2DTwo-dimensional texture.
DynamicTexture2DTwo-dimensional dynamic GPU texture.

Properties

color_space ColorSpace

Color space of the texture data.

cpp
ColorSpace color_space {ColorSpace::sRGB};

format Format

Texture storage format.

cpp
Format format {Format::RGBA8};

generate_mipamps bool

Enables automatic mipmap generation for this texture.

cpp
bool generate_mipamps {false};

mag_filter MagFilter

Magnification filter used when sampling the texture.

cpp
MagFilter mag_filter {MagFilter::Linear};

min_filter MinFilter

Minification filter used when sampling the texture.

cpp
MinFilter min_filter {MinFilter::Linear};

renderer_id unsigned int

Renderer-specific texture handle. Typically corresponds to the underlying graphics API object identifier, for example, an OpenGL texture ID.

cpp
unsigned int renderer_id {0};

row_alignment RowAlignment

Row alignment used when uploading texture data.

cpp
RowAlignment row_alignment {RowAlignment::FourBytes};

Functions

GetType() Type pure virtual

Identifies the concrete texture type.

cpp
virtual Type Texture::GetType() const=0;

Released under the MIT License.