HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
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"
9#include "../geometry/scale.hpp"
10#include "../geometry/vector.hpp"
11#include "../geometry/point.hpp"
12#include <algorithm>
13
14namespace hi::inline v1 {
15
17 alignas(sizeof(float) * 2)
18 // Red, Green in binary32 (native endian).
20
21public:
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
Defined the geo::extent, extent2 and extent3 types.
DOXYGEN BUG.
Definition algorithm.hpp:15
Definition sfloat_rg32.hpp:16