|
HikoGUI
A low latency retained GUI
|
#include <TTauri/Foundation/vec.hpp>
Public Member Functions | |
| tt_force_inline | vec (vec const &rhs) noexcept=default |
| tt_force_inline vec & | operator= (vec const &rhs) noexcept=default |
| tt_force_inline | vec (vec &&rhs) noexcept=default |
| tt_force_inline vec & | operator= (vec &&rhs) noexcept=default |
| tt_force_inline | vec (__m128 rhs) noexcept |
| tt_force_inline vec & | operator= (__m128 rhs) noexcept |
| tt_force_inline | operator __m128 () const noexcept |
| tt_force_inline | vec (std::array< float, 4 > const &rhs) noexcept |
| tt_force_inline vec & | operator= (std::array< float, 4 > const &rhs) noexcept |
| tt_force_inline | operator std::array< float, 4 > () const noexcept |
| tt_force_inline | vec (std::array< float, 2 > const &rhs) noexcept |
| tt_force_inline vec & | operator= (std::array< float, 2 > const &rhs) noexcept |
| tt_force_inline | operator std::array< float, 2 > () const noexcept |
| tt_force_inline | vec (std::array< float16, 4 > const &rhs) noexcept |
| tt_force_inline vec & | operator= (std::array< float16, 4 > const &rhs) noexcept |
| tt_force_inline | operator std::array< float16, 4 > () const noexcept |
| template<typename T , std::enable_if_t< std::is_arithmetic_v< T >, int > = 0> | |
| tt_force_inline | vec (T rhs) noexcept |
| Initialize a vec with all elements set to a value. | |
| tt_force_inline vec & | operator= (float rhs) noexcept |
| Initialize a vec with all elements set to a value. | |
| tt_force_inline | vec (float x, float y, float z=0.0f, float w=0.0f) noexcept |
| Create a vec out of 2 to 4 values. | |
| tt_force_inline | vec (double x, double y) noexcept |
| tt_force_inline | vec (double x, double y, double z, double w=0.0f) noexcept |
| tt_force_inline | vec (int x, int y, int z=0, int w=0) noexcept |
| template<size_t I> | |
| tt_force_inline vec & | set (float rhs) noexcept |
| template<size_t I> | |
| tt_force_inline float | get () const noexcept |
| tt_force_inline bool | is_point () const noexcept |
| tt_force_inline bool | is_vector () const noexcept |
| tt_force_inline bool | is_opaque () const noexcept |
| tt_force_inline bool | is_transparent () const noexcept |
| constexpr size_t | size () const noexcept |
| tt_force_inline float | operator[] (size_t i) const noexcept |
| tt_force_inline vec & | x (float rhs) noexcept |
| tt_force_inline vec & | y (float rhs) noexcept |
| tt_force_inline vec & | z (float rhs) noexcept |
| tt_force_inline vec & | w (float rhs) noexcept |
| tt_force_inline vec & | r (float rhs) noexcept |
| tt_force_inline vec & | g (float rhs) noexcept |
| tt_force_inline vec & | b (float rhs) noexcept |
| tt_force_inline vec & | a (float rhs) noexcept |
| tt_force_inline vec & | width (float rhs) noexcept |
| tt_force_inline vec & | height (float rhs) noexcept |
| tt_force_inline vec & | depth (float rhs) noexcept |
| tt_force_inline float | x () const noexcept |
| tt_force_inline float | y () const noexcept |
| tt_force_inline float | z () const noexcept |
| tt_force_inline float | w () const noexcept |
| tt_force_inline float | r () const noexcept |
| tt_force_inline float | g () const noexcept |
| tt_force_inline float | b () const noexcept |
| tt_force_inline float | a () const noexcept |
| tt_force_inline float | width () const noexcept |
| tt_force_inline float | height () const noexcept |
| tt_force_inline float | depth () const noexcept |
| tt_force_inline vec & | operator+= (vec const &rhs) noexcept |
| tt_force_inline vec & | operator-= (vec const &rhs) noexcept |
| tt_force_inline vec & | operator*= (vec const &rhs) noexcept |
| tt_force_inline vec & | operator/= (vec const &rhs) noexcept |
| vec | resize2DRetainingAspectRatio (vec const &rhs) noexcept |
| Resize an extent while retaining aspect ratio. | |
| template<char a, char b, char c, char d> | |
| tt_force_inline vec | swizzle () const noexcept |
Static Public Member Functions | |
| template<typename T , std::enable_if_t< std::is_arithmetic_v< T >, int > = 0> | |
| static tt_force_inline vec | make_x (T x) noexcept |
| template<typename T , std::enable_if_t< std::is_arithmetic_v< T >, int > = 0> | |
| static tt_force_inline vec | make_y (T y) noexcept |
| template<typename T , std::enable_if_t< std::is_arithmetic_v< T >, int > = 0> | |
| static tt_force_inline vec | make_z (T z) noexcept |
| template<typename T , std::enable_if_t< std::is_arithmetic_v< T >, int > = 0> | |
| static tt_force_inline vec | make_w (T w) noexcept |
| static tt_force_inline vec | point (float x=0.0f, float y=0.0f, float z=0.0f) noexcept |
| Create a point out of 2 to 4 values. | |
| static tt_force_inline vec | point (int x=0.0f, int y=0.0f, int z=0.0f) noexcept |
| static tt_force_inline vec | point (vec rhs) noexcept |
| Create a point out of 2 to 4 values. | |
| static tt_force_inline vec | origin () noexcept |
| Get a origin vector(0.0, 0.0, 0.0, 1.0). | |
| static tt_force_inline vec | color (float r, float g, float b, float a=1.0f) noexcept |
| Create a color out of 3 to 4 values. | |
| static vec | colorFromSRGB (float r, float g, float b, float a=1.0f) noexcept |
| static vec | colorFromSRGB (uint8_t r, uint8_t g, uint8_t b, uint8_t a=255) noexcept |
| static vec | colorFromSRGB (std::string_view str) |
| template<char a, char b, char c, char d> | |
| static constexpr int | swizzle_permute_mask () noexcept |
| template<char a, char b, char c, char d> | |
| static constexpr int | swizzle_zero_mask () noexcept |
| template<char a, char b, char c, char d> | |
| static constexpr int | swizzle_number_mask () noexcept |
Friends | |
| tt_force_inline friend vec | operator- (vec const &rhs) noexcept |
| tt_force_inline friend vec | operator+ (vec const &lhs, vec const &rhs) noexcept |
| tt_force_inline friend vec | operator- (vec const &lhs, vec const &rhs) noexcept |
| tt_force_inline friend vec | operator* (vec const &lhs, vec const &rhs) noexcept |
| template<typename T , std::enable_if_t< std::is_arithmetic_v< T >, int > = 0> | |
| tt_force_inline friend vec | operator* (vec const &lhs, T const &rhs) noexcept |
| template<typename T , std::enable_if_t< std::is_arithmetic_v< T >, int > = 0> | |
| tt_force_inline friend vec | operator* (T const &lhs, vec const &rhs) noexcept |
| tt_force_inline friend vec | operator/ (vec const &lhs, vec const &rhs) noexcept |
| tt_force_inline friend vec | max (vec const &lhs, vec const &rhs) noexcept |
| tt_force_inline friend vec | min (vec const &lhs, vec const &rhs) noexcept |
| tt_force_inline friend vec | abs (vec const &rhs) noexcept |
| tt_force_inline friend int | eq (vec const &lhs, vec const &rhs) noexcept |
| Equal to. | |
| tt_force_inline friend int | ne (vec const &lhs, vec const &rhs) noexcept |
| Not equal to. | |
| tt_force_inline friend bool | operator== (vec const &lhs, vec const &rhs) noexcept |
| tt_force_inline friend bool | operator!= (vec const &lhs, vec const &rhs) noexcept |
| tt_force_inline friend int | operator< (vec const &lhs, vec const &rhs) noexcept |
| Less than. | |
| tt_force_inline friend int | operator<= (vec const &lhs, vec const &rhs) noexcept |
| Less than or equal. | |
| tt_force_inline friend int | operator> (vec const &lhs, vec const &rhs) noexcept |
| Greater than. | |
| tt_force_inline friend int | operator>= (vec const &lhs, vec const &rhs) noexcept |
| Greater than or equal. | |
| tt_force_inline friend __m128 | _length_squared (vec const &rhs) noexcept |
| tt_force_inline friend float | length_squared (vec const &rhs) noexcept |
| tt_force_inline friend float | length (vec const &rhs) noexcept |
| tt_force_inline friend vec | normalize (vec const &rhs) noexcept |
| tt_force_inline friend vec | homogeneous_divide (vec const &rhs) noexcept |
| tt_force_inline friend float | dot (vec const &lhs, vec const &rhs) noexcept |
| tt_force_inline friend vec | reciprocal (vec const &rhs) noexcept |
| template<bool nx, bool ny, bool nz, bool nw> | |
| vec | neg (vec const &rhs) noexcept |
| tt_force_inline friend vec | hadd (vec const &lhs, vec const &rhs) noexcept |
| tt_force_inline friend vec | hsub (vec const &lhs, vec const &rhs) noexcept |
| tt_force_inline friend float | viktor_cross (vec const &lhs, vec const &rhs) noexcept |
| vec | cross (vec const &lhs, vec const &rhs) noexcept |
| tt_force_inline friend vec | normal (vec const &rhs) noexcept |
| Calculate the 2D normal on a 2D vector. | |
| vec | ceil (vec const &rhs) noexcept |
| vec | floor (vec const &rhs) noexcept |
| vec | round (vec const &rhs) noexcept |
| std::array< vec, 4 > | transpose (vec col0, vec col1, vec col2, vec col3) noexcept |
| vec | midpoint (vec const &p1, vec const &p2) noexcept |
| Find a point at the midpoint between two points. | |
| vec | desaturate (vec const &color, float brightness) noexcept |
| vec | composit (vec const &under, vec const &over) noexcept |
| vec | reflect_point (vec const &p, vec const anchor) noexcept |
| Find the point on the other side and at the same distance of an anchor-point. | |
| std::string | to_string (vec const &rhs) noexcept |
| std::ostream friend & | operator<< (std::ostream &lhs, vec const &rhs) noexcept |
| template<std::size_t I> | |
| tt_force_inline friend float | get (vec const &rhs) noexcept |
A 4D vector.
If you need a 2D or 3D vector, point or color, you can use this vector class as a homogenious coordinate.
This class supports swizzeling. Swizzeling is done using member functions which will return a vec. The name of the member function consists of 2 to 4 of the following characters: 'x', 'y', 'z', 'w', 'r', 'g', 'b', 'a', '0' & '1'. If the swizzle member function name would start with a '0' or '1' character it will be prefixed with an underscore '_'.
Since swizzle member functions always return a 4D vec, the third and forth element will default to '0' and 'w'. This allows a 2D vector to maintain its homogeniousness, or a color to maintain its alpha value.
|
inlineexplicitnoexcept |
Initialize a vec with all elements set to a value.
Useful as a scalar converter, when combined with an arithmatic operator.
|
inlinenoexcept |
Create a vec out of 2 to 4 values.
This vector is used as a homogenious coordinate, meaning:
When this vector is used for color then:
|
inlinestaticnoexcept |
Create a color out of 3 to 4 values.
If you use this vector as a color:
|
inlinenoexcept |
Initialize a vec with all elements set to a value.
Useful as a scalar converter, when combined with an arithmatic operator.
|
inlinestaticnoexcept |
Get a origin vector(0.0, 0.0, 0.0, 1.0).
The origin of a window or image are in the left-bottom corner. The center of the first pixel in the left-bottom corner is at coordinate (0.5, 0.5). The origin of a glyph lies on the crossing of the baseline and left-side-bearing. Paths have a specific location of the origin.
|
inlinestaticnoexcept |
Create a point out of 2 to 4 values.
This vector is used as a homogeneous coordinate, meaning:
When this vector is used for color then:
Create a point out of 2 to 4 values.
This vector is used as a homogeneous coordinate, meaning:
When this vector is used for color then:
Resize an extent while retaining aspect ratio.
| rhs | The extent to match. |
Equal to.
Find a point at the midpoint between two points.
Not equal to.
Less than.
Less than or equal.
Greater than.
Greater than or equal.
Find the point on the other side and at the same distance of an anchor-point.