nCine::TextureFormat class

Backend-neutral pixel format descriptor of a texture.

Describes the pixel format of decoded or empty texture data as a backend-neutral PixelFormat, tracks whether the data is compressed and whether the external channel order is BGR/BGRA. The backend translates the format into its own internal/external formats and pixel data types when the texture is uploaded.

Public static functions

static auto calculateMipSizes(PixelFormat format, std::int32_t width, std::int32_t height, std::int32_t mipMapCount, std::uint32_t* mipDataOffsets, std::uint32_t* mipDataSizes) -> std::uint32_t
Calculates the pixel data offset and size for each MIP map level.

Constructors, destructors, conversion operators

TextureFormat()
TextureFormat(PixelFormat format) explicit

Public functions

auto pixelFormat() const -> PixelFormat
Returns the backend-neutral pixel format.
auto isCompressed() const -> bool
Returns true if the format holds compressed data.
auto isBgr() const -> bool
Returns true if the external channel order is BGR/BGRA instead of RGB/RGBA.
auto numChannels() const -> std::uint32_t
Returns the number of color channels.
void bgrFormat()
Marks the external channel order as BGR/BGRA.