HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
glyph_atlas_info.hpp
1// Copyright Take Vos 2021.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5
6#pragma once
7
8#include "../geometry/module.hpp"
9
10namespace hi::inline v1 {
11
13public:
20
23 extent2 size;
24
28
34
35 [[nodiscard]] constexpr bool empty() const noexcept
36 {
37 return size == extent2{};
38 }
39
40 [[nodiscard]] constexpr operator bool() const noexcept
41 {
42 return not empty();
43 }
44
45 constexpr glyph_atlas_info() noexcept = default;
46
54 constexpr glyph_atlas_info(point3 position, extent2 size, scale2 border_scale, scale2 texture_coordinate_scale) noexcept :
55 position(position),
56 size(size),
57 border_scale(border_scale),
58 texture_coordinates(bounding_rectangle(texture_coordinate_scale * rectangle{position, size}))
59 {
60 hi_axiom(position == floor(position));
61 hi_axiom(size == ceil(size));
62 }
63};
64
65} // namespace hi::inline v1
#define hi_axiom(expression,...)
Specify an axiom; an expression that is true.
Definition assert.hpp:253
DOXYGEN BUG.
Definition algorithm.hpp:13
Definition glyph_atlas_info.hpp:12
scale2 border_scale
The scaling factor used for scaling a quad to include the border.
Definition glyph_atlas_info.hpp:27
point3 position
pixel coordinates.
Definition glyph_atlas_info.hpp:19
extent2 size
Size of the glyph in pixels in the texture map.
Definition glyph_atlas_info.hpp:23
aarectangle texture_coordinates
The position and size of the glyph in the texture in UV coordinates.
Definition glyph_atlas_info.hpp:33
A rectangle / parallelogram in 3D space.
Definition rectangle.hpp:20