Class TextureCache¶
Defined in File texture.hpp
Class Documentation¶
-
class
legion::rendering
::
TextureCache
¶ Data cache for loading, storing and managing textures.
Public Static Functions
-
static texture_handle
create_texture
(const std::string &name, const fs::view &file, texture_import_settings settings = default_texture_settings)¶ Create a new texture and load it from a file if a texture with the same name doesn’t exist yet.
- Return
texture_handle A valid handle to the newly created texture if it succeeds, invalid_texture_handle if it fails.
- Parameters
name
: Identifying name for the texture.file
: File to load from.settings
: Settings to pass on to the import pipeline.
-
static texture_handle
create_texture
(const fs::view &file, texture_import_settings settings = default_texture_settings)¶
-
static texture_handle
create_texture
(const std::string &name, math::ivec2 size, texture_import_settings settings = default_texture_settings)¶
-
static texture_handle
create_texture_from_image
(const std::string &name, texture_import_settings settings = default_texture_settings)¶ Create a new texture from an image if a texture with the same name doesn’t exist yet.
- Return
texture_handle A valid handle to the newly created texture if it succeeds, invalid_texture_handle if it fails.
- Parameters
name
: Name of the image and identifying name for the texture.settings
: Settings to pass on to the import pipeline.
-
static texture_handle
create_texture_from_image
(image_handle image, texture_import_settings settings = default_texture_settings)¶ Create a new texture from an image if a texture with the same name doesn’t exist yet.
- Return
texture_handle A valid handle to the newly created texture if it succeeds, invalid_texture_handle if it fails.
- Parameters
image_handle
: Image to load from. The identifying name for the texture will be the same as the name of the image.settings
: Settings to pass on to the import pipeline.
-
static texture_handle
get_handle
(const std::string &name)¶ Returns a handle to a texture with a certain name. Will return invalid_texture_handle if the requested texture doesn’t exist.
-
static texture_handle
get_handle
(id_type id)¶ Returns a handle to a texture with a certain name. Will return invalid_texture_handle if the requested texture doesn’t exist.
- Parameters
id
: Name hash
-
static texture_handle