nCine::ITextureLoader class

Texture loader interface class.

Derived classes

class TextureLoaderDds
DDS texture loader.
class TextureLoaderKtx
KTX texture loader.
class TextureLoaderPkm
PKM texture loader.
class TextureLoaderPng
PNG texture loader.
class TextureLoaderPvr
PVR texture loader.
class TextureLoaderQoi
QOI texture loader.
class TextureLoaderRaw
Texture loader used to specify a raw format when loading texels.

Public static functions

static auto createFromFile(const Death::Containers::StringView filename) -> std::unique_ptr<ITextureLoader>
Returns the proper texture loader according to the memory buffer name extension.

Constructors, destructors, conversion operators

~ITextureLoader() virtual
ITextureLoader() protected
An empty constructor only used by TextureLoaderRaw
ITextureLoader(std::unique_ptr<Death::IO::Stream> fileHandle) protected explicit

Public functions

auto hasLoaded() const -> bool
Returns true if the texture has been correctly loaded.
auto width() const -> int
Returns texture width.
auto height() const -> int
Returns texture height.
auto size() const -> Vector2i
Returns texture size as a Vector2<int> class.
auto mipMapCount() const -> int
Returns the number of MIP maps stored in the texture file.
auto dataSize() const -> unsigned long
Returns texture data size in bytes.
auto dataSize(unsigned int mipMapLevel) const -> long
Returns the texture data size in bytes for the specified MIP map level.
auto texFormat() const -> const TextureFormat&
Returns the texture format object.
auto pixels() const -> const GLubyte*
Returns the pointer to pixel data.
auto pixels(unsigned int mipMapLevel) const -> const GLubyte*
Returns the pointer to pixel data for the specified MIP map level.

Protected static functions

static auto createLoader(std::unique_ptr<Death::IO::Stream> fileHandle, const Death::Containers::StringView path) -> std::unique_ptr<ITextureLoader>

Protected functions

void loadPixels(GLenum internalFormat)
Loads pixel data from a texture file holding either compressed or uncompressed data.
void loadPixels(GLenum internalFormat, GLenum type)
Loads pixel data from a texture file holding either compressed or uncompressed data, overriding pixel type.

Protected variables

bool hasLoaded_
A flag indicating if the loading process has been successful.
std::unique_ptr<Death::IO::Stream> fileHandle_
Texture file handle.
int width_
int height_
int headerSize_
unsigned long dataSize_
int mipMapCount_
std::unique_ptr<unsigned long[]> mipDataOffsets_
std::unique_ptr<unsigned long[]> mipDataSizes_
TextureFormat texFormat_
std::unique_ptr<GLubyte[]> pixels_

Function documentation

static std::unique_ptr<ITextureLoader> nCine::ITextureLoader::createFromFile(const Death::Containers::StringView filename)

Returns the proper texture loader according to the memory buffer name extension.

Returns the proper texture loader according to the file extension