Texture
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.
| Value | Description |
|---|---|
| Linear | Linear color space, no gamma correction is applied. |
| sRGB | sRGB color space, converted to linear on sampling. |
Texture::Format enum
Enumerates pixel format and storage type for the texture.
| Value | Description |
|---|---|
| RGBA8 | 8-bit normalized RGBA. |
| RGBA16F | 16-bit float RGBA. |
| R16F | 16-bit float single channel. |
| R32F | 32-bit float single channel. |
| R32UI | 32-bit unsigned integer single channel. |
| SRGBA8 | 8-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.
| Value | Description |
|---|---|
| Nearest | Nearest-neighbor sampling. |
| Linear | Linear 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.
| Value | Description |
|---|---|
| Nearest | Nearest-neighbor sampling. |
| Linear | Linear interpolation. |
| NearestMipmapNearest | Nearest mip, nearest sample. |
| LinearMipmapNearest | Nearest mip, linear sample. |
| NearestMipmapLinear | Linear mip, nearest sample. |
| LinearMipmapLinear | Linear 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.
| Value | Description |
|---|---|
| OneByte | 1-byte alignment (tightly packed). |
| TwoBytes | 2-byte alignment. |
| FourBytes | 4-byte alignment (default). |
| EightBytes | 8-byte alignment |
Texture::Type enum
Enumerates all supported texture types.
| Value | Description |
|---|---|
| Texture2D | Two-dimensional texture. |
| DynamicTexture2D | Two-dimensional dynamic GPU texture. |
Properties
color_space ColorSpace
Color space of the texture data.
ColorSpace color_space {ColorSpace::sRGB};generate_mipamps bool
Enables automatic mipmap generation for this texture.
bool generate_mipamps {false};Magnification filter used when sampling the texture.
MagFilter mag_filter {MagFilter::Linear};Minification filter used when sampling the texture.
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.
unsigned int renderer_id {0};row_alignment RowAlignment
Row alignment used when uploading texture data.
RowAlignment row_alignment {RowAlignment::FourBytes};Functions
Identifies the concrete texture type.
virtual Type Texture::GetType() const=0;