lxgui
Loading...
Searching...
No Matches
gui_material.hpp
1#ifndef LXGUI_GUI_MATERIAL_HPP
2#define LXGUI_GUI_MATERIAL_HPP
3
4#include "lxgui/gui_bounds2.hpp"
5#include "lxgui/gui_vector2.hpp"
6#include "lxgui/lxgui.hpp"
7#include "lxgui/utils.hpp"
8
9namespace lxgui::gui {
10
16class material {
17public:
18 enum class wrap { repeat, clamp };
19
20 enum class filter { none, linear };
21
26 explicit material(bool is_atlas);
27
29 virtual ~material() = default;
30
32 material(const material&) = delete;
33
35 material(material&&) = delete;
36
38 material& operator=(const material&) = delete;
39
42
47 virtual bounds2f get_rect() const = 0;
48
60 virtual vector2ui get_canvas_dimensions() const = 0;
61
66 virtual bool uses_same_texture(const material& other) const = 0;
67
75 vector2f get_canvas_uv(const vector2f& texture_uv, bool from_normalized) const;
76
84 vector2f get_local_uv(const vector2f& canvas_uv, bool as_normalized) const;
85
90 bool is_in_atlas() const;
91
92protected:
93 bool is_atlas_ = false;
94};
95
96} // namespace lxgui::gui
97
98#endif
A class that holds rendering data.
material(material &&)=delete
Non-movable.
material(const material &)=delete
Non-copiable.
virtual bool uses_same_texture(const material &other) const =0
Checks if another material is based on the same texture as the current material.
vector2f get_local_uv(const vector2f &canvas_uv, bool as_normalized) const
Returns local UV coordinates on the texture, given canvas UV coordinates.
material & operator=(material &&)=delete
Non-movable.
virtual bounds2f get_rect() const =0
Returns the pixel rect in pixels of the canvas containing this texture (if any).
vector2f get_canvas_uv(const vector2f &texture_uv, bool from_normalized) const
Returns normalized UV coordinates on the canvas, given local UV coordinates.
virtual ~material()=default
Destructor.
material & operator=(const material &)=delete
Non-copiable.
bool is_in_atlas() const
Checks if the material is embedded in an atlas.
virtual vector2ui get_canvas_dimensions() const =0
Returns the physical dimensions (in pixels) of the canvas containing this texture (if any).