HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
sfloat_rgb32.hpp
Go to the documentation of this file.
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
9#pragma once
10
11#include "../SIMD/module.hpp"
12#include <algorithm>
13
14namespace hi::inline v1 {
15
21 // Red, Green, Blue in binary32 (native endian).
23
24public:
25 sfloat_rgb32() = default;
26 sfloat_rgb32(sfloat_rgb32 const &rhs) noexcept = default;
27 sfloat_rgb32(sfloat_rgb32 &&rhs) noexcept = default;
28 sfloat_rgb32 &operator=(sfloat_rgb32 const &rhs) noexcept = default;
29 sfloat_rgb32 &operator=(sfloat_rgb32 &&rhs) noexcept = default;
30
31 sfloat_rgb32(f32x4 const &rhs) noexcept : v{rhs.r(), rhs.g(), rhs.b()} {}
32
33 sfloat_rgb32 &operator=(f32x4 const &rhs) noexcept
34 {
35 v = {rhs.r(), rhs.g(), rhs.b()};
36 return *this;
37 }
38
39 operator f32x4() const noexcept
40 {
41 return f32x4{std::get<0>(v), std::get<1>(v), std::get<2>(v), 0.0f};
42 }
43
44 sfloat_rgb32(point3 const &rhs) noexcept : sfloat_rgb32(static_cast<f32x4>(rhs)) {}
45
46 sfloat_rgb32 &operator=(point3 const &rhs) noexcept
47 {
48 return *this = static_cast<f32x4>(rhs);
49 }
50
51 operator point3() const noexcept
52 {
53 return point3{f32x4{*this}};
54 }
55
56 [[nodiscard]] friend bool operator==(sfloat_rgb32 const &lhs, sfloat_rgb32 const &rhs) noexcept = default;
57};
58
59} // namespace hi::inline v1
DOXYGEN BUG.
Definition algorithm.hpp:13
3 x float32 pixel format.
Definition sfloat_rgb32.hpp:20