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 sampling.
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::Mapping enum
Enumerates supported texture mapping modes.
Mapping describes how the texture's content should be interpreted when sampled rather than how it is stored. A 2D texture marked as
Mapping::Equirectangular holds a full 360° panorama (e.g. an HDR environment) and is sampled by direction instead of texture coordinates.
| Value | Description |
|---|---|
| UV | Sampled with texture coordinates (default). |
| Equirectangular | Panorama sampled by direction. |
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.
RGBA8 textures typically use 4-byte row alignment.
| 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. |
| CubeTexture | Cube texture made up of six images. |
Texture::Wrapping enum
Enumerates supported texture wrapping modes.
Wrapping modes control how a texture is sampled when texture coordinates fall outside the range, applied independently per axis.
Cube maps ignore these modes and always clamp to edge to avoid visible seams where faces meet.
| Value | Description |
|---|---|
| Repeat | Tiles the texture, ignoring the integer part of the coordinate. |
| ClampToEdge | Clamps the coordinate to the edge texel. |
| MirroredRepeat | Tiles the texture, mirroring on each repetition. |
Properties
anisotropy float
Maximum anisotropy used when sampling this texture. Values greater than 1 enable anisotropic filtering, which improves texture quality at oblique viewing angles. The value is clamped to the driver-reported maximum at upload time. Only takes effect when the texture is sampled with a mipmapped minification filter. Defaults to 1 (isotropic).
float anisotropy {1.0f};color_space ColorSpace
Color space used when sampling this texture.
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};Mapping mode used to interpret the texture's content.
Mapping mapping {Mapping::UV};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};Wrapping mode applied to the horizontal (U) texture coordinate.
Wrapping wrap_s {Wrapping::Repeat};Wrapping mode applied to the vertical (V) texture coordinate.
Wrapping wrap_t {Wrapping::Repeat};Functions
Identifies the concrete texture type.
virtual Type Texture::GetType() const=0;