HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
src
hikogui
rapid
sfloat_rg32.hpp
1
// Copyright Take Vos 2020-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
#pragma once
6
7
#include "../rapid/numeric_array.hpp"
8
#include "
../geometry/extent.hpp
"
9
#include "../geometry/scale.hpp"
10
#include "../geometry/vector.hpp"
11
#include "../geometry/point.hpp"
12
#include <algorithm>
13
14
namespace
hi::inline
v1
{
15
16
class
sfloat_rg32
{
17
alignas
(
sizeof
(float) * 2)
18
// Red, Green in binary32 (native endian).
19
std::array<float, 2>
v;
20
21
public
:
22
sfloat_rg32
() =
default
;
23
sfloat_rg32
(
sfloat_rg32
const
&rhs)
noexcept
=
default
;
24
sfloat_rg32
(
sfloat_rg32
&&rhs)
noexcept
=
default
;
25
sfloat_rg32
&operator=(
sfloat_rg32
const
&rhs)
noexcept
=
default
;
26
sfloat_rg32
&operator=(
sfloat_rg32
&&rhs)
noexcept
=
default
;
27
28
explicit
sfloat_rg32
(
f32x4
const
&rhs) noexcept : v{rhs.r(), rhs.g()} {}
29
30
sfloat_rg32
&operator=(
f32x4
const
&rhs)
noexcept
31
{
32
v = {rhs.r(), rhs.g()};
33
return
*
this
;
34
}
35
36
explicit
operator
f32x4
()
const
noexcept
37
{
38
return
f32x4
{std::get<0>(v), std::get<1>(v), 0.0f, 0.0f};
39
}
40
41
sfloat_rg32
(extent2
const
&rhs) noexcept :
sfloat_rg32
{
static_cast<
f32x4
>
(rhs)} {}
42
sfloat_rg32
(
scale2
const
&rhs) noexcept :
sfloat_rg32
{
static_cast<
f32x4
>
(rhs)} {}
43
sfloat_rg32
(
vector2
const
&rhs) noexcept :
sfloat_rg32
{
static_cast<
f32x4
>
(rhs)} {}
44
sfloat_rg32
(
point2
const
&rhs) noexcept :
sfloat_rg32
{
static_cast<
f32x4
>
(rhs)} {}
45
46
[[nodiscard]]
friend
bool
operator==(
sfloat_rg32
const
&lhs,
sfloat_rg32
const
&rhs)
noexcept
=
default
;
47
};
48
49
}
// namespace hi::inline v1
extent.hpp
Defined the geo::extent, extent2 and extent3 types.
v1
DOXYGEN BUG.
Definition
algorithm.hpp:15
v1::geo::point< float, 2 >
v1::geo::scale< 2 >
v1::geo::vector< float, 2 >
v1::numeric_array< float, 4 >
v1::sfloat_rg32
Definition
sfloat_rg32.hpp:16
std::array
Generated on Mon Apr 22 2024 12:52:03 for HikoGUI by
1.10.0