.. index:: pair: class; EE::Graphics::TextureLoader .. _doxid-class_e_e_1_1_graphics_1_1_texture_loader: class EE::Graphics::TextureLoader ================================= .. toctree:: :hidden: Overview ~~~~~~~~ The :ref:`Texture ` loader loads a texture in synchronous or asynchronous mode. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class TextureLoader { public: // typedefs typedef std::function`, :ref:`Texture`*)> :target:`OnTextureLoaded`; // construction :ref:`TextureLoader`(:ref:`IOStream`& Stream, const bool& Mipmap = false, const :ref:`Texture::ClampMode`& ClampMode = :ref:`Texture::ClampMode::ClampToEdge`, const bool& CompressTexture = false, const bool& KeepLocalCopy = false); :ref:`TextureLoader`(const std::string& filepath, const bool& Mipmap = false, const :ref:`Texture::ClampMode`& ClampMode = :ref:`Texture::ClampMode::ClampToEdge`, const bool& CompressTexture = false, const bool& KeepLocalCopy = false); :ref:`TextureLoader`(const unsigned char* ImagePtr, const unsigned int& Size, const bool& Mipmap = false, const :ref:`Texture::ClampMode`& ClampMode = :ref:`Texture::ClampMode::ClampToEdge`, const bool& CompressTexture = false, const bool& KeepLocalCopy = false); :ref:`TextureLoader`(:ref:`Pack`* Pack, const std::string& FilePackPath, const bool& Mipmap = false, const :ref:`Texture::ClampMode`& ClampMode = :ref:`Texture::ClampMode::ClampToEdge`, const bool& CompressTexture = false, const bool& KeepLocalCopy = false); :ref:`TextureLoader`( const unsigned char* Pixels, const unsigned int& Width, const unsigned int& Height, const unsigned int& Channels, const bool& Mipmap = false, const :ref:`Texture::ClampMode`& ClampMode = :ref:`Texture::ClampMode::ClampToEdge`, const bool& CompressTexture = false, const bool& KeepLocalCopy = false, const std::string& FileName = std::string("") ); virtual :target:`~TextureLoader`(); // methods static :ref:`Uint32` :target:`pushLoadedCallback`(const :ref:`OnTextureLoaded`& cb); static void :target:`popLoadedCallback`(const :ref:`Uint32`& cbId); void :ref:`setColorKey`(:ref:`RGB` Color); void :ref:`unload`(); const std::string& :ref:`getFilepath`() const; :ref:`Uint32` :ref:`getId`() const; :ref:`Texture`* :ref:`getTexture`() const; :ref:`Image::FormatConfiguration` :target:`getFormatConfiguration`() const; void :target:`setFormatConfiguration`(const :ref:`Image::FormatConfiguration`& formatConfiguration); void :ref:`load`(); }; .. _details-class_e_e_1_1_graphics_1_1_texture_loader: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ The :ref:`Texture ` loader loads a texture in synchronous or asynchronous mode. Construction ------------ .. index:: pair: function; TextureLoader .. _doxid-class_e_e_1_1_graphics_1_1_texture_loader_1ae070fd8b0265e241002aef0b1876e193: .. ref-code-block:: cpp :class: doxyrest-title-code-block TextureLoader(:ref:`IOStream`& Stream, const bool& Mipmap = false, const :ref:`Texture::ClampMode`& ClampMode = :ref:`Texture::ClampMode::ClampToEdge`, const bool& CompressTexture = false, const bool& KeepLocalCopy = false) Load a :ref:`Texture ` from stream .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - 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 ) .. index:: pair: function; TextureLoader .. _doxid-class_e_e_1_1_graphics_1_1_texture_loader_1afc1ba5a6b5954809c12eb385e1d717cf: .. ref-code-block:: cpp :class: doxyrest-title-code-block TextureLoader(const std::string& filepath, const bool& Mipmap = false, const :ref:`Texture::ClampMode`& ClampMode = :ref:`Texture::ClampMode::ClampToEdge`, const bool& CompressTexture = false, const bool& KeepLocalCopy = false) Load a :ref:`Texture ` from a file path .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - 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 ) .. index:: pair: function; TextureLoader .. _doxid-class_e_e_1_1_graphics_1_1_texture_loader_1a552c77a96e803b5e194aad603b2102d3: .. ref-code-block:: cpp :class: doxyrest-title-code-block TextureLoader(const unsigned char* ImagePtr, const unsigned int& Size, const bool& Mipmap = false, const :ref:`Texture::ClampMode`& ClampMode = :ref:`Texture::ClampMode::ClampToEdge`, const bool& CompressTexture = false, const bool& KeepLocalCopy = false) Load a texture from memory .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - 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 ) .. index:: pair: function; TextureLoader .. _doxid-class_e_e_1_1_graphics_1_1_texture_loader_1abb879075a22f4cc8b7db5547fa230df1: .. ref-code-block:: cpp :class: doxyrest-title-code-block TextureLoader(:ref:`Pack`* Pack, const std::string& FilePackPath, const bool& Mipmap = false, const :ref:`Texture::ClampMode`& ClampMode = :ref:`Texture::ClampMode::ClampToEdge`, const bool& CompressTexture = false, const bool& KeepLocalCopy = false) Load a texture from a Pack file .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - 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 ) .. index:: pair: function; TextureLoader .. _doxid-class_e_e_1_1_graphics_1_1_texture_loader_1a3599687ac0acaf8be4170774ea4793f9: .. ref-code-block:: cpp :class: doxyrest-title-code-block TextureLoader( const unsigned char* Pixels, const unsigned int& Width, const unsigned int& Height, const unsigned int& Channels, const bool& Mipmap = false, const :ref:`Texture::ClampMode`& ClampMode = :ref:`Texture::ClampMode::ClampToEdge`, const bool& CompressTexture = false, const bool& KeepLocalCopy = false, const std::string& FileName = std::string("") ) Loads a RAW :ref:`Texture ` from Memory .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - Pixels - The :ref:`Texture ` array * - Width - :ref:`Texture ` Width * - Height - :ref:`Texture ` Height * - Channels - :ref:`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 ------- .. index:: pair: function; setColorKey .. _doxid-class_e_e_1_1_graphics_1_1_texture_loader_1a6877802774b9cc089cf2bd046fe2d130: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setColorKey(:ref:`RGB` Color) A color key can be set to be transparent in the texture. This must be set before the loading is done. .. index:: pair: function; unload .. _doxid-class_e_e_1_1_graphics_1_1_texture_loader_1a6caa250802e5f2ef4c4510b6fb478979: .. ref-code-block:: cpp :class: doxyrest-title-code-block void unload() Releases the texture loaded ( if was already loaded ), it will destroy the texture from memory. .. index:: pair: function; getFilepath .. _doxid-class_e_e_1_1_graphics_1_1_texture_loader_1a3ab3aa56ba154f1174243adae653dbbf: .. ref-code-block:: cpp :class: doxyrest-title-code-block const std::string& getFilepath() const .. rubric:: Returns: The file path to the texture ( if any ) .. index:: pair: function; getId .. _doxid-class_e_e_1_1_graphics_1_1_texture_loader_1a1c38575cb0aea48345c62f60d0424102: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Uint32` getId() const .. rubric:: Returns: The texture internal id .. index:: pair: function; getTexture .. _doxid-class_e_e_1_1_graphics_1_1_texture_loader_1a2d1285e4379b154efd9fcdc545b234ba: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Texture`* getTexture() const .. rubric:: Returns: The texture instance ( if it was loaded ). .. index:: pair: function; load .. _doxid-class_e_e_1_1_graphics_1_1_texture_loader_1a501b8d15d3943bc719635064610bfb3d: .. ref-code-block:: cpp :class: doxyrest-title-code-block void load() Starts loading the texture