.. index:: pair: class; EE::Graphics::TextureAtlasLoader .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader: class EE::Graphics::TextureAtlasLoader ====================================== .. toctree:: :hidden: struct_EE_Graphics_TextureAtlasLoader_sTempTexAtlas.rst Overview ~~~~~~~~ The :ref:`Texture ` Atlas Loader loads any previously created :ref:`Texture ` Atlas. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class TextureAtlasLoader { public: // typedefs typedef std::function :target:`GLLoadCallback`; // structs struct :ref:`sTempTexAtlas`; // construction :ref:`TextureAtlasLoader`(); :ref:`TextureAtlasLoader`(const std::string& TextureAtlasPath, const bool& threaded = false, :ref:`GLLoadCallback` LoadCallback = :ref:`GLLoadCallback`()); :ref:`TextureAtlasLoader`(const :ref:`Uint8`* Data, const :ref:`Uint32`& DataSize, const std::string& TextureAtlasName, const bool& threaded = false, :ref:`GLLoadCallback` LoadCallback = :ref:`GLLoadCallback`()); :ref:`TextureAtlasLoader`(:ref:`Pack`* Pack, const std::string& FilePackPath, const bool& threaded = false, :ref:`GLLoadCallback` LoadCallback = :ref:`GLLoadCallback`()); :ref:`TextureAtlasLoader`(:ref:`IOStream`& IOS, const bool& threaded = false, :ref:`GLLoadCallback` LoadCallback = :ref:`GLLoadCallback`()); :target:`~TextureAtlasLoader`(); // methods static TextureAtlasLoader* :target:`New`(); static TextureAtlasLoader* :target:`New`(const std::string& TextureAtlasPath, const bool& threaded = false, :ref:`GLLoadCallback` LoadCallback = :ref:`GLLoadCallback`()); static TextureAtlasLoader* :target:`New`(const :ref:`Uint8`* Data, const :ref:`Uint32`& DataSize, const std::string& TextureAtlasName, const bool& threaded = false, :ref:`GLLoadCallback` LoadCallback = :ref:`GLLoadCallback`()); static TextureAtlasLoader* :target:`New`(:ref:`Pack`* Pack, const std::string& FilePackPath, const bool& threaded = false, :ref:`GLLoadCallback` LoadCallback = :ref:`GLLoadCallback`()); static TextureAtlasLoader* :target:`New`(:ref:`IOStream`& IOS, const bool& threaded = false, :ref:`GLLoadCallback` LoadCallback = :ref:`GLLoadCallback`()); void :ref:`loadFromFile`(const std::string& TextureAtlasPath = ""); void :ref:`loadFromStream`(:ref:`IOStream`& IOS); void :ref:`loadFromMemory`(const :ref:`Uint8`* Data, const :ref:`Uint32`& DataSize, const std::string& TextureAtlasName); void :ref:`loadFromPack`(:ref:`Pack`* Pack, const std::string& FilePackPath); bool :ref:`isThreaded`() const; void :ref:`setThreaded`(const bool& threaded); const bool& :ref:`isLoaded`() const; const bool& :ref:`isLoading`() const; bool :ref:`updateTextureAtlas`(std::string TextureAtlasPath, std::string ImagesPath, :ref:`Sizei` maxImageSize = Sizei::Zero); bool :ref:`updateTextureAtlas`(); :ref:`Texture`* :ref:`getTexture`(const :ref:`Uint32`& texnum = 0) const; :ref:`Uint32` :ref:`getTexturesLoadedCount`(); :ref:`TextureAtlas`* :ref:`getTextureAtlas`() const; void :ref:`setLoadCallback`(:ref:`GLLoadCallback` LoadCallback); sTextureAtlasHdr :target:`getTextureAtlasHeader`(); void :target:`setTextureFilter`(const :ref:`Texture::Filter`& textureFilter); }; .. _details-class_e_e_1_1_graphics_1_1_texture_atlas_loader: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ The :ref:`Texture ` Atlas Loader loads any previously created :ref:`Texture ` Atlas. Construction ------------ .. index:: pair: function; TextureAtlasLoader .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1a85c7777b173c84e4651f26d965fcd387: .. ref-code-block:: cpp :class: doxyrest-title-code-block TextureAtlasLoader() Creates an empty loader. The texture atlas can be loaded callin any Load\* function. .. index:: pair: function; TextureAtlasLoader .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1af7a52852b05bcfa7c42eba8b5ce66471: .. ref-code-block:: cpp :class: doxyrest-title-code-block TextureAtlasLoader(const std::string& TextureAtlasPath, const bool& threaded = false, :ref:`GLLoadCallback` LoadCallback = :ref:`GLLoadCallback`()) Loads a texture atlas from its path ( the texture atlas binary is expected, not the texture, the ".eta" file ). If the loader is not threaded, it will load the atlas immediately. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - TextureAtlasPath - The texture atlas path. * - threaded - Indicates if the loading is done in another thread. * - LoadCallback - The load notification callback. .. index:: pair: function; TextureAtlasLoader .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1afa1c9f947d5e80afa71a49ad91500d73: .. ref-code-block:: cpp :class: doxyrest-title-code-block TextureAtlasLoader(const :ref:`Uint8`* Data, const :ref:`Uint32`& DataSize, const std::string& TextureAtlasName, const bool& threaded = false, :ref:`GLLoadCallback` LoadCallback = :ref:`GLLoadCallback`()) Loads a texture atlas from memory. If the loader is not threaded, it will load the atlas immediately. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - Data - The texture atlas buffer pointer * - DataSize - The texture atlas buffer pointer size * - TextureAtlasName - Since the texture atlas is loaded from memory, the name can't be obtained from the file name. So it needs to be indicated manually. * - threaded - Indicates if the loading is done in another thread. * - LoadCallback - The load notification callback. .. index:: pair: function; TextureAtlasLoader .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1a9dee7b0493c8bcfa92d24f7d452be55c: .. ref-code-block:: cpp :class: doxyrest-title-code-block TextureAtlasLoader(:ref:`Pack`* Pack, const std::string& FilePackPath, const bool& threaded = false, :ref:`GLLoadCallback` LoadCallback = :ref:`GLLoadCallback`()) Loads a texture atlas from a pack file. If the loader is not threaded, it will load the atlas immediately. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - Pack - The pointer of the pack instance to be used to load the file. * - FilePackPath - The path of the file inside the pack. * - threaded - Indicates if the loading is done in another thread. * - LoadCallback - The load notification callback. .. index:: pair: function; TextureAtlasLoader .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1a594053b2b1b70ad4e8b60cbf745619ed: .. ref-code-block:: cpp :class: doxyrest-title-code-block TextureAtlasLoader(:ref:`IOStream`& IOS, const bool& threaded = false, :ref:`GLLoadCallback` LoadCallback = :ref:`GLLoadCallback`()) Loads a texture atlas from a io stream. If the loader is not threaded, it will load the atlas immediately. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - IOS - The io stream to use for the loading. * - threaded - Indicates if the loading is done in another thread. * - LoadCallback - The load notification callback. Methods ------- .. index:: pair: function; loadFromFile .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1a95274b555dfea69cfe2fb05ede34a65e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void loadFromFile(const std::string& TextureAtlasPath = "") Loads a texture atlas from its path ( the texture atlas binary is expected, not the texture, the ".eta" file ). If the loader is not threaded, it will load the atlas immediately. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - TextureAtlasPath - The texture atlas path. .. index:: pair: function; loadFromStream .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1a616030a07de2b1592e46d0958c074995: .. ref-code-block:: cpp :class: doxyrest-title-code-block void loadFromStream(:ref:`IOStream`& IOS) Loads a texture atlas from a io stream. If the loader is not threaded, it will load the atlas immediately. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - IOS - The io stream to use for the loading. .. index:: pair: function; loadFromMemory .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1ac6f437d0545f2b24dc9e824344e51d2d: .. ref-code-block:: cpp :class: doxyrest-title-code-block void loadFromMemory(const :ref:`Uint8`* Data, const :ref:`Uint32`& DataSize, const std::string& TextureAtlasName) Loads a texture atlas from memory. If the loader is not threaded, it will load the atlas immediately. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - Data - The texture atlas buffer pointer * - DataSize - The texture atlas buffer pointer size * - TextureAtlasName - Since the texture atlas is loaded from memory, the name can't be obtained from the file name. So it needs to be indicated manually. .. index:: pair: function; loadFromPack .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1aa7a9b690af81940feac05efc5642cce3: .. ref-code-block:: cpp :class: doxyrest-title-code-block void loadFromPack(:ref:`Pack`* Pack, const std::string& FilePackPath) Loads a texture atlas from a pack file. If the loader is not threaded, it will load the atlas immediately. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - Pack - The pointer of the pack instance to be used to load the file. * - FilePackPath - The path of the file inside the pack. .. index:: pair: function; isThreaded .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1a26a9c9bf27f392b219efb9b0fe8f6923: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool isThreaded() const .. rubric:: Returns: If the loader is threaded ( asynchronous ). .. index:: pair: function; setThreaded .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1a9eda8f17f84e1466fc00e89a9d73c655: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setThreaded(const bool& threaded) If threaded is true sets the loader as asynchronous. This must be called before the loading is done. .. index:: pair: function; isLoaded .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1a65537f67bddfbe7652cf47a4e7fd9123: .. ref-code-block:: cpp :class: doxyrest-title-code-block const bool& isLoaded() const .. rubric:: Returns: True if the texture atlas is loaded. .. index:: pair: function; isLoading .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1a7649784639a422599623e7f68c1cf4a9: .. ref-code-block:: cpp :class: doxyrest-title-code-block const bool& isLoading() const .. rubric:: Returns: True if the texture atlas is loading. .. index:: pair: function; updateTextureAtlas .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1a4eece1af3c4b14a33ec46175dd6e5615: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool updateTextureAtlas(std::string TextureAtlasPath, std::string ImagesPath, :ref:`Sizei` maxImageSize = Sizei::Zero) The function will check if the texture atlas is updated. Checks if all the images inside the images path are inside the texture atlas, and if they have the same date and size, otherwise it will recreate or update the texture atlas. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - TextureAtlasPath - The path to the texture atlas ( the ".eta" file ) * - ImagesPath - The directory where the source images are located. * - maxImageSize - Maximum texture size allowed for the new texture atlas created. Default value will use the current image size. .. index:: pair: function; updateTextureAtlas .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1a16624eaafc4e50b61eeb985997257018: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool updateTextureAtlas() Rewrites the texture atlas file. Usefull if the TextureRegions where modified and need to be updated inside the texture atlas. .. index:: pair: function; getTexture .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1a6ea7b92db0c5674bd62f2149978c1a54: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Texture`* getTexture(const :ref:`Uint32`& texnum = 0) const .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - texnum - The texture index. A texture atlas can use more than one texture, so it can be 0 to GetTexturesLoadedCount(). Usually a texture atlas corresponds to only one texture, so the texture index is 0. .. rubric:: Returns: The texture that corresponds to the texture atlas. .. index:: pair: function; getTexturesLoadedCount .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1a67dc75200b439a3e2273748e34133d00: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Uint32` getTexturesLoadedCount() .. rubric:: Returns: The number of textures linked to the texture atlas. .. index:: pair: function; getTextureAtlas .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1a50456cb52c6ee7b1aa75ed3a636efdbf: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`TextureAtlas`* getTextureAtlas() const .. rubric:: Returns: The texture atlas instance pointer ( NULL if the atlas isn't loaded yet ). .. index:: pair: function; setLoadCallback .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_loader_1a99f27f71d5ae4913170668a7bac2d600: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setLoadCallback(:ref:`GLLoadCallback` LoadCallback) Sets a load notification callback.