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