Parses raw texture files and stiches them into a large altas.
More...
#include <TextureAtlas.hpp>
|
| struct | Info |
| | Information about textures stored in atlas. More...
|
| |
| struct | Sheet |
| | A sheet of textures in the atlas. More...
|
| |
|
| | TextureAtlas () |
| | Constructor.
|
| |
| virtual | ~TextureAtlas () |
| | Destructor.
|
| |
| void | add (const std::string &file) |
| | Add a single file.
|
| |
| void | add_from_vfs () |
| | Loads all atlas textures in the vfs.
|
| |
| void | save () |
| | Save all created atlas' to disk.
|
| |
| void | clear () |
| | Clear all data.
|
| |
| bool | contains (const std::string &key) |
| | Check if atlas contains a texture.
|
| |
| meta::optional_ref< Info > | query (const std::string &key) |
| | Get data about texture in atlas.
|
| |
| meta::vector< std::string > | keys () |
| | Get a list of keys in the cache.
|
| |
|
| template<meta::is_arithmetic Type> |
| static float | map_x_texel (const Type x, const Type width) |
| | Takes in a x positon texture coord and maps it to a texel.
|
| |
| template<meta::is_arithmetic Type> |
| static float | map_y_texel (const Type y, const Type height) |
| | Takes in a y positon texture coord and maps it to a texel.
|
| |
Parses raw texture files and stiches them into a large altas.
Definition at line 29 of file TextureAtlas.hpp.
◆ TextureAtlas() [1/3]
| galaxy::resource::TextureAtlas::TextureAtlas |
( |
| ) |
|
◆ ~TextureAtlas()
| galaxy::resource::TextureAtlas::~TextureAtlas |
( |
| ) |
|
|
virtual |
◆ TextureAtlas() [2/3]
| galaxy::resource::TextureAtlas::TextureAtlas |
( |
TextureAtlas && | | ) |
|
|
privatedelete |
◆ TextureAtlas() [3/3]
| galaxy::resource::TextureAtlas::TextureAtlas |
( |
const TextureAtlas & | | ) |
|
|
privatedelete |
◆ add()
| void galaxy::resource::TextureAtlas::add |
( |
const std::string & | file | ) |
|
◆ add_from_vfs()
| void galaxy::resource::TextureAtlas::add_from_vfs |
( |
| ) |
|
◆ save()
| void galaxy::resource::TextureAtlas::save |
( |
| ) |
|
Save all created atlas' to disk.
WARNING: This function will slow down the more atlas' there are to save.
Definition at line 148 of file TextureAtlas.cpp.
◆ clear()
| void galaxy::resource::TextureAtlas::clear |
( |
| ) |
|
◆ contains()
| bool galaxy::resource::TextureAtlas::contains |
( |
const std::string & | key | ) |
|
|
nodiscard |
Check if atlas contains a texture.
- Parameters
-
| key | Identifier of texture to look for. |
- Returns
- True if found.
Definition at line 168 of file TextureAtlas.cpp.
◆ query()
| meta::optional_ref< TextureAtlas::Info > galaxy::resource::TextureAtlas::query |
( |
const std::string & | key | ) |
|
|
nodiscard |
◆ map_x_texel()
template<meta::is_arithmetic Type>
| float galaxy::resource::TextureAtlas::map_x_texel |
( |
const Type | x, |
|
|
const Type | width ) |
|
inlinestaticnodiscard |
Takes in a x positon texture coord and maps it to a texel.
- Template Parameters
-
| Type | Type of the variable. |
- Parameters
-
| x | Position of texture coord. |
| width | Texture width. |
- Returns
- OpenGL shader compatible texel.
Definition at line 233 of file TextureAtlas.hpp.
◆ map_y_texel()
template<meta::is_arithmetic Type>
| float galaxy::resource::TextureAtlas::map_y_texel |
( |
const Type | y, |
|
|
const Type | height ) |
|
inlinestaticnodiscard |
Takes in a y positon texture coord and maps it to a texel.
- Template Parameters
-
| Type | Type of the variable. |
- Parameters
-
| y | Position of texture coord. |
| height | Texture height. |
- Returns
- OpenGL shader compatible texel.
Definition at line 246 of file TextureAtlas.hpp.
◆ keys()
| meta::vector< std::string > galaxy::resource::TextureAtlas::keys |
( |
| ) |
|
|
nodiscard |
Get a list of keys in the cache.
- Returns
- A vector of strings.
Definition at line 185 of file TextureAtlas.cpp.
◆ operator=() [1/2]
Move assignment operator.
◆ operator=() [2/2]
Copy assignment operator.
◆ init()
| void galaxy::resource::TextureAtlas::init |
( |
| ) |
|
|
private |
◆ m_max_bindings
| int galaxy::resource::TextureAtlas::m_max_bindings |
|
private |
◆ m_size
| int galaxy::resource::TextureAtlas::m_size |
|
private |
◆ m_sheets
| meta::vector<std::unique_ptr<Sheet> > galaxy::resource::TextureAtlas::m_sheets |
|
private |
◆ m_data
| robin_hood::unordered_flat_map<std::string, Info> galaxy::resource::TextureAtlas::m_data |
|
private |
◆ m_vao
| graphics::VertexArray galaxy::resource::TextureAtlas::m_vao |
|
private |
Default vertex array to use when building an atlas.
Definition at line 224 of file TextureAtlas.hpp.
◆ m_transform
Default transform to use when building an atlas.
Definition at line 229 of file TextureAtlas.hpp.
The documentation for this class was generated from the following files: