class EE::Graphics::TextureLoader¶
Overview¶
The Texture loader loads a texture in synchronous or asynchronous mode. More…
#include <textureloader.hpp> class TextureLoader { public: // construction TextureLoader(IOStream& Stream, const bool& Mipmap = false, const Texture::ClampMode& ClampMode = Texture::ClampMode::ClampToEdge, const bool& CompressTexture = false, const bool& KeepLocalCopy = false); TextureLoader(const std::string& filepath, const bool& Mipmap = false, const Texture::ClampMode& ClampMode = Texture::ClampMode::ClampToEdge, const bool& CompressTexture = false, const bool& KeepLocalCopy = false); TextureLoader(const unsigned char* ImagePtr, const unsigned int& Size, const bool& Mipmap = false, const Texture::ClampMode& ClampMode = Texture::ClampMode::ClampToEdge, const bool& CompressTexture = false, const bool& KeepLocalCopy = false); TextureLoader(Pack* Pack, const std::string& FilePackPath, const bool& Mipmap = false, const Texture::ClampMode& ClampMode = Texture::ClampMode::ClampToEdge, const bool& CompressTexture = false, const bool& KeepLocalCopy = false); TextureLoader( const unsigned char* Pixels, const unsigned int& Width, const unsigned int& Height, const unsigned int& Channels, const bool& Mipmap = false, const Texture::ClampMode& ClampMode = Texture::ClampMode::ClampToEdge, const bool& CompressTexture = false, const bool& KeepLocalCopy = false, const std::string& FileName = std::string("") ); virtual ~TextureLoader(); // methods void setColorKey(RGB Color); void reset(); const std::string& getFilepath() const; ResourceId getId() const; const TexturePtr& getTexture() const; Image::FormatConfiguration getFormatConfiguration() const; void setFormatConfiguration(const Image::FormatConfiguration& formatConfiguration); void load(); };
Detailed Documentation¶
The Texture loader loads a texture in synchronous or asynchronous mode.
Construction¶
TextureLoader(IOStream& Stream, const bool& Mipmap = false, const Texture::ClampMode& ClampMode = Texture::ClampMode::ClampToEdge, const bool& CompressTexture = false, const bool& KeepLocalCopy = false)
Load a Texture from stream
Parameters:
Stream |
The io stream instance |
Mipmap |
Use mipmaps? |
ClampMode |
Defines the CLAMP MODE |
CompressTexture |
If use the DXT compression on the texture loading ( if the card can display them, will convert RGB to DXT1, RGBA to DXT5 ) |
KeepLocalCopy |
Keep the array data copy. ( useful if want to reload the texture ) |
TextureLoader(const std::string& filepath, const bool& Mipmap = false, const Texture::ClampMode& ClampMode = Texture::ClampMode::ClampToEdge, const bool& CompressTexture = false, const bool& KeepLocalCopy = false)
Load a Texture from a file path
Parameters:
filepath |
The path for the texture |
Mipmap |
Use mipmaps? |
ClampMode |
Defines the CLAMP MODE |
CompressTexture |
If use the DXT compression on the texture loading ( if the card can display them, will convert RGB to DXT1, RGBA to DXT5 ) |
KeepLocalCopy |
Keep the array data copy. ( useful if want to reload the texture ) |
TextureLoader(const unsigned char* ImagePtr, const unsigned int& Size, const bool& Mipmap = false, const Texture::ClampMode& ClampMode = Texture::ClampMode::ClampToEdge, const bool& CompressTexture = false, const bool& KeepLocalCopy = false)
Load a texture from memory
Parameters:
ImagePtr |
The image data in memory just as if it were still in a file |
Size |
The size of the texture ( Width * Height * BytesPerPixel ) |
Mipmap |
Use mipmaps? |
ClampMode |
Defines the CLAMP MODE |
CompressTexture |
If use the DXT compression on the texture loading ( if the card can display them, will convert RGB to DXT1, RGBA to DXT5 ) |
KeepLocalCopy |
Keep the array data copy. ( useful if want to reload the texture ) |
TextureLoader(Pack* Pack, const std::string& FilePackPath, const bool& Mipmap = false, const Texture::ClampMode& ClampMode = Texture::ClampMode::ClampToEdge, const bool& CompressTexture = false, const bool& KeepLocalCopy = false)
Load a texture from a Pack file
Parameters:
Pack |
Pointer to the pack instance |
FilePackPath |
The path of the file inside the pack |
Mipmap |
Create Mipmap? |
ClampMode |
Defines the CLAMP MODE |
CompressTexture |
If use the DXT compression on the texture loading ( if the card can display them, will convert RGB to DXT1, RGBA to DXT5 ) |
KeepLocalCopy |
Keep the array data copy. ( useful if want to reload the texture ) |
TextureLoader( const unsigned char* Pixels, const unsigned int& Width, const unsigned int& Height, const unsigned int& Channels, const bool& Mipmap = false, const Texture::ClampMode& ClampMode = Texture::ClampMode::ClampToEdge, const bool& CompressTexture = false, const bool& KeepLocalCopy = false, const std::string& FileName = std::string("") )
Loads a RAW Texture from Memory
Parameters:
Pixels |
The Texture array |
Width |
Texture Width |
Height |
Texture Height |
Channels |
Texture Number of Channels (in bytes) |
Mipmap |
Create Mipmap? |
ClampMode |
Defines the CLAMP MODE |
CompressTexture |
If use the DXT compression on the texture loading ( if the card can display them, will convert RGB to DXT1, RGBA to DXT5 ) |
KeepLocalCopy |
Keep the array data copy. ( useful if want to reload the texture ) |
FileName |
A filename to recognize the texture ( the path in case that was loaded from outside the texture factory ). |
Methods¶
void setColorKey(RGB Color)
A color key can be set to be transparent in the texture. This must be set before the loading is done.
void reset()
Clears the loader state and releases its texture handle. Other texture owners remain valid.
const std::string& getFilepath() const
Returns:
The file path to the texture ( if any )
ResourceId getId() const
Returns:
The process-wide texture identity.
const TexturePtr& getTexture() const
Returns:
The texture instance ( if it was loaded ).
void load()
Starts loading the texture