template<class AllocationPolicy>
glpp::core::object::texture_atlas_entry_t class

helper class representing an entry of a texture_atlas_t object

texture_atlas_entry_t is a proxy class for easy access to single texture entrys inside a texture_atlas_t object. They are created by the access member functions of texture_atlas_t. This class facilitates access to texture entries by owning a instance of a key_t. On access the entry will be fetched from the texture_atlas_t with the use of this key.

Public types

using key_t = typename AllocationPolicy::key_t
key type of the assiciated texture_atlas_t

Constructors, destructors, conversion operators

texture_atlas_entry_t(texture_atlas_entry_t&& mov) defaulted
move constructor
texture_atlas_entry_t(const texture_atlas_entry_t& cpy) defaulted
copy constructor

Public functions

auto fetch(const std::string_view name, const std::string_view uv) const -> std::string
return string to fetch a texel inside shader code
auto fetch(const std::string_view name, const glm::vec2 uv) const -> std::string
return string to fetch a texel inside shader code
auto key() const -> key_t
return key owned by texture_atlas_entry_t
auto operator=(texture_atlas_entry_t&& mov) -> texture_atlas_entry_t& deleted
move assignment operator
auto operator=(const texture_atlas_entry_t& cpy) -> texture_atlas_entry_t& deleted
copy assignment operator
template<class PixelFormat>
void update(const image_t<PixelFormat>& image)
update pixel data of a texture entry
auto valid() const -> bool
check if texture_entry_t object is still contained in the texture_atlas_t object

Function documentation

template<class AllocationPolicy>
glpp::core::object::texture_atlas_entry_t<AllocationPolicy>::texture_atlas_entry_t(texture_atlas_entry_t&& mov) defaulted

move constructor

texture_atlas_entry_t is move constructible.

template<class AllocationPolicy>
glpp::core::object::texture_atlas_entry_t<AllocationPolicy>::texture_atlas_entry_t(const texture_atlas_entry_t& cpy) defaulted

copy constructor

texture_atlas_entry_t is copy constructible.

template<class AllocationPolicy>
std::string glpp::core::object::texture_atlas_entry_t<AllocationPolicy>::fetch(const std::string_view name, const std::string_view uv) const

return string to fetch a texel inside shader code

Parameters
name [in] name of the texture_atlas_t binding to the renderer
uv [in] either name of a shader variable of type vec2 or a vec2 value
Returns std::string with GLSL code

This function will generate shader code, that can be used to fetch pixel values from a texture atlas.

template<class AllocationPolicy>
std::string glpp::core::object::texture_atlas_entry_t<AllocationPolicy>::fetch(const std::string_view name, const glm::vec2 uv) const

return string to fetch a texel inside shader code

Parameters
name [in] name of the texture_atlas_t binding to the renderer
uv [in] value for the uv coordinates that shall be fetched in the shader
Returns std::string with GLSL code

This function will generate shader code, that can be used to fetch pixel values from a texture atlas.

template<class AllocationPolicy>
key_t glpp::core::object::texture_atlas_entry_t<AllocationPolicy>::key() const

return key owned by texture_atlas_entry_t

Texture entries in texture_atlas_t are identified by keys. This class facilitates access to texture entries by owning a instance of a key_t. On access the entry will be fetched from the texture_atlas_t with the use of this key.

template<class AllocationPolicy>
texture_atlas_entry_t& glpp::core::object::texture_atlas_entry_t<AllocationPolicy>::operator=(texture_atlas_entry_t&& mov) deleted

move assignment operator

texture_atlas_entry_t is not move assignable.

template<class AllocationPolicy>
texture_atlas_entry_t& glpp::core::object::texture_atlas_entry_t<AllocationPolicy>::operator=(const texture_atlas_entry_t& cpy) deleted

copy assignment operator

texture_atlas_entry_t is not copy assignable.

template<class AllocationPolicy>
template<class PixelFormat>
void glpp::core::object::texture_atlas_entry_t<AllocationPolicy>::update(const image_t<PixelFormat>& image)

update pixel data of a texture entry

Parameters
image [in] new pixel data

This function will overwrite the pixel data of the texture entry with the pixel data of the image parameter. Resizing on update might not be possible with every AllocationPolicy policy.

template<class AllocationPolicy>
bool glpp::core::object::texture_atlas_entry_t<AllocationPolicy>::valid() const

check if texture_entry_t object is still contained in the texture_atlas_t object

A texture entry might be erased from the texture_atlas_t. This function checks if the key, that is owned by the instance of texture_entry_t is contained in the associated texture_atlas_t.