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/point.hpp"
9#include "../geometry/extent.hpp"
10#include "../geometry/scale.hpp"
11#include "../geometry/axis_aligned_rectangle.hpp"
12
13namespace hi::inline v1 {
14
16public:
23
27
31
37
38 [[nodiscard]] constexpr bool empty() const noexcept
39 {
40 return size == extent2{};
41 }
42
43 [[nodiscard]] constexpr operator bool() const noexcept
44 {
45 return not empty();
46 }
47
48 constexpr glyph_atlas_info() noexcept = default;
49
57 constexpr glyph_atlas_info(point3 position, extent2 size, scale2 border_scale, scale2 texture_coordinate_scale) noexcept :
58 position(position),
59 size(size),
60 border_scale(border_scale),
61 texture_coordinates(bounding_rectangle(texture_coordinate_scale * rectangle{position, size}))
62 {
63 hi_axiom(position == floor(position));
64 hi_axiom(size == ceil(size));
65 }
66};
67
68} // namespace hi::inline v1
DOXYGEN BUG.
Definition algorithm.hpp:15
Class which represents an axis-aligned rectangle.
Definition axis_aligned_rectangle.hpp:20
A rectangle / parallelogram in 3D space.
Definition rectangle.hpp:20
Definition glyph_atlas_info.hpp:15
scale2 border_scale
The scaling factor used for scaling a quad to include the border.
Definition glyph_atlas_info.hpp:30
point3 position
pixel coordinates.
Definition glyph_atlas_info.hpp:22
extent2 size
Size of the glyph in pixels in the texture map.
Definition glyph_atlas_info.hpp:26
aarectangle texture_coordinates
The position and size of the glyph in the texture in UV coordinates.
Definition glyph_atlas_info.hpp:36