HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
src
ttauri
color
sfloat_rgb32.hpp
1
// Copyright Take Vos 2020.
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 "../geometry/numeric_array.hpp"
8
#include <algorithm>
9
10
namespace
tt {
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
v = {rhs.r(), rhs.g(), rhs.b()};
27
return
*
this
;
28
}
29
30
operator
f32x4
()
const
noexcept
{
31
return
f32x4
{std::get<0>(v), std::get<1>(v), std::get<2>(v), 0.0f};
32
}
33
34
sfloat_rgb32
(
point3
const
&rhs) noexcept :
sfloat_rgb32
(
static_cast<
f32x4
>
(rhs)) {}
35
36
sfloat_rgb32
&operator=(
point3
const
&rhs)
noexcept
37
{
38
return
*
this
=
static_cast<
f32x4
>
(rhs);
39
}
40
41
operator
point3
()
const
noexcept
42
{
43
return
point3
{
f32x4
{*
this
}};
44
}
45
46
[[nodiscard]]
friend
bool
operator==(
sfloat_rgb32
const
&lhs,
sfloat_rgb32
const
&rhs)
noexcept
{
47
return
lhs.v == rhs.v;
48
}
49
[[nodiscard]]
friend
bool
operator!=(
sfloat_rgb32
const
&lhs,
sfloat_rgb32
const
&rhs)
noexcept
{
50
return
!(lhs == rhs);
51
}
52
};
53
54
}
tt::sfloat_rgb32
Definition
sfloat_rgb32.hpp:12
tt::numeric_array< float, 4 >
tt::geo::point< 3 >
std::array
Generated on Mon Apr 22 2024 12:53:41 for HikoGUI by
1.10.0