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 "../macros.hpp"
13#include <algorithm>
14
15namespace hi::inline v1 {
16
22 // Red, Green, Blue in binary32 (native endian).
24
25public:
26 sfloat_rgb32() = default;
27 sfloat_rgb32(sfloat_rgb32 const &rhs) noexcept = default;
28 sfloat_rgb32(sfloat_rgb32 &&rhs) noexcept = default;
29 sfloat_rgb32 &operator=(sfloat_rgb32 const &rhs) noexcept = default;
30 sfloat_rgb32 &operator=(sfloat_rgb32 &&rhs) noexcept = default;
31
32 sfloat_rgb32(f32x4 const &rhs) noexcept : v{rhs.r(), rhs.g(), rhs.b()} {}
33
34 sfloat_rgb32 &operator=(f32x4 const &rhs) noexcept
35 {
36 v = {rhs.r(), rhs.g(), rhs.b()};
37 return *this;
38 }
39
40 operator f32x4() const noexcept
41 {
42 return f32x4{std::get<0>(v), std::get<1>(v), std::get<2>(v), 0.0f};
43 }
44
45 sfloat_rgb32(point3 const &rhs) noexcept : sfloat_rgb32(static_cast<f32x4>(rhs)) {}
46
47 sfloat_rgb32 &operator=(point3 const &rhs) noexcept
48 {
49 return *this = static_cast<f32x4>(rhs);
50 }
51
52 operator point3() const noexcept
53 {
54 return point3{f32x4{*this}};
55 }
56
57 [[nodiscard]] friend bool operator==(sfloat_rgb32 const &lhs, sfloat_rgb32 const &rhs) noexcept = default;
58};
59
60} // namespace hi::inline v1
DOXYGEN BUG.
Definition algorithm.hpp:16
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
A high-level geometric point Part of the high-level vec, point, mat and color types.
Definition point3.hpp:27
3 x float32 pixel format.
Definition sfloat_rgb32.hpp:21